@websy/websy-designs 1.4.15 → 1.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/routes/v1/recaptcha.js +2 -1
- package/dist/websy-designs-es6.debug.js +51 -30
- package/dist/websy-designs-es6.js +266 -238
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +52 -31
- package/dist/websy-designs.js +270 -242
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2254,27 +2254,28 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2254
2254
|
|
|
2255
2255
|
return new Promise(function (resolve, reject) {
|
|
2256
2256
|
if (_this11.options.useRecaptcha === true) {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
grecaptcha.execute(
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
}
|
|
2271
|
-
},
|
|
2272
|
-
|
|
2273
|
-
})
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2257
|
+
if (_this11.recaptchaValue) {
|
|
2258
|
+
// grecaptcha.ready(() => {
|
|
2259
|
+
// grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
|
|
2260
|
+
_this11.apiService.add('google/checkrecaptcha', {
|
|
2261
|
+
grecaptcharesponse: _this11.recaptchaValue
|
|
2262
|
+
}).then(function (response) {
|
|
2263
|
+
if (response.success && response.success === true) {
|
|
2264
|
+
resolve(true);
|
|
2265
|
+
grecaptcha.reset("".concat(_this11.elementId, "_recaptcha"), {
|
|
2266
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2267
|
+
});
|
|
2268
|
+
} else {
|
|
2269
|
+
resolve(false);
|
|
2270
|
+
}
|
|
2271
|
+
}); // }, err => {
|
|
2272
|
+
// reject(err)
|
|
2273
|
+
// })
|
|
2274
|
+
// })
|
|
2275
|
+
|
|
2276
|
+
} else {
|
|
2277
|
+
resolve(false);
|
|
2278
|
+
}
|
|
2278
2279
|
} else {
|
|
2279
2280
|
resolve(true);
|
|
2280
2281
|
}
|
|
@@ -2338,19 +2339,23 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2338
2339
|
}, {
|
|
2339
2340
|
key: "recaptchaReady",
|
|
2340
2341
|
value: function recaptchaReady() {
|
|
2342
|
+
var _this13 = this;
|
|
2343
|
+
|
|
2341
2344
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2342
2345
|
|
|
2343
2346
|
if (el) {
|
|
2344
|
-
grecaptcha.
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
+
grecaptcha.ready(function () {
|
|
2348
|
+
grecaptcha.render("".concat(_this13.elementId, "_recaptcha"), {
|
|
2349
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2350
|
+
callback: _this13.validateRecaptcha.bind(_this13)
|
|
2351
|
+
});
|
|
2347
2352
|
});
|
|
2348
2353
|
}
|
|
2349
2354
|
}
|
|
2350
2355
|
}, {
|
|
2351
2356
|
key: "render",
|
|
2352
2357
|
value: function render(update, data) {
|
|
2353
|
-
var
|
|
2358
|
+
var _this14 = this;
|
|
2354
2359
|
|
|
2355
2360
|
var el = document.getElementById(this.elementId);
|
|
2356
2361
|
var componentsToProcess = [];
|
|
@@ -2360,13 +2365,18 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2360
2365
|
this.options.fields.forEach(function (f, i) {
|
|
2361
2366
|
if (f.component) {
|
|
2362
2367
|
componentsToProcess.push(f);
|
|
2363
|
-
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(
|
|
2368
|
+
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(_this14.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2364
2369
|
} else if (f.type === 'longtext') {
|
|
2365
|
-
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(
|
|
2370
|
+
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(_this14.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 ");
|
|
2366
2371
|
} else {
|
|
2367
|
-
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(
|
|
2372
|
+
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(_this14.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 ");
|
|
2368
2373
|
}
|
|
2369
2374
|
});
|
|
2375
|
+
|
|
2376
|
+
if (this.options.useRecaptcha === true) {
|
|
2377
|
+
html += "\n --><div id='".concat(this.elementId, "_recaptcha' data-sitekey='").concat(ENVIRONMENT.RECAPTCHA_KEY, "' class='websy-form-recaptcha'></div>\n <div id='").concat(this.elementId, "_recaptchaError' class='websy-alert websy-alert-error websy-hidden'>Invalid recaptcha response</div><!--\n ");
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2370
2380
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
2371
2381
|
|
|
2372
2382
|
if (this.options.cancel) {
|
|
@@ -2374,14 +2384,10 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2374
2384
|
}
|
|
2375
2385
|
|
|
2376
2386
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2377
|
-
|
|
2378
|
-
if (this.options.useRecaptcha === true) {
|
|
2379
|
-
html += "\n <div id='".concat(this.elementId, "_recaptcha'></div>\n ");
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
2387
|
el.innerHTML = html;
|
|
2383
2388
|
this.processComponents(componentsToProcess, function () {
|
|
2384
|
-
if (
|
|
2389
|
+
if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2390
|
+
_this14.recaptchaReady();
|
|
2385
2391
|
}
|
|
2386
2392
|
});
|
|
2387
2393
|
}
|
|
@@ -2389,13 +2395,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2389
2395
|
}, {
|
|
2390
2396
|
key: "submitForm",
|
|
2391
2397
|
value: function submitForm() {
|
|
2392
|
-
var
|
|
2398
|
+
var _this15 = this;
|
|
2393
2399
|
|
|
2394
2400
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2401
|
+
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2402
|
+
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
2395
2403
|
|
|
2396
2404
|
if (formEl.reportValidity() === true) {
|
|
2405
|
+
if (buttonEl) {
|
|
2406
|
+
buttonEl.setAttribute('disabled', true);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2397
2409
|
this.checkRecaptcha().then(function (result) {
|
|
2410
|
+
if (buttonEl) {
|
|
2411
|
+
buttonEl.removeAttribute('disabled');
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2398
2414
|
if (result === true) {
|
|
2415
|
+
if (recaptchErrEl) {
|
|
2416
|
+
recaptchErrEl.classList.add('websy-hidden');
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2399
2419
|
var formData = new FormData(formEl);
|
|
2400
2420
|
var data = {};
|
|
2401
2421
|
var temp = new FormData(formEl);
|
|
@@ -2403,39 +2423,47 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2403
2423
|
data[key] = value;
|
|
2404
2424
|
});
|
|
2405
2425
|
|
|
2406
|
-
if (
|
|
2407
|
-
var
|
|
2426
|
+
if (_this15.options.url) {
|
|
2427
|
+
var _this15$apiService;
|
|
2408
2428
|
|
|
2409
|
-
var params = [
|
|
2429
|
+
var params = [_this15.options.url];
|
|
2410
2430
|
|
|
2411
|
-
if (
|
|
2412
|
-
params.push(
|
|
2431
|
+
if (_this15.options.mode === 'update') {
|
|
2432
|
+
params.push(_this15.options.id);
|
|
2413
2433
|
}
|
|
2414
2434
|
|
|
2415
2435
|
params.push(data);
|
|
2416
2436
|
|
|
2417
|
-
(
|
|
2418
|
-
if (
|
|
2437
|
+
(_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
|
|
2438
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2419
2439
|
// this.render()
|
|
2420
2440
|
formEl.reset();
|
|
2421
2441
|
}
|
|
2422
2442
|
|
|
2423
|
-
|
|
2443
|
+
buttonEl.removeAttribute('disabled');
|
|
2444
|
+
|
|
2445
|
+
_this15.options.onSuccess.call(_this15, result);
|
|
2424
2446
|
}, function (err) {
|
|
2425
2447
|
console.log('Error submitting form data:', err);
|
|
2426
2448
|
|
|
2427
|
-
|
|
2449
|
+
_this15.options.onError.call(_this15, err);
|
|
2428
2450
|
});
|
|
2429
|
-
} else if (
|
|
2430
|
-
|
|
2431
|
-
if (
|
|
2451
|
+
} else if (_this15.options.submitFn) {
|
|
2452
|
+
_this15.options.submitFn(data, function () {
|
|
2453
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2432
2454
|
// this.render()
|
|
2433
2455
|
formEl.reset();
|
|
2434
2456
|
}
|
|
2435
2457
|
});
|
|
2436
2458
|
}
|
|
2437
2459
|
} else {
|
|
2438
|
-
|
|
2460
|
+
if (buttonEl) {
|
|
2461
|
+
buttonEl.removeAttribute('disabled');
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
if (recaptchErrEl) {
|
|
2465
|
+
recaptchErrEl.classList.remove('websy-hidden');
|
|
2466
|
+
}
|
|
2439
2467
|
}
|
|
2440
2468
|
});
|
|
2441
2469
|
}
|
|
@@ -2448,17 +2476,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2448
2476
|
}, {
|
|
2449
2477
|
key: "data",
|
|
2450
2478
|
set: function set(d) {
|
|
2451
|
-
var
|
|
2479
|
+
var _this16 = this;
|
|
2452
2480
|
|
|
2453
2481
|
if (!this.options.fields) {
|
|
2454
2482
|
this.options.fields = [];
|
|
2455
2483
|
}
|
|
2456
2484
|
|
|
2457
2485
|
var _loop = function _loop(key) {
|
|
2458
|
-
|
|
2486
|
+
_this16.options.fields.forEach(function (f) {
|
|
2459
2487
|
if (f.field === key) {
|
|
2460
2488
|
f.value = d[key];
|
|
2461
|
-
var el = document.getElementById("".concat(
|
|
2489
|
+
var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
|
|
2462
2490
|
el.value = f.value;
|
|
2463
2491
|
}
|
|
2464
2492
|
});
|
|
@@ -2662,11 +2690,11 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2662
2690
|
}, {
|
|
2663
2691
|
key: "handleSearch",
|
|
2664
2692
|
value: function handleSearch(searchText) {
|
|
2665
|
-
var
|
|
2693
|
+
var _this17 = this;
|
|
2666
2694
|
|
|
2667
2695
|
var el = document.getElementById(this.elementId);
|
|
2668
2696
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
2669
|
-
return d.level ===
|
|
2697
|
+
return d.level === _this17.maxLevel;
|
|
2670
2698
|
});
|
|
2671
2699
|
var visibleItems = lowestItems;
|
|
2672
2700
|
var defaultMethod = 'remove';
|
|
@@ -2674,7 +2702,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2674
2702
|
if (searchText && searchText.length > 1) {
|
|
2675
2703
|
defaultMethod = 'add';
|
|
2676
2704
|
visibleItems = lowestItems.filter(function (d) {
|
|
2677
|
-
return d[
|
|
2705
|
+
return d[_this17.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2678
2706
|
});
|
|
2679
2707
|
} // hide everything
|
|
2680
2708
|
|
|
@@ -2878,7 +2906,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2878
2906
|
|
|
2879
2907
|
var Pager = /*#__PURE__*/function () {
|
|
2880
2908
|
function Pager(elementId, options) {
|
|
2881
|
-
var
|
|
2909
|
+
var _this18 = this;
|
|
2882
2910
|
|
|
2883
2911
|
_classCallCheck(this, Pager);
|
|
2884
2912
|
|
|
@@ -2931,8 +2959,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2931
2959
|
allowClear: false,
|
|
2932
2960
|
disableSearch: true,
|
|
2933
2961
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2934
|
-
if (
|
|
2935
|
-
|
|
2962
|
+
if (_this18.options.onChangePageSize) {
|
|
2963
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2936
2964
|
}
|
|
2937
2965
|
}
|
|
2938
2966
|
});
|
|
@@ -2956,13 +2984,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2956
2984
|
}, {
|
|
2957
2985
|
key: "render",
|
|
2958
2986
|
value: function render() {
|
|
2959
|
-
var
|
|
2987
|
+
var _this19 = this;
|
|
2960
2988
|
|
|
2961
2989
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2962
2990
|
|
|
2963
2991
|
if (el) {
|
|
2964
2992
|
var pages = this.options.pages.map(function (item, index) {
|
|
2965
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2993
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2966
2994
|
});
|
|
2967
2995
|
var startIndex = 0;
|
|
2968
2996
|
|
|
@@ -3030,58 +3058,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3030
3058
|
_createClass(WebsyPDFButton, [{
|
|
3031
3059
|
key: "handleClick",
|
|
3032
3060
|
value: function handleClick(event) {
|
|
3033
|
-
var
|
|
3061
|
+
var _this20 = this;
|
|
3034
3062
|
|
|
3035
3063
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3036
3064
|
this.loader.show();
|
|
3037
3065
|
setTimeout(function () {
|
|
3038
|
-
if (
|
|
3039
|
-
var el = document.getElementById(
|
|
3066
|
+
if (_this20.options.targetId) {
|
|
3067
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
3040
3068
|
|
|
3041
3069
|
if (el) {
|
|
3042
3070
|
var pdfData = {
|
|
3043
3071
|
options: {}
|
|
3044
3072
|
};
|
|
3045
3073
|
|
|
3046
|
-
if (
|
|
3047
|
-
pdfData.options = _extends({},
|
|
3074
|
+
if (_this20.options.pdfOptions) {
|
|
3075
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
3048
3076
|
}
|
|
3049
3077
|
|
|
3050
|
-
if (
|
|
3051
|
-
if (
|
|
3052
|
-
var headerEl = document.getElementById(
|
|
3078
|
+
if (_this20.options.header) {
|
|
3079
|
+
if (_this20.options.header.elementId) {
|
|
3080
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
3053
3081
|
|
|
3054
3082
|
if (headerEl) {
|
|
3055
3083
|
pdfData.header = headerEl.outerHTML;
|
|
3056
3084
|
|
|
3057
|
-
if (
|
|
3058
|
-
pdfData.options.headerCSS =
|
|
3085
|
+
if (_this20.options.header.css) {
|
|
3086
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3059
3087
|
}
|
|
3060
3088
|
}
|
|
3061
|
-
} else if (
|
|
3062
|
-
pdfData.header =
|
|
3089
|
+
} else if (_this20.options.header.html) {
|
|
3090
|
+
pdfData.header = _this20.options.header.html;
|
|
3063
3091
|
|
|
3064
|
-
if (
|
|
3065
|
-
pdfData.options.headerCSS =
|
|
3092
|
+
if (_this20.options.header.css) {
|
|
3093
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3066
3094
|
}
|
|
3067
3095
|
} else {
|
|
3068
|
-
pdfData.header =
|
|
3096
|
+
pdfData.header = _this20.options.header;
|
|
3069
3097
|
}
|
|
3070
3098
|
}
|
|
3071
3099
|
|
|
3072
|
-
if (
|
|
3073
|
-
if (
|
|
3074
|
-
var footerEl = document.getElementById(
|
|
3100
|
+
if (_this20.options.footer) {
|
|
3101
|
+
if (_this20.options.footer.elementId) {
|
|
3102
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
3075
3103
|
|
|
3076
3104
|
if (footerEl) {
|
|
3077
3105
|
pdfData.footer = footerEl.outerHTML;
|
|
3078
3106
|
|
|
3079
|
-
if (
|
|
3080
|
-
pdfData.options.footerCSS =
|
|
3107
|
+
if (_this20.options.footer.css) {
|
|
3108
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
3081
3109
|
}
|
|
3082
3110
|
}
|
|
3083
3111
|
} else {
|
|
3084
|
-
pdfData.footer =
|
|
3112
|
+
pdfData.footer = _this20.options.footer;
|
|
3085
3113
|
}
|
|
3086
3114
|
}
|
|
3087
3115
|
|
|
@@ -3090,31 +3118,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3090
3118
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3091
3119
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3092
3120
|
|
|
3093
|
-
|
|
3121
|
+
_this20.service.add('', pdfData, {
|
|
3094
3122
|
responseType: 'blob'
|
|
3095
3123
|
}).then(function (response) {
|
|
3096
|
-
|
|
3124
|
+
_this20.loader.hide();
|
|
3097
3125
|
|
|
3098
3126
|
var blob = new Blob([response], {
|
|
3099
3127
|
type: 'application/pdf'
|
|
3100
3128
|
});
|
|
3101
3129
|
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 ");
|
|
3102
3130
|
|
|
3103
|
-
if (
|
|
3131
|
+
if (_this20.options.directDownload === true) {
|
|
3104
3132
|
var fileName;
|
|
3105
3133
|
|
|
3106
|
-
if (typeof
|
|
3107
|
-
fileName =
|
|
3134
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
3135
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
3108
3136
|
} else {
|
|
3109
|
-
fileName =
|
|
3137
|
+
fileName = _this20.options.fileName || 'Export';
|
|
3110
3138
|
}
|
|
3111
3139
|
|
|
3112
3140
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3113
3141
|
}
|
|
3114
3142
|
|
|
3115
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3143
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3116
3144
|
|
|
3117
|
-
|
|
3145
|
+
_this20.popup.show({
|
|
3118
3146
|
message: msg,
|
|
3119
3147
|
mask: true
|
|
3120
3148
|
});
|
|
@@ -3315,7 +3343,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3315
3343
|
|
|
3316
3344
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3317
3345
|
function ResponsiveText(elementId, options) {
|
|
3318
|
-
var
|
|
3346
|
+
var _this21 = this;
|
|
3319
3347
|
|
|
3320
3348
|
_classCallCheck(this, ResponsiveText);
|
|
3321
3349
|
|
|
@@ -3328,7 +3356,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3328
3356
|
this.elementId = elementId;
|
|
3329
3357
|
this.canvas = document.createElement('canvas');
|
|
3330
3358
|
window.addEventListener('resize', function () {
|
|
3331
|
-
return
|
|
3359
|
+
return _this21.render();
|
|
3332
3360
|
});
|
|
3333
3361
|
var el = document.getElementById(this.elementId);
|
|
3334
3362
|
|
|
@@ -3547,7 +3575,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3547
3575
|
|
|
3548
3576
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3549
3577
|
function WebsyResultList(elementId, options) {
|
|
3550
|
-
var
|
|
3578
|
+
var _this22 = this;
|
|
3551
3579
|
|
|
3552
3580
|
_classCallCheck(this, WebsyResultList);
|
|
3553
3581
|
|
|
@@ -3579,9 +3607,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3579
3607
|
|
|
3580
3608
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3581
3609
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3582
|
-
|
|
3610
|
+
_this22.options.template = templateString;
|
|
3583
3611
|
|
|
3584
|
-
|
|
3612
|
+
_this22.render();
|
|
3585
3613
|
});
|
|
3586
3614
|
} else {
|
|
3587
3615
|
this.render();
|
|
@@ -3601,7 +3629,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3601
3629
|
}, {
|
|
3602
3630
|
key: "buildHTML",
|
|
3603
3631
|
value: function buildHTML(d) {
|
|
3604
|
-
var
|
|
3632
|
+
var _this23 = this;
|
|
3605
3633
|
|
|
3606
3634
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3607
3635
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3611,7 +3639,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3611
3639
|
if (this.options.template) {
|
|
3612
3640
|
if (d.length > 0) {
|
|
3613
3641
|
d.forEach(function (row, ix) {
|
|
3614
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3642
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3615
3643
|
|
|
3616
3644
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3617
3645
|
|
|
@@ -3716,7 +3744,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3716
3744
|
parts.forEach(function (p) {
|
|
3717
3745
|
items = items[p];
|
|
3718
3746
|
});
|
|
3719
|
-
template = template.replace(m[0],
|
|
3747
|
+
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3720
3748
|
}
|
|
3721
3749
|
});
|
|
3722
3750
|
|
|
@@ -3728,7 +3756,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3728
3756
|
}
|
|
3729
3757
|
});
|
|
3730
3758
|
|
|
3731
|
-
var flatRow =
|
|
3759
|
+
var flatRow = _this23.flattenObject(row);
|
|
3732
3760
|
|
|
3733
3761
|
for (var key in flatRow) {
|
|
3734
3762
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -3863,13 +3891,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3863
3891
|
}, {
|
|
3864
3892
|
key: "render",
|
|
3865
3893
|
value: function render() {
|
|
3866
|
-
var
|
|
3894
|
+
var _this24 = this;
|
|
3867
3895
|
|
|
3868
3896
|
if (this.options.entity) {
|
|
3869
3897
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3870
|
-
|
|
3898
|
+
_this24.rows = results.rows;
|
|
3871
3899
|
|
|
3872
|
-
|
|
3900
|
+
_this24.resize();
|
|
3873
3901
|
});
|
|
3874
3902
|
} else {
|
|
3875
3903
|
this.resize();
|
|
@@ -3955,14 +3983,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3955
3983
|
_createClass(WebsyRouter, [{
|
|
3956
3984
|
key: "addGroup",
|
|
3957
3985
|
value: function addGroup(group) {
|
|
3958
|
-
var
|
|
3986
|
+
var _this25 = this;
|
|
3959
3987
|
|
|
3960
3988
|
if (!this.groups[group]) {
|
|
3961
3989
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3962
3990
|
|
|
3963
3991
|
if (els) {
|
|
3964
3992
|
this.getClosestParent(els[0], function (parent) {
|
|
3965
|
-
|
|
3993
|
+
_this25.groups[group] = {
|
|
3966
3994
|
activeView: '',
|
|
3967
3995
|
views: [],
|
|
3968
3996
|
parent: parent.getAttribute('data-view')
|
|
@@ -4025,7 +4053,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4025
4053
|
}, {
|
|
4026
4054
|
key: "removeUrlParams",
|
|
4027
4055
|
value: function removeUrlParams() {
|
|
4028
|
-
var
|
|
4056
|
+
var _this26 = this;
|
|
4029
4057
|
|
|
4030
4058
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4031
4059
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -4039,7 +4067,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4039
4067
|
|
|
4040
4068
|
if (this.currentParams && this.currentParams.items) {
|
|
4041
4069
|
params.forEach(function (p) {
|
|
4042
|
-
delete
|
|
4070
|
+
delete _this26.currentParams.items[p];
|
|
4043
4071
|
});
|
|
4044
4072
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4045
4073
|
}
|
|
@@ -4403,12 +4431,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4403
4431
|
}, {
|
|
4404
4432
|
key: "showComponents",
|
|
4405
4433
|
value: function showComponents(view) {
|
|
4406
|
-
var
|
|
4434
|
+
var _this27 = this;
|
|
4407
4435
|
|
|
4408
4436
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4409
4437
|
this.options.views[view].components.forEach(function (c) {
|
|
4410
4438
|
if (typeof c.instance === 'undefined') {
|
|
4411
|
-
|
|
4439
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
4412
4440
|
|
|
4413
4441
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4414
4442
|
} else if (c.instance.render) {
|
|
@@ -4785,7 +4813,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4785
4813
|
|
|
4786
4814
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4787
4815
|
function WebsyTemplate(elementId, options) {
|
|
4788
|
-
var
|
|
4816
|
+
var _this28 = this;
|
|
4789
4817
|
|
|
4790
4818
|
_classCallCheck(this, WebsyTemplate);
|
|
4791
4819
|
|
|
@@ -4811,9 +4839,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4811
4839
|
|
|
4812
4840
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4813
4841
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4814
|
-
|
|
4842
|
+
_this28.options.template = templateString;
|
|
4815
4843
|
|
|
4816
|
-
|
|
4844
|
+
_this28.render();
|
|
4817
4845
|
});
|
|
4818
4846
|
} else {
|
|
4819
4847
|
this.render();
|
|
@@ -4823,7 +4851,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4823
4851
|
_createClass(WebsyTemplate, [{
|
|
4824
4852
|
key: "buildHTML",
|
|
4825
4853
|
value: function buildHTML() {
|
|
4826
|
-
var
|
|
4854
|
+
var _this29 = this;
|
|
4827
4855
|
|
|
4828
4856
|
var html = "";
|
|
4829
4857
|
|
|
@@ -4885,14 +4913,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4885
4913
|
}
|
|
4886
4914
|
|
|
4887
4915
|
if (polarity === true) {
|
|
4888
|
-
if (typeof
|
|
4916
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4889
4917
|
// remove the <if> tags
|
|
4890
4918
|
removeAll = false;
|
|
4891
4919
|
} else if (parts[0] === parts[1]) {
|
|
4892
4920
|
removeAll = false;
|
|
4893
4921
|
}
|
|
4894
4922
|
} else if (polarity === false) {
|
|
4895
|
-
if (typeof
|
|
4923
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4896
4924
|
// remove the <if> tags
|
|
4897
4925
|
removeAll = false;
|
|
4898
4926
|
}
|
|
@@ -5182,7 +5210,7 @@ var WebsyUtils = {
|
|
|
5182
5210
|
|
|
5183
5211
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5184
5212
|
function WebsyTable(elementId, options) {
|
|
5185
|
-
var
|
|
5213
|
+
var _this30 = this;
|
|
5186
5214
|
|
|
5187
5215
|
_classCallCheck(this, WebsyTable);
|
|
5188
5216
|
|
|
@@ -5220,8 +5248,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5220
5248
|
allowClear: false,
|
|
5221
5249
|
disableSearch: true,
|
|
5222
5250
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5223
|
-
if (
|
|
5224
|
-
|
|
5251
|
+
if (_this30.options.onChangePageSize) {
|
|
5252
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5225
5253
|
}
|
|
5226
5254
|
}
|
|
5227
5255
|
});
|
|
@@ -5242,7 +5270,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5242
5270
|
_createClass(WebsyTable, [{
|
|
5243
5271
|
key: "appendRows",
|
|
5244
5272
|
value: function appendRows(data) {
|
|
5245
|
-
var
|
|
5273
|
+
var _this31 = this;
|
|
5246
5274
|
|
|
5247
5275
|
this.hideError();
|
|
5248
5276
|
var bodyHTML = '';
|
|
@@ -5250,15 +5278,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5250
5278
|
if (data) {
|
|
5251
5279
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5252
5280
|
return '<tr>' + r.map(function (c, i) {
|
|
5253
|
-
if (
|
|
5281
|
+
if (_this31.options.columns[i].show !== false) {
|
|
5254
5282
|
var style = '';
|
|
5255
5283
|
|
|
5256
5284
|
if (c.style) {
|
|
5257
5285
|
style += c.style;
|
|
5258
5286
|
}
|
|
5259
5287
|
|
|
5260
|
-
if (
|
|
5261
|
-
style += "width: ".concat(
|
|
5288
|
+
if (_this31.options.columns[i].width) {
|
|
5289
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5262
5290
|
}
|
|
5263
5291
|
|
|
5264
5292
|
if (c.backgroundColor) {
|
|
@@ -5273,18 +5301,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5273
5301
|
style += "color: ".concat(c.color, "; ");
|
|
5274
5302
|
}
|
|
5275
5303
|
|
|
5276
|
-
if (
|
|
5277
|
-
return "\n <td \n data-row-index='".concat(
|
|
5278
|
-
} else if ((
|
|
5279
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5304
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5305
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5306
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5307
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5280
5308
|
} else {
|
|
5281
5309
|
var info = c.value;
|
|
5282
5310
|
|
|
5283
|
-
if (
|
|
5311
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5284
5312
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5285
5313
|
}
|
|
5286
5314
|
|
|
5287
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5315
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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 ");
|
|
5288
5316
|
}
|
|
5289
5317
|
}
|
|
5290
5318
|
}).join('') + '</tr>';
|
|
@@ -5456,7 +5484,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5456
5484
|
}, {
|
|
5457
5485
|
key: "render",
|
|
5458
5486
|
value: function render(data) {
|
|
5459
|
-
var
|
|
5487
|
+
var _this32 = this;
|
|
5460
5488
|
|
|
5461
5489
|
if (!this.options.columns) {
|
|
5462
5490
|
return;
|
|
@@ -5491,7 +5519,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5491
5519
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5492
5520
|
}
|
|
5493
5521
|
|
|
5494
|
-
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 ?
|
|
5522
|
+
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 ? _this32.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5495
5523
|
}
|
|
5496
5524
|
}).join('') + '</tr>';
|
|
5497
5525
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5510,7 +5538,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5510
5538
|
|
|
5511
5539
|
if (pagingEl) {
|
|
5512
5540
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5513
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5541
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5514
5542
|
});
|
|
5515
5543
|
var startIndex = 0;
|
|
5516
5544
|
|
|
@@ -5578,7 +5606,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5578
5606
|
|
|
5579
5607
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5580
5608
|
function WebsyTable2(elementId, options) {
|
|
5581
|
-
var
|
|
5609
|
+
var _this33 = this;
|
|
5582
5610
|
|
|
5583
5611
|
_classCallCheck(this, WebsyTable2);
|
|
5584
5612
|
|
|
@@ -5619,8 +5647,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5619
5647
|
allowClear: false,
|
|
5620
5648
|
disableSearch: true,
|
|
5621
5649
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5622
|
-
if (
|
|
5623
|
-
|
|
5650
|
+
if (_this33.options.onChangePageSize) {
|
|
5651
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5624
5652
|
}
|
|
5625
5653
|
}
|
|
5626
5654
|
});
|
|
@@ -5644,7 +5672,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5644
5672
|
_createClass(WebsyTable2, [{
|
|
5645
5673
|
key: "appendRows",
|
|
5646
5674
|
value: function appendRows(data) {
|
|
5647
|
-
var
|
|
5675
|
+
var _this34 = this;
|
|
5648
5676
|
|
|
5649
5677
|
this.hideError();
|
|
5650
5678
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5653,15 +5681,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5653
5681
|
if (data) {
|
|
5654
5682
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5655
5683
|
return '<tr>' + r.map(function (c, i) {
|
|
5656
|
-
if (
|
|
5657
|
-
var style = "height: ".concat(
|
|
5684
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5685
|
+
var style = "height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px;");
|
|
5658
5686
|
|
|
5659
5687
|
if (c.style) {
|
|
5660
5688
|
style += c.style;
|
|
5661
5689
|
}
|
|
5662
5690
|
|
|
5663
|
-
if (
|
|
5664
|
-
style += "width: ".concat(
|
|
5691
|
+
if (_this34.options.columns[i].width) {
|
|
5692
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5665
5693
|
}
|
|
5666
5694
|
|
|
5667
5695
|
if (c.backgroundColor) {
|
|
@@ -5676,18 +5704,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5676
5704
|
style += "color: ".concat(c.color, "; ");
|
|
5677
5705
|
}
|
|
5678
5706
|
|
|
5679
|
-
if (
|
|
5680
|
-
return "\n <td \n data-row-index='".concat(
|
|
5681
|
-
} else if ((
|
|
5682
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5707
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5708
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5709
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5710
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5683
5711
|
} else {
|
|
5684
5712
|
var info = c.value;
|
|
5685
5713
|
|
|
5686
|
-
if (
|
|
5714
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5687
5715
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5688
5716
|
}
|
|
5689
5717
|
|
|
5690
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5718
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
5691
5719
|
}
|
|
5692
5720
|
}
|
|
5693
5721
|
}).join('') + '</tr>';
|
|
@@ -5950,7 +5978,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5950
5978
|
}, {
|
|
5951
5979
|
key: "render",
|
|
5952
5980
|
value: function render(data) {
|
|
5953
|
-
var
|
|
5981
|
+
var _this35 = this;
|
|
5954
5982
|
|
|
5955
5983
|
if (!this.options.columns) {
|
|
5956
5984
|
return;
|
|
@@ -5986,7 +6014,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5986
6014
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5987
6015
|
}
|
|
5988
6016
|
|
|
5989
|
-
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 ?
|
|
6017
|
+
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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5990
6018
|
}
|
|
5991
6019
|
}).join('') + '</tr>';
|
|
5992
6020
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5997,7 +6025,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5997
6025
|
var dropdownHTML = "";
|
|
5998
6026
|
this.options.columns.forEach(function (c, i) {
|
|
5999
6027
|
if (c.searchable && c.searchField) {
|
|
6000
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6028
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6001
6029
|
}
|
|
6002
6030
|
});
|
|
6003
6031
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6019,7 +6047,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6019
6047
|
|
|
6020
6048
|
if (pagingEl) {
|
|
6021
6049
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6022
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6050
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6023
6051
|
});
|
|
6024
6052
|
var startIndex = 0;
|
|
6025
6053
|
|
|
@@ -6110,7 +6138,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6110
6138
|
}, {
|
|
6111
6139
|
key: "getColumnParameters",
|
|
6112
6140
|
value: function getColumnParameters(values) {
|
|
6113
|
-
var
|
|
6141
|
+
var _this36 = this;
|
|
6114
6142
|
|
|
6115
6143
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6116
6144
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6118,10 +6146,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6118
6146
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6119
6147
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6120
6148
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6121
|
-
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 ?
|
|
6149
|
+
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 ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6122
6150
|
}).join('') + '</tr>';
|
|
6123
6151
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6124
|
-
return "\n <td \n style='height: ".concat(
|
|
6152
|
+
return "\n <td \n style='height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6125
6153
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6126
6154
|
|
|
6127
6155
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6249,7 +6277,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6249
6277
|
}, {
|
|
6250
6278
|
key: "buildBodyHtml",
|
|
6251
6279
|
value: function buildBodyHtml() {
|
|
6252
|
-
var
|
|
6280
|
+
var _this37 = this;
|
|
6253
6281
|
|
|
6254
6282
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6255
6283
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -6308,7 +6336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6308
6336
|
} // console.log('rowspan', cell.rowspan)
|
|
6309
6337
|
|
|
6310
6338
|
|
|
6311
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6339
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this37.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.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-col-index='").concat(cellIndex, "'\n "); // if (useWidths === true) {
|
|
6312
6340
|
// bodyHtml += `
|
|
6313
6341
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6314
6342
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6318,11 +6346,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6318
6346
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6319
6347
|
|
|
6320
6348
|
if (cell.expandable === true) {
|
|
6321
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6349
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this37.options.plusIcon, "</i>");
|
|
6322
6350
|
}
|
|
6323
6351
|
|
|
6324
6352
|
if (cell.collapsable === true) {
|
|
6325
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6353
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this37.options.minusIcon, "</i>");
|
|
6326
6354
|
}
|
|
6327
6355
|
|
|
6328
6356
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6347,7 +6375,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6347
6375
|
}, {
|
|
6348
6376
|
key: "buildHeaderHtml",
|
|
6349
6377
|
value: function buildHeaderHtml() {
|
|
6350
|
-
var
|
|
6378
|
+
var _this38 = this;
|
|
6351
6379
|
|
|
6352
6380
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6353
6381
|
var headerHtml = '';
|
|
@@ -6362,7 +6390,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6362
6390
|
}
|
|
6363
6391
|
|
|
6364
6392
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6365
|
-
if (useWidths === false && rowIndex !==
|
|
6393
|
+
if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
|
|
6366
6394
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6367
6395
|
return;
|
|
6368
6396
|
}
|
|
@@ -6388,18 +6416,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6388
6416
|
// `
|
|
6389
6417
|
// }
|
|
6390
6418
|
|
|
6391
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6419
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6392
6420
|
});
|
|
6393
6421
|
headerHtml += "</tr>";
|
|
6394
6422
|
});
|
|
6395
6423
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6396
6424
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6397
6425
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6398
|
-
var testEl = document.getElementById("".concat(
|
|
6426
|
+
var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6399
6427
|
|
|
6400
6428
|
if (!testEl) {
|
|
6401
6429
|
var newE = document.createElement('div');
|
|
6402
|
-
newE.id = "".concat(
|
|
6430
|
+
newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6403
6431
|
newE.className = 'websy-modal-dropdown';
|
|
6404
6432
|
dropdownEl.appendChild(newE);
|
|
6405
6433
|
}
|
|
@@ -6415,7 +6443,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6415
6443
|
}, {
|
|
6416
6444
|
key: "buildTotalHtml",
|
|
6417
6445
|
value: function buildTotalHtml() {
|
|
6418
|
-
var
|
|
6446
|
+
var _this39 = this;
|
|
6419
6447
|
|
|
6420
6448
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6421
6449
|
|
|
@@ -6428,7 +6456,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6428
6456
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6429
6457
|
|
|
6430
6458
|
if (useWidths === true) {
|
|
6431
|
-
totalHtml += "\n style='width: ".concat(
|
|
6459
|
+
totalHtml += "\n style='width: ".concat(_this39.options.columns[_this39.options.columns.length - 1][colIndex].width || _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6432
6460
|
}
|
|
6433
6461
|
|
|
6434
6462
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6439,7 +6467,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6439
6467
|
}, {
|
|
6440
6468
|
key: "calculateSizes",
|
|
6441
6469
|
value: function calculateSizes() {
|
|
6442
|
-
var
|
|
6470
|
+
var _this40 = this;
|
|
6443
6471
|
|
|
6444
6472
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6445
6473
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6482,32 +6510,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6482
6510
|
rows.forEach(function (row, rowIndex) {
|
|
6483
6511
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6484
6512
|
var colSize = col.getBoundingClientRect();
|
|
6485
|
-
|
|
6513
|
+
_this40.sizes.cellHeight = colSize.height;
|
|
6486
6514
|
|
|
6487
|
-
if (
|
|
6488
|
-
if (!
|
|
6489
|
-
|
|
6515
|
+
if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
|
|
6516
|
+
if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
|
|
6517
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6490
6518
|
}
|
|
6491
6519
|
|
|
6492
|
-
|
|
6493
|
-
|
|
6520
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6521
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6494
6522
|
|
|
6495
|
-
if (colIndex >=
|
|
6496
|
-
firstNonPinnedColumnWidth =
|
|
6523
|
+
if (colIndex >= _this40.pinnedColumns) {
|
|
6524
|
+
firstNonPinnedColumnWidth = _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth;
|
|
6497
6525
|
}
|
|
6498
6526
|
}
|
|
6499
6527
|
});
|
|
6500
6528
|
});
|
|
6501
6529
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6502
|
-
if (colIndex <
|
|
6503
|
-
|
|
6530
|
+
if (colIndex < _this40.pinnedColumns) {
|
|
6531
|
+
_this40.sizes.scrollableWidth -= col.actualWidth;
|
|
6504
6532
|
}
|
|
6505
6533
|
});
|
|
6506
6534
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6507
6535
|
return a + (b.width || b.actualWidth);
|
|
6508
6536
|
}, 0);
|
|
6509
6537
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6510
|
-
return i >=
|
|
6538
|
+
return i >= _this40.pinnedColumns;
|
|
6511
6539
|
}).reduce(function (a, b) {
|
|
6512
6540
|
return a + (b.width || b.actualWidth);
|
|
6513
6541
|
}, 0);
|
|
@@ -6528,10 +6556,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6528
6556
|
c.actualWidth += equalWidth; // }
|
|
6529
6557
|
// }
|
|
6530
6558
|
|
|
6531
|
-
|
|
6559
|
+
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6532
6560
|
|
|
6533
|
-
if (i <
|
|
6534
|
-
|
|
6561
|
+
if (i < _this40.pinnedColumns) {
|
|
6562
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6535
6563
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6536
6564
|
|
|
6537
6565
|
});
|
|
@@ -6588,7 +6616,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6588
6616
|
}, {
|
|
6589
6617
|
key: "createSample",
|
|
6590
6618
|
value: function createSample(data) {
|
|
6591
|
-
var
|
|
6619
|
+
var _this41 = this;
|
|
6592
6620
|
|
|
6593
6621
|
var output = [];
|
|
6594
6622
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6600,7 +6628,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6600
6628
|
var longest = '';
|
|
6601
6629
|
|
|
6602
6630
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6603
|
-
if (data[i].length ===
|
|
6631
|
+
if (data[i].length === _this41.options.columns[_this41.options.columns.length - 1].length) {
|
|
6604
6632
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6605
6633
|
longest = data[i][colIndex].value;
|
|
6606
6634
|
}
|
|
@@ -6995,7 +7023,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6995
7023
|
|
|
6996
7024
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6997
7025
|
function WebsyChart(elementId, options) {
|
|
6998
|
-
var
|
|
7026
|
+
var _this42 = this;
|
|
6999
7027
|
|
|
7000
7028
|
_classCallCheck(this, WebsyChart);
|
|
7001
7029
|
|
|
@@ -7046,22 +7074,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7046
7074
|
this.invertOverride = function (input, input2) {
|
|
7047
7075
|
var xAxis = 'bottomAxis';
|
|
7048
7076
|
|
|
7049
|
-
if (
|
|
7077
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7050
7078
|
xAxis = 'leftAxis';
|
|
7051
7079
|
}
|
|
7052
7080
|
|
|
7053
|
-
var width =
|
|
7081
|
+
var width = _this42[xAxis].step();
|
|
7054
7082
|
|
|
7055
7083
|
var output;
|
|
7056
7084
|
|
|
7057
|
-
var domain = _toConsumableArray(
|
|
7085
|
+
var domain = _toConsumableArray(_this42[xAxis].domain());
|
|
7058
7086
|
|
|
7059
|
-
if (
|
|
7087
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7060
7088
|
domain = domain.reverse();
|
|
7061
7089
|
}
|
|
7062
7090
|
|
|
7063
7091
|
for (var j = 0; j < domain.length; j++) {
|
|
7064
|
-
var breakA =
|
|
7092
|
+
var breakA = _this42[xAxis](domain[j]) - width / 2;
|
|
7065
7093
|
var breakB = breakA + width;
|
|
7066
7094
|
|
|
7067
7095
|
if (input > breakA && input <= breakB) {
|
|
@@ -7161,10 +7189,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7161
7189
|
}, {
|
|
7162
7190
|
key: "handleEventMouseMove",
|
|
7163
7191
|
value: function handleEventMouseMove(event, d) {
|
|
7164
|
-
var
|
|
7192
|
+
var _this43 = this;
|
|
7165
7193
|
|
|
7166
7194
|
var bisectDate = d3.bisector(function (d) {
|
|
7167
|
-
return
|
|
7195
|
+
return _this43.parseX(d.x.value);
|
|
7168
7196
|
}).left;
|
|
7169
7197
|
|
|
7170
7198
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7203,8 +7231,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7203
7231
|
}
|
|
7204
7232
|
|
|
7205
7233
|
this.options.data.series.forEach(function (s) {
|
|
7206
|
-
if (
|
|
7207
|
-
xPoint =
|
|
7234
|
+
if (_this43.options.data[xData].scale !== 'Time') {
|
|
7235
|
+
xPoint = _this43[xAxis](_this43.parseX(xLabel));
|
|
7208
7236
|
s.data.forEach(function (d) {
|
|
7209
7237
|
if (d.x.value === xLabel) {
|
|
7210
7238
|
if (!tooltipTitle) {
|
|
@@ -7223,13 +7251,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7223
7251
|
var pointA = s.data[index - 1];
|
|
7224
7252
|
var pointB = s.data[index];
|
|
7225
7253
|
|
|
7226
|
-
if (
|
|
7254
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7227
7255
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7228
7256
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7229
7257
|
}
|
|
7230
7258
|
|
|
7231
7259
|
if (pointA && !pointB) {
|
|
7232
|
-
xPoint =
|
|
7260
|
+
xPoint = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7233
7261
|
tooltipTitle = pointA.x.value;
|
|
7234
7262
|
|
|
7235
7263
|
if (!pointA.y.color) {
|
|
@@ -7239,12 +7267,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7239
7267
|
tooltipData.push(pointA.y);
|
|
7240
7268
|
|
|
7241
7269
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7242
|
-
tooltipTitle = d3.timeFormat(
|
|
7270
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7243
7271
|
}
|
|
7244
7272
|
}
|
|
7245
7273
|
|
|
7246
7274
|
if (pointB && !pointA) {
|
|
7247
|
-
xPoint =
|
|
7275
|
+
xPoint = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7248
7276
|
tooltipTitle = pointB.x.value;
|
|
7249
7277
|
|
|
7250
7278
|
if (!pointB.y.color) {
|
|
@@ -7254,14 +7282,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7254
7282
|
tooltipData.push(pointB.y);
|
|
7255
7283
|
|
|
7256
7284
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7257
|
-
tooltipTitle = d3.timeFormat(
|
|
7285
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7258
7286
|
}
|
|
7259
7287
|
}
|
|
7260
7288
|
|
|
7261
7289
|
if (pointA && pointB) {
|
|
7262
|
-
var d0 =
|
|
7290
|
+
var d0 = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7263
7291
|
|
|
7264
|
-
var d1 =
|
|
7292
|
+
var d1 = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7265
7293
|
|
|
7266
7294
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7267
7295
|
|
|
@@ -7270,7 +7298,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7270
7298
|
tooltipTitle = pointB.x.value;
|
|
7271
7299
|
|
|
7272
7300
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7273
|
-
tooltipTitle = d3.timeFormat(
|
|
7301
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7274
7302
|
}
|
|
7275
7303
|
|
|
7276
7304
|
if (!pointB.y.color) {
|
|
@@ -7283,7 +7311,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7283
7311
|
tooltipTitle = pointA.x.value;
|
|
7284
7312
|
|
|
7285
7313
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7286
|
-
tooltipTitle = d3.timeFormat(
|
|
7314
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7287
7315
|
}
|
|
7288
7316
|
|
|
7289
7317
|
if (!pointA.y.color) {
|
|
@@ -7397,7 +7425,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7397
7425
|
}, {
|
|
7398
7426
|
key: "render",
|
|
7399
7427
|
value: function render(options) {
|
|
7400
|
-
var
|
|
7428
|
+
var _this44 = this;
|
|
7401
7429
|
|
|
7402
7430
|
/* global d3 options WebsyUtils */
|
|
7403
7431
|
if (typeof options !== 'undefined') {
|
|
@@ -7466,7 +7494,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7466
7494
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7467
7495
|
return {
|
|
7468
7496
|
value: s.label || s.key,
|
|
7469
|
-
color: s.color ||
|
|
7497
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7470
7498
|
};
|
|
7471
7499
|
});
|
|
7472
7500
|
|
|
@@ -7748,7 +7776,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7748
7776
|
|
|
7749
7777
|
if (this.options.data.bottom.formatter) {
|
|
7750
7778
|
bAxisFunc.tickFormat(function (d) {
|
|
7751
|
-
return
|
|
7779
|
+
return _this44.options.data.bottom.formatter(d);
|
|
7752
7780
|
});
|
|
7753
7781
|
}
|
|
7754
7782
|
|
|
@@ -7774,8 +7802,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7774
7802
|
|
|
7775
7803
|
if (this.options.margin.axisLeft > 0) {
|
|
7776
7804
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7777
|
-
if (
|
|
7778
|
-
d =
|
|
7805
|
+
if (_this44.options.data.left.formatter) {
|
|
7806
|
+
d = _this44.options.data.left.formatter(d);
|
|
7779
7807
|
}
|
|
7780
7808
|
|
|
7781
7809
|
return d;
|
|
@@ -7812,8 +7840,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7812
7840
|
|
|
7813
7841
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7814
7842
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7815
|
-
if (
|
|
7816
|
-
d =
|
|
7843
|
+
if (_this44.options.data.right.formatter) {
|
|
7844
|
+
d = _this44.options.data.right.formatter(d);
|
|
7817
7845
|
}
|
|
7818
7846
|
|
|
7819
7847
|
return d;
|
|
@@ -7852,18 +7880,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7852
7880
|
this.renderedKeys = {};
|
|
7853
7881
|
this.options.data.series.forEach(function (series, index) {
|
|
7854
7882
|
if (!series.key) {
|
|
7855
|
-
series.key =
|
|
7883
|
+
series.key = _this44.createIdentity();
|
|
7856
7884
|
}
|
|
7857
7885
|
|
|
7858
7886
|
if (!series.color) {
|
|
7859
|
-
series.color =
|
|
7887
|
+
series.color = _this44.options.colors[index % _this44.options.colors.length];
|
|
7860
7888
|
}
|
|
7861
7889
|
|
|
7862
|
-
|
|
7890
|
+
_this44["render".concat(series.type || 'bar')](series, index);
|
|
7863
7891
|
|
|
7864
|
-
|
|
7892
|
+
_this44.renderLabels(series, index);
|
|
7865
7893
|
|
|
7866
|
-
|
|
7894
|
+
_this44.renderedKeys[series.key] = series.type;
|
|
7867
7895
|
});
|
|
7868
7896
|
}
|
|
7869
7897
|
}
|
|
@@ -7871,17 +7899,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7871
7899
|
}, {
|
|
7872
7900
|
key: "renderarea",
|
|
7873
7901
|
value: function renderarea(series, index) {
|
|
7874
|
-
var
|
|
7902
|
+
var _this45 = this;
|
|
7875
7903
|
|
|
7876
7904
|
/* global d3 series index */
|
|
7877
7905
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7878
7906
|
return d3.area().x(function (d) {
|
|
7879
|
-
return
|
|
7907
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
7880
7908
|
}).y0(function (d) {
|
|
7881
|
-
return
|
|
7909
|
+
return _this45[yAxis](0);
|
|
7882
7910
|
}).y1(function (d) {
|
|
7883
|
-
return
|
|
7884
|
-
}).curve(d3[curveStyle ||
|
|
7911
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7912
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7885
7913
|
};
|
|
7886
7914
|
|
|
7887
7915
|
var xAxis = 'bottomAxis';
|
|
@@ -8010,7 +8038,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8010
8038
|
}, {
|
|
8011
8039
|
key: "renderLabels",
|
|
8012
8040
|
value: function renderLabels(series, index) {
|
|
8013
|
-
var
|
|
8041
|
+
var _this46 = this;
|
|
8014
8042
|
|
|
8015
8043
|
/* global series index d3 WebsyDesigns */
|
|
8016
8044
|
var xAxis = 'bottomAxis';
|
|
@@ -8029,11 +8057,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8029
8057
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8030
8058
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8031
8059
|
labels.attr('x', function (d) {
|
|
8032
|
-
return getLabelX.call(
|
|
8060
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8033
8061
|
}).attr('y', function (d) {
|
|
8034
|
-
return getLabelY.call(
|
|
8062
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8035
8063
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8036
|
-
return
|
|
8064
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8037
8065
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8038
8066
|
return d.y.label || d.y.value;
|
|
8039
8067
|
}).each(function (d, i) {
|
|
@@ -8058,11 +8086,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8058
8086
|
}
|
|
8059
8087
|
});
|
|
8060
8088
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8061
|
-
return getLabelX.call(
|
|
8089
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8062
8090
|
}).attr('y', function (d) {
|
|
8063
|
-
return getLabelY.call(
|
|
8091
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8064
8092
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8065
|
-
return
|
|
8093
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8066
8094
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8067
8095
|
return d.y.label || d.y.value;
|
|
8068
8096
|
}).each(function (d, i) {
|
|
@@ -8119,16 +8147,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8119
8147
|
}, {
|
|
8120
8148
|
key: "renderline",
|
|
8121
8149
|
value: function renderline(series, index) {
|
|
8122
|
-
var
|
|
8150
|
+
var _this47 = this;
|
|
8123
8151
|
|
|
8124
8152
|
/* global series index d3 */
|
|
8125
8153
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8126
8154
|
return d3.line().x(function (d) {
|
|
8127
|
-
var adjustment =
|
|
8128
|
-
return
|
|
8155
|
+
var adjustment = _this47.options.data[xAxis].scale === 'Time' ? 0 : _this47["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8156
|
+
return _this47["".concat(xAxis, "Axis")](_this47.parseX(d.x.value)) + adjustment;
|
|
8129
8157
|
}).y(function (d) {
|
|
8130
|
-
return
|
|
8131
|
-
}).curve(d3[curveStyle ||
|
|
8158
|
+
return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8159
|
+
}).curve(d3[curveStyle || _this47.options.curveStyle]);
|
|
8132
8160
|
};
|
|
8133
8161
|
|
|
8134
8162
|
var xAxis = 'bottom';
|
|
@@ -8172,14 +8200,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8172
8200
|
}, {
|
|
8173
8201
|
key: "rendersymbol",
|
|
8174
8202
|
value: function rendersymbol(series, index) {
|
|
8175
|
-
var
|
|
8203
|
+
var _this48 = this;
|
|
8176
8204
|
|
|
8177
8205
|
/* global d3 series index series.key */
|
|
8178
8206
|
var drawSymbol = function drawSymbol(size) {
|
|
8179
8207
|
return d3.symbol() // .type(d => {
|
|
8180
8208
|
// return d3.symbols[0]
|
|
8181
8209
|
// })
|
|
8182
|
-
.size(size ||
|
|
8210
|
+
.size(size || _this48.options.symbolSize);
|
|
8183
8211
|
};
|
|
8184
8212
|
|
|
8185
8213
|
var xAxis = 'bottomAxis';
|
|
@@ -8197,7 +8225,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8197
8225
|
symbols.attr('d', function (d) {
|
|
8198
8226
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8199
8227
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8200
|
-
return "translate(".concat(
|
|
8228
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8201
8229
|
}); // Enter
|
|
8202
8230
|
|
|
8203
8231
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8206,7 +8234,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8206
8234
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8207
8235
|
return "symbol symbol_".concat(series.key);
|
|
8208
8236
|
}).attr('transform', function (d) {
|
|
8209
|
-
return "translate(".concat(
|
|
8237
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8210
8238
|
});
|
|
8211
8239
|
}
|
|
8212
8240
|
}, {
|
|
@@ -8361,7 +8389,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8361
8389
|
}, {
|
|
8362
8390
|
key: "resize",
|
|
8363
8391
|
value: function resize() {
|
|
8364
|
-
var
|
|
8392
|
+
var _this49 = this;
|
|
8365
8393
|
|
|
8366
8394
|
var el = document.getElementById(this.elementId);
|
|
8367
8395
|
|
|
@@ -8374,7 +8402,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8374
8402
|
// }
|
|
8375
8403
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8376
8404
|
html += this._data.map(function (d, i) {
|
|
8377
|
-
return
|
|
8405
|
+
return _this49.getLegendItemHTML(d);
|
|
8378
8406
|
}).join('');
|
|
8379
8407
|
html += "\n <div>\n ";
|
|
8380
8408
|
el.innerHTML = html;
|
|
@@ -8546,7 +8574,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8546
8574
|
}, {
|
|
8547
8575
|
key: "render",
|
|
8548
8576
|
value: function render() {
|
|
8549
|
-
var
|
|
8577
|
+
var _this50 = this;
|
|
8550
8578
|
|
|
8551
8579
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8552
8580
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8555,7 +8583,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8555
8583
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8556
8584
|
return {
|
|
8557
8585
|
value: s.label || s.key,
|
|
8558
|
-
color: s.color ||
|
|
8586
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8559
8587
|
};
|
|
8560
8588
|
});
|
|
8561
8589
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8619,7 +8647,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8619
8647
|
|
|
8620
8648
|
if (this.polygons) {
|
|
8621
8649
|
this.polygons.forEach(function (p) {
|
|
8622
|
-
return
|
|
8650
|
+
return _this50.map.removeLayer(p);
|
|
8623
8651
|
});
|
|
8624
8652
|
}
|
|
8625
8653
|
|
|
@@ -8677,18 +8705,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8677
8705
|
}
|
|
8678
8706
|
|
|
8679
8707
|
if (!p.options.color) {
|
|
8680
|
-
p.options.color =
|
|
8708
|
+
p.options.color = _this50.options.colors[i % _this50.options.colors.length];
|
|
8681
8709
|
}
|
|
8682
8710
|
|
|
8683
8711
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8684
8712
|
return c.map(function (d) {
|
|
8685
8713
|
return [d.Latitude, d.Longitude];
|
|
8686
8714
|
});
|
|
8687
|
-
}), p.options).addTo(
|
|
8715
|
+
}), p.options).addTo(_this50.map);
|
|
8688
8716
|
|
|
8689
|
-
|
|
8717
|
+
_this50.polygons.push(pol);
|
|
8690
8718
|
|
|
8691
|
-
|
|
8719
|
+
_this50.map.fitBounds(pol.getBounds());
|
|
8692
8720
|
});
|
|
8693
8721
|
} // if (this.data.markers.length > 0) {
|
|
8694
8722
|
// el.classList.remove('hidden')
|