@websy/websy-designs 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/authHelper.js +1 -1
- package/dist/server/helpers/v1/pgHelper.js +49 -0
- package/dist/server/routes/v1/shop.js +1 -0
- package/dist/websy-designs-es6.debug.js +563 -282
- package/dist/websy-designs-es6.js +829 -466
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +592 -302
- package/dist/websy-designs.js +863 -489
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -1949,6 +1949,29 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1949
1949
|
|
|
1950
1950
|
this.updateHeader(item);
|
|
1951
1951
|
}
|
|
1952
|
+
}, {
|
|
1953
|
+
key: "setValue",
|
|
1954
|
+
value: function setValue(value) {
|
|
1955
|
+
var _this12 = this;
|
|
1956
|
+
|
|
1957
|
+
this.selectedItems = [];
|
|
1958
|
+
|
|
1959
|
+
if (Array.isArray(value)) {
|
|
1960
|
+
this.options.items.forEach(function (d) {
|
|
1961
|
+
if (value.indexOf(d.value) !== -1) {
|
|
1962
|
+
_this12.selectedItems.push(d.index);
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
} else {
|
|
1966
|
+
this.options.items.forEach(function (d) {
|
|
1967
|
+
if (d.value === value) {
|
|
1968
|
+
_this12.selectedItems.push(d.index);
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
this.render();
|
|
1974
|
+
}
|
|
1952
1975
|
}, {
|
|
1953
1976
|
key: "updateHeader",
|
|
1954
1977
|
value: function updateHeader(item) {
|
|
@@ -2403,7 +2426,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2403
2426
|
}, {
|
|
2404
2427
|
key: "render",
|
|
2405
2428
|
value: function render() {
|
|
2406
|
-
var
|
|
2429
|
+
var _this13 = this;
|
|
2407
2430
|
|
|
2408
2431
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2409
2432
|
|
|
@@ -2411,7 +2434,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2411
2434
|
this.measureItems();
|
|
2412
2435
|
var html = "\n <div id='".concat(this.elementId, "start_item' class='websy-dragdrop-item ").concat(this.options.items.length === 0 ? 'empty' : '', "' data-id='").concat(this.elementId, "start'>\n <div id='").concat(this.elementId, "start_dropZone' class='websy-drop-zone droppable' data-index='start' data-side='start' data-id='").concat(this.elementId, "start' data-placeholder='").concat(this.options.dropPlaceholder, "'></div>\n </div>\n ");
|
|
2413
2436
|
html += this.options.items.map(function (d, i) {
|
|
2414
|
-
return
|
|
2437
|
+
return _this13.createItemHtml(_this13.elementId, i, d);
|
|
2415
2438
|
}).join('');
|
|
2416
2439
|
el.innerHTML = html;
|
|
2417
2440
|
this.options.items.forEach(function (item, i) {
|
|
@@ -2463,6 +2486,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2463
2486
|
}
|
|
2464
2487
|
|
|
2465
2488
|
this.apiService = new WebsyDesigns.APIService('');
|
|
2489
|
+
this.fieldMap = {};
|
|
2466
2490
|
this.elementId = elementId;
|
|
2467
2491
|
var el = document.getElementById(elementId);
|
|
2468
2492
|
|
|
@@ -2490,19 +2514,19 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2490
2514
|
}, {
|
|
2491
2515
|
key: "checkRecaptcha",
|
|
2492
2516
|
value: function checkRecaptcha() {
|
|
2493
|
-
var
|
|
2517
|
+
var _this14 = this;
|
|
2494
2518
|
|
|
2495
2519
|
return new Promise(function (resolve, reject) {
|
|
2496
|
-
if (
|
|
2497
|
-
if (
|
|
2520
|
+
if (_this14.options.useRecaptcha === true) {
|
|
2521
|
+
if (_this14.recaptchaValue) {
|
|
2498
2522
|
// grecaptcha.ready(() => {
|
|
2499
2523
|
// grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
|
|
2500
|
-
|
|
2501
|
-
grecaptcharesponse:
|
|
2524
|
+
_this14.apiService.add('google/checkrecaptcha', {
|
|
2525
|
+
grecaptcharesponse: _this14.recaptchaValue
|
|
2502
2526
|
}).then(function (response) {
|
|
2503
2527
|
if (response.success && response.success === true) {
|
|
2504
2528
|
resolve(true);
|
|
2505
|
-
grecaptcha.reset("".concat(
|
|
2529
|
+
grecaptcha.reset("".concat(_this14.elementId, "_recaptcha"), {
|
|
2506
2530
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2507
2531
|
});
|
|
2508
2532
|
} else {
|
|
@@ -2563,14 +2587,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2563
2587
|
}, {
|
|
2564
2588
|
key: "processComponents",
|
|
2565
2589
|
value: function processComponents(components, callbackFn) {
|
|
2566
|
-
var
|
|
2590
|
+
var _this15 = this;
|
|
2567
2591
|
|
|
2568
2592
|
if (components.length === 0) {
|
|
2569
2593
|
callbackFn();
|
|
2570
2594
|
} else {
|
|
2571
2595
|
components.forEach(function (c) {
|
|
2572
2596
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2573
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2597
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2574
2598
|
} else {// some user feedback here
|
|
2575
2599
|
}
|
|
2576
2600
|
});
|
|
@@ -2579,15 +2603,15 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2579
2603
|
}, {
|
|
2580
2604
|
key: "recaptchaReady",
|
|
2581
2605
|
value: function recaptchaReady() {
|
|
2582
|
-
var
|
|
2606
|
+
var _this16 = this;
|
|
2583
2607
|
|
|
2584
2608
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2585
2609
|
|
|
2586
2610
|
if (el) {
|
|
2587
2611
|
grecaptcha.ready(function () {
|
|
2588
|
-
grecaptcha.render("".concat(
|
|
2612
|
+
grecaptcha.render("".concat(_this16.elementId, "_recaptcha"), {
|
|
2589
2613
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2590
|
-
callback:
|
|
2614
|
+
callback: _this16.validateRecaptcha.bind(_this16)
|
|
2591
2615
|
});
|
|
2592
2616
|
});
|
|
2593
2617
|
}
|
|
@@ -2595,7 +2619,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2595
2619
|
}, {
|
|
2596
2620
|
key: "render",
|
|
2597
2621
|
value: function render(update, data) {
|
|
2598
|
-
var
|
|
2622
|
+
var _this17 = this;
|
|
2599
2623
|
|
|
2600
2624
|
var el = document.getElementById(this.elementId);
|
|
2601
2625
|
var componentsToProcess = [];
|
|
@@ -2603,13 +2627,15 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2603
2627
|
if (el) {
|
|
2604
2628
|
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
|
|
2605
2629
|
this.options.fields.forEach(function (f, i) {
|
|
2630
|
+
_this17.fieldMap[f.field] = f;
|
|
2631
|
+
|
|
2606
2632
|
if (f.component) {
|
|
2607
2633
|
componentsToProcess.push(f);
|
|
2608
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(
|
|
2634
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this17.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2609
2635
|
} else if (f.type === 'longtext') {
|
|
2610
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(
|
|
2636
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this17.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
2611
2637
|
} else {
|
|
2612
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
2638
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this17.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
2613
2639
|
}
|
|
2614
2640
|
});
|
|
2615
2641
|
|
|
@@ -2626,16 +2652,35 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2626
2652
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2627
2653
|
el.innerHTML = html;
|
|
2628
2654
|
this.processComponents(componentsToProcess, function () {
|
|
2629
|
-
if (
|
|
2630
|
-
|
|
2655
|
+
if (_this17.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2656
|
+
_this17.recaptchaReady();
|
|
2631
2657
|
}
|
|
2632
2658
|
});
|
|
2633
2659
|
}
|
|
2634
2660
|
}
|
|
2661
|
+
}, {
|
|
2662
|
+
key: "setValue",
|
|
2663
|
+
value: function setValue(field, value) {
|
|
2664
|
+
if (this.fieldMap[field]) {
|
|
2665
|
+
if (this.fieldMap[field].instance) {
|
|
2666
|
+
this.fieldMap[field].instance.setValue(value);
|
|
2667
|
+
} else {
|
|
2668
|
+
var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
|
|
2669
|
+
|
|
2670
|
+
if (el) {
|
|
2671
|
+
el.value = value;
|
|
2672
|
+
} else {
|
|
2673
|
+
console.error("Input for ".concat(field, " does not exist in form."));
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
} else {
|
|
2677
|
+
console.error("Field ".concat(field, " does not exist in form."));
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2635
2680
|
}, {
|
|
2636
2681
|
key: "submitForm",
|
|
2637
2682
|
value: function submitForm() {
|
|
2638
|
-
var
|
|
2683
|
+
var _this18 = this;
|
|
2639
2684
|
|
|
2640
2685
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2641
2686
|
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
@@ -2663,34 +2708,34 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2663
2708
|
data[key] = value;
|
|
2664
2709
|
});
|
|
2665
2710
|
|
|
2666
|
-
if (
|
|
2667
|
-
var
|
|
2711
|
+
if (_this18.options.url) {
|
|
2712
|
+
var _this18$apiService;
|
|
2668
2713
|
|
|
2669
|
-
var params = [
|
|
2714
|
+
var params = [_this18.options.url];
|
|
2670
2715
|
|
|
2671
|
-
if (
|
|
2672
|
-
params.push(
|
|
2716
|
+
if (_this18.options.mode === 'update') {
|
|
2717
|
+
params.push(_this18.options.id);
|
|
2673
2718
|
}
|
|
2674
2719
|
|
|
2675
2720
|
params.push(data);
|
|
2676
2721
|
|
|
2677
|
-
(
|
|
2678
|
-
if (
|
|
2722
|
+
(_this18$apiService = _this18.apiService)[_this18.options.mode].apply(_this18$apiService, params).then(function (result) {
|
|
2723
|
+
if (_this18.options.clearAfterSave === true) {
|
|
2679
2724
|
// this.render()
|
|
2680
2725
|
formEl.reset();
|
|
2681
2726
|
}
|
|
2682
2727
|
|
|
2683
2728
|
buttonEl.removeAttribute('disabled');
|
|
2684
2729
|
|
|
2685
|
-
|
|
2730
|
+
_this18.options.onSuccess.call(_this18, result);
|
|
2686
2731
|
}, function (err) {
|
|
2687
2732
|
console.log('Error submitting form data:', err);
|
|
2688
2733
|
|
|
2689
|
-
|
|
2734
|
+
_this18.options.onError.call(_this18, err);
|
|
2690
2735
|
});
|
|
2691
|
-
} else if (
|
|
2692
|
-
|
|
2693
|
-
if (
|
|
2736
|
+
} else if (_this18.options.submitFn) {
|
|
2737
|
+
_this18.options.submitFn(data, function () {
|
|
2738
|
+
if (_this18.options.clearAfterSave === true) {
|
|
2694
2739
|
// this.render()
|
|
2695
2740
|
formEl.reset();
|
|
2696
2741
|
}
|
|
@@ -2715,18 +2760,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2715
2760
|
}
|
|
2716
2761
|
}, {
|
|
2717
2762
|
key: "data",
|
|
2763
|
+
get: function get() {
|
|
2764
|
+
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2765
|
+
var data = {};
|
|
2766
|
+
var temp = new FormData(formEl);
|
|
2767
|
+
temp.forEach(function (value, key) {
|
|
2768
|
+
data[key] = value;
|
|
2769
|
+
});
|
|
2770
|
+
return data;
|
|
2771
|
+
},
|
|
2718
2772
|
set: function set(d) {
|
|
2719
|
-
var
|
|
2773
|
+
var _this19 = this;
|
|
2720
2774
|
|
|
2721
2775
|
if (!this.options.fields) {
|
|
2722
2776
|
this.options.fields = [];
|
|
2723
2777
|
}
|
|
2724
2778
|
|
|
2725
2779
|
var _loop = function _loop(key) {
|
|
2726
|
-
|
|
2780
|
+
_this19.options.fields.forEach(function (f) {
|
|
2727
2781
|
if (f.field === key) {
|
|
2728
2782
|
f.value = d[key];
|
|
2729
|
-
var el = document.getElementById("".concat(
|
|
2783
|
+
var el = document.getElementById("".concat(_this19.elementId, "_input_").concat(f.field));
|
|
2730
2784
|
el.value = f.value;
|
|
2731
2785
|
}
|
|
2732
2786
|
});
|
|
@@ -2867,6 +2921,11 @@ var WebsyLogin = /*#__PURE__*/function () {
|
|
|
2867
2921
|
onSuccess: this.loginSuccess.bind(this),
|
|
2868
2922
|
onError: this.loginFail.bind(this)
|
|
2869
2923
|
};
|
|
2924
|
+
|
|
2925
|
+
if (this.options.fields) {
|
|
2926
|
+
formOptions.fields = this.options.fields.concat(formOptions.fields);
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2870
2929
|
this.loginForm = new WebsyDesigns.WebsyForm("".concat(this.elementId, "_container"), _extends({}, this.options, formOptions));
|
|
2871
2930
|
} else {
|
|
2872
2931
|
console.error("No element with ID ".concat(this.elementId, " found for WebsyLogin component."));
|
|
@@ -3046,7 +3105,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3046
3105
|
}, {
|
|
3047
3106
|
key: "handleSearch",
|
|
3048
3107
|
value: function handleSearch(searchText) {
|
|
3049
|
-
var
|
|
3108
|
+
var _this20 = this;
|
|
3050
3109
|
|
|
3051
3110
|
var el = document.getElementById(this.elementId); // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3052
3111
|
|
|
@@ -3059,7 +3118,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3059
3118
|
if (searchText && searchText.length > 1) {
|
|
3060
3119
|
defaultMethod = 'add';
|
|
3061
3120
|
visibleItems = lowestItems.filter(function (d) {
|
|
3062
|
-
return d[
|
|
3121
|
+
return d[_this20.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
3063
3122
|
});
|
|
3064
3123
|
} // hide everything
|
|
3065
3124
|
|
|
@@ -3287,7 +3346,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3287
3346
|
|
|
3288
3347
|
var Pager = /*#__PURE__*/function () {
|
|
3289
3348
|
function Pager(elementId, options) {
|
|
3290
|
-
var
|
|
3349
|
+
var _this21 = this;
|
|
3291
3350
|
|
|
3292
3351
|
_classCallCheck(this, Pager);
|
|
3293
3352
|
|
|
@@ -3340,8 +3399,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3340
3399
|
allowClear: false,
|
|
3341
3400
|
disableSearch: true,
|
|
3342
3401
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3343
|
-
if (
|
|
3344
|
-
|
|
3402
|
+
if (_this21.options.onChangePageSize) {
|
|
3403
|
+
_this21.options.onChangePageSize(selectedItem.value);
|
|
3345
3404
|
}
|
|
3346
3405
|
}
|
|
3347
3406
|
});
|
|
@@ -3365,13 +3424,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3365
3424
|
}, {
|
|
3366
3425
|
key: "render",
|
|
3367
3426
|
value: function render() {
|
|
3368
|
-
var
|
|
3427
|
+
var _this22 = this;
|
|
3369
3428
|
|
|
3370
3429
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3371
3430
|
|
|
3372
3431
|
if (el) {
|
|
3373
3432
|
var pages = this.options.pages.map(function (item, index) {
|
|
3374
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3433
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3375
3434
|
});
|
|
3376
3435
|
var startIndex = 0;
|
|
3377
3436
|
|
|
@@ -3439,58 +3498,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3439
3498
|
_createClass(WebsyPDFButton, [{
|
|
3440
3499
|
key: "handleClick",
|
|
3441
3500
|
value: function handleClick(event) {
|
|
3442
|
-
var
|
|
3501
|
+
var _this23 = this;
|
|
3443
3502
|
|
|
3444
3503
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3445
3504
|
this.loader.show();
|
|
3446
3505
|
setTimeout(function () {
|
|
3447
|
-
if (
|
|
3448
|
-
var el = document.getElementById(
|
|
3506
|
+
if (_this23.options.targetId) {
|
|
3507
|
+
var el = document.getElementById(_this23.options.targetId);
|
|
3449
3508
|
|
|
3450
3509
|
if (el) {
|
|
3451
3510
|
var pdfData = {
|
|
3452
3511
|
options: {}
|
|
3453
3512
|
};
|
|
3454
3513
|
|
|
3455
|
-
if (
|
|
3456
|
-
pdfData.options = _extends({},
|
|
3514
|
+
if (_this23.options.pdfOptions) {
|
|
3515
|
+
pdfData.options = _extends({}, _this23.options.pdfOptions);
|
|
3457
3516
|
}
|
|
3458
3517
|
|
|
3459
|
-
if (
|
|
3460
|
-
if (
|
|
3461
|
-
var headerEl = document.getElementById(
|
|
3518
|
+
if (_this23.options.header) {
|
|
3519
|
+
if (_this23.options.header.elementId) {
|
|
3520
|
+
var headerEl = document.getElementById(_this23.options.header.elementId);
|
|
3462
3521
|
|
|
3463
3522
|
if (headerEl) {
|
|
3464
3523
|
pdfData.header = headerEl.outerHTML;
|
|
3465
3524
|
|
|
3466
|
-
if (
|
|
3467
|
-
pdfData.options.headerCSS =
|
|
3525
|
+
if (_this23.options.header.css) {
|
|
3526
|
+
pdfData.options.headerCSS = _this23.options.header.css;
|
|
3468
3527
|
}
|
|
3469
3528
|
}
|
|
3470
|
-
} else if (
|
|
3471
|
-
pdfData.header =
|
|
3529
|
+
} else if (_this23.options.header.html) {
|
|
3530
|
+
pdfData.header = _this23.options.header.html;
|
|
3472
3531
|
|
|
3473
|
-
if (
|
|
3474
|
-
pdfData.options.headerCSS =
|
|
3532
|
+
if (_this23.options.header.css) {
|
|
3533
|
+
pdfData.options.headerCSS = _this23.options.header.css;
|
|
3475
3534
|
}
|
|
3476
3535
|
} else {
|
|
3477
|
-
pdfData.header =
|
|
3536
|
+
pdfData.header = _this23.options.header;
|
|
3478
3537
|
}
|
|
3479
3538
|
}
|
|
3480
3539
|
|
|
3481
|
-
if (
|
|
3482
|
-
if (
|
|
3483
|
-
var footerEl = document.getElementById(
|
|
3540
|
+
if (_this23.options.footer) {
|
|
3541
|
+
if (_this23.options.footer.elementId) {
|
|
3542
|
+
var footerEl = document.getElementById(_this23.options.footer.elementId);
|
|
3484
3543
|
|
|
3485
3544
|
if (footerEl) {
|
|
3486
3545
|
pdfData.footer = footerEl.outerHTML;
|
|
3487
3546
|
|
|
3488
|
-
if (
|
|
3489
|
-
pdfData.options.footerCSS =
|
|
3547
|
+
if (_this23.options.footer.css) {
|
|
3548
|
+
pdfData.options.footerCSS = _this23.options.footer.css;
|
|
3490
3549
|
}
|
|
3491
3550
|
}
|
|
3492
3551
|
} else {
|
|
3493
|
-
pdfData.footer =
|
|
3552
|
+
pdfData.footer = _this23.options.footer;
|
|
3494
3553
|
}
|
|
3495
3554
|
}
|
|
3496
3555
|
|
|
@@ -3499,31 +3558,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3499
3558
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3500
3559
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3501
3560
|
|
|
3502
|
-
|
|
3561
|
+
_this23.service.add('', pdfData, {
|
|
3503
3562
|
responseType: 'blob'
|
|
3504
3563
|
}).then(function (response) {
|
|
3505
|
-
|
|
3564
|
+
_this23.loader.hide();
|
|
3506
3565
|
|
|
3507
3566
|
var blob = new Blob([response], {
|
|
3508
3567
|
type: 'application/pdf'
|
|
3509
3568
|
});
|
|
3510
3569
|
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 ");
|
|
3511
3570
|
|
|
3512
|
-
if (
|
|
3571
|
+
if (_this23.options.directDownload === true) {
|
|
3513
3572
|
var fileName;
|
|
3514
3573
|
|
|
3515
|
-
if (typeof
|
|
3516
|
-
fileName =
|
|
3574
|
+
if (typeof _this23.options.fileName === 'function') {
|
|
3575
|
+
fileName = _this23.options.fileName() || 'Export';
|
|
3517
3576
|
} else {
|
|
3518
|
-
fileName =
|
|
3577
|
+
fileName = _this23.options.fileName || 'Export';
|
|
3519
3578
|
}
|
|
3520
3579
|
|
|
3521
3580
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3522
3581
|
}
|
|
3523
3582
|
|
|
3524
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3583
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this23.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3525
3584
|
|
|
3526
|
-
|
|
3585
|
+
_this23.popup.show({
|
|
3527
3586
|
message: msg,
|
|
3528
3587
|
mask: true
|
|
3529
3588
|
});
|
|
@@ -3724,7 +3783,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3724
3783
|
|
|
3725
3784
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3726
3785
|
function ResponsiveText(elementId, options) {
|
|
3727
|
-
var
|
|
3786
|
+
var _this24 = this;
|
|
3728
3787
|
|
|
3729
3788
|
_classCallCheck(this, ResponsiveText);
|
|
3730
3789
|
|
|
@@ -3737,7 +3796,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3737
3796
|
this.elementId = elementId;
|
|
3738
3797
|
this.canvas = document.createElement('canvas');
|
|
3739
3798
|
window.addEventListener('resize', function () {
|
|
3740
|
-
return
|
|
3799
|
+
return _this24.render();
|
|
3741
3800
|
});
|
|
3742
3801
|
var el = document.getElementById(this.elementId);
|
|
3743
3802
|
|
|
@@ -3956,7 +4015,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3956
4015
|
|
|
3957
4016
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3958
4017
|
function WebsyResultList(elementId, options) {
|
|
3959
|
-
var
|
|
4018
|
+
var _this25 = this;
|
|
3960
4019
|
|
|
3961
4020
|
_classCallCheck(this, WebsyResultList);
|
|
3962
4021
|
|
|
@@ -3988,9 +4047,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3988
4047
|
|
|
3989
4048
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3990
4049
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3991
|
-
|
|
4050
|
+
_this25.options.template = templateString;
|
|
3992
4051
|
|
|
3993
|
-
|
|
4052
|
+
_this25.render();
|
|
3994
4053
|
});
|
|
3995
4054
|
} else {
|
|
3996
4055
|
this.render();
|
|
@@ -4010,7 +4069,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4010
4069
|
}, {
|
|
4011
4070
|
key: "buildHTML",
|
|
4012
4071
|
value: function buildHTML(d) {
|
|
4013
|
-
var
|
|
4072
|
+
var _this26 = this;
|
|
4014
4073
|
|
|
4015
4074
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4016
4075
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -4020,7 +4079,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4020
4079
|
if (this.options.template) {
|
|
4021
4080
|
if (d.length > 0) {
|
|
4022
4081
|
d.forEach(function (row, ix) {
|
|
4023
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4082
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this26.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
4024
4083
|
|
|
4025
4084
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
4026
4085
|
|
|
@@ -4125,7 +4184,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4125
4184
|
parts.forEach(function (p) {
|
|
4126
4185
|
items = items[p];
|
|
4127
4186
|
});
|
|
4128
|
-
template = template.replace(m[0],
|
|
4187
|
+
template = template.replace(m[0], _this26.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4129
4188
|
}
|
|
4130
4189
|
});
|
|
4131
4190
|
|
|
@@ -4137,7 +4196,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4137
4196
|
}
|
|
4138
4197
|
});
|
|
4139
4198
|
|
|
4140
|
-
var flatRow =
|
|
4199
|
+
var flatRow = _this26.flattenObject(row);
|
|
4141
4200
|
|
|
4142
4201
|
for (var key in flatRow) {
|
|
4143
4202
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -4272,13 +4331,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4272
4331
|
}, {
|
|
4273
4332
|
key: "render",
|
|
4274
4333
|
value: function render() {
|
|
4275
|
-
var
|
|
4334
|
+
var _this27 = this;
|
|
4276
4335
|
|
|
4277
4336
|
if (this.options.entity) {
|
|
4278
4337
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
4279
|
-
|
|
4338
|
+
_this27.rows = results.rows;
|
|
4280
4339
|
|
|
4281
|
-
|
|
4340
|
+
_this27.resize();
|
|
4282
4341
|
});
|
|
4283
4342
|
} else {
|
|
4284
4343
|
this.resize();
|
|
@@ -4364,14 +4423,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4364
4423
|
_createClass(WebsyRouter, [{
|
|
4365
4424
|
key: "addGroup",
|
|
4366
4425
|
value: function addGroup(group) {
|
|
4367
|
-
var
|
|
4426
|
+
var _this28 = this;
|
|
4368
4427
|
|
|
4369
4428
|
if (!this.groups[group]) {
|
|
4370
4429
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4371
4430
|
|
|
4372
4431
|
if (els) {
|
|
4373
4432
|
this.getClosestParent(els[0], function (parent) {
|
|
4374
|
-
|
|
4433
|
+
_this28.groups[group] = {
|
|
4375
4434
|
activeView: '',
|
|
4376
4435
|
views: [],
|
|
4377
4436
|
parent: parent.getAttribute('data-view')
|
|
@@ -4434,7 +4493,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4434
4493
|
}, {
|
|
4435
4494
|
key: "removeUrlParams",
|
|
4436
4495
|
value: function removeUrlParams() {
|
|
4437
|
-
var
|
|
4496
|
+
var _this29 = this;
|
|
4438
4497
|
|
|
4439
4498
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4440
4499
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -4448,7 +4507,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4448
4507
|
|
|
4449
4508
|
if (this.currentParams && this.currentParams.items) {
|
|
4450
4509
|
params.forEach(function (p) {
|
|
4451
|
-
delete
|
|
4510
|
+
delete _this29.currentParams.items[p];
|
|
4452
4511
|
});
|
|
4453
4512
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4454
4513
|
}
|
|
@@ -4480,13 +4539,17 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4480
4539
|
inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
|
|
4481
4540
|
}
|
|
4482
4541
|
|
|
4542
|
+
this.currentParams = {
|
|
4543
|
+
path: '',
|
|
4544
|
+
items: {}
|
|
4545
|
+
};
|
|
4546
|
+
|
|
4483
4547
|
if (reloadView === true) {
|
|
4484
4548
|
this.navigate("".concat(inputPath), 'main', null, noHistory);
|
|
4485
4549
|
} else {
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
};
|
|
4550
|
+
history.replaceState({
|
|
4551
|
+
inputPath: inputPath
|
|
4552
|
+
}, 'unused', inputPath);
|
|
4490
4553
|
}
|
|
4491
4554
|
}
|
|
4492
4555
|
}, {
|
|
@@ -4812,12 +4875,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4812
4875
|
}, {
|
|
4813
4876
|
key: "showComponents",
|
|
4814
4877
|
value: function showComponents(view) {
|
|
4815
|
-
var
|
|
4878
|
+
var _this30 = this;
|
|
4816
4879
|
|
|
4817
4880
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4818
4881
|
this.options.views[view].components.forEach(function (c) {
|
|
4819
4882
|
if (typeof c.instance === 'undefined') {
|
|
4820
|
-
|
|
4883
|
+
_this30.prepComponent(c.elementId, c.options);
|
|
4821
4884
|
|
|
4822
4885
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4823
4886
|
} else if (c.instance.render) {
|
|
@@ -5175,7 +5238,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5175
5238
|
}, {
|
|
5176
5239
|
key: "handleKeyUp",
|
|
5177
5240
|
value: function handleKeyUp(event) {
|
|
5178
|
-
var
|
|
5241
|
+
var _this31 = this;
|
|
5179
5242
|
|
|
5180
5243
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5181
5244
|
if (this.searchTimeoutFn) {
|
|
@@ -5198,8 +5261,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5198
5261
|
|
|
5199
5262
|
if (event.target.value.length >= this.options.minLength) {
|
|
5200
5263
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5201
|
-
if (
|
|
5202
|
-
|
|
5264
|
+
if (_this31.options.onSearch) {
|
|
5265
|
+
_this31.options.onSearch(event.target.value);
|
|
5203
5266
|
}
|
|
5204
5267
|
}, this.options.searchTimeout);
|
|
5205
5268
|
} else {
|
|
@@ -5247,23 +5310,6 @@ var WebsySignup = /*#__PURE__*/function () {
|
|
|
5247
5310
|
};
|
|
5248
5311
|
this.elementId = elementId;
|
|
5249
5312
|
this.options = _extends({}, DEFAULTS, options);
|
|
5250
|
-
|
|
5251
|
-
if (!this.options.fields) {
|
|
5252
|
-
this.options.fields = [{
|
|
5253
|
-
label: this.options.loginType === 'email' ? 'Email' : 'Username',
|
|
5254
|
-
placeholder: "Enter ".concat(this.options.loginType === 'email' ? 'your email address' : 'your chosen Username'),
|
|
5255
|
-
field: this.options.loginType,
|
|
5256
|
-
type: this.options.loginType,
|
|
5257
|
-
required: true
|
|
5258
|
-
}, {
|
|
5259
|
-
label: 'Password',
|
|
5260
|
-
placeholder: 'Enter your password',
|
|
5261
|
-
field: this.options.passwordField || 'password',
|
|
5262
|
-
type: 'password',
|
|
5263
|
-
required: true
|
|
5264
|
-
}];
|
|
5265
|
-
}
|
|
5266
|
-
|
|
5267
5313
|
var el = document.getElementById(this.elementId);
|
|
5268
5314
|
|
|
5269
5315
|
if (el) {
|
|
@@ -5274,8 +5320,25 @@ var WebsySignup = /*#__PURE__*/function () {
|
|
|
5274
5320
|
classes: (this.options.buttonClasses || []).join(' ') || ''
|
|
5275
5321
|
},
|
|
5276
5322
|
submitFn: this.submitForm.bind(this),
|
|
5277
|
-
fields:
|
|
5323
|
+
fields: [{
|
|
5324
|
+
label: this.options.loginType === 'email' ? 'Email' : 'Username',
|
|
5325
|
+
placeholder: "Enter ".concat(this.options.loginType === 'email' ? 'your email address' : 'your chosen Username'),
|
|
5326
|
+
field: this.options.loginType,
|
|
5327
|
+
type: this.options.loginType,
|
|
5328
|
+
required: true
|
|
5329
|
+
}, {
|
|
5330
|
+
label: 'Password',
|
|
5331
|
+
placeholder: 'Enter your password',
|
|
5332
|
+
field: this.options.passwordField || 'password',
|
|
5333
|
+
type: 'password',
|
|
5334
|
+
required: true
|
|
5335
|
+
}]
|
|
5278
5336
|
};
|
|
5337
|
+
|
|
5338
|
+
if (this.options.fields) {
|
|
5339
|
+
formOptions.fields = this.options.fields.concat(formOptions.fields);
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5279
5342
|
this.signupForm = new WebsyDesigns.WebsyForm(this.elementId, _extends({}, this.options, formOptions));
|
|
5280
5343
|
} else {
|
|
5281
5344
|
console.error("No element with ID ".concat(this.elementId, " found for WebsyLogin component."));
|
|
@@ -5370,7 +5433,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5370
5433
|
|
|
5371
5434
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5372
5435
|
function WebsyTemplate(elementId, options) {
|
|
5373
|
-
var
|
|
5436
|
+
var _this32 = this;
|
|
5374
5437
|
|
|
5375
5438
|
_classCallCheck(this, WebsyTemplate);
|
|
5376
5439
|
|
|
@@ -5396,9 +5459,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5396
5459
|
|
|
5397
5460
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5398
5461
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5399
|
-
|
|
5462
|
+
_this32.options.template = templateString;
|
|
5400
5463
|
|
|
5401
|
-
|
|
5464
|
+
_this32.render();
|
|
5402
5465
|
});
|
|
5403
5466
|
} else {
|
|
5404
5467
|
this.render();
|
|
@@ -5408,7 +5471,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5408
5471
|
_createClass(WebsyTemplate, [{
|
|
5409
5472
|
key: "buildHTML",
|
|
5410
5473
|
value: function buildHTML() {
|
|
5411
|
-
var
|
|
5474
|
+
var _this33 = this;
|
|
5412
5475
|
|
|
5413
5476
|
var html = "";
|
|
5414
5477
|
|
|
@@ -5470,14 +5533,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5470
5533
|
}
|
|
5471
5534
|
|
|
5472
5535
|
if (polarity === true) {
|
|
5473
|
-
if (typeof
|
|
5536
|
+
if (typeof _this33.options.data[parts[0]] !== 'undefined' && _this33.options.data[parts[0]] === parts[1]) {
|
|
5474
5537
|
// remove the <if> tags
|
|
5475
5538
|
removeAll = false;
|
|
5476
5539
|
} else if (parts[0] === parts[1]) {
|
|
5477
5540
|
removeAll = false;
|
|
5478
5541
|
}
|
|
5479
5542
|
} else if (polarity === false) {
|
|
5480
|
-
if (typeof
|
|
5543
|
+
if (typeof _this33.options.data[parts[0]] !== 'undefined' && _this33.options.data[parts[0]] !== parts[1]) {
|
|
5481
5544
|
// remove the <if> tags
|
|
5482
5545
|
removeAll = false;
|
|
5483
5546
|
}
|
|
@@ -5770,7 +5833,7 @@ var WebsyUtils = {
|
|
|
5770
5833
|
|
|
5771
5834
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5772
5835
|
function WebsyTable(elementId, options) {
|
|
5773
|
-
var
|
|
5836
|
+
var _this34 = this;
|
|
5774
5837
|
|
|
5775
5838
|
_classCallCheck(this, WebsyTable);
|
|
5776
5839
|
|
|
@@ -5808,8 +5871,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5808
5871
|
allowClear: false,
|
|
5809
5872
|
disableSearch: true,
|
|
5810
5873
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5811
|
-
if (
|
|
5812
|
-
|
|
5874
|
+
if (_this34.options.onChangePageSize) {
|
|
5875
|
+
_this34.options.onChangePageSize(selectedItem.value);
|
|
5813
5876
|
}
|
|
5814
5877
|
}
|
|
5815
5878
|
});
|
|
@@ -5830,7 +5893,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5830
5893
|
_createClass(WebsyTable, [{
|
|
5831
5894
|
key: "appendRows",
|
|
5832
5895
|
value: function appendRows(data) {
|
|
5833
|
-
var
|
|
5896
|
+
var _this35 = this;
|
|
5834
5897
|
|
|
5835
5898
|
this.hideError();
|
|
5836
5899
|
var bodyHTML = '';
|
|
@@ -5838,15 +5901,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5838
5901
|
if (data) {
|
|
5839
5902
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5840
5903
|
return '<tr>' + r.map(function (c, i) {
|
|
5841
|
-
if (
|
|
5904
|
+
if (_this35.options.columns[i].show !== false) {
|
|
5842
5905
|
var style = '';
|
|
5843
5906
|
|
|
5844
5907
|
if (c.style) {
|
|
5845
5908
|
style += c.style;
|
|
5846
5909
|
}
|
|
5847
5910
|
|
|
5848
|
-
if (
|
|
5849
|
-
style += "width: ".concat(
|
|
5911
|
+
if (_this35.options.columns[i].width) {
|
|
5912
|
+
style += "width: ".concat(_this35.options.columns[i].width, "; ");
|
|
5850
5913
|
}
|
|
5851
5914
|
|
|
5852
5915
|
if (c.backgroundColor) {
|
|
@@ -5861,18 +5924,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5861
5924
|
style += "color: ".concat(c.color, "; ");
|
|
5862
5925
|
}
|
|
5863
5926
|
|
|
5864
|
-
if (
|
|
5865
|
-
return "\n <td \n data-row-index='".concat(
|
|
5866
|
-
} else if ((
|
|
5867
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5927
|
+
if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5928
|
+
return "\n <td \n data-row-index='".concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.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(_this35.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5929
|
+
} else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5930
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this35.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5868
5931
|
} else {
|
|
5869
5932
|
var info = c.value;
|
|
5870
5933
|
|
|
5871
|
-
if (
|
|
5934
|
+
if (_this35.options.columns[i].showAsImage === true) {
|
|
5872
5935
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5873
5936
|
}
|
|
5874
5937
|
|
|
5875
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5938
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.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 ");
|
|
5876
5939
|
}
|
|
5877
5940
|
}
|
|
5878
5941
|
}).join('') + '</tr>';
|
|
@@ -6044,7 +6107,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6044
6107
|
}, {
|
|
6045
6108
|
key: "render",
|
|
6046
6109
|
value: function render(data) {
|
|
6047
|
-
var
|
|
6110
|
+
var _this36 = this;
|
|
6048
6111
|
|
|
6049
6112
|
if (!this.options.columns) {
|
|
6050
6113
|
return;
|
|
@@ -6079,7 +6142,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6079
6142
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6080
6143
|
}
|
|
6081
6144
|
|
|
6082
|
-
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 ?
|
|
6145
|
+
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 ? _this36.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
6083
6146
|
}
|
|
6084
6147
|
}).join('') + '</tr>';
|
|
6085
6148
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6098,7 +6161,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6098
6161
|
|
|
6099
6162
|
if (pagingEl) {
|
|
6100
6163
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6101
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6164
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6102
6165
|
});
|
|
6103
6166
|
var startIndex = 0;
|
|
6104
6167
|
|
|
@@ -6166,7 +6229,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6166
6229
|
|
|
6167
6230
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6168
6231
|
function WebsyTable2(elementId, options) {
|
|
6169
|
-
var
|
|
6232
|
+
var _this37 = this;
|
|
6170
6233
|
|
|
6171
6234
|
_classCallCheck(this, WebsyTable2);
|
|
6172
6235
|
|
|
@@ -6207,8 +6270,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6207
6270
|
allowClear: false,
|
|
6208
6271
|
disableSearch: true,
|
|
6209
6272
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6210
|
-
if (
|
|
6211
|
-
|
|
6273
|
+
if (_this37.options.onChangePageSize) {
|
|
6274
|
+
_this37.options.onChangePageSize(selectedItem.value);
|
|
6212
6275
|
}
|
|
6213
6276
|
}
|
|
6214
6277
|
});
|
|
@@ -6232,7 +6295,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6232
6295
|
_createClass(WebsyTable2, [{
|
|
6233
6296
|
key: "appendRows",
|
|
6234
6297
|
value: function appendRows(data) {
|
|
6235
|
-
var
|
|
6298
|
+
var _this38 = this;
|
|
6236
6299
|
|
|
6237
6300
|
this.hideError();
|
|
6238
6301
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -6241,15 +6304,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6241
6304
|
if (data) {
|
|
6242
6305
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6243
6306
|
return '<tr>' + r.map(function (c, i) {
|
|
6244
|
-
if (
|
|
6245
|
-
var style = "height: ".concat(
|
|
6307
|
+
if (_this38.options.columns[i].show !== false) {
|
|
6308
|
+
var style = "height: ".concat(_this38.options.cellSize, "px; line-height: ").concat(_this38.options.cellSize, "px;");
|
|
6246
6309
|
|
|
6247
6310
|
if (c.style) {
|
|
6248
6311
|
style += c.style;
|
|
6249
6312
|
}
|
|
6250
6313
|
|
|
6251
|
-
if (
|
|
6252
|
-
style += "width: ".concat(
|
|
6314
|
+
if (_this38.options.columns[i].width) {
|
|
6315
|
+
style += "width: ".concat(_this38.options.columns[i].width, "; ");
|
|
6253
6316
|
}
|
|
6254
6317
|
|
|
6255
6318
|
if (c.backgroundColor) {
|
|
@@ -6264,18 +6327,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6264
6327
|
style += "color: ".concat(c.color, "; ");
|
|
6265
6328
|
}
|
|
6266
6329
|
|
|
6267
|
-
if (
|
|
6268
|
-
return "\n <td \n data-row-index='".concat(
|
|
6269
|
-
} else if ((
|
|
6270
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6330
|
+
if (_this38.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6331
|
+
return "\n <td \n data-row-index='".concat(_this38.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this38.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(_this38.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this38.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6332
|
+
} else if ((_this38.options.columns[i].showAsNavigatorLink === true || _this38.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6333
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this38.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this38.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this38.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this38.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6271
6334
|
} else {
|
|
6272
6335
|
var info = c.value;
|
|
6273
6336
|
|
|
6274
|
-
if (
|
|
6337
|
+
if (_this38.options.columns[i].showAsImage === true) {
|
|
6275
6338
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6276
6339
|
}
|
|
6277
6340
|
|
|
6278
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6341
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this38.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this38.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 ");
|
|
6279
6342
|
}
|
|
6280
6343
|
}
|
|
6281
6344
|
}).join('') + '</tr>';
|
|
@@ -6538,7 +6601,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6538
6601
|
}, {
|
|
6539
6602
|
key: "render",
|
|
6540
6603
|
value: function render(data) {
|
|
6541
|
-
var
|
|
6604
|
+
var _this39 = this;
|
|
6542
6605
|
|
|
6543
6606
|
if (!this.options.columns) {
|
|
6544
6607
|
return;
|
|
@@ -6574,7 +6637,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6574
6637
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6575
6638
|
}
|
|
6576
6639
|
|
|
6577
|
-
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 ?
|
|
6640
|
+
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 ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6578
6641
|
}
|
|
6579
6642
|
}).join('') + '</tr>';
|
|
6580
6643
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6585,7 +6648,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6585
6648
|
var dropdownHTML = "";
|
|
6586
6649
|
this.options.columns.forEach(function (c, i) {
|
|
6587
6650
|
if (c.searchable && c.searchField) {
|
|
6588
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6651
|
+
dropdownHTML += "\n <div id=\"".concat(_this39.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6589
6652
|
}
|
|
6590
6653
|
});
|
|
6591
6654
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6607,7 +6670,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6607
6670
|
|
|
6608
6671
|
if (pagingEl) {
|
|
6609
6672
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6610
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6673
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this39.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6611
6674
|
});
|
|
6612
6675
|
var startIndex = 0;
|
|
6613
6676
|
|
|
@@ -6698,7 +6761,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6698
6761
|
}, {
|
|
6699
6762
|
key: "getColumnParameters",
|
|
6700
6763
|
value: function getColumnParameters(values) {
|
|
6701
|
-
var
|
|
6764
|
+
var _this40 = this;
|
|
6702
6765
|
|
|
6703
6766
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6704
6767
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6706,10 +6769,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6706
6769
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6707
6770
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6708
6771
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6709
|
-
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 ?
|
|
6772
|
+
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 ? _this40.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6710
6773
|
}).join('') + '</tr>';
|
|
6711
6774
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6712
|
-
return "\n <td \n style='height: ".concat(
|
|
6775
|
+
return "\n <td \n style='height: ".concat(_this40.options.cellSize, "px; line-height: ").concat(_this40.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6713
6776
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6714
6777
|
|
|
6715
6778
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6840,7 +6903,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6840
6903
|
}, {
|
|
6841
6904
|
key: "buildBodyHtml",
|
|
6842
6905
|
value: function buildBodyHtml() {
|
|
6843
|
-
var
|
|
6906
|
+
var _this41 = this;
|
|
6844
6907
|
|
|
6845
6908
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6846
6909
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -6903,7 +6966,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6903
6966
|
} // console.log('rowspan', cell.rowspan)
|
|
6904
6967
|
|
|
6905
6968
|
|
|
6906
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6969
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
|
|
6907
6970
|
// bodyHtml += `
|
|
6908
6971
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6909
6972
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6913,11 +6976,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6913
6976
|
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(sizeIndex, "'\n >");
|
|
6914
6977
|
|
|
6915
6978
|
if (cell.expandable === true) {
|
|
6916
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6979
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this41.options.plusIcon, "</i>");
|
|
6917
6980
|
}
|
|
6918
6981
|
|
|
6919
6982
|
if (cell.collapsable === true) {
|
|
6920
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6983
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this41.options.minusIcon, "</i>");
|
|
6921
6984
|
}
|
|
6922
6985
|
|
|
6923
6986
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6942,7 +7005,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6942
7005
|
}, {
|
|
6943
7006
|
key: "buildHeaderHtml",
|
|
6944
7007
|
value: function buildHeaderHtml() {
|
|
6945
|
-
var
|
|
7008
|
+
var _this42 = this;
|
|
6946
7009
|
|
|
6947
7010
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6948
7011
|
|
|
@@ -6962,7 +7025,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6962
7025
|
}
|
|
6963
7026
|
|
|
6964
7027
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6965
|
-
if (useWidths === false && rowIndex !==
|
|
7028
|
+
if (useWidths === false && rowIndex !== _this42.options.columns.length - 1) {
|
|
6966
7029
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6967
7030
|
return;
|
|
6968
7031
|
}
|
|
@@ -6981,25 +7044,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6981
7044
|
style += col.style;
|
|
6982
7045
|
}
|
|
6983
7046
|
|
|
6984
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
7047
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this42.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6985
7048
|
// headerHtml += `
|
|
6986
7049
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6987
7050
|
// width='${col.width || col.actualWidth}'
|
|
6988
7051
|
// `
|
|
6989
7052
|
// }
|
|
6990
7053
|
|
|
6991
|
-
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 ?
|
|
7054
|
+
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 ? _this42.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this42.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6992
7055
|
});
|
|
6993
7056
|
headerHtml += "</tr>";
|
|
6994
7057
|
});
|
|
6995
7058
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6996
7059
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6997
7060
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6998
|
-
var testEl = document.getElementById("".concat(
|
|
7061
|
+
var testEl = document.getElementById("".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6999
7062
|
|
|
7000
7063
|
if (!testEl) {
|
|
7001
7064
|
var newE = document.createElement('div');
|
|
7002
|
-
newE.id = "".concat(
|
|
7065
|
+
newE.id = "".concat(_this42.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7003
7066
|
newE.className = 'websy-modal-dropdown';
|
|
7004
7067
|
dropdownEl.appendChild(newE);
|
|
7005
7068
|
}
|
|
@@ -7022,7 +7085,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7022
7085
|
}, {
|
|
7023
7086
|
key: "buildTotalHtml",
|
|
7024
7087
|
value: function buildTotalHtml() {
|
|
7025
|
-
var
|
|
7088
|
+
var _this43 = this;
|
|
7026
7089
|
|
|
7027
7090
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7028
7091
|
|
|
@@ -7035,7 +7098,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7035
7098
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7036
7099
|
|
|
7037
7100
|
if (useWidths === true) {
|
|
7038
|
-
totalHtml += "\n style='width: ".concat(
|
|
7101
|
+
totalHtml += "\n style='width: ".concat(_this43.options.columns[_this43.options.columns.length - 1][colIndex].width || _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
7039
7102
|
}
|
|
7040
7103
|
|
|
7041
7104
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -7046,7 +7109,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7046
7109
|
}, {
|
|
7047
7110
|
key: "calculateSizes",
|
|
7048
7111
|
value: function calculateSizes() {
|
|
7049
|
-
var
|
|
7112
|
+
var _this44 = this;
|
|
7050
7113
|
|
|
7051
7114
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7052
7115
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -7095,32 +7158,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7095
7158
|
rows.forEach(function (row, rowIndex) {
|
|
7096
7159
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7097
7160
|
var colSize = col.getBoundingClientRect();
|
|
7098
|
-
|
|
7161
|
+
_this44.sizes.cellHeight = colSize.height;
|
|
7099
7162
|
|
|
7100
|
-
if (
|
|
7101
|
-
if (!
|
|
7102
|
-
|
|
7163
|
+
if (_this44.options.columns[_this44.options.columns.length - 1][colIndex]) {
|
|
7164
|
+
if (!_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth) {
|
|
7165
|
+
_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
7103
7166
|
}
|
|
7104
7167
|
|
|
7105
|
-
|
|
7106
|
-
|
|
7168
|
+
_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
7169
|
+
_this44.options.columns[_this44.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
7107
7170
|
|
|
7108
|
-
if (colIndex >=
|
|
7109
|
-
firstNonPinnedColumnWidth =
|
|
7171
|
+
if (colIndex >= _this44.pinnedColumns) {
|
|
7172
|
+
firstNonPinnedColumnWidth = _this44.options.columns[_this44.options.columns.length - 1][colIndex].actualWidth;
|
|
7110
7173
|
}
|
|
7111
7174
|
}
|
|
7112
7175
|
});
|
|
7113
7176
|
});
|
|
7114
7177
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7115
|
-
if (colIndex <
|
|
7116
|
-
|
|
7178
|
+
if (colIndex < _this44.pinnedColumns) {
|
|
7179
|
+
_this44.sizes.scrollableWidth -= col.actualWidth;
|
|
7117
7180
|
}
|
|
7118
7181
|
});
|
|
7119
7182
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
7120
7183
|
return a + (b.width || b.actualWidth);
|
|
7121
7184
|
}, 0);
|
|
7122
7185
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
7123
|
-
return i >=
|
|
7186
|
+
return i >= _this44.pinnedColumns;
|
|
7124
7187
|
}).reduce(function (a, b) {
|
|
7125
7188
|
return a + (b.width || b.actualWidth);
|
|
7126
7189
|
}, 0);
|
|
@@ -7141,10 +7204,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7141
7204
|
c.actualWidth += equalWidth; // }
|
|
7142
7205
|
// }
|
|
7143
7206
|
|
|
7144
|
-
|
|
7207
|
+
_this44.sizes.totalWidth += c.width || c.actualWidth;
|
|
7145
7208
|
|
|
7146
|
-
if (i <
|
|
7147
|
-
|
|
7209
|
+
if (i < _this44.pinnedColumns) {
|
|
7210
|
+
_this44.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7148
7211
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7149
7212
|
|
|
7150
7213
|
});
|
|
@@ -7207,7 +7270,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7207
7270
|
}, {
|
|
7208
7271
|
key: "createSample",
|
|
7209
7272
|
value: function createSample(data) {
|
|
7210
|
-
var
|
|
7273
|
+
var _this45 = this;
|
|
7211
7274
|
|
|
7212
7275
|
var output = [];
|
|
7213
7276
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -7219,7 +7282,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7219
7282
|
var longest = '';
|
|
7220
7283
|
|
|
7221
7284
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7222
|
-
if (data[i].length ===
|
|
7285
|
+
if (data[i].length === _this45.options.columns[_this45.options.columns.length - 1].length) {
|
|
7223
7286
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7224
7287
|
longest = data[i][colIndex].value;
|
|
7225
7288
|
}
|
|
@@ -7647,7 +7710,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7647
7710
|
|
|
7648
7711
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7649
7712
|
function WebsyChart(elementId, options) {
|
|
7650
|
-
var
|
|
7713
|
+
var _this46 = this;
|
|
7651
7714
|
|
|
7652
7715
|
_classCallCheck(this, WebsyChart);
|
|
7653
7716
|
|
|
@@ -7684,6 +7747,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7684
7747
|
tooltipWidth: 200,
|
|
7685
7748
|
brushHeight: 50,
|
|
7686
7749
|
minBandWidth: 30,
|
|
7750
|
+
maxBandWidth: 100,
|
|
7687
7751
|
allowUnevenBands: true
|
|
7688
7752
|
};
|
|
7689
7753
|
this.elementId = elementId;
|
|
@@ -7706,7 +7770,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7706
7770
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7707
7771
|
var xAxis = 'bottom';
|
|
7708
7772
|
|
|
7709
|
-
if (
|
|
7773
|
+
if (_this46.options.orientation === 'horizontal') {
|
|
7710
7774
|
xAxis = 'left';
|
|
7711
7775
|
}
|
|
7712
7776
|
|
|
@@ -7717,39 +7781,37 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7717
7781
|
xAxis += 'Axis';
|
|
7718
7782
|
var output;
|
|
7719
7783
|
|
|
7720
|
-
var width =
|
|
7784
|
+
var width = _this46.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
|
|
7721
7785
|
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
output = index;
|
|
7728
|
-
break;
|
|
7729
|
-
}
|
|
7730
|
-
} else {
|
|
7786
|
+
|
|
7787
|
+
for (var index = 0; index < _this46.customBottomRange.length; index++) {
|
|
7788
|
+
if (input > _this46.customBottomRange[index]) {
|
|
7789
|
+
if (_this46.customBottomRange[index + 1]) {
|
|
7790
|
+
if (input < _this46.customBottomRange[index + 1]) {
|
|
7731
7791
|
output = index;
|
|
7732
7792
|
break;
|
|
7733
7793
|
}
|
|
7734
|
-
}
|
|
7735
|
-
|
|
7736
|
-
} else {
|
|
7737
|
-
var domain = _toConsumableArray(_this45[xAxis].domain());
|
|
7738
|
-
|
|
7739
|
-
if (_this45.options.orientation === 'horizontal') {
|
|
7740
|
-
domain = domain.reverse();
|
|
7741
|
-
}
|
|
7742
|
-
|
|
7743
|
-
for (var j = 0; j < domain.length; j++) {
|
|
7744
|
-
var breakA = _this45[xAxis](domain[j]) - width / 2;
|
|
7745
|
-
var breakB = breakA + width;
|
|
7746
|
-
|
|
7747
|
-
if (input > breakA && input <= breakB) {
|
|
7748
|
-
output = j;
|
|
7794
|
+
} else {
|
|
7795
|
+
output = index;
|
|
7749
7796
|
break;
|
|
7750
7797
|
}
|
|
7751
7798
|
}
|
|
7752
|
-
}
|
|
7799
|
+
} // }
|
|
7800
|
+
// else {
|
|
7801
|
+
// let domain = [...this[xAxis].domain()]
|
|
7802
|
+
// if (this.options.orientation === 'horizontal') {
|
|
7803
|
+
// domain = domain.reverse()
|
|
7804
|
+
// }
|
|
7805
|
+
// for (let j = 0; j < domain.length; j++) {
|
|
7806
|
+
// let breakA = this[xAxis](domain[j]) - (width / 2)
|
|
7807
|
+
// let breakB = breakA + width
|
|
7808
|
+
// if (input > breakA && input <= breakB) {
|
|
7809
|
+
// output = j
|
|
7810
|
+
// break
|
|
7811
|
+
// }
|
|
7812
|
+
// }
|
|
7813
|
+
// }
|
|
7814
|
+
|
|
7753
7815
|
|
|
7754
7816
|
return output;
|
|
7755
7817
|
};
|
|
@@ -7758,64 +7820,97 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7758
7820
|
|
|
7759
7821
|
this.brushed = function (event) {
|
|
7760
7822
|
console.log('brushing', event);
|
|
7761
|
-
that.
|
|
7762
|
-
var xAxis = 'bottom';
|
|
7763
|
-
var xAxisCaps = 'Bottom';
|
|
7823
|
+
var newX = that.options.margin.left + that.options.margin.axisLeft + (1 - event.selection[0] / (that.plotWidth / (that.widthForCalc + that.totalBandPadding)));
|
|
7764
7824
|
|
|
7765
|
-
if (that.
|
|
7766
|
-
|
|
7767
|
-
xAxisCaps = 'Left';
|
|
7825
|
+
if (that.plotArea) {
|
|
7826
|
+
that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7768
7827
|
}
|
|
7769
7828
|
|
|
7770
|
-
if (
|
|
7771
|
-
|
|
7829
|
+
if (that.areaLayer) {
|
|
7830
|
+
that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7772
7831
|
}
|
|
7773
7832
|
|
|
7774
|
-
if (
|
|
7775
|
-
that
|
|
7833
|
+
if (that.lineLayer) {
|
|
7834
|
+
that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7776
7835
|
}
|
|
7777
7836
|
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
if (!event.selection || event.selection.length === 0) {
|
|
7781
|
-
that.brushLayer.select('.brush').call(that.brush).call(that.brush.move, s);
|
|
7782
|
-
return;
|
|
7837
|
+
if (that.barLayer) {
|
|
7838
|
+
that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7783
7839
|
}
|
|
7784
7840
|
|
|
7785
|
-
if (that.
|
|
7786
|
-
that.
|
|
7787
|
-
}
|
|
7788
|
-
var startEndOrdinal = s.map(function (a, b) {
|
|
7789
|
-
return that.bottomAxis.invert(a, b, true);
|
|
7790
|
-
}, that.bottomBrushAxis);
|
|
7791
|
-
|
|
7792
|
-
if (startEndOrdinal && startEndOrdinal.length === 2 && typeof startEndOrdinal[0] !== 'undefined' && typeof startEndOrdinal[1] !== 'undefined') {
|
|
7793
|
-
var domain = [];
|
|
7794
|
-
|
|
7795
|
-
var domainValues = _toConsumableArray(that["".concat(xAxis, "BrushAxis")].domain());
|
|
7841
|
+
if (that.labelLayer) {
|
|
7842
|
+
that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7843
|
+
}
|
|
7796
7844
|
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
that.brushedDomain.push(domainValues[i]);
|
|
7800
|
-
}
|
|
7801
|
-
}
|
|
7845
|
+
if (that.symbolLayer) {
|
|
7846
|
+
that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7802
7847
|
}
|
|
7803
7848
|
|
|
7804
|
-
if (that.
|
|
7805
|
-
that
|
|
7806
|
-
that["".concat(xAxis, "AxisLayer")].call(d3["axis".concat(xAxisCaps)](that["".concat(xAxis, "Axis")]));
|
|
7849
|
+
if (that.refLineLayer) {
|
|
7850
|
+
that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
|
|
7807
7851
|
}
|
|
7808
7852
|
|
|
7809
|
-
if (that.
|
|
7810
|
-
that.
|
|
7853
|
+
if (that.bottomAxisLayer) {
|
|
7854
|
+
that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop + that.plotHeight, ")"));
|
|
7855
|
+
} // that.brushedDomain = []
|
|
7856
|
+
// let xAxis = 'bottom'
|
|
7857
|
+
// let xAxisCaps = 'Bottom'
|
|
7858
|
+
// if (that.options.orientation === 'horizontal') {
|
|
7859
|
+
// xAxis = 'left'
|
|
7860
|
+
// xAxisCaps = 'Left'
|
|
7861
|
+
// }
|
|
7862
|
+
// if (!that[`${xAxis}Axis`]) {
|
|
7863
|
+
// return
|
|
7864
|
+
// }
|
|
7865
|
+
// if (!that[`${xAxis}Axis`].invert) {
|
|
7866
|
+
// that[`${xAxis}Axis`].invert = that.invertOverride
|
|
7867
|
+
// }
|
|
7868
|
+
// let s = event.selection || that[`${xAxis}Axis`].range()
|
|
7869
|
+
// if (!event.selection || event.selection.length === 0) {
|
|
7870
|
+
// that.brushLayer
|
|
7871
|
+
// .select('.brush')
|
|
7872
|
+
// .call(that.brush)
|
|
7873
|
+
// .call(that.brush.move, s)
|
|
7874
|
+
// return
|
|
7875
|
+
// }
|
|
7876
|
+
// if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
|
|
7877
|
+
// that.brushedDomain = s.map(that[`${xAxis}BrushAxis`].invert, that[[`${xAxis}Axis`]])
|
|
7878
|
+
// }
|
|
7879
|
+
// else {
|
|
7880
|
+
// let startEndOrdinal = s.map((a, b) => that.bottomAxis.invert(a, b, true), that.bottomBrushAxis)
|
|
7881
|
+
// if (
|
|
7882
|
+
// startEndOrdinal &&
|
|
7883
|
+
// startEndOrdinal.length === 2 &&
|
|
7884
|
+
// typeof startEndOrdinal[0] !== 'undefined' &&
|
|
7885
|
+
// typeof startEndOrdinal[1] !== 'undefined'
|
|
7886
|
+
// ) {
|
|
7887
|
+
// let domain = []
|
|
7888
|
+
// let domainValues = [...that[`${xAxis}BrushAxis`].domain()]
|
|
7889
|
+
// for (let i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
|
|
7890
|
+
// // domain.push(that.xRange[i])
|
|
7891
|
+
// that.brushedDomain.push(domainValues[i])
|
|
7892
|
+
// }
|
|
7893
|
+
// }
|
|
7894
|
+
// }
|
|
7895
|
+
// if (that.brushedDomain.length > 0) {
|
|
7896
|
+
// that[`${xAxis}Axis`].domain(that.brushedDomain)
|
|
7897
|
+
// that[`${xAxis}AxisLayer`].call(
|
|
7898
|
+
// d3[`axis${xAxisCaps}`](that[`${xAxis}Axis`])
|
|
7899
|
+
// )
|
|
7900
|
+
// }
|
|
7901
|
+
// if (that.leftAxis && that.bottomAxis) {
|
|
7902
|
+
// that.renderComponents()
|
|
7903
|
+
// if (that.options.orientation === 'vertical') {
|
|
7904
|
+
// // that.bottomAxisLayer.call(that.bAxisFunc)
|
|
7905
|
+
// if (that.options.data.bottom.rotate) {
|
|
7906
|
+
// that.bottomAxisLayer.selectAll('text')
|
|
7907
|
+
// .attr('transform', `rotate(${((that.options.data.bottom && that.options.data.bottom.rotate) || 0)})`)
|
|
7908
|
+
// .style('text-anchor', `${((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? 'middle' : 'end'}`)
|
|
7909
|
+
// .style('transform-origin', ((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? '0 0' : `0 ${((that.options.data.bottom && that.options.data.bottom.fontSize) || that.options.fontSize)}px`)
|
|
7910
|
+
// }
|
|
7911
|
+
// }
|
|
7912
|
+
// }
|
|
7811
7913
|
|
|
7812
|
-
if (that.options.orientation === 'vertical') {
|
|
7813
|
-
// that.bottomAxisLayer.call(that.bAxisFunc)
|
|
7814
|
-
if (that.options.data.bottom.rotate) {
|
|
7815
|
-
that.bottomAxisLayer.selectAll('text').attr('transform', "rotate(".concat(that.options.data.bottom && that.options.data.bottom.rotate || 0, ")")).style('text-anchor', "".concat((that.options.data.bottom && that.options.data.bottom.rotate || 0) === 0 ? 'middle' : 'end')).style('transform-origin', (that.options.data.bottom && that.options.data.bottom.rotate || 0) === 0 ? '0 0' : "0 ".concat(that.options.data.bottom && that.options.data.bottom.fontSize || that.options.fontSize, "px"));
|
|
7816
|
-
}
|
|
7817
|
-
}
|
|
7818
|
-
}
|
|
7819
7914
|
};
|
|
7820
7915
|
|
|
7821
7916
|
var el = document.getElementById(this.elementId);
|
|
@@ -7930,10 +8025,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7930
8025
|
}, {
|
|
7931
8026
|
key: "handleEventMouseMove",
|
|
7932
8027
|
value: function handleEventMouseMove(event, d) {
|
|
7933
|
-
var
|
|
8028
|
+
var _this47 = this;
|
|
7934
8029
|
|
|
7935
8030
|
var bisectDate = d3.bisector(function (d) {
|
|
7936
|
-
return
|
|
8031
|
+
return _this47.parseX(d.x.value);
|
|
7937
8032
|
}).left;
|
|
7938
8033
|
|
|
7939
8034
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7972,12 +8067,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7972
8067
|
}
|
|
7973
8068
|
|
|
7974
8069
|
this.options.data.series.forEach(function (s) {
|
|
7975
|
-
if (
|
|
7976
|
-
if (
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
}
|
|
8070
|
+
if (_this47.options.data[xData].scale !== 'Time') {
|
|
8071
|
+
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8072
|
+
xPoint = _this47.customBottomRange[x0] + (_this47.customBottomRange[x0 + 1] - _this47.customBottomRange[x0]) / 2; // }
|
|
8073
|
+
// else {
|
|
8074
|
+
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
8075
|
+
// }
|
|
7981
8076
|
|
|
7982
8077
|
s.data.forEach(function (d) {
|
|
7983
8078
|
if (d.x.value === xLabel) {
|
|
@@ -7997,13 +8092,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7997
8092
|
var pointA = s.data[index - 1];
|
|
7998
8093
|
var pointB = s.data[index];
|
|
7999
8094
|
|
|
8000
|
-
if (
|
|
8095
|
+
if (_this47.options.orientation === 'horizontal') {
|
|
8001
8096
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8002
8097
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8003
8098
|
}
|
|
8004
8099
|
|
|
8005
8100
|
if (pointA && !pointB) {
|
|
8006
|
-
xPoint =
|
|
8101
|
+
xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
|
|
8007
8102
|
tooltipTitle = pointA.x.value;
|
|
8008
8103
|
|
|
8009
8104
|
if (!pointA.y.color) {
|
|
@@ -8013,12 +8108,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8013
8108
|
tooltipData.push(pointA.y);
|
|
8014
8109
|
|
|
8015
8110
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8016
|
-
tooltipTitle = d3.timeFormat(
|
|
8111
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8017
8112
|
}
|
|
8018
8113
|
}
|
|
8019
8114
|
|
|
8020
8115
|
if (pointB && !pointA) {
|
|
8021
|
-
xPoint =
|
|
8116
|
+
xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
|
|
8022
8117
|
tooltipTitle = pointB.x.value;
|
|
8023
8118
|
|
|
8024
8119
|
if (!pointB.y.color) {
|
|
@@ -8028,14 +8123,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8028
8123
|
tooltipData.push(pointB.y);
|
|
8029
8124
|
|
|
8030
8125
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8031
|
-
tooltipTitle = d3.timeFormat(
|
|
8126
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8032
8127
|
}
|
|
8033
8128
|
}
|
|
8034
8129
|
|
|
8035
8130
|
if (pointA && pointB) {
|
|
8036
|
-
var d0 =
|
|
8131
|
+
var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
|
|
8037
8132
|
|
|
8038
|
-
var d1 =
|
|
8133
|
+
var d1 = _this47[xAxis](_this47.parseX(pointB.x.value));
|
|
8039
8134
|
|
|
8040
8135
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8041
8136
|
|
|
@@ -8044,7 +8139,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8044
8139
|
tooltipTitle = pointB.x.value;
|
|
8045
8140
|
|
|
8046
8141
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8047
|
-
tooltipTitle = d3.timeFormat(
|
|
8142
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8048
8143
|
}
|
|
8049
8144
|
|
|
8050
8145
|
if (!pointB.y.color) {
|
|
@@ -8057,7 +8152,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8057
8152
|
tooltipTitle = pointA.x.value;
|
|
8058
8153
|
|
|
8059
8154
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8060
|
-
tooltipTitle = d3.timeFormat(
|
|
8155
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8061
8156
|
}
|
|
8062
8157
|
|
|
8063
8158
|
if (!pointA.y.color) {
|
|
@@ -8121,6 +8216,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8121
8216
|
}
|
|
8122
8217
|
|
|
8123
8218
|
this.tooltip.setHeight(this.plotHeight);
|
|
8219
|
+
|
|
8220
|
+
if (isNaN(posOptions.left)) {
|
|
8221
|
+
this.tooltip.hide();
|
|
8222
|
+
return;
|
|
8223
|
+
}
|
|
8224
|
+
|
|
8124
8225
|
this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions); // }
|
|
8125
8226
|
// else {
|
|
8126
8227
|
// xPoint = x0
|
|
@@ -8151,20 +8252,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8151
8252
|
/* global d3 WebsyDesigns */
|
|
8152
8253
|
this.defs = this.svg.append('defs');
|
|
8153
8254
|
this.clip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_clip")).append('rect');
|
|
8255
|
+
this.xAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_xAxisClip")).append('rect');
|
|
8154
8256
|
this.brushClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_brushclip")).append('rect');
|
|
8155
8257
|
this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer');
|
|
8156
8258
|
this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer');
|
|
8157
|
-
this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer');
|
|
8259
|
+
this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_xAxisClip)")).append('g');
|
|
8158
8260
|
this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer');
|
|
8159
8261
|
this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer');
|
|
8160
8262
|
this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer');
|
|
8161
|
-
this.plotArea = this.svg.append('g').attr('class', 'plot-layer');
|
|
8162
|
-
this.areaLayer = this.svg.append('g').attr('class', 'area-layer');
|
|
8163
|
-
this.lineLayer = this.svg.append('g').attr('class', 'line-layer');
|
|
8164
|
-
this.barLayer = this.svg.append('g').attr('class', 'bar-layer');
|
|
8165
|
-
|
|
8166
|
-
this.
|
|
8167
|
-
this.
|
|
8263
|
+
this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
8264
|
+
this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
8265
|
+
this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
8266
|
+
this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g'); // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
|
|
8267
|
+
|
|
8268
|
+
this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
8269
|
+
this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
8270
|
+
this.refLineLayer = this.svg.append('g').attr('class', 'refline-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
8168
8271
|
this.trackingLineLayer = this.svg.append('g').attr('class', 'tracking-line-layer');
|
|
8169
8272
|
this.trackingLineLayer.append('line').attr('class', 'tracking-line');
|
|
8170
8273
|
this.tooltip = new WebsyDesigns.WebsyChartTooltip(this.svg);
|
|
@@ -8182,7 +8285,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8182
8285
|
}, {
|
|
8183
8286
|
key: "render",
|
|
8184
8287
|
value: function render(options) {
|
|
8185
|
-
var
|
|
8288
|
+
var _this48 = this;
|
|
8186
8289
|
|
|
8187
8290
|
/* global d3 options WebsyUtils */
|
|
8188
8291
|
if (typeof options !== 'undefined') {
|
|
@@ -8257,7 +8360,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8257
8360
|
this.options.data.series.map(function (s, i) {
|
|
8258
8361
|
return {
|
|
8259
8362
|
value: s.label || s.key,
|
|
8260
|
-
color: s.color ||
|
|
8363
|
+
color: s.color || _this48.options.colors[i % _this48.options.colors.length]
|
|
8261
8364
|
};
|
|
8262
8365
|
});
|
|
8263
8366
|
}
|
|
@@ -8456,46 +8559,123 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8456
8559
|
if (this.options.axis.hideBottom === true) {
|
|
8457
8560
|
this.options.margin.axisBottom = 0;
|
|
8458
8561
|
}
|
|
8459
|
-
} //
|
|
8562
|
+
} // At some point before this we need to add in logic to make space for any data point labels
|
|
8563
|
+
// Define the plot size
|
|
8460
8564
|
|
|
8461
8565
|
|
|
8462
8566
|
this.plotWidth = this.width - this.options.margin.legendLeft - this.options.margin.legendRight - this.options.margin.left - this.options.margin.right - this.options.margin.axisLeft - this.options.margin.axisRight;
|
|
8463
8567
|
this.plotHeight = this.height - this.options.margin.legendTop - this.options.margin.legendBottom - this.options.margin.top - this.options.margin.bottom - this.options.margin.axisBottom - this.options.margin.axisTop;
|
|
8464
8568
|
this.brushNeeded = false;
|
|
8569
|
+
var proposedBandWidth; // distance between x axis data points.
|
|
8570
|
+
|
|
8571
|
+
var maxBandWidthFits = false; // Check to see if all bars at the max allowed width will fit
|
|
8572
|
+
|
|
8573
|
+
this.bandPadding = 0;
|
|
8574
|
+
this.totalBandPadding = 0;
|
|
8575
|
+
this.brushBandPadding = 0;
|
|
8576
|
+
this.totalBrushBandPadding = 0;
|
|
8577
|
+
var noOfPoints = 0;
|
|
8578
|
+
var noOfGroups = 0;
|
|
8579
|
+
var plotable = 0;
|
|
8580
|
+
|
|
8581
|
+
if (this.options.maxBandWidth) {
|
|
8582
|
+
if (this.options.orientation === 'horizontal') {
|
|
8583
|
+
this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
|
|
8584
|
+
if (typeof b.valueCount === 'undefined') {
|
|
8585
|
+
return a + 1;
|
|
8586
|
+
}
|
|
8465
8587
|
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8588
|
+
return a + b.valueCount;
|
|
8589
|
+
}, 0);
|
|
8590
|
+
|
|
8591
|
+
if (this.options.data.left.padding) {
|
|
8592
|
+
this.totalBandPadding = this.plotHeight * this.options.data.left.padding;
|
|
8593
|
+
this.bandPadding = this.totalBandPadding / this.options.data.left.data.length;
|
|
8594
|
+
this.totalBrushBandPadding = this.plotHeight * this.options.data.left.padding;
|
|
8595
|
+
this.brushBandPadding = this.totalBandPadding / this.options.data.left.data.length;
|
|
8470
8596
|
}
|
|
8471
8597
|
|
|
8472
|
-
|
|
8473
|
-
|
|
8598
|
+
plotable = this.plotHeight - this.totalBandPadding;
|
|
8599
|
+
noOfPoints = this.options.grouping === 'grouped' ? this.options.data.left.totalValueCount : this.options.data.left.data.length;
|
|
8600
|
+
noOfGroups = this.options.data.left.data.length;
|
|
8601
|
+
} else {
|
|
8602
|
+
this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
|
|
8603
|
+
if (typeof b.valueCount === 'undefined') {
|
|
8604
|
+
return a + 1;
|
|
8605
|
+
}
|
|
8474
8606
|
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
} // some if to check if brushing is needed
|
|
8607
|
+
return a + b.valueCount;
|
|
8608
|
+
}, 0);
|
|
8478
8609
|
|
|
8610
|
+
if (this.options.data.bottom.padding) {
|
|
8611
|
+
this.totalBandPadding = this.plotWidth * this.options.data.bottom.padding;
|
|
8612
|
+
this.bandPadding = this.totalBandPadding / this.options.data.bottom.data.length;
|
|
8613
|
+
this.totalBrushBandPadding = this.plotWidth * this.options.data.bottom.padding;
|
|
8614
|
+
this.brushBandPadding = this.totalBandPadding / this.options.data.bottom.data.length;
|
|
8615
|
+
}
|
|
8479
8616
|
|
|
8480
|
-
|
|
8481
|
-
this.
|
|
8482
|
-
|
|
8617
|
+
plotable = this.plotWidth - this.totalBandPadding;
|
|
8618
|
+
noOfPoints = this.options.grouping === 'grouped' ? this.options.data.bottom.totalValueCount : this.options.data.bottom.data.length;
|
|
8619
|
+
noOfGroups = this.options.data.bottom.data.length;
|
|
8620
|
+
}
|
|
8621
|
+
|
|
8622
|
+
if (plotable / noOfPoints > this.options.maxBandWidth) {
|
|
8623
|
+
maxBandWidthFits = true;
|
|
8624
|
+
proposedBandWidth = this.options.maxBandWidth;
|
|
8483
8625
|
}
|
|
8484
|
-
} else {
|
|
8485
|
-
// some if to check if brushing is needed
|
|
8486
|
-
this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
|
|
8487
|
-
if (typeof b.valueCount === 'undefined') {
|
|
8488
|
-
return a + 1;
|
|
8489
|
-
}
|
|
8490
8626
|
|
|
8491
|
-
|
|
8492
|
-
|
|
8627
|
+
if (!maxBandWidthFits) {
|
|
8628
|
+
// Check to see if all bars at the min allowed width will fit
|
|
8629
|
+
if (plotable / noOfPoints < this.options.minBandWidth) {
|
|
8630
|
+
this.brushNeeded = true;
|
|
8631
|
+
proposedBandWidth = this.options.minBandWidth;
|
|
8493
8632
|
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8633
|
+
if (this.options.orientation === 'horizontal') {
|
|
8634
|
+
this.plotWidth -= this.options.brushHeight;
|
|
8635
|
+
} else {
|
|
8636
|
+
this.plotHeight -= this.options.brushHeight;
|
|
8637
|
+
}
|
|
8638
|
+
} else {
|
|
8639
|
+
proposedBandWidth = plotable / noOfPoints;
|
|
8640
|
+
}
|
|
8497
8641
|
}
|
|
8498
|
-
} //
|
|
8642
|
+
} // if (this.options.minBandWidth) {
|
|
8643
|
+
// this.widthForCalc = this.options.data.bottom.totalValueCount * this.options.minBandWidth
|
|
8644
|
+
// if (this.options.data.bottom.padding) {
|
|
8645
|
+
// this.widthForCalc += (this.options.minBandWidth * this.options.data.bottom.padding) * this.options.data.bottom.totalValueCount
|
|
8646
|
+
// this.widthForCalc += (this.options.data.bottom.data.length * this.options.groupPadding * 2)
|
|
8647
|
+
// }
|
|
8648
|
+
// }
|
|
8649
|
+
// if (this.options.orientation === 'vertical') {
|
|
8650
|
+
// this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce((a, b) => {
|
|
8651
|
+
// if (typeof b.valueCount === 'undefined') {
|
|
8652
|
+
// return a + 1
|
|
8653
|
+
// }
|
|
8654
|
+
// return a + b.valueCount
|
|
8655
|
+
// }, 0)
|
|
8656
|
+
// if (this.options.maxBandWidth) {
|
|
8657
|
+
// this.plotWidth = Math.min(this.plotWidth, (this.options.data.bottom.totalValueCount) * this.options.maxBandWidth)
|
|
8658
|
+
// }
|
|
8659
|
+
// // some if to check if brushing is needed
|
|
8660
|
+
// if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
|
|
8661
|
+
// this.brushNeeded = true
|
|
8662
|
+
// this.plotHeight -= this.options.brushHeight
|
|
8663
|
+
// }
|
|
8664
|
+
// }
|
|
8665
|
+
// else {
|
|
8666
|
+
// // some if to check if brushing is needed
|
|
8667
|
+
// this.options.data.left.totalValueCount = this.options.data.left.data.reduce((a, b) => {
|
|
8668
|
+
// if (typeof b.valueCount === 'undefined') {
|
|
8669
|
+
// return a + 1
|
|
8670
|
+
// }
|
|
8671
|
+
// return a + b.valueCount
|
|
8672
|
+
// }, 0)
|
|
8673
|
+
// if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
|
|
8674
|
+
// this.brushNeeded = true
|
|
8675
|
+
// this.plotWidth -= this.options.brushHeight
|
|
8676
|
+
// }
|
|
8677
|
+
// }
|
|
8678
|
+
// Translate the layers
|
|
8499
8679
|
|
|
8500
8680
|
|
|
8501
8681
|
this.leftAxisLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
|
|
@@ -8513,50 +8693,97 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8513
8693
|
this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
|
|
8514
8694
|
this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
|
|
8515
8695
|
this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")"));
|
|
8696
|
+
this.clip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", 0)")).attr('width', this.plotWidth).attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop);
|
|
8697
|
+
this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft).attr('height', longestBottomBounds.height + 10);
|
|
8516
8698
|
this.brushClip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")")).attr('width', this.plotWidth).attr('height', this.options.brushHeight);
|
|
8517
8699
|
this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
|
|
8518
8700
|
var that = this;
|
|
8519
8701
|
this.eventLayer.attr('x', 0).attr('y', 0).attr('width', this.plotWidth).attr('height', this.plotHeight).attr('fill-opacity', '0'); // this.tooltip.transform(this.options.margin.left + this.options.margin.axisLeft, this.options.margin.top + this.options.margin.axisTop)
|
|
8520
8702
|
// Configure the bottom axis
|
|
8521
8703
|
|
|
8522
|
-
var bottomDomain = this.createDomain('bottom');
|
|
8523
|
-
|
|
8704
|
+
var bottomDomain = this.createDomain('bottom'); // let bottomBrushDomain = this.createDomain('bottom', true)
|
|
8705
|
+
|
|
8706
|
+
var bottomBrushDomain = this.createDomain('bottom');
|
|
8524
8707
|
var bottomRange = [0, this.plotWidth];
|
|
8708
|
+
var bottomBrushRange = [0, this.plotWidth];
|
|
8709
|
+
var leftRange = [this.plotHeight, 0];
|
|
8710
|
+
var leftBrushRange = [this.options.brushHeight, 0];
|
|
8711
|
+
|
|
8712
|
+
if (this.options.orientation === 'horizontal') {
|
|
8713
|
+
leftBrushRange = [this.plotHeight, 0];
|
|
8714
|
+
}
|
|
8715
|
+
|
|
8716
|
+
this.widthForCalc = proposedBandWidth * noOfPoints; // + totalPadding
|
|
8717
|
+
|
|
8525
8718
|
this.customBottomRange = [];
|
|
8719
|
+
this.customBottomDetailRange = [];
|
|
8720
|
+
this.customBottomBrushRange = [];
|
|
8721
|
+
this.customLeftRange = [];
|
|
8722
|
+
this.customLeftDetailRange = [];
|
|
8723
|
+
this.customLeftBrushRange = []; // if (this.options.allowUnevenBands === true) {
|
|
8724
|
+
// always allow uneven bands
|
|
8526
8725
|
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
})));
|
|
8534
|
-
}
|
|
8726
|
+
var customRangeSide = 'Bottom';
|
|
8727
|
+
var customRangeSideLC = 'bottom';
|
|
8728
|
+
|
|
8729
|
+
if (this.options.orientation === 'horizontal') {
|
|
8730
|
+
customRangeSide = 'Left';
|
|
8731
|
+
customRangeSideLC = 'left';
|
|
8535
8732
|
}
|
|
8536
8733
|
|
|
8537
|
-
this.options.data.
|
|
8538
|
-
|
|
8734
|
+
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') {
|
|
8735
|
+
var acc = 0;
|
|
8736
|
+
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8737
|
+
var adjustment = _this48.bandPadding * index + _this48.bandPadding; // if (this.options.data.bottom.padding) {
|
|
8738
|
+
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8739
|
+
// }
|
|
8539
8740
|
|
|
8540
|
-
|
|
8541
|
-
this.totalPadding = this.plotWidth * this.options.data.bottom.padding;
|
|
8542
|
-
var rangeLength = bottomDomain.length;
|
|
8741
|
+
var start = _this48.widthForCalc / noOfPoints * acc;
|
|
8543
8742
|
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8743
|
+
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8744
|
+
var pos = i * proposedBandWidth;
|
|
8745
|
+
|
|
8746
|
+
_this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8747
|
+
}
|
|
8748
|
+
|
|
8749
|
+
acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
|
|
8750
|
+
var end = _this48.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8751
|
+
|
|
8752
|
+
return end + adjustment;
|
|
8753
|
+
})));
|
|
8754
|
+
acc = 0;
|
|
8755
|
+
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8756
|
+
var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
|
|
8757
|
+
acc += _this48.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
|
|
8758
|
+
return (_this48.options.orientation === 'vertical' ? _this48.plotWidth : _this48.plotHeight) / noOfPoints * acc;
|
|
8759
|
+
})));
|
|
8760
|
+
} // }
|
|
8547
8761
|
|
|
8548
|
-
|
|
8549
|
-
|
|
8762
|
+
|
|
8763
|
+
var rangeLength = bottomDomain.length;
|
|
8764
|
+
this.options.data.bottomBrush = {};
|
|
8765
|
+
this.options.data.leftBrush = {};
|
|
8766
|
+
|
|
8767
|
+
if (this.options.orientation === 'vertical') {
|
|
8768
|
+
this.options.data.bottom.bandWidth = proposedBandWidth;
|
|
8769
|
+
this.options.data.bottomBrush.bandWidth = (this.plotWidth - this.totalBandPadding) / noOfPoints;
|
|
8770
|
+
} else {
|
|
8771
|
+
this.options.data.left.bandWidth = proposedBandWidth;
|
|
8772
|
+
this.options.data.leftBrush.bandWidth = (this.plotHeight - this.totalBandPadding) / noOfPoints;
|
|
8550
8773
|
}
|
|
8551
8774
|
|
|
8552
|
-
|
|
8553
|
-
|
|
8775
|
+
this.brushBandPadding = this.totalBandPadding / noOfGroups;
|
|
8776
|
+
|
|
8777
|
+
if (this.options.orientation === 'vertical') {
|
|
8778
|
+
bottomRange = [0, this.widthForCalc + this.totalBandPadding];
|
|
8779
|
+
} else {
|
|
8780
|
+
leftRange = [this.widthForCalc + this.totalBandPadding, 0];
|
|
8554
8781
|
}
|
|
8555
8782
|
|
|
8556
|
-
this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || '
|
|
8783
|
+
this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Ordinal')]().domain(bottomDomain).range(bottomRange);
|
|
8557
8784
|
|
|
8558
8785
|
if (!this.brushInitialized) {
|
|
8559
|
-
this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || '
|
|
8786
|
+
this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Ordinal')]().domain(bottomBrushDomain).range(bottomBrushRange);
|
|
8560
8787
|
}
|
|
8561
8788
|
|
|
8562
8789
|
if (this.bottomAxis.nice) {// this.bottomAxis.nice()
|
|
@@ -8577,38 +8804,78 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8577
8804
|
brushLength = this.options.brushHeight;
|
|
8578
8805
|
brushThickness = this.plotHeight;
|
|
8579
8806
|
} else {
|
|
8580
|
-
if (
|
|
8581
|
-
brushEnd = this.plotWidth * (this.plotWidth / this.
|
|
8807
|
+
if (this.brushNeeded) {
|
|
8808
|
+
brushEnd = this.plotWidth * (this.plotWidth / (this.widthForCalc + this.totalBandPadding));
|
|
8582
8809
|
}
|
|
8583
8810
|
}
|
|
8584
8811
|
|
|
8585
|
-
this.brush = d3[brushMethod]().extent([[0, 0], [brushLength, brushThickness]]).on('brush end', this.brushed);
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
//
|
|
8812
|
+
this.brush = d3[brushMethod]().extent([[0, 0], [brushLength, brushThickness]]).on('brush end', this.brushed); // const brushResizePath = d => {
|
|
8813
|
+
// let e = +(d.type === 'e')
|
|
8814
|
+
// let x = e ? 1 : -1
|
|
8815
|
+
// let y = this.options.brushHeight
|
|
8816
|
+
// return (
|
|
8817
|
+
// 'M' +
|
|
8818
|
+
// 0.5 * x +
|
|
8819
|
+
// ',' +
|
|
8820
|
+
// y +
|
|
8821
|
+
// 'A6,6 0 0 ' +
|
|
8822
|
+
// e +
|
|
8823
|
+
// ' ' +
|
|
8824
|
+
// 6.5 * x +
|
|
8825
|
+
// ',' +
|
|
8826
|
+
// (y + 6) +
|
|
8827
|
+
// 'V' +
|
|
8828
|
+
// (2 * y - 6) +
|
|
8829
|
+
// 'A6,6 0 0 ' +
|
|
8830
|
+
// e +
|
|
8831
|
+
// ' ' +
|
|
8832
|
+
// 0.5 * x +
|
|
8833
|
+
// ',' +
|
|
8834
|
+
// 2 * y +
|
|
8835
|
+
// 'Z' +
|
|
8836
|
+
// 'M' +
|
|
8837
|
+
// 2.5 * x +
|
|
8838
|
+
// ',' +
|
|
8839
|
+
// (y + 8) +
|
|
8840
|
+
// 'V' +
|
|
8841
|
+
// (2 * y - 8) +
|
|
8842
|
+
// 'M' +
|
|
8843
|
+
// 4.5 * x +
|
|
8844
|
+
// ',' +
|
|
8845
|
+
// (y + 8) +
|
|
8846
|
+
// 'V' +
|
|
8847
|
+
// (2 * y - 8)
|
|
8848
|
+
// )
|
|
8849
|
+
// }
|
|
8850
|
+
// this.brushHandle = this.brushLayer
|
|
8851
|
+
// .select('.brush')
|
|
8852
|
+
// .selectAll('.handle--custom')
|
|
8853
|
+
// .remove()
|
|
8854
|
+
// this.brushHandle = this.brushLayer
|
|
8855
|
+
// .select('.brush')
|
|
8856
|
+
// .selectAll('.handle--custom')
|
|
8857
|
+
// .data([{ type: 'w' }, { type: 'e' }])
|
|
8858
|
+
// .enter()
|
|
8859
|
+
// .append('path')
|
|
8860
|
+
// .attr('class', 'handle--custom')
|
|
8861
|
+
// .attr('stroke', 'transparent')
|
|
8862
|
+
// .attr('fill', 'transparent')
|
|
8863
|
+
// .attr('cursor', 'ew-resize')
|
|
8864
|
+
// .attr('d', brushResizePath)
|
|
8865
|
+
// BRUSH END
|
|
8866
|
+
// this.brushLayer.selectAll('.handle').remove()
|
|
8601
8867
|
|
|
8602
8868
|
if (this.brushNeeded) {
|
|
8603
8869
|
if (!this.brushInitialized) {
|
|
8604
8870
|
this.brushLayer.style('visibility', 'visible');
|
|
8605
8871
|
this.brushInitialized = true;
|
|
8606
8872
|
this.brushLayer.select('.brush').call(this.brush).call(this.brush.move, [0, brushEnd]);
|
|
8873
|
+
} else {
|
|
8874
|
+
this.brushLayer.style('visibility', 'visible');
|
|
8607
8875
|
}
|
|
8608
8876
|
} else {
|
|
8609
8877
|
this.brushLayer.style('visibility', 'hidden'); // this.brushLayer.selectAll().remove()
|
|
8610
|
-
|
|
8611
|
-
this.brushArea.selectAll('*').remove();
|
|
8878
|
+
// this.brushArea.selectAll('*').remove()
|
|
8612
8879
|
}
|
|
8613
8880
|
|
|
8614
8881
|
if (this.options.margin.axisBottom > 0) {
|
|
@@ -8666,7 +8933,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8666
8933
|
|
|
8667
8934
|
if (this.options.data.bottom.formatter) {
|
|
8668
8935
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8669
|
-
return
|
|
8936
|
+
return _this48.options.data.bottom.formatter(d);
|
|
8670
8937
|
});
|
|
8671
8938
|
}
|
|
8672
8939
|
|
|
@@ -8678,7 +8945,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8678
8945
|
|
|
8679
8946
|
if (this.customBottomRange.length > 0) {
|
|
8680
8947
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8681
|
-
return "translate(".concat(
|
|
8948
|
+
return "translate(".concat(_this48.customBottomRange[i] + (_this48.customBottomRange[i + 1] - _this48.customBottomRange[i]) / 2, ", 0)");
|
|
8682
8949
|
});
|
|
8683
8950
|
}
|
|
8684
8951
|
} // Configure the left axis
|
|
@@ -8687,8 +8954,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8687
8954
|
var leftDomain = this.createDomain('left');
|
|
8688
8955
|
var leftBrushDomain = this.createDomain('left', true);
|
|
8689
8956
|
var rightDomain = this.createDomain('right');
|
|
8690
|
-
this.leftAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftDomain).range(
|
|
8691
|
-
this.leftBrushAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftBrushDomain).range(
|
|
8957
|
+
this.leftAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftDomain).range(leftRange);
|
|
8958
|
+
this.leftBrushAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftBrushDomain).range(leftBrushRange);
|
|
8692
8959
|
|
|
8693
8960
|
if (this.leftAxis.padding && this.options.data.left.padding) {
|
|
8694
8961
|
this.leftAxis.padding(this.options.data.left.padding || 0);
|
|
@@ -8700,12 +8967,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8700
8967
|
|
|
8701
8968
|
if (this.options.margin.axisLeft > 0) {
|
|
8702
8969
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8703
|
-
if (
|
|
8704
|
-
d =
|
|
8970
|
+
if (_this48.options.data.left.formatter) {
|
|
8971
|
+
d = _this48.options.data.left.formatter(d);
|
|
8705
8972
|
}
|
|
8706
8973
|
|
|
8707
8974
|
return d;
|
|
8708
8975
|
}));
|
|
8976
|
+
|
|
8977
|
+
if (this.customLeftRange.length > 0) {
|
|
8978
|
+
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8979
|
+
return "translate(0, ".concat(_this48.customLeftRange[i] + (_this48.customLeftRange[i + 1] - _this48.customLeftRange[i]) / 2, ")");
|
|
8980
|
+
});
|
|
8981
|
+
}
|
|
8709
8982
|
}
|
|
8710
8983
|
|
|
8711
8984
|
if (this.options.data.left && this.options.data.left.showTitle === true) {
|
|
@@ -8736,8 +9009,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8736
9009
|
|
|
8737
9010
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8738
9011
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8739
|
-
if (
|
|
8740
|
-
d =
|
|
9012
|
+
if (_this48.options.data.right.formatter) {
|
|
9013
|
+
d = _this48.options.data.right.formatter(d);
|
|
8741
9014
|
}
|
|
8742
9015
|
|
|
8743
9016
|
return d;
|
|
@@ -8768,7 +9041,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8768
9041
|
for (var key in this.renderedKeys) {
|
|
8769
9042
|
if (newKeys.indexOf(key) === -1) {
|
|
8770
9043
|
// remove the components
|
|
8771
|
-
this[
|
|
9044
|
+
// this[`remove${this.renderedKeys[key]}`](key)
|
|
9045
|
+
this.removeline(key);
|
|
9046
|
+
this.removebar(key);
|
|
9047
|
+
this.removesymbol(key);
|
|
9048
|
+
this.removelabel(key);
|
|
8772
9049
|
}
|
|
8773
9050
|
}
|
|
8774
9051
|
|
|
@@ -8779,48 +9056,57 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8779
9056
|
}, {
|
|
8780
9057
|
key: "renderComponents",
|
|
8781
9058
|
value: function renderComponents() {
|
|
8782
|
-
var
|
|
9059
|
+
var _this49 = this;
|
|
8783
9060
|
|
|
8784
9061
|
// Draw the series data
|
|
8785
9062
|
this.renderedKeys = {};
|
|
8786
9063
|
this.options.data.series.forEach(function (series, index) {
|
|
8787
9064
|
if (!series.key) {
|
|
8788
|
-
series.key =
|
|
9065
|
+
series.key = _this49.createIdentity();
|
|
8789
9066
|
}
|
|
8790
9067
|
|
|
8791
9068
|
if (!series.color) {
|
|
8792
|
-
series.color =
|
|
9069
|
+
series.color = _this49.options.colors[index % _this49.options.colors.length];
|
|
8793
9070
|
}
|
|
8794
9071
|
|
|
8795
|
-
|
|
9072
|
+
_this49["render".concat(series.type || 'bar')](series, index);
|
|
8796
9073
|
|
|
8797
|
-
|
|
9074
|
+
_this49.renderLabels(series, index);
|
|
8798
9075
|
|
|
8799
|
-
|
|
9076
|
+
_this49.renderedKeys[series.key] = series.type;
|
|
8800
9077
|
});
|
|
8801
9078
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8802
9079
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8803
9080
|
|
|
8804
9081
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8805
9082
|
this.options.refLines.forEach(function (l) {
|
|
8806
|
-
return
|
|
9083
|
+
return _this49.renderRefLine(l);
|
|
8807
9084
|
});
|
|
8808
9085
|
}
|
|
8809
9086
|
}
|
|
8810
9087
|
}, {
|
|
8811
9088
|
key: "renderarea",
|
|
8812
9089
|
value: function renderarea(series, index) {
|
|
8813
|
-
var
|
|
9090
|
+
var _this50 = this;
|
|
8814
9091
|
|
|
8815
9092
|
/* global d3 series index */
|
|
8816
9093
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8817
9094
|
return d3.area().x(function (d) {
|
|
8818
|
-
return
|
|
9095
|
+
// return this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
9096
|
+
var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9097
|
+
|
|
9098
|
+
var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9099
|
+
|
|
9100
|
+
if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9101
|
+
xPos = xPos + (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9102
|
+
}
|
|
9103
|
+
|
|
9104
|
+
return xPos;
|
|
8819
9105
|
}).y0(function (d) {
|
|
8820
|
-
return
|
|
9106
|
+
return _this50["".concat(yAxis, "Axis")](0);
|
|
8821
9107
|
}).y1(function (d) {
|
|
8822
|
-
return
|
|
8823
|
-
}).curve(d3[curveStyle ||
|
|
9108
|
+
return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9109
|
+
}).curve(d3[curveStyle || _this50.options.curveStyle]);
|
|
8824
9110
|
};
|
|
8825
9111
|
|
|
8826
9112
|
var xAxis = 'bottom';
|
|
@@ -8838,23 +9124,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8838
9124
|
areas // .style('stroke-width', series.lineWidth || this.options.lineWidth)
|
|
8839
9125
|
// .attr('id', `line_${series.key}`)
|
|
8840
9126
|
// .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
8841
|
-
|
|
8842
|
-
|
|
9127
|
+
.attr('fill', function (d) {
|
|
9128
|
+
return d[0].y.color || series.color;
|
|
9129
|
+
}) // .attr('stroke', 'transparent')
|
|
8843
9130
|
.transition(this.transition).attr('d', function (d) {
|
|
8844
9131
|
return drawArea(xAxis, yAxis, series.curveStyle)(d);
|
|
8845
9132
|
}); // Enter
|
|
8846
9133
|
|
|
8847
9134
|
areas.enter().append('path').attr('d', function (d) {
|
|
8848
9135
|
return drawArea(xAxis, yAxis, series.curveStyle)(d);
|
|
8849
|
-
}).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)).attr('transform', 'translate(' + (this.options.data[xAxis].scale === 'Time' ? 0 : this.options.data[xAxis
|
|
8850
|
-
.
|
|
9136
|
+
}).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)) // .attr('transform', 'translate(' + (this.options.data[xAxis].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2) + ',0)')
|
|
9137
|
+
// .style('stroke-width', series.lineWidth || this.options.lineWidth)
|
|
9138
|
+
.attr('fill', function (d) {
|
|
9139
|
+
return d[0].y.color || series.color;
|
|
9140
|
+
}) // .style('fill-opacity', 0)
|
|
8851
9141
|
.attr('stroke', 'transparent') // .transition(this.transition)
|
|
8852
|
-
.style('fill-opacity', series.opacity || 0.
|
|
9142
|
+
.style('fill-opacity', series.opacity || 0.3);
|
|
8853
9143
|
}
|
|
8854
9144
|
}, {
|
|
8855
9145
|
key: "renderbar",
|
|
8856
9146
|
value: function renderbar(series, index) {
|
|
8857
|
-
var
|
|
9147
|
+
var _this51 = this;
|
|
8858
9148
|
|
|
8859
9149
|
/* global series index d3 */
|
|
8860
9150
|
var xAxis = 'bottom';
|
|
@@ -8866,16 +9156,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8866
9156
|
if (this.options.orientation === 'horizontal') {
|
|
8867
9157
|
xAxis = 'left';
|
|
8868
9158
|
yAxis = 'bottom';
|
|
8869
|
-
}
|
|
8870
|
-
// barWidth = barWidth / this.options.data.series.length - 4
|
|
8871
|
-
// }
|
|
8872
|
-
|
|
9159
|
+
}
|
|
8873
9160
|
|
|
8874
|
-
function getBarHeight(d, i,
|
|
9161
|
+
function getBarHeight(d, i, yAxis, xAxis) {
|
|
8875
9162
|
var output;
|
|
8876
9163
|
|
|
8877
9164
|
if (this.options.orientation === 'horizontal') {
|
|
8878
|
-
output = this.options.data[xAxis.
|
|
9165
|
+
output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
|
|
8879
9166
|
} else {
|
|
8880
9167
|
var x = getBarX.call(this, d, i, xAxis);
|
|
8881
9168
|
|
|
@@ -8897,9 +9184,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8897
9184
|
var output;
|
|
8898
9185
|
|
|
8899
9186
|
if (this.options.orientation === 'horizontal') {
|
|
8900
|
-
|
|
8901
|
-
acummulativeY[d.y.index] += width;
|
|
8902
|
-
output = width;
|
|
9187
|
+
output = this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
|
|
8903
9188
|
} else {
|
|
8904
9189
|
var x = getBarX.call(this, d, i, xAxis);
|
|
8905
9190
|
|
|
@@ -8907,7 +9192,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8907
9192
|
return null;
|
|
8908
9193
|
}
|
|
8909
9194
|
|
|
8910
|
-
output = Math.max(1, this.options.data[xAxis.
|
|
9195
|
+
output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
|
|
8911
9196
|
}
|
|
8912
9197
|
|
|
8913
9198
|
if (isNaN(output)) {
|
|
@@ -8918,46 +9203,50 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8918
9203
|
}
|
|
8919
9204
|
|
|
8920
9205
|
function getBarX(d, i, xAxis) {
|
|
8921
|
-
// let barWidth = this.plotWidth / this.options.data[xAxis.replace('Brush', '')].totalValueCount
|
|
8922
|
-
// if (this.options.data[xAxis.replace('Brush', '')].padding) {
|
|
8923
|
-
// barWidth = barWidth - (barWidth * this.options.data[xAxis.replace('Brush', '')].padding)
|
|
8924
|
-
// }
|
|
8925
|
-
// let groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data[xAxis.replace('Brush', '')].totalValueCount
|
|
8926
9206
|
var output;
|
|
8927
9207
|
|
|
8928
9208
|
if (this.options.orientation === 'horizontal') {
|
|
8929
9209
|
if (this.options.grouping === 'stacked') {
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
}
|
|
9210
|
+
// let h = getBarWidth.call(this, d, i, xAxis)
|
|
9211
|
+
// let adjustment = 0
|
|
9212
|
+
// if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
9213
|
+
// adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
9214
|
+
// }
|
|
9215
|
+
// output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9216
|
+
var accH = getBarWidth.call(this, {
|
|
9217
|
+
x: d.x,
|
|
9218
|
+
y: {
|
|
9219
|
+
value: d.y.accumulative
|
|
9220
|
+
}
|
|
9221
|
+
}, i, xAxis); // let h = getBarWidth.call(this, d, i, xAxis)
|
|
8936
9222
|
|
|
8937
|
-
output =
|
|
9223
|
+
output = accH * (d.y.accumulative < 0 ? 0 : 1);
|
|
8938
9224
|
} else {
|
|
8939
|
-
var
|
|
8940
|
-
|
|
8941
|
-
output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
|
|
9225
|
+
var h = getBarWidth.call(this, d, i, xAxis);
|
|
9226
|
+
output = this["".concat(yAxis, "Axis")](0) + h * (d.y.value < 0 ? 1 : 0);
|
|
8942
9227
|
}
|
|
8943
9228
|
} else {
|
|
8944
9229
|
// let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
|
|
8945
|
-
|
|
8946
|
-
|
|
9230
|
+
// let adjustment = this[`custom${xAxis.toInitialCaps()}Range`][i] + (i * this.options.data[xAxis].bandWidth)
|
|
8947
9231
|
if (this.options.grouping === 'grouped') {
|
|
8948
9232
|
var xIndex = 0;
|
|
8949
9233
|
|
|
8950
9234
|
if (this.processedX[d.x.value]) {
|
|
8951
9235
|
xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel));
|
|
8952
|
-
}
|
|
8953
|
-
|
|
8954
|
-
|
|
9236
|
+
} // let barAdjustment =
|
|
9237
|
+
// (this.options.data[xAxis].bandWidth * xIndex) +
|
|
9238
|
+
// (xIndex * this.options.groupPadding * 2) + this.options.groupPadding +
|
|
9239
|
+
// (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
|
|
9240
|
+
// let barAdjustment =
|
|
8955
9241
|
// (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
|
|
8956
9242
|
// this.options.groupPadding
|
|
8957
9243
|
// // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
|
|
8958
9244
|
|
|
8959
|
-
|
|
8960
|
-
|
|
9245
|
+
|
|
9246
|
+
var barAdjustment = this.options.data[xAxis].bandWidth * xIndex + (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
|
|
9247
|
+
|
|
9248
|
+
if (this["custom".concat(xAxis.toInitialCaps(), "Range")].length > 0) {
|
|
9249
|
+
output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment; // output = this[`custom${xAxis.toInitialCaps().replace('Brush', '')}DetailRange`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)]
|
|
8961
9250
|
} else {
|
|
8962
9251
|
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
|
|
8963
9252
|
}
|
|
@@ -8968,12 +9257,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8968
9257
|
|
|
8969
9258
|
if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
|
|
8970
9259
|
this.processedX[d.x.value].push(d.y.tooltipLabel);
|
|
8971
|
-
}
|
|
9260
|
+
} // console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output)
|
|
8972
9261
|
|
|
8973
|
-
console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output);
|
|
8974
9262
|
} else {
|
|
8975
|
-
|
|
8976
|
-
|
|
9263
|
+
var _barAdjustment = (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
|
|
9264
|
+
|
|
9265
|
+
output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + _barAdjustment;
|
|
8977
9266
|
}
|
|
8978
9267
|
}
|
|
8979
9268
|
|
|
@@ -8984,23 +9273,30 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8984
9273
|
return output;
|
|
8985
9274
|
}
|
|
8986
9275
|
|
|
8987
|
-
function getBarY(d, i,
|
|
8988
|
-
// let barWidth = this[`${xAxis}Axis`].bandwidth()
|
|
8989
|
-
// let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
|
|
9276
|
+
function getBarY(d, i, yAxis, xAxis) {
|
|
8990
9277
|
var output;
|
|
8991
9278
|
|
|
8992
9279
|
if (this.options.orientation === 'horizontal') {
|
|
8993
9280
|
if (this.options.grouping !== 'grouped') {
|
|
8994
|
-
|
|
9281
|
+
var barAdjustment = (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
|
|
9282
|
+
output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
|
|
8995
9283
|
} else {
|
|
8996
9284
|
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
|
|
8997
9285
|
}
|
|
8998
9286
|
} else {
|
|
8999
9287
|
if (this.options.grouping === 'stacked') {
|
|
9000
|
-
|
|
9288
|
+
var accH = getBarHeight.call(this, {
|
|
9289
|
+
x: d.x,
|
|
9290
|
+
y: {
|
|
9291
|
+
value: d.y.accumulative
|
|
9292
|
+
}
|
|
9293
|
+
}, i, yAxis, xAxis);
|
|
9294
|
+
var h = getBarHeight.call(this, d, i, yAxis, xAxis);
|
|
9295
|
+
output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
|
|
9001
9296
|
} else {
|
|
9002
|
-
var
|
|
9003
|
-
|
|
9297
|
+
var _h = getBarHeight.call(this, d, i, yAxis, xAxis);
|
|
9298
|
+
|
|
9299
|
+
output = this["".concat(yAxis, "Axis")](0) - _h * (d.y.value < 0 ? 0 : 1);
|
|
9004
9300
|
}
|
|
9005
9301
|
}
|
|
9006
9302
|
|
|
@@ -9013,25 +9309,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9013
9309
|
|
|
9014
9310
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9015
9311
|
bars.attr('width', function (d, i) {
|
|
9016
|
-
return Math.abs(getBarWidth.call(
|
|
9312
|
+
return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
|
|
9017
9313
|
}).attr('height', function (d, i) {
|
|
9018
|
-
return getBarHeight.call(
|
|
9314
|
+
return getBarHeight.call(_this51, d, i, yAxis, xAxis);
|
|
9019
9315
|
}).attr('x', function (d, i) {
|
|
9020
|
-
return getBarX.call(
|
|
9316
|
+
return getBarX.call(_this51, d, i, xAxis);
|
|
9021
9317
|
}).attr('y', function (d, i) {
|
|
9022
|
-
return getBarY.call(
|
|
9318
|
+
return getBarY.call(_this51, d, i, yAxis, xAxis);
|
|
9023
9319
|
}) // .transition(this.transition)
|
|
9024
9320
|
.attr('fill', function (d) {
|
|
9025
9321
|
return d.y.color || d.color || series.color;
|
|
9026
9322
|
});
|
|
9027
9323
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9028
|
-
return Math.abs(getBarWidth.call(
|
|
9324
|
+
return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
|
|
9029
9325
|
}).attr('height', function (d, i) {
|
|
9030
|
-
return getBarHeight.call(
|
|
9326
|
+
return getBarHeight.call(_this51, d, i, yAxis, xAxis);
|
|
9031
9327
|
}).attr('x', function (d, i) {
|
|
9032
|
-
return getBarX.call(
|
|
9328
|
+
return getBarX.call(_this51, d, i, xAxis);
|
|
9033
9329
|
}).attr('y', function (d, i) {
|
|
9034
|
-
return getBarY.call(
|
|
9330
|
+
return getBarY.call(_this51, d, i, yAxis, xAxis);
|
|
9035
9331
|
}) // .transition(this.transition)
|
|
9036
9332
|
.attr('fill', function (d) {
|
|
9037
9333
|
return d.y.color || d.color || series.color;
|
|
@@ -9043,25 +9339,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9043
9339
|
this.brushBarsInitialized[series.key] = true;
|
|
9044
9340
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9045
9341
|
brushBars.attr('width', function (d, i) {
|
|
9046
|
-
return Math.abs(getBarWidth.call(
|
|
9342
|
+
return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
|
|
9047
9343
|
}).attr('height', function (d, i) {
|
|
9048
|
-
return getBarHeight.call(
|
|
9344
|
+
return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9049
9345
|
}).attr('x', function (d, i) {
|
|
9050
|
-
return getBarX.call(
|
|
9346
|
+
return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
|
|
9051
9347
|
}).attr('y', function (d, i) {
|
|
9052
|
-
return getBarY.call(
|
|
9348
|
+
return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9053
9349
|
}) // .transition(this.transition)
|
|
9054
9350
|
.attr('fill', function (d) {
|
|
9055
9351
|
return d.y.color || d.color || series.color;
|
|
9056
9352
|
});
|
|
9057
9353
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9058
|
-
return Math.abs(getBarWidth.call(
|
|
9354
|
+
return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
|
|
9059
9355
|
}).attr('height', function (d, i) {
|
|
9060
|
-
return getBarHeight.call(
|
|
9356
|
+
return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9061
9357
|
}).attr('x', function (d, i) {
|
|
9062
|
-
return getBarX.call(
|
|
9358
|
+
return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
|
|
9063
9359
|
}).attr('y', function (d, i) {
|
|
9064
|
-
return getBarY.call(
|
|
9360
|
+
return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9065
9361
|
}) // .transition(this.transition)
|
|
9066
9362
|
.attr('fill', function (d) {
|
|
9067
9363
|
return d.y.color || d.color || series.color;
|
|
@@ -9079,16 +9375,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9079
9375
|
}, {
|
|
9080
9376
|
key: "renderLabels",
|
|
9081
9377
|
value: function renderLabels(series, index) {
|
|
9082
|
-
var
|
|
9378
|
+
var _this52 = this;
|
|
9083
9379
|
|
|
9084
9380
|
/* global series index d3 WebsyDesigns */
|
|
9085
|
-
var xAxis = '
|
|
9086
|
-
var yAxis = '
|
|
9381
|
+
var xAxis = 'bottom';
|
|
9382
|
+
var yAxis = 'left';
|
|
9087
9383
|
var that = this;
|
|
9088
9384
|
|
|
9089
9385
|
if (this.options.orientation === 'horizontal') {
|
|
9090
|
-
xAxis = '
|
|
9091
|
-
yAxis = '
|
|
9386
|
+
xAxis = 'left';
|
|
9387
|
+
yAxis = 'bottom';
|
|
9092
9388
|
}
|
|
9093
9389
|
|
|
9094
9390
|
if (this.options.showLabels === true || series.showLabels === true) {
|
|
@@ -9098,15 +9394,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9098
9394
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9099
9395
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9100
9396
|
labels.attr('x', function (d) {
|
|
9101
|
-
return getLabelX.call(
|
|
9397
|
+
return getLabelX.call(_this52, d, series.labelPosition);
|
|
9102
9398
|
}).attr('y', function (d) {
|
|
9103
|
-
return getLabelY.call(
|
|
9399
|
+
return getLabelY.call(_this52, d, series.labelPosition);
|
|
9104
9400
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9105
|
-
if (
|
|
9401
|
+
if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9106
9402
|
return 'transparent';
|
|
9107
9403
|
}
|
|
9108
9404
|
|
|
9109
|
-
return
|
|
9405
|
+
return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9110
9406
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9111
9407
|
return d.y.label || d.y.value;
|
|
9112
9408
|
}).each(function (d, i) {
|
|
@@ -9131,15 +9427,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9131
9427
|
}
|
|
9132
9428
|
});
|
|
9133
9429
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9134
|
-
return getLabelX.call(
|
|
9430
|
+
return getLabelX.call(_this52, d, series.labelPosition);
|
|
9135
9431
|
}).attr('y', function (d) {
|
|
9136
|
-
return getLabelY.call(
|
|
9432
|
+
return getLabelY.call(_this52, d, series.labelPosition);
|
|
9137
9433
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9138
|
-
if (
|
|
9434
|
+
if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9139
9435
|
return 'transparent';
|
|
9140
9436
|
}
|
|
9141
9437
|
|
|
9142
|
-
return
|
|
9438
|
+
return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9143
9439
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9144
9440
|
return d.y.label || d.y.value;
|
|
9145
9441
|
}).each(function (d, i) {
|
|
@@ -9161,6 +9457,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9161
9457
|
if (that.plotheight - getLabelX.call(that, d) < (that.options.labelSize || that.options.fontSize)) {
|
|
9162
9458
|
this.setAttribute('y', +this.getAttribute('y') + 8);
|
|
9163
9459
|
}
|
|
9460
|
+
|
|
9461
|
+
if (series.labelPosition !== 'outside') {
|
|
9462
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9463
|
+
}
|
|
9164
9464
|
}
|
|
9165
9465
|
});
|
|
9166
9466
|
}
|
|
@@ -9170,12 +9470,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9170
9470
|
|
|
9171
9471
|
if (this.options.orientation === 'horizontal') {
|
|
9172
9472
|
if (this.options.grouping === 'stacked') {
|
|
9173
|
-
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
9473
|
+
return this[yAxis + 'Axis'](d.y.accumulative) + this[yAxis + 'Axis'](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
9174
9474
|
} else {
|
|
9175
|
-
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
|
|
9475
|
+
return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) + 4;
|
|
9176
9476
|
}
|
|
9177
9477
|
} else {
|
|
9178
|
-
return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2
|
|
9478
|
+
// return this[xAxis](this.parseX(d.x.value)) + (this.options.data[xAxis.replace('Axis', '')].bandWidth / 2)
|
|
9479
|
+
var xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9480
|
+
var xPos = this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9481
|
+
|
|
9482
|
+
if (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9483
|
+
xPos = xPos + (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9484
|
+
}
|
|
9485
|
+
|
|
9486
|
+
return xPos;
|
|
9179
9487
|
}
|
|
9180
9488
|
}
|
|
9181
9489
|
|
|
@@ -9183,12 +9491,21 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9183
9491
|
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
9184
9492
|
|
|
9185
9493
|
if (this.options.orientation === 'horizontal') {
|
|
9186
|
-
|
|
9494
|
+
var xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9495
|
+
var xPos = this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9496
|
+
|
|
9497
|
+
if (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9498
|
+
xPos = xPos + (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9499
|
+
}
|
|
9500
|
+
|
|
9501
|
+
return xPos;
|
|
9187
9502
|
} else {
|
|
9188
9503
|
if (this.options.grouping === 'stacked') {
|
|
9189
|
-
|
|
9504
|
+
var accH = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.accumulative));
|
|
9505
|
+
var h = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
|
|
9506
|
+
return this["".concat(yAxis, "Axis")](0) - (accH + h - (labelPosition === 'inside' ? h / 2 : 0)) * (d.y.accumulative < 0 ? 0 : 1); // return (this[`${yAxis}Axis`](0)) - (this[yAxis + 'Axis'](d.y.accumulative) - (this[yAxis + 'Axis'](d.y.value))) // / (labelPosition === 'inside' ? 2 : 1)))
|
|
9190
9507
|
} else {
|
|
9191
|
-
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize);
|
|
9508
|
+
return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize);
|
|
9192
9509
|
}
|
|
9193
9510
|
}
|
|
9194
9511
|
}
|
|
@@ -9196,25 +9513,34 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9196
9513
|
}, {
|
|
9197
9514
|
key: "renderline",
|
|
9198
9515
|
value: function renderline(series, index) {
|
|
9199
|
-
var
|
|
9516
|
+
var _this53 = this;
|
|
9200
9517
|
|
|
9201
9518
|
/* global series index d3 */
|
|
9202
9519
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9203
9520
|
return d3.line().x(function (d) {
|
|
9204
|
-
if (
|
|
9205
|
-
return
|
|
9521
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
9522
|
+
return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9206
9523
|
} else {
|
|
9207
|
-
var
|
|
9208
|
-
|
|
9524
|
+
var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9525
|
+
|
|
9526
|
+
var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9527
|
+
|
|
9528
|
+
if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9529
|
+
xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9530
|
+
} // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
|
|
9531
|
+
// return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
|
|
9532
|
+
|
|
9533
|
+
|
|
9534
|
+
return xPos;
|
|
9209
9535
|
}
|
|
9210
9536
|
}).y(function (d) {
|
|
9211
|
-
if (
|
|
9212
|
-
var adjustment =
|
|
9213
|
-
return
|
|
9537
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
9538
|
+
var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
|
|
9539
|
+
return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment;
|
|
9214
9540
|
} else {
|
|
9215
|
-
return
|
|
9541
|
+
return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9216
9542
|
}
|
|
9217
|
-
}).curve(d3[curveStyle ||
|
|
9543
|
+
}).curve(d3[curveStyle || _this53.options.curveStyle]);
|
|
9218
9544
|
};
|
|
9219
9545
|
|
|
9220
9546
|
var xAxis = 'bottom';
|
|
@@ -9240,14 +9566,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9240
9566
|
|
|
9241
9567
|
lines.style('stroke-width', series.lineWidth || this.options.lineWidth) // .attr('id', `line_${series.key}`)
|
|
9242
9568
|
// .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
9243
|
-
.attr('stroke',
|
|
9569
|
+
.attr('stroke', function (d) {
|
|
9570
|
+
return d[0].y.color || series.color;
|
|
9571
|
+
}).attr('fill', 'transparent').transition(this.transition).attr('d', function (d) {
|
|
9244
9572
|
return drawLine(xAxis, yAxis, series.curveStyle)(d);
|
|
9245
9573
|
}); // Enter
|
|
9246
9574
|
|
|
9247
9575
|
lines.enter().append('path').attr('d', function (d) {
|
|
9248
9576
|
return drawLine(xAxis, yAxis, series.curveStyle)(d);
|
|
9249
9577
|
}).attr('class', "line_".concat(series.key)).attr('id', "line_".concat(series.key)) // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
9250
|
-
.style('stroke-width', series.lineWidth || this.options.lineWidth).attr('stroke',
|
|
9578
|
+
.style('stroke-width', series.lineWidth || this.options.lineWidth).attr('stroke', function (d) {
|
|
9579
|
+
return d[0].y.color || series.color;
|
|
9580
|
+
}).attr('fill', 'transparent') // .transition(this.transition)
|
|
9251
9581
|
.style('stroke-opacity', 1);
|
|
9252
9582
|
|
|
9253
9583
|
if (!this.brushLinesInitialized[series.key]) {
|
|
@@ -9307,18 +9637,31 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9307
9637
|
value: function removeline(key) {
|
|
9308
9638
|
/* global key d3 */
|
|
9309
9639
|
var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9640
|
+
var areas = this.areaLayer.selectAll(".area_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9641
|
+
}
|
|
9642
|
+
}, {
|
|
9643
|
+
key: "removelabel",
|
|
9644
|
+
value: function removelabel(key) {
|
|
9645
|
+
/* global key d3 */
|
|
9646
|
+
var labels = this.labelLayer.selectAll(".label_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9647
|
+
}
|
|
9648
|
+
}, {
|
|
9649
|
+
key: "removesymbol",
|
|
9650
|
+
value: function removesymbol(key) {
|
|
9651
|
+
/* global key d3 */
|
|
9652
|
+
var symbols = this.symbolLayer.selectAll(".symbol_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9310
9653
|
}
|
|
9311
9654
|
}, {
|
|
9312
9655
|
key: "rendersymbol",
|
|
9313
9656
|
value: function rendersymbol(series, index) {
|
|
9314
|
-
var
|
|
9657
|
+
var _this54 = this;
|
|
9315
9658
|
|
|
9316
9659
|
/* global d3 series index series.key */
|
|
9317
9660
|
var drawSymbol = function drawSymbol(size) {
|
|
9318
9661
|
return d3.symbol() // .type(d => {
|
|
9319
9662
|
// return d3.symbols[0]
|
|
9320
9663
|
// })
|
|
9321
|
-
.size(size ||
|
|
9664
|
+
.size(size || _this54.options.symbolSize);
|
|
9322
9665
|
};
|
|
9323
9666
|
|
|
9324
9667
|
var xAxis = 'bottom';
|
|
@@ -9336,12 +9679,28 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9336
9679
|
symbols.attr('d', function (d) {
|
|
9337
9680
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
9338
9681
|
}).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
9339
|
-
|
|
9682
|
+
// let adjustment = (this.options.data[xAxis].scale === 'Time' || this.options.data[xAxis].scale === 'Linear') ? 0 : this.options.data[xAxis].bandWidth / 2
|
|
9683
|
+
// if (this.options.orientation === 'horizontal') {
|
|
9684
|
+
// return `translate(${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)}, ${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment})`
|
|
9685
|
+
// }
|
|
9686
|
+
// else {
|
|
9687
|
+
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9688
|
+
// }
|
|
9689
|
+
var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9690
|
+
|
|
9691
|
+
var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9340
9692
|
|
|
9341
|
-
if (
|
|
9342
|
-
|
|
9693
|
+
if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9694
|
+
xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9695
|
+
}
|
|
9696
|
+
|
|
9697
|
+
var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
|
|
9698
|
+
|
|
9699
|
+
if (_this54.options.orientation === 'horizontal') {
|
|
9700
|
+
return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9343
9701
|
} else {
|
|
9344
|
-
return
|
|
9702
|
+
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9703
|
+
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9345
9704
|
}
|
|
9346
9705
|
}); // Enter
|
|
9347
9706
|
|
|
@@ -9351,12 +9710,21 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9351
9710
|
.attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
9352
9711
|
return "symbol symbol_".concat(series.key);
|
|
9353
9712
|
}).attr('transform', function (d) {
|
|
9354
|
-
var
|
|
9713
|
+
var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9714
|
+
|
|
9715
|
+
var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9355
9716
|
|
|
9356
|
-
if (
|
|
9357
|
-
|
|
9717
|
+
if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9718
|
+
xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9719
|
+
}
|
|
9720
|
+
|
|
9721
|
+
var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
|
|
9722
|
+
|
|
9723
|
+
if (_this54.options.orientation === 'horizontal') {
|
|
9724
|
+
return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9358
9725
|
} else {
|
|
9359
|
-
return
|
|
9726
|
+
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9727
|
+
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9360
9728
|
}
|
|
9361
9729
|
});
|
|
9362
9730
|
}
|
|
@@ -9578,7 +9946,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9578
9946
|
}, {
|
|
9579
9947
|
key: "resize",
|
|
9580
9948
|
value: function resize() {
|
|
9581
|
-
var
|
|
9949
|
+
var _this55 = this;
|
|
9582
9950
|
|
|
9583
9951
|
var el = document.getElementById(this.elementId);
|
|
9584
9952
|
|
|
@@ -9591,7 +9959,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9591
9959
|
// }
|
|
9592
9960
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9593
9961
|
html += this._data.map(function (d, i) {
|
|
9594
|
-
return
|
|
9962
|
+
return _this55.getLegendItemHTML(d);
|
|
9595
9963
|
}).join('');
|
|
9596
9964
|
html += "\n <div>\n ";
|
|
9597
9965
|
el.innerHTML = html;
|
|
@@ -9763,7 +10131,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9763
10131
|
}, {
|
|
9764
10132
|
key: "render",
|
|
9765
10133
|
value: function render() {
|
|
9766
|
-
var
|
|
10134
|
+
var _this56 = this;
|
|
9767
10135
|
|
|
9768
10136
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9769
10137
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -9772,7 +10140,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9772
10140
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9773
10141
|
return {
|
|
9774
10142
|
value: s.label || s.key,
|
|
9775
|
-
color: s.color ||
|
|
10143
|
+
color: s.color || _this56.options.colors[i % _this56.options.colors.length]
|
|
9776
10144
|
};
|
|
9777
10145
|
});
|
|
9778
10146
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9836,7 +10204,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9836
10204
|
|
|
9837
10205
|
if (this.polygons) {
|
|
9838
10206
|
this.polygons.forEach(function (p) {
|
|
9839
|
-
return
|
|
10207
|
+
return _this56.map.removeLayer(p);
|
|
9840
10208
|
});
|
|
9841
10209
|
}
|
|
9842
10210
|
|
|
@@ -9894,18 +10262,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9894
10262
|
}
|
|
9895
10263
|
|
|
9896
10264
|
if (!p.options.color) {
|
|
9897
|
-
p.options.color =
|
|
10265
|
+
p.options.color = _this56.options.colors[i % _this56.options.colors.length];
|
|
9898
10266
|
}
|
|
9899
10267
|
|
|
9900
10268
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9901
10269
|
return c.map(function (d) {
|
|
9902
10270
|
return [d.Latitude, d.Longitude];
|
|
9903
10271
|
});
|
|
9904
|
-
}), p.options).addTo(
|
|
10272
|
+
}), p.options).addTo(_this56.map);
|
|
9905
10273
|
|
|
9906
|
-
|
|
10274
|
+
_this56.polygons.push(pol);
|
|
9907
10275
|
|
|
9908
|
-
|
|
10276
|
+
_this56.map.fitBounds(pol.getBounds());
|
|
9909
10277
|
});
|
|
9910
10278
|
} // if (this.data.markers.length > 0) {
|
|
9911
10279
|
// el.classList.remove('hidden')
|
|
@@ -10093,3 +10461,9 @@ function usePayPal() {
|
|
|
10093
10461
|
pps.src = '//www.paypal.com/sdk/js';
|
|
10094
10462
|
document.getElementsByTagName('body')[0].appendChild(pps);
|
|
10095
10463
|
}
|
|
10464
|
+
|
|
10465
|
+
String.prototype.toInitialCaps = function () {
|
|
10466
|
+
var letters = this.split('');
|
|
10467
|
+
var initial = letters.shift().toUpperCase();
|
|
10468
|
+
return initial + letters.join('');
|
|
10469
|
+
};
|