@websy/websy-designs 1.9.14 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/authHelper.js +11 -11
- package/dist/server/helpers/v1/pgHelper.js +78 -7
- package/dist/server/routes/v1/api.js +26 -10
- package/dist/websy-designs-es6.debug.js +270 -110
- package/dist/websy-designs-es6.js +562 -368
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +280 -115
- package/dist/websy-designs.js +568 -373
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -84,6 +84,12 @@ var APIService = /*#__PURE__*/function () {
|
|
|
84
84
|
var url = this.buildUrl(entity, id);
|
|
85
85
|
return this.run('DELETE', url);
|
|
86
86
|
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "deleteMany",
|
|
89
|
+
value: function deleteMany(entity, query) {
|
|
90
|
+
var url = this.buildUrl(entity, null, query);
|
|
91
|
+
return this.run('DELETE', url);
|
|
92
|
+
}
|
|
87
93
|
}, {
|
|
88
94
|
key: "get",
|
|
89
95
|
value: function get(entity, id, query, offset, limit) {
|
|
@@ -95,11 +101,11 @@ var APIService = /*#__PURE__*/function () {
|
|
|
95
101
|
url += "?offset=".concat(offset);
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
if (limit) {
|
|
104
|
+
if (limit || this.options.rowLimit) {
|
|
99
105
|
if (url.indexOf('?') !== -1) {
|
|
100
|
-
url += "&limit=".concat(limit);
|
|
106
|
+
url += "&limit=".concat(limit || this.options.rowLimit);
|
|
101
107
|
} else {
|
|
102
|
-
url += "?limit=".concat(limit);
|
|
108
|
+
url += "?limit=".concat(limit || this.options.rowLimit);
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
return this.run('GET', url);
|
|
@@ -232,16 +238,52 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
232
238
|
}
|
|
233
239
|
}
|
|
234
240
|
_createClass(ButtonGroup, [{
|
|
241
|
+
key: "value",
|
|
242
|
+
get: function get() {
|
|
243
|
+
if (this.options.activeItem > -1) {
|
|
244
|
+
return [this.options.items[this.options.activeItem]];
|
|
245
|
+
} else if (this.options.multiSelect === true) {
|
|
246
|
+
return this.options.items.filter(function (d) {
|
|
247
|
+
return d.selected;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return [];
|
|
251
|
+
},
|
|
252
|
+
set: function set(value) {
|
|
253
|
+
var activeIndex = -1;
|
|
254
|
+
if (this.options.multiSelect === true) {
|
|
255
|
+
if (Array.isArray(value)) {
|
|
256
|
+
this.options.items.forEach(function (d) {
|
|
257
|
+
if (value.indexOf(d.value) !== -1) {
|
|
258
|
+
d.selected = true;
|
|
259
|
+
} else {
|
|
260
|
+
d.selected = false;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
for (var i = 0; i < this.options.items.length; i++) {
|
|
266
|
+
if ((this.options.items[i].value || this.options.items[i].label) === value) {
|
|
267
|
+
activeIndex = i;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
this.options.activeItem = activeIndex;
|
|
271
|
+
}
|
|
272
|
+
this.render();
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
235
275
|
key: "handleClick",
|
|
236
276
|
value: function handleClick(event) {
|
|
237
277
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
238
278
|
var index = +event.target.getAttribute('data-index');
|
|
239
279
|
if (this.options.multiSelect === true) {
|
|
240
280
|
if (event.target.classList.contains('active')) {
|
|
281
|
+
this.options.items[index].selected = false;
|
|
241
282
|
this.options.onDeactivate(this.options.items[index], index, event);
|
|
242
283
|
event.target.classList.remove('active');
|
|
243
284
|
event.target.classList.add('inactive');
|
|
244
285
|
} else {
|
|
286
|
+
this.options.items[index].selected = true;
|
|
245
287
|
this.options.onActivate(this.options.items[index], index, event);
|
|
246
288
|
event.target.classList.add('active');
|
|
247
289
|
event.target.classList.remove('inactive');
|
|
@@ -297,6 +339,8 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
297
339
|
var activeClass = '';
|
|
298
340
|
if (_this.options.activeItem !== -1) {
|
|
299
341
|
activeClass = i === _this.options.activeItem ? 'active' : 'inactive';
|
|
342
|
+
} else if (_this.options.multiSelect === true) {
|
|
343
|
+
activeClass = t.selected === true ? 'active' : 'inactive';
|
|
300
344
|
}
|
|
301
345
|
return "\n <".concat(_this.options.tag, " ").concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(activeClass, "\">").concat(t.label, "</").concat(_this.options.tag, ">\n ");
|
|
302
346
|
}).join('');
|
|
@@ -315,7 +359,8 @@ var WebsyCarousel = /*#__PURE__*/function () {
|
|
|
315
359
|
showFrameSelector: true,
|
|
316
360
|
showPrevNext: true,
|
|
317
361
|
autoPlay: true,
|
|
318
|
-
frames: []
|
|
362
|
+
frames: [],
|
|
363
|
+
frameSelectorIcon: "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 512 512\">\n <circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n "
|
|
319
364
|
};
|
|
320
365
|
this.playTimeoutFn = null;
|
|
321
366
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -427,7 +472,7 @@ var WebsyCarousel = /*#__PURE__*/function () {
|
|
|
427
472
|
if (this.options.showFrameSelector === true && this.options.frames.length > 1) {
|
|
428
473
|
html += "<div class=\"websy-btn-parent\">";
|
|
429
474
|
this.options.frames.forEach(function (frame, frameIndex) {
|
|
430
|
-
html += "\n
|
|
475
|
+
html += "\n <div data-index=\"".concat(frameIndex, "\" id=\"").concat(_this3.elementId, "_selector_").concat(frameIndex, "\" \n class=\"websy-progress-btn ").concat(_this3.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : '', "\">\n ").concat(_this3.options.frameSelectorIcon, "\n </div>\n ");
|
|
431
476
|
});
|
|
432
477
|
html += "</div>";
|
|
433
478
|
}
|
|
@@ -1722,6 +1767,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1722
1767
|
var contentPos = WebsyUtils.getElementPos(contentEl);
|
|
1723
1768
|
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1724
1769
|
contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
|
|
1770
|
+
contentEl.style.width = "".concat(headerEl.clientWidth, "px");
|
|
1725
1771
|
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
1726
1772
|
// contentEl.classList.add('on-top')
|
|
1727
1773
|
contentEl.style.bottom = "calc(100vh - ".concat(headerPos.top, "px)");
|
|
@@ -1731,6 +1777,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1731
1777
|
} else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
|
|
1732
1778
|
var targetPos = WebsyUtils.getElementPos(event.target);
|
|
1733
1779
|
contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
|
|
1780
|
+
contentEl.style.width = "".concat(targetPos.width, "px");
|
|
1734
1781
|
}
|
|
1735
1782
|
if (this.options.disableSearch !== true) {
|
|
1736
1783
|
var searchEl = document.getElementById("".concat(this.elementId, "_search"));
|
|
@@ -1742,6 +1789,21 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1742
1789
|
this.options.onOpen(this.elementId);
|
|
1743
1790
|
}
|
|
1744
1791
|
}
|
|
1792
|
+
}, {
|
|
1793
|
+
key: "items",
|
|
1794
|
+
set: function set(items) {
|
|
1795
|
+
this.options.items = _toConsumableArray(items);
|
|
1796
|
+
if (this.options.items.length > 0) {
|
|
1797
|
+
this.options.items = this.options.items.map(function (d, i) {
|
|
1798
|
+
if (typeof d.index === 'undefined') {
|
|
1799
|
+
d.index = i;
|
|
1800
|
+
}
|
|
1801
|
+
return d;
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
this._originalData = _toConsumableArray(this.options.items);
|
|
1805
|
+
this.render();
|
|
1806
|
+
}
|
|
1745
1807
|
}, {
|
|
1746
1808
|
key: "render",
|
|
1747
1809
|
value: function render() {
|
|
@@ -2244,9 +2306,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2244
2306
|
};
|
|
2245
2307
|
GlobalPubSub.subscribe('recaptchaready', this.recaptchaReady.bind(this));
|
|
2246
2308
|
this.recaptchaResult = null;
|
|
2247
|
-
this.options = _extends(
|
|
2248
|
-
// defaults go here
|
|
2249
|
-
}, options);
|
|
2309
|
+
this.options = _extends({}, defaults, options);
|
|
2250
2310
|
if (!elementId) {
|
|
2251
2311
|
console.log('No element Id provided');
|
|
2252
2312
|
return;
|
|
@@ -2320,23 +2380,41 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2320
2380
|
}, {
|
|
2321
2381
|
key: "data",
|
|
2322
2382
|
get: function get() {
|
|
2383
|
+
var _this16 = this;
|
|
2323
2384
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2324
2385
|
var data = {};
|
|
2325
2386
|
var temp = new FormData(formEl);
|
|
2326
2387
|
temp.forEach(function (value, key) {
|
|
2327
|
-
|
|
2388
|
+
if (_this16.fieldMap[key] && _this16.fieldMap[key].type === 'checkbox') {
|
|
2389
|
+
data[key] = true;
|
|
2390
|
+
}
|
|
2391
|
+
if (_this16.fieldMap[key] && _this16.fieldMap[key].instance && _this16.fieldMap[key].instance.value) {
|
|
2392
|
+
data[key] = _this16.fieldMap[key].instance.value;
|
|
2393
|
+
} else {
|
|
2394
|
+
data[key] = value;
|
|
2395
|
+
}
|
|
2328
2396
|
});
|
|
2397
|
+
var keys = Object.keys(data);
|
|
2398
|
+
for (var key in this.fieldMap) {
|
|
2399
|
+
if (keys.indexOf(key) === -1) {
|
|
2400
|
+
if (this.fieldMap[key] && this.fieldMap[key].type === 'checkbox') {
|
|
2401
|
+
data[key] = false;
|
|
2402
|
+
} else if (this.fieldMap[key] && this.fieldMap[key].instance && this.fieldMap[key].instance.value) {
|
|
2403
|
+
data[key] = this.fieldMap[key].instance.value;
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2329
2407
|
return data;
|
|
2330
2408
|
},
|
|
2331
2409
|
set: function set(d) {
|
|
2332
|
-
var
|
|
2410
|
+
var _this17 = this;
|
|
2333
2411
|
if (!this.options.fields) {
|
|
2334
2412
|
this.options.fields = [];
|
|
2335
2413
|
}
|
|
2336
2414
|
var _loop = function _loop(key) {
|
|
2337
|
-
|
|
2415
|
+
_this17.options.fields.forEach(function (f) {
|
|
2338
2416
|
if (f.field === key) {
|
|
2339
|
-
|
|
2417
|
+
_this17.setValue(key, d[key]);
|
|
2340
2418
|
// f.value = d[key]
|
|
2341
2419
|
// const el = document.getElementById(`${this.elementId}_input_${f.field}`)
|
|
2342
2420
|
// if (el) {
|
|
@@ -2395,6 +2473,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2395
2473
|
value: function handleClick(event) {
|
|
2396
2474
|
if (event.target.classList.contains('submit')) {
|
|
2397
2475
|
event.preventDefault();
|
|
2476
|
+
event.stopPropagation();
|
|
2398
2477
|
this.submitForm();
|
|
2399
2478
|
} else if (event.target.classList.contains('cancel')) {
|
|
2400
2479
|
event.preventDefault();
|
|
@@ -2536,7 +2615,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2536
2615
|
}, {
|
|
2537
2616
|
key: "processComponents",
|
|
2538
2617
|
value: function processComponents(components, callbackFn) {
|
|
2539
|
-
var
|
|
2618
|
+
var _this18 = this;
|
|
2540
2619
|
if (components.length === 0) {
|
|
2541
2620
|
callbackFn();
|
|
2542
2621
|
} else {
|
|
@@ -2545,11 +2624,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2545
2624
|
if (!c.options.onChange) {
|
|
2546
2625
|
c.options.onChange = function () {
|
|
2547
2626
|
if (c.required || c.validate) {
|
|
2548
|
-
|
|
2627
|
+
_this18.validateField(c, c.instance.value);
|
|
2549
2628
|
}
|
|
2550
2629
|
};
|
|
2551
2630
|
}
|
|
2552
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2631
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this18.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2553
2632
|
} else {
|
|
2554
2633
|
// some user feedback here
|
|
2555
2634
|
}
|
|
@@ -2559,13 +2638,13 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2559
2638
|
}, {
|
|
2560
2639
|
key: "recaptchaReady",
|
|
2561
2640
|
value: function recaptchaReady() {
|
|
2562
|
-
var
|
|
2641
|
+
var _this19 = this;
|
|
2563
2642
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2564
2643
|
if (el) {
|
|
2565
2644
|
grecaptcha.ready(function () {
|
|
2566
|
-
grecaptcha.render("".concat(
|
|
2645
|
+
grecaptcha.render("".concat(_this19.elementId, "_recaptcha"), {
|
|
2567
2646
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2568
|
-
callback:
|
|
2647
|
+
callback: _this19.validateRecaptcha.bind(_this19)
|
|
2569
2648
|
});
|
|
2570
2649
|
});
|
|
2571
2650
|
}
|
|
@@ -2573,20 +2652,21 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2573
2652
|
}, {
|
|
2574
2653
|
key: "render",
|
|
2575
2654
|
value: function render(update, data) {
|
|
2576
|
-
var
|
|
2655
|
+
var _this20 = this;
|
|
2577
2656
|
var el = document.getElementById(this.elementId);
|
|
2578
2657
|
var componentsToProcess = [];
|
|
2579
2658
|
if (el) {
|
|
2580
2659
|
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
|
|
2581
2660
|
this.options.fields.forEach(function (f, i) {
|
|
2582
|
-
|
|
2661
|
+
_this20.fieldMap[f.field] = f;
|
|
2662
|
+
f.owningElement = _this20.elementId;
|
|
2583
2663
|
if (f.component) {
|
|
2584
2664
|
componentsToProcess.push(f);
|
|
2585
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2665
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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(_this20.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2586
2666
|
} else if (f.type === 'longtext') {
|
|
2587
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2667
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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(_this20.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(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2588
2668
|
} else {
|
|
2589
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2669
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\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(_this20.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(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2590
2670
|
}
|
|
2591
2671
|
});
|
|
2592
2672
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2599,8 +2679,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2599
2679
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2600
2680
|
el.innerHTML = html;
|
|
2601
2681
|
this.processComponents(componentsToProcess, function () {
|
|
2602
|
-
if (
|
|
2603
|
-
|
|
2682
|
+
if (_this20.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2683
|
+
_this20.recaptchaReady();
|
|
2604
2684
|
}
|
|
2605
2685
|
});
|
|
2606
2686
|
}
|
|
@@ -2615,6 +2695,10 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2615
2695
|
var el = document.getElementById("".concat(this.elementId, "_input_").concat(field));
|
|
2616
2696
|
if (el) {
|
|
2617
2697
|
el.value = value;
|
|
2698
|
+
el.setAttribute('value', value);
|
|
2699
|
+
if (this.fieldMap[field].type === 'checkbox') {
|
|
2700
|
+
el.checked = value;
|
|
2701
|
+
}
|
|
2618
2702
|
} else {
|
|
2619
2703
|
console.error("Input for ".concat(field, " does not exist in form."));
|
|
2620
2704
|
}
|
|
@@ -2626,7 +2710,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2626
2710
|
}, {
|
|
2627
2711
|
key: "submitForm",
|
|
2628
2712
|
value: function submitForm() {
|
|
2629
|
-
var
|
|
2713
|
+
var _this21 = this;
|
|
2630
2714
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2631
2715
|
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2632
2716
|
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
@@ -2651,27 +2735,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2651
2735
|
temp.forEach(function (value, key) {
|
|
2652
2736
|
data[key] = value;
|
|
2653
2737
|
});
|
|
2654
|
-
if (
|
|
2655
|
-
var
|
|
2656
|
-
var params = [
|
|
2657
|
-
if (
|
|
2658
|
-
params.push(
|
|
2738
|
+
if (_this21.options.url) {
|
|
2739
|
+
var _this21$apiService;
|
|
2740
|
+
var params = [_this21.options.url];
|
|
2741
|
+
if (_this21.options.mode === 'update') {
|
|
2742
|
+
params.push(_this21.options.id);
|
|
2659
2743
|
}
|
|
2660
2744
|
params.push(data);
|
|
2661
|
-
(
|
|
2662
|
-
if (
|
|
2745
|
+
(_this21$apiService = _this21.apiService)[_this21.options.mode].apply(_this21$apiService, params).then(function (result) {
|
|
2746
|
+
if (_this21.options.clearAfterSave === true) {
|
|
2663
2747
|
// this.render()
|
|
2664
2748
|
formEl.reset();
|
|
2665
2749
|
}
|
|
2666
2750
|
buttonEl.removeAttribute('disabled');
|
|
2667
|
-
|
|
2751
|
+
_this21.options.onSuccess.call(_this21, result);
|
|
2668
2752
|
}, function (err) {
|
|
2669
2753
|
console.log('Error submitting form data:', err);
|
|
2670
|
-
|
|
2754
|
+
_this21.options.onError.call(_this21, err);
|
|
2671
2755
|
});
|
|
2672
|
-
} else if (
|
|
2673
|
-
|
|
2674
|
-
if (
|
|
2756
|
+
} else if (_this21.options.submitFn) {
|
|
2757
|
+
_this21.options.submitFn(data, function () {
|
|
2758
|
+
if (_this21.options.clearAfterSave === true) {
|
|
2675
2759
|
// this.render()
|
|
2676
2760
|
formEl.reset();
|
|
2677
2761
|
}
|
|
@@ -2778,6 +2862,12 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2778
2862
|
this.render();
|
|
2779
2863
|
}
|
|
2780
2864
|
_createClass(MultiForm, [{
|
|
2865
|
+
key: "addData",
|
|
2866
|
+
value: function addData(data) {
|
|
2867
|
+
this.formData = this.formData.concat(data);
|
|
2868
|
+
this.render();
|
|
2869
|
+
}
|
|
2870
|
+
}, {
|
|
2781
2871
|
key: "addEntry",
|
|
2782
2872
|
value: function addEntry() {
|
|
2783
2873
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -2787,7 +2877,11 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2787
2877
|
newFormEl.classList.add('websy-multi-form-form-container');
|
|
2788
2878
|
newFormEl.innerHTML = "\n <div id='".concat(this.elementId, "_").concat(newId, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(newId, "_deleteButton' data-formid='").concat(newId, "' class='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(newId, "_addButton' data-formid='").concat(newId, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n ");
|
|
2789
2879
|
el.appendChild(newFormEl);
|
|
2790
|
-
var formOptions = _extends({}, this.options
|
|
2880
|
+
var formOptions = _extends({}, this.options, {
|
|
2881
|
+
fields: _toConsumableArray(this.options.fields.map(function (f) {
|
|
2882
|
+
return _extends({}, f);
|
|
2883
|
+
}))
|
|
2884
|
+
});
|
|
2791
2885
|
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
|
|
2792
2886
|
}
|
|
2793
2887
|
}, {
|
|
@@ -2807,14 +2901,25 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2807
2901
|
var d = this.forms.map(function (f) {
|
|
2808
2902
|
return f.data;
|
|
2809
2903
|
});
|
|
2810
|
-
|
|
2811
|
-
|
|
2904
|
+
console.log('forms data', d);
|
|
2905
|
+
if (this.options.allowAdd !== false) {
|
|
2906
|
+
// we don't return the last form
|
|
2907
|
+
d.pop();
|
|
2908
|
+
}
|
|
2812
2909
|
return d;
|
|
2813
2910
|
},
|
|
2814
2911
|
set: function set(d) {
|
|
2815
2912
|
this.formData = d;
|
|
2816
2913
|
this.render();
|
|
2817
2914
|
}
|
|
2915
|
+
}, {
|
|
2916
|
+
key: "deleted",
|
|
2917
|
+
get: function get() {
|
|
2918
|
+
var _this22 = this;
|
|
2919
|
+
return this.formData.filter(function (d) {
|
|
2920
|
+
return _this22.recordsToDelete.includes("".concat(d.id));
|
|
2921
|
+
});
|
|
2922
|
+
}
|
|
2818
2923
|
}, {
|
|
2819
2924
|
key: "handleClick",
|
|
2820
2925
|
value: function handleClick(event) {
|
|
@@ -2859,7 +2964,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2859
2964
|
}, {
|
|
2860
2965
|
key: "render",
|
|
2861
2966
|
value: function render() {
|
|
2862
|
-
var
|
|
2967
|
+
var _this23 = this;
|
|
2863
2968
|
this.forms = [];
|
|
2864
2969
|
this.recordsToDelete = [];
|
|
2865
2970
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -2867,9 +2972,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2867
2972
|
var html = '';
|
|
2868
2973
|
this.formData.forEach(function (d) {
|
|
2869
2974
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2870
|
-
html += "\n <div id='".concat(
|
|
2871
|
-
if (
|
|
2872
|
-
html += "\n <button id='".concat(
|
|
2975
|
+
html += "\n <div id='".concat(_this23.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this23.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
2976
|
+
if (_this23.options.allowDelete === true) {
|
|
2977
|
+
html += "\n <button id='".concat(_this23.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this23.options.deleteButton, "\n </button>\n ");
|
|
2873
2978
|
}
|
|
2874
2979
|
html += "\n </div>\n ";
|
|
2875
2980
|
});
|
|
@@ -2878,15 +2983,25 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2878
2983
|
html += "\n <div id='".concat(this.elementId, "_").concat(id, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(this.elementId, "_").concat(id, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(id, "_deleteButton' data-formid='").concat(id, "' class='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(id, "_addButton' data-formid='").concat(id, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n </div>\n ");
|
|
2879
2984
|
}
|
|
2880
2985
|
el.innerHTML = html;
|
|
2881
|
-
this.formData.
|
|
2882
|
-
|
|
2883
|
-
var
|
|
2986
|
+
this.forms = new Array(this.formData.length);
|
|
2987
|
+
this.formData.forEach(function (d, i) {
|
|
2988
|
+
var formOptions = _extends({}, _this23.options, {
|
|
2989
|
+
fields: _toConsumableArray(_this23.options.fields.map(function (f) {
|
|
2990
|
+
return _extends({}, f);
|
|
2991
|
+
}))
|
|
2992
|
+
});
|
|
2993
|
+
var formObject = new WebsyDesigns.Form("".concat(_this23.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
2884
2994
|
formObject.data = d;
|
|
2885
|
-
|
|
2995
|
+
_this23.forms[i] = formObject;
|
|
2886
2996
|
});
|
|
2887
2997
|
if (this.options.allowAdd === true) {
|
|
2888
|
-
var formOptions = _extends({}, this.options
|
|
2889
|
-
|
|
2998
|
+
var formOptions = _extends({}, this.options, {
|
|
2999
|
+
fields: _toConsumableArray(this.options.fields.map(function (f) {
|
|
3000
|
+
return _extends({}, f);
|
|
3001
|
+
}))
|
|
3002
|
+
});
|
|
3003
|
+
var formObject = new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions);
|
|
3004
|
+
this.forms.push(formObject);
|
|
2890
3005
|
}
|
|
2891
3006
|
}
|
|
2892
3007
|
}
|
|
@@ -3174,7 +3289,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3174
3289
|
}, {
|
|
3175
3290
|
key: "handleSearch",
|
|
3176
3291
|
value: function handleSearch(searchText) {
|
|
3177
|
-
var
|
|
3292
|
+
var _this24 = this;
|
|
3178
3293
|
var el = document.getElementById(this.elementId);
|
|
3179
3294
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3180
3295
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -3185,7 +3300,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3185
3300
|
if (searchText && searchText.length > 1) {
|
|
3186
3301
|
defaultMethod = 'add';
|
|
3187
3302
|
visibleItems = lowestItems.filter(function (d) {
|
|
3188
|
-
return d[
|
|
3303
|
+
return d[_this24.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
3189
3304
|
});
|
|
3190
3305
|
}
|
|
3191
3306
|
// hide everything
|
|
@@ -3367,7 +3482,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3367
3482
|
/* global WebsyDesigns */
|
|
3368
3483
|
var Pager = /*#__PURE__*/function () {
|
|
3369
3484
|
function Pager(elementId, options) {
|
|
3370
|
-
var
|
|
3485
|
+
var _this25 = this;
|
|
3371
3486
|
_classCallCheck(this, Pager);
|
|
3372
3487
|
this.elementId = elementId;
|
|
3373
3488
|
var DEFAULTS = {
|
|
@@ -3414,8 +3529,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3414
3529
|
allowClear: false,
|
|
3415
3530
|
disableSearch: true,
|
|
3416
3531
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3417
|
-
if (
|
|
3418
|
-
|
|
3532
|
+
if (_this25.options.onChangePageSize) {
|
|
3533
|
+
_this25.options.onChangePageSize(selectedItem.value);
|
|
3419
3534
|
}
|
|
3420
3535
|
}
|
|
3421
3536
|
});
|
|
@@ -3436,11 +3551,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3436
3551
|
}, {
|
|
3437
3552
|
key: "render",
|
|
3438
3553
|
value: function render() {
|
|
3439
|
-
var
|
|
3554
|
+
var _this26 = this;
|
|
3440
3555
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3441
3556
|
if (el) {
|
|
3442
3557
|
var pages = this.options.pages.map(function (item, index) {
|
|
3443
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3558
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this26.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3444
3559
|
});
|
|
3445
3560
|
var startIndex = 0;
|
|
3446
3561
|
if (this.options.pages.length > 8) {
|
|
@@ -3470,7 +3585,11 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3470
3585
|
classes: [],
|
|
3471
3586
|
wait: 0,
|
|
3472
3587
|
buttonText: 'Download',
|
|
3473
|
-
directDownload: false
|
|
3588
|
+
directDownload: false,
|
|
3589
|
+
preProcess: function preProcess(callbackFn) {
|
|
3590
|
+
return callbackFn(true);
|
|
3591
|
+
},
|
|
3592
|
+
onError: function onError() {}
|
|
3474
3593
|
};
|
|
3475
3594
|
this.elementId = elementId;
|
|
3476
3595
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -3498,83 +3617,90 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3498
3617
|
_createClass(WebsyPDFButton, [{
|
|
3499
3618
|
key: "handleClick",
|
|
3500
3619
|
value: function handleClick(event) {
|
|
3501
|
-
var
|
|
3620
|
+
var _this27 = this;
|
|
3502
3621
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3503
3622
|
this.loader.show();
|
|
3504
|
-
|
|
3505
|
-
if (
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
if (_this25.options.header.elementId) {
|
|
3516
|
-
var headerEl = document.getElementById(_this25.options.header.elementId);
|
|
3517
|
-
if (headerEl) {
|
|
3518
|
-
pdfData.header = headerEl.outerHTML;
|
|
3519
|
-
if (_this25.options.header.css) {
|
|
3520
|
-
pdfData.options.headerCSS = _this25.options.header.css;
|
|
3521
|
-
}
|
|
3623
|
+
this.options.preProcess(function (proceed) {
|
|
3624
|
+
if (proceed === true) {
|
|
3625
|
+
setTimeout(function () {
|
|
3626
|
+
if (_this27.options.targetId) {
|
|
3627
|
+
var el = document.getElementById(_this27.options.targetId);
|
|
3628
|
+
if (el) {
|
|
3629
|
+
var pdfData = {
|
|
3630
|
+
options: {}
|
|
3631
|
+
};
|
|
3632
|
+
if (_this27.options.pdfOptions) {
|
|
3633
|
+
pdfData.options = _extends({}, _this27.options.pdfOptions);
|
|
3522
3634
|
}
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3635
|
+
if (_this27.options.header) {
|
|
3636
|
+
if (_this27.options.header.elementId) {
|
|
3637
|
+
var headerEl = document.getElementById(_this27.options.header.elementId);
|
|
3638
|
+
if (headerEl) {
|
|
3639
|
+
pdfData.header = headerEl.outerHTML;
|
|
3640
|
+
if (_this27.options.header.css) {
|
|
3641
|
+
pdfData.options.headerCSS = _this27.options.header.css;
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
} else if (_this27.options.header.html) {
|
|
3645
|
+
pdfData.header = _this27.options.header.html;
|
|
3646
|
+
if (_this27.options.header.css) {
|
|
3647
|
+
pdfData.options.headerCSS = _this27.options.header.css;
|
|
3648
|
+
}
|
|
3649
|
+
} else {
|
|
3650
|
+
pdfData.header = _this27.options.header;
|
|
3651
|
+
}
|
|
3527
3652
|
}
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
pdfData.
|
|
3653
|
+
if (_this27.options.footer) {
|
|
3654
|
+
if (_this27.options.footer.elementId) {
|
|
3655
|
+
var footerEl = document.getElementById(_this27.options.footer.elementId);
|
|
3656
|
+
if (footerEl) {
|
|
3657
|
+
pdfData.footer = footerEl.outerHTML;
|
|
3658
|
+
if (_this27.options.footer.css) {
|
|
3659
|
+
pdfData.options.footerCSS = _this27.options.footer.css;
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
} else {
|
|
3663
|
+
pdfData.footer = _this27.options.footer;
|
|
3539
3664
|
}
|
|
3540
3665
|
}
|
|
3541
|
-
|
|
3542
|
-
|
|
3666
|
+
pdfData.html = el.outerHTML;
|
|
3667
|
+
// document.getElementById(`${this.elementId}_pdfHeader`).value = pdfData.header
|
|
3668
|
+
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3669
|
+
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3670
|
+
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3671
|
+
_this27.service.add('', pdfData, {
|
|
3672
|
+
responseType: 'blob'
|
|
3673
|
+
}).then(function (response) {
|
|
3674
|
+
_this27.loader.hide();
|
|
3675
|
+
var blob = new Blob([response], {
|
|
3676
|
+
type: 'application/pdf'
|
|
3677
|
+
});
|
|
3678
|
+
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 ");
|
|
3679
|
+
if (_this27.options.directDownload === true) {
|
|
3680
|
+
var fileName;
|
|
3681
|
+
if (typeof _this27.options.fileName === 'function') {
|
|
3682
|
+
fileName = _this27.options.fileName() || 'Export';
|
|
3683
|
+
} else {
|
|
3684
|
+
fileName = _this27.options.fileName || 'Export';
|
|
3685
|
+
}
|
|
3686
|
+
msg += "download='".concat(fileName, ".pdf'");
|
|
3687
|
+
}
|
|
3688
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this27.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3689
|
+
_this27.popup.show({
|
|
3690
|
+
message: msg,
|
|
3691
|
+
mask: true
|
|
3692
|
+
});
|
|
3693
|
+
}, function (err) {
|
|
3694
|
+
console.error(err);
|
|
3695
|
+
});
|
|
3543
3696
|
}
|
|
3544
3697
|
}
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3550
|
-
_this25.service.add('', pdfData, {
|
|
3551
|
-
responseType: 'blob'
|
|
3552
|
-
}).then(function (response) {
|
|
3553
|
-
_this25.loader.hide();
|
|
3554
|
-
var blob = new Blob([response], {
|
|
3555
|
-
type: 'application/pdf'
|
|
3556
|
-
});
|
|
3557
|
-
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 ");
|
|
3558
|
-
if (_this25.options.directDownload === true) {
|
|
3559
|
-
var fileName;
|
|
3560
|
-
if (typeof _this25.options.fileName === 'function') {
|
|
3561
|
-
fileName = _this25.options.fileName() || 'Export';
|
|
3562
|
-
} else {
|
|
3563
|
-
fileName = _this25.options.fileName || 'Export';
|
|
3564
|
-
}
|
|
3565
|
-
msg += "download='".concat(fileName, ".pdf'");
|
|
3566
|
-
}
|
|
3567
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this25.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3568
|
-
_this25.popup.show({
|
|
3569
|
-
message: msg,
|
|
3570
|
-
mask: true
|
|
3571
|
-
});
|
|
3572
|
-
}, function (err) {
|
|
3573
|
-
console.error(err);
|
|
3574
|
-
});
|
|
3575
|
-
}
|
|
3698
|
+
}, _this27.options.wait);
|
|
3699
|
+
} else {
|
|
3700
|
+
_this27.loader.hide();
|
|
3701
|
+
_this27.options.onError();
|
|
3576
3702
|
}
|
|
3577
|
-
}
|
|
3703
|
+
});
|
|
3578
3704
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
3579
3705
|
this.popup.hide();
|
|
3580
3706
|
if (this.options.onClose) {
|
|
@@ -3714,6 +3840,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3714
3840
|
}, {
|
|
3715
3841
|
key: "subscribe",
|
|
3716
3842
|
value: function subscribe(id, method, fn) {
|
|
3843
|
+
if (!this.subscriptions) {
|
|
3844
|
+
this.subscriptions = {};
|
|
3845
|
+
}
|
|
3717
3846
|
if (arguments.length === 3) {
|
|
3718
3847
|
if (!this.subscriptions[id]) {
|
|
3719
3848
|
this.subscriptions[id] = {};
|
|
@@ -3733,7 +3862,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3733
3862
|
}();
|
|
3734
3863
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3735
3864
|
function ResponsiveText(elementId, options) {
|
|
3736
|
-
var
|
|
3865
|
+
var _this28 = this;
|
|
3737
3866
|
_classCallCheck(this, ResponsiveText);
|
|
3738
3867
|
var DEFAULTS = {
|
|
3739
3868
|
textAlign: 'center',
|
|
@@ -3744,7 +3873,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3744
3873
|
this.elementId = elementId;
|
|
3745
3874
|
this.canvas = document.createElement('canvas');
|
|
3746
3875
|
window.addEventListener('resize', function () {
|
|
3747
|
-
return
|
|
3876
|
+
return _this28.render();
|
|
3748
3877
|
});
|
|
3749
3878
|
var el = document.getElementById(this.elementId);
|
|
3750
3879
|
if (el) {
|
|
@@ -3934,7 +4063,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3934
4063
|
/* global WebsyDesigns */
|
|
3935
4064
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3936
4065
|
function WebsyResultList(elementId, options) {
|
|
3937
|
-
var
|
|
4066
|
+
var _this29 = this;
|
|
3938
4067
|
_classCallCheck(this, WebsyResultList);
|
|
3939
4068
|
var DEFAULTS = {
|
|
3940
4069
|
listeners: {
|
|
@@ -3960,8 +4089,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3960
4089
|
}
|
|
3961
4090
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3962
4091
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3963
|
-
|
|
3964
|
-
|
|
4092
|
+
_this29.options.template = templateString;
|
|
4093
|
+
_this29.render();
|
|
3965
4094
|
});
|
|
3966
4095
|
} else {
|
|
3967
4096
|
this.render();
|
|
@@ -3980,7 +4109,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3980
4109
|
}, {
|
|
3981
4110
|
key: "buildHTML",
|
|
3982
4111
|
value: function buildHTML(d) {
|
|
3983
|
-
var
|
|
4112
|
+
var _this30 = this;
|
|
3984
4113
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3985
4114
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3986
4115
|
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -3988,7 +4117,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3988
4117
|
if (this.options.template) {
|
|
3989
4118
|
if (d.length > 0) {
|
|
3990
4119
|
d.forEach(function (row, ix) {
|
|
3991
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4120
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this30.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3992
4121
|
// find conditional elements
|
|
3993
4122
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3994
4123
|
ifMatches.forEach(function (m) {
|
|
@@ -4076,7 +4205,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4076
4205
|
parts.forEach(function (p) {
|
|
4077
4206
|
items = items[p];
|
|
4078
4207
|
});
|
|
4079
|
-
template = template.replace(m[0],
|
|
4208
|
+
template = template.replace(m[0], _this30.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4080
4209
|
}
|
|
4081
4210
|
});
|
|
4082
4211
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4085,7 +4214,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4085
4214
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4086
4215
|
}
|
|
4087
4216
|
});
|
|
4088
|
-
var flatRow =
|
|
4217
|
+
var flatRow = _this30.flattenObject(row);
|
|
4089
4218
|
for (var key in flatRow) {
|
|
4090
4219
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4091
4220
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4210,15 +4339,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4210
4339
|
}, {
|
|
4211
4340
|
key: "render",
|
|
4212
4341
|
value: function render() {
|
|
4213
|
-
var
|
|
4342
|
+
var _this31 = this;
|
|
4214
4343
|
if (this.options.entity) {
|
|
4215
4344
|
var url = this.options.entity;
|
|
4216
4345
|
if (this.options.sortField) {
|
|
4217
4346
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4218
4347
|
}
|
|
4219
4348
|
this.apiService.get(url).then(function (results) {
|
|
4220
|
-
|
|
4221
|
-
|
|
4349
|
+
_this31.rows = results.rows;
|
|
4350
|
+
_this31.resize();
|
|
4222
4351
|
});
|
|
4223
4352
|
} else {
|
|
4224
4353
|
this.resize();
|
|
@@ -4288,12 +4417,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4288
4417
|
_createClass(WebsyRouter, [{
|
|
4289
4418
|
key: "addGroup",
|
|
4290
4419
|
value: function addGroup(group) {
|
|
4291
|
-
var
|
|
4420
|
+
var _this32 = this;
|
|
4292
4421
|
if (!this.groups[group]) {
|
|
4293
4422
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4294
4423
|
if (els) {
|
|
4295
4424
|
this.getClosestParent(els[0], function (parent) {
|
|
4296
|
-
|
|
4425
|
+
_this32.groups[group] = {
|
|
4297
4426
|
activeView: '',
|
|
4298
4427
|
views: [],
|
|
4299
4428
|
parent: parent.getAttribute('data-view')
|
|
@@ -4357,7 +4486,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4357
4486
|
}, {
|
|
4358
4487
|
key: "removeUrlParams",
|
|
4359
4488
|
value: function removeUrlParams() {
|
|
4360
|
-
var
|
|
4489
|
+
var _this33 = this;
|
|
4361
4490
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4362
4491
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4363
4492
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4365,7 +4494,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4365
4494
|
var path = '';
|
|
4366
4495
|
if (this.currentParams && this.currentParams.items) {
|
|
4367
4496
|
params.forEach(function (p) {
|
|
4368
|
-
delete
|
|
4497
|
+
delete _this33.currentParams.items[p];
|
|
4369
4498
|
});
|
|
4370
4499
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4371
4500
|
}
|
|
@@ -4696,11 +4825,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4696
4825
|
}, {
|
|
4697
4826
|
key: "showComponents",
|
|
4698
4827
|
value: function showComponents(view) {
|
|
4699
|
-
var
|
|
4828
|
+
var _this34 = this;
|
|
4700
4829
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4701
4830
|
this.options.views[view].components.forEach(function (c) {
|
|
4702
4831
|
if (typeof c.instance === 'undefined') {
|
|
4703
|
-
|
|
4832
|
+
_this34.prepComponent(c.elementId, c.options);
|
|
4704
4833
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4705
4834
|
} else if (c.instance.render) {
|
|
4706
4835
|
c.instance.render();
|
|
@@ -5020,7 +5149,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5020
5149
|
}, {
|
|
5021
5150
|
key: "handleKeyUp",
|
|
5022
5151
|
value: function handleKeyUp(event) {
|
|
5023
|
-
var
|
|
5152
|
+
var _this35 = this;
|
|
5024
5153
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5025
5154
|
if (this.searchTimeoutFn) {
|
|
5026
5155
|
clearTimeout(this.searchTimeoutFn);
|
|
@@ -5038,8 +5167,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5038
5167
|
}
|
|
5039
5168
|
if (event.target.value.length >= this.options.minLength) {
|
|
5040
5169
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5041
|
-
if (
|
|
5042
|
-
|
|
5170
|
+
if (_this35.options.onSearch) {
|
|
5171
|
+
_this35.options.onSearch(event.target.value, event);
|
|
5043
5172
|
}
|
|
5044
5173
|
}, this.options.searchTimeout);
|
|
5045
5174
|
} else {
|
|
@@ -5197,7 +5326,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5197
5326
|
/* global WebsyDesigns */
|
|
5198
5327
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5199
5328
|
function WebsyTemplate(elementId, options) {
|
|
5200
|
-
var
|
|
5329
|
+
var _this36 = this;
|
|
5201
5330
|
_classCallCheck(this, WebsyTemplate);
|
|
5202
5331
|
var DEFAULTS = {
|
|
5203
5332
|
listeners: {
|
|
@@ -5217,8 +5346,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5217
5346
|
}
|
|
5218
5347
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5219
5348
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5220
|
-
|
|
5221
|
-
|
|
5349
|
+
_this36.options.template = templateString;
|
|
5350
|
+
_this36.render();
|
|
5222
5351
|
});
|
|
5223
5352
|
} else {
|
|
5224
5353
|
this.render();
|
|
@@ -5227,7 +5356,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5227
5356
|
_createClass(WebsyTemplate, [{
|
|
5228
5357
|
key: "buildHTML",
|
|
5229
5358
|
value: function buildHTML() {
|
|
5230
|
-
var
|
|
5359
|
+
var _this37 = this;
|
|
5231
5360
|
var html = "";
|
|
5232
5361
|
if (this.options.template) {
|
|
5233
5362
|
var template = this.options.template;
|
|
@@ -5276,14 +5405,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5276
5405
|
}
|
|
5277
5406
|
}
|
|
5278
5407
|
if (polarity === true) {
|
|
5279
|
-
if (typeof
|
|
5408
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] === parts[1]) {
|
|
5280
5409
|
// remove the <if> tags
|
|
5281
5410
|
removeAll = false;
|
|
5282
5411
|
} else if (parts[0] === parts[1]) {
|
|
5283
5412
|
removeAll = false;
|
|
5284
5413
|
}
|
|
5285
5414
|
} else if (polarity === false) {
|
|
5286
|
-
if (typeof
|
|
5415
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] !== parts[1]) {
|
|
5287
5416
|
// remove the <if> tags
|
|
5288
5417
|
removeAll = false;
|
|
5289
5418
|
}
|
|
@@ -5320,7 +5449,55 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5320
5449
|
}, {
|
|
5321
5450
|
key: "handleClick",
|
|
5322
5451
|
value: function handleClick(event) {
|
|
5323
|
-
|
|
5452
|
+
if (event.target.classList.contains('clickable')) {
|
|
5453
|
+
this.handleEvent(event, 'clickable', 'click');
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
}, {
|
|
5457
|
+
key: "handleEvent",
|
|
5458
|
+
value: function handleEvent(event, eventType, action) {
|
|
5459
|
+
var l = event.target.getAttribute('data-event');
|
|
5460
|
+
if (l) {
|
|
5461
|
+
l = l.split('(');
|
|
5462
|
+
var params = [];
|
|
5463
|
+
var id = event.target.getAttribute('data-id');
|
|
5464
|
+
// const locator = event.target.getAttribute('data-locator')
|
|
5465
|
+
// if (l[1]) {
|
|
5466
|
+
// l[1] = l[1].replace(')', '')
|
|
5467
|
+
// params = l[1].split(',')
|
|
5468
|
+
// }
|
|
5469
|
+
// l = l[0]
|
|
5470
|
+
var data = this.options.data;
|
|
5471
|
+
// if (locator !== '') {
|
|
5472
|
+
// let locatorItems = locator.split(';')
|
|
5473
|
+
// locatorItems.forEach(loc => {
|
|
5474
|
+
// let locatorParts = loc.split(':')
|
|
5475
|
+
// if (data[locatorParts[0]]) {
|
|
5476
|
+
// data = data[locatorParts[0]]
|
|
5477
|
+
// let parts = locatorParts[1].split('.')
|
|
5478
|
+
// parts.forEach(p => {
|
|
5479
|
+
// data = data[p]
|
|
5480
|
+
// })
|
|
5481
|
+
// }
|
|
5482
|
+
// })
|
|
5483
|
+
// }
|
|
5484
|
+
// params = params.map(p => {
|
|
5485
|
+
// if (typeof p !== 'string' && typeof p !== 'number') {
|
|
5486
|
+
// if (data[+id]) {
|
|
5487
|
+
// p = data[+id][p]
|
|
5488
|
+
// }
|
|
5489
|
+
// }
|
|
5490
|
+
// else if (typeof p === 'string') {
|
|
5491
|
+
// p = p.replace(/"/g, '').replace(/'/g, '')
|
|
5492
|
+
// }
|
|
5493
|
+
// return p
|
|
5494
|
+
// })
|
|
5495
|
+
if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
|
|
5496
|
+
var _this$options$listene2;
|
|
5497
|
+
event.stopPropagation();
|
|
5498
|
+
(_this$options$listene2 = this.options.listeners[action][l]).call.apply(_this$options$listene2, [this, event, data[+id]].concat(params));
|
|
5499
|
+
}
|
|
5500
|
+
}
|
|
5324
5501
|
}
|
|
5325
5502
|
}, {
|
|
5326
5503
|
key: "render",
|
|
@@ -5544,7 +5721,7 @@ var WebsyUtils = {
|
|
|
5544
5721
|
/* global WebsyDesigns */
|
|
5545
5722
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5546
5723
|
function WebsyTable(elementId, options) {
|
|
5547
|
-
var
|
|
5724
|
+
var _this38 = this;
|
|
5548
5725
|
_classCallCheck(this, WebsyTable);
|
|
5549
5726
|
var DEFAULTS = {
|
|
5550
5727
|
pageSize: 20,
|
|
@@ -5576,8 +5753,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5576
5753
|
allowClear: false,
|
|
5577
5754
|
disableSearch: true,
|
|
5578
5755
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5579
|
-
if (
|
|
5580
|
-
|
|
5756
|
+
if (_this38.options.onChangePageSize) {
|
|
5757
|
+
_this38.options.onChangePageSize(selectedItem.value);
|
|
5581
5758
|
}
|
|
5582
5759
|
}
|
|
5583
5760
|
});
|
|
@@ -5596,19 +5773,19 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5596
5773
|
_createClass(WebsyTable, [{
|
|
5597
5774
|
key: "appendRows",
|
|
5598
5775
|
value: function appendRows(data) {
|
|
5599
|
-
var
|
|
5776
|
+
var _this39 = this;
|
|
5600
5777
|
this.hideError();
|
|
5601
5778
|
var bodyHTML = '';
|
|
5602
5779
|
if (data) {
|
|
5603
5780
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5604
5781
|
return '<tr>' + r.map(function (c, i) {
|
|
5605
|
-
if (
|
|
5782
|
+
if (_this39.options.columns[i].show !== false) {
|
|
5606
5783
|
var style = '';
|
|
5607
5784
|
if (c.style) {
|
|
5608
5785
|
style += c.style;
|
|
5609
5786
|
}
|
|
5610
|
-
if (
|
|
5611
|
-
style += "width: ".concat(
|
|
5787
|
+
if (_this39.options.columns[i].width) {
|
|
5788
|
+
style += "width: ".concat(_this39.options.columns[i].width, "; ");
|
|
5612
5789
|
}
|
|
5613
5790
|
if (c.backgroundColor) {
|
|
5614
5791
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5619,16 +5796,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5619
5796
|
if (c.color) {
|
|
5620
5797
|
style += "color: ".concat(c.color, "; ");
|
|
5621
5798
|
}
|
|
5622
|
-
if (
|
|
5623
|
-
return "\n <td \n data-row-index='".concat(
|
|
5624
|
-
} else if ((
|
|
5625
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5799
|
+
if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5800
|
+
return "\n <td \n data-row-index='".concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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(_this39.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5801
|
+
} else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5802
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this39.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5626
5803
|
} else {
|
|
5627
5804
|
var info = c.value;
|
|
5628
|
-
if (
|
|
5805
|
+
if (_this39.options.columns[i].showAsImage === true) {
|
|
5629
5806
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5630
5807
|
}
|
|
5631
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5808
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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 ");
|
|
5632
5809
|
}
|
|
5633
5810
|
}
|
|
5634
5811
|
}).join('') + '</tr>';
|
|
@@ -5787,7 +5964,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5787
5964
|
}, {
|
|
5788
5965
|
key: "render",
|
|
5789
5966
|
value: function render(data) {
|
|
5790
|
-
var
|
|
5967
|
+
var _this40 = this;
|
|
5791
5968
|
if (!this.options.columns) {
|
|
5792
5969
|
return;
|
|
5793
5970
|
}
|
|
@@ -5814,7 +5991,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5814
5991
|
if (c.width) {
|
|
5815
5992
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5816
5993
|
}
|
|
5817
|
-
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 ?
|
|
5994
|
+
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 ? _this40.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5818
5995
|
}
|
|
5819
5996
|
}).join('') + '</tr>';
|
|
5820
5997
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5832,7 +6009,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5832
6009
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5833
6010
|
if (pagingEl) {
|
|
5834
6011
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5835
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6012
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5836
6013
|
});
|
|
5837
6014
|
var startIndex = 0;
|
|
5838
6015
|
if (this.options.pageCount > 8) {
|
|
@@ -5887,7 +6064,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5887
6064
|
/* global WebsyDesigns */
|
|
5888
6065
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5889
6066
|
function WebsyTable2(elementId, options) {
|
|
5890
|
-
var
|
|
6067
|
+
var _this41 = this;
|
|
5891
6068
|
_classCallCheck(this, WebsyTable2);
|
|
5892
6069
|
var DEFAULTS = {
|
|
5893
6070
|
pageSize: 20,
|
|
@@ -5922,8 +6099,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5922
6099
|
allowClear: false,
|
|
5923
6100
|
disableSearch: true,
|
|
5924
6101
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5925
|
-
if (
|
|
5926
|
-
|
|
6102
|
+
if (_this41.options.onChangePageSize) {
|
|
6103
|
+
_this41.options.onChangePageSize(selectedItem.value);
|
|
5927
6104
|
}
|
|
5928
6105
|
}
|
|
5929
6106
|
});
|
|
@@ -5945,20 +6122,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5945
6122
|
_createClass(WebsyTable2, [{
|
|
5946
6123
|
key: "appendRows",
|
|
5947
6124
|
value: function appendRows(data) {
|
|
5948
|
-
var
|
|
6125
|
+
var _this42 = this;
|
|
5949
6126
|
this.hideError();
|
|
5950
6127
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5951
6128
|
var bodyHTML = '';
|
|
5952
6129
|
if (data) {
|
|
5953
6130
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5954
6131
|
return '<tr>' + r.map(function (c, i) {
|
|
5955
|
-
if (
|
|
5956
|
-
var style = "height: ".concat(
|
|
6132
|
+
if (_this42.options.columns[i].show !== false) {
|
|
6133
|
+
var style = "height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px;");
|
|
5957
6134
|
if (c.style) {
|
|
5958
6135
|
style += c.style;
|
|
5959
6136
|
}
|
|
5960
|
-
if (
|
|
5961
|
-
style += "width: ".concat(
|
|
6137
|
+
if (_this42.options.columns[i].width) {
|
|
6138
|
+
style += "width: ".concat(_this42.options.columns[i].width, "; ");
|
|
5962
6139
|
}
|
|
5963
6140
|
if (c.backgroundColor) {
|
|
5964
6141
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5969,16 +6146,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5969
6146
|
if (c.color) {
|
|
5970
6147
|
style += "color: ".concat(c.color, "; ");
|
|
5971
6148
|
}
|
|
5972
|
-
if (
|
|
5973
|
-
return "\n <td \n data-row-index='".concat(
|
|
5974
|
-
} else if ((
|
|
5975
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6149
|
+
if (_this42.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6150
|
+
return "\n <td \n data-row-index='".concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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(_this42.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6151
|
+
} else if ((_this42.options.columns[i].showAsNavigatorLink === true || _this42.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6152
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this42.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this42.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5976
6153
|
} else {
|
|
5977
6154
|
var info = c.value;
|
|
5978
|
-
if (
|
|
6155
|
+
if (_this42.options.columns[i].showAsImage === true) {
|
|
5979
6156
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5980
6157
|
}
|
|
5981
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6158
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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 ");
|
|
5982
6159
|
}
|
|
5983
6160
|
}
|
|
5984
6161
|
}).join('') + '</tr>';
|
|
@@ -6212,7 +6389,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6212
6389
|
}, {
|
|
6213
6390
|
key: "render",
|
|
6214
6391
|
value: function render(data) {
|
|
6215
|
-
var
|
|
6392
|
+
var _this43 = this;
|
|
6216
6393
|
if (!this.options.columns) {
|
|
6217
6394
|
return;
|
|
6218
6395
|
}
|
|
@@ -6240,7 +6417,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6240
6417
|
if (c.width) {
|
|
6241
6418
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6242
6419
|
}
|
|
6243
|
-
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 ?
|
|
6420
|
+
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 ? _this43.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6244
6421
|
}
|
|
6245
6422
|
}).join('') + '</tr>';
|
|
6246
6423
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6250,7 +6427,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6250
6427
|
var dropdownHTML = "";
|
|
6251
6428
|
this.options.columns.forEach(function (c, i) {
|
|
6252
6429
|
if (c.searchable && c.searchField) {
|
|
6253
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6430
|
+
dropdownHTML += "\n <div id=\"".concat(_this43.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6254
6431
|
}
|
|
6255
6432
|
});
|
|
6256
6433
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6270,7 +6447,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6270
6447
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6271
6448
|
if (pagingEl) {
|
|
6272
6449
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6273
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6450
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this43.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6274
6451
|
});
|
|
6275
6452
|
var startIndex = 0;
|
|
6276
6453
|
if (this.options.pageCount > 8) {
|
|
@@ -6347,17 +6524,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6347
6524
|
}, {
|
|
6348
6525
|
key: "getColumnParameters",
|
|
6349
6526
|
value: function getColumnParameters(values) {
|
|
6350
|
-
var
|
|
6527
|
+
var _this44 = this;
|
|
6351
6528
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6352
6529
|
tableEl.style.tableLayout = 'auto';
|
|
6353
6530
|
tableEl.style.width = 'auto';
|
|
6354
6531
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6355
6532
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6356
6533
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6357
|
-
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 ?
|
|
6534
|
+
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 ? _this44.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6358
6535
|
}).join('') + '</tr>';
|
|
6359
6536
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6360
|
-
return "\n <td \n style='height: ".concat(
|
|
6537
|
+
return "\n <td \n style='height: ".concat(_this44.options.cellSize, "px; line-height: ").concat(_this44.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6361
6538
|
}).join('') + '</tr>';
|
|
6362
6539
|
// get height of the first data cell
|
|
6363
6540
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6418,6 +6595,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6418
6595
|
autoFitColumns: true
|
|
6419
6596
|
};
|
|
6420
6597
|
this.options = _extends({}, DEFAULTS, options);
|
|
6598
|
+
this._isRendered = false;
|
|
6421
6599
|
this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
6422
6600
|
if (this.options.disableTouch === true) {
|
|
6423
6601
|
this.isTouchDevice = false;
|
|
@@ -6478,6 +6656,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6478
6656
|
}
|
|
6479
6657
|
}
|
|
6480
6658
|
_createClass(WebsyTable3, [{
|
|
6659
|
+
key: "isRendered",
|
|
6660
|
+
get: function get() {
|
|
6661
|
+
return this._isRendered;
|
|
6662
|
+
}
|
|
6663
|
+
}, {
|
|
6481
6664
|
key: "columns",
|
|
6482
6665
|
set: function set(columns) {
|
|
6483
6666
|
this.options.columns = columns;
|
|
@@ -6492,6 +6675,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6492
6675
|
}, {
|
|
6493
6676
|
key: "appendRows",
|
|
6494
6677
|
value: function appendRows(data) {
|
|
6678
|
+
this._isRendered = false;
|
|
6495
6679
|
this.hideError();
|
|
6496
6680
|
var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
6497
6681
|
if (bodyEl) {
|
|
@@ -6503,6 +6687,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6503
6687
|
bodyEl.querySelector('tbody').innerHTML += this.buildBodyHtml(data, true, true);
|
|
6504
6688
|
} else {
|
|
6505
6689
|
bodyEl.innerHTML += this.buildBodyHtml(data, true);
|
|
6690
|
+
this._isRendered = true;
|
|
6506
6691
|
}
|
|
6507
6692
|
this.currentData = this.currentData.concat(data);
|
|
6508
6693
|
}
|
|
@@ -6513,7 +6698,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6513
6698
|
}, {
|
|
6514
6699
|
key: "buildBodyHtml",
|
|
6515
6700
|
value: function buildBodyHtml() {
|
|
6516
|
-
var
|
|
6701
|
+
var _this45 = this;
|
|
6517
6702
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6518
6703
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6519
6704
|
if (!this.options.columns) {
|
|
@@ -6538,7 +6723,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6538
6723
|
row.forEach(function (cell, cellIndex) {
|
|
6539
6724
|
var sizeIndex = cell.level || cellIndex;
|
|
6540
6725
|
var colIndex = cell.index || cellIndex;
|
|
6541
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6726
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this45.options.columns[_this45.options.columns.length - 1][colIndex].show === false) {
|
|
6542
6727
|
return; // need to revisit this logic
|
|
6543
6728
|
}
|
|
6544
6729
|
|
|
@@ -6565,7 +6750,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6565
6750
|
style += "color: ".concat(cell.color, "; ");
|
|
6566
6751
|
}
|
|
6567
6752
|
// console.log('rowspan', cell.rowspan)
|
|
6568
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6753
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this45.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : 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(colIndex, "'\n ");
|
|
6569
6754
|
// if (useWidths === true) {
|
|
6570
6755
|
// bodyHtml += `
|
|
6571
6756
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -6574,10 +6759,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6574
6759
|
// }
|
|
6575
6760
|
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
|
|
6576
6761
|
if (cell.expandable === true) {
|
|
6577
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6762
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this45.options.plusIcon, "</i>");
|
|
6578
6763
|
}
|
|
6579
6764
|
if (cell.collapsable === true) {
|
|
6580
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6765
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this45.options.minusIcon, "</i>");
|
|
6581
6766
|
}
|
|
6582
6767
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6583
6768
|
cell.value = "\n <a href=\"".concat(encodeURI(cell.value), "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
@@ -6598,7 +6783,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6598
6783
|
}, {
|
|
6599
6784
|
key: "buildHeaderHtml",
|
|
6600
6785
|
value: function buildHeaderHtml() {
|
|
6601
|
-
var
|
|
6786
|
+
var _this46 = this;
|
|
6602
6787
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6603
6788
|
if (!this.options.columns) {
|
|
6604
6789
|
return '';
|
|
@@ -6615,7 +6800,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6615
6800
|
headerHtml += '</colgroup>';
|
|
6616
6801
|
}
|
|
6617
6802
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6618
|
-
if (useWidths === false && rowIndex !==
|
|
6803
|
+
if (useWidths === false && rowIndex !== _this46.options.columns.length - 1) {
|
|
6619
6804
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6620
6805
|
return;
|
|
6621
6806
|
}
|
|
@@ -6639,24 +6824,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6639
6824
|
if (col.style) {
|
|
6640
6825
|
style += col.style;
|
|
6641
6826
|
}
|
|
6642
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6827
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this46.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6643
6828
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6644
6829
|
// headerHtml += `
|
|
6645
6830
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6646
6831
|
// width='${col.width || col.actualWidth}'
|
|
6647
6832
|
// `
|
|
6648
6833
|
// }
|
|
6649
|
-
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 ?
|
|
6834
|
+
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 ? _this46.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this46.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6650
6835
|
});
|
|
6651
6836
|
headerHtml += "</tr>";
|
|
6652
6837
|
});
|
|
6653
6838
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6654
6839
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6655
6840
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6656
|
-
var testEl = document.getElementById("".concat(
|
|
6841
|
+
var testEl = document.getElementById("".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6657
6842
|
if (!testEl) {
|
|
6658
6843
|
var newE = document.createElement('div');
|
|
6659
|
-
newE.id = "".concat(
|
|
6844
|
+
newE.id = "".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6660
6845
|
newE.className = 'websy-modal-dropdown';
|
|
6661
6846
|
dropdownEl.appendChild(newE);
|
|
6662
6847
|
}
|
|
@@ -6679,7 +6864,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6679
6864
|
}, {
|
|
6680
6865
|
key: "buildTotalHtml",
|
|
6681
6866
|
value: function buildTotalHtml() {
|
|
6682
|
-
var
|
|
6867
|
+
var _this47 = this;
|
|
6683
6868
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6684
6869
|
if (!this.options.totals) {
|
|
6685
6870
|
return '';
|
|
@@ -6695,7 +6880,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6695
6880
|
|
|
6696
6881
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6697
6882
|
if (useWidths === true) {
|
|
6698
|
-
totalHtml += "\n style='width: ".concat(
|
|
6883
|
+
totalHtml += "\n style='width: ".concat(_this47.options.columns[_this47.options.columns.length - 1][colIndex].width || _this47.options.columns[_this47.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6699
6884
|
}
|
|
6700
6885
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6701
6886
|
});
|
|
@@ -6705,7 +6890,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6705
6890
|
}, {
|
|
6706
6891
|
key: "calculateSizes",
|
|
6707
6892
|
value: function calculateSizes() {
|
|
6708
|
-
var
|
|
6893
|
+
var _this48 = this;
|
|
6709
6894
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6710
6895
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6711
6896
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6749,7 +6934,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6749
6934
|
rows.forEach(function (row, rowIndex) {
|
|
6750
6935
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6751
6936
|
var colSize = col.getBoundingClientRect();
|
|
6752
|
-
|
|
6937
|
+
_this48.sizes.cellHeight = colSize.height;
|
|
6753
6938
|
if (columnsForSizing[colIndex]) {
|
|
6754
6939
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6755
6940
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -6761,7 +6946,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6761
6946
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6762
6947
|
// }
|
|
6763
6948
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6764
|
-
if (colIndex >=
|
|
6949
|
+
if (colIndex >= _this48.pinnedColumns) {
|
|
6765
6950
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6766
6951
|
}
|
|
6767
6952
|
}
|
|
@@ -6776,7 +6961,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6776
6961
|
return a + (b.width || b.actualWidth);
|
|
6777
6962
|
}, 0);
|
|
6778
6963
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6779
|
-
return i >=
|
|
6964
|
+
return i >= _this48.pinnedColumns;
|
|
6780
6965
|
}).reduce(function (a, b) {
|
|
6781
6966
|
return a + (b.width || b.actualWidth);
|
|
6782
6967
|
}, 0);
|
|
@@ -6787,7 +6972,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6787
6972
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6788
6973
|
columnsForSizing.forEach(function (c) {
|
|
6789
6974
|
c.shouldGrow = true;
|
|
6790
|
-
if (
|
|
6975
|
+
if (_this48.options.autoFitColumns === false) {
|
|
6791
6976
|
c.shouldGrow = false;
|
|
6792
6977
|
if (c.potentialWidth > c.actualWidth) {
|
|
6793
6978
|
c.shouldGrow = true;
|
|
@@ -6806,7 +6991,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6806
6991
|
// if (!c.width) {
|
|
6807
6992
|
// if (c.actualWidth < equalWidth) {
|
|
6808
6993
|
// adjust the width
|
|
6809
|
-
if (
|
|
6994
|
+
if (_this48.options.autoFitColumns === true) {
|
|
6810
6995
|
if (c.width) {
|
|
6811
6996
|
c.width += equalWidth;
|
|
6812
6997
|
}
|
|
@@ -6830,9 +7015,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6830
7015
|
}
|
|
6831
7016
|
// }
|
|
6832
7017
|
// }
|
|
6833
|
-
|
|
6834
|
-
if (i >
|
|
6835
|
-
|
|
7018
|
+
_this48.sizes.totalWidth += c.width || c.actualWidth;
|
|
7019
|
+
if (i > _this48.pinnedColumns) {
|
|
7020
|
+
_this48.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6836
7021
|
}
|
|
6837
7022
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6838
7023
|
});
|
|
@@ -6891,7 +7076,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6891
7076
|
}, {
|
|
6892
7077
|
key: "createSample",
|
|
6893
7078
|
value: function createSample(data) {
|
|
6894
|
-
var
|
|
7079
|
+
var _this49 = this;
|
|
6895
7080
|
var output = [];
|
|
6896
7081
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6897
7082
|
if (col.maxLength) {
|
|
@@ -6901,7 +7086,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6901
7086
|
} else if (data) {
|
|
6902
7087
|
var longest = '';
|
|
6903
7088
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6904
|
-
if (data[i].length ===
|
|
7089
|
+
if (data[i].length === _this49.options.columns[_this49.options.columns.length - 1].length) {
|
|
6905
7090
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6906
7091
|
longest = data[i][colIndex].value;
|
|
6907
7092
|
}
|
|
@@ -7173,7 +7358,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7173
7358
|
}, {
|
|
7174
7359
|
key: "perpetualScroll",
|
|
7175
7360
|
value: function perpetualScroll() {
|
|
7176
|
-
var
|
|
7361
|
+
var _this50 = this;
|
|
7177
7362
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7178
7363
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7179
7364
|
return;
|
|
@@ -7192,17 +7377,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7192
7377
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7193
7378
|
var _loop2 = function _loop2(i) {
|
|
7194
7379
|
setTimeout(function () {
|
|
7195
|
-
var delta =
|
|
7380
|
+
var delta = _this50.mouseYStart - _this50.currentClientY + _this50.sizes.cellHeight * (i + 1) * direction;
|
|
7196
7381
|
delta = Math.min(10, delta);
|
|
7197
7382
|
delta = Math.max(-10, delta);
|
|
7198
7383
|
// only run this if isPerpetual === true
|
|
7199
7384
|
// this value is reset to false on touchStart
|
|
7200
|
-
if (
|
|
7385
|
+
if (_this50.isPerpetual === true) {
|
|
7201
7386
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7202
7387
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7203
|
-
|
|
7204
|
-
if (
|
|
7205
|
-
clearTimeout(
|
|
7388
|
+
_this50.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7389
|
+
if (_this50.scrollTimeout) {
|
|
7390
|
+
clearTimeout(_this50.scrollTimeout);
|
|
7206
7391
|
}
|
|
7207
7392
|
}
|
|
7208
7393
|
}, 1000 / fps * i);
|
|
@@ -7470,7 +7655,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7470
7655
|
/* global d3 include WebsyDesigns */
|
|
7471
7656
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7472
7657
|
function WebsyChart(elementId, options) {
|
|
7473
|
-
var
|
|
7658
|
+
var _this51 = this;
|
|
7474
7659
|
_classCallCheck(this, WebsyChart);
|
|
7475
7660
|
var DEFAULTS = {
|
|
7476
7661
|
margin: {
|
|
@@ -7508,10 +7693,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7508
7693
|
maxBandWidth: 100,
|
|
7509
7694
|
allowUnevenBands: true,
|
|
7510
7695
|
allowBrushing: true,
|
|
7511
|
-
balancedMinMax: false
|
|
7696
|
+
balancedMinMax: false,
|
|
7697
|
+
onRendered: function onRendered() {}
|
|
7512
7698
|
};
|
|
7513
7699
|
this.elementId = elementId;
|
|
7514
7700
|
this.options = _extends({}, DEFAULTS, options);
|
|
7701
|
+
this._isRendered = false;
|
|
7515
7702
|
this.leftAxis = null;
|
|
7516
7703
|
this.rightAxis = null;
|
|
7517
7704
|
this.topAxis = null;
|
|
@@ -7527,7 +7714,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7527
7714
|
this.invertOverride = function (input, input2) {
|
|
7528
7715
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7529
7716
|
var xAxis = 'bottom';
|
|
7530
|
-
if (
|
|
7717
|
+
if (_this51.options.orientation === 'horizontal') {
|
|
7531
7718
|
xAxis = 'left';
|
|
7532
7719
|
}
|
|
7533
7720
|
if (forBrush === true) {
|
|
@@ -7535,12 +7722,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7535
7722
|
}
|
|
7536
7723
|
xAxis += 'Axis';
|
|
7537
7724
|
var output;
|
|
7538
|
-
var width =
|
|
7725
|
+
var width = _this51.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7539
7726
|
// if (this.customBottomRange) {
|
|
7540
|
-
for (var index = 0; index <
|
|
7541
|
-
if (input >
|
|
7542
|
-
if (
|
|
7543
|
-
if (input <
|
|
7727
|
+
for (var index = 0; index < _this51.customBottomRange.length; index++) {
|
|
7728
|
+
if (input > _this51.customBottomRange[index]) {
|
|
7729
|
+
if (_this51.customBottomRange[index + 1]) {
|
|
7730
|
+
if (input < _this51.customBottomRange[index + 1]) {
|
|
7544
7731
|
output = index;
|
|
7545
7732
|
break;
|
|
7546
7733
|
}
|
|
@@ -7550,21 +7737,6 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7550
7737
|
}
|
|
7551
7738
|
}
|
|
7552
7739
|
}
|
|
7553
|
-
// }
|
|
7554
|
-
// else {
|
|
7555
|
-
// let domain = [...this[xAxis].domain()]
|
|
7556
|
-
// if (this.options.orientation === 'horizontal') {
|
|
7557
|
-
// domain = domain.reverse()
|
|
7558
|
-
// }
|
|
7559
|
-
// for (let j = 0; j < domain.length; j++) {
|
|
7560
|
-
// let breakA = this[xAxis](domain[j]) - (width / 2)
|
|
7561
|
-
// let breakB = breakA + width
|
|
7562
|
-
// if (input > breakA && input <= breakB) {
|
|
7563
|
-
// output = j
|
|
7564
|
-
// break
|
|
7565
|
-
// }
|
|
7566
|
-
// }
|
|
7567
|
-
// }
|
|
7568
7740
|
return output;
|
|
7569
7741
|
};
|
|
7570
7742
|
var that = this;
|
|
@@ -7639,6 +7811,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7639
7811
|
this.options.data = d;
|
|
7640
7812
|
this.render();
|
|
7641
7813
|
}
|
|
7814
|
+
}, {
|
|
7815
|
+
key: "isRendered",
|
|
7816
|
+
get: function get() {
|
|
7817
|
+
return this._isRendered;
|
|
7818
|
+
}
|
|
7642
7819
|
}, {
|
|
7643
7820
|
key: "close",
|
|
7644
7821
|
value: function close() {
|
|
@@ -7715,9 +7892,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7715
7892
|
}, {
|
|
7716
7893
|
key: "handleEventMouseMove",
|
|
7717
7894
|
value: function handleEventMouseMove(event, d) {
|
|
7718
|
-
var
|
|
7895
|
+
var _this52 = this;
|
|
7719
7896
|
var bisectDate = d3.bisector(function (d) {
|
|
7720
|
-
return
|
|
7897
|
+
return _this52.parseX(d.x.value);
|
|
7721
7898
|
}).left;
|
|
7722
7899
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7723
7900
|
var xAxis = 'bottomAxis';
|
|
@@ -7750,9 +7927,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7750
7927
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7751
7928
|
}
|
|
7752
7929
|
this.options.data.series.forEach(function (s) {
|
|
7753
|
-
if (
|
|
7930
|
+
if (_this52.options.data[xData].scale !== 'Time') {
|
|
7754
7931
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7755
|
-
xPoint =
|
|
7932
|
+
xPoint = _this52.customBottomRange[x0] + (_this52.customBottomRange[x0 + 1] - _this52.customBottomRange[x0]) / 2;
|
|
7756
7933
|
// }
|
|
7757
7934
|
// else {
|
|
7758
7935
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7772,41 +7949,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7772
7949
|
var index = bisectDate(s.data, x0, 1);
|
|
7773
7950
|
var pointA = s.data[index - 1];
|
|
7774
7951
|
var pointB = s.data[index];
|
|
7775
|
-
if (
|
|
7952
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
7776
7953
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7777
7954
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7778
7955
|
}
|
|
7779
7956
|
if (pointA && !pointB) {
|
|
7780
|
-
xPoint =
|
|
7957
|
+
xPoint = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7781
7958
|
tooltipTitle = pointA.x.value;
|
|
7782
7959
|
if (!pointA.y.color) {
|
|
7783
7960
|
pointA.y.color = s.color;
|
|
7784
7961
|
}
|
|
7785
7962
|
tooltipData.push(pointA);
|
|
7786
7963
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7787
|
-
tooltipTitle = d3.timeFormat(
|
|
7964
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7788
7965
|
}
|
|
7789
7966
|
}
|
|
7790
7967
|
if (pointB && !pointA) {
|
|
7791
|
-
xPoint =
|
|
7968
|
+
xPoint = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7792
7969
|
tooltipTitle = pointB.x.value;
|
|
7793
7970
|
if (!pointB.y.color) {
|
|
7794
7971
|
pointB.y.color = s.color;
|
|
7795
7972
|
}
|
|
7796
7973
|
tooltipData.push(pointB);
|
|
7797
7974
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7798
|
-
tooltipTitle = d3.timeFormat(
|
|
7975
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7799
7976
|
}
|
|
7800
7977
|
}
|
|
7801
7978
|
if (pointA && pointB) {
|
|
7802
|
-
var d0 =
|
|
7803
|
-
var d1 =
|
|
7979
|
+
var d0 = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7980
|
+
var d1 = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7804
7981
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7805
7982
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7806
7983
|
xPoint = d1;
|
|
7807
7984
|
tooltipTitle = pointB.x.value;
|
|
7808
7985
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7809
|
-
tooltipTitle = d3.timeFormat(
|
|
7986
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7810
7987
|
}
|
|
7811
7988
|
if (!pointB.y.color) {
|
|
7812
7989
|
pointB.y.color = s.color;
|
|
@@ -7816,7 +7993,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7816
7993
|
xPoint = d0;
|
|
7817
7994
|
tooltipTitle = pointA.x.value;
|
|
7818
7995
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7819
|
-
tooltipTitle = d3.timeFormat(
|
|
7996
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7820
7997
|
}
|
|
7821
7998
|
if (!pointA.y.color) {
|
|
7822
7999
|
pointA.y.color = s.color;
|
|
@@ -7942,8 +8119,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7942
8119
|
}, {
|
|
7943
8120
|
key: "render",
|
|
7944
8121
|
value: function render(options) {
|
|
7945
|
-
var
|
|
8122
|
+
var _this53 = this;
|
|
7946
8123
|
/* global d3 options WebsyUtils */
|
|
8124
|
+
this._isRendered = false;
|
|
7947
8125
|
if (typeof options !== 'undefined') {
|
|
7948
8126
|
this.options = _extends({}, this.options, options);
|
|
7949
8127
|
if (this.options.legendOptions) {
|
|
@@ -8010,7 +8188,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8010
8188
|
this.options.data.series.map(function (s, i) {
|
|
8011
8189
|
return {
|
|
8012
8190
|
value: s.label || s.key,
|
|
8013
|
-
color: s.color ||
|
|
8191
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
8014
8192
|
};
|
|
8015
8193
|
});
|
|
8016
8194
|
}
|
|
@@ -8367,25 +8545,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8367
8545
|
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') {
|
|
8368
8546
|
var acc = 0;
|
|
8369
8547
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8370
|
-
var adjustment =
|
|
8548
|
+
var adjustment = _this53.bandPadding * index + _this53.bandPadding;
|
|
8371
8549
|
// if (this.options.data.bottom.padding) {
|
|
8372
8550
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8373
8551
|
// }
|
|
8374
|
-
var start =
|
|
8552
|
+
var start = _this53.widthForCalc / noOfPoints * acc;
|
|
8375
8553
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8376
8554
|
var pos = i * proposedBandWidth;
|
|
8377
|
-
|
|
8555
|
+
_this53["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8378
8556
|
}
|
|
8379
|
-
acc +=
|
|
8380
|
-
var end =
|
|
8557
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8558
|
+
var end = _this53.widthForCalc / noOfPoints * acc;
|
|
8381
8559
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8382
8560
|
return end + adjustment;
|
|
8383
8561
|
})));
|
|
8384
8562
|
acc = 0;
|
|
8385
8563
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8386
|
-
var adjustment =
|
|
8387
|
-
acc +=
|
|
8388
|
-
return (
|
|
8564
|
+
var adjustment = _this53.brushBandPadding * index + _this53.brushBandPadding;
|
|
8565
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8566
|
+
return (_this53.options.orientation === 'vertical' ? _this53.plotWidth : _this53.plotHeight) / noOfPoints * acc;
|
|
8389
8567
|
})));
|
|
8390
8568
|
}
|
|
8391
8569
|
// }
|
|
@@ -8558,7 +8736,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8558
8736
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
8559
8737
|
if (this.options.data.bottom.formatter) {
|
|
8560
8738
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8561
|
-
return
|
|
8739
|
+
return _this53.options.data.bottom.formatter(d);
|
|
8562
8740
|
});
|
|
8563
8741
|
}
|
|
8564
8742
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -8568,7 +8746,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8568
8746
|
}
|
|
8569
8747
|
if (this.customBottomRange.length > 0) {
|
|
8570
8748
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8571
|
-
return "translate(".concat(
|
|
8749
|
+
return "translate(".concat(_this53.customBottomRange[i] + (_this53.customBottomRange[i + 1] - _this53.customBottomRange[i]) / 2, ", 0)");
|
|
8572
8750
|
});
|
|
8573
8751
|
}
|
|
8574
8752
|
}
|
|
@@ -8587,14 +8765,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8587
8765
|
}
|
|
8588
8766
|
if (this.options.margin.axisLeft > 0) {
|
|
8589
8767
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8590
|
-
if (
|
|
8591
|
-
d =
|
|
8768
|
+
if (_this53.options.data.left.formatter) {
|
|
8769
|
+
d = _this53.options.data.left.formatter(d);
|
|
8592
8770
|
}
|
|
8593
8771
|
return d;
|
|
8594
8772
|
}));
|
|
8595
8773
|
if (this.customLeftRange.length > 0) {
|
|
8596
8774
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8597
|
-
return "translate(0, ".concat(
|
|
8775
|
+
return "translate(0, ".concat(_this53.customLeftRange[i] + (_this53.customLeftRange[i + 1] - _this53.customLeftRange[i]) / 2, ")");
|
|
8598
8776
|
});
|
|
8599
8777
|
}
|
|
8600
8778
|
}
|
|
@@ -8622,8 +8800,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8622
8800
|
}
|
|
8623
8801
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8624
8802
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8625
|
-
if (
|
|
8626
|
-
d =
|
|
8803
|
+
if (_this53.options.data.right.formatter) {
|
|
8804
|
+
d = _this53.options.data.right.formatter(d);
|
|
8627
8805
|
}
|
|
8628
8806
|
return d;
|
|
8629
8807
|
}));
|
|
@@ -8663,50 +8841,51 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8663
8841
|
}, {
|
|
8664
8842
|
key: "renderComponents",
|
|
8665
8843
|
value: function renderComponents() {
|
|
8666
|
-
var
|
|
8844
|
+
var _this54 = this;
|
|
8667
8845
|
// Draw the series data
|
|
8668
8846
|
this.renderedKeys = {};
|
|
8669
8847
|
this.options.data.series.forEach(function (series, index) {
|
|
8670
8848
|
if (!series.key) {
|
|
8671
|
-
series.key =
|
|
8849
|
+
series.key = _this54.createIdentity();
|
|
8672
8850
|
}
|
|
8673
8851
|
if (!series.color) {
|
|
8674
|
-
series.color =
|
|
8852
|
+
series.color = _this54.options.colors[index % _this54.options.colors.length];
|
|
8675
8853
|
}
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8854
|
+
_this54["render".concat(series.type || 'bar')](series, index);
|
|
8855
|
+
_this54.renderLabels(series, index);
|
|
8856
|
+
_this54.renderedKeys[series.key] = series.type;
|
|
8679
8857
|
});
|
|
8680
8858
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8681
8859
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8682
8860
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8683
8861
|
this.options.refLines.forEach(function (l) {
|
|
8684
|
-
return
|
|
8862
|
+
return _this54.renderRefLine(l);
|
|
8685
8863
|
});
|
|
8686
8864
|
}
|
|
8865
|
+
this._isRendered = true;
|
|
8687
8866
|
}
|
|
8688
8867
|
}, {
|
|
8689
8868
|
key: "renderarea",
|
|
8690
8869
|
value: function renderarea(series, index) {
|
|
8691
|
-
var
|
|
8870
|
+
var _this55 = this;
|
|
8692
8871
|
/* global d3 series index */
|
|
8693
8872
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8694
8873
|
return d3.area().x(function (d) {
|
|
8695
|
-
if (
|
|
8696
|
-
return
|
|
8874
|
+
if (_this55.options.data[xAxis].scale === 'Time') {
|
|
8875
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
|
|
8697
8876
|
} else {
|
|
8698
|
-
var xIndex =
|
|
8699
|
-
var xPos =
|
|
8700
|
-
if (
|
|
8701
|
-
xPos = xPos + (
|
|
8877
|
+
var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8878
|
+
var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8879
|
+
if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8880
|
+
xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8702
8881
|
}
|
|
8703
8882
|
return xPos;
|
|
8704
8883
|
}
|
|
8705
8884
|
}).y0(function (d) {
|
|
8706
|
-
return
|
|
8885
|
+
return _this55["".concat(yAxis, "Axis")](0);
|
|
8707
8886
|
}).y1(function (d) {
|
|
8708
|
-
return
|
|
8709
|
-
}).curve(d3[curveStyle ||
|
|
8887
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8888
|
+
}).curve(d3[curveStyle || _this55.options.curveStyle]);
|
|
8710
8889
|
};
|
|
8711
8890
|
var xAxis = 'bottom';
|
|
8712
8891
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8746,7 +8925,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8746
8925
|
}, {
|
|
8747
8926
|
key: "renderbar",
|
|
8748
8927
|
value: function renderbar(series, index) {
|
|
8749
|
-
var
|
|
8928
|
+
var _this56 = this;
|
|
8750
8929
|
/* global series index d3 */
|
|
8751
8930
|
var xAxis = 'bottom';
|
|
8752
8931
|
var yAxis = 'left';
|
|
@@ -8913,26 +9092,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8913
9092
|
}
|
|
8914
9093
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8915
9094
|
bars.attr('width', function (d, i) {
|
|
8916
|
-
return Math.abs(getBarWidth.call(
|
|
9095
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8917
9096
|
}).attr('height', function (d, i) {
|
|
8918
|
-
return getBarHeight.call(
|
|
9097
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8919
9098
|
}).attr('x', function (d, i) {
|
|
8920
|
-
return getBarX.call(
|
|
9099
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8921
9100
|
}).attr('y', function (d, i) {
|
|
8922
|
-
return getBarY.call(
|
|
9101
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8923
9102
|
})
|
|
8924
9103
|
// .transition(this.transition)
|
|
8925
9104
|
.attr('fill', function (d) {
|
|
8926
9105
|
return d.y.color || d.color || series.color;
|
|
8927
9106
|
});
|
|
8928
9107
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8929
|
-
return Math.abs(getBarWidth.call(
|
|
9108
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8930
9109
|
}).attr('height', function (d, i) {
|
|
8931
|
-
return getBarHeight.call(
|
|
9110
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8932
9111
|
}).attr('x', function (d, i) {
|
|
8933
|
-
return getBarX.call(
|
|
9112
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8934
9113
|
}).attr('y', function (d, i) {
|
|
8935
|
-
return getBarY.call(
|
|
9114
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8936
9115
|
})
|
|
8937
9116
|
// .transition(this.transition)
|
|
8938
9117
|
.attr('fill', function (d) {
|
|
@@ -8944,26 +9123,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8944
9123
|
this.brushBarsInitialized[series.key] = true;
|
|
8945
9124
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8946
9125
|
brushBars.attr('width', function (d, i) {
|
|
8947
|
-
return Math.abs(getBarWidth.call(
|
|
9126
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8948
9127
|
}).attr('height', function (d, i) {
|
|
8949
|
-
return getBarHeight.call(
|
|
9128
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8950
9129
|
}).attr('x', function (d, i) {
|
|
8951
|
-
return getBarX.call(
|
|
9130
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8952
9131
|
}).attr('y', function (d, i) {
|
|
8953
|
-
return getBarY.call(
|
|
9132
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8954
9133
|
})
|
|
8955
9134
|
// .transition(this.transition)
|
|
8956
9135
|
.attr('fill', function (d) {
|
|
8957
9136
|
return d.y.color || d.color || series.color;
|
|
8958
9137
|
});
|
|
8959
9138
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8960
|
-
return Math.abs(getBarWidth.call(
|
|
9139
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8961
9140
|
}).attr('height', function (d, i) {
|
|
8962
|
-
return getBarHeight.call(
|
|
9141
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8963
9142
|
}).attr('x', function (d, i) {
|
|
8964
|
-
return getBarX.call(
|
|
9143
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8965
9144
|
}).attr('y', function (d, i) {
|
|
8966
|
-
return getBarY.call(
|
|
9145
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8967
9146
|
})
|
|
8968
9147
|
// .transition(this.transition)
|
|
8969
9148
|
.attr('fill', function (d) {
|
|
@@ -8984,7 +9163,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8984
9163
|
}, {
|
|
8985
9164
|
key: "renderLabels",
|
|
8986
9165
|
value: function renderLabels(series, index) {
|
|
8987
|
-
var
|
|
9166
|
+
var _this57 = this;
|
|
8988
9167
|
/* global series index d3 WebsyDesigns */
|
|
8989
9168
|
var xAxis = 'bottom';
|
|
8990
9169
|
var yAxis = 'left';
|
|
@@ -9000,14 +9179,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9000
9179
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9001
9180
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9002
9181
|
labels.attr('x', function (d) {
|
|
9003
|
-
return getLabelX.call(
|
|
9182
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9004
9183
|
}).attr('y', function (d) {
|
|
9005
|
-
return getLabelY.call(
|
|
9184
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9006
9185
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9007
|
-
if (
|
|
9186
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9008
9187
|
return 'transparent';
|
|
9009
9188
|
}
|
|
9010
|
-
return
|
|
9189
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9011
9190
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9012
9191
|
return d.y.label || d.y.value;
|
|
9013
9192
|
}).each(function (d, i) {
|
|
@@ -9041,14 +9220,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9041
9220
|
}
|
|
9042
9221
|
});
|
|
9043
9222
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9044
|
-
return getLabelX.call(
|
|
9223
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9045
9224
|
}).attr('y', function (d) {
|
|
9046
|
-
return getLabelY.call(
|
|
9225
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9047
9226
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9048
|
-
if (
|
|
9227
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9049
9228
|
return 'transparent';
|
|
9050
9229
|
}
|
|
9051
|
-
return
|
|
9230
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9052
9231
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9053
9232
|
return d.y.label || d.y.value;
|
|
9054
9233
|
}).each(function (d, i) {
|
|
@@ -9126,32 +9305,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9126
9305
|
}, {
|
|
9127
9306
|
key: "renderline",
|
|
9128
9307
|
value: function renderline(series, index) {
|
|
9129
|
-
var
|
|
9308
|
+
var _this58 = this;
|
|
9130
9309
|
/* global series index d3 */
|
|
9131
9310
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9132
9311
|
return d3.line().x(function (d) {
|
|
9133
|
-
if (
|
|
9134
|
-
return
|
|
9312
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9313
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9135
9314
|
} else {
|
|
9136
|
-
if (
|
|
9137
|
-
return
|
|
9315
|
+
if (_this58.options.data[xAxis].scale === 'Time') {
|
|
9316
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
|
|
9138
9317
|
} else {
|
|
9139
|
-
var xIndex =
|
|
9140
|
-
var xPos =
|
|
9141
|
-
if (
|
|
9142
|
-
xPos = xPos + (
|
|
9318
|
+
var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9319
|
+
var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9320
|
+
if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9321
|
+
xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9143
9322
|
}
|
|
9144
9323
|
return xPos;
|
|
9145
9324
|
}
|
|
9146
9325
|
}
|
|
9147
9326
|
}).y(function (d) {
|
|
9148
|
-
if (
|
|
9149
|
-
var adjustment =
|
|
9150
|
-
return
|
|
9327
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9328
|
+
var adjustment = _this58.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
|
|
9329
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value)) + adjustment;
|
|
9151
9330
|
} else {
|
|
9152
|
-
return
|
|
9331
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9153
9332
|
}
|
|
9154
|
-
}).curve(d3[curveStyle ||
|
|
9333
|
+
}).curve(d3[curveStyle || _this58.options.curveStyle]);
|
|
9155
9334
|
};
|
|
9156
9335
|
var xAxis = 'bottom';
|
|
9157
9336
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9260,14 +9439,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9260
9439
|
}, {
|
|
9261
9440
|
key: "rendersymbol",
|
|
9262
9441
|
value: function rendersymbol(series, index) {
|
|
9263
|
-
var
|
|
9442
|
+
var _this59 = this;
|
|
9264
9443
|
/* global d3 series index series.key */
|
|
9265
9444
|
var drawSymbol = function drawSymbol(size) {
|
|
9266
9445
|
return d3.symbol()
|
|
9267
9446
|
// .type(d => {
|
|
9268
9447
|
// return d3.symbols[0]
|
|
9269
9448
|
// })
|
|
9270
|
-
.size(size ||
|
|
9449
|
+
.size(size || _this59.options.symbolSize);
|
|
9271
9450
|
};
|
|
9272
9451
|
var xAxis = 'bottom';
|
|
9273
9452
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9293,27 +9472,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9293
9472
|
// else {
|
|
9294
9473
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9295
9474
|
// }
|
|
9296
|
-
var xIndex =
|
|
9297
|
-
var xPos =
|
|
9298
|
-
if (
|
|
9299
|
-
xPos = xPos + (
|
|
9300
|
-
}
|
|
9301
|
-
var adjustment =
|
|
9302
|
-
if (
|
|
9303
|
-
return "translate(".concat(
|
|
9475
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9476
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9477
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9478
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9479
|
+
}
|
|
9480
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9481
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9482
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9304
9483
|
} else {
|
|
9305
|
-
if (
|
|
9306
|
-
xPos =
|
|
9484
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9485
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9307
9486
|
} else {
|
|
9308
|
-
var _xIndex =
|
|
9309
|
-
var _xPos =
|
|
9310
|
-
if (
|
|
9311
|
-
_xPos = _xPos + (
|
|
9487
|
+
var _xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9488
|
+
var _xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
9489
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
9490
|
+
_xPos = _xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
9312
9491
|
}
|
|
9313
9492
|
// return xPos
|
|
9314
9493
|
}
|
|
9315
9494
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9316
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9495
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9317
9496
|
}
|
|
9318
9497
|
});
|
|
9319
9498
|
// Enter
|
|
@@ -9328,27 +9507,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9328
9507
|
}).attr('class', function (d) {
|
|
9329
9508
|
return "symbol symbol_".concat(series.key);
|
|
9330
9509
|
}).attr('transform', function (d) {
|
|
9331
|
-
var xIndex =
|
|
9332
|
-
var xPos =
|
|
9333
|
-
if (
|
|
9334
|
-
xPos = xPos + (
|
|
9335
|
-
}
|
|
9336
|
-
var adjustment =
|
|
9337
|
-
if (
|
|
9338
|
-
return "translate(".concat(
|
|
9510
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9511
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9512
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9513
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9514
|
+
}
|
|
9515
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9516
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9517
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9339
9518
|
} else {
|
|
9340
|
-
if (
|
|
9341
|
-
xPos =
|
|
9519
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9520
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9342
9521
|
} else {
|
|
9343
|
-
var _xIndex2 =
|
|
9344
|
-
var _xPos2 =
|
|
9345
|
-
if (
|
|
9346
|
-
_xPos2 = _xPos2 + (
|
|
9522
|
+
var _xIndex2 = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9523
|
+
var _xPos2 = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
9524
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
9525
|
+
_xPos2 = _xPos2 + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
9347
9526
|
}
|
|
9348
9527
|
// return xPos
|
|
9349
9528
|
}
|
|
9350
9529
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9351
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9530
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9352
9531
|
}
|
|
9353
9532
|
});
|
|
9354
9533
|
}
|
|
@@ -9971,7 +10150,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9971
10150
|
}, {
|
|
9972
10151
|
key: "resize",
|
|
9973
10152
|
value: function resize() {
|
|
9974
|
-
var
|
|
10153
|
+
var _this60 = this;
|
|
9975
10154
|
var el = document.getElementById(this.elementId);
|
|
9976
10155
|
if (el) {
|
|
9977
10156
|
// if (this.options.width) {
|
|
@@ -9982,7 +10161,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9982
10161
|
// }
|
|
9983
10162
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9984
10163
|
html += this._data.map(function (d, i) {
|
|
9985
|
-
return
|
|
10164
|
+
return _this60.getLegendItemHTML(d);
|
|
9986
10165
|
}).join('');
|
|
9987
10166
|
html += "\n <div>\n ";
|
|
9988
10167
|
el.innerHTML = html;
|
|
@@ -10027,11 +10206,18 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
10027
10206
|
};
|
|
10028
10207
|
this.elementId = elementId;
|
|
10029
10208
|
this.options = _extends({}, DEFAULTS, options);
|
|
10209
|
+
this._isRendered = false;
|
|
10030
10210
|
this.render();
|
|
10031
10211
|
}
|
|
10032
10212
|
_createClass(WebsyKPI, [{
|
|
10213
|
+
key: "isRendered",
|
|
10214
|
+
get: function get() {
|
|
10215
|
+
return this._isRendered;
|
|
10216
|
+
}
|
|
10217
|
+
}, {
|
|
10033
10218
|
key: "render",
|
|
10034
10219
|
value: function render(options) {
|
|
10220
|
+
this._isRendered = false;
|
|
10035
10221
|
this.options = _extends({}, this.options, options);
|
|
10036
10222
|
if (!this.options.label.classes) {
|
|
10037
10223
|
this.options.label.classes = [];
|
|
@@ -10066,6 +10252,7 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
10066
10252
|
}
|
|
10067
10253
|
html += " \n </div>\n </div>\n ";
|
|
10068
10254
|
el.innerHTML = html;
|
|
10255
|
+
this._isRendered = true;
|
|
10069
10256
|
}
|
|
10070
10257
|
}
|
|
10071
10258
|
}]);
|
|
@@ -10089,6 +10276,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10089
10276
|
};
|
|
10090
10277
|
this.elementId = elementId;
|
|
10091
10278
|
this.options = _extends({}, DEFAULTS, options);
|
|
10279
|
+
this._isRendered = false;
|
|
10092
10280
|
if (!elementId) {
|
|
10093
10281
|
console.log('No element Id provided for Websy Map');
|
|
10094
10282
|
return;
|
|
@@ -10118,6 +10306,11 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10118
10306
|
}
|
|
10119
10307
|
}
|
|
10120
10308
|
_createClass(WebsyMap, [{
|
|
10309
|
+
key: "isRendered",
|
|
10310
|
+
get: function get() {
|
|
10311
|
+
return this._isRendered;
|
|
10312
|
+
}
|
|
10313
|
+
}, {
|
|
10121
10314
|
key: "handleClick",
|
|
10122
10315
|
value: function handleClick(event) {}
|
|
10123
10316
|
}, {
|
|
@@ -10126,14 +10319,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10126
10319
|
}, {
|
|
10127
10320
|
key: "render",
|
|
10128
10321
|
value: function render() {
|
|
10129
|
-
var
|
|
10322
|
+
var _this61 = this;
|
|
10323
|
+
this._isRendered = false;
|
|
10130
10324
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10131
10325
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10132
10326
|
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
10133
10327
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10134
10328
|
return {
|
|
10135
10329
|
value: s.label || s.key,
|
|
10136
|
-
color: s.color ||
|
|
10330
|
+
color: s.color || _this61.options.colors[i % _this61.options.colors.length]
|
|
10137
10331
|
};
|
|
10138
10332
|
});
|
|
10139
10333
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10187,7 +10381,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10187
10381
|
}
|
|
10188
10382
|
if (this.polygons) {
|
|
10189
10383
|
this.polygons.forEach(function (p) {
|
|
10190
|
-
return
|
|
10384
|
+
return _this61.map.removeLayer(p);
|
|
10191
10385
|
});
|
|
10192
10386
|
}
|
|
10193
10387
|
this.polygons = [];
|
|
@@ -10241,15 +10435,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10241
10435
|
p.options = {};
|
|
10242
10436
|
}
|
|
10243
10437
|
if (!p.options.color) {
|
|
10244
|
-
p.options.color =
|
|
10438
|
+
p.options.color = _this61.options.colors[i % _this61.options.colors.length];
|
|
10245
10439
|
}
|
|
10246
10440
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10247
10441
|
return c.map(function (d) {
|
|
10248
10442
|
return [d.Latitude, d.Longitude];
|
|
10249
10443
|
});
|
|
10250
|
-
}), p.options).addTo(
|
|
10251
|
-
|
|
10252
|
-
|
|
10444
|
+
}), p.options).addTo(_this61.map);
|
|
10445
|
+
_this61.polygons.push(pol);
|
|
10446
|
+
_this61.map.fitBounds(pol.getBounds());
|
|
10253
10447
|
});
|
|
10254
10448
|
}
|
|
10255
10449
|
// if (this.data.markers.length > 0) {
|
|
@@ -10268,6 +10462,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10268
10462
|
} else if (this.options.center) {
|
|
10269
10463
|
this.map.setView(this.options.center, this.options.zoom || null);
|
|
10270
10464
|
}
|
|
10465
|
+
this._isRendered = true;
|
|
10271
10466
|
}
|
|
10272
10467
|
}]);
|
|
10273
10468
|
return WebsyMap;
|