@websy/websy-designs 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/pgHelper.js +3 -0
- package/dist/websy-designs-es6.debug.js +27 -4
- package/dist/websy-designs-es6.js +253 -230
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +27 -4
- package/dist/websy-designs.js +256 -233
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -99,8 +99,25 @@ var APIService = /*#__PURE__*/function () {
|
|
|
99
99
|
}
|
|
100
100
|
}, {
|
|
101
101
|
key: "get",
|
|
102
|
-
value: function get(entity, id, query) {
|
|
102
|
+
value: function get(entity, id, query, offset, limit) {
|
|
103
103
|
var url = this.buildUrl(entity, id, query);
|
|
104
|
+
|
|
105
|
+
if (offset) {
|
|
106
|
+
if (url.indexOf('?') !== -1) {
|
|
107
|
+
url += "&offset=".concat(offset);
|
|
108
|
+
} else {
|
|
109
|
+
url += "?offset=".concat(offset);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (limit) {
|
|
114
|
+
if (url.indexOf('?') !== -1) {
|
|
115
|
+
url += "&limit=".concat(limit);
|
|
116
|
+
} else {
|
|
117
|
+
url += "?limit=".concat(limit);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
104
121
|
return this.run('GET', url);
|
|
105
122
|
}
|
|
106
123
|
}, {
|
|
@@ -1334,12 +1351,18 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1334
1351
|
}, {
|
|
1335
1352
|
key: "selectRange",
|
|
1336
1353
|
value: function selectRange(index) {
|
|
1354
|
+
var _this8 = this;
|
|
1355
|
+
|
|
1337
1356
|
var confirm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1338
1357
|
|
|
1339
1358
|
if (this.options.ranges[this.options.mode][index]) {
|
|
1340
1359
|
this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
|
|
1341
1360
|
this.currentselection = this.options.ranges[this.options.mode][index].range.map(function (d) {
|
|
1342
|
-
|
|
1361
|
+
if (_this8.options.mode === 'date' || _this8.options.mode === 'monthyear') {
|
|
1362
|
+
return d.getTime();
|
|
1363
|
+
} else {
|
|
1364
|
+
return d;
|
|
1365
|
+
}
|
|
1343
1366
|
});
|
|
1344
1367
|
this.selectedRange = +index;
|
|
1345
1368
|
this.highlightRange();
|
|
@@ -1350,7 +1373,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1350
1373
|
}, {
|
|
1351
1374
|
key: "selectCustomRange",
|
|
1352
1375
|
value: function selectCustomRange(rangeInput) {
|
|
1353
|
-
var
|
|
1376
|
+
var _this9 = this;
|
|
1354
1377
|
|
|
1355
1378
|
this.selectedRange = -1;
|
|
1356
1379
|
this.isContinuousRange = true; // if (rangeInput.length === 1) {
|
|
@@ -1366,13 +1389,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1366
1389
|
this.customRangeSelected = true;
|
|
1367
1390
|
rangeInput.forEach(function (r, i) {
|
|
1368
1391
|
if (i > 0) {
|
|
1369
|
-
if (
|
|
1370
|
-
if (r.getTime() /
|
|
1371
|
-
|
|
1392
|
+
if (_this9.options.mode === 'date' || _this9.options.mode === 'monthyear') {
|
|
1393
|
+
if (r.getTime() / _this9.oneDay - rangeInput[i - 1] / _this9.oneDay > 1) {
|
|
1394
|
+
_this9.isContinuousRange = false;
|
|
1372
1395
|
}
|
|
1373
|
-
} else if (
|
|
1396
|
+
} else if (_this9.options.mode === 'hour' || _this9.options.mode === 'year') {
|
|
1374
1397
|
if (r - rangeInput[i - 1] > 1) {
|
|
1375
|
-
|
|
1398
|
+
_this9.isContinuousRange = false;
|
|
1376
1399
|
}
|
|
1377
1400
|
}
|
|
1378
1401
|
}
|
|
@@ -1451,27 +1474,27 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1451
1474
|
}, {
|
|
1452
1475
|
key: "updateRange",
|
|
1453
1476
|
value: function updateRange() {
|
|
1454
|
-
var
|
|
1477
|
+
var _this10 = this;
|
|
1455
1478
|
|
|
1456
1479
|
var range;
|
|
1457
1480
|
|
|
1458
1481
|
if (this.selectedRange === -1) {
|
|
1459
1482
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1460
|
-
if (
|
|
1483
|
+
if (_this10.options.mode === 'date') {
|
|
1461
1484
|
if (!d.toLocaleDateString) {
|
|
1462
1485
|
d = new Date(d);
|
|
1463
1486
|
}
|
|
1464
1487
|
|
|
1465
1488
|
return d.toLocaleDateString();
|
|
1466
|
-
} else if (
|
|
1489
|
+
} else if (_this10.options.mode === 'year') {
|
|
1467
1490
|
return d;
|
|
1468
|
-
} else if (
|
|
1491
|
+
} else if (_this10.options.mode === 'monthyear') {
|
|
1469
1492
|
if (!d.getMonth) {
|
|
1470
1493
|
d = new Date(d);
|
|
1471
1494
|
}
|
|
1472
1495
|
|
|
1473
|
-
return "".concat(
|
|
1474
|
-
} else if (
|
|
1496
|
+
return "".concat(_this10.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1497
|
+
} else if (_this10.options.mode === 'hour') {
|
|
1475
1498
|
return d;
|
|
1476
1499
|
}
|
|
1477
1500
|
});
|
|
@@ -1541,7 +1564,7 @@ Date.prototype.floor = function () {
|
|
|
1541
1564
|
|
|
1542
1565
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1543
1566
|
function WebsyDropdown(elementId, options) {
|
|
1544
|
-
var
|
|
1567
|
+
var _this11 = this;
|
|
1545
1568
|
|
|
1546
1569
|
_classCallCheck(this, WebsyDropdown);
|
|
1547
1570
|
|
|
@@ -1590,10 +1613,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1590
1613
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1591
1614
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1592
1615
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1593
|
-
return
|
|
1616
|
+
return _this11.options.items[s].label || _this11.options.items[s].value;
|
|
1594
1617
|
}).join(this.options.multiValueDelimiter);
|
|
1595
1618
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1596
|
-
return
|
|
1619
|
+
return _this11.options.items[s].value || _this11.options.items[s].label;
|
|
1597
1620
|
}).join(this.options.multiValueDelimiter);
|
|
1598
1621
|
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, " ").concat(this.options.customActions.length > 0 ? 'with-actions' : '', "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n ");
|
|
1599
1622
|
|
|
@@ -1887,10 +1910,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1887
1910
|
}, {
|
|
1888
1911
|
key: "renderItems",
|
|
1889
1912
|
value: function renderItems() {
|
|
1890
|
-
var
|
|
1913
|
+
var _this12 = this;
|
|
1891
1914
|
|
|
1892
1915
|
var html = this.options.items.map(function (r, i) {
|
|
1893
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1916
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this12.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1894
1917
|
}).join('');
|
|
1895
1918
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1896
1919
|
|
|
@@ -2360,7 +2383,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2360
2383
|
}, {
|
|
2361
2384
|
key: "render",
|
|
2362
2385
|
value: function render() {
|
|
2363
|
-
var
|
|
2386
|
+
var _this13 = this;
|
|
2364
2387
|
|
|
2365
2388
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2366
2389
|
|
|
@@ -2368,7 +2391,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
|
|
|
2368
2391
|
this.measureItems();
|
|
2369
2392
|
var html = "\n <div id='".concat(this.elementId, "start_item' class='websy-dragdrop-item ").concat(this.options.items.length === 0 ? 'empty' : '', "' data-id='").concat(this.elementId, "start'>\n <div id='").concat(this.elementId, "start_dropZone' class='websy-drop-zone droppable' data-index='start' data-side='start' data-id='").concat(this.elementId, "start' data-placeholder='").concat(this.options.dropPlaceholder, "'></div>\n </div>\n ");
|
|
2370
2393
|
html += this.options.items.map(function (d, i) {
|
|
2371
|
-
return
|
|
2394
|
+
return _this13.createItemHtml(_this13.elementId, i, d);
|
|
2372
2395
|
}).join('');
|
|
2373
2396
|
el.innerHTML = html;
|
|
2374
2397
|
this.options.items.forEach(function (item, i) {
|
|
@@ -2447,16 +2470,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2447
2470
|
}, {
|
|
2448
2471
|
key: "checkRecaptcha",
|
|
2449
2472
|
value: function checkRecaptcha() {
|
|
2450
|
-
var
|
|
2473
|
+
var _this14 = this;
|
|
2451
2474
|
|
|
2452
2475
|
return new Promise(function (resolve, reject) {
|
|
2453
|
-
if (
|
|
2476
|
+
if (_this14.options.useRecaptcha === true) {
|
|
2454
2477
|
// if (this.recaptchaValue) {
|
|
2455
2478
|
grecaptcha.ready(function () {
|
|
2456
2479
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
2457
2480
|
action: 'submit'
|
|
2458
2481
|
}).then(function (token) {
|
|
2459
|
-
|
|
2482
|
+
_this14.apiService.add('google/checkrecaptcha', {
|
|
2460
2483
|
grecaptcharesponse: token
|
|
2461
2484
|
}).then(function (response) {
|
|
2462
2485
|
if (response.success && response.success === true) {
|
|
@@ -2519,14 +2542,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2519
2542
|
}, {
|
|
2520
2543
|
key: "processComponents",
|
|
2521
2544
|
value: function processComponents(components, callbackFn) {
|
|
2522
|
-
var
|
|
2545
|
+
var _this15 = this;
|
|
2523
2546
|
|
|
2524
2547
|
if (components.length === 0) {
|
|
2525
2548
|
callbackFn();
|
|
2526
2549
|
} else {
|
|
2527
2550
|
components.forEach(function (c) {
|
|
2528
2551
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
2529
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2552
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2530
2553
|
} else {// some user feedback here
|
|
2531
2554
|
}
|
|
2532
2555
|
});
|
|
@@ -2547,7 +2570,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2547
2570
|
}, {
|
|
2548
2571
|
key: "render",
|
|
2549
2572
|
value: function render(update, data) {
|
|
2550
|
-
var
|
|
2573
|
+
var _this16 = this;
|
|
2551
2574
|
|
|
2552
2575
|
var el = document.getElementById(this.elementId);
|
|
2553
2576
|
var componentsToProcess = [];
|
|
@@ -2557,11 +2580,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2557
2580
|
this.options.fields.forEach(function (f, i) {
|
|
2558
2581
|
if (f.component) {
|
|
2559
2582
|
componentsToProcess.push(f);
|
|
2560
|
-
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(
|
|
2583
|
+
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(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2561
2584
|
} else if (f.type === 'longtext') {
|
|
2562
|
-
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(
|
|
2585
|
+
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(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
2563
2586
|
} else {
|
|
2564
|
-
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(
|
|
2587
|
+
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(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
2565
2588
|
}
|
|
2566
2589
|
});
|
|
2567
2590
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -2578,7 +2601,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2578
2601
|
|
|
2579
2602
|
el.innerHTML = html;
|
|
2580
2603
|
this.processComponents(componentsToProcess, function () {
|
|
2581
|
-
if (
|
|
2604
|
+
if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
2582
2605
|
}
|
|
2583
2606
|
});
|
|
2584
2607
|
}
|
|
@@ -2586,7 +2609,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2586
2609
|
}, {
|
|
2587
2610
|
key: "submitForm",
|
|
2588
2611
|
value: function submitForm() {
|
|
2589
|
-
var
|
|
2612
|
+
var _this17 = this;
|
|
2590
2613
|
|
|
2591
2614
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2592
2615
|
|
|
@@ -2600,32 +2623,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2600
2623
|
data[key] = value;
|
|
2601
2624
|
});
|
|
2602
2625
|
|
|
2603
|
-
if (
|
|
2604
|
-
var
|
|
2626
|
+
if (_this17.options.url) {
|
|
2627
|
+
var _this17$apiService;
|
|
2605
2628
|
|
|
2606
|
-
var params = [
|
|
2629
|
+
var params = [_this17.options.url];
|
|
2607
2630
|
|
|
2608
|
-
if (
|
|
2609
|
-
params.push(
|
|
2631
|
+
if (_this17.options.mode === 'update') {
|
|
2632
|
+
params.push(_this17.options.id);
|
|
2610
2633
|
}
|
|
2611
2634
|
|
|
2612
2635
|
params.push(data);
|
|
2613
2636
|
|
|
2614
|
-
(
|
|
2615
|
-
if (
|
|
2637
|
+
(_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
|
|
2638
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2616
2639
|
// this.render()
|
|
2617
2640
|
formEl.reset();
|
|
2618
2641
|
}
|
|
2619
2642
|
|
|
2620
|
-
|
|
2643
|
+
_this17.options.onSuccess.call(_this17, result);
|
|
2621
2644
|
}, function (err) {
|
|
2622
2645
|
console.log('Error submitting form data:', err);
|
|
2623
2646
|
|
|
2624
|
-
|
|
2647
|
+
_this17.options.onError.call(_this17, err);
|
|
2625
2648
|
});
|
|
2626
|
-
} else if (
|
|
2627
|
-
|
|
2628
|
-
if (
|
|
2649
|
+
} else if (_this17.options.submitFn) {
|
|
2650
|
+
_this17.options.submitFn(data, function () {
|
|
2651
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2629
2652
|
// this.render()
|
|
2630
2653
|
formEl.reset();
|
|
2631
2654
|
}
|
|
@@ -2645,17 +2668,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2645
2668
|
}, {
|
|
2646
2669
|
key: "data",
|
|
2647
2670
|
set: function set(d) {
|
|
2648
|
-
var
|
|
2671
|
+
var _this18 = this;
|
|
2649
2672
|
|
|
2650
2673
|
if (!this.options.fields) {
|
|
2651
2674
|
this.options.fields = [];
|
|
2652
2675
|
}
|
|
2653
2676
|
|
|
2654
2677
|
var _loop = function _loop(key) {
|
|
2655
|
-
|
|
2678
|
+
_this18.options.fields.forEach(function (f) {
|
|
2656
2679
|
if (f.field === key) {
|
|
2657
2680
|
f.value = d[key];
|
|
2658
|
-
var el = document.getElementById("".concat(
|
|
2681
|
+
var el = document.getElementById("".concat(_this18.elementId, "_input_").concat(f.field));
|
|
2659
2682
|
el.value = f.value;
|
|
2660
2683
|
}
|
|
2661
2684
|
});
|
|
@@ -2923,11 +2946,11 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2923
2946
|
}, {
|
|
2924
2947
|
key: "handleSearch",
|
|
2925
2948
|
value: function handleSearch(searchText) {
|
|
2926
|
-
var
|
|
2949
|
+
var _this19 = this;
|
|
2927
2950
|
|
|
2928
2951
|
var el = document.getElementById(this.elementId);
|
|
2929
2952
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
2930
|
-
return d.level ===
|
|
2953
|
+
return d.level === _this19.maxLevel;
|
|
2931
2954
|
});
|
|
2932
2955
|
var visibleItems = lowestItems;
|
|
2933
2956
|
var defaultMethod = 'remove';
|
|
@@ -2935,7 +2958,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2935
2958
|
if (searchText.length > 1) {
|
|
2936
2959
|
defaultMethod = 'add';
|
|
2937
2960
|
visibleItems = lowestItems.filter(function (d) {
|
|
2938
|
-
return d[
|
|
2961
|
+
return d[_this19.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2939
2962
|
});
|
|
2940
2963
|
} // hide everything
|
|
2941
2964
|
|
|
@@ -3119,7 +3142,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3119
3142
|
|
|
3120
3143
|
var Pager = /*#__PURE__*/function () {
|
|
3121
3144
|
function Pager(elementId, options) {
|
|
3122
|
-
var
|
|
3145
|
+
var _this20 = this;
|
|
3123
3146
|
|
|
3124
3147
|
_classCallCheck(this, Pager);
|
|
3125
3148
|
|
|
@@ -3172,8 +3195,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3172
3195
|
allowClear: false,
|
|
3173
3196
|
disableSearch: true,
|
|
3174
3197
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3175
|
-
if (
|
|
3176
|
-
|
|
3198
|
+
if (_this20.options.onChangePageSize) {
|
|
3199
|
+
_this20.options.onChangePageSize(selectedItem.value);
|
|
3177
3200
|
}
|
|
3178
3201
|
}
|
|
3179
3202
|
});
|
|
@@ -3197,13 +3220,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3197
3220
|
}, {
|
|
3198
3221
|
key: "render",
|
|
3199
3222
|
value: function render() {
|
|
3200
|
-
var
|
|
3223
|
+
var _this21 = this;
|
|
3201
3224
|
|
|
3202
3225
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3203
3226
|
|
|
3204
3227
|
if (el) {
|
|
3205
3228
|
var pages = this.options.pages.map(function (item, index) {
|
|
3206
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3229
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this21.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3207
3230
|
});
|
|
3208
3231
|
var startIndex = 0;
|
|
3209
3232
|
|
|
@@ -3271,58 +3294,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3271
3294
|
_createClass(WebsyPDFButton, [{
|
|
3272
3295
|
key: "handleClick",
|
|
3273
3296
|
value: function handleClick(event) {
|
|
3274
|
-
var
|
|
3297
|
+
var _this22 = this;
|
|
3275
3298
|
|
|
3276
3299
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3277
3300
|
this.loader.show();
|
|
3278
3301
|
setTimeout(function () {
|
|
3279
|
-
if (
|
|
3280
|
-
var el = document.getElementById(
|
|
3302
|
+
if (_this22.options.targetId) {
|
|
3303
|
+
var el = document.getElementById(_this22.options.targetId);
|
|
3281
3304
|
|
|
3282
3305
|
if (el) {
|
|
3283
3306
|
var pdfData = {
|
|
3284
3307
|
options: {}
|
|
3285
3308
|
};
|
|
3286
3309
|
|
|
3287
|
-
if (
|
|
3288
|
-
pdfData.options = _extends({},
|
|
3310
|
+
if (_this22.options.pdfOptions) {
|
|
3311
|
+
pdfData.options = _extends({}, _this22.options.pdfOptions);
|
|
3289
3312
|
}
|
|
3290
3313
|
|
|
3291
|
-
if (
|
|
3292
|
-
if (
|
|
3293
|
-
var headerEl = document.getElementById(
|
|
3314
|
+
if (_this22.options.header) {
|
|
3315
|
+
if (_this22.options.header.elementId) {
|
|
3316
|
+
var headerEl = document.getElementById(_this22.options.header.elementId);
|
|
3294
3317
|
|
|
3295
3318
|
if (headerEl) {
|
|
3296
3319
|
pdfData.header = headerEl.outerHTML;
|
|
3297
3320
|
|
|
3298
|
-
if (
|
|
3299
|
-
pdfData.options.headerCSS =
|
|
3321
|
+
if (_this22.options.header.css) {
|
|
3322
|
+
pdfData.options.headerCSS = _this22.options.header.css;
|
|
3300
3323
|
}
|
|
3301
3324
|
}
|
|
3302
|
-
} else if (
|
|
3303
|
-
pdfData.header =
|
|
3325
|
+
} else if (_this22.options.header.html) {
|
|
3326
|
+
pdfData.header = _this22.options.header.html;
|
|
3304
3327
|
|
|
3305
|
-
if (
|
|
3306
|
-
pdfData.options.headerCSS =
|
|
3328
|
+
if (_this22.options.header.css) {
|
|
3329
|
+
pdfData.options.headerCSS = _this22.options.header.css;
|
|
3307
3330
|
}
|
|
3308
3331
|
} else {
|
|
3309
|
-
pdfData.header =
|
|
3332
|
+
pdfData.header = _this22.options.header;
|
|
3310
3333
|
}
|
|
3311
3334
|
}
|
|
3312
3335
|
|
|
3313
|
-
if (
|
|
3314
|
-
if (
|
|
3315
|
-
var footerEl = document.getElementById(
|
|
3336
|
+
if (_this22.options.footer) {
|
|
3337
|
+
if (_this22.options.footer.elementId) {
|
|
3338
|
+
var footerEl = document.getElementById(_this22.options.footer.elementId);
|
|
3316
3339
|
|
|
3317
3340
|
if (footerEl) {
|
|
3318
3341
|
pdfData.footer = footerEl.outerHTML;
|
|
3319
3342
|
|
|
3320
|
-
if (
|
|
3321
|
-
pdfData.options.footerCSS =
|
|
3343
|
+
if (_this22.options.footer.css) {
|
|
3344
|
+
pdfData.options.footerCSS = _this22.options.footer.css;
|
|
3322
3345
|
}
|
|
3323
3346
|
}
|
|
3324
3347
|
} else {
|
|
3325
|
-
pdfData.footer =
|
|
3348
|
+
pdfData.footer = _this22.options.footer;
|
|
3326
3349
|
}
|
|
3327
3350
|
}
|
|
3328
3351
|
|
|
@@ -3331,31 +3354,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3331
3354
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3332
3355
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3333
3356
|
|
|
3334
|
-
|
|
3357
|
+
_this22.service.add('', pdfData, {
|
|
3335
3358
|
responseType: 'blob'
|
|
3336
3359
|
}).then(function (response) {
|
|
3337
|
-
|
|
3360
|
+
_this22.loader.hide();
|
|
3338
3361
|
|
|
3339
3362
|
var blob = new Blob([response], {
|
|
3340
3363
|
type: 'application/pdf'
|
|
3341
3364
|
});
|
|
3342
3365
|
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 ");
|
|
3343
3366
|
|
|
3344
|
-
if (
|
|
3367
|
+
if (_this22.options.directDownload === true) {
|
|
3345
3368
|
var fileName;
|
|
3346
3369
|
|
|
3347
|
-
if (typeof
|
|
3348
|
-
fileName =
|
|
3370
|
+
if (typeof _this22.options.fileName === 'function') {
|
|
3371
|
+
fileName = _this22.options.fileName() || 'Export';
|
|
3349
3372
|
} else {
|
|
3350
|
-
fileName =
|
|
3373
|
+
fileName = _this22.options.fileName || 'Export';
|
|
3351
3374
|
}
|
|
3352
3375
|
|
|
3353
3376
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3354
3377
|
}
|
|
3355
3378
|
|
|
3356
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3379
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this22.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3357
3380
|
|
|
3358
|
-
|
|
3381
|
+
_this22.popup.show({
|
|
3359
3382
|
message: msg,
|
|
3360
3383
|
mask: true
|
|
3361
3384
|
});
|
|
@@ -3556,7 +3579,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3556
3579
|
|
|
3557
3580
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3558
3581
|
function ResponsiveText(elementId, options) {
|
|
3559
|
-
var
|
|
3582
|
+
var _this23 = this;
|
|
3560
3583
|
|
|
3561
3584
|
_classCallCheck(this, ResponsiveText);
|
|
3562
3585
|
|
|
@@ -3569,7 +3592,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3569
3592
|
this.elementId = elementId;
|
|
3570
3593
|
this.canvas = document.createElement('canvas');
|
|
3571
3594
|
window.addEventListener('resize', function () {
|
|
3572
|
-
return
|
|
3595
|
+
return _this23.render();
|
|
3573
3596
|
});
|
|
3574
3597
|
var el = document.getElementById(this.elementId);
|
|
3575
3598
|
|
|
@@ -3788,7 +3811,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3788
3811
|
|
|
3789
3812
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3790
3813
|
function WebsyResultList(elementId, options) {
|
|
3791
|
-
var
|
|
3814
|
+
var _this24 = this;
|
|
3792
3815
|
|
|
3793
3816
|
_classCallCheck(this, WebsyResultList);
|
|
3794
3817
|
|
|
@@ -3820,9 +3843,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3820
3843
|
|
|
3821
3844
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3822
3845
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3823
|
-
|
|
3846
|
+
_this24.options.template = templateString;
|
|
3824
3847
|
|
|
3825
|
-
|
|
3848
|
+
_this24.render();
|
|
3826
3849
|
});
|
|
3827
3850
|
} else {
|
|
3828
3851
|
this.render();
|
|
@@ -3842,7 +3865,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3842
3865
|
}, {
|
|
3843
3866
|
key: "buildHTML",
|
|
3844
3867
|
value: function buildHTML(d) {
|
|
3845
|
-
var
|
|
3868
|
+
var _this25 = this;
|
|
3846
3869
|
|
|
3847
3870
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3848
3871
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3852,7 +3875,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3852
3875
|
if (this.options.template) {
|
|
3853
3876
|
if (d.length > 0) {
|
|
3854
3877
|
d.forEach(function (row, ix) {
|
|
3855
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3878
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this25.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3856
3879
|
|
|
3857
3880
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3858
3881
|
|
|
@@ -3957,7 +3980,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3957
3980
|
parts.forEach(function (p) {
|
|
3958
3981
|
items = items[p];
|
|
3959
3982
|
});
|
|
3960
|
-
template = template.replace(m[0],
|
|
3983
|
+
template = template.replace(m[0], _this25.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3961
3984
|
}
|
|
3962
3985
|
});
|
|
3963
3986
|
|
|
@@ -3969,7 +3992,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3969
3992
|
}
|
|
3970
3993
|
});
|
|
3971
3994
|
|
|
3972
|
-
var flatRow =
|
|
3995
|
+
var flatRow = _this25.flattenObject(row);
|
|
3973
3996
|
|
|
3974
3997
|
for (var key in flatRow) {
|
|
3975
3998
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -4104,13 +4127,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4104
4127
|
}, {
|
|
4105
4128
|
key: "render",
|
|
4106
4129
|
value: function render() {
|
|
4107
|
-
var
|
|
4130
|
+
var _this26 = this;
|
|
4108
4131
|
|
|
4109
4132
|
if (this.options.entity) {
|
|
4110
4133
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
4111
|
-
|
|
4134
|
+
_this26.rows = results.rows;
|
|
4112
4135
|
|
|
4113
|
-
|
|
4136
|
+
_this26.resize();
|
|
4114
4137
|
});
|
|
4115
4138
|
} else {
|
|
4116
4139
|
this.resize();
|
|
@@ -4196,14 +4219,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4196
4219
|
_createClass(WebsyRouter, [{
|
|
4197
4220
|
key: "addGroup",
|
|
4198
4221
|
value: function addGroup(group) {
|
|
4199
|
-
var
|
|
4222
|
+
var _this27 = this;
|
|
4200
4223
|
|
|
4201
4224
|
if (!this.groups[group]) {
|
|
4202
4225
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4203
4226
|
|
|
4204
4227
|
if (els) {
|
|
4205
4228
|
this.getClosestParent(els[0], function (parent) {
|
|
4206
|
-
|
|
4229
|
+
_this27.groups[group] = {
|
|
4207
4230
|
activeView: '',
|
|
4208
4231
|
views: [],
|
|
4209
4232
|
parent: parent.getAttribute('data-view')
|
|
@@ -4266,7 +4289,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4266
4289
|
}, {
|
|
4267
4290
|
key: "removeUrlParams",
|
|
4268
4291
|
value: function removeUrlParams() {
|
|
4269
|
-
var
|
|
4292
|
+
var _this28 = this;
|
|
4270
4293
|
|
|
4271
4294
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4272
4295
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -4280,7 +4303,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4280
4303
|
|
|
4281
4304
|
if (this.currentParams && this.currentParams.items) {
|
|
4282
4305
|
params.forEach(function (p) {
|
|
4283
|
-
delete
|
|
4306
|
+
delete _this28.currentParams.items[p];
|
|
4284
4307
|
});
|
|
4285
4308
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4286
4309
|
}
|
|
@@ -4644,12 +4667,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4644
4667
|
}, {
|
|
4645
4668
|
key: "showComponents",
|
|
4646
4669
|
value: function showComponents(view) {
|
|
4647
|
-
var
|
|
4670
|
+
var _this29 = this;
|
|
4648
4671
|
|
|
4649
4672
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4650
4673
|
this.options.views[view].components.forEach(function (c) {
|
|
4651
4674
|
if (typeof c.instance === 'undefined') {
|
|
4652
|
-
|
|
4675
|
+
_this29.prepComponent(c.elementId, c.options);
|
|
4653
4676
|
|
|
4654
4677
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4655
4678
|
} else if (c.instance.render) {
|
|
@@ -5004,7 +5027,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5004
5027
|
}, {
|
|
5005
5028
|
key: "handleKeyUp",
|
|
5006
5029
|
value: function handleKeyUp(event) {
|
|
5007
|
-
var
|
|
5030
|
+
var _this30 = this;
|
|
5008
5031
|
|
|
5009
5032
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5010
5033
|
if (this.searchTimeoutFn) {
|
|
@@ -5023,8 +5046,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5023
5046
|
|
|
5024
5047
|
if (event.target.value.length >= this.options.minLength) {
|
|
5025
5048
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5026
|
-
if (
|
|
5027
|
-
|
|
5049
|
+
if (_this30.options.onSearch) {
|
|
5050
|
+
_this30.options.onSearch(event.target.value);
|
|
5028
5051
|
}
|
|
5029
5052
|
}, this.options.searchTimeout);
|
|
5030
5053
|
} else {
|
|
@@ -5186,7 +5209,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5186
5209
|
|
|
5187
5210
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5188
5211
|
function WebsyTemplate(elementId, options) {
|
|
5189
|
-
var
|
|
5212
|
+
var _this31 = this;
|
|
5190
5213
|
|
|
5191
5214
|
_classCallCheck(this, WebsyTemplate);
|
|
5192
5215
|
|
|
@@ -5212,9 +5235,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5212
5235
|
|
|
5213
5236
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5214
5237
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5215
|
-
|
|
5238
|
+
_this31.options.template = templateString;
|
|
5216
5239
|
|
|
5217
|
-
|
|
5240
|
+
_this31.render();
|
|
5218
5241
|
});
|
|
5219
5242
|
} else {
|
|
5220
5243
|
this.render();
|
|
@@ -5224,7 +5247,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5224
5247
|
_createClass(WebsyTemplate, [{
|
|
5225
5248
|
key: "buildHTML",
|
|
5226
5249
|
value: function buildHTML() {
|
|
5227
|
-
var
|
|
5250
|
+
var _this32 = this;
|
|
5228
5251
|
|
|
5229
5252
|
var html = "";
|
|
5230
5253
|
|
|
@@ -5286,14 +5309,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5286
5309
|
}
|
|
5287
5310
|
|
|
5288
5311
|
if (polarity === true) {
|
|
5289
|
-
if (typeof
|
|
5312
|
+
if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] === parts[1]) {
|
|
5290
5313
|
// remove the <if> tags
|
|
5291
5314
|
removeAll = false;
|
|
5292
5315
|
} else if (parts[0] === parts[1]) {
|
|
5293
5316
|
removeAll = false;
|
|
5294
5317
|
}
|
|
5295
5318
|
} else if (polarity === false) {
|
|
5296
|
-
if (typeof
|
|
5319
|
+
if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] !== parts[1]) {
|
|
5297
5320
|
// remove the <if> tags
|
|
5298
5321
|
removeAll = false;
|
|
5299
5322
|
}
|
|
@@ -5583,7 +5606,7 @@ var WebsyUtils = {
|
|
|
5583
5606
|
|
|
5584
5607
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5585
5608
|
function WebsyTable(elementId, options) {
|
|
5586
|
-
var
|
|
5609
|
+
var _this33 = this;
|
|
5587
5610
|
|
|
5588
5611
|
_classCallCheck(this, WebsyTable);
|
|
5589
5612
|
|
|
@@ -5621,8 +5644,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5621
5644
|
allowClear: false,
|
|
5622
5645
|
disableSearch: true,
|
|
5623
5646
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5624
|
-
if (
|
|
5625
|
-
|
|
5647
|
+
if (_this33.options.onChangePageSize) {
|
|
5648
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5626
5649
|
}
|
|
5627
5650
|
}
|
|
5628
5651
|
});
|
|
@@ -5643,7 +5666,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5643
5666
|
_createClass(WebsyTable, [{
|
|
5644
5667
|
key: "appendRows",
|
|
5645
5668
|
value: function appendRows(data) {
|
|
5646
|
-
var
|
|
5669
|
+
var _this34 = this;
|
|
5647
5670
|
|
|
5648
5671
|
this.hideError();
|
|
5649
5672
|
var bodyHTML = '';
|
|
@@ -5651,15 +5674,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5651
5674
|
if (data) {
|
|
5652
5675
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5653
5676
|
return '<tr>' + r.map(function (c, i) {
|
|
5654
|
-
if (
|
|
5677
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5655
5678
|
var style = '';
|
|
5656
5679
|
|
|
5657
5680
|
if (c.style) {
|
|
5658
5681
|
style += c.style;
|
|
5659
5682
|
}
|
|
5660
5683
|
|
|
5661
|
-
if (
|
|
5662
|
-
style += "width: ".concat(
|
|
5684
|
+
if (_this34.options.columns[i].width) {
|
|
5685
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5663
5686
|
}
|
|
5664
5687
|
|
|
5665
5688
|
if (c.backgroundColor) {
|
|
@@ -5674,18 +5697,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5674
5697
|
style += "color: ".concat(c.color, "; ");
|
|
5675
5698
|
}
|
|
5676
5699
|
|
|
5677
|
-
if (
|
|
5678
|
-
return "\n <td \n data-row-index='".concat(
|
|
5679
|
-
} else if ((
|
|
5680
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5700
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5701
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5702
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5703
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5681
5704
|
} else {
|
|
5682
5705
|
var info = c.value;
|
|
5683
5706
|
|
|
5684
|
-
if (
|
|
5707
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5685
5708
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5686
5709
|
}
|
|
5687
5710
|
|
|
5688
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5711
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
5689
5712
|
}
|
|
5690
5713
|
}
|
|
5691
5714
|
}).join('') + '</tr>';
|
|
@@ -5857,7 +5880,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5857
5880
|
}, {
|
|
5858
5881
|
key: "render",
|
|
5859
5882
|
value: function render(data) {
|
|
5860
|
-
var
|
|
5883
|
+
var _this35 = this;
|
|
5861
5884
|
|
|
5862
5885
|
if (!this.options.columns) {
|
|
5863
5886
|
return;
|
|
@@ -5892,7 +5915,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5892
5915
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5893
5916
|
}
|
|
5894
5917
|
|
|
5895
|
-
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 ?
|
|
5918
|
+
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 ? _this35.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5896
5919
|
}
|
|
5897
5920
|
}).join('') + '</tr>';
|
|
5898
5921
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5911,7 +5934,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5911
5934
|
|
|
5912
5935
|
if (pagingEl) {
|
|
5913
5936
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5914
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5937
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5915
5938
|
});
|
|
5916
5939
|
var startIndex = 0;
|
|
5917
5940
|
|
|
@@ -5979,7 +6002,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5979
6002
|
|
|
5980
6003
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5981
6004
|
function WebsyTable2(elementId, options) {
|
|
5982
|
-
var
|
|
6005
|
+
var _this36 = this;
|
|
5983
6006
|
|
|
5984
6007
|
_classCallCheck(this, WebsyTable2);
|
|
5985
6008
|
|
|
@@ -6020,8 +6043,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6020
6043
|
allowClear: false,
|
|
6021
6044
|
disableSearch: true,
|
|
6022
6045
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6023
|
-
if (
|
|
6024
|
-
|
|
6046
|
+
if (_this36.options.onChangePageSize) {
|
|
6047
|
+
_this36.options.onChangePageSize(selectedItem.value);
|
|
6025
6048
|
}
|
|
6026
6049
|
}
|
|
6027
6050
|
});
|
|
@@ -6045,7 +6068,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6045
6068
|
_createClass(WebsyTable2, [{
|
|
6046
6069
|
key: "appendRows",
|
|
6047
6070
|
value: function appendRows(data) {
|
|
6048
|
-
var
|
|
6071
|
+
var _this37 = this;
|
|
6049
6072
|
|
|
6050
6073
|
this.hideError();
|
|
6051
6074
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -6054,15 +6077,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6054
6077
|
if (data) {
|
|
6055
6078
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6056
6079
|
return '<tr>' + r.map(function (c, i) {
|
|
6057
|
-
if (
|
|
6058
|
-
var style = "height: ".concat(
|
|
6080
|
+
if (_this37.options.columns[i].show !== false) {
|
|
6081
|
+
var style = "height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px;");
|
|
6059
6082
|
|
|
6060
6083
|
if (c.style) {
|
|
6061
6084
|
style += c.style;
|
|
6062
6085
|
}
|
|
6063
6086
|
|
|
6064
|
-
if (
|
|
6065
|
-
style += "width: ".concat(
|
|
6087
|
+
if (_this37.options.columns[i].width) {
|
|
6088
|
+
style += "width: ".concat(_this37.options.columns[i].width, "; ");
|
|
6066
6089
|
}
|
|
6067
6090
|
|
|
6068
6091
|
if (c.backgroundColor) {
|
|
@@ -6077,18 +6100,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6077
6100
|
style += "color: ".concat(c.color, "; ");
|
|
6078
6101
|
}
|
|
6079
6102
|
|
|
6080
|
-
if (
|
|
6081
|
-
return "\n <td \n data-row-index='".concat(
|
|
6082
|
-
} else if ((
|
|
6083
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6103
|
+
if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6104
|
+
return "\n <td \n data-row-index='".concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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(_this37.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6105
|
+
} else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6106
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this37.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6084
6107
|
} else {
|
|
6085
6108
|
var info = c.value;
|
|
6086
6109
|
|
|
6087
|
-
if (
|
|
6110
|
+
if (_this37.options.columns[i].showAsImage === true) {
|
|
6088
6111
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6089
6112
|
}
|
|
6090
6113
|
|
|
6091
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6114
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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 ");
|
|
6092
6115
|
}
|
|
6093
6116
|
}
|
|
6094
6117
|
}).join('') + '</tr>';
|
|
@@ -6351,7 +6374,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6351
6374
|
}, {
|
|
6352
6375
|
key: "render",
|
|
6353
6376
|
value: function render(data) {
|
|
6354
|
-
var
|
|
6377
|
+
var _this38 = this;
|
|
6355
6378
|
|
|
6356
6379
|
if (!this.options.columns) {
|
|
6357
6380
|
return;
|
|
@@ -6387,7 +6410,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6387
6410
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6388
6411
|
}
|
|
6389
6412
|
|
|
6390
|
-
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 ?
|
|
6413
|
+
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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6391
6414
|
}
|
|
6392
6415
|
}).join('') + '</tr>';
|
|
6393
6416
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6398,7 +6421,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6398
6421
|
var dropdownHTML = "";
|
|
6399
6422
|
this.options.columns.forEach(function (c, i) {
|
|
6400
6423
|
if (c.searchable && c.searchField) {
|
|
6401
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6424
|
+
dropdownHTML += "\n <div id=\"".concat(_this38.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6402
6425
|
}
|
|
6403
6426
|
});
|
|
6404
6427
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6420,7 +6443,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6420
6443
|
|
|
6421
6444
|
if (pagingEl) {
|
|
6422
6445
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6423
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6446
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6424
6447
|
});
|
|
6425
6448
|
var startIndex = 0;
|
|
6426
6449
|
|
|
@@ -6511,7 +6534,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6511
6534
|
}, {
|
|
6512
6535
|
key: "getColumnParameters",
|
|
6513
6536
|
value: function getColumnParameters(values) {
|
|
6514
|
-
var
|
|
6537
|
+
var _this39 = this;
|
|
6515
6538
|
|
|
6516
6539
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6517
6540
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6519,10 +6542,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6519
6542
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6520
6543
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6521
6544
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6522
|
-
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 ?
|
|
6545
|
+
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 ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6523
6546
|
}).join('') + '</tr>';
|
|
6524
6547
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6525
|
-
return "\n <td \n style='height: ".concat(
|
|
6548
|
+
return "\n <td \n style='height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6526
6549
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6527
6550
|
|
|
6528
6551
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6744,7 +6767,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6744
6767
|
}, {
|
|
6745
6768
|
key: "buildHeaderHtml",
|
|
6746
6769
|
value: function buildHeaderHtml() {
|
|
6747
|
-
var
|
|
6770
|
+
var _this40 = this;
|
|
6748
6771
|
|
|
6749
6772
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6750
6773
|
var headerHtml = '';
|
|
@@ -6759,7 +6782,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6759
6782
|
}
|
|
6760
6783
|
|
|
6761
6784
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6762
|
-
if (useWidths === false && rowIndex !==
|
|
6785
|
+
if (useWidths === false && rowIndex !== _this40.options.columns.length - 1) {
|
|
6763
6786
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6764
6787
|
return;
|
|
6765
6788
|
}
|
|
@@ -6785,18 +6808,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6785
6808
|
// `
|
|
6786
6809
|
// }
|
|
6787
6810
|
|
|
6788
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6811
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this40.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6789
6812
|
});
|
|
6790
6813
|
headerHtml += "</tr>";
|
|
6791
6814
|
});
|
|
6792
6815
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6793
6816
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6794
6817
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6795
|
-
var testEl = document.getElementById("".concat(
|
|
6818
|
+
var testEl = document.getElementById("".concat(_this40.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6796
6819
|
|
|
6797
6820
|
if (!testEl) {
|
|
6798
6821
|
var newE = document.createElement('div');
|
|
6799
|
-
newE.id = "".concat(
|
|
6822
|
+
newE.id = "".concat(_this40.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6800
6823
|
newE.className = 'websy-modal-dropdown';
|
|
6801
6824
|
dropdownEl.appendChild(newE);
|
|
6802
6825
|
}
|
|
@@ -6812,7 +6835,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6812
6835
|
}, {
|
|
6813
6836
|
key: "buildTotalHtml",
|
|
6814
6837
|
value: function buildTotalHtml() {
|
|
6815
|
-
var
|
|
6838
|
+
var _this41 = this;
|
|
6816
6839
|
|
|
6817
6840
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6818
6841
|
|
|
@@ -6825,7 +6848,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6825
6848
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6826
6849
|
|
|
6827
6850
|
if (useWidths === true) {
|
|
6828
|
-
totalHtml += "\n style='width: ".concat(
|
|
6851
|
+
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 ");
|
|
6829
6852
|
}
|
|
6830
6853
|
|
|
6831
6854
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6836,7 +6859,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6836
6859
|
}, {
|
|
6837
6860
|
key: "calculateSizes",
|
|
6838
6861
|
value: function calculateSizes() {
|
|
6839
|
-
var
|
|
6862
|
+
var _this42 = this;
|
|
6840
6863
|
|
|
6841
6864
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6842
6865
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6879,32 +6902,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6879
6902
|
rows.forEach(function (row, rowIndex) {
|
|
6880
6903
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6881
6904
|
var colSize = col.getBoundingClientRect();
|
|
6882
|
-
|
|
6905
|
+
_this42.sizes.cellHeight = colSize.height;
|
|
6883
6906
|
|
|
6884
|
-
if (
|
|
6885
|
-
if (!
|
|
6886
|
-
|
|
6907
|
+
if (_this42.options.columns[_this42.options.columns.length - 1][colIndex]) {
|
|
6908
|
+
if (!_this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth) {
|
|
6909
|
+
_this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6887
6910
|
}
|
|
6888
6911
|
|
|
6889
|
-
|
|
6890
|
-
|
|
6912
|
+
_this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6913
|
+
_this42.options.columns[_this42.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6891
6914
|
|
|
6892
|
-
if (colIndex >=
|
|
6893
|
-
firstNonPinnedColumnWidth =
|
|
6915
|
+
if (colIndex >= _this42.pinnedColumns) {
|
|
6916
|
+
firstNonPinnedColumnWidth = _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth;
|
|
6894
6917
|
}
|
|
6895
6918
|
}
|
|
6896
6919
|
});
|
|
6897
6920
|
});
|
|
6898
6921
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6899
|
-
if (colIndex <
|
|
6900
|
-
|
|
6922
|
+
if (colIndex < _this42.pinnedColumns) {
|
|
6923
|
+
_this42.sizes.scrollableWidth -= col.actualWidth;
|
|
6901
6924
|
}
|
|
6902
6925
|
});
|
|
6903
6926
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6904
6927
|
return a + (b.width || b.actualWidth);
|
|
6905
6928
|
}, 0);
|
|
6906
6929
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6907
|
-
return i >=
|
|
6930
|
+
return i >= _this42.pinnedColumns;
|
|
6908
6931
|
}).reduce(function (a, b) {
|
|
6909
6932
|
return a + (b.width || b.actualWidth);
|
|
6910
6933
|
}, 0);
|
|
@@ -6925,10 +6948,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6925
6948
|
c.actualWidth += equalWidth; // }
|
|
6926
6949
|
// }
|
|
6927
6950
|
|
|
6928
|
-
|
|
6951
|
+
_this42.sizes.totalWidth += c.width || c.actualWidth;
|
|
6929
6952
|
|
|
6930
|
-
if (i <
|
|
6931
|
-
|
|
6953
|
+
if (i < _this42.pinnedColumns) {
|
|
6954
|
+
_this42.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6932
6955
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6933
6956
|
|
|
6934
6957
|
});
|
|
@@ -6985,7 +7008,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6985
7008
|
}, {
|
|
6986
7009
|
key: "createSample",
|
|
6987
7010
|
value: function createSample(data) {
|
|
6988
|
-
var
|
|
7011
|
+
var _this43 = this;
|
|
6989
7012
|
|
|
6990
7013
|
var output = [];
|
|
6991
7014
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6997,7 +7020,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6997
7020
|
var longest = '';
|
|
6998
7021
|
|
|
6999
7022
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7000
|
-
if (data[i].length ===
|
|
7023
|
+
if (data[i].length === _this43.options.columns[_this43.options.columns.length - 1].length) {
|
|
7001
7024
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7002
7025
|
longest = data[i][colIndex].value;
|
|
7003
7026
|
}
|
|
@@ -7392,7 +7415,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7392
7415
|
|
|
7393
7416
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7394
7417
|
function WebsyChart(elementId, options) {
|
|
7395
|
-
var
|
|
7418
|
+
var _this44 = this;
|
|
7396
7419
|
|
|
7397
7420
|
_classCallCheck(this, WebsyChart);
|
|
7398
7421
|
|
|
@@ -7443,22 +7466,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7443
7466
|
this.invertOverride = function (input, input2) {
|
|
7444
7467
|
var xAxis = 'bottomAxis';
|
|
7445
7468
|
|
|
7446
|
-
if (
|
|
7469
|
+
if (_this44.options.orientation === 'horizontal') {
|
|
7447
7470
|
xAxis = 'leftAxis';
|
|
7448
7471
|
}
|
|
7449
7472
|
|
|
7450
|
-
var width =
|
|
7473
|
+
var width = _this44[xAxis].step();
|
|
7451
7474
|
|
|
7452
7475
|
var output;
|
|
7453
7476
|
|
|
7454
|
-
var domain = _toConsumableArray(
|
|
7477
|
+
var domain = _toConsumableArray(_this44[xAxis].domain());
|
|
7455
7478
|
|
|
7456
|
-
if (
|
|
7479
|
+
if (_this44.options.orientation === 'horizontal') {
|
|
7457
7480
|
domain = domain.reverse();
|
|
7458
7481
|
}
|
|
7459
7482
|
|
|
7460
7483
|
for (var j = 0; j < domain.length; j++) {
|
|
7461
|
-
var breakA =
|
|
7484
|
+
var breakA = _this44[xAxis](domain[j]) - width / 2;
|
|
7462
7485
|
var breakB = breakA + width;
|
|
7463
7486
|
|
|
7464
7487
|
if (input > breakA && input <= breakB) {
|
|
@@ -7558,10 +7581,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7558
7581
|
}, {
|
|
7559
7582
|
key: "handleEventMouseMove",
|
|
7560
7583
|
value: function handleEventMouseMove(event, d) {
|
|
7561
|
-
var
|
|
7584
|
+
var _this45 = this;
|
|
7562
7585
|
|
|
7563
7586
|
var bisectDate = d3.bisector(function (d) {
|
|
7564
|
-
return
|
|
7587
|
+
return _this45.parseX(d.x.value);
|
|
7565
7588
|
}).left;
|
|
7566
7589
|
|
|
7567
7590
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7600,8 +7623,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7600
7623
|
}
|
|
7601
7624
|
|
|
7602
7625
|
this.options.data.series.forEach(function (s) {
|
|
7603
|
-
if (
|
|
7604
|
-
xPoint =
|
|
7626
|
+
if (_this45.options.data[xData].scale !== 'Time') {
|
|
7627
|
+
xPoint = _this45[xAxis](_this45.parseX(xLabel));
|
|
7605
7628
|
s.data.forEach(function (d) {
|
|
7606
7629
|
if (d.x.value === xLabel) {
|
|
7607
7630
|
if (!tooltipTitle) {
|
|
@@ -7620,13 +7643,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7620
7643
|
var pointA = s.data[index - 1];
|
|
7621
7644
|
var pointB = s.data[index];
|
|
7622
7645
|
|
|
7623
|
-
if (
|
|
7646
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7624
7647
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7625
7648
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7626
7649
|
}
|
|
7627
7650
|
|
|
7628
7651
|
if (pointA && !pointB) {
|
|
7629
|
-
xPoint =
|
|
7652
|
+
xPoint = _this45[xAxis](_this45.parseX(pointA.x.value));
|
|
7630
7653
|
tooltipTitle = pointA.x.value;
|
|
7631
7654
|
|
|
7632
7655
|
if (!pointA.y.color) {
|
|
@@ -7636,12 +7659,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7636
7659
|
tooltipData.push(pointA.y);
|
|
7637
7660
|
|
|
7638
7661
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7639
|
-
tooltipTitle = d3.timeFormat(
|
|
7662
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7640
7663
|
}
|
|
7641
7664
|
}
|
|
7642
7665
|
|
|
7643
7666
|
if (pointB && !pointA) {
|
|
7644
|
-
xPoint =
|
|
7667
|
+
xPoint = _this45[xAxis](_this45.parseX(pointB.x.value));
|
|
7645
7668
|
tooltipTitle = pointB.x.value;
|
|
7646
7669
|
|
|
7647
7670
|
if (!pointB.y.color) {
|
|
@@ -7651,14 +7674,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7651
7674
|
tooltipData.push(pointB.y);
|
|
7652
7675
|
|
|
7653
7676
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7654
|
-
tooltipTitle = d3.timeFormat(
|
|
7677
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7655
7678
|
}
|
|
7656
7679
|
}
|
|
7657
7680
|
|
|
7658
7681
|
if (pointA && pointB) {
|
|
7659
|
-
var d0 =
|
|
7682
|
+
var d0 = _this45[xAxis](_this45.parseX(pointA.x.value));
|
|
7660
7683
|
|
|
7661
|
-
var d1 =
|
|
7684
|
+
var d1 = _this45[xAxis](_this45.parseX(pointB.x.value));
|
|
7662
7685
|
|
|
7663
7686
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7664
7687
|
|
|
@@ -7667,7 +7690,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7667
7690
|
tooltipTitle = pointB.x.value;
|
|
7668
7691
|
|
|
7669
7692
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7670
|
-
tooltipTitle = d3.timeFormat(
|
|
7693
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7671
7694
|
}
|
|
7672
7695
|
|
|
7673
7696
|
if (!pointB.y.color) {
|
|
@@ -7680,7 +7703,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7680
7703
|
tooltipTitle = pointA.x.value;
|
|
7681
7704
|
|
|
7682
7705
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7683
|
-
tooltipTitle = d3.timeFormat(
|
|
7706
|
+
tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7684
7707
|
}
|
|
7685
7708
|
|
|
7686
7709
|
if (!pointA.y.color) {
|
|
@@ -7794,7 +7817,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7794
7817
|
}, {
|
|
7795
7818
|
key: "render",
|
|
7796
7819
|
value: function render(options) {
|
|
7797
|
-
var
|
|
7820
|
+
var _this46 = this;
|
|
7798
7821
|
|
|
7799
7822
|
/* global d3 options WebsyUtils */
|
|
7800
7823
|
if (typeof options !== 'undefined') {
|
|
@@ -7863,7 +7886,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7863
7886
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7864
7887
|
return {
|
|
7865
7888
|
value: s.label || s.key,
|
|
7866
|
-
color: s.color ||
|
|
7889
|
+
color: s.color || _this46.options.colors[i % _this46.options.colors.length]
|
|
7867
7890
|
};
|
|
7868
7891
|
});
|
|
7869
7892
|
|
|
@@ -8145,7 +8168,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8145
8168
|
|
|
8146
8169
|
if (this.options.data.bottom.formatter) {
|
|
8147
8170
|
bAxisFunc.tickFormat(function (d) {
|
|
8148
|
-
return
|
|
8171
|
+
return _this46.options.data.bottom.formatter(d);
|
|
8149
8172
|
});
|
|
8150
8173
|
}
|
|
8151
8174
|
|
|
@@ -8171,8 +8194,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8171
8194
|
|
|
8172
8195
|
if (this.options.margin.axisLeft > 0) {
|
|
8173
8196
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8174
|
-
if (
|
|
8175
|
-
d =
|
|
8197
|
+
if (_this46.options.data.left.formatter) {
|
|
8198
|
+
d = _this46.options.data.left.formatter(d);
|
|
8176
8199
|
}
|
|
8177
8200
|
|
|
8178
8201
|
return d;
|
|
@@ -8209,8 +8232,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8209
8232
|
|
|
8210
8233
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8211
8234
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8212
|
-
if (
|
|
8213
|
-
d =
|
|
8235
|
+
if (_this46.options.data.right.formatter) {
|
|
8236
|
+
d = _this46.options.data.right.formatter(d);
|
|
8214
8237
|
}
|
|
8215
8238
|
|
|
8216
8239
|
return d;
|
|
@@ -8249,18 +8272,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8249
8272
|
this.renderedKeys = {};
|
|
8250
8273
|
this.options.data.series.forEach(function (series, index) {
|
|
8251
8274
|
if (!series.key) {
|
|
8252
|
-
series.key =
|
|
8275
|
+
series.key = _this46.createIdentity();
|
|
8253
8276
|
}
|
|
8254
8277
|
|
|
8255
8278
|
if (!series.color) {
|
|
8256
|
-
series.color =
|
|
8279
|
+
series.color = _this46.options.colors[index % _this46.options.colors.length];
|
|
8257
8280
|
}
|
|
8258
8281
|
|
|
8259
|
-
|
|
8282
|
+
_this46["render".concat(series.type || 'bar')](series, index);
|
|
8260
8283
|
|
|
8261
|
-
|
|
8284
|
+
_this46.renderLabels(series, index);
|
|
8262
8285
|
|
|
8263
|
-
|
|
8286
|
+
_this46.renderedKeys[series.key] = series.type;
|
|
8264
8287
|
});
|
|
8265
8288
|
}
|
|
8266
8289
|
}
|
|
@@ -8268,17 +8291,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8268
8291
|
}, {
|
|
8269
8292
|
key: "renderarea",
|
|
8270
8293
|
value: function renderarea(series, index) {
|
|
8271
|
-
var
|
|
8294
|
+
var _this47 = this;
|
|
8272
8295
|
|
|
8273
8296
|
/* global d3 series index */
|
|
8274
8297
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8275
8298
|
return d3.area().x(function (d) {
|
|
8276
|
-
return
|
|
8299
|
+
return _this47[xAxis](_this47.parseX(d.x.value));
|
|
8277
8300
|
}).y0(function (d) {
|
|
8278
|
-
return
|
|
8301
|
+
return _this47[yAxis](0);
|
|
8279
8302
|
}).y1(function (d) {
|
|
8280
|
-
return
|
|
8281
|
-
}).curve(d3[curveStyle ||
|
|
8303
|
+
return _this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8304
|
+
}).curve(d3[curveStyle || _this47.options.curveStyle]);
|
|
8282
8305
|
};
|
|
8283
8306
|
|
|
8284
8307
|
var xAxis = 'bottomAxis';
|
|
@@ -8401,7 +8424,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8401
8424
|
}, {
|
|
8402
8425
|
key: "renderLabels",
|
|
8403
8426
|
value: function renderLabels(series, index) {
|
|
8404
|
-
var
|
|
8427
|
+
var _this48 = this;
|
|
8405
8428
|
|
|
8406
8429
|
/* global series index d3 WebsyDesigns */
|
|
8407
8430
|
var xAxis = 'bottomAxis';
|
|
@@ -8420,11 +8443,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8420
8443
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8421
8444
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8422
8445
|
labels.attr('x', function (d) {
|
|
8423
|
-
return getLabelX.call(
|
|
8446
|
+
return getLabelX.call(_this48, d, series.labelPosition);
|
|
8424
8447
|
}).attr('y', function (d) {
|
|
8425
|
-
return getLabelY.call(
|
|
8448
|
+
return getLabelY.call(_this48, d, series.labelPosition);
|
|
8426
8449
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8427
|
-
return
|
|
8450
|
+
return _this48.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8428
8451
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8429
8452
|
return d.y.label || d.y.value;
|
|
8430
8453
|
}).each(function (d, i) {
|
|
@@ -8449,11 +8472,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8449
8472
|
}
|
|
8450
8473
|
});
|
|
8451
8474
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8452
|
-
return getLabelX.call(
|
|
8475
|
+
return getLabelX.call(_this48, d, series.labelPosition);
|
|
8453
8476
|
}).attr('y', function (d) {
|
|
8454
|
-
return getLabelY.call(
|
|
8477
|
+
return getLabelY.call(_this48, d, series.labelPosition);
|
|
8455
8478
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8456
|
-
return
|
|
8479
|
+
return _this48.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8457
8480
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8458
8481
|
return d.y.label || d.y.value;
|
|
8459
8482
|
}).each(function (d, i) {
|
|
@@ -8510,16 +8533,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8510
8533
|
}, {
|
|
8511
8534
|
key: "renderline",
|
|
8512
8535
|
value: function renderline(series, index) {
|
|
8513
|
-
var
|
|
8536
|
+
var _this49 = this;
|
|
8514
8537
|
|
|
8515
8538
|
/* global series index d3 */
|
|
8516
8539
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8517
8540
|
return d3.line().x(function (d) {
|
|
8518
|
-
var adjustment =
|
|
8519
|
-
return
|
|
8541
|
+
var adjustment = _this49.options.data[xAxis].scale === 'Time' ? 0 : _this49["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8542
|
+
return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value)) + adjustment;
|
|
8520
8543
|
}).y(function (d) {
|
|
8521
|
-
return
|
|
8522
|
-
}).curve(d3[curveStyle ||
|
|
8544
|
+
return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8545
|
+
}).curve(d3[curveStyle || _this49.options.curveStyle]);
|
|
8523
8546
|
};
|
|
8524
8547
|
|
|
8525
8548
|
var xAxis = 'bottom';
|
|
@@ -8563,14 +8586,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8563
8586
|
}, {
|
|
8564
8587
|
key: "rendersymbol",
|
|
8565
8588
|
value: function rendersymbol(series, index) {
|
|
8566
|
-
var
|
|
8589
|
+
var _this50 = this;
|
|
8567
8590
|
|
|
8568
8591
|
/* global d3 series index series.key */
|
|
8569
8592
|
var drawSymbol = function drawSymbol(size) {
|
|
8570
8593
|
return d3.symbol() // .type(d => {
|
|
8571
8594
|
// return d3.symbols[0]
|
|
8572
8595
|
// })
|
|
8573
|
-
.size(size ||
|
|
8596
|
+
.size(size || _this50.options.symbolSize);
|
|
8574
8597
|
};
|
|
8575
8598
|
|
|
8576
8599
|
var xAxis = 'bottomAxis';
|
|
@@ -8588,7 +8611,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8588
8611
|
symbols.attr('d', function (d) {
|
|
8589
8612
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8590
8613
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8591
|
-
return "translate(".concat(
|
|
8614
|
+
return "translate(".concat(_this50[xAxis](_this50.parseX(d.x.value)), ", ").concat(_this50[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8592
8615
|
}); // Enter
|
|
8593
8616
|
|
|
8594
8617
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8597,7 +8620,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8597
8620
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8598
8621
|
return "symbol symbol_".concat(series.key);
|
|
8599
8622
|
}).attr('transform', function (d) {
|
|
8600
|
-
return "translate(".concat(
|
|
8623
|
+
return "translate(".concat(_this50[xAxis](_this50.parseX(d.x.value)), ", ").concat(_this50[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8601
8624
|
});
|
|
8602
8625
|
}
|
|
8603
8626
|
}, {
|
|
@@ -8752,7 +8775,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8752
8775
|
}, {
|
|
8753
8776
|
key: "resize",
|
|
8754
8777
|
value: function resize() {
|
|
8755
|
-
var
|
|
8778
|
+
var _this51 = this;
|
|
8756
8779
|
|
|
8757
8780
|
var el = document.getElementById(this.elementId);
|
|
8758
8781
|
|
|
@@ -8765,7 +8788,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8765
8788
|
// }
|
|
8766
8789
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8767
8790
|
html += this._data.map(function (d, i) {
|
|
8768
|
-
return
|
|
8791
|
+
return _this51.getLegendItemHTML(d);
|
|
8769
8792
|
}).join('');
|
|
8770
8793
|
html += "\n <div>\n ";
|
|
8771
8794
|
el.innerHTML = html;
|
|
@@ -8937,7 +8960,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8937
8960
|
}, {
|
|
8938
8961
|
key: "render",
|
|
8939
8962
|
value: function render() {
|
|
8940
|
-
var
|
|
8963
|
+
var _this52 = this;
|
|
8941
8964
|
|
|
8942
8965
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8943
8966
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8946,7 +8969,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8946
8969
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8947
8970
|
return {
|
|
8948
8971
|
value: s.label || s.key,
|
|
8949
|
-
color: s.color ||
|
|
8972
|
+
color: s.color || _this52.options.colors[i % _this52.options.colors.length]
|
|
8950
8973
|
};
|
|
8951
8974
|
});
|
|
8952
8975
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9010,7 +9033,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9010
9033
|
|
|
9011
9034
|
if (this.polygons) {
|
|
9012
9035
|
this.polygons.forEach(function (p) {
|
|
9013
|
-
return
|
|
9036
|
+
return _this52.map.removeLayer(p);
|
|
9014
9037
|
});
|
|
9015
9038
|
}
|
|
9016
9039
|
|
|
@@ -9068,18 +9091,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9068
9091
|
}
|
|
9069
9092
|
|
|
9070
9093
|
if (!p.options.color) {
|
|
9071
|
-
p.options.color =
|
|
9094
|
+
p.options.color = _this52.options.colors[i % _this52.options.colors.length];
|
|
9072
9095
|
}
|
|
9073
9096
|
|
|
9074
9097
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9075
9098
|
return c.map(function (d) {
|
|
9076
9099
|
return [d.Latitude, d.Longitude];
|
|
9077
9100
|
});
|
|
9078
|
-
}), p.options).addTo(
|
|
9101
|
+
}), p.options).addTo(_this52.map);
|
|
9079
9102
|
|
|
9080
|
-
|
|
9103
|
+
_this52.polygons.push(pol);
|
|
9081
9104
|
|
|
9082
|
-
|
|
9105
|
+
_this52.map.fitBounds(pol.getBounds());
|
|
9083
9106
|
});
|
|
9084
9107
|
} // if (this.data.markers.length > 0) {
|
|
9085
9108
|
// el.classList.remove('hidden')
|