@websy/websy-designs 2.0.0 → 2.0.2
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/pgHelper.js +2 -2
- package/dist/server/websy-designs-server.js +1 -2
- package/dist/websy-designs-es6.debug.js +12 -2
- package/dist/websy-designs-es6.js +321 -311
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +12 -2
- package/dist/websy-designs.js +347 -337
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2800,6 +2800,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2800
2800
|
}, {
|
|
2801
2801
|
key: "addEntry",
|
|
2802
2802
|
value: function addEntry() {
|
|
2803
|
+
var _this21 = this;
|
|
2803
2804
|
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
2804
2805
|
if (typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows) {
|
|
2805
2806
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -2811,8 +2812,11 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2811
2812
|
newFormEl.innerHTML = html;
|
|
2812
2813
|
el.appendChild(newFormEl);
|
|
2813
2814
|
var formOptions = _extends({}, this.options, {
|
|
2815
|
+
rowIndex: this.forms.length,
|
|
2814
2816
|
fields: _toConsumableArray(this.options.fields.map(function (f) {
|
|
2815
|
-
return _extends({}, f
|
|
2817
|
+
return _extends({}, f, {
|
|
2818
|
+
rowIndex: _this21.forms.length
|
|
2819
|
+
});
|
|
2816
2820
|
}))
|
|
2817
2821
|
});
|
|
2818
2822
|
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
|
|
@@ -2847,9 +2851,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2847
2851
|
}, {
|
|
2848
2852
|
key: "deleted",
|
|
2849
2853
|
get: function get() {
|
|
2850
|
-
var
|
|
2854
|
+
var _this22 = this;
|
|
2851
2855
|
return this.formData.filter(function (d) {
|
|
2852
|
-
return
|
|
2856
|
+
return _this22.recordsToDelete.includes("".concat(d.id));
|
|
2853
2857
|
});
|
|
2854
2858
|
}
|
|
2855
2859
|
}, {
|
|
@@ -2890,7 +2894,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2890
2894
|
}, {
|
|
2891
2895
|
key: "render",
|
|
2892
2896
|
value: function render() {
|
|
2893
|
-
var
|
|
2897
|
+
var _this23 = this;
|
|
2894
2898
|
this.forms = [];
|
|
2895
2899
|
this.recordsToDelete = [];
|
|
2896
2900
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -2898,9 +2902,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2898
2902
|
var html = '';
|
|
2899
2903
|
this.formData.forEach(function (d) {
|
|
2900
2904
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2901
|
-
html += "\n <div id='".concat(
|
|
2902
|
-
if (
|
|
2903
|
-
html += "\n <button id='".concat(
|
|
2905
|
+
html += "\n <div id='".concat(_this23.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this23.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
2906
|
+
if (_this23.options.allowDelete === true && !_this23.options.readOnly) {
|
|
2907
|
+
html += "\n <button id='".concat(_this23.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this23.options.deleteIcon).concat(_this23.options.deleteLabel, "\n </button>\n ");
|
|
2904
2908
|
}
|
|
2905
2909
|
html += "\n </div>\n ";
|
|
2906
2910
|
});
|
|
@@ -2908,14 +2912,20 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2908
2912
|
el.innerHTML = html;
|
|
2909
2913
|
this.forms = new Array(this.formData.length);
|
|
2910
2914
|
this.formData.forEach(function (d, i) {
|
|
2911
|
-
var formOptions = _extends({},
|
|
2912
|
-
|
|
2913
|
-
|
|
2915
|
+
var formOptions = _extends({}, _this23.options, {
|
|
2916
|
+
rowIndex: i,
|
|
2917
|
+
fields: _toConsumableArray(_this23.options.fields.map(function (f) {
|
|
2918
|
+
var newF = _extends({}, f);
|
|
2919
|
+
if (!newF.options) {
|
|
2920
|
+
newF.options = {};
|
|
2921
|
+
}
|
|
2922
|
+
newF.options.rowIndex = i;
|
|
2923
|
+
return newF;
|
|
2914
2924
|
}))
|
|
2915
2925
|
});
|
|
2916
|
-
var formObject = new WebsyDesigns.Form("".concat(
|
|
2926
|
+
var formObject = new WebsyDesigns.Form("".concat(_this23.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
2917
2927
|
formObject.data = d;
|
|
2918
|
-
|
|
2928
|
+
_this23.forms[i] = formObject;
|
|
2919
2929
|
});
|
|
2920
2930
|
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
2921
2931
|
if (addEl) {
|
|
@@ -3148,7 +3158,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3148
3158
|
}, {
|
|
3149
3159
|
key: "handleSearch",
|
|
3150
3160
|
value: function handleSearch(searchText) {
|
|
3151
|
-
var
|
|
3161
|
+
var _this24 = this;
|
|
3152
3162
|
var el = document.getElementById(this.elementId);
|
|
3153
3163
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3154
3164
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -3159,7 +3169,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3159
3169
|
if (searchText && searchText.length > 1) {
|
|
3160
3170
|
defaultMethod = 'add';
|
|
3161
3171
|
visibleItems = lowestItems.filter(function (d) {
|
|
3162
|
-
return d[
|
|
3172
|
+
return d[_this24.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
3163
3173
|
});
|
|
3164
3174
|
}
|
|
3165
3175
|
// hide everything
|
|
@@ -3342,7 +3352,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3342
3352
|
/* global WebsyDesigns */
|
|
3343
3353
|
var Pager = /*#__PURE__*/function () {
|
|
3344
3354
|
function Pager(elementId, options) {
|
|
3345
|
-
var
|
|
3355
|
+
var _this25 = this;
|
|
3346
3356
|
_classCallCheck(this, Pager);
|
|
3347
3357
|
this.elementId = elementId;
|
|
3348
3358
|
var DEFAULTS = {
|
|
@@ -3389,8 +3399,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3389
3399
|
allowClear: false,
|
|
3390
3400
|
disableSearch: true,
|
|
3391
3401
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3392
|
-
if (
|
|
3393
|
-
|
|
3402
|
+
if (_this25.options.onChangePageSize) {
|
|
3403
|
+
_this25.options.onChangePageSize(selectedItem.value);
|
|
3394
3404
|
}
|
|
3395
3405
|
}
|
|
3396
3406
|
});
|
|
@@ -3411,11 +3421,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3411
3421
|
}, {
|
|
3412
3422
|
key: "render",
|
|
3413
3423
|
value: function render() {
|
|
3414
|
-
var
|
|
3424
|
+
var _this26 = this;
|
|
3415
3425
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3416
3426
|
if (el) {
|
|
3417
3427
|
var pages = this.options.pages.map(function (item, index) {
|
|
3418
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3428
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this26.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3419
3429
|
});
|
|
3420
3430
|
var startIndex = 0;
|
|
3421
3431
|
if (this.options.pages.length > 8) {
|
|
@@ -3477,50 +3487,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3477
3487
|
_createClass(WebsyPDFButton, [{
|
|
3478
3488
|
key: "handleClick",
|
|
3479
3489
|
value: function handleClick(event) {
|
|
3480
|
-
var
|
|
3490
|
+
var _this27 = this;
|
|
3481
3491
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3482
3492
|
this.loader.show();
|
|
3483
3493
|
this.options.preProcess(function (proceed) {
|
|
3484
3494
|
if (proceed === true) {
|
|
3485
3495
|
setTimeout(function () {
|
|
3486
|
-
if (
|
|
3487
|
-
var el = document.getElementById(
|
|
3496
|
+
if (_this27.options.targetId) {
|
|
3497
|
+
var el = document.getElementById(_this27.options.targetId);
|
|
3488
3498
|
if (el) {
|
|
3489
3499
|
var pdfData = {
|
|
3490
3500
|
options: {}
|
|
3491
3501
|
};
|
|
3492
|
-
if (
|
|
3493
|
-
pdfData.options = _extends({},
|
|
3502
|
+
if (_this27.options.pdfOptions) {
|
|
3503
|
+
pdfData.options = _extends({}, _this27.options.pdfOptions);
|
|
3494
3504
|
}
|
|
3495
|
-
if (
|
|
3496
|
-
if (
|
|
3497
|
-
var headerEl = document.getElementById(
|
|
3505
|
+
if (_this27.options.header) {
|
|
3506
|
+
if (_this27.options.header.elementId) {
|
|
3507
|
+
var headerEl = document.getElementById(_this27.options.header.elementId);
|
|
3498
3508
|
if (headerEl) {
|
|
3499
3509
|
pdfData.header = headerEl.outerHTML;
|
|
3500
|
-
if (
|
|
3501
|
-
pdfData.options.headerCSS =
|
|
3510
|
+
if (_this27.options.header.css) {
|
|
3511
|
+
pdfData.options.headerCSS = _this27.options.header.css;
|
|
3502
3512
|
}
|
|
3503
3513
|
}
|
|
3504
|
-
} else if (
|
|
3505
|
-
pdfData.header =
|
|
3506
|
-
if (
|
|
3507
|
-
pdfData.options.headerCSS =
|
|
3514
|
+
} else if (_this27.options.header.html) {
|
|
3515
|
+
pdfData.header = _this27.options.header.html;
|
|
3516
|
+
if (_this27.options.header.css) {
|
|
3517
|
+
pdfData.options.headerCSS = _this27.options.header.css;
|
|
3508
3518
|
}
|
|
3509
3519
|
} else {
|
|
3510
|
-
pdfData.header =
|
|
3520
|
+
pdfData.header = _this27.options.header;
|
|
3511
3521
|
}
|
|
3512
3522
|
}
|
|
3513
|
-
if (
|
|
3514
|
-
if (
|
|
3515
|
-
var footerEl = document.getElementById(
|
|
3523
|
+
if (_this27.options.footer) {
|
|
3524
|
+
if (_this27.options.footer.elementId) {
|
|
3525
|
+
var footerEl = document.getElementById(_this27.options.footer.elementId);
|
|
3516
3526
|
if (footerEl) {
|
|
3517
3527
|
pdfData.footer = footerEl.outerHTML;
|
|
3518
|
-
if (
|
|
3519
|
-
pdfData.options.footerCSS =
|
|
3528
|
+
if (_this27.options.footer.css) {
|
|
3529
|
+
pdfData.options.footerCSS = _this27.options.footer.css;
|
|
3520
3530
|
}
|
|
3521
3531
|
}
|
|
3522
3532
|
} else {
|
|
3523
|
-
pdfData.footer =
|
|
3533
|
+
pdfData.footer = _this27.options.footer;
|
|
3524
3534
|
}
|
|
3525
3535
|
}
|
|
3526
3536
|
pdfData.html = el.outerHTML;
|
|
@@ -3528,25 +3538,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3528
3538
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3529
3539
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3530
3540
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3531
|
-
|
|
3541
|
+
_this27.service.add('', pdfData, {
|
|
3532
3542
|
responseType: 'blob'
|
|
3533
3543
|
}).then(function (response) {
|
|
3534
|
-
|
|
3544
|
+
_this27.loader.hide();
|
|
3535
3545
|
var blob = new Blob([response], {
|
|
3536
3546
|
type: 'application/pdf'
|
|
3537
3547
|
});
|
|
3538
3548
|
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 ");
|
|
3539
|
-
if (
|
|
3549
|
+
if (_this27.options.directDownload === true) {
|
|
3540
3550
|
var fileName;
|
|
3541
|
-
if (typeof
|
|
3542
|
-
fileName =
|
|
3551
|
+
if (typeof _this27.options.fileName === 'function') {
|
|
3552
|
+
fileName = _this27.options.fileName() || 'Export';
|
|
3543
3553
|
} else {
|
|
3544
|
-
fileName =
|
|
3554
|
+
fileName = _this27.options.fileName || 'Export';
|
|
3545
3555
|
}
|
|
3546
3556
|
msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
|
|
3547
3557
|
}
|
|
3548
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3549
|
-
|
|
3558
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this27.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3559
|
+
_this27.popup.show({
|
|
3550
3560
|
message: msg,
|
|
3551
3561
|
mask: true
|
|
3552
3562
|
});
|
|
@@ -3555,10 +3565,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3555
3565
|
});
|
|
3556
3566
|
}
|
|
3557
3567
|
}
|
|
3558
|
-
},
|
|
3568
|
+
}, _this27.options.wait);
|
|
3559
3569
|
} else {
|
|
3560
|
-
|
|
3561
|
-
|
|
3570
|
+
_this27.loader.hide();
|
|
3571
|
+
_this27.options.onError();
|
|
3562
3572
|
}
|
|
3563
3573
|
});
|
|
3564
3574
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
@@ -3731,7 +3741,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3731
3741
|
}();
|
|
3732
3742
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3733
3743
|
function ResponsiveText(elementId, options) {
|
|
3734
|
-
var
|
|
3744
|
+
var _this28 = this;
|
|
3735
3745
|
_classCallCheck(this, ResponsiveText);
|
|
3736
3746
|
var DEFAULTS = {
|
|
3737
3747
|
textAlign: 'center',
|
|
@@ -3742,7 +3752,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3742
3752
|
this.elementId = elementId;
|
|
3743
3753
|
this.canvas = document.createElement('canvas');
|
|
3744
3754
|
window.addEventListener('resize', function () {
|
|
3745
|
-
return
|
|
3755
|
+
return _this28.render();
|
|
3746
3756
|
});
|
|
3747
3757
|
var el = document.getElementById(this.elementId);
|
|
3748
3758
|
if (el) {
|
|
@@ -3932,7 +3942,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3932
3942
|
/* global WebsyDesigns */
|
|
3933
3943
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3934
3944
|
function WebsyResultList(elementId, options) {
|
|
3935
|
-
var
|
|
3945
|
+
var _this29 = this;
|
|
3936
3946
|
_classCallCheck(this, WebsyResultList);
|
|
3937
3947
|
var DEFAULTS = {
|
|
3938
3948
|
listeners: {
|
|
@@ -3958,8 +3968,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3958
3968
|
}
|
|
3959
3969
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3960
3970
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3961
|
-
|
|
3962
|
-
|
|
3971
|
+
_this29.options.template = templateString;
|
|
3972
|
+
_this29.render();
|
|
3963
3973
|
});
|
|
3964
3974
|
} else {
|
|
3965
3975
|
this.render();
|
|
@@ -3981,7 +3991,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3981
3991
|
}, {
|
|
3982
3992
|
key: "buildHTML",
|
|
3983
3993
|
value: function buildHTML() {
|
|
3984
|
-
var
|
|
3994
|
+
var _this30 = this;
|
|
3985
3995
|
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3986
3996
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3987
3997
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3990,7 +4000,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3990
4000
|
if (this.options.template) {
|
|
3991
4001
|
if (d.length > 0) {
|
|
3992
4002
|
d.forEach(function (row, ix) {
|
|
3993
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4003
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this30.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3994
4004
|
// find conditional elements
|
|
3995
4005
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3996
4006
|
ifMatches.forEach(function (m) {
|
|
@@ -4078,7 +4088,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4078
4088
|
parts.forEach(function (p) {
|
|
4079
4089
|
items = items[p];
|
|
4080
4090
|
});
|
|
4081
|
-
template = template.replace(m[0],
|
|
4091
|
+
template = template.replace(m[0], _this30.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4082
4092
|
}
|
|
4083
4093
|
});
|
|
4084
4094
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4087,7 +4097,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4087
4097
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4088
4098
|
}
|
|
4089
4099
|
});
|
|
4090
|
-
var flatRow =
|
|
4100
|
+
var flatRow = _this30.flattenObject(row);
|
|
4091
4101
|
for (var key in flatRow) {
|
|
4092
4102
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4093
4103
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4212,15 +4222,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4212
4222
|
}, {
|
|
4213
4223
|
key: "render",
|
|
4214
4224
|
value: function render() {
|
|
4215
|
-
var
|
|
4225
|
+
var _this31 = this;
|
|
4216
4226
|
if (this.options.entity) {
|
|
4217
4227
|
var url = this.options.entity;
|
|
4218
4228
|
if (this.options.sortField) {
|
|
4219
4229
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4220
4230
|
}
|
|
4221
4231
|
this.apiService.get(url).then(function (results) {
|
|
4222
|
-
|
|
4223
|
-
|
|
4232
|
+
_this31.rows = results.rows;
|
|
4233
|
+
_this31.resize();
|
|
4224
4234
|
});
|
|
4225
4235
|
} else {
|
|
4226
4236
|
this.resize();
|
|
@@ -4299,12 +4309,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4299
4309
|
_createClass(WebsyRouter, [{
|
|
4300
4310
|
key: "addGroup",
|
|
4301
4311
|
value: function addGroup(group) {
|
|
4302
|
-
var
|
|
4312
|
+
var _this32 = this;
|
|
4303
4313
|
if (!this.groups[group]) {
|
|
4304
4314
|
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4305
4315
|
if (els) {
|
|
4306
4316
|
this.getClosestParent(els[0], function (parent) {
|
|
4307
|
-
|
|
4317
|
+
_this32.groups[group] = {
|
|
4308
4318
|
activeView: '',
|
|
4309
4319
|
views: [],
|
|
4310
4320
|
parent: parent.getAttribute('data-view')
|
|
@@ -4368,7 +4378,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4368
4378
|
}, {
|
|
4369
4379
|
key: "removeUrlParams",
|
|
4370
4380
|
value: function removeUrlParams() {
|
|
4371
|
-
var
|
|
4381
|
+
var _this33 = this;
|
|
4372
4382
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4373
4383
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4374
4384
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4376,7 +4386,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4376
4386
|
var path = '';
|
|
4377
4387
|
if (this.currentParams && this.currentParams.items) {
|
|
4378
4388
|
params.forEach(function (p) {
|
|
4379
|
-
delete
|
|
4389
|
+
delete _this33.currentParams.items[p];
|
|
4380
4390
|
});
|
|
4381
4391
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4382
4392
|
}
|
|
@@ -4707,11 +4717,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4707
4717
|
}, {
|
|
4708
4718
|
key: "showComponents",
|
|
4709
4719
|
value: function showComponents(view) {
|
|
4710
|
-
var
|
|
4720
|
+
var _this34 = this;
|
|
4711
4721
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4712
4722
|
this.options.views[view].components.forEach(function (c) {
|
|
4713
4723
|
if (typeof c.instance === 'undefined') {
|
|
4714
|
-
|
|
4724
|
+
_this34.prepComponent(c.elementId, c.options);
|
|
4715
4725
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4716
4726
|
} else if (c.instance.render) {
|
|
4717
4727
|
c.instance.render();
|
|
@@ -4731,42 +4741,42 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4731
4741
|
}, {
|
|
4732
4742
|
key: "initView",
|
|
4733
4743
|
value: function initView(view) {
|
|
4734
|
-
var
|
|
4744
|
+
var _this35 = this;
|
|
4735
4745
|
return new Promise(function (resolve, reject) {
|
|
4736
|
-
if (!
|
|
4737
|
-
|
|
4746
|
+
if (!_this35.options.views[view]) {
|
|
4747
|
+
_this35.options.views[view] = {
|
|
4738
4748
|
components: []
|
|
4739
4749
|
};
|
|
4740
4750
|
}
|
|
4741
|
-
if (
|
|
4751
|
+
if (_this35.options.views[view].ready === true) {
|
|
4742
4752
|
resolve();
|
|
4743
|
-
} else if (
|
|
4744
|
-
|
|
4753
|
+
} else if (_this35.options.views[view].template) {
|
|
4754
|
+
_this35.preloadView(view, function () {
|
|
4745
4755
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4746
|
-
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(
|
|
4756
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this35.options.viewClass));
|
|
4747
4757
|
if (viewEl) {
|
|
4748
|
-
|
|
4749
|
-
template:
|
|
4758
|
+
_this35.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
4759
|
+
template: _this35.options.views[view].template,
|
|
4750
4760
|
data: data,
|
|
4751
4761
|
readyCallbackFn: function readyCallbackFn() {
|
|
4752
|
-
|
|
4762
|
+
_this35.options.views[view].ready = true;
|
|
4753
4763
|
resolve();
|
|
4754
4764
|
}
|
|
4755
4765
|
});
|
|
4756
4766
|
} else {
|
|
4757
4767
|
console.log("No view element found for '".concat(view, "' to render template"));
|
|
4758
|
-
|
|
4768
|
+
_this35.options.views[view].ready = true;
|
|
4759
4769
|
resolve();
|
|
4760
4770
|
}
|
|
4761
4771
|
});
|
|
4762
|
-
} else if (
|
|
4763
|
-
|
|
4772
|
+
} else if (_this35.options.views[view].ready !== true && _this35.options.views[view].load) {
|
|
4773
|
+
_this35.preloadView(view, function () {
|
|
4764
4774
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4765
|
-
|
|
4775
|
+
_this35.options.views[view].ready = true;
|
|
4766
4776
|
resolve();
|
|
4767
4777
|
});
|
|
4768
4778
|
} else {
|
|
4769
|
-
|
|
4779
|
+
_this35.options.views[view].ready = true;
|
|
4770
4780
|
resolve();
|
|
4771
4781
|
}
|
|
4772
4782
|
});
|
|
@@ -4774,35 +4784,35 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4774
4784
|
}, {
|
|
4775
4785
|
key: "showView",
|
|
4776
4786
|
value: function showView(view, params, group) {
|
|
4777
|
-
var
|
|
4787
|
+
var _this36 = this;
|
|
4778
4788
|
if (view === '/' || view === '') {
|
|
4779
4789
|
view = this.options.defaultView || '';
|
|
4780
4790
|
}
|
|
4781
4791
|
this.initView(view).then(function () {
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
var children =
|
|
4792
|
+
_this36.activateItem(view, _this36.options.triggerClass);
|
|
4793
|
+
_this36.activateItem(view, _this36.options.viewClass);
|
|
4794
|
+
var children = _this36.getActiveViewsFromParent(view);
|
|
4785
4795
|
for (var c = 0; c < children.length; c++) {
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4796
|
+
_this36.activateItem(children[c].view, _this36.options.triggerClass);
|
|
4797
|
+
_this36.activateItem(children[c].view, _this36.options.viewClass);
|
|
4798
|
+
_this36.showComponents(children[c].view);
|
|
4789
4799
|
if (children[c].show) {
|
|
4790
4800
|
children[c].show.call(children[c]);
|
|
4791
4801
|
}
|
|
4792
|
-
|
|
4802
|
+
_this36.publish('show', [children[c].view, null, group]);
|
|
4793
4803
|
}
|
|
4794
|
-
if (
|
|
4795
|
-
|
|
4796
|
-
if (
|
|
4797
|
-
|
|
4804
|
+
if (_this36.previousView !== _this36.currentView || group !== 'main') {
|
|
4805
|
+
_this36.showComponents(view);
|
|
4806
|
+
if (_this36.options.views[view].show) {
|
|
4807
|
+
_this36.options.views[view].show.call(_this36.options.views[view]);
|
|
4798
4808
|
}
|
|
4799
|
-
|
|
4800
|
-
} else if (
|
|
4801
|
-
|
|
4802
|
-
if (
|
|
4803
|
-
|
|
4809
|
+
_this36.publish('show', [view, params, group]);
|
|
4810
|
+
} else if (_this36.previousView === _this36.currentView && _this36.previousParams.path !== _this36.currentParams.path) {
|
|
4811
|
+
_this36.showComponents(view);
|
|
4812
|
+
if (_this36.options.views[view].show) {
|
|
4813
|
+
_this36.options.views[view].show.call(_this36.options.views[view]);
|
|
4804
4814
|
}
|
|
4805
|
-
|
|
4815
|
+
_this36.publish('show', [view, params, group]);
|
|
4806
4816
|
}
|
|
4807
4817
|
});
|
|
4808
4818
|
}
|
|
@@ -5131,7 +5141,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5131
5141
|
/* global WebsyDesigns */
|
|
5132
5142
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5133
5143
|
function WebsyTemplate(elementId, options) {
|
|
5134
|
-
var
|
|
5144
|
+
var _this37 = this;
|
|
5135
5145
|
_classCallCheck(this, WebsyTemplate);
|
|
5136
5146
|
var DEFAULTS = {
|
|
5137
5147
|
listeners: {
|
|
@@ -5160,8 +5170,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5160
5170
|
}
|
|
5161
5171
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5162
5172
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5163
|
-
|
|
5164
|
-
|
|
5173
|
+
_this37.options.template = templateString;
|
|
5174
|
+
_this37.render();
|
|
5165
5175
|
});
|
|
5166
5176
|
} else {
|
|
5167
5177
|
this.render();
|
|
@@ -5170,7 +5180,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5170
5180
|
_createClass(WebsyTemplate, [{
|
|
5171
5181
|
key: "buildHTML",
|
|
5172
5182
|
value: function buildHTML() {
|
|
5173
|
-
var
|
|
5183
|
+
var _this38 = this;
|
|
5174
5184
|
var html = "";
|
|
5175
5185
|
if (this.options.template) {
|
|
5176
5186
|
var template = this.options.template;
|
|
@@ -5219,14 +5229,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5219
5229
|
}
|
|
5220
5230
|
}
|
|
5221
5231
|
if (polarity === true) {
|
|
5222
|
-
if (typeof
|
|
5232
|
+
if (typeof _this38.options.data[parts[0]] !== 'undefined' && _this38.options.data[parts[0]] === parts[1]) {
|
|
5223
5233
|
// remove the <if> tags
|
|
5224
5234
|
removeAll = false;
|
|
5225
5235
|
} else if (parts[0] === parts[1]) {
|
|
5226
5236
|
removeAll = false;
|
|
5227
5237
|
}
|
|
5228
5238
|
} else if (polarity === false) {
|
|
5229
|
-
if (typeof
|
|
5239
|
+
if (typeof _this38.options.data[parts[0]] !== 'undefined' && _this38.options.data[parts[0]] !== parts[1]) {
|
|
5230
5240
|
// remove the <if> tags
|
|
5231
5241
|
removeAll = false;
|
|
5232
5242
|
}
|
|
@@ -5545,7 +5555,7 @@ var WebsyUtils = {
|
|
|
5545
5555
|
/* global WebsyDesigns */
|
|
5546
5556
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5547
5557
|
function WebsyTable(elementId, options) {
|
|
5548
|
-
var
|
|
5558
|
+
var _this39 = this;
|
|
5549
5559
|
_classCallCheck(this, WebsyTable);
|
|
5550
5560
|
var DEFAULTS = {
|
|
5551
5561
|
pageSize: 20,
|
|
@@ -5578,8 +5588,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5578
5588
|
allowClear: false,
|
|
5579
5589
|
disableSearch: true,
|
|
5580
5590
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5581
|
-
if (
|
|
5582
|
-
|
|
5591
|
+
if (_this39.options.onChangePageSize) {
|
|
5592
|
+
_this39.options.onChangePageSize(selectedItem.value);
|
|
5583
5593
|
}
|
|
5584
5594
|
}
|
|
5585
5595
|
});
|
|
@@ -5603,20 +5613,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5603
5613
|
}, {
|
|
5604
5614
|
key: "appendRows",
|
|
5605
5615
|
value: function appendRows(data) {
|
|
5606
|
-
var
|
|
5616
|
+
var _this40 = this;
|
|
5607
5617
|
this._isRendered = false;
|
|
5608
5618
|
this.hideError();
|
|
5609
5619
|
var bodyHTML = '';
|
|
5610
5620
|
if (data) {
|
|
5611
5621
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5612
5622
|
return '<tr>' + r.map(function (c, i) {
|
|
5613
|
-
if (
|
|
5623
|
+
if (_this40.options.columns[i].show !== false) {
|
|
5614
5624
|
var style = '';
|
|
5615
5625
|
if (c.style) {
|
|
5616
5626
|
style += c.style;
|
|
5617
5627
|
}
|
|
5618
|
-
if (
|
|
5619
|
-
style += "width: ".concat(
|
|
5628
|
+
if (_this40.options.columns[i].width) {
|
|
5629
|
+
style += "width: ".concat(_this40.options.columns[i].width, "; ");
|
|
5620
5630
|
}
|
|
5621
5631
|
if (c.backgroundColor) {
|
|
5622
5632
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5627,20 +5637,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5627
5637
|
if (c.color) {
|
|
5628
5638
|
style += "color: ".concat(c.color, "; ");
|
|
5629
5639
|
}
|
|
5630
|
-
if (
|
|
5631
|
-
return "\n <td \n data-row-index='".concat(
|
|
5632
|
-
} else if ((
|
|
5633
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5640
|
+
if (_this40.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5641
|
+
return "\n <td \n data-row-index='".concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this40.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this40.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this40.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5642
|
+
} else if ((_this40.options.columns[i].showAsNavigatorLink === true || _this40.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5643
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this40.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this40.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this40.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5634
5644
|
} else {
|
|
5635
5645
|
var info = c.value;
|
|
5636
|
-
if (
|
|
5646
|
+
if (_this40.options.columns[i].showAsImage === true) {
|
|
5637
5647
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5638
5648
|
}
|
|
5639
5649
|
var html = "\n <td \n ";
|
|
5640
|
-
if (!
|
|
5650
|
+
if (!_this40.options.columns[i].showAsImage && c.value && c.value.indexOf && c.value.indexOf('<svg') === -1 && c.value.indexOf('<img') === -1) {
|
|
5641
5651
|
html += "\n data-info='".concat(info, "'\n ");
|
|
5642
5652
|
}
|
|
5643
|
-
html += "\n data-row-index='".concat(
|
|
5653
|
+
html += "\n data-row-index='".concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this40.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
5644
5654
|
return html;
|
|
5645
5655
|
}
|
|
5646
5656
|
}
|
|
@@ -5801,7 +5811,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5801
5811
|
}, {
|
|
5802
5812
|
key: "render",
|
|
5803
5813
|
value: function render(data) {
|
|
5804
|
-
var
|
|
5814
|
+
var _this41 = this;
|
|
5805
5815
|
this._isRendered = false;
|
|
5806
5816
|
if (!this.options.columns) {
|
|
5807
5817
|
return;
|
|
@@ -5829,7 +5839,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5829
5839
|
if (c.width) {
|
|
5830
5840
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5831
5841
|
}
|
|
5832
|
-
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 ?
|
|
5842
|
+
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 ? _this41.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5833
5843
|
}
|
|
5834
5844
|
}).join('') + '</tr>';
|
|
5835
5845
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5847,7 +5857,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5847
5857
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5848
5858
|
if (pagingEl) {
|
|
5849
5859
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5850
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5860
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this41.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5851
5861
|
});
|
|
5852
5862
|
var startIndex = 0;
|
|
5853
5863
|
if (this.options.pageCount > 8) {
|
|
@@ -5903,7 +5913,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5903
5913
|
/* global WebsyDesigns */
|
|
5904
5914
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5905
5915
|
function WebsyTable2(elementId, options) {
|
|
5906
|
-
var
|
|
5916
|
+
var _this42 = this;
|
|
5907
5917
|
_classCallCheck(this, WebsyTable2);
|
|
5908
5918
|
var DEFAULTS = {
|
|
5909
5919
|
pageSize: 20,
|
|
@@ -5938,8 +5948,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5938
5948
|
allowClear: false,
|
|
5939
5949
|
disableSearch: true,
|
|
5940
5950
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5941
|
-
if (
|
|
5942
|
-
|
|
5951
|
+
if (_this42.options.onChangePageSize) {
|
|
5952
|
+
_this42.options.onChangePageSize(selectedItem.value);
|
|
5943
5953
|
}
|
|
5944
5954
|
}
|
|
5945
5955
|
});
|
|
@@ -5961,20 +5971,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5961
5971
|
_createClass(WebsyTable2, [{
|
|
5962
5972
|
key: "appendRows",
|
|
5963
5973
|
value: function appendRows(data) {
|
|
5964
|
-
var
|
|
5974
|
+
var _this43 = this;
|
|
5965
5975
|
this.hideError();
|
|
5966
5976
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5967
5977
|
var bodyHTML = '';
|
|
5968
5978
|
if (data) {
|
|
5969
5979
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5970
5980
|
return '<tr>' + r.map(function (c, i) {
|
|
5971
|
-
if (
|
|
5972
|
-
var style = "height: ".concat(
|
|
5981
|
+
if (_this43.options.columns[i].show !== false) {
|
|
5982
|
+
var style = "height: ".concat(_this43.options.cellSize, "px; line-height: ").concat(_this43.options.cellSize, "px;");
|
|
5973
5983
|
if (c.style) {
|
|
5974
5984
|
style += c.style;
|
|
5975
5985
|
}
|
|
5976
|
-
if (
|
|
5977
|
-
style += "width: ".concat(
|
|
5986
|
+
if (_this43.options.columns[i].width) {
|
|
5987
|
+
style += "width: ".concat(_this43.options.columns[i].width, "; ");
|
|
5978
5988
|
}
|
|
5979
5989
|
if (c.backgroundColor) {
|
|
5980
5990
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5985,16 +5995,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5985
5995
|
if (c.color) {
|
|
5986
5996
|
style += "color: ".concat(c.color, "; ");
|
|
5987
5997
|
}
|
|
5988
|
-
if (
|
|
5989
|
-
return "\n <td \n data-row-index='".concat(
|
|
5990
|
-
} else if ((
|
|
5991
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5998
|
+
if (_this43.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5999
|
+
return "\n <td \n data-row-index='".concat(_this43.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this43.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(_this43.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this43.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6000
|
+
} else if ((_this43.options.columns[i].showAsNavigatorLink === true || _this43.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6001
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this43.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this43.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this43.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this43.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5992
6002
|
} else {
|
|
5993
6003
|
var info = c.value;
|
|
5994
|
-
if (
|
|
6004
|
+
if (_this43.options.columns[i].showAsImage === true) {
|
|
5995
6005
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5996
6006
|
}
|
|
5997
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6007
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this43.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this43.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 ");
|
|
5998
6008
|
}
|
|
5999
6009
|
}
|
|
6000
6010
|
}).join('') + '</tr>';
|
|
@@ -6228,7 +6238,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6228
6238
|
}, {
|
|
6229
6239
|
key: "render",
|
|
6230
6240
|
value: function render(data) {
|
|
6231
|
-
var
|
|
6241
|
+
var _this44 = this;
|
|
6232
6242
|
if (!this.options.columns) {
|
|
6233
6243
|
return;
|
|
6234
6244
|
}
|
|
@@ -6256,7 +6266,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6256
6266
|
if (c.width) {
|
|
6257
6267
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6258
6268
|
}
|
|
6259
|
-
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 ?
|
|
6269
|
+
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 ? _this44.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6260
6270
|
}
|
|
6261
6271
|
}).join('') + '</tr>';
|
|
6262
6272
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6266,7 +6276,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6266
6276
|
var dropdownHTML = "";
|
|
6267
6277
|
this.options.columns.forEach(function (c, i) {
|
|
6268
6278
|
if (c.searchable && c.searchField) {
|
|
6269
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6279
|
+
dropdownHTML += "\n <div id=\"".concat(_this44.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6270
6280
|
}
|
|
6271
6281
|
});
|
|
6272
6282
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6286,7 +6296,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6286
6296
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6287
6297
|
if (pagingEl) {
|
|
6288
6298
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6289
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6299
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this44.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6290
6300
|
});
|
|
6291
6301
|
var startIndex = 0;
|
|
6292
6302
|
if (this.options.pageCount > 8) {
|
|
@@ -6363,17 +6373,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6363
6373
|
}, {
|
|
6364
6374
|
key: "getColumnParameters",
|
|
6365
6375
|
value: function getColumnParameters(values) {
|
|
6366
|
-
var
|
|
6376
|
+
var _this45 = this;
|
|
6367
6377
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6368
6378
|
tableEl.style.tableLayout = 'auto';
|
|
6369
6379
|
tableEl.style.width = 'auto';
|
|
6370
6380
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6371
6381
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6372
6382
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6373
|
-
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 ?
|
|
6383
|
+
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 ? _this45.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6374
6384
|
}).join('') + '</tr>';
|
|
6375
6385
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6376
|
-
return "\n <td \n style='height: ".concat(
|
|
6386
|
+
return "\n <td \n style='height: ".concat(_this45.options.cellSize, "px; line-height: ").concat(_this45.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6377
6387
|
}).join('') + '</tr>';
|
|
6378
6388
|
// get height of the first data cell
|
|
6379
6389
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6537,7 +6547,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6537
6547
|
}, {
|
|
6538
6548
|
key: "buildBodyHtml",
|
|
6539
6549
|
value: function buildBodyHtml() {
|
|
6540
|
-
var
|
|
6550
|
+
var _this46 = this;
|
|
6541
6551
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6542
6552
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6543
6553
|
if (!this.options.columns) {
|
|
@@ -6562,7 +6572,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6562
6572
|
row.forEach(function (cell, cellIndex) {
|
|
6563
6573
|
var sizeIndex = cell.level || cellIndex;
|
|
6564
6574
|
var colIndex = cell.index || cellIndex;
|
|
6565
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6575
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this46.options.columns[_this46.options.columns.length - 1][colIndex].show === false) {
|
|
6566
6576
|
return; // need to revisit this logic
|
|
6567
6577
|
}
|
|
6568
6578
|
|
|
@@ -6589,7 +6599,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6589
6599
|
style += "color: ".concat(cell.color, "; ");
|
|
6590
6600
|
}
|
|
6591
6601
|
// console.log('rowspan', cell.rowspan)
|
|
6592
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6602
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this46.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n ");
|
|
6593
6603
|
if (!sizingColumns[sizeIndex].showAsImage && cell.value.indexOf('<svg') === -1 && cell.value.indexOf('<img') === -1) {
|
|
6594
6604
|
bodyHtml += "\n data-info='".concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n ");
|
|
6595
6605
|
}
|
|
@@ -6602,10 +6612,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6602
6612
|
// }
|
|
6603
6613
|
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
|
|
6604
6614
|
if (cell.expandable === true) {
|
|
6605
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6615
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this46.options.plusIcon, "</i>");
|
|
6606
6616
|
}
|
|
6607
6617
|
if (cell.collapsable === true) {
|
|
6608
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6618
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this46.options.minusIcon, "</i>");
|
|
6609
6619
|
}
|
|
6610
6620
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6611
6621
|
cell.value = "\n <a href=\"".concat(encodeURI(cell.value), "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
@@ -6626,7 +6636,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6626
6636
|
}, {
|
|
6627
6637
|
key: "buildHeaderHtml",
|
|
6628
6638
|
value: function buildHeaderHtml() {
|
|
6629
|
-
var
|
|
6639
|
+
var _this47 = this;
|
|
6630
6640
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6631
6641
|
if (!this.options.columns) {
|
|
6632
6642
|
return '';
|
|
@@ -6647,7 +6657,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6647
6657
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
6648
6658
|
// return
|
|
6649
6659
|
// }
|
|
6650
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
6660
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this47.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
6651
6661
|
row.filter(function (c) {
|
|
6652
6662
|
return c.show !== false;
|
|
6653
6663
|
}).forEach(function (col, colIndex) {
|
|
@@ -6667,24 +6677,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6667
6677
|
if (col.style) {
|
|
6668
6678
|
style += col.style;
|
|
6669
6679
|
}
|
|
6670
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6680
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this47.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6671
6681
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6672
6682
|
// headerHtml += `
|
|
6673
6683
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6674
6684
|
// width='${col.width || col.actualWidth}'
|
|
6675
6685
|
// `
|
|
6676
6686
|
// }
|
|
6677
|
-
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 ?
|
|
6687
|
+
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 ? _this47.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this47.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6678
6688
|
});
|
|
6679
6689
|
headerHtml += "</tr>";
|
|
6680
6690
|
});
|
|
6681
6691
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6682
6692
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6683
6693
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6684
|
-
var testEl = document.getElementById("".concat(
|
|
6694
|
+
var testEl = document.getElementById("".concat(_this47.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6685
6695
|
if (!testEl) {
|
|
6686
6696
|
var newE = document.createElement('div');
|
|
6687
|
-
newE.id = "".concat(
|
|
6697
|
+
newE.id = "".concat(_this47.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6688
6698
|
newE.className = 'websy-modal-dropdown';
|
|
6689
6699
|
dropdownEl.appendChild(newE);
|
|
6690
6700
|
}
|
|
@@ -6707,7 +6717,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6707
6717
|
}, {
|
|
6708
6718
|
key: "buildTotalHtml",
|
|
6709
6719
|
value: function buildTotalHtml() {
|
|
6710
|
-
var
|
|
6720
|
+
var _this48 = this;
|
|
6711
6721
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6712
6722
|
if (!this.options.totals) {
|
|
6713
6723
|
return '';
|
|
@@ -6723,7 +6733,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6723
6733
|
|
|
6724
6734
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6725
6735
|
if (useWidths === true) {
|
|
6726
|
-
totalHtml += "\n style='width: ".concat(
|
|
6736
|
+
totalHtml += "\n style='width: ".concat(_this48.options.columns[_this48.options.columns.length - 1][colIndex].width || _this48.options.columns[_this48.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6727
6737
|
}
|
|
6728
6738
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6729
6739
|
});
|
|
@@ -6733,7 +6743,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6733
6743
|
}, {
|
|
6734
6744
|
key: "calculateSizes",
|
|
6735
6745
|
value: function calculateSizes() {
|
|
6736
|
-
var
|
|
6746
|
+
var _this49 = this;
|
|
6737
6747
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6738
6748
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6739
6749
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6777,7 +6787,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6777
6787
|
rows.forEach(function (row, rowIndex) {
|
|
6778
6788
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6779
6789
|
var colSize = col.getBoundingClientRect();
|
|
6780
|
-
|
|
6790
|
+
_this49.sizes.cellHeight = colSize.height;
|
|
6781
6791
|
if (columnsForSizing[colIndex]) {
|
|
6782
6792
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6783
6793
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -6789,7 +6799,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6789
6799
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6790
6800
|
// }
|
|
6791
6801
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6792
|
-
if (colIndex >=
|
|
6802
|
+
if (colIndex >= _this49.pinnedColumns) {
|
|
6793
6803
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6794
6804
|
}
|
|
6795
6805
|
}
|
|
@@ -6804,7 +6814,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6804
6814
|
return a + (b.width || b.actualWidth);
|
|
6805
6815
|
}, 0);
|
|
6806
6816
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6807
|
-
return i >=
|
|
6817
|
+
return i >= _this49.pinnedColumns;
|
|
6808
6818
|
}).reduce(function (a, b) {
|
|
6809
6819
|
return a + (b.width || b.actualWidth);
|
|
6810
6820
|
}, 0);
|
|
@@ -6815,7 +6825,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6815
6825
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6816
6826
|
columnsForSizing.forEach(function (c) {
|
|
6817
6827
|
c.shouldGrow = true;
|
|
6818
|
-
if (
|
|
6828
|
+
if (_this49.options.autoFitColumns === false) {
|
|
6819
6829
|
c.shouldGrow = false;
|
|
6820
6830
|
if (c.potentialWidth > c.actualWidth) {
|
|
6821
6831
|
c.shouldGrow = true;
|
|
@@ -6834,7 +6844,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6834
6844
|
// if (!c.width) {
|
|
6835
6845
|
// if (c.actualWidth < equalWidth) {
|
|
6836
6846
|
// adjust the width
|
|
6837
|
-
if (
|
|
6847
|
+
if (_this49.options.autoFitColumns === true) {
|
|
6838
6848
|
if (c.width) {
|
|
6839
6849
|
c.width += equalWidth;
|
|
6840
6850
|
}
|
|
@@ -6858,9 +6868,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6858
6868
|
}
|
|
6859
6869
|
// }
|
|
6860
6870
|
// }
|
|
6861
|
-
|
|
6862
|
-
if (i >
|
|
6863
|
-
|
|
6871
|
+
_this49.sizes.totalWidth += c.width || c.actualWidth;
|
|
6872
|
+
if (i > _this49.pinnedColumns) {
|
|
6873
|
+
_this49.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6864
6874
|
}
|
|
6865
6875
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6866
6876
|
});
|
|
@@ -6919,7 +6929,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6919
6929
|
}, {
|
|
6920
6930
|
key: "createSample",
|
|
6921
6931
|
value: function createSample(data) {
|
|
6922
|
-
var
|
|
6932
|
+
var _this50 = this;
|
|
6923
6933
|
var output = [];
|
|
6924
6934
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6925
6935
|
if (col.maxLength) {
|
|
@@ -6929,7 +6939,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6929
6939
|
} else if (data) {
|
|
6930
6940
|
var longest = '';
|
|
6931
6941
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6932
|
-
if (data[i].length ===
|
|
6942
|
+
if (data[i].length === _this50.options.columns[_this50.options.columns.length - 1].length) {
|
|
6933
6943
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6934
6944
|
longest = data[i][colIndex].value;
|
|
6935
6945
|
}
|
|
@@ -7201,7 +7211,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7201
7211
|
}, {
|
|
7202
7212
|
key: "perpetualScroll",
|
|
7203
7213
|
value: function perpetualScroll() {
|
|
7204
|
-
var
|
|
7214
|
+
var _this51 = this;
|
|
7205
7215
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7206
7216
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7207
7217
|
return;
|
|
@@ -7220,17 +7230,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7220
7230
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7221
7231
|
var _loop2 = function _loop2(i) {
|
|
7222
7232
|
setTimeout(function () {
|
|
7223
|
-
var delta =
|
|
7233
|
+
var delta = _this51.mouseYStart - _this51.currentClientY + _this51.sizes.cellHeight * (i + 1) * direction;
|
|
7224
7234
|
delta = Math.min(10, delta);
|
|
7225
7235
|
delta = Math.max(-10, delta);
|
|
7226
7236
|
// only run this if isPerpetual === true
|
|
7227
7237
|
// this value is reset to false on touchStart
|
|
7228
|
-
if (
|
|
7238
|
+
if (_this51.isPerpetual === true) {
|
|
7229
7239
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7230
7240
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7231
|
-
|
|
7232
|
-
if (
|
|
7233
|
-
clearTimeout(
|
|
7241
|
+
_this51.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7242
|
+
if (_this51.scrollTimeout) {
|
|
7243
|
+
clearTimeout(_this51.scrollTimeout);
|
|
7234
7244
|
}
|
|
7235
7245
|
}
|
|
7236
7246
|
}, 1000 / fps * i);
|
|
@@ -7504,7 +7514,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7504
7514
|
/* global d3 include WebsyDesigns */
|
|
7505
7515
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7506
7516
|
function WebsyChart(elementId, options) {
|
|
7507
|
-
var
|
|
7517
|
+
var _this52 = this;
|
|
7508
7518
|
_classCallCheck(this, WebsyChart);
|
|
7509
7519
|
var DEFAULTS = {
|
|
7510
7520
|
margin: {
|
|
@@ -7564,7 +7574,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7564
7574
|
this.invertOverride = function (input, input2) {
|
|
7565
7575
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7566
7576
|
var xAxis = 'bottom';
|
|
7567
|
-
if (
|
|
7577
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
7568
7578
|
xAxis = 'left';
|
|
7569
7579
|
}
|
|
7570
7580
|
if (forBrush === true) {
|
|
@@ -7572,12 +7582,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7572
7582
|
}
|
|
7573
7583
|
xAxis += 'Axis';
|
|
7574
7584
|
var output;
|
|
7575
|
-
var width =
|
|
7585
|
+
var width = _this52.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7576
7586
|
// if (this.customBottomRange) {
|
|
7577
|
-
for (var index = 0; index <
|
|
7578
|
-
if (input >
|
|
7579
|
-
if (
|
|
7580
|
-
if (input <
|
|
7587
|
+
for (var index = 0; index < _this52.customBottomRange.length; index++) {
|
|
7588
|
+
if (input > _this52.customBottomRange[index]) {
|
|
7589
|
+
if (_this52.customBottomRange[index + 1]) {
|
|
7590
|
+
if (input < _this52.customBottomRange[index + 1]) {
|
|
7581
7591
|
output = index;
|
|
7582
7592
|
break;
|
|
7583
7593
|
}
|
|
@@ -7742,9 +7752,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7742
7752
|
}, {
|
|
7743
7753
|
key: "handleEventMouseMove",
|
|
7744
7754
|
value: function handleEventMouseMove(event, d) {
|
|
7745
|
-
var
|
|
7755
|
+
var _this53 = this;
|
|
7746
7756
|
var bisectDate = d3.bisector(function (d) {
|
|
7747
|
-
return
|
|
7757
|
+
return _this53.parseX(d.x.value);
|
|
7748
7758
|
}).left;
|
|
7749
7759
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7750
7760
|
var xAxis = 'bottomAxis';
|
|
@@ -7777,9 +7787,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7777
7787
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7778
7788
|
}
|
|
7779
7789
|
this.options.data.series.forEach(function (s) {
|
|
7780
|
-
if (
|
|
7790
|
+
if (_this53.options.data[xData].scale !== 'Time') {
|
|
7781
7791
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7782
|
-
xPoint =
|
|
7792
|
+
xPoint = _this53.customBottomRange[x0] + (_this53.customBottomRange[x0 + 1] - _this53.customBottomRange[x0]) / 2;
|
|
7783
7793
|
// }
|
|
7784
7794
|
// else {
|
|
7785
7795
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7799,41 +7809,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7799
7809
|
var index = bisectDate(s.data, x0, 1);
|
|
7800
7810
|
var pointA = s.data[index - 1];
|
|
7801
7811
|
var pointB = s.data[index];
|
|
7802
|
-
if (
|
|
7812
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
7803
7813
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7804
7814
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7805
7815
|
}
|
|
7806
7816
|
if (pointA && !pointB) {
|
|
7807
|
-
xPoint =
|
|
7817
|
+
xPoint = _this53[xAxis](_this53.parseX(pointA.x.value));
|
|
7808
7818
|
tooltipTitle = pointA.x.value;
|
|
7809
7819
|
if (!pointA.y.color) {
|
|
7810
7820
|
pointA.y.color = s.color;
|
|
7811
7821
|
}
|
|
7812
7822
|
tooltipData.push(pointA);
|
|
7813
7823
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7814
|
-
tooltipTitle = d3.timeFormat(
|
|
7824
|
+
tooltipTitle = d3.timeFormat(_this53.options.dateFormat || _this53.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7815
7825
|
}
|
|
7816
7826
|
}
|
|
7817
7827
|
if (pointB && !pointA) {
|
|
7818
|
-
xPoint =
|
|
7828
|
+
xPoint = _this53[xAxis](_this53.parseX(pointB.x.value));
|
|
7819
7829
|
tooltipTitle = pointB.x.value;
|
|
7820
7830
|
if (!pointB.y.color) {
|
|
7821
7831
|
pointB.y.color = s.color;
|
|
7822
7832
|
}
|
|
7823
7833
|
tooltipData.push(pointB);
|
|
7824
7834
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7825
|
-
tooltipTitle = d3.timeFormat(
|
|
7835
|
+
tooltipTitle = d3.timeFormat(_this53.options.dateFormat || _this53.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7826
7836
|
}
|
|
7827
7837
|
}
|
|
7828
7838
|
if (pointA && pointB) {
|
|
7829
|
-
var d0 =
|
|
7830
|
-
var d1 =
|
|
7839
|
+
var d0 = _this53[xAxis](_this53.parseX(pointA.x.value));
|
|
7840
|
+
var d1 = _this53[xAxis](_this53.parseX(pointB.x.value));
|
|
7831
7841
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7832
7842
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7833
7843
|
xPoint = d1;
|
|
7834
7844
|
tooltipTitle = pointB.x.value;
|
|
7835
7845
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7836
|
-
tooltipTitle = d3.timeFormat(
|
|
7846
|
+
tooltipTitle = d3.timeFormat(_this53.options.dateFormat || _this53.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7837
7847
|
}
|
|
7838
7848
|
if (!pointB.y.color) {
|
|
7839
7849
|
pointB.y.color = s.color;
|
|
@@ -7843,7 +7853,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7843
7853
|
xPoint = d0;
|
|
7844
7854
|
tooltipTitle = pointA.x.value;
|
|
7845
7855
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7846
|
-
tooltipTitle = d3.timeFormat(
|
|
7856
|
+
tooltipTitle = d3.timeFormat(_this53.options.dateFormat || _this53.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7847
7857
|
}
|
|
7848
7858
|
if (!pointA.y.color) {
|
|
7849
7859
|
pointA.y.color = s.color;
|
|
@@ -7969,7 +7979,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7969
7979
|
}, {
|
|
7970
7980
|
key: "render",
|
|
7971
7981
|
value: function render(options) {
|
|
7972
|
-
var
|
|
7982
|
+
var _this54 = this;
|
|
7973
7983
|
/* global d3 options WebsyUtils */
|
|
7974
7984
|
this._isRendered = false;
|
|
7975
7985
|
if (typeof options !== 'undefined') {
|
|
@@ -8038,7 +8048,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8038
8048
|
this.options.data.series.map(function (s, i) {
|
|
8039
8049
|
return {
|
|
8040
8050
|
value: s.label || s.key,
|
|
8041
|
-
color: s.color ||
|
|
8051
|
+
color: s.color || _this54.options.colors[i % _this54.options.colors.length]
|
|
8042
8052
|
};
|
|
8043
8053
|
});
|
|
8044
8054
|
}
|
|
@@ -8395,25 +8405,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8395
8405
|
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') {
|
|
8396
8406
|
var acc = 0;
|
|
8397
8407
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8398
|
-
var adjustment =
|
|
8408
|
+
var adjustment = _this54.bandPadding * index + _this54.bandPadding;
|
|
8399
8409
|
// if (this.options.data.bottom.padding) {
|
|
8400
8410
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8401
8411
|
// }
|
|
8402
|
-
var start =
|
|
8412
|
+
var start = _this54.widthForCalc / noOfPoints * acc;
|
|
8403
8413
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8404
8414
|
var pos = i * proposedBandWidth;
|
|
8405
|
-
|
|
8415
|
+
_this54["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8406
8416
|
}
|
|
8407
|
-
acc +=
|
|
8408
|
-
var end =
|
|
8417
|
+
acc += _this54.options.grouping !== 'stacked' && _this54.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8418
|
+
var end = _this54.widthForCalc / noOfPoints * acc;
|
|
8409
8419
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8410
8420
|
return end + adjustment;
|
|
8411
8421
|
})));
|
|
8412
8422
|
acc = 0;
|
|
8413
8423
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8414
|
-
var adjustment =
|
|
8415
|
-
acc +=
|
|
8416
|
-
return (
|
|
8424
|
+
var adjustment = _this54.brushBandPadding * index + _this54.brushBandPadding;
|
|
8425
|
+
acc += _this54.options.grouping !== 'stacked' && _this54.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8426
|
+
return (_this54.options.orientation === 'vertical' ? _this54.plotWidth : _this54.plotHeight) / noOfPoints * acc;
|
|
8417
8427
|
})));
|
|
8418
8428
|
}
|
|
8419
8429
|
// }
|
|
@@ -8586,7 +8596,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8586
8596
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
8587
8597
|
if (this.options.data.bottom.formatter) {
|
|
8588
8598
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8589
|
-
return
|
|
8599
|
+
return _this54.options.data.bottom.formatter(d);
|
|
8590
8600
|
});
|
|
8591
8601
|
}
|
|
8592
8602
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -8596,7 +8606,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8596
8606
|
}
|
|
8597
8607
|
if (this.customBottomRange.length > 0) {
|
|
8598
8608
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8599
|
-
return "translate(".concat(
|
|
8609
|
+
return "translate(".concat(_this54.customBottomRange[i] + (_this54.customBottomRange[i + 1] - _this54.customBottomRange[i]) / 2, ", 0)");
|
|
8600
8610
|
});
|
|
8601
8611
|
}
|
|
8602
8612
|
}
|
|
@@ -8615,14 +8625,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8615
8625
|
}
|
|
8616
8626
|
if (this.options.margin.axisLeft > 0) {
|
|
8617
8627
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8618
|
-
if (
|
|
8619
|
-
d =
|
|
8628
|
+
if (_this54.options.data.left.formatter) {
|
|
8629
|
+
d = _this54.options.data.left.formatter(d);
|
|
8620
8630
|
}
|
|
8621
8631
|
return d;
|
|
8622
8632
|
}));
|
|
8623
8633
|
if (this.customLeftRange.length > 0) {
|
|
8624
8634
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8625
|
-
return "translate(0, ".concat(
|
|
8635
|
+
return "translate(0, ".concat(_this54.customLeftRange[i] + (_this54.customLeftRange[i + 1] - _this54.customLeftRange[i]) / 2, ")");
|
|
8626
8636
|
});
|
|
8627
8637
|
}
|
|
8628
8638
|
}
|
|
@@ -8650,8 +8660,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8650
8660
|
}
|
|
8651
8661
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8652
8662
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8653
|
-
if (
|
|
8654
|
-
d =
|
|
8663
|
+
if (_this54.options.data.right.formatter) {
|
|
8664
|
+
d = _this54.options.data.right.formatter(d);
|
|
8655
8665
|
}
|
|
8656
8666
|
return d;
|
|
8657
8667
|
}));
|
|
@@ -8691,25 +8701,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8691
8701
|
}, {
|
|
8692
8702
|
key: "renderComponents",
|
|
8693
8703
|
value: function renderComponents() {
|
|
8694
|
-
var
|
|
8704
|
+
var _this55 = this;
|
|
8695
8705
|
// Draw the series data
|
|
8696
8706
|
this.renderedKeys = {};
|
|
8697
8707
|
this.options.data.series.forEach(function (series, index) {
|
|
8698
8708
|
if (!series.key) {
|
|
8699
|
-
series.key =
|
|
8709
|
+
series.key = _this55.createIdentity();
|
|
8700
8710
|
}
|
|
8701
8711
|
if (!series.color) {
|
|
8702
|
-
series.color =
|
|
8712
|
+
series.color = _this55.options.colors[index % _this55.options.colors.length];
|
|
8703
8713
|
}
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8714
|
+
_this55["render".concat(series.type || 'bar')](series, index);
|
|
8715
|
+
_this55.renderLabels(series, index);
|
|
8716
|
+
_this55.renderedKeys[series.key] = series.type;
|
|
8707
8717
|
});
|
|
8708
8718
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8709
8719
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8710
8720
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8711
8721
|
this.options.refLines.forEach(function (l) {
|
|
8712
|
-
return
|
|
8722
|
+
return _this55.renderRefLine(l);
|
|
8713
8723
|
});
|
|
8714
8724
|
}
|
|
8715
8725
|
this._isRendered = true;
|
|
@@ -8717,25 +8727,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8717
8727
|
}, {
|
|
8718
8728
|
key: "renderarea",
|
|
8719
8729
|
value: function renderarea(series, index) {
|
|
8720
|
-
var
|
|
8730
|
+
var _this56 = this;
|
|
8721
8731
|
/* global d3 series index */
|
|
8722
8732
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8723
8733
|
return d3.area().x(function (d) {
|
|
8724
|
-
if (
|
|
8725
|
-
return
|
|
8734
|
+
if (_this56.options.data[xAxis].scale === 'Time') {
|
|
8735
|
+
return _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
|
|
8726
8736
|
} else {
|
|
8727
|
-
var xIndex =
|
|
8728
|
-
var xPos =
|
|
8729
|
-
if (
|
|
8730
|
-
xPos = xPos + (
|
|
8737
|
+
var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8738
|
+
var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8739
|
+
if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8740
|
+
xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8731
8741
|
}
|
|
8732
8742
|
return xPos;
|
|
8733
8743
|
}
|
|
8734
8744
|
}).y0(function (d) {
|
|
8735
|
-
return
|
|
8745
|
+
return _this56["".concat(yAxis, "Axis")](0);
|
|
8736
8746
|
}).y1(function (d) {
|
|
8737
|
-
return
|
|
8738
|
-
}).curve(d3[curveStyle ||
|
|
8747
|
+
return _this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8748
|
+
}).curve(d3[curveStyle || _this56.options.curveStyle]);
|
|
8739
8749
|
};
|
|
8740
8750
|
var xAxis = 'bottom';
|
|
8741
8751
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8775,7 +8785,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8775
8785
|
}, {
|
|
8776
8786
|
key: "renderbar",
|
|
8777
8787
|
value: function renderbar(series, index) {
|
|
8778
|
-
var
|
|
8788
|
+
var _this57 = this;
|
|
8779
8789
|
/* global series index d3 */
|
|
8780
8790
|
var xAxis = 'bottom';
|
|
8781
8791
|
var yAxis = 'left';
|
|
@@ -8942,24 +8952,24 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8942
8952
|
}
|
|
8943
8953
|
bars.exit().transition().duration(this.options.transitionDuration).style('fill-opacity', 1e-6).remove();
|
|
8944
8954
|
bars.attr('width', function (d, i) {
|
|
8945
|
-
return Math.abs(getBarWidth.call(
|
|
8955
|
+
return Math.abs(getBarWidth.call(_this57, d, i, yAxis, xAxis));
|
|
8946
8956
|
}).attr('height', function (d, i) {
|
|
8947
|
-
return getBarHeight.call(
|
|
8957
|
+
return getBarHeight.call(_this57, d, i, yAxis, xAxis);
|
|
8948
8958
|
}).attr('x', function (d, i) {
|
|
8949
|
-
return getBarX.call(
|
|
8959
|
+
return getBarX.call(_this57, d, i, yAxis, xAxis);
|
|
8950
8960
|
}).attr('y', function (d, i) {
|
|
8951
|
-
return getBarY.call(
|
|
8961
|
+
return getBarY.call(_this57, d, i, yAxis, xAxis);
|
|
8952
8962
|
}).transition().duration(this.options.transitionDuration).attr('fill', function (d) {
|
|
8953
8963
|
return d.y.color || d.color || series.color;
|
|
8954
8964
|
});
|
|
8955
8965
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8956
|
-
return Math.abs(getBarWidth.call(
|
|
8966
|
+
return Math.abs(getBarWidth.call(_this57, d, i, yAxis, xAxis));
|
|
8957
8967
|
}).attr('height', function (d, i) {
|
|
8958
|
-
return getBarHeight.call(
|
|
8968
|
+
return getBarHeight.call(_this57, d, i, yAxis, xAxis);
|
|
8959
8969
|
}).attr('x', function (d, i) {
|
|
8960
|
-
return getBarX.call(
|
|
8970
|
+
return getBarX.call(_this57, d, i, yAxis, xAxis);
|
|
8961
8971
|
}).attr('y', function (d, i) {
|
|
8962
|
-
return getBarY.call(
|
|
8972
|
+
return getBarY.call(_this57, d, i, yAxis, xAxis);
|
|
8963
8973
|
})
|
|
8964
8974
|
// .transition(this.transition)
|
|
8965
8975
|
.attr('fill', function (d) {
|
|
@@ -8971,24 +8981,24 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8971
8981
|
this.brushBarsInitialized[series.key] = true;
|
|
8972
8982
|
brushBars.exit().transition().duration(this.options.transitionDuration).style('fill-opacity', 1e-6).remove();
|
|
8973
8983
|
brushBars.attr('width', function (d, i) {
|
|
8974
|
-
return Math.abs(getBarWidth.call(
|
|
8984
|
+
return Math.abs(getBarWidth.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8975
8985
|
}).attr('height', function (d, i) {
|
|
8976
|
-
return getBarHeight.call(
|
|
8986
|
+
return getBarHeight.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8977
8987
|
}).attr('x', function (d, i) {
|
|
8978
|
-
return getBarX.call(
|
|
8988
|
+
return getBarX.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8979
8989
|
}).attr('y', function (d, i) {
|
|
8980
|
-
return getBarY.call(
|
|
8990
|
+
return getBarY.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8981
8991
|
}).transition().duration(this.options.transitionDuration).attr('fill', function (d) {
|
|
8982
8992
|
return d.y.color || d.color || series.color;
|
|
8983
8993
|
});
|
|
8984
8994
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8985
|
-
return Math.abs(getBarWidth.call(
|
|
8995
|
+
return Math.abs(getBarWidth.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8986
8996
|
}).attr('height', function (d, i) {
|
|
8987
|
-
return getBarHeight.call(
|
|
8997
|
+
return getBarHeight.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8988
8998
|
}).attr('x', function (d, i) {
|
|
8989
|
-
return getBarX.call(
|
|
8999
|
+
return getBarX.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8990
9000
|
}).attr('y', function (d, i) {
|
|
8991
|
-
return getBarY.call(
|
|
9001
|
+
return getBarY.call(_this57, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8992
9002
|
})
|
|
8993
9003
|
// .transition(this.transition)
|
|
8994
9004
|
.attr('fill', function (d) {
|
|
@@ -9015,7 +9025,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9015
9025
|
}, {
|
|
9016
9026
|
key: "renderLabels",
|
|
9017
9027
|
value: function renderLabels(series, index) {
|
|
9018
|
-
var
|
|
9028
|
+
var _this58 = this;
|
|
9019
9029
|
/* global series index d3 WebsyDesigns */
|
|
9020
9030
|
var xAxis = 'bottom';
|
|
9021
9031
|
var yAxis = 'left';
|
|
@@ -9031,14 +9041,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9031
9041
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9032
9042
|
labels.exit().transition().duration(this.options.transitionDuration).style('stroke-opacity', 1e-6).remove();
|
|
9033
9043
|
labels.attr('x', function (d) {
|
|
9034
|
-
return getLabelX.call(
|
|
9044
|
+
return getLabelX.call(_this58, d, series.labelPosition);
|
|
9035
9045
|
}).attr('y', function (d) {
|
|
9036
|
-
return getLabelY.call(
|
|
9046
|
+
return getLabelY.call(_this58, d, series.labelPosition);
|
|
9037
9047
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9038
|
-
if (
|
|
9048
|
+
if (_this58.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9039
9049
|
return 'transparent';
|
|
9040
9050
|
}
|
|
9041
|
-
return
|
|
9051
|
+
return _this58.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9042
9052
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition().duration(this.options.transitionDuration).text(function (d) {
|
|
9043
9053
|
return d.y.label || d.y.value;
|
|
9044
9054
|
}).each(function (d, i) {
|
|
@@ -9072,14 +9082,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9072
9082
|
}
|
|
9073
9083
|
});
|
|
9074
9084
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9075
|
-
return getLabelX.call(
|
|
9085
|
+
return getLabelX.call(_this58, d, series.labelPosition);
|
|
9076
9086
|
}).attr('y', function (d) {
|
|
9077
|
-
return getLabelY.call(
|
|
9087
|
+
return getLabelY.call(_this58, d, series.labelPosition);
|
|
9078
9088
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9079
|
-
if (
|
|
9089
|
+
if (_this58.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9080
9090
|
return 'transparent';
|
|
9081
9091
|
}
|
|
9082
|
-
return
|
|
9092
|
+
return _this58.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9083
9093
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9084
9094
|
return d.y.label || d.y.value;
|
|
9085
9095
|
}).each(function (d, i) {
|
|
@@ -9157,32 +9167,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9157
9167
|
}, {
|
|
9158
9168
|
key: "renderline",
|
|
9159
9169
|
value: function renderline(series, index) {
|
|
9160
|
-
var
|
|
9170
|
+
var _this59 = this;
|
|
9161
9171
|
/* global series index d3 */
|
|
9162
9172
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9163
9173
|
return d3.line().x(function (d) {
|
|
9164
|
-
if (
|
|
9165
|
-
return
|
|
9174
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9175
|
+
return _this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9166
9176
|
} else {
|
|
9167
|
-
if (
|
|
9168
|
-
return
|
|
9177
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9178
|
+
return _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9169
9179
|
} else {
|
|
9170
|
-
var xIndex =
|
|
9171
|
-
var xPos =
|
|
9172
|
-
if (
|
|
9173
|
-
xPos = xPos + (
|
|
9180
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9181
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9182
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9183
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9174
9184
|
}
|
|
9175
9185
|
return xPos;
|
|
9176
9186
|
}
|
|
9177
9187
|
}
|
|
9178
9188
|
}).y(function (d) {
|
|
9179
|
-
if (
|
|
9180
|
-
var adjustment =
|
|
9181
|
-
return
|
|
9189
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9190
|
+
var adjustment = _this59.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9191
|
+
return _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value)) + adjustment;
|
|
9182
9192
|
} else {
|
|
9183
|
-
return
|
|
9193
|
+
return _this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9184
9194
|
}
|
|
9185
|
-
}).curve(d3[curveStyle ||
|
|
9195
|
+
}).curve(d3[curveStyle || _this59.options.curveStyle]);
|
|
9186
9196
|
};
|
|
9187
9197
|
var xAxis = 'bottom';
|
|
9188
9198
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9303,14 +9313,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9303
9313
|
}, {
|
|
9304
9314
|
key: "rendersymbol",
|
|
9305
9315
|
value: function rendersymbol(series, index) {
|
|
9306
|
-
var
|
|
9316
|
+
var _this60 = this;
|
|
9307
9317
|
/* global d3 series index series.key */
|
|
9308
9318
|
var drawSymbol = function drawSymbol(size) {
|
|
9309
9319
|
return d3.symbol()
|
|
9310
9320
|
// .type(d => {
|
|
9311
9321
|
// return d3.symbols[0]
|
|
9312
9322
|
// })
|
|
9313
|
-
.size(size ||
|
|
9323
|
+
.size(size || _this60.options.symbolSize);
|
|
9314
9324
|
};
|
|
9315
9325
|
var xAxis = 'bottom';
|
|
9316
9326
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9340,27 +9350,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9340
9350
|
// else {
|
|
9341
9351
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9342
9352
|
// }
|
|
9343
|
-
var xIndex =
|
|
9344
|
-
var xPos =
|
|
9345
|
-
if (
|
|
9346
|
-
xPos = xPos + (
|
|
9347
|
-
}
|
|
9348
|
-
var adjustment =
|
|
9349
|
-
if (
|
|
9350
|
-
return "translate(".concat(
|
|
9353
|
+
var xIndex = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9354
|
+
var xPos = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9355
|
+
if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9356
|
+
xPos = xPos + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9357
|
+
}
|
|
9358
|
+
var adjustment = _this60.options.data[xAxis].scale === 'Time' || _this60.options.data[xAxis].scale === 'Linear' ? 0 : _this60.options.data[xAxis].bandWidth / 2;
|
|
9359
|
+
if (_this60.options.orientation === 'horizontal') {
|
|
9360
|
+
return "translate(".concat(_this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9351
9361
|
} else {
|
|
9352
|
-
if (
|
|
9353
|
-
xPos =
|
|
9362
|
+
if (_this60.options.data[xAxis].scale === 'Time') {
|
|
9363
|
+
xPos = _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value));
|
|
9354
9364
|
} else {
|
|
9355
|
-
var _xIndex =
|
|
9356
|
-
var _xPos =
|
|
9357
|
-
if (
|
|
9358
|
-
_xPos = _xPos + (
|
|
9365
|
+
var _xIndex = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9366
|
+
var _xPos = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
9367
|
+
if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
9368
|
+
_xPos = _xPos + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
9359
9369
|
}
|
|
9360
9370
|
// return xPos
|
|
9361
9371
|
}
|
|
9362
9372
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9363
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9373
|
+
return "translate(".concat(xPos, ", ").concat(_this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9364
9374
|
}
|
|
9365
9375
|
});
|
|
9366
9376
|
// Enter
|
|
@@ -9375,27 +9385,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9375
9385
|
}).attr('class', function (d) {
|
|
9376
9386
|
return "symbol symbol_".concat(series.key);
|
|
9377
9387
|
}).attr('transform', function (d) {
|
|
9378
|
-
var xIndex =
|
|
9379
|
-
var xPos =
|
|
9380
|
-
if (
|
|
9381
|
-
xPos = xPos + (
|
|
9382
|
-
}
|
|
9383
|
-
var adjustment =
|
|
9384
|
-
if (
|
|
9385
|
-
return "translate(".concat(
|
|
9388
|
+
var xIndex = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9389
|
+
var xPos = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9390
|
+
if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9391
|
+
xPos = xPos + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9392
|
+
}
|
|
9393
|
+
var adjustment = _this60.options.data[xAxis].scale === 'Time' || _this60.options.data[xAxis].scale === 'Linear' ? 0 : _this60.options.data[xAxis].bandWidth / 2;
|
|
9394
|
+
if (_this60.options.orientation === 'horizontal') {
|
|
9395
|
+
return "translate(".concat(_this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9386
9396
|
} else {
|
|
9387
|
-
if (
|
|
9388
|
-
xPos =
|
|
9397
|
+
if (_this60.options.data[xAxis].scale === 'Time') {
|
|
9398
|
+
xPos = _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value));
|
|
9389
9399
|
} else {
|
|
9390
|
-
var _xIndex2 =
|
|
9391
|
-
var _xPos2 =
|
|
9392
|
-
if (
|
|
9393
|
-
_xPos2 = _xPos2 + (
|
|
9400
|
+
var _xIndex2 = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9401
|
+
var _xPos2 = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
9402
|
+
if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
9403
|
+
_xPos2 = _xPos2 + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
9394
9404
|
}
|
|
9395
9405
|
// return xPos
|
|
9396
9406
|
}
|
|
9397
9407
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9398
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9408
|
+
return "translate(".concat(xPos, ", ").concat(_this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9399
9409
|
}
|
|
9400
9410
|
});
|
|
9401
9411
|
}
|
|
@@ -9591,7 +9601,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9591
9601
|
}, {
|
|
9592
9602
|
key: "resize",
|
|
9593
9603
|
value: function resize() {
|
|
9594
|
-
var
|
|
9604
|
+
var _this61 = this;
|
|
9595
9605
|
var el = document.getElementById(this.elementId);
|
|
9596
9606
|
if (el) {
|
|
9597
9607
|
// if (this.options.width) {
|
|
@@ -9602,7 +9612,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9602
9612
|
// }
|
|
9603
9613
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9604
9614
|
html += this._data.map(function (d, i) {
|
|
9605
|
-
return
|
|
9615
|
+
return _this61.getLegendItemHTML(d);
|
|
9606
9616
|
}).join('');
|
|
9607
9617
|
html += "\n <div>\n ";
|
|
9608
9618
|
el.innerHTML = html;
|
|
@@ -9763,7 +9773,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9763
9773
|
}, {
|
|
9764
9774
|
key: "render",
|
|
9765
9775
|
value: function render() {
|
|
9766
|
-
var
|
|
9776
|
+
var _this62 = this;
|
|
9767
9777
|
this._isRendered = false;
|
|
9768
9778
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9769
9779
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -9771,7 +9781,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9771
9781
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9772
9782
|
return {
|
|
9773
9783
|
value: s.label || s.key,
|
|
9774
|
-
color: s.color ||
|
|
9784
|
+
color: s.color || _this62.options.colors[i % _this62.options.colors.length]
|
|
9775
9785
|
};
|
|
9776
9786
|
});
|
|
9777
9787
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9825,7 +9835,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9825
9835
|
}
|
|
9826
9836
|
if (this.polygons) {
|
|
9827
9837
|
this.polygons.forEach(function (p) {
|
|
9828
|
-
return
|
|
9838
|
+
return _this62.map.removeLayer(p);
|
|
9829
9839
|
});
|
|
9830
9840
|
}
|
|
9831
9841
|
this.polygons = [];
|
|
@@ -9879,15 +9889,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9879
9889
|
p.options = {};
|
|
9880
9890
|
}
|
|
9881
9891
|
if (!p.options.color) {
|
|
9882
|
-
p.options.color =
|
|
9892
|
+
p.options.color = _this62.options.colors[i % _this62.options.colors.length];
|
|
9883
9893
|
}
|
|
9884
9894
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9885
9895
|
return c.map(function (d) {
|
|
9886
9896
|
return [d.Latitude, d.Longitude];
|
|
9887
9897
|
});
|
|
9888
|
-
}), p.options).addTo(
|
|
9889
|
-
|
|
9890
|
-
|
|
9898
|
+
}), p.options).addTo(_this62.map);
|
|
9899
|
+
_this62.polygons.push(pol);
|
|
9900
|
+
_this62.map.fitBounds(pol.getBounds());
|
|
9891
9901
|
});
|
|
9892
9902
|
}
|
|
9893
9903
|
// if (this.data.markers.length > 0) {
|