@websy/websy-designs 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/authHelper.js +3 -2
- package/dist/server/helpers/v1/pgHelper.js +1 -0
- package/dist/websy-designs-es6.debug.js +278 -98
- package/dist/websy-designs-es6.js +600 -369
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +280 -100
- package/dist/websy-designs.js +606 -375
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2035,29 +2035,6 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
2035
2035
|
|
|
2036
2036
|
this.updateHeader(item);
|
|
2037
2037
|
}
|
|
2038
|
-
}, {
|
|
2039
|
-
key: "setValue",
|
|
2040
|
-
value: function setValue(value) {
|
|
2041
|
-
var _this11 = this;
|
|
2042
|
-
|
|
2043
|
-
this.selectedItems = [];
|
|
2044
|
-
|
|
2045
|
-
if (Array.isArray(value)) {
|
|
2046
|
-
this.options.items.forEach(function (d) {
|
|
2047
|
-
if (value.indexOf(d.value) !== -1) {
|
|
2048
|
-
_this11.selectedItems.push(d.index);
|
|
2049
|
-
}
|
|
2050
|
-
});
|
|
2051
|
-
} else {
|
|
2052
|
-
this.options.items.forEach(function (d) {
|
|
2053
|
-
if (d.value === value) {
|
|
2054
|
-
_this11.selectedItems.push(d.index);
|
|
2055
|
-
}
|
|
2056
|
-
});
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
this.render();
|
|
2060
|
-
}
|
|
2061
2038
|
}, {
|
|
2062
2039
|
key: "updateHeader",
|
|
2063
2040
|
value: function updateHeader(item) {
|
|
@@ -2170,6 +2147,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
2170
2147
|
this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
|
|
2171
2148
|
}
|
|
2172
2149
|
|
|
2150
|
+
if (this.options.onChange) {
|
|
2151
|
+
this.options.onChange(this);
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2173
2154
|
if (this.options.closeAfterSelection === true) {
|
|
2174
2155
|
this.close();
|
|
2175
2156
|
}
|
|
@@ -2215,6 +2196,40 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
2215
2196
|
get: function get() {
|
|
2216
2197
|
return this.options.items;
|
|
2217
2198
|
}
|
|
2199
|
+
}, {
|
|
2200
|
+
key: "value",
|
|
2201
|
+
get: function get() {
|
|
2202
|
+
var _this11 = this;
|
|
2203
|
+
|
|
2204
|
+
if (this.selectedItems && this.selectedItems.length > 0) {
|
|
2205
|
+
return this.selectedItems.map(function (d, i) {
|
|
2206
|
+
return _this11.options.items[+d];
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
return [];
|
|
2211
|
+
},
|
|
2212
|
+
set: function set(value) {
|
|
2213
|
+
var _this12 = this;
|
|
2214
|
+
|
|
2215
|
+
this.selectedItems = [];
|
|
2216
|
+
|
|
2217
|
+
if (Array.isArray(value)) {
|
|
2218
|
+
this.options.items.forEach(function (d) {
|
|
2219
|
+
if (value.indexOf(d.value) !== -1) {
|
|
2220
|
+
_this12.selectedItems.push(d.index);
|
|
2221
|
+
}
|
|
2222
|
+
});
|
|
2223
|
+
} else {
|
|
2224
|
+
this.options.items.forEach(function (d) {
|
|
2225
|
+
if (d.value === value) {
|
|
2226
|
+
_this12.selectedItems.push(d.index);
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
this.render();
|
|
2232
|
+
}
|
|
2218
2233
|
}]);
|
|
2219
2234
|
|
|
2220
2235
|
return WebsyDropdown;
|
|
@@ -2259,7 +2274,9 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2259
2274
|
// if (this.options.classes) {
|
|
2260
2275
|
// this.options.classes.forEach(c => el.classList.add(c))
|
|
2261
2276
|
// }
|
|
2277
|
+
el.addEventListener('change', this.handleChange.bind(this));
|
|
2262
2278
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
2279
|
+
el.addEventListener('focusout', this.handleFocusOut.bind(this));
|
|
2263
2280
|
el.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
2264
2281
|
el.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
2265
2282
|
this.render();
|
|
@@ -2279,19 +2296,19 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2279
2296
|
}, {
|
|
2280
2297
|
key: "checkRecaptcha",
|
|
2281
2298
|
value: function checkRecaptcha() {
|
|
2282
|
-
var
|
|
2299
|
+
var _this13 = this;
|
|
2283
2300
|
|
|
2284
2301
|
return new Promise(function (resolve, reject) {
|
|
2285
|
-
if (
|
|
2286
|
-
if (
|
|
2302
|
+
if (_this13.options.useRecaptcha === true) {
|
|
2303
|
+
if (_this13.recaptchaValue) {
|
|
2287
2304
|
// grecaptcha.ready(() => {
|
|
2288
2305
|
// grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
|
|
2289
|
-
|
|
2290
|
-
grecaptcharesponse:
|
|
2306
|
+
_this13.apiService.add('google/checkrecaptcha', {
|
|
2307
|
+
grecaptcharesponse: _this13.recaptchaValue
|
|
2291
2308
|
}).then(function (response) {
|
|
2292
2309
|
if (response.success && response.success === true) {
|
|
2293
2310
|
resolve(true);
|
|
2294
|
-
grecaptcha.reset("".concat(
|
|
2311
|
+
grecaptcha.reset("".concat(_this13.elementId, "_recaptcha"), {
|
|
2295
2312
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2296
2313
|
});
|
|
2297
2314
|
} else {
|
|
@@ -2328,6 +2345,24 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2328
2345
|
el.innerHTML = msg;
|
|
2329
2346
|
}
|
|
2330
2347
|
}
|
|
2348
|
+
}, {
|
|
2349
|
+
key: "handleChange",
|
|
2350
|
+
value: function handleChange(event) {
|
|
2351
|
+
if (event.target.getAttribute('data-user-type') === 'expiry') {
|
|
2352
|
+
if (event.target.value.length === 7) {
|
|
2353
|
+
var value = event.target.value.split('/');
|
|
2354
|
+
event.target.value = "".concat(value[0], "/").concat(value[1].substring(2, 4));
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
if (event.target.classList.contains('websy-input')) {
|
|
2359
|
+
var index = event.target.getAttribute('data-index');
|
|
2360
|
+
|
|
2361
|
+
if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
|
|
2362
|
+
this.validateField(this.options.fields[index], event.target.value);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2331
2366
|
}, {
|
|
2332
2367
|
key: "handleClick",
|
|
2333
2368
|
value: function handleClick(event) {
|
|
@@ -2339,27 +2374,104 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2339
2374
|
this.cancelForm();
|
|
2340
2375
|
}
|
|
2341
2376
|
}
|
|
2377
|
+
}, {
|
|
2378
|
+
key: "handleFocusOut",
|
|
2379
|
+
value: function handleFocusOut(event) {
|
|
2380
|
+
if (event.target.classList.contains('websy-input')) {
|
|
2381
|
+
var index = event.target.getAttribute('data-index');
|
|
2382
|
+
|
|
2383
|
+
if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
|
|
2384
|
+
this.validateField(this.options.fields[index], event.target.value);
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2342
2388
|
}, {
|
|
2343
2389
|
key: "handleKeyDown",
|
|
2344
2390
|
value: function handleKeyDown(event) {
|
|
2345
2391
|
if (event.key === 'enter') {
|
|
2346
2392
|
this.submitForm();
|
|
2347
2393
|
}
|
|
2394
|
+
|
|
2395
|
+
if (event.target.getAttribute('data-user-type') === 'expiry') {
|
|
2396
|
+
var isNumeric = !isNaN(event.key);
|
|
2397
|
+
var validKey = false;
|
|
2398
|
+
|
|
2399
|
+
if (!validKey) {
|
|
2400
|
+
validKey = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].indexOf(event.key) !== -1;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
if (event.target.value.length === 5 && !validKey || !validKey && !isNumeric) {
|
|
2404
|
+
event.preventDefault();
|
|
2405
|
+
return false;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
if (event.key === 'Backspace') {
|
|
2409
|
+
if (event.target.value.indexOf('/') === event.target.selectionStart - 1) {
|
|
2410
|
+
var chars = event.target.value.split('');
|
|
2411
|
+
chars.pop();
|
|
2412
|
+
event.target.value = chars.join('');
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
if (event.target.getAttribute('data-user-type') === 'cvv') {
|
|
2418
|
+
var _isNumeric = !isNaN(event.key);
|
|
2419
|
+
|
|
2420
|
+
var _validKey = false;
|
|
2421
|
+
|
|
2422
|
+
if (!_validKey) {
|
|
2423
|
+
_validKey = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].indexOf(event.key) !== -1;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
if (event.target.value.length === 3 && !_validKey || !_validKey && !_isNumeric) {
|
|
2427
|
+
event.preventDefault();
|
|
2428
|
+
return false;
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2348
2431
|
}
|
|
2349
2432
|
}, {
|
|
2350
2433
|
key: "handleKeyUp",
|
|
2351
|
-
value: function handleKeyUp(event) {
|
|
2434
|
+
value: function handleKeyUp(event) {
|
|
2435
|
+
if (event.target.getAttribute('data-user-type') === 'expiry') {
|
|
2436
|
+
var chars = event.target.value.split('');
|
|
2437
|
+
var isNumeric = !isNaN(event.key);
|
|
2438
|
+
|
|
2439
|
+
if (event.key === 'Backspace') {
|
|
2440
|
+
if (chars[chars.length - 1] === '/' && chars.length !== 3) {
|
|
2441
|
+
chars.pop();
|
|
2442
|
+
event.target.value = chars.join('');
|
|
2443
|
+
return;
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
if (event.target.selectionStart === 2) {
|
|
2448
|
+
if (chars[2] && ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'].indexOf(event.key) === -1) {
|
|
2449
|
+
event.target.setSelectionRange(3, 3);
|
|
2450
|
+
} else if (isNumeric) {
|
|
2451
|
+
event.target.value += '/';
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2352
2456
|
}, {
|
|
2353
2457
|
key: "processComponents",
|
|
2354
2458
|
value: function processComponents(components, callbackFn) {
|
|
2355
|
-
var
|
|
2459
|
+
var _this14 = this;
|
|
2356
2460
|
|
|
2357
2461
|
if (components.length === 0) {
|
|
2358
2462
|
callbackFn();
|
|
2359
2463
|
} else {
|
|
2360
2464
|
components.forEach(function (c) {
|
|
2361
2465
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2362
|
-
|
|
2466
|
+
if (!c.options.onChange) {
|
|
2467
|
+
c.options.onChange = function () {
|
|
2468
|
+
if (c.required || c.validate) {
|
|
2469
|
+
_this14.validateField(c, c.instance.value);
|
|
2470
|
+
}
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2363
2475
|
} else {// some user feedback here
|
|
2364
2476
|
}
|
|
2365
2477
|
});
|
|
@@ -2368,15 +2480,15 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2368
2480
|
}, {
|
|
2369
2481
|
key: "recaptchaReady",
|
|
2370
2482
|
value: function recaptchaReady() {
|
|
2371
|
-
var
|
|
2483
|
+
var _this15 = this;
|
|
2372
2484
|
|
|
2373
2485
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2374
2486
|
|
|
2375
2487
|
if (el) {
|
|
2376
2488
|
grecaptcha.ready(function () {
|
|
2377
|
-
grecaptcha.render("".concat(
|
|
2489
|
+
grecaptcha.render("".concat(_this15.elementId, "_recaptcha"), {
|
|
2378
2490
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2379
|
-
callback:
|
|
2491
|
+
callback: _this15.validateRecaptcha.bind(_this15)
|
|
2380
2492
|
});
|
|
2381
2493
|
});
|
|
2382
2494
|
}
|
|
@@ -2384,7 +2496,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2384
2496
|
}, {
|
|
2385
2497
|
key: "render",
|
|
2386
2498
|
value: function render(update, data) {
|
|
2387
|
-
var
|
|
2499
|
+
var _this16 = this;
|
|
2388
2500
|
|
|
2389
2501
|
var el = document.getElementById(this.elementId);
|
|
2390
2502
|
var componentsToProcess = [];
|
|
@@ -2392,15 +2504,15 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2392
2504
|
if (el) {
|
|
2393
2505
|
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
|
|
2394
2506
|
this.options.fields.forEach(function (f, i) {
|
|
2395
|
-
|
|
2507
|
+
_this16.fieldMap[f.field] = f;
|
|
2396
2508
|
|
|
2397
2509
|
if (f.component) {
|
|
2398
2510
|
componentsToProcess.push(f);
|
|
2399
|
-
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(
|
|
2511
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this16.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this16.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2400
2512
|
} else if (f.type === 'longtext') {
|
|
2401
|
-
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(
|
|
2513
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this16.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n <span id='").concat(_this16.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2402
2514
|
} else {
|
|
2403
|
-
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(
|
|
2515
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this16.elementId, "_").concat(f.field, "_inputContainer' class='websy-input-container ").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input\" \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 <span id='").concat(_this16.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2404
2516
|
}
|
|
2405
2517
|
});
|
|
2406
2518
|
|
|
@@ -2417,8 +2529,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2417
2529
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2418
2530
|
el.innerHTML = html;
|
|
2419
2531
|
this.processComponents(componentsToProcess, function () {
|
|
2420
|
-
if (
|
|
2421
|
-
|
|
2532
|
+
if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2533
|
+
_this16.recaptchaReady();
|
|
2422
2534
|
}
|
|
2423
2535
|
});
|
|
2424
2536
|
}
|
|
@@ -2428,7 +2540,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2428
2540
|
value: function setValue(field, value) {
|
|
2429
2541
|
if (this.fieldMap[field]) {
|
|
2430
2542
|
if (this.fieldMap[field].instance) {
|
|
2431
|
-
this.fieldMap[field].instance.
|
|
2543
|
+
this.fieldMap[field].instance.value = value;
|
|
2432
2544
|
} else {
|
|
2433
2545
|
var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
|
|
2434
2546
|
|
|
@@ -2445,13 +2557,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2445
2557
|
}, {
|
|
2446
2558
|
key: "submitForm",
|
|
2447
2559
|
value: function submitForm() {
|
|
2448
|
-
var
|
|
2560
|
+
var _this17 = this;
|
|
2449
2561
|
|
|
2450
2562
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2451
2563
|
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2452
2564
|
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
2453
2565
|
|
|
2454
|
-
if (
|
|
2566
|
+
if (this.options.preSubmitFn && this.options.preSubmitFn() === false) {
|
|
2567
|
+
return;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
if (this.validateForm() === true) {
|
|
2455
2571
|
if (buttonEl) {
|
|
2456
2572
|
buttonEl.setAttribute('disabled', true);
|
|
2457
2573
|
}
|
|
@@ -2473,34 +2589,34 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2473
2589
|
data[key] = value;
|
|
2474
2590
|
});
|
|
2475
2591
|
|
|
2476
|
-
if (
|
|
2477
|
-
var
|
|
2592
|
+
if (_this17.options.url) {
|
|
2593
|
+
var _this17$apiService;
|
|
2478
2594
|
|
|
2479
|
-
var params = [
|
|
2595
|
+
var params = [_this17.options.url];
|
|
2480
2596
|
|
|
2481
|
-
if (
|
|
2482
|
-
params.push(
|
|
2597
|
+
if (_this17.options.mode === 'update') {
|
|
2598
|
+
params.push(_this17.options.id);
|
|
2483
2599
|
}
|
|
2484
2600
|
|
|
2485
2601
|
params.push(data);
|
|
2486
2602
|
|
|
2487
|
-
(
|
|
2488
|
-
if (
|
|
2603
|
+
(_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
|
|
2604
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2489
2605
|
// this.render()
|
|
2490
2606
|
formEl.reset();
|
|
2491
2607
|
}
|
|
2492
2608
|
|
|
2493
2609
|
buttonEl.removeAttribute('disabled');
|
|
2494
2610
|
|
|
2495
|
-
|
|
2611
|
+
_this17.options.onSuccess.call(_this17, result);
|
|
2496
2612
|
}, function (err) {
|
|
2497
2613
|
console.log('Error submitting form data:', err);
|
|
2498
2614
|
|
|
2499
|
-
|
|
2615
|
+
_this17.options.onError.call(_this17, err);
|
|
2500
2616
|
});
|
|
2501
|
-
} else if (
|
|
2502
|
-
|
|
2503
|
-
if (
|
|
2617
|
+
} else if (_this17.options.submitFn) {
|
|
2618
|
+
_this17.options.submitFn(data, function () {
|
|
2619
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2504
2620
|
// this.render()
|
|
2505
2621
|
formEl.reset();
|
|
2506
2622
|
}
|
|
@@ -2518,6 +2634,76 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2518
2634
|
});
|
|
2519
2635
|
}
|
|
2520
2636
|
}
|
|
2637
|
+
}, {
|
|
2638
|
+
key: "validateForm",
|
|
2639
|
+
value: function validateForm() {
|
|
2640
|
+
var valid = true;
|
|
2641
|
+
var data = this.data;
|
|
2642
|
+
|
|
2643
|
+
for (var i = 0; i < this.options.fields.length; i++) {
|
|
2644
|
+
if (this.options.fields[i].required || this.options.fields[i].validate) {
|
|
2645
|
+
if (this.validateField(this.options.fields[i], data[this.options.fields[i].field]) === false) {
|
|
2646
|
+
valid = false;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
return valid;
|
|
2652
|
+
}
|
|
2653
|
+
}, {
|
|
2654
|
+
key: "validateField",
|
|
2655
|
+
value: function validateField(field, value) {
|
|
2656
|
+
var inputContainerEl = document.getElementById("".concat(this.elementId, "_").concat(field.field, "_inputContainer"));
|
|
2657
|
+
var errorEl = document.getElementById("".concat(this.elementId, "_").concat(field.field, "_error"));
|
|
2658
|
+
|
|
2659
|
+
if (field.required) {
|
|
2660
|
+
var valid = true;
|
|
2661
|
+
|
|
2662
|
+
if (field.component && field.instance && field.instance.value) {
|
|
2663
|
+
valid = field.instance.value.length > 0;
|
|
2664
|
+
} else {
|
|
2665
|
+
valid = !(typeof value === 'undefined' || value === '');
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
if (!valid) {
|
|
2669
|
+
if (errorEl) {
|
|
2670
|
+
errorEl.innerHTML = field.invalidMessage || 'A value is required';
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
if (inputContainerEl) {
|
|
2674
|
+
inputContainerEl.classList.add('websy-form-input-has-error');
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
return false;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
if (field.validate) {
|
|
2682
|
+
var _valid = field.validate(field, value);
|
|
2683
|
+
|
|
2684
|
+
if (!_valid) {
|
|
2685
|
+
if (errorEl) {
|
|
2686
|
+
errorEl.innerHTML = field.invalidMessage || 'A value is required';
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
if (inputContainerEl) {
|
|
2690
|
+
inputContainerEl.classList.add('websy-form-input-has-error');
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
return false;
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
if (errorEl) {
|
|
2698
|
+
errorEl.innerHTML = '';
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
if (inputContainerEl) {
|
|
2702
|
+
inputContainerEl.classList.remove('websy-form-input-has-error');
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
return true;
|
|
2706
|
+
}
|
|
2521
2707
|
}, {
|
|
2522
2708
|
key: "validateRecaptcha",
|
|
2523
2709
|
value: function validateRecaptcha(token) {
|
|
@@ -2535,27 +2721,29 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2535
2721
|
return data;
|
|
2536
2722
|
},
|
|
2537
2723
|
set: function set(d) {
|
|
2538
|
-
var
|
|
2724
|
+
var _this18 = this;
|
|
2539
2725
|
|
|
2540
2726
|
if (!this.options.fields) {
|
|
2541
2727
|
this.options.fields = [];
|
|
2542
2728
|
}
|
|
2543
2729
|
|
|
2544
2730
|
var _loop = function _loop(key) {
|
|
2545
|
-
|
|
2731
|
+
_this18.options.fields.forEach(function (f) {
|
|
2546
2732
|
if (f.field === key) {
|
|
2547
|
-
f.value = d[key]
|
|
2548
|
-
|
|
2549
|
-
el
|
|
2733
|
+
_this18.setValue(key, d[key]); // f.value = d[key]
|
|
2734
|
+
// const el = document.getElementById(`${this.elementId}_input_${f.field}`)
|
|
2735
|
+
// if (el) {
|
|
2736
|
+
// el.value = f.value
|
|
2737
|
+
// }
|
|
2738
|
+
|
|
2550
2739
|
}
|
|
2551
2740
|
});
|
|
2552
2741
|
};
|
|
2553
2742
|
|
|
2554
2743
|
for (var key in d) {
|
|
2555
2744
|
_loop(key);
|
|
2556
|
-
}
|
|
2745
|
+
} // this.render()
|
|
2557
2746
|
|
|
2558
|
-
this.render();
|
|
2559
2747
|
}
|
|
2560
2748
|
}]);
|
|
2561
2749
|
|
|
@@ -2614,17 +2802,20 @@ var WebsyLoadingDialog = /*#__PURE__*/function () {
|
|
|
2614
2802
|
}
|
|
2615
2803
|
|
|
2616
2804
|
var el = document.getElementById(this.elementId);
|
|
2617
|
-
var html = "\n\t\t\t<div class='websy-loading-container ".concat((this.options.classes || []).join(' '), "'>\n\t\t\t\t<div class='websy-ripple'>\n\t\t\t\t\t<div></div>\n\t\t\t\t\t<div></div>\n\t\t\t\t</div>\n\t\t\t\t<h4>").concat(this.options.title || 'Loading...', "</h4>\n\t\t");
|
|
2618
2805
|
|
|
2619
|
-
if (
|
|
2620
|
-
|
|
2621
|
-
|
|
2806
|
+
if (el) {
|
|
2807
|
+
var html = "\n <div class='websy-loading-container ".concat((this.options.classes || []).join(' '), "'>\n <div class='websy-ripple'>\n <div></div>\n <div></div>\n </div>\n <h4>").concat(this.options.title || 'Loading...', "</h4>\n ");
|
|
2808
|
+
|
|
2809
|
+
if (this.options.messages) {
|
|
2810
|
+
for (var i = 0; i < this.options.messages.length; i++) {
|
|
2811
|
+
html += "<p>".concat(this.options.messages[i], "</p>");
|
|
2812
|
+
}
|
|
2622
2813
|
}
|
|
2623
|
-
}
|
|
2624
2814
|
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2815
|
+
html += "\n </div>\t\n ";
|
|
2816
|
+
el.classList.add('loading');
|
|
2817
|
+
el.innerHTML = html;
|
|
2818
|
+
}
|
|
2628
2819
|
}
|
|
2629
2820
|
}, {
|
|
2630
2821
|
key: "show",
|
|
@@ -2798,7 +2989,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2798
2989
|
}, {
|
|
2799
2990
|
key: "handleSearch",
|
|
2800
2991
|
value: function handleSearch(searchText) {
|
|
2801
|
-
var
|
|
2992
|
+
var _this19 = this;
|
|
2802
2993
|
|
|
2803
2994
|
var el = document.getElementById(this.elementId); // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
2804
2995
|
|
|
@@ -2811,7 +3002,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2811
3002
|
if (searchText && searchText.length > 1) {
|
|
2812
3003
|
defaultMethod = 'add';
|
|
2813
3004
|
visibleItems = lowestItems.filter(function (d) {
|
|
2814
|
-
return d[
|
|
3005
|
+
return d[_this19.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2815
3006
|
});
|
|
2816
3007
|
} // hide everything
|
|
2817
3008
|
|
|
@@ -3039,7 +3230,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3039
3230
|
|
|
3040
3231
|
var Pager = /*#__PURE__*/function () {
|
|
3041
3232
|
function Pager(elementId, options) {
|
|
3042
|
-
var
|
|
3233
|
+
var _this20 = this;
|
|
3043
3234
|
|
|
3044
3235
|
_classCallCheck(this, Pager);
|
|
3045
3236
|
|
|
@@ -3092,8 +3283,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3092
3283
|
allowClear: false,
|
|
3093
3284
|
disableSearch: true,
|
|
3094
3285
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3095
|
-
if (
|
|
3096
|
-
|
|
3286
|
+
if (_this20.options.onChangePageSize) {
|
|
3287
|
+
_this20.options.onChangePageSize(selectedItem.value);
|
|
3097
3288
|
}
|
|
3098
3289
|
}
|
|
3099
3290
|
});
|
|
@@ -3117,13 +3308,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3117
3308
|
}, {
|
|
3118
3309
|
key: "render",
|
|
3119
3310
|
value: function render() {
|
|
3120
|
-
var
|
|
3311
|
+
var _this21 = this;
|
|
3121
3312
|
|
|
3122
3313
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3123
3314
|
|
|
3124
3315
|
if (el) {
|
|
3125
3316
|
var pages = this.options.pages.map(function (item, index) {
|
|
3126
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3317
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this21.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3127
3318
|
});
|
|
3128
3319
|
var startIndex = 0;
|
|
3129
3320
|
|
|
@@ -3191,58 +3382,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3191
3382
|
_createClass(WebsyPDFButton, [{
|
|
3192
3383
|
key: "handleClick",
|
|
3193
3384
|
value: function handleClick(event) {
|
|
3194
|
-
var
|
|
3385
|
+
var _this22 = this;
|
|
3195
3386
|
|
|
3196
3387
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3197
3388
|
this.loader.show();
|
|
3198
3389
|
setTimeout(function () {
|
|
3199
|
-
if (
|
|
3200
|
-
var el = document.getElementById(
|
|
3390
|
+
if (_this22.options.targetId) {
|
|
3391
|
+
var el = document.getElementById(_this22.options.targetId);
|
|
3201
3392
|
|
|
3202
3393
|
if (el) {
|
|
3203
3394
|
var pdfData = {
|
|
3204
3395
|
options: {}
|
|
3205
3396
|
};
|
|
3206
3397
|
|
|
3207
|
-
if (
|
|
3208
|
-
pdfData.options = _extends({},
|
|
3398
|
+
if (_this22.options.pdfOptions) {
|
|
3399
|
+
pdfData.options = _extends({}, _this22.options.pdfOptions);
|
|
3209
3400
|
}
|
|
3210
3401
|
|
|
3211
|
-
if (
|
|
3212
|
-
if (
|
|
3213
|
-
var headerEl = document.getElementById(
|
|
3402
|
+
if (_this22.options.header) {
|
|
3403
|
+
if (_this22.options.header.elementId) {
|
|
3404
|
+
var headerEl = document.getElementById(_this22.options.header.elementId);
|
|
3214
3405
|
|
|
3215
3406
|
if (headerEl) {
|
|
3216
3407
|
pdfData.header = headerEl.outerHTML;
|
|
3217
3408
|
|
|
3218
|
-
if (
|
|
3219
|
-
pdfData.options.headerCSS =
|
|
3409
|
+
if (_this22.options.header.css) {
|
|
3410
|
+
pdfData.options.headerCSS = _this22.options.header.css;
|
|
3220
3411
|
}
|
|
3221
3412
|
}
|
|
3222
|
-
} else if (
|
|
3223
|
-
pdfData.header =
|
|
3413
|
+
} else if (_this22.options.header.html) {
|
|
3414
|
+
pdfData.header = _this22.options.header.html;
|
|
3224
3415
|
|
|
3225
|
-
if (
|
|
3226
|
-
pdfData.options.headerCSS =
|
|
3416
|
+
if (_this22.options.header.css) {
|
|
3417
|
+
pdfData.options.headerCSS = _this22.options.header.css;
|
|
3227
3418
|
}
|
|
3228
3419
|
} else {
|
|
3229
|
-
pdfData.header =
|
|
3420
|
+
pdfData.header = _this22.options.header;
|
|
3230
3421
|
}
|
|
3231
3422
|
}
|
|
3232
3423
|
|
|
3233
|
-
if (
|
|
3234
|
-
if (
|
|
3235
|
-
var footerEl = document.getElementById(
|
|
3424
|
+
if (_this22.options.footer) {
|
|
3425
|
+
if (_this22.options.footer.elementId) {
|
|
3426
|
+
var footerEl = document.getElementById(_this22.options.footer.elementId);
|
|
3236
3427
|
|
|
3237
3428
|
if (footerEl) {
|
|
3238
3429
|
pdfData.footer = footerEl.outerHTML;
|
|
3239
3430
|
|
|
3240
|
-
if (
|
|
3241
|
-
pdfData.options.footerCSS =
|
|
3431
|
+
if (_this22.options.footer.css) {
|
|
3432
|
+
pdfData.options.footerCSS = _this22.options.footer.css;
|
|
3242
3433
|
}
|
|
3243
3434
|
}
|
|
3244
3435
|
} else {
|
|
3245
|
-
pdfData.footer =
|
|
3436
|
+
pdfData.footer = _this22.options.footer;
|
|
3246
3437
|
}
|
|
3247
3438
|
}
|
|
3248
3439
|
|
|
@@ -3251,31 +3442,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3251
3442
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3252
3443
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3253
3444
|
|
|
3254
|
-
|
|
3445
|
+
_this22.service.add('', pdfData, {
|
|
3255
3446
|
responseType: 'blob'
|
|
3256
3447
|
}).then(function (response) {
|
|
3257
|
-
|
|
3448
|
+
_this22.loader.hide();
|
|
3258
3449
|
|
|
3259
3450
|
var blob = new Blob([response], {
|
|
3260
3451
|
type: 'application/pdf'
|
|
3261
3452
|
});
|
|
3262
3453
|
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 ");
|
|
3263
3454
|
|
|
3264
|
-
if (
|
|
3455
|
+
if (_this22.options.directDownload === true) {
|
|
3265
3456
|
var fileName;
|
|
3266
3457
|
|
|
3267
|
-
if (typeof
|
|
3268
|
-
fileName =
|
|
3458
|
+
if (typeof _this22.options.fileName === 'function') {
|
|
3459
|
+
fileName = _this22.options.fileName() || 'Export';
|
|
3269
3460
|
} else {
|
|
3270
|
-
fileName =
|
|
3461
|
+
fileName = _this22.options.fileName || 'Export';
|
|
3271
3462
|
}
|
|
3272
3463
|
|
|
3273
3464
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3274
3465
|
}
|
|
3275
3466
|
|
|
3276
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3467
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this22.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3277
3468
|
|
|
3278
|
-
|
|
3469
|
+
_this22.popup.show({
|
|
3279
3470
|
message: msg,
|
|
3280
3471
|
mask: true
|
|
3281
3472
|
});
|
|
@@ -3476,7 +3667,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3476
3667
|
|
|
3477
3668
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3478
3669
|
function ResponsiveText(elementId, options) {
|
|
3479
|
-
var
|
|
3670
|
+
var _this23 = this;
|
|
3480
3671
|
|
|
3481
3672
|
_classCallCheck(this, ResponsiveText);
|
|
3482
3673
|
|
|
@@ -3489,7 +3680,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3489
3680
|
this.elementId = elementId;
|
|
3490
3681
|
this.canvas = document.createElement('canvas');
|
|
3491
3682
|
window.addEventListener('resize', function () {
|
|
3492
|
-
return
|
|
3683
|
+
return _this23.render();
|
|
3493
3684
|
});
|
|
3494
3685
|
var el = document.getElementById(this.elementId);
|
|
3495
3686
|
|
|
@@ -3708,7 +3899,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3708
3899
|
|
|
3709
3900
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3710
3901
|
function WebsyResultList(elementId, options) {
|
|
3711
|
-
var
|
|
3902
|
+
var _this24 = this;
|
|
3712
3903
|
|
|
3713
3904
|
_classCallCheck(this, WebsyResultList);
|
|
3714
3905
|
|
|
@@ -3740,9 +3931,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3740
3931
|
|
|
3741
3932
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3742
3933
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3743
|
-
|
|
3934
|
+
_this24.options.template = templateString;
|
|
3744
3935
|
|
|
3745
|
-
|
|
3936
|
+
_this24.render();
|
|
3746
3937
|
});
|
|
3747
3938
|
} else {
|
|
3748
3939
|
this.render();
|
|
@@ -3762,7 +3953,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3762
3953
|
}, {
|
|
3763
3954
|
key: "buildHTML",
|
|
3764
3955
|
value: function buildHTML(d) {
|
|
3765
|
-
var
|
|
3956
|
+
var _this25 = this;
|
|
3766
3957
|
|
|
3767
3958
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3768
3959
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3772,7 +3963,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3772
3963
|
if (this.options.template) {
|
|
3773
3964
|
if (d.length > 0) {
|
|
3774
3965
|
d.forEach(function (row, ix) {
|
|
3775
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3966
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this25.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3776
3967
|
|
|
3777
3968
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3778
3969
|
|
|
@@ -3877,7 +4068,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3877
4068
|
parts.forEach(function (p) {
|
|
3878
4069
|
items = items[p];
|
|
3879
4070
|
});
|
|
3880
|
-
template = template.replace(m[0],
|
|
4071
|
+
template = template.replace(m[0], _this25.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3881
4072
|
}
|
|
3882
4073
|
});
|
|
3883
4074
|
|
|
@@ -3889,7 +4080,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3889
4080
|
}
|
|
3890
4081
|
});
|
|
3891
4082
|
|
|
3892
|
-
var flatRow =
|
|
4083
|
+
var flatRow = _this25.flattenObject(row);
|
|
3893
4084
|
|
|
3894
4085
|
for (var key in flatRow) {
|
|
3895
4086
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -4024,13 +4215,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4024
4215
|
}, {
|
|
4025
4216
|
key: "render",
|
|
4026
4217
|
value: function render() {
|
|
4027
|
-
var
|
|
4218
|
+
var _this26 = this;
|
|
4028
4219
|
|
|
4029
4220
|
if (this.options.entity) {
|
|
4030
4221
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
4031
|
-
|
|
4222
|
+
_this26.rows = results.rows;
|
|
4032
4223
|
|
|
4033
|
-
|
|
4224
|
+
_this26.resize();
|
|
4034
4225
|
});
|
|
4035
4226
|
} else {
|
|
4036
4227
|
this.resize();
|
|
@@ -4116,14 +4307,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4116
4307
|
_createClass(WebsyRouter, [{
|
|
4117
4308
|
key: "addGroup",
|
|
4118
4309
|
value: function addGroup(group) {
|
|
4119
|
-
var
|
|
4310
|
+
var _this27 = this;
|
|
4120
4311
|
|
|
4121
4312
|
if (!this.groups[group]) {
|
|
4122
4313
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4123
4314
|
|
|
4124
4315
|
if (els) {
|
|
4125
4316
|
this.getClosestParent(els[0], function (parent) {
|
|
4126
|
-
|
|
4317
|
+
_this27.groups[group] = {
|
|
4127
4318
|
activeView: '',
|
|
4128
4319
|
views: [],
|
|
4129
4320
|
parent: parent.getAttribute('data-view')
|
|
@@ -4168,6 +4359,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4168
4359
|
path = this.buildUrlPath(output.items);
|
|
4169
4360
|
}
|
|
4170
4361
|
|
|
4362
|
+
output.path = path;
|
|
4171
4363
|
this.currentParams = output;
|
|
4172
4364
|
var inputPath = this.currentView;
|
|
4173
4365
|
|
|
@@ -4181,26 +4373,24 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4181
4373
|
if (reloadView === true) {
|
|
4182
4374
|
// this.showView(this.currentView, this.currentParams, 'main')
|
|
4183
4375
|
this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
|
|
4376
|
+
} else {
|
|
4377
|
+
this.updateHistory(inputPath, !noHistory, true);
|
|
4184
4378
|
}
|
|
4185
4379
|
}
|
|
4186
4380
|
}, {
|
|
4187
4381
|
key: "removeUrlParams",
|
|
4188
4382
|
value: function removeUrlParams() {
|
|
4189
|
-
var
|
|
4383
|
+
var _this28 = this;
|
|
4190
4384
|
|
|
4191
4385
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4192
4386
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4193
4387
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
4194
4388
|
this.previousParams = _extends({}, this.currentParams);
|
|
4195
|
-
var output = {
|
|
4196
|
-
path: '',
|
|
4197
|
-
items: {}
|
|
4198
|
-
};
|
|
4199
4389
|
var path = '';
|
|
4200
4390
|
|
|
4201
4391
|
if (this.currentParams && this.currentParams.items) {
|
|
4202
4392
|
params.forEach(function (p) {
|
|
4203
|
-
delete
|
|
4393
|
+
delete _this28.currentParams.items[p];
|
|
4204
4394
|
});
|
|
4205
4395
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4206
4396
|
}
|
|
@@ -4214,6 +4404,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4214
4404
|
if (reloadView === true) {
|
|
4215
4405
|
// this.showView(this.currentView, this.currentParams, 'main')
|
|
4216
4406
|
this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
|
|
4407
|
+
} else if (noHistory === false) {
|
|
4408
|
+
this.currentParams = {
|
|
4409
|
+
items: this.currentParams.items,
|
|
4410
|
+
path: path
|
|
4411
|
+
};
|
|
4412
|
+
this.updateHistory(inputPath, !noHistory, true);
|
|
4217
4413
|
}
|
|
4218
4414
|
}
|
|
4219
4415
|
}, {
|
|
@@ -4240,9 +4436,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4240
4436
|
if (reloadView === true) {
|
|
4241
4437
|
this.navigate("".concat(inputPath), 'main', null, noHistory);
|
|
4242
4438
|
} else {
|
|
4243
|
-
|
|
4244
|
-
inputPath: inputPath
|
|
4245
|
-
}, 'unused', inputPath);
|
|
4439
|
+
this.updateHistory(inputPath, !noHistory, true);
|
|
4246
4440
|
}
|
|
4247
4441
|
}
|
|
4248
4442
|
}, {
|
|
@@ -4568,12 +4762,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4568
4762
|
}, {
|
|
4569
4763
|
key: "showComponents",
|
|
4570
4764
|
value: function showComponents(view) {
|
|
4571
|
-
var
|
|
4765
|
+
var _this29 = this;
|
|
4572
4766
|
|
|
4573
4767
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4574
4768
|
this.options.views[view].components.forEach(function (c) {
|
|
4575
4769
|
if (typeof c.instance === 'undefined') {
|
|
4576
|
-
|
|
4770
|
+
_this29.prepComponent(c.elementId, c.options);
|
|
4577
4771
|
|
|
4578
4772
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4579
4773
|
} else if (c.instance.render) {
|
|
@@ -4585,6 +4779,10 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4585
4779
|
}, {
|
|
4586
4780
|
key: "showView",
|
|
4587
4781
|
value: function showView(view, params, group) {
|
|
4782
|
+
if (view === '/' || view === '') {
|
|
4783
|
+
view = this.options.defaultView || '';
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4588
4786
|
this.activateItem(view, this.options.triggerClass);
|
|
4589
4787
|
this.activateItem(view, this.options.viewClass);
|
|
4590
4788
|
var children = this.getActiveViewsFromParent(view);
|
|
@@ -4736,29 +4934,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4736
4934
|
|
|
4737
4935
|
if ((this.currentPath !== inputPath || previousParamsPath !== this.currentParams.path) && group === this.options.defaultGroup) {
|
|
4738
4936
|
var historyUrl = inputPath;
|
|
4739
|
-
|
|
4740
|
-
if (this.options.urlPrefix) {
|
|
4741
|
-
historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
|
|
4742
|
-
inputPath = inputPath === '/' ? '' : "/".concat(inputPath);
|
|
4743
|
-
historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
|
|
4744
|
-
inputPath = "/".concat(this.options.urlPrefix).concat(inputPath).replace(/\/\//g, '/');
|
|
4745
|
-
}
|
|
4746
|
-
|
|
4747
|
-
if (this.currentParams && this.currentParams.path) {
|
|
4748
|
-
historyUrl += "?".concat(this.currentParams.path);
|
|
4749
|
-
} else if (this.queryParams && this.options.persistentParameters === true) {
|
|
4750
|
-
historyUrl += "?".concat(this.queryParams);
|
|
4751
|
-
}
|
|
4752
|
-
|
|
4753
|
-
if (popped === false) {
|
|
4754
|
-
history.pushState({
|
|
4755
|
-
inputPath: historyUrl
|
|
4756
|
-
}, 'unused', historyUrl);
|
|
4757
|
-
} else {
|
|
4758
|
-
history.replaceState({
|
|
4759
|
-
inputPath: historyUrl
|
|
4760
|
-
}, 'unused', historyUrl);
|
|
4761
|
-
}
|
|
4937
|
+
this.updateHistory(historyUrl, popped);
|
|
4762
4938
|
}
|
|
4763
4939
|
|
|
4764
4940
|
if (toggle === false) {
|
|
@@ -4800,6 +4976,33 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4800
4976
|
item.apply(null, params);
|
|
4801
4977
|
});
|
|
4802
4978
|
}
|
|
4979
|
+
}, {
|
|
4980
|
+
key: "updateHistory",
|
|
4981
|
+
value: function updateHistory(historyUrl) {
|
|
4982
|
+
var replaceState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4983
|
+
var overridePersistent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4984
|
+
|
|
4985
|
+
if (this.options.urlPrefix) {
|
|
4986
|
+
historyUrl = historyUrl === '/' ? '' : "/".concat(historyUrl);
|
|
4987
|
+
historyUrl = "/".concat(this.options.urlPrefix).concat(historyUrl).replace(/\/\//g, '/');
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4990
|
+
if (this.currentParams && this.currentParams.path || overridePersistent === true) {
|
|
4991
|
+
historyUrl += "?".concat(this.currentParams.path);
|
|
4992
|
+
} else if (this.queryParams && this.options.persistentParameters === true) {
|
|
4993
|
+
historyUrl += "?".concat(this.queryParams);
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4996
|
+
if (replaceState === false) {
|
|
4997
|
+
history.pushState({
|
|
4998
|
+
inputPath: historyUrl
|
|
4999
|
+
}, 'unused', historyUrl);
|
|
5000
|
+
} else {
|
|
5001
|
+
history.replaceState({
|
|
5002
|
+
inputPath: historyUrl
|
|
5003
|
+
}, 'unused', historyUrl);
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
4803
5006
|
}, {
|
|
4804
5007
|
key: "subscribe",
|
|
4805
5008
|
value: function subscribe(event, fn) {
|
|
@@ -4952,7 +5155,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4952
5155
|
|
|
4953
5156
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4954
5157
|
function WebsyTemplate(elementId, options) {
|
|
4955
|
-
var
|
|
5158
|
+
var _this30 = this;
|
|
4956
5159
|
|
|
4957
5160
|
_classCallCheck(this, WebsyTemplate);
|
|
4958
5161
|
|
|
@@ -4978,9 +5181,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4978
5181
|
|
|
4979
5182
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4980
5183
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4981
|
-
|
|
5184
|
+
_this30.options.template = templateString;
|
|
4982
5185
|
|
|
4983
|
-
|
|
5186
|
+
_this30.render();
|
|
4984
5187
|
});
|
|
4985
5188
|
} else {
|
|
4986
5189
|
this.render();
|
|
@@ -4990,7 +5193,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4990
5193
|
_createClass(WebsyTemplate, [{
|
|
4991
5194
|
key: "buildHTML",
|
|
4992
5195
|
value: function buildHTML() {
|
|
4993
|
-
var
|
|
5196
|
+
var _this31 = this;
|
|
4994
5197
|
|
|
4995
5198
|
var html = "";
|
|
4996
5199
|
|
|
@@ -5052,14 +5255,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5052
5255
|
}
|
|
5053
5256
|
|
|
5054
5257
|
if (polarity === true) {
|
|
5055
|
-
if (typeof
|
|
5258
|
+
if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] === parts[1]) {
|
|
5056
5259
|
// remove the <if> tags
|
|
5057
5260
|
removeAll = false;
|
|
5058
5261
|
} else if (parts[0] === parts[1]) {
|
|
5059
5262
|
removeAll = false;
|
|
5060
5263
|
}
|
|
5061
5264
|
} else if (polarity === false) {
|
|
5062
|
-
if (typeof
|
|
5265
|
+
if (typeof _this31.options.data[parts[0]] !== 'undefined' && _this31.options.data[parts[0]] !== parts[1]) {
|
|
5063
5266
|
// remove the <if> tags
|
|
5064
5267
|
removeAll = false;
|
|
5065
5268
|
}
|
|
@@ -5352,7 +5555,7 @@ var WebsyUtils = {
|
|
|
5352
5555
|
|
|
5353
5556
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5354
5557
|
function WebsyTable(elementId, options) {
|
|
5355
|
-
var
|
|
5558
|
+
var _this32 = this;
|
|
5356
5559
|
|
|
5357
5560
|
_classCallCheck(this, WebsyTable);
|
|
5358
5561
|
|
|
@@ -5390,8 +5593,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5390
5593
|
allowClear: false,
|
|
5391
5594
|
disableSearch: true,
|
|
5392
5595
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5393
|
-
if (
|
|
5394
|
-
|
|
5596
|
+
if (_this32.options.onChangePageSize) {
|
|
5597
|
+
_this32.options.onChangePageSize(selectedItem.value);
|
|
5395
5598
|
}
|
|
5396
5599
|
}
|
|
5397
5600
|
});
|
|
@@ -5412,7 +5615,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5412
5615
|
_createClass(WebsyTable, [{
|
|
5413
5616
|
key: "appendRows",
|
|
5414
5617
|
value: function appendRows(data) {
|
|
5415
|
-
var
|
|
5618
|
+
var _this33 = this;
|
|
5416
5619
|
|
|
5417
5620
|
this.hideError();
|
|
5418
5621
|
var bodyHTML = '';
|
|
@@ -5420,15 +5623,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5420
5623
|
if (data) {
|
|
5421
5624
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5422
5625
|
return '<tr>' + r.map(function (c, i) {
|
|
5423
|
-
if (
|
|
5626
|
+
if (_this33.options.columns[i].show !== false) {
|
|
5424
5627
|
var style = '';
|
|
5425
5628
|
|
|
5426
5629
|
if (c.style) {
|
|
5427
5630
|
style += c.style;
|
|
5428
5631
|
}
|
|
5429
5632
|
|
|
5430
|
-
if (
|
|
5431
|
-
style += "width: ".concat(
|
|
5633
|
+
if (_this33.options.columns[i].width) {
|
|
5634
|
+
style += "width: ".concat(_this33.options.columns[i].width, "; ");
|
|
5432
5635
|
}
|
|
5433
5636
|
|
|
5434
5637
|
if (c.backgroundColor) {
|
|
@@ -5443,18 +5646,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5443
5646
|
style += "color: ".concat(c.color, "; ");
|
|
5444
5647
|
}
|
|
5445
5648
|
|
|
5446
|
-
if (
|
|
5447
|
-
return "\n <td \n data-row-index='".concat(
|
|
5448
|
-
} else if ((
|
|
5449
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5649
|
+
if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5650
|
+
return "\n <td \n data-row-index='".concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.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(_this33.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5651
|
+
} else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5652
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this33.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5450
5653
|
} else {
|
|
5451
5654
|
var info = c.value;
|
|
5452
5655
|
|
|
5453
|
-
if (
|
|
5656
|
+
if (_this33.options.columns[i].showAsImage === true) {
|
|
5454
5657
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5455
5658
|
}
|
|
5456
5659
|
|
|
5457
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5660
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.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 ");
|
|
5458
5661
|
}
|
|
5459
5662
|
}
|
|
5460
5663
|
}).join('') + '</tr>';
|
|
@@ -5626,7 +5829,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5626
5829
|
}, {
|
|
5627
5830
|
key: "render",
|
|
5628
5831
|
value: function render(data) {
|
|
5629
|
-
var
|
|
5832
|
+
var _this34 = this;
|
|
5630
5833
|
|
|
5631
5834
|
if (!this.options.columns) {
|
|
5632
5835
|
return;
|
|
@@ -5661,7 +5864,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5661
5864
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5662
5865
|
}
|
|
5663
5866
|
|
|
5664
|
-
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 ?
|
|
5867
|
+
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 ? _this34.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5665
5868
|
}
|
|
5666
5869
|
}).join('') + '</tr>';
|
|
5667
5870
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5680,7 +5883,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5680
5883
|
|
|
5681
5884
|
if (pagingEl) {
|
|
5682
5885
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5683
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5886
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5684
5887
|
});
|
|
5685
5888
|
var startIndex = 0;
|
|
5686
5889
|
|
|
@@ -5748,7 +5951,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5748
5951
|
|
|
5749
5952
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5750
5953
|
function WebsyTable2(elementId, options) {
|
|
5751
|
-
var
|
|
5954
|
+
var _this35 = this;
|
|
5752
5955
|
|
|
5753
5956
|
_classCallCheck(this, WebsyTable2);
|
|
5754
5957
|
|
|
@@ -5789,8 +5992,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5789
5992
|
allowClear: false,
|
|
5790
5993
|
disableSearch: true,
|
|
5791
5994
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5792
|
-
if (
|
|
5793
|
-
|
|
5995
|
+
if (_this35.options.onChangePageSize) {
|
|
5996
|
+
_this35.options.onChangePageSize(selectedItem.value);
|
|
5794
5997
|
}
|
|
5795
5998
|
}
|
|
5796
5999
|
});
|
|
@@ -5814,7 +6017,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5814
6017
|
_createClass(WebsyTable2, [{
|
|
5815
6018
|
key: "appendRows",
|
|
5816
6019
|
value: function appendRows(data) {
|
|
5817
|
-
var
|
|
6020
|
+
var _this36 = this;
|
|
5818
6021
|
|
|
5819
6022
|
this.hideError();
|
|
5820
6023
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5823,15 +6026,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5823
6026
|
if (data) {
|
|
5824
6027
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5825
6028
|
return '<tr>' + r.map(function (c, i) {
|
|
5826
|
-
if (
|
|
5827
|
-
var style = "height: ".concat(
|
|
6029
|
+
if (_this36.options.columns[i].show !== false) {
|
|
6030
|
+
var style = "height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px;");
|
|
5828
6031
|
|
|
5829
6032
|
if (c.style) {
|
|
5830
6033
|
style += c.style;
|
|
5831
6034
|
}
|
|
5832
6035
|
|
|
5833
|
-
if (
|
|
5834
|
-
style += "width: ".concat(
|
|
6036
|
+
if (_this36.options.columns[i].width) {
|
|
6037
|
+
style += "width: ".concat(_this36.options.columns[i].width, "; ");
|
|
5835
6038
|
}
|
|
5836
6039
|
|
|
5837
6040
|
if (c.backgroundColor) {
|
|
@@ -5846,18 +6049,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5846
6049
|
style += "color: ".concat(c.color, "; ");
|
|
5847
6050
|
}
|
|
5848
6051
|
|
|
5849
|
-
if (
|
|
5850
|
-
return "\n <td \n data-row-index='".concat(
|
|
5851
|
-
} else if ((
|
|
5852
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6052
|
+
if (_this36.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6053
|
+
return "\n <td \n data-row-index='".concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.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(_this36.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6054
|
+
} else if ((_this36.options.columns[i].showAsNavigatorLink === true || _this36.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6055
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this36.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this36.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this36.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5853
6056
|
} else {
|
|
5854
6057
|
var info = c.value;
|
|
5855
6058
|
|
|
5856
|
-
if (
|
|
6059
|
+
if (_this36.options.columns[i].showAsImage === true) {
|
|
5857
6060
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5858
6061
|
}
|
|
5859
6062
|
|
|
5860
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6063
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this36.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this36.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 ");
|
|
5861
6064
|
}
|
|
5862
6065
|
}
|
|
5863
6066
|
}).join('') + '</tr>';
|
|
@@ -6120,7 +6323,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6120
6323
|
}, {
|
|
6121
6324
|
key: "render",
|
|
6122
6325
|
value: function render(data) {
|
|
6123
|
-
var
|
|
6326
|
+
var _this37 = this;
|
|
6124
6327
|
|
|
6125
6328
|
if (!this.options.columns) {
|
|
6126
6329
|
return;
|
|
@@ -6156,7 +6359,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6156
6359
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6157
6360
|
}
|
|
6158
6361
|
|
|
6159
|
-
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 ?
|
|
6362
|
+
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 ? _this37.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6160
6363
|
}
|
|
6161
6364
|
}).join('') + '</tr>';
|
|
6162
6365
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6167,7 +6370,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6167
6370
|
var dropdownHTML = "";
|
|
6168
6371
|
this.options.columns.forEach(function (c, i) {
|
|
6169
6372
|
if (c.searchable && c.searchField) {
|
|
6170
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6373
|
+
dropdownHTML += "\n <div id=\"".concat(_this37.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6171
6374
|
}
|
|
6172
6375
|
});
|
|
6173
6376
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6189,7 +6392,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6189
6392
|
|
|
6190
6393
|
if (pagingEl) {
|
|
6191
6394
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6192
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6395
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this37.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6193
6396
|
});
|
|
6194
6397
|
var startIndex = 0;
|
|
6195
6398
|
|
|
@@ -6280,7 +6483,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6280
6483
|
}, {
|
|
6281
6484
|
key: "getColumnParameters",
|
|
6282
6485
|
value: function getColumnParameters(values) {
|
|
6283
|
-
var
|
|
6486
|
+
var _this38 = this;
|
|
6284
6487
|
|
|
6285
6488
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6286
6489
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6288,10 +6491,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6288
6491
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6289
6492
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6290
6493
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6291
|
-
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 ?
|
|
6494
|
+
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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6292
6495
|
}).join('') + '</tr>';
|
|
6293
6496
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6294
|
-
return "\n <td \n style='height: ".concat(
|
|
6497
|
+
return "\n <td \n style='height: ".concat(_this38.options.cellSize, "px; line-height: ").concat(_this38.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6295
6498
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6296
6499
|
|
|
6297
6500
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6422,7 +6625,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6422
6625
|
}, {
|
|
6423
6626
|
key: "buildBodyHtml",
|
|
6424
6627
|
value: function buildBodyHtml() {
|
|
6425
|
-
var
|
|
6628
|
+
var _this39 = this;
|
|
6426
6629
|
|
|
6427
6630
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6428
6631
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -6436,7 +6639,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6436
6639
|
}
|
|
6437
6640
|
|
|
6438
6641
|
var bodyHtml = "";
|
|
6439
|
-
var sizingColumns = this.options.columns[this.options.columns.length - 1]
|
|
6642
|
+
var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
|
|
6643
|
+
return c.show !== false;
|
|
6644
|
+
});
|
|
6440
6645
|
|
|
6441
6646
|
if (useWidths === true) {
|
|
6442
6647
|
bodyHtml += '<colgroup>';
|
|
@@ -6451,7 +6656,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6451
6656
|
row.forEach(function (cell, cellIndex) {
|
|
6452
6657
|
var sizeIndex = cell.level || cellIndex;
|
|
6453
6658
|
|
|
6454
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined') {
|
|
6659
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
|
|
6455
6660
|
return; // need to revisit this logic
|
|
6456
6661
|
}
|
|
6457
6662
|
|
|
@@ -6485,7 +6690,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6485
6690
|
} // console.log('rowspan', cell.rowspan)
|
|
6486
6691
|
|
|
6487
6692
|
|
|
6488
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6693
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
|
|
6489
6694
|
// bodyHtml += `
|
|
6490
6695
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6491
6696
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6495,11 +6700,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6495
6700
|
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n >");
|
|
6496
6701
|
|
|
6497
6702
|
if (cell.expandable === true) {
|
|
6498
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6703
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this39.options.plusIcon, "</i>");
|
|
6499
6704
|
}
|
|
6500
6705
|
|
|
6501
6706
|
if (cell.collapsable === true) {
|
|
6502
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6707
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this39.options.minusIcon, "</i>");
|
|
6503
6708
|
}
|
|
6504
6709
|
|
|
6505
6710
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6524,7 +6729,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6524
6729
|
}, {
|
|
6525
6730
|
key: "buildHeaderHtml",
|
|
6526
6731
|
value: function buildHeaderHtml() {
|
|
6527
|
-
var
|
|
6732
|
+
var _this40 = this;
|
|
6528
6733
|
|
|
6529
6734
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6530
6735
|
|
|
@@ -6533,7 +6738,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6533
6738
|
}
|
|
6534
6739
|
|
|
6535
6740
|
var headerHtml = '';
|
|
6536
|
-
var sizingColumns = this.options.columns[this.options.columns.length - 1]
|
|
6741
|
+
var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
|
|
6742
|
+
return c.show !== false;
|
|
6743
|
+
});
|
|
6537
6744
|
|
|
6538
6745
|
if (useWidths === true) {
|
|
6539
6746
|
headerHtml += '<colgroup>';
|
|
@@ -6544,13 +6751,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6544
6751
|
}
|
|
6545
6752
|
|
|
6546
6753
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6547
|
-
if (useWidths === false && rowIndex !==
|
|
6754
|
+
if (useWidths === false && rowIndex !== _this40.options.columns.length - 1) {
|
|
6548
6755
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6549
6756
|
return;
|
|
6550
6757
|
}
|
|
6551
6758
|
|
|
6552
6759
|
headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
|
|
6553
|
-
row.
|
|
6760
|
+
row.filter(function (c) {
|
|
6761
|
+
return c.show !== false;
|
|
6762
|
+
}).forEach(function (col, colIndex) {
|
|
6763
|
+
if (typeof sizingColumns[colIndex] === 'undefined' || sizingColumns[colIndex].show === false) {
|
|
6764
|
+
return; // need to revisit this logic
|
|
6765
|
+
}
|
|
6766
|
+
|
|
6554
6767
|
var style = "width: ".concat(sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth, "px!important; ");
|
|
6555
6768
|
var divStyle = style;
|
|
6556
6769
|
|
|
@@ -6563,25 +6776,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6563
6776
|
style += col.style;
|
|
6564
6777
|
}
|
|
6565
6778
|
|
|
6566
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6779
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this40.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6567
6780
|
// headerHtml += `
|
|
6568
6781
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6569
6782
|
// width='${col.width || col.actualWidth}'
|
|
6570
6783
|
// `
|
|
6571
6784
|
// }
|
|
6572
6785
|
|
|
6573
|
-
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 ?
|
|
6786
|
+
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 ? _this40.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this40.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6574
6787
|
});
|
|
6575
6788
|
headerHtml += "</tr>";
|
|
6576
6789
|
});
|
|
6577
6790
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6578
6791
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6579
6792
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6580
|
-
var testEl = document.getElementById("".concat(
|
|
6793
|
+
var testEl = document.getElementById("".concat(_this40.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6581
6794
|
|
|
6582
6795
|
if (!testEl) {
|
|
6583
6796
|
var newE = document.createElement('div');
|
|
6584
|
-
newE.id = "".concat(
|
|
6797
|
+
newE.id = "".concat(_this40.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6585
6798
|
newE.className = 'websy-modal-dropdown';
|
|
6586
6799
|
dropdownEl.appendChild(newE);
|
|
6587
6800
|
}
|
|
@@ -6604,7 +6817,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6604
6817
|
}, {
|
|
6605
6818
|
key: "buildTotalHtml",
|
|
6606
6819
|
value: function buildTotalHtml() {
|
|
6607
|
-
var
|
|
6820
|
+
var _this41 = this;
|
|
6608
6821
|
|
|
6609
6822
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6610
6823
|
|
|
@@ -6612,12 +6825,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6612
6825
|
return '';
|
|
6613
6826
|
}
|
|
6614
6827
|
|
|
6828
|
+
var sizingColumns = this.options.columns[this.options.columns.length - 1].filter(function (c) {
|
|
6829
|
+
return c.show !== false;
|
|
6830
|
+
});
|
|
6615
6831
|
var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
|
|
6616
6832
|
this.options.totals.forEach(function (col, colIndex) {
|
|
6833
|
+
if (typeof sizingColumns[colIndex] === 'undefined' || sizingColumns[colIndex].show === false) {
|
|
6834
|
+
return; // need to revisit this logic
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6617
6837
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6618
6838
|
|
|
6619
6839
|
if (useWidths === true) {
|
|
6620
|
-
totalHtml += "\n style='width: ".concat(
|
|
6840
|
+
totalHtml += "\n style='width: ".concat(_this41.options.columns[_this41.options.columns.length - 1][colIndex].width || _this41.options.columns[_this41.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6621
6841
|
}
|
|
6622
6842
|
|
|
6623
6843
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6628,7 +6848,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6628
6848
|
}, {
|
|
6629
6849
|
key: "calculateSizes",
|
|
6630
6850
|
value: function calculateSizes() {
|
|
6631
|
-
var
|
|
6851
|
+
var _this42 = this;
|
|
6632
6852
|
|
|
6633
6853
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6634
6854
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6674,45 +6894,48 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6674
6894
|
var totalWidth = 0;
|
|
6675
6895
|
this.sizes.scrollableWidth = this.sizes.outer.width;
|
|
6676
6896
|
var firstNonPinnedColumnWidth = 0;
|
|
6897
|
+
var columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(function (c) {
|
|
6898
|
+
return c.show !== false;
|
|
6899
|
+
});
|
|
6677
6900
|
rows.forEach(function (row, rowIndex) {
|
|
6678
6901
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6679
6902
|
var colSize = col.getBoundingClientRect();
|
|
6680
|
-
|
|
6903
|
+
_this42.sizes.cellHeight = colSize.height;
|
|
6681
6904
|
|
|
6682
|
-
if (
|
|
6683
|
-
if (!
|
|
6684
|
-
|
|
6905
|
+
if (columnsForSizing[colIndex]) {
|
|
6906
|
+
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6907
|
+
columnsForSizing[colIndex].actualWidth = 0;
|
|
6685
6908
|
}
|
|
6686
6909
|
|
|
6687
|
-
|
|
6688
|
-
|
|
6910
|
+
columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth);
|
|
6911
|
+
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6689
6912
|
|
|
6690
|
-
if (colIndex >=
|
|
6691
|
-
firstNonPinnedColumnWidth =
|
|
6913
|
+
if (colIndex >= _this42.pinnedColumns) {
|
|
6914
|
+
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6692
6915
|
}
|
|
6693
6916
|
}
|
|
6694
6917
|
});
|
|
6695
|
-
});
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
this.sizes.totalWidth =
|
|
6918
|
+
}); // columnsForSizing.forEach((col, colIndex) => {
|
|
6919
|
+
// if (colIndex < this.pinnedColumns) {
|
|
6920
|
+
// this.sizes.scrollableWidth -= col.actualWidth
|
|
6921
|
+
// }
|
|
6922
|
+
// })
|
|
6923
|
+
|
|
6924
|
+
this.sizes.totalWidth = columnsForSizing.reduce(function (a, b) {
|
|
6702
6925
|
return a + (b.width || b.actualWidth);
|
|
6703
6926
|
}, 0);
|
|
6704
|
-
this.sizes.totalNonPinnedWidth =
|
|
6705
|
-
return i >=
|
|
6927
|
+
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6928
|
+
return i >= _this42.pinnedColumns;
|
|
6706
6929
|
}).reduce(function (a, b) {
|
|
6707
6930
|
return a + (b.width || b.actualWidth);
|
|
6708
6931
|
}, 0);
|
|
6709
6932
|
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth; // const outerSize = outerEl.getBoundingClientRect()
|
|
6710
6933
|
|
|
6711
6934
|
if (this.sizes.totalWidth < this.sizes.outer.width) {
|
|
6712
|
-
var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) /
|
|
6935
|
+
var equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / columnsForSizing.length;
|
|
6713
6936
|
this.sizes.totalWidth = 0;
|
|
6714
6937
|
this.sizes.totalNonPinnedWidth = 0;
|
|
6715
|
-
|
|
6938
|
+
columnsForSizing.forEach(function (c, i) {
|
|
6716
6939
|
// if (!c.width) {
|
|
6717
6940
|
// if (c.actualWidth < equalWidth) {
|
|
6718
6941
|
// adjust the width
|
|
@@ -6723,10 +6946,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6723
6946
|
c.actualWidth += equalWidth; // }
|
|
6724
6947
|
// }
|
|
6725
6948
|
|
|
6726
|
-
|
|
6949
|
+
_this42.sizes.totalWidth += c.width || c.actualWidth;
|
|
6727
6950
|
|
|
6728
|
-
if (i
|
|
6729
|
-
|
|
6951
|
+
if (i > _this42.pinnedColumns) {
|
|
6952
|
+
_this42.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6730
6953
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6731
6954
|
|
|
6732
6955
|
});
|
|
@@ -6735,20 +6958,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6735
6958
|
|
|
6736
6959
|
if (this.sizes.pinnedWidth > this.sizes.outer.width - firstNonPinnedColumnWidth) {
|
|
6737
6960
|
this.sizes.totalWidth = 0;
|
|
6738
|
-
var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth);
|
|
6961
|
+
var diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth);
|
|
6962
|
+
var oldPinnedWidth = this.sizes.pinnedWidth;
|
|
6963
|
+
this.sizes.pinnedWidth = 0; // let colDiff = diff / this.pinnedColumns
|
|
6739
6964
|
|
|
6740
|
-
for (var i = 0; i <
|
|
6965
|
+
for (var i = 0; i < columnsForSizing.length; i++) {
|
|
6741
6966
|
if (i < this.pinnedColumns) {
|
|
6742
|
-
var colDiff =
|
|
6743
|
-
|
|
6967
|
+
var colDiff = columnsForSizing[i].actualWidth / oldPinnedWidth * diff;
|
|
6968
|
+
columnsForSizing[i].actualWidth -= colDiff;
|
|
6969
|
+
this.sizes.pinnedWidth += columnsForSizing[i].actualWidth;
|
|
6744
6970
|
}
|
|
6745
6971
|
|
|
6746
|
-
this.sizes.totalWidth +=
|
|
6972
|
+
this.sizes.totalWidth += columnsForSizing[i].width || columnsForSizing[i].actualWidth;
|
|
6747
6973
|
}
|
|
6748
6974
|
} // take the height of the last cell as the official height for data cells
|
|
6749
6975
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
6750
6976
|
|
|
6751
6977
|
|
|
6978
|
+
this.sizes.scrollableWidth = this.sizes.table.width - this.sizes.pinnedWidth;
|
|
6752
6979
|
headEl.innerHTML = '';
|
|
6753
6980
|
bodyEl.innerHTML = '';
|
|
6754
6981
|
footerEl.innerHTML = '';
|
|
@@ -6789,7 +7016,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6789
7016
|
}, {
|
|
6790
7017
|
key: "createSample",
|
|
6791
7018
|
value: function createSample(data) {
|
|
6792
|
-
var
|
|
7019
|
+
var _this43 = this;
|
|
6793
7020
|
|
|
6794
7021
|
var output = [];
|
|
6795
7022
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6801,7 +7028,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6801
7028
|
var longest = '';
|
|
6802
7029
|
|
|
6803
7030
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6804
|
-
if (data[i].length ===
|
|
7031
|
+
if (data[i].length === _this43.options.columns[_this43.options.columns.length - 1].length) {
|
|
6805
7032
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6806
7033
|
longest = data[i][colIndex].value;
|
|
6807
7034
|
}
|
|
@@ -7126,21 +7353,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7126
7353
|
this.endCol = 0;
|
|
7127
7354
|
|
|
7128
7355
|
for (var i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
7129
|
-
|
|
7356
|
+
if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
|
|
7357
|
+
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
|
|
7130
7358
|
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7359
|
+
if (actualLeft < cumulativeWidth) {
|
|
7360
|
+
this.startCol = i;
|
|
7361
|
+
break;
|
|
7362
|
+
}
|
|
7134
7363
|
}
|
|
7135
7364
|
}
|
|
7136
7365
|
|
|
7137
7366
|
cumulativeWidth = 0;
|
|
7138
7367
|
|
|
7139
7368
|
for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
|
|
7140
|
-
|
|
7369
|
+
if (this.options.allColumns[this.options.allColumns.length - 1][_i10].show !== false) {
|
|
7370
|
+
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
|
|
7141
7371
|
|
|
7142
|
-
|
|
7143
|
-
|
|
7372
|
+
if (cumulativeWidth < this.sizes.scrollableWidth) {
|
|
7373
|
+
this.endCol = _i10;
|
|
7374
|
+
}
|
|
7144
7375
|
}
|
|
7145
7376
|
}
|
|
7146
7377
|
|
|
@@ -7229,7 +7460,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7229
7460
|
|
|
7230
7461
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7231
7462
|
function WebsyChart(elementId, options) {
|
|
7232
|
-
var
|
|
7463
|
+
var _this44 = this;
|
|
7233
7464
|
|
|
7234
7465
|
_classCallCheck(this, WebsyChart);
|
|
7235
7466
|
|
|
@@ -7289,7 +7520,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7289
7520
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7290
7521
|
var xAxis = 'bottom';
|
|
7291
7522
|
|
|
7292
|
-
if (
|
|
7523
|
+
if (_this44.options.orientation === 'horizontal') {
|
|
7293
7524
|
xAxis = 'left';
|
|
7294
7525
|
}
|
|
7295
7526
|
|
|
@@ -7300,13 +7531,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7300
7531
|
xAxis += 'Axis';
|
|
7301
7532
|
var output;
|
|
7302
7533
|
|
|
7303
|
-
var width =
|
|
7534
|
+
var width = _this44.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
|
|
7304
7535
|
|
|
7305
7536
|
|
|
7306
|
-
for (var index = 0; index <
|
|
7307
|
-
if (input >
|
|
7308
|
-
if (
|
|
7309
|
-
if (input <
|
|
7537
|
+
for (var index = 0; index < _this44.customBottomRange.length; index++) {
|
|
7538
|
+
if (input > _this44.customBottomRange[index]) {
|
|
7539
|
+
if (_this44.customBottomRange[index + 1]) {
|
|
7540
|
+
if (input < _this44.customBottomRange[index + 1]) {
|
|
7310
7541
|
output = index;
|
|
7311
7542
|
break;
|
|
7312
7543
|
}
|
|
@@ -7544,10 +7775,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7544
7775
|
}, {
|
|
7545
7776
|
key: "handleEventMouseMove",
|
|
7546
7777
|
value: function handleEventMouseMove(event, d) {
|
|
7547
|
-
var
|
|
7778
|
+
var _this45 = this;
|
|
7548
7779
|
|
|
7549
7780
|
var bisectDate = d3.bisector(function (d) {
|
|
7550
|
-
return
|
|
7781
|
+
return _this45.parseX(d.x.value);
|
|
7551
7782
|
}).left;
|
|
7552
7783
|
|
|
7553
7784
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7586,9 +7817,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7586
7817
|
}
|
|
7587
7818
|
|
|
7588
7819
|
this.options.data.series.forEach(function (s) {
|
|
7589
|
-
if (
|
|
7820
|
+
if (_this45.options.data[xData].scale !== 'Time') {
|
|
7590
7821
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7591
|
-
xPoint =
|
|
7822
|
+
xPoint = _this45.customBottomRange[x0] + (_this45.customBottomRange[x0 + 1] - _this45.customBottomRange[x0]) / 2; // }
|
|
7592
7823
|
// else {
|
|
7593
7824
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
7594
7825
|
// }
|
|
@@ -7611,13 +7842,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7611
7842
|
var pointA = s.data[index - 1];
|
|
7612
7843
|
var pointB = s.data[index];
|
|
7613
7844
|
|
|
7614
|
-
if (
|
|
7845
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7615
7846
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7616
7847
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7617
7848
|
}
|
|
7618
7849
|
|
|
7619
7850
|
if (pointA && !pointB) {
|
|
7620
|
-
xPoint =
|
|
7851
|
+
xPoint = _this45[xAxis](_this45.parseX(pointA.x.value));
|
|
7621
7852
|
tooltipTitle = pointA.x.value;
|
|
7622
7853
|
|
|
7623
7854
|
if (!pointA.y.color) {
|
|
@@ -7627,12 +7858,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7627
7858
|
tooltipData.push(pointA.y);
|
|
7628
7859
|
|
|
7629
7860
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7630
|
-
tooltipTitle = d3.timeFormat(
|
|
7861
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7631
7862
|
}
|
|
7632
7863
|
}
|
|
7633
7864
|
|
|
7634
7865
|
if (pointB && !pointA) {
|
|
7635
|
-
xPoint =
|
|
7866
|
+
xPoint = _this45[xAxis](_this45.parseX(pointB.x.value));
|
|
7636
7867
|
tooltipTitle = pointB.x.value;
|
|
7637
7868
|
|
|
7638
7869
|
if (!pointB.y.color) {
|
|
@@ -7642,14 +7873,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7642
7873
|
tooltipData.push(pointB.y);
|
|
7643
7874
|
|
|
7644
7875
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7645
|
-
tooltipTitle = d3.timeFormat(
|
|
7876
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7646
7877
|
}
|
|
7647
7878
|
}
|
|
7648
7879
|
|
|
7649
7880
|
if (pointA && pointB) {
|
|
7650
|
-
var d0 =
|
|
7881
|
+
var d0 = _this45[xAxis](_this45.parseX(pointA.x.value));
|
|
7651
7882
|
|
|
7652
|
-
var d1 =
|
|
7883
|
+
var d1 = _this45[xAxis](_this45.parseX(pointB.x.value));
|
|
7653
7884
|
|
|
7654
7885
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7655
7886
|
|
|
@@ -7658,7 +7889,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7658
7889
|
tooltipTitle = pointB.x.value;
|
|
7659
7890
|
|
|
7660
7891
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7661
|
-
tooltipTitle = d3.timeFormat(
|
|
7892
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7662
7893
|
}
|
|
7663
7894
|
|
|
7664
7895
|
if (!pointB.y.color) {
|
|
@@ -7671,7 +7902,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7671
7902
|
tooltipTitle = pointA.x.value;
|
|
7672
7903
|
|
|
7673
7904
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7674
|
-
tooltipTitle = d3.timeFormat(
|
|
7905
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7675
7906
|
}
|
|
7676
7907
|
|
|
7677
7908
|
if (!pointA.y.color) {
|
|
@@ -7804,7 +8035,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7804
8035
|
}, {
|
|
7805
8036
|
key: "render",
|
|
7806
8037
|
value: function render(options) {
|
|
7807
|
-
var
|
|
8038
|
+
var _this46 = this;
|
|
7808
8039
|
|
|
7809
8040
|
/* global d3 options WebsyUtils */
|
|
7810
8041
|
if (typeof options !== 'undefined') {
|
|
@@ -7879,7 +8110,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7879
8110
|
this.options.data.series.map(function (s, i) {
|
|
7880
8111
|
return {
|
|
7881
8112
|
value: s.label || s.key,
|
|
7882
|
-
color: s.color ||
|
|
8113
|
+
color: s.color || _this46.options.colors[i % _this46.options.colors.length]
|
|
7883
8114
|
};
|
|
7884
8115
|
});
|
|
7885
8116
|
}
|
|
@@ -8253,28 +8484,28 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8253
8484
|
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') {
|
|
8254
8485
|
var acc = 0;
|
|
8255
8486
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8256
|
-
var adjustment =
|
|
8487
|
+
var adjustment = _this46.bandPadding * index + _this46.bandPadding; // if (this.options.data.bottom.padding) {
|
|
8257
8488
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8258
8489
|
// }
|
|
8259
8490
|
|
|
8260
|
-
var start =
|
|
8491
|
+
var start = _this46.widthForCalc / noOfPoints * acc;
|
|
8261
8492
|
|
|
8262
8493
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8263
8494
|
var pos = i * proposedBandWidth;
|
|
8264
8495
|
|
|
8265
|
-
|
|
8496
|
+
_this46["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8266
8497
|
}
|
|
8267
8498
|
|
|
8268
|
-
acc +=
|
|
8269
|
-
var end =
|
|
8499
|
+
acc += _this46.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
|
|
8500
|
+
var end = _this46.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8270
8501
|
|
|
8271
8502
|
return end + adjustment;
|
|
8272
8503
|
})));
|
|
8273
8504
|
acc = 0;
|
|
8274
8505
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8275
|
-
var adjustment =
|
|
8276
|
-
acc +=
|
|
8277
|
-
return (
|
|
8506
|
+
var adjustment = _this46.brushBandPadding * index + _this46.brushBandPadding;
|
|
8507
|
+
acc += _this46.options.grouping !== 'stacked' ? d.valueCount || 1 : 1;
|
|
8508
|
+
return (_this46.options.orientation === 'vertical' ? _this46.plotWidth : _this46.plotHeight) / noOfPoints * acc;
|
|
8278
8509
|
})));
|
|
8279
8510
|
} // }
|
|
8280
8511
|
|
|
@@ -8452,7 +8683,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8452
8683
|
|
|
8453
8684
|
if (this.options.data.bottom.formatter) {
|
|
8454
8685
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8455
|
-
return
|
|
8686
|
+
return _this46.options.data.bottom.formatter(d);
|
|
8456
8687
|
});
|
|
8457
8688
|
}
|
|
8458
8689
|
|
|
@@ -8464,7 +8695,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8464
8695
|
|
|
8465
8696
|
if (this.customBottomRange.length > 0) {
|
|
8466
8697
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8467
|
-
return "translate(".concat(
|
|
8698
|
+
return "translate(".concat(_this46.customBottomRange[i] + (_this46.customBottomRange[i + 1] - _this46.customBottomRange[i]) / 2, ", 0)");
|
|
8468
8699
|
});
|
|
8469
8700
|
}
|
|
8470
8701
|
} // Configure the left axis
|
|
@@ -8486,8 +8717,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8486
8717
|
|
|
8487
8718
|
if (this.options.margin.axisLeft > 0) {
|
|
8488
8719
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8489
|
-
if (
|
|
8490
|
-
d =
|
|
8720
|
+
if (_this46.options.data.left.formatter) {
|
|
8721
|
+
d = _this46.options.data.left.formatter(d);
|
|
8491
8722
|
}
|
|
8492
8723
|
|
|
8493
8724
|
return d;
|
|
@@ -8495,7 +8726,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8495
8726
|
|
|
8496
8727
|
if (this.customLeftRange.length > 0) {
|
|
8497
8728
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8498
|
-
return "translate(0, ".concat(
|
|
8729
|
+
return "translate(0, ".concat(_this46.customLeftRange[i] + (_this46.customLeftRange[i + 1] - _this46.customLeftRange[i]) / 2, ")");
|
|
8499
8730
|
});
|
|
8500
8731
|
}
|
|
8501
8732
|
}
|
|
@@ -8528,8 +8759,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8528
8759
|
|
|
8529
8760
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8530
8761
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8531
|
-
if (
|
|
8532
|
-
d =
|
|
8762
|
+
if (_this46.options.data.right.formatter) {
|
|
8763
|
+
d = _this46.options.data.right.formatter(d);
|
|
8533
8764
|
}
|
|
8534
8765
|
|
|
8535
8766
|
return d;
|
|
@@ -8575,57 +8806,57 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8575
8806
|
}, {
|
|
8576
8807
|
key: "renderComponents",
|
|
8577
8808
|
value: function renderComponents() {
|
|
8578
|
-
var
|
|
8809
|
+
var _this47 = this;
|
|
8579
8810
|
|
|
8580
8811
|
// Draw the series data
|
|
8581
8812
|
this.renderedKeys = {};
|
|
8582
8813
|
this.options.data.series.forEach(function (series, index) {
|
|
8583
8814
|
if (!series.key) {
|
|
8584
|
-
series.key =
|
|
8815
|
+
series.key = _this47.createIdentity();
|
|
8585
8816
|
}
|
|
8586
8817
|
|
|
8587
8818
|
if (!series.color) {
|
|
8588
|
-
series.color =
|
|
8819
|
+
series.color = _this47.options.colors[index % _this47.options.colors.length];
|
|
8589
8820
|
}
|
|
8590
8821
|
|
|
8591
|
-
|
|
8822
|
+
_this47["render".concat(series.type || 'bar')](series, index);
|
|
8592
8823
|
|
|
8593
|
-
|
|
8824
|
+
_this47.renderLabels(series, index);
|
|
8594
8825
|
|
|
8595
|
-
|
|
8826
|
+
_this47.renderedKeys[series.key] = series.type;
|
|
8596
8827
|
});
|
|
8597
8828
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8598
8829
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8599
8830
|
|
|
8600
8831
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8601
8832
|
this.options.refLines.forEach(function (l) {
|
|
8602
|
-
return
|
|
8833
|
+
return _this47.renderRefLine(l);
|
|
8603
8834
|
});
|
|
8604
8835
|
}
|
|
8605
8836
|
}
|
|
8606
8837
|
}, {
|
|
8607
8838
|
key: "renderarea",
|
|
8608
8839
|
value: function renderarea(series, index) {
|
|
8609
|
-
var
|
|
8840
|
+
var _this48 = this;
|
|
8610
8841
|
|
|
8611
8842
|
/* global d3 series index */
|
|
8612
8843
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8613
8844
|
return d3.area().x(function (d) {
|
|
8614
8845
|
// return this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
8615
|
-
var xIndex =
|
|
8846
|
+
var xIndex = _this48[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8616
8847
|
|
|
8617
|
-
var xPos =
|
|
8848
|
+
var xPos = _this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8618
8849
|
|
|
8619
|
-
if (
|
|
8620
|
-
xPos = xPos + (
|
|
8850
|
+
if (_this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8851
|
+
xPos = xPos + (_this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8621
8852
|
}
|
|
8622
8853
|
|
|
8623
8854
|
return xPos;
|
|
8624
8855
|
}).y0(function (d) {
|
|
8625
|
-
return
|
|
8856
|
+
return _this48["".concat(yAxis, "Axis")](0);
|
|
8626
8857
|
}).y1(function (d) {
|
|
8627
|
-
return
|
|
8628
|
-
}).curve(d3[curveStyle ||
|
|
8858
|
+
return _this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8859
|
+
}).curve(d3[curveStyle || _this48.options.curveStyle]);
|
|
8629
8860
|
};
|
|
8630
8861
|
|
|
8631
8862
|
var xAxis = 'bottom';
|
|
@@ -8663,7 +8894,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8663
8894
|
}, {
|
|
8664
8895
|
key: "renderbar",
|
|
8665
8896
|
value: function renderbar(series, index) {
|
|
8666
|
-
var
|
|
8897
|
+
var _this49 = this;
|
|
8667
8898
|
|
|
8668
8899
|
/* global series index d3 */
|
|
8669
8900
|
var xAxis = 'bottom';
|
|
@@ -8828,25 +9059,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8828
9059
|
|
|
8829
9060
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8830
9061
|
bars.attr('width', function (d, i) {
|
|
8831
|
-
return Math.abs(getBarWidth.call(
|
|
9062
|
+
return Math.abs(getBarWidth.call(_this49, d, i, xAxis));
|
|
8832
9063
|
}).attr('height', function (d, i) {
|
|
8833
|
-
return getBarHeight.call(
|
|
9064
|
+
return getBarHeight.call(_this49, d, i, yAxis, xAxis);
|
|
8834
9065
|
}).attr('x', function (d, i) {
|
|
8835
|
-
return getBarX.call(
|
|
9066
|
+
return getBarX.call(_this49, d, i, xAxis);
|
|
8836
9067
|
}).attr('y', function (d, i) {
|
|
8837
|
-
return getBarY.call(
|
|
9068
|
+
return getBarY.call(_this49, d, i, yAxis, xAxis);
|
|
8838
9069
|
}) // .transition(this.transition)
|
|
8839
9070
|
.attr('fill', function (d) {
|
|
8840
9071
|
return d.y.color || d.color || series.color;
|
|
8841
9072
|
});
|
|
8842
9073
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8843
|
-
return Math.abs(getBarWidth.call(
|
|
9074
|
+
return Math.abs(getBarWidth.call(_this49, d, i, xAxis));
|
|
8844
9075
|
}).attr('height', function (d, i) {
|
|
8845
|
-
return getBarHeight.call(
|
|
9076
|
+
return getBarHeight.call(_this49, d, i, yAxis, xAxis);
|
|
8846
9077
|
}).attr('x', function (d, i) {
|
|
8847
|
-
return getBarX.call(
|
|
9078
|
+
return getBarX.call(_this49, d, i, xAxis);
|
|
8848
9079
|
}).attr('y', function (d, i) {
|
|
8849
|
-
return getBarY.call(
|
|
9080
|
+
return getBarY.call(_this49, d, i, yAxis, xAxis);
|
|
8850
9081
|
}) // .transition(this.transition)
|
|
8851
9082
|
.attr('fill', function (d) {
|
|
8852
9083
|
return d.y.color || d.color || series.color;
|
|
@@ -8858,25 +9089,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8858
9089
|
this.brushBarsInitialized[series.key] = true;
|
|
8859
9090
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8860
9091
|
brushBars.attr('width', function (d, i) {
|
|
8861
|
-
return Math.abs(getBarWidth.call(
|
|
9092
|
+
return Math.abs(getBarWidth.call(_this49, d, i, "".concat(xAxis, "Brush")));
|
|
8862
9093
|
}).attr('height', function (d, i) {
|
|
8863
|
-
return getBarHeight.call(
|
|
9094
|
+
return getBarHeight.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8864
9095
|
}).attr('x', function (d, i) {
|
|
8865
|
-
return getBarX.call(
|
|
9096
|
+
return getBarX.call(_this49, d, i, "".concat(xAxis, "Brush"));
|
|
8866
9097
|
}).attr('y', function (d, i) {
|
|
8867
|
-
return getBarY.call(
|
|
9098
|
+
return getBarY.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8868
9099
|
}) // .transition(this.transition)
|
|
8869
9100
|
.attr('fill', function (d) {
|
|
8870
9101
|
return d.y.color || d.color || series.color;
|
|
8871
9102
|
});
|
|
8872
9103
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8873
|
-
return Math.abs(getBarWidth.call(
|
|
9104
|
+
return Math.abs(getBarWidth.call(_this49, d, i, "".concat(xAxis, "Brush")));
|
|
8874
9105
|
}).attr('height', function (d, i) {
|
|
8875
|
-
return getBarHeight.call(
|
|
9106
|
+
return getBarHeight.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8876
9107
|
}).attr('x', function (d, i) {
|
|
8877
|
-
return getBarX.call(
|
|
9108
|
+
return getBarX.call(_this49, d, i, "".concat(xAxis, "Brush"));
|
|
8878
9109
|
}).attr('y', function (d, i) {
|
|
8879
|
-
return getBarY.call(
|
|
9110
|
+
return getBarY.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8880
9111
|
}) // .transition(this.transition)
|
|
8881
9112
|
.attr('fill', function (d) {
|
|
8882
9113
|
return d.y.color || d.color || series.color;
|
|
@@ -8894,7 +9125,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8894
9125
|
}, {
|
|
8895
9126
|
key: "renderLabels",
|
|
8896
9127
|
value: function renderLabels(series, index) {
|
|
8897
|
-
var
|
|
9128
|
+
var _this50 = this;
|
|
8898
9129
|
|
|
8899
9130
|
/* global series index d3 WebsyDesigns */
|
|
8900
9131
|
var xAxis = 'bottom';
|
|
@@ -8913,15 +9144,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8913
9144
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8914
9145
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8915
9146
|
labels.attr('x', function (d) {
|
|
8916
|
-
return getLabelX.call(
|
|
9147
|
+
return getLabelX.call(_this50, d, series.labelPosition);
|
|
8917
9148
|
}).attr('y', function (d) {
|
|
8918
|
-
return getLabelY.call(
|
|
9149
|
+
return getLabelY.call(_this50, d, series.labelPosition);
|
|
8919
9150
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8920
|
-
if (
|
|
9151
|
+
if (_this50.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8921
9152
|
return 'transparent';
|
|
8922
9153
|
}
|
|
8923
9154
|
|
|
8924
|
-
return
|
|
9155
|
+
return _this50.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8925
9156
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8926
9157
|
return d.y.label || d.y.value;
|
|
8927
9158
|
}).each(function (d, i) {
|
|
@@ -8946,15 +9177,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8946
9177
|
}
|
|
8947
9178
|
});
|
|
8948
9179
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8949
|
-
return getLabelX.call(
|
|
9180
|
+
return getLabelX.call(_this50, d, series.labelPosition);
|
|
8950
9181
|
}).attr('y', function (d) {
|
|
8951
|
-
return getLabelY.call(
|
|
9182
|
+
return getLabelY.call(_this50, d, series.labelPosition);
|
|
8952
9183
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8953
|
-
if (
|
|
9184
|
+
if (_this50.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8954
9185
|
return 'transparent';
|
|
8955
9186
|
}
|
|
8956
9187
|
|
|
8957
|
-
return
|
|
9188
|
+
return _this50.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8958
9189
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8959
9190
|
return d.y.label || d.y.value;
|
|
8960
9191
|
}).each(function (d, i) {
|
|
@@ -9032,20 +9263,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9032
9263
|
}, {
|
|
9033
9264
|
key: "renderline",
|
|
9034
9265
|
value: function renderline(series, index) {
|
|
9035
|
-
var
|
|
9266
|
+
var _this51 = this;
|
|
9036
9267
|
|
|
9037
9268
|
/* global series index d3 */
|
|
9038
9269
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9039
9270
|
return d3.line().x(function (d) {
|
|
9040
|
-
if (
|
|
9041
|
-
return
|
|
9271
|
+
if (_this51.options.orientation === 'horizontal') {
|
|
9272
|
+
return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9042
9273
|
} else {
|
|
9043
|
-
var xIndex =
|
|
9274
|
+
var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9044
9275
|
|
|
9045
|
-
var xPos =
|
|
9276
|
+
var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9046
9277
|
|
|
9047
|
-
if (
|
|
9048
|
-
xPos = xPos + (
|
|
9278
|
+
if (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9279
|
+
xPos = xPos + (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9049
9280
|
} // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
|
|
9050
9281
|
// return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
|
|
9051
9282
|
|
|
@@ -9053,13 +9284,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9053
9284
|
return xPos;
|
|
9054
9285
|
}
|
|
9055
9286
|
}).y(function (d) {
|
|
9056
|
-
if (
|
|
9057
|
-
var adjustment =
|
|
9058
|
-
return
|
|
9287
|
+
if (_this51.options.orientation === 'horizontal') {
|
|
9288
|
+
var adjustment = _this51.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this51.options.data[xAxis].bandWidth / 2;
|
|
9289
|
+
return _this51["".concat(xAxis, "Axis")](_this51.parseX(d.x.value)) + adjustment;
|
|
9059
9290
|
} else {
|
|
9060
|
-
return
|
|
9291
|
+
return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9061
9292
|
}
|
|
9062
|
-
}).curve(d3[curveStyle ||
|
|
9293
|
+
}).curve(d3[curveStyle || _this51.options.curveStyle]);
|
|
9063
9294
|
};
|
|
9064
9295
|
|
|
9065
9296
|
var xAxis = 'bottom';
|
|
@@ -9173,14 +9404,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9173
9404
|
}, {
|
|
9174
9405
|
key: "rendersymbol",
|
|
9175
9406
|
value: function rendersymbol(series, index) {
|
|
9176
|
-
var
|
|
9407
|
+
var _this52 = this;
|
|
9177
9408
|
|
|
9178
9409
|
/* global d3 series index series.key */
|
|
9179
9410
|
var drawSymbol = function drawSymbol(size) {
|
|
9180
9411
|
return d3.symbol() // .type(d => {
|
|
9181
9412
|
// return d3.symbols[0]
|
|
9182
9413
|
// })
|
|
9183
|
-
.size(size ||
|
|
9414
|
+
.size(size || _this52.options.symbolSize);
|
|
9184
9415
|
};
|
|
9185
9416
|
|
|
9186
9417
|
var xAxis = 'bottom';
|
|
@@ -9205,21 +9436,21 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9205
9436
|
// else {
|
|
9206
9437
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9207
9438
|
// }
|
|
9208
|
-
var xIndex =
|
|
9439
|
+
var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9209
9440
|
|
|
9210
|
-
var xPos =
|
|
9441
|
+
var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9211
9442
|
|
|
9212
|
-
if (
|
|
9213
|
-
xPos = xPos + (
|
|
9443
|
+
if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9444
|
+
xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9214
9445
|
}
|
|
9215
9446
|
|
|
9216
|
-
var adjustment =
|
|
9447
|
+
var adjustment = _this52.options.data[xAxis].scale === 'Time' || _this52.options.data[xAxis].scale === 'Linear' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
|
|
9217
9448
|
|
|
9218
|
-
if (
|
|
9219
|
-
return "translate(".concat(
|
|
9449
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
9450
|
+
return "translate(".concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9220
9451
|
} else {
|
|
9221
9452
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9222
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9453
|
+
return "translate(".concat(xPos, ", ").concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9223
9454
|
}
|
|
9224
9455
|
}); // Enter
|
|
9225
9456
|
|
|
@@ -9229,21 +9460,21 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9229
9460
|
.attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
9230
9461
|
return "symbol symbol_".concat(series.key);
|
|
9231
9462
|
}).attr('transform', function (d) {
|
|
9232
|
-
var xIndex =
|
|
9463
|
+
var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9233
9464
|
|
|
9234
|
-
var xPos =
|
|
9465
|
+
var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9235
9466
|
|
|
9236
|
-
if (
|
|
9237
|
-
xPos = xPos + (
|
|
9467
|
+
if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9468
|
+
xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9238
9469
|
}
|
|
9239
9470
|
|
|
9240
|
-
var adjustment =
|
|
9471
|
+
var adjustment = _this52.options.data[xAxis].scale === 'Time' || _this52.options.data[xAxis].scale === 'Linear' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
|
|
9241
9472
|
|
|
9242
|
-
if (
|
|
9243
|
-
return "translate(".concat(
|
|
9473
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
9474
|
+
return "translate(".concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9244
9475
|
} else {
|
|
9245
9476
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9246
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9477
|
+
return "translate(".concat(xPos, ", ").concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9247
9478
|
}
|
|
9248
9479
|
});
|
|
9249
9480
|
}
|
|
@@ -9465,7 +9696,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9465
9696
|
}, {
|
|
9466
9697
|
key: "resize",
|
|
9467
9698
|
value: function resize() {
|
|
9468
|
-
var
|
|
9699
|
+
var _this53 = this;
|
|
9469
9700
|
|
|
9470
9701
|
var el = document.getElementById(this.elementId);
|
|
9471
9702
|
|
|
@@ -9478,7 +9709,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9478
9709
|
// }
|
|
9479
9710
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9480
9711
|
html += this._data.map(function (d, i) {
|
|
9481
|
-
return
|
|
9712
|
+
return _this53.getLegendItemHTML(d);
|
|
9482
9713
|
}).join('');
|
|
9483
9714
|
html += "\n <div>\n ";
|
|
9484
9715
|
el.innerHTML = html;
|
|
@@ -9650,7 +9881,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9650
9881
|
}, {
|
|
9651
9882
|
key: "render",
|
|
9652
9883
|
value: function render() {
|
|
9653
|
-
var
|
|
9884
|
+
var _this54 = this;
|
|
9654
9885
|
|
|
9655
9886
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9656
9887
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -9659,7 +9890,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9659
9890
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9660
9891
|
return {
|
|
9661
9892
|
value: s.label || s.key,
|
|
9662
|
-
color: s.color ||
|
|
9893
|
+
color: s.color || _this54.options.colors[i % _this54.options.colors.length]
|
|
9663
9894
|
};
|
|
9664
9895
|
});
|
|
9665
9896
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9723,7 +9954,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9723
9954
|
|
|
9724
9955
|
if (this.polygons) {
|
|
9725
9956
|
this.polygons.forEach(function (p) {
|
|
9726
|
-
return
|
|
9957
|
+
return _this54.map.removeLayer(p);
|
|
9727
9958
|
});
|
|
9728
9959
|
}
|
|
9729
9960
|
|
|
@@ -9781,18 +10012,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9781
10012
|
}
|
|
9782
10013
|
|
|
9783
10014
|
if (!p.options.color) {
|
|
9784
|
-
p.options.color =
|
|
10015
|
+
p.options.color = _this54.options.colors[i % _this54.options.colors.length];
|
|
9785
10016
|
}
|
|
9786
10017
|
|
|
9787
10018
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9788
10019
|
return c.map(function (d) {
|
|
9789
10020
|
return [d.Latitude, d.Longitude];
|
|
9790
10021
|
});
|
|
9791
|
-
}), p.options).addTo(
|
|
10022
|
+
}), p.options).addTo(_this54.map);
|
|
9792
10023
|
|
|
9793
|
-
|
|
10024
|
+
_this54.polygons.push(pol);
|
|
9794
10025
|
|
|
9795
|
-
|
|
10026
|
+
_this54.map.fitBounds(pol.getBounds());
|
|
9796
10027
|
});
|
|
9797
10028
|
} // if (this.data.markers.length > 0) {
|
|
9798
10029
|
// el.classList.remove('hidden')
|