@websy/websy-designs 1.9.14 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/authHelper.js +11 -11
- package/dist/server/helpers/v1/pgHelper.js +78 -7
- package/dist/server/helpers/v1/puppeteer-report/examples/package-lock.json +972 -0
- package/dist/server/routes/v1/api.js +26 -10
- package/dist/websy-designs-es6.debug.js +157 -17
- package/dist/websy-designs-es6.js +477 -312
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +167 -22
- package/dist/websy-designs.js +483 -317
- 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) {
|
|
@@ -3498,48 +3613,48 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3498
3613
|
_createClass(WebsyPDFButton, [{
|
|
3499
3614
|
key: "handleClick",
|
|
3500
3615
|
value: function handleClick(event) {
|
|
3501
|
-
var
|
|
3616
|
+
var _this27 = this;
|
|
3502
3617
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3503
3618
|
this.loader.show();
|
|
3504
3619
|
setTimeout(function () {
|
|
3505
|
-
if (
|
|
3506
|
-
var el = document.getElementById(
|
|
3620
|
+
if (_this27.options.targetId) {
|
|
3621
|
+
var el = document.getElementById(_this27.options.targetId);
|
|
3507
3622
|
if (el) {
|
|
3508
3623
|
var pdfData = {
|
|
3509
3624
|
options: {}
|
|
3510
3625
|
};
|
|
3511
|
-
if (
|
|
3512
|
-
pdfData.options = _extends({},
|
|
3626
|
+
if (_this27.options.pdfOptions) {
|
|
3627
|
+
pdfData.options = _extends({}, _this27.options.pdfOptions);
|
|
3513
3628
|
}
|
|
3514
|
-
if (
|
|
3515
|
-
if (
|
|
3516
|
-
var headerEl = document.getElementById(
|
|
3629
|
+
if (_this27.options.header) {
|
|
3630
|
+
if (_this27.options.header.elementId) {
|
|
3631
|
+
var headerEl = document.getElementById(_this27.options.header.elementId);
|
|
3517
3632
|
if (headerEl) {
|
|
3518
3633
|
pdfData.header = headerEl.outerHTML;
|
|
3519
|
-
if (
|
|
3520
|
-
pdfData.options.headerCSS =
|
|
3634
|
+
if (_this27.options.header.css) {
|
|
3635
|
+
pdfData.options.headerCSS = _this27.options.header.css;
|
|
3521
3636
|
}
|
|
3522
3637
|
}
|
|
3523
|
-
} else if (
|
|
3524
|
-
pdfData.header =
|
|
3525
|
-
if (
|
|
3526
|
-
pdfData.options.headerCSS =
|
|
3638
|
+
} else if (_this27.options.header.html) {
|
|
3639
|
+
pdfData.header = _this27.options.header.html;
|
|
3640
|
+
if (_this27.options.header.css) {
|
|
3641
|
+
pdfData.options.headerCSS = _this27.options.header.css;
|
|
3527
3642
|
}
|
|
3528
3643
|
} else {
|
|
3529
|
-
pdfData.header =
|
|
3644
|
+
pdfData.header = _this27.options.header;
|
|
3530
3645
|
}
|
|
3531
3646
|
}
|
|
3532
|
-
if (
|
|
3533
|
-
if (
|
|
3534
|
-
var footerEl = document.getElementById(
|
|
3647
|
+
if (_this27.options.footer) {
|
|
3648
|
+
if (_this27.options.footer.elementId) {
|
|
3649
|
+
var footerEl = document.getElementById(_this27.options.footer.elementId);
|
|
3535
3650
|
if (footerEl) {
|
|
3536
3651
|
pdfData.footer = footerEl.outerHTML;
|
|
3537
|
-
if (
|
|
3538
|
-
pdfData.options.footerCSS =
|
|
3652
|
+
if (_this27.options.footer.css) {
|
|
3653
|
+
pdfData.options.footerCSS = _this27.options.footer.css;
|
|
3539
3654
|
}
|
|
3540
3655
|
}
|
|
3541
3656
|
} else {
|
|
3542
|
-
pdfData.footer =
|
|
3657
|
+
pdfData.footer = _this27.options.footer;
|
|
3543
3658
|
}
|
|
3544
3659
|
}
|
|
3545
3660
|
pdfData.html = el.outerHTML;
|
|
@@ -3547,25 +3662,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3547
3662
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3548
3663
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3549
3664
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3550
|
-
|
|
3665
|
+
_this27.service.add('', pdfData, {
|
|
3551
3666
|
responseType: 'blob'
|
|
3552
3667
|
}).then(function (response) {
|
|
3553
|
-
|
|
3668
|
+
_this27.loader.hide();
|
|
3554
3669
|
var blob = new Blob([response], {
|
|
3555
3670
|
type: 'application/pdf'
|
|
3556
3671
|
});
|
|
3557
3672
|
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 (
|
|
3673
|
+
if (_this27.options.directDownload === true) {
|
|
3559
3674
|
var fileName;
|
|
3560
|
-
if (typeof
|
|
3561
|
-
fileName =
|
|
3675
|
+
if (typeof _this27.options.fileName === 'function') {
|
|
3676
|
+
fileName = _this27.options.fileName() || 'Export';
|
|
3562
3677
|
} else {
|
|
3563
|
-
fileName =
|
|
3678
|
+
fileName = _this27.options.fileName || 'Export';
|
|
3564
3679
|
}
|
|
3565
3680
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3566
3681
|
}
|
|
3567
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3568
|
-
|
|
3682
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this27.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3683
|
+
_this27.popup.show({
|
|
3569
3684
|
message: msg,
|
|
3570
3685
|
mask: true
|
|
3571
3686
|
});
|
|
@@ -3714,6 +3829,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3714
3829
|
}, {
|
|
3715
3830
|
key: "subscribe",
|
|
3716
3831
|
value: function subscribe(id, method, fn) {
|
|
3832
|
+
if (!this.subscriptions) {
|
|
3833
|
+
this.subscriptions = {};
|
|
3834
|
+
}
|
|
3717
3835
|
if (arguments.length === 3) {
|
|
3718
3836
|
if (!this.subscriptions[id]) {
|
|
3719
3837
|
this.subscriptions[id] = {};
|
|
@@ -3733,7 +3851,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3733
3851
|
}();
|
|
3734
3852
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3735
3853
|
function ResponsiveText(elementId, options) {
|
|
3736
|
-
var
|
|
3854
|
+
var _this28 = this;
|
|
3737
3855
|
_classCallCheck(this, ResponsiveText);
|
|
3738
3856
|
var DEFAULTS = {
|
|
3739
3857
|
textAlign: 'center',
|
|
@@ -3744,7 +3862,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3744
3862
|
this.elementId = elementId;
|
|
3745
3863
|
this.canvas = document.createElement('canvas');
|
|
3746
3864
|
window.addEventListener('resize', function () {
|
|
3747
|
-
return
|
|
3865
|
+
return _this28.render();
|
|
3748
3866
|
});
|
|
3749
3867
|
var el = document.getElementById(this.elementId);
|
|
3750
3868
|
if (el) {
|
|
@@ -3934,7 +4052,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3934
4052
|
/* global WebsyDesigns */
|
|
3935
4053
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3936
4054
|
function WebsyResultList(elementId, options) {
|
|
3937
|
-
var
|
|
4055
|
+
var _this29 = this;
|
|
3938
4056
|
_classCallCheck(this, WebsyResultList);
|
|
3939
4057
|
var DEFAULTS = {
|
|
3940
4058
|
listeners: {
|
|
@@ -3960,8 +4078,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3960
4078
|
}
|
|
3961
4079
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3962
4080
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3963
|
-
|
|
3964
|
-
|
|
4081
|
+
_this29.options.template = templateString;
|
|
4082
|
+
_this29.render();
|
|
3965
4083
|
});
|
|
3966
4084
|
} else {
|
|
3967
4085
|
this.render();
|
|
@@ -3980,7 +4098,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3980
4098
|
}, {
|
|
3981
4099
|
key: "buildHTML",
|
|
3982
4100
|
value: function buildHTML(d) {
|
|
3983
|
-
var
|
|
4101
|
+
var _this30 = this;
|
|
3984
4102
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3985
4103
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3986
4104
|
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -3988,7 +4106,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3988
4106
|
if (this.options.template) {
|
|
3989
4107
|
if (d.length > 0) {
|
|
3990
4108
|
d.forEach(function (row, ix) {
|
|
3991
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4109
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this30.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3992
4110
|
// find conditional elements
|
|
3993
4111
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3994
4112
|
ifMatches.forEach(function (m) {
|
|
@@ -4076,7 +4194,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4076
4194
|
parts.forEach(function (p) {
|
|
4077
4195
|
items = items[p];
|
|
4078
4196
|
});
|
|
4079
|
-
template = template.replace(m[0],
|
|
4197
|
+
template = template.replace(m[0], _this30.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4080
4198
|
}
|
|
4081
4199
|
});
|
|
4082
4200
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4085,7 +4203,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4085
4203
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4086
4204
|
}
|
|
4087
4205
|
});
|
|
4088
|
-
var flatRow =
|
|
4206
|
+
var flatRow = _this30.flattenObject(row);
|
|
4089
4207
|
for (var key in flatRow) {
|
|
4090
4208
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4091
4209
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4210,15 +4328,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4210
4328
|
}, {
|
|
4211
4329
|
key: "render",
|
|
4212
4330
|
value: function render() {
|
|
4213
|
-
var
|
|
4331
|
+
var _this31 = this;
|
|
4214
4332
|
if (this.options.entity) {
|
|
4215
4333
|
var url = this.options.entity;
|
|
4216
4334
|
if (this.options.sortField) {
|
|
4217
4335
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4218
4336
|
}
|
|
4219
4337
|
this.apiService.get(url).then(function (results) {
|
|
4220
|
-
|
|
4221
|
-
|
|
4338
|
+
_this31.rows = results.rows;
|
|
4339
|
+
_this31.resize();
|
|
4222
4340
|
});
|
|
4223
4341
|
} else {
|
|
4224
4342
|
this.resize();
|
|
@@ -4288,12 +4406,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4288
4406
|
_createClass(WebsyRouter, [{
|
|
4289
4407
|
key: "addGroup",
|
|
4290
4408
|
value: function addGroup(group) {
|
|
4291
|
-
var
|
|
4409
|
+
var _this32 = this;
|
|
4292
4410
|
if (!this.groups[group]) {
|
|
4293
4411
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4294
4412
|
if (els) {
|
|
4295
4413
|
this.getClosestParent(els[0], function (parent) {
|
|
4296
|
-
|
|
4414
|
+
_this32.groups[group] = {
|
|
4297
4415
|
activeView: '',
|
|
4298
4416
|
views: [],
|
|
4299
4417
|
parent: parent.getAttribute('data-view')
|
|
@@ -4357,7 +4475,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4357
4475
|
}, {
|
|
4358
4476
|
key: "removeUrlParams",
|
|
4359
4477
|
value: function removeUrlParams() {
|
|
4360
|
-
var
|
|
4478
|
+
var _this33 = this;
|
|
4361
4479
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4362
4480
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4363
4481
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4365,7 +4483,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4365
4483
|
var path = '';
|
|
4366
4484
|
if (this.currentParams && this.currentParams.items) {
|
|
4367
4485
|
params.forEach(function (p) {
|
|
4368
|
-
delete
|
|
4486
|
+
delete _this33.currentParams.items[p];
|
|
4369
4487
|
});
|
|
4370
4488
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4371
4489
|
}
|
|
@@ -4696,11 +4814,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4696
4814
|
}, {
|
|
4697
4815
|
key: "showComponents",
|
|
4698
4816
|
value: function showComponents(view) {
|
|
4699
|
-
var
|
|
4817
|
+
var _this34 = this;
|
|
4700
4818
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4701
4819
|
this.options.views[view].components.forEach(function (c) {
|
|
4702
4820
|
if (typeof c.instance === 'undefined') {
|
|
4703
|
-
|
|
4821
|
+
_this34.prepComponent(c.elementId, c.options);
|
|
4704
4822
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4705
4823
|
} else if (c.instance.render) {
|
|
4706
4824
|
c.instance.render();
|
|
@@ -5020,7 +5138,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5020
5138
|
}, {
|
|
5021
5139
|
key: "handleKeyUp",
|
|
5022
5140
|
value: function handleKeyUp(event) {
|
|
5023
|
-
var
|
|
5141
|
+
var _this35 = this;
|
|
5024
5142
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5025
5143
|
if (this.searchTimeoutFn) {
|
|
5026
5144
|
clearTimeout(this.searchTimeoutFn);
|
|
@@ -5038,8 +5156,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5038
5156
|
}
|
|
5039
5157
|
if (event.target.value.length >= this.options.minLength) {
|
|
5040
5158
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5041
|
-
if (
|
|
5042
|
-
|
|
5159
|
+
if (_this35.options.onSearch) {
|
|
5160
|
+
_this35.options.onSearch(event.target.value, event);
|
|
5043
5161
|
}
|
|
5044
5162
|
}, this.options.searchTimeout);
|
|
5045
5163
|
} else {
|
|
@@ -5197,7 +5315,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5197
5315
|
/* global WebsyDesigns */
|
|
5198
5316
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5199
5317
|
function WebsyTemplate(elementId, options) {
|
|
5200
|
-
var
|
|
5318
|
+
var _this36 = this;
|
|
5201
5319
|
_classCallCheck(this, WebsyTemplate);
|
|
5202
5320
|
var DEFAULTS = {
|
|
5203
5321
|
listeners: {
|
|
@@ -5217,8 +5335,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5217
5335
|
}
|
|
5218
5336
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5219
5337
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5220
|
-
|
|
5221
|
-
|
|
5338
|
+
_this36.options.template = templateString;
|
|
5339
|
+
_this36.render();
|
|
5222
5340
|
});
|
|
5223
5341
|
} else {
|
|
5224
5342
|
this.render();
|
|
@@ -5227,7 +5345,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5227
5345
|
_createClass(WebsyTemplate, [{
|
|
5228
5346
|
key: "buildHTML",
|
|
5229
5347
|
value: function buildHTML() {
|
|
5230
|
-
var
|
|
5348
|
+
var _this37 = this;
|
|
5231
5349
|
var html = "";
|
|
5232
5350
|
if (this.options.template) {
|
|
5233
5351
|
var template = this.options.template;
|
|
@@ -5276,14 +5394,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5276
5394
|
}
|
|
5277
5395
|
}
|
|
5278
5396
|
if (polarity === true) {
|
|
5279
|
-
if (typeof
|
|
5397
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] === parts[1]) {
|
|
5280
5398
|
// remove the <if> tags
|
|
5281
5399
|
removeAll = false;
|
|
5282
5400
|
} else if (parts[0] === parts[1]) {
|
|
5283
5401
|
removeAll = false;
|
|
5284
5402
|
}
|
|
5285
5403
|
} else if (polarity === false) {
|
|
5286
|
-
if (typeof
|
|
5404
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] !== parts[1]) {
|
|
5287
5405
|
// remove the <if> tags
|
|
5288
5406
|
removeAll = false;
|
|
5289
5407
|
}
|
|
@@ -5320,7 +5438,55 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5320
5438
|
}, {
|
|
5321
5439
|
key: "handleClick",
|
|
5322
5440
|
value: function handleClick(event) {
|
|
5323
|
-
|
|
5441
|
+
if (event.target.classList.contains('clickable')) {
|
|
5442
|
+
this.handleEvent(event, 'clickable', 'click');
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
}, {
|
|
5446
|
+
key: "handleEvent",
|
|
5447
|
+
value: function handleEvent(event, eventType, action) {
|
|
5448
|
+
var l = event.target.getAttribute('data-event');
|
|
5449
|
+
if (l) {
|
|
5450
|
+
l = l.split('(');
|
|
5451
|
+
var params = [];
|
|
5452
|
+
var id = event.target.getAttribute('data-id');
|
|
5453
|
+
// const locator = event.target.getAttribute('data-locator')
|
|
5454
|
+
// if (l[1]) {
|
|
5455
|
+
// l[1] = l[1].replace(')', '')
|
|
5456
|
+
// params = l[1].split(',')
|
|
5457
|
+
// }
|
|
5458
|
+
// l = l[0]
|
|
5459
|
+
var data = this.options.data;
|
|
5460
|
+
// if (locator !== '') {
|
|
5461
|
+
// let locatorItems = locator.split(';')
|
|
5462
|
+
// locatorItems.forEach(loc => {
|
|
5463
|
+
// let locatorParts = loc.split(':')
|
|
5464
|
+
// if (data[locatorParts[0]]) {
|
|
5465
|
+
// data = data[locatorParts[0]]
|
|
5466
|
+
// let parts = locatorParts[1].split('.')
|
|
5467
|
+
// parts.forEach(p => {
|
|
5468
|
+
// data = data[p]
|
|
5469
|
+
// })
|
|
5470
|
+
// }
|
|
5471
|
+
// })
|
|
5472
|
+
// }
|
|
5473
|
+
// params = params.map(p => {
|
|
5474
|
+
// if (typeof p !== 'string' && typeof p !== 'number') {
|
|
5475
|
+
// if (data[+id]) {
|
|
5476
|
+
// p = data[+id][p]
|
|
5477
|
+
// }
|
|
5478
|
+
// }
|
|
5479
|
+
// else if (typeof p === 'string') {
|
|
5480
|
+
// p = p.replace(/"/g, '').replace(/'/g, '')
|
|
5481
|
+
// }
|
|
5482
|
+
// return p
|
|
5483
|
+
// })
|
|
5484
|
+
if (event.target.classList.contains(eventType) && this.options.listeners[action] && this.options.listeners[action][l]) {
|
|
5485
|
+
var _this$options$listene2;
|
|
5486
|
+
event.stopPropagation();
|
|
5487
|
+
(_this$options$listene2 = this.options.listeners[action][l]).call.apply(_this$options$listene2, [this, event, data[+id]].concat(params));
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5324
5490
|
}
|
|
5325
5491
|
}, {
|
|
5326
5492
|
key: "render",
|
|
@@ -5544,7 +5710,7 @@ var WebsyUtils = {
|
|
|
5544
5710
|
/* global WebsyDesigns */
|
|
5545
5711
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5546
5712
|
function WebsyTable(elementId, options) {
|
|
5547
|
-
var
|
|
5713
|
+
var _this38 = this;
|
|
5548
5714
|
_classCallCheck(this, WebsyTable);
|
|
5549
5715
|
var DEFAULTS = {
|
|
5550
5716
|
pageSize: 20,
|
|
@@ -5576,8 +5742,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5576
5742
|
allowClear: false,
|
|
5577
5743
|
disableSearch: true,
|
|
5578
5744
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5579
|
-
if (
|
|
5580
|
-
|
|
5745
|
+
if (_this38.options.onChangePageSize) {
|
|
5746
|
+
_this38.options.onChangePageSize(selectedItem.value);
|
|
5581
5747
|
}
|
|
5582
5748
|
}
|
|
5583
5749
|
});
|
|
@@ -5596,19 +5762,19 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5596
5762
|
_createClass(WebsyTable, [{
|
|
5597
5763
|
key: "appendRows",
|
|
5598
5764
|
value: function appendRows(data) {
|
|
5599
|
-
var
|
|
5765
|
+
var _this39 = this;
|
|
5600
5766
|
this.hideError();
|
|
5601
5767
|
var bodyHTML = '';
|
|
5602
5768
|
if (data) {
|
|
5603
5769
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5604
5770
|
return '<tr>' + r.map(function (c, i) {
|
|
5605
|
-
if (
|
|
5771
|
+
if (_this39.options.columns[i].show !== false) {
|
|
5606
5772
|
var style = '';
|
|
5607
5773
|
if (c.style) {
|
|
5608
5774
|
style += c.style;
|
|
5609
5775
|
}
|
|
5610
|
-
if (
|
|
5611
|
-
style += "width: ".concat(
|
|
5776
|
+
if (_this39.options.columns[i].width) {
|
|
5777
|
+
style += "width: ".concat(_this39.options.columns[i].width, "; ");
|
|
5612
5778
|
}
|
|
5613
5779
|
if (c.backgroundColor) {
|
|
5614
5780
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5619,16 +5785,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5619
5785
|
if (c.color) {
|
|
5620
5786
|
style += "color: ".concat(c.color, "; ");
|
|
5621
5787
|
}
|
|
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(
|
|
5788
|
+
if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5789
|
+
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 ");
|
|
5790
|
+
} else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5791
|
+
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
5792
|
} else {
|
|
5627
5793
|
var info = c.value;
|
|
5628
|
-
if (
|
|
5794
|
+
if (_this39.options.columns[i].showAsImage === true) {
|
|
5629
5795
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5630
5796
|
}
|
|
5631
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5797
|
+
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
5798
|
}
|
|
5633
5799
|
}
|
|
5634
5800
|
}).join('') + '</tr>';
|
|
@@ -5787,7 +5953,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5787
5953
|
}, {
|
|
5788
5954
|
key: "render",
|
|
5789
5955
|
value: function render(data) {
|
|
5790
|
-
var
|
|
5956
|
+
var _this40 = this;
|
|
5791
5957
|
if (!this.options.columns) {
|
|
5792
5958
|
return;
|
|
5793
5959
|
}
|
|
@@ -5814,7 +5980,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5814
5980
|
if (c.width) {
|
|
5815
5981
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5816
5982
|
}
|
|
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 ?
|
|
5983
|
+
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
5984
|
}
|
|
5819
5985
|
}).join('') + '</tr>';
|
|
5820
5986
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5832,7 +5998,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5832
5998
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5833
5999
|
if (pagingEl) {
|
|
5834
6000
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5835
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6001
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5836
6002
|
});
|
|
5837
6003
|
var startIndex = 0;
|
|
5838
6004
|
if (this.options.pageCount > 8) {
|
|
@@ -5887,7 +6053,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5887
6053
|
/* global WebsyDesigns */
|
|
5888
6054
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5889
6055
|
function WebsyTable2(elementId, options) {
|
|
5890
|
-
var
|
|
6056
|
+
var _this41 = this;
|
|
5891
6057
|
_classCallCheck(this, WebsyTable2);
|
|
5892
6058
|
var DEFAULTS = {
|
|
5893
6059
|
pageSize: 20,
|
|
@@ -5922,8 +6088,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5922
6088
|
allowClear: false,
|
|
5923
6089
|
disableSearch: true,
|
|
5924
6090
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5925
|
-
if (
|
|
5926
|
-
|
|
6091
|
+
if (_this41.options.onChangePageSize) {
|
|
6092
|
+
_this41.options.onChangePageSize(selectedItem.value);
|
|
5927
6093
|
}
|
|
5928
6094
|
}
|
|
5929
6095
|
});
|
|
@@ -5945,20 +6111,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5945
6111
|
_createClass(WebsyTable2, [{
|
|
5946
6112
|
key: "appendRows",
|
|
5947
6113
|
value: function appendRows(data) {
|
|
5948
|
-
var
|
|
6114
|
+
var _this42 = this;
|
|
5949
6115
|
this.hideError();
|
|
5950
6116
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5951
6117
|
var bodyHTML = '';
|
|
5952
6118
|
if (data) {
|
|
5953
6119
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5954
6120
|
return '<tr>' + r.map(function (c, i) {
|
|
5955
|
-
if (
|
|
5956
|
-
var style = "height: ".concat(
|
|
6121
|
+
if (_this42.options.columns[i].show !== false) {
|
|
6122
|
+
var style = "height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px;");
|
|
5957
6123
|
if (c.style) {
|
|
5958
6124
|
style += c.style;
|
|
5959
6125
|
}
|
|
5960
|
-
if (
|
|
5961
|
-
style += "width: ".concat(
|
|
6126
|
+
if (_this42.options.columns[i].width) {
|
|
6127
|
+
style += "width: ".concat(_this42.options.columns[i].width, "; ");
|
|
5962
6128
|
}
|
|
5963
6129
|
if (c.backgroundColor) {
|
|
5964
6130
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5969,16 +6135,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5969
6135
|
if (c.color) {
|
|
5970
6136
|
style += "color: ".concat(c.color, "; ");
|
|
5971
6137
|
}
|
|
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(
|
|
6138
|
+
if (_this42.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6139
|
+
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 ");
|
|
6140
|
+
} else if ((_this42.options.columns[i].showAsNavigatorLink === true || _this42.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6141
|
+
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
6142
|
} else {
|
|
5977
6143
|
var info = c.value;
|
|
5978
|
-
if (
|
|
6144
|
+
if (_this42.options.columns[i].showAsImage === true) {
|
|
5979
6145
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5980
6146
|
}
|
|
5981
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6147
|
+
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
6148
|
}
|
|
5983
6149
|
}
|
|
5984
6150
|
}).join('') + '</tr>';
|
|
@@ -6212,7 +6378,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6212
6378
|
}, {
|
|
6213
6379
|
key: "render",
|
|
6214
6380
|
value: function render(data) {
|
|
6215
|
-
var
|
|
6381
|
+
var _this43 = this;
|
|
6216
6382
|
if (!this.options.columns) {
|
|
6217
6383
|
return;
|
|
6218
6384
|
}
|
|
@@ -6240,7 +6406,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6240
6406
|
if (c.width) {
|
|
6241
6407
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6242
6408
|
}
|
|
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 ?
|
|
6409
|
+
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
6410
|
}
|
|
6245
6411
|
}).join('') + '</tr>';
|
|
6246
6412
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6250,7 +6416,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6250
6416
|
var dropdownHTML = "";
|
|
6251
6417
|
this.options.columns.forEach(function (c, i) {
|
|
6252
6418
|
if (c.searchable && c.searchField) {
|
|
6253
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6419
|
+
dropdownHTML += "\n <div id=\"".concat(_this43.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6254
6420
|
}
|
|
6255
6421
|
});
|
|
6256
6422
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6270,7 +6436,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6270
6436
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6271
6437
|
if (pagingEl) {
|
|
6272
6438
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6273
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6439
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this43.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6274
6440
|
});
|
|
6275
6441
|
var startIndex = 0;
|
|
6276
6442
|
if (this.options.pageCount > 8) {
|
|
@@ -6347,17 +6513,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6347
6513
|
}, {
|
|
6348
6514
|
key: "getColumnParameters",
|
|
6349
6515
|
value: function getColumnParameters(values) {
|
|
6350
|
-
var
|
|
6516
|
+
var _this44 = this;
|
|
6351
6517
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6352
6518
|
tableEl.style.tableLayout = 'auto';
|
|
6353
6519
|
tableEl.style.width = 'auto';
|
|
6354
6520
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6355
6521
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6356
6522
|
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 ?
|
|
6523
|
+
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
6524
|
}).join('') + '</tr>';
|
|
6359
6525
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6360
|
-
return "\n <td \n style='height: ".concat(
|
|
6526
|
+
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
6527
|
}).join('') + '</tr>';
|
|
6362
6528
|
// get height of the first data cell
|
|
6363
6529
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6513,7 +6679,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6513
6679
|
}, {
|
|
6514
6680
|
key: "buildBodyHtml",
|
|
6515
6681
|
value: function buildBodyHtml() {
|
|
6516
|
-
var
|
|
6682
|
+
var _this45 = this;
|
|
6517
6683
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6518
6684
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6519
6685
|
if (!this.options.columns) {
|
|
@@ -6538,7 +6704,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6538
6704
|
row.forEach(function (cell, cellIndex) {
|
|
6539
6705
|
var sizeIndex = cell.level || cellIndex;
|
|
6540
6706
|
var colIndex = cell.index || cellIndex;
|
|
6541
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6707
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this45.options.columns[_this45.options.columns.length - 1][colIndex].show === false) {
|
|
6542
6708
|
return; // need to revisit this logic
|
|
6543
6709
|
}
|
|
6544
6710
|
|
|
@@ -6565,7 +6731,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6565
6731
|
style += "color: ".concat(cell.color, "; ");
|
|
6566
6732
|
}
|
|
6567
6733
|
// console.log('rowspan', cell.rowspan)
|
|
6568
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6734
|
+
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
6735
|
// if (useWidths === true) {
|
|
6570
6736
|
// bodyHtml += `
|
|
6571
6737
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -6574,10 +6740,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6574
6740
|
// }
|
|
6575
6741
|
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
6742
|
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(
|
|
6743
|
+
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
6744
|
}
|
|
6579
6745
|
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(
|
|
6746
|
+
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
6747
|
}
|
|
6582
6748
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6583
6749
|
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 +6764,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6598
6764
|
}, {
|
|
6599
6765
|
key: "buildHeaderHtml",
|
|
6600
6766
|
value: function buildHeaderHtml() {
|
|
6601
|
-
var
|
|
6767
|
+
var _this46 = this;
|
|
6602
6768
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6603
6769
|
if (!this.options.columns) {
|
|
6604
6770
|
return '';
|
|
@@ -6615,7 +6781,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6615
6781
|
headerHtml += '</colgroup>';
|
|
6616
6782
|
}
|
|
6617
6783
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6618
|
-
if (useWidths === false && rowIndex !==
|
|
6784
|
+
if (useWidths === false && rowIndex !== _this46.options.columns.length - 1) {
|
|
6619
6785
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6620
6786
|
return;
|
|
6621
6787
|
}
|
|
@@ -6639,24 +6805,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6639
6805
|
if (col.style) {
|
|
6640
6806
|
style += col.style;
|
|
6641
6807
|
}
|
|
6642
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6808
|
+
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
6809
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6644
6810
|
// headerHtml += `
|
|
6645
6811
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6646
6812
|
// width='${col.width || col.actualWidth}'
|
|
6647
6813
|
// `
|
|
6648
6814
|
// }
|
|
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 ?
|
|
6815
|
+
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
6816
|
});
|
|
6651
6817
|
headerHtml += "</tr>";
|
|
6652
6818
|
});
|
|
6653
6819
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6654
6820
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6655
6821
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6656
|
-
var testEl = document.getElementById("".concat(
|
|
6822
|
+
var testEl = document.getElementById("".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6657
6823
|
if (!testEl) {
|
|
6658
6824
|
var newE = document.createElement('div');
|
|
6659
|
-
newE.id = "".concat(
|
|
6825
|
+
newE.id = "".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6660
6826
|
newE.className = 'websy-modal-dropdown';
|
|
6661
6827
|
dropdownEl.appendChild(newE);
|
|
6662
6828
|
}
|
|
@@ -6679,7 +6845,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6679
6845
|
}, {
|
|
6680
6846
|
key: "buildTotalHtml",
|
|
6681
6847
|
value: function buildTotalHtml() {
|
|
6682
|
-
var
|
|
6848
|
+
var _this47 = this;
|
|
6683
6849
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6684
6850
|
if (!this.options.totals) {
|
|
6685
6851
|
return '';
|
|
@@ -6695,7 +6861,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6695
6861
|
|
|
6696
6862
|
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
6863
|
if (useWidths === true) {
|
|
6698
|
-
totalHtml += "\n style='width: ".concat(
|
|
6864
|
+
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
6865
|
}
|
|
6700
6866
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6701
6867
|
});
|
|
@@ -6705,7 +6871,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6705
6871
|
}, {
|
|
6706
6872
|
key: "calculateSizes",
|
|
6707
6873
|
value: function calculateSizes() {
|
|
6708
|
-
var
|
|
6874
|
+
var _this48 = this;
|
|
6709
6875
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6710
6876
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6711
6877
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6749,7 +6915,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6749
6915
|
rows.forEach(function (row, rowIndex) {
|
|
6750
6916
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6751
6917
|
var colSize = col.getBoundingClientRect();
|
|
6752
|
-
|
|
6918
|
+
_this48.sizes.cellHeight = colSize.height;
|
|
6753
6919
|
if (columnsForSizing[colIndex]) {
|
|
6754
6920
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6755
6921
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -6761,7 +6927,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6761
6927
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6762
6928
|
// }
|
|
6763
6929
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6764
|
-
if (colIndex >=
|
|
6930
|
+
if (colIndex >= _this48.pinnedColumns) {
|
|
6765
6931
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6766
6932
|
}
|
|
6767
6933
|
}
|
|
@@ -6776,7 +6942,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6776
6942
|
return a + (b.width || b.actualWidth);
|
|
6777
6943
|
}, 0);
|
|
6778
6944
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6779
|
-
return i >=
|
|
6945
|
+
return i >= _this48.pinnedColumns;
|
|
6780
6946
|
}).reduce(function (a, b) {
|
|
6781
6947
|
return a + (b.width || b.actualWidth);
|
|
6782
6948
|
}, 0);
|
|
@@ -6787,7 +6953,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6787
6953
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6788
6954
|
columnsForSizing.forEach(function (c) {
|
|
6789
6955
|
c.shouldGrow = true;
|
|
6790
|
-
if (
|
|
6956
|
+
if (_this48.options.autoFitColumns === false) {
|
|
6791
6957
|
c.shouldGrow = false;
|
|
6792
6958
|
if (c.potentialWidth > c.actualWidth) {
|
|
6793
6959
|
c.shouldGrow = true;
|
|
@@ -6806,7 +6972,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6806
6972
|
// if (!c.width) {
|
|
6807
6973
|
// if (c.actualWidth < equalWidth) {
|
|
6808
6974
|
// adjust the width
|
|
6809
|
-
if (
|
|
6975
|
+
if (_this48.options.autoFitColumns === true) {
|
|
6810
6976
|
if (c.width) {
|
|
6811
6977
|
c.width += equalWidth;
|
|
6812
6978
|
}
|
|
@@ -6830,9 +6996,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6830
6996
|
}
|
|
6831
6997
|
// }
|
|
6832
6998
|
// }
|
|
6833
|
-
|
|
6834
|
-
if (i >
|
|
6835
|
-
|
|
6999
|
+
_this48.sizes.totalWidth += c.width || c.actualWidth;
|
|
7000
|
+
if (i > _this48.pinnedColumns) {
|
|
7001
|
+
_this48.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6836
7002
|
}
|
|
6837
7003
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6838
7004
|
});
|
|
@@ -6891,7 +7057,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6891
7057
|
}, {
|
|
6892
7058
|
key: "createSample",
|
|
6893
7059
|
value: function createSample(data) {
|
|
6894
|
-
var
|
|
7060
|
+
var _this49 = this;
|
|
6895
7061
|
var output = [];
|
|
6896
7062
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6897
7063
|
if (col.maxLength) {
|
|
@@ -6901,7 +7067,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6901
7067
|
} else if (data) {
|
|
6902
7068
|
var longest = '';
|
|
6903
7069
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6904
|
-
if (data[i].length ===
|
|
7070
|
+
if (data[i].length === _this49.options.columns[_this49.options.columns.length - 1].length) {
|
|
6905
7071
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6906
7072
|
longest = data[i][colIndex].value;
|
|
6907
7073
|
}
|
|
@@ -7173,7 +7339,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7173
7339
|
}, {
|
|
7174
7340
|
key: "perpetualScroll",
|
|
7175
7341
|
value: function perpetualScroll() {
|
|
7176
|
-
var
|
|
7342
|
+
var _this50 = this;
|
|
7177
7343
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7178
7344
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7179
7345
|
return;
|
|
@@ -7192,17 +7358,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7192
7358
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7193
7359
|
var _loop2 = function _loop2(i) {
|
|
7194
7360
|
setTimeout(function () {
|
|
7195
|
-
var delta =
|
|
7361
|
+
var delta = _this50.mouseYStart - _this50.currentClientY + _this50.sizes.cellHeight * (i + 1) * direction;
|
|
7196
7362
|
delta = Math.min(10, delta);
|
|
7197
7363
|
delta = Math.max(-10, delta);
|
|
7198
7364
|
// only run this if isPerpetual === true
|
|
7199
7365
|
// this value is reset to false on touchStart
|
|
7200
|
-
if (
|
|
7366
|
+
if (_this50.isPerpetual === true) {
|
|
7201
7367
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7202
7368
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7203
|
-
|
|
7204
|
-
if (
|
|
7205
|
-
clearTimeout(
|
|
7369
|
+
_this50.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7370
|
+
if (_this50.scrollTimeout) {
|
|
7371
|
+
clearTimeout(_this50.scrollTimeout);
|
|
7206
7372
|
}
|
|
7207
7373
|
}
|
|
7208
7374
|
}, 1000 / fps * i);
|
|
@@ -7470,7 +7636,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7470
7636
|
/* global d3 include WebsyDesigns */
|
|
7471
7637
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7472
7638
|
function WebsyChart(elementId, options) {
|
|
7473
|
-
var
|
|
7639
|
+
var _this51 = this;
|
|
7474
7640
|
_classCallCheck(this, WebsyChart);
|
|
7475
7641
|
var DEFAULTS = {
|
|
7476
7642
|
margin: {
|
|
@@ -7527,7 +7693,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7527
7693
|
this.invertOverride = function (input, input2) {
|
|
7528
7694
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7529
7695
|
var xAxis = 'bottom';
|
|
7530
|
-
if (
|
|
7696
|
+
if (_this51.options.orientation === 'horizontal') {
|
|
7531
7697
|
xAxis = 'left';
|
|
7532
7698
|
}
|
|
7533
7699
|
if (forBrush === true) {
|
|
@@ -7535,12 +7701,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7535
7701
|
}
|
|
7536
7702
|
xAxis += 'Axis';
|
|
7537
7703
|
var output;
|
|
7538
|
-
var width =
|
|
7704
|
+
var width = _this51.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7539
7705
|
// if (this.customBottomRange) {
|
|
7540
|
-
for (var index = 0; index <
|
|
7541
|
-
if (input >
|
|
7542
|
-
if (
|
|
7543
|
-
if (input <
|
|
7706
|
+
for (var index = 0; index < _this51.customBottomRange.length; index++) {
|
|
7707
|
+
if (input > _this51.customBottomRange[index]) {
|
|
7708
|
+
if (_this51.customBottomRange[index + 1]) {
|
|
7709
|
+
if (input < _this51.customBottomRange[index + 1]) {
|
|
7544
7710
|
output = index;
|
|
7545
7711
|
break;
|
|
7546
7712
|
}
|
|
@@ -7715,9 +7881,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7715
7881
|
}, {
|
|
7716
7882
|
key: "handleEventMouseMove",
|
|
7717
7883
|
value: function handleEventMouseMove(event, d) {
|
|
7718
|
-
var
|
|
7884
|
+
var _this52 = this;
|
|
7719
7885
|
var bisectDate = d3.bisector(function (d) {
|
|
7720
|
-
return
|
|
7886
|
+
return _this52.parseX(d.x.value);
|
|
7721
7887
|
}).left;
|
|
7722
7888
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7723
7889
|
var xAxis = 'bottomAxis';
|
|
@@ -7750,9 +7916,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7750
7916
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7751
7917
|
}
|
|
7752
7918
|
this.options.data.series.forEach(function (s) {
|
|
7753
|
-
if (
|
|
7919
|
+
if (_this52.options.data[xData].scale !== 'Time') {
|
|
7754
7920
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7755
|
-
xPoint =
|
|
7921
|
+
xPoint = _this52.customBottomRange[x0] + (_this52.customBottomRange[x0 + 1] - _this52.customBottomRange[x0]) / 2;
|
|
7756
7922
|
// }
|
|
7757
7923
|
// else {
|
|
7758
7924
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7772,41 +7938,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7772
7938
|
var index = bisectDate(s.data, x0, 1);
|
|
7773
7939
|
var pointA = s.data[index - 1];
|
|
7774
7940
|
var pointB = s.data[index];
|
|
7775
|
-
if (
|
|
7941
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
7776
7942
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7777
7943
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7778
7944
|
}
|
|
7779
7945
|
if (pointA && !pointB) {
|
|
7780
|
-
xPoint =
|
|
7946
|
+
xPoint = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7781
7947
|
tooltipTitle = pointA.x.value;
|
|
7782
7948
|
if (!pointA.y.color) {
|
|
7783
7949
|
pointA.y.color = s.color;
|
|
7784
7950
|
}
|
|
7785
7951
|
tooltipData.push(pointA);
|
|
7786
7952
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7787
|
-
tooltipTitle = d3.timeFormat(
|
|
7953
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7788
7954
|
}
|
|
7789
7955
|
}
|
|
7790
7956
|
if (pointB && !pointA) {
|
|
7791
|
-
xPoint =
|
|
7957
|
+
xPoint = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7792
7958
|
tooltipTitle = pointB.x.value;
|
|
7793
7959
|
if (!pointB.y.color) {
|
|
7794
7960
|
pointB.y.color = s.color;
|
|
7795
7961
|
}
|
|
7796
7962
|
tooltipData.push(pointB);
|
|
7797
7963
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7798
|
-
tooltipTitle = d3.timeFormat(
|
|
7964
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7799
7965
|
}
|
|
7800
7966
|
}
|
|
7801
7967
|
if (pointA && pointB) {
|
|
7802
|
-
var d0 =
|
|
7803
|
-
var d1 =
|
|
7968
|
+
var d0 = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7969
|
+
var d1 = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7804
7970
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7805
7971
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7806
7972
|
xPoint = d1;
|
|
7807
7973
|
tooltipTitle = pointB.x.value;
|
|
7808
7974
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7809
|
-
tooltipTitle = d3.timeFormat(
|
|
7975
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7810
7976
|
}
|
|
7811
7977
|
if (!pointB.y.color) {
|
|
7812
7978
|
pointB.y.color = s.color;
|
|
@@ -7816,7 +7982,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7816
7982
|
xPoint = d0;
|
|
7817
7983
|
tooltipTitle = pointA.x.value;
|
|
7818
7984
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7819
|
-
tooltipTitle = d3.timeFormat(
|
|
7985
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7820
7986
|
}
|
|
7821
7987
|
if (!pointA.y.color) {
|
|
7822
7988
|
pointA.y.color = s.color;
|
|
@@ -7942,7 +8108,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7942
8108
|
}, {
|
|
7943
8109
|
key: "render",
|
|
7944
8110
|
value: function render(options) {
|
|
7945
|
-
var
|
|
8111
|
+
var _this53 = this;
|
|
7946
8112
|
/* global d3 options WebsyUtils */
|
|
7947
8113
|
if (typeof options !== 'undefined') {
|
|
7948
8114
|
this.options = _extends({}, this.options, options);
|
|
@@ -8010,7 +8176,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8010
8176
|
this.options.data.series.map(function (s, i) {
|
|
8011
8177
|
return {
|
|
8012
8178
|
value: s.label || s.key,
|
|
8013
|
-
color: s.color ||
|
|
8179
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
8014
8180
|
};
|
|
8015
8181
|
});
|
|
8016
8182
|
}
|
|
@@ -8367,25 +8533,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8367
8533
|
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
8534
|
var acc = 0;
|
|
8369
8535
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8370
|
-
var adjustment =
|
|
8536
|
+
var adjustment = _this53.bandPadding * index + _this53.bandPadding;
|
|
8371
8537
|
// if (this.options.data.bottom.padding) {
|
|
8372
8538
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8373
8539
|
// }
|
|
8374
|
-
var start =
|
|
8540
|
+
var start = _this53.widthForCalc / noOfPoints * acc;
|
|
8375
8541
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8376
8542
|
var pos = i * proposedBandWidth;
|
|
8377
|
-
|
|
8543
|
+
_this53["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8378
8544
|
}
|
|
8379
|
-
acc +=
|
|
8380
|
-
var end =
|
|
8545
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8546
|
+
var end = _this53.widthForCalc / noOfPoints * acc;
|
|
8381
8547
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8382
8548
|
return end + adjustment;
|
|
8383
8549
|
})));
|
|
8384
8550
|
acc = 0;
|
|
8385
8551
|
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 (
|
|
8552
|
+
var adjustment = _this53.brushBandPadding * index + _this53.brushBandPadding;
|
|
8553
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8554
|
+
return (_this53.options.orientation === 'vertical' ? _this53.plotWidth : _this53.plotHeight) / noOfPoints * acc;
|
|
8389
8555
|
})));
|
|
8390
8556
|
}
|
|
8391
8557
|
// }
|
|
@@ -8558,7 +8724,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8558
8724
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
8559
8725
|
if (this.options.data.bottom.formatter) {
|
|
8560
8726
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8561
|
-
return
|
|
8727
|
+
return _this53.options.data.bottom.formatter(d);
|
|
8562
8728
|
});
|
|
8563
8729
|
}
|
|
8564
8730
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -8568,7 +8734,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8568
8734
|
}
|
|
8569
8735
|
if (this.customBottomRange.length > 0) {
|
|
8570
8736
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8571
|
-
return "translate(".concat(
|
|
8737
|
+
return "translate(".concat(_this53.customBottomRange[i] + (_this53.customBottomRange[i + 1] - _this53.customBottomRange[i]) / 2, ", 0)");
|
|
8572
8738
|
});
|
|
8573
8739
|
}
|
|
8574
8740
|
}
|
|
@@ -8587,14 +8753,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8587
8753
|
}
|
|
8588
8754
|
if (this.options.margin.axisLeft > 0) {
|
|
8589
8755
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8590
|
-
if (
|
|
8591
|
-
d =
|
|
8756
|
+
if (_this53.options.data.left.formatter) {
|
|
8757
|
+
d = _this53.options.data.left.formatter(d);
|
|
8592
8758
|
}
|
|
8593
8759
|
return d;
|
|
8594
8760
|
}));
|
|
8595
8761
|
if (this.customLeftRange.length > 0) {
|
|
8596
8762
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8597
|
-
return "translate(0, ".concat(
|
|
8763
|
+
return "translate(0, ".concat(_this53.customLeftRange[i] + (_this53.customLeftRange[i + 1] - _this53.customLeftRange[i]) / 2, ")");
|
|
8598
8764
|
});
|
|
8599
8765
|
}
|
|
8600
8766
|
}
|
|
@@ -8622,8 +8788,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8622
8788
|
}
|
|
8623
8789
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8624
8790
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8625
|
-
if (
|
|
8626
|
-
d =
|
|
8791
|
+
if (_this53.options.data.right.formatter) {
|
|
8792
|
+
d = _this53.options.data.right.formatter(d);
|
|
8627
8793
|
}
|
|
8628
8794
|
return d;
|
|
8629
8795
|
}));
|
|
@@ -8663,50 +8829,50 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8663
8829
|
}, {
|
|
8664
8830
|
key: "renderComponents",
|
|
8665
8831
|
value: function renderComponents() {
|
|
8666
|
-
var
|
|
8832
|
+
var _this54 = this;
|
|
8667
8833
|
// Draw the series data
|
|
8668
8834
|
this.renderedKeys = {};
|
|
8669
8835
|
this.options.data.series.forEach(function (series, index) {
|
|
8670
8836
|
if (!series.key) {
|
|
8671
|
-
series.key =
|
|
8837
|
+
series.key = _this54.createIdentity();
|
|
8672
8838
|
}
|
|
8673
8839
|
if (!series.color) {
|
|
8674
|
-
series.color =
|
|
8840
|
+
series.color = _this54.options.colors[index % _this54.options.colors.length];
|
|
8675
8841
|
}
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8842
|
+
_this54["render".concat(series.type || 'bar')](series, index);
|
|
8843
|
+
_this54.renderLabels(series, index);
|
|
8844
|
+
_this54.renderedKeys[series.key] = series.type;
|
|
8679
8845
|
});
|
|
8680
8846
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8681
8847
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8682
8848
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8683
8849
|
this.options.refLines.forEach(function (l) {
|
|
8684
|
-
return
|
|
8850
|
+
return _this54.renderRefLine(l);
|
|
8685
8851
|
});
|
|
8686
8852
|
}
|
|
8687
8853
|
}
|
|
8688
8854
|
}, {
|
|
8689
8855
|
key: "renderarea",
|
|
8690
8856
|
value: function renderarea(series, index) {
|
|
8691
|
-
var
|
|
8857
|
+
var _this55 = this;
|
|
8692
8858
|
/* global d3 series index */
|
|
8693
8859
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8694
8860
|
return d3.area().x(function (d) {
|
|
8695
|
-
if (
|
|
8696
|
-
return
|
|
8861
|
+
if (_this55.options.data[xAxis].scale === 'Time') {
|
|
8862
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
|
|
8697
8863
|
} else {
|
|
8698
|
-
var xIndex =
|
|
8699
|
-
var xPos =
|
|
8700
|
-
if (
|
|
8701
|
-
xPos = xPos + (
|
|
8864
|
+
var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8865
|
+
var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8866
|
+
if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8867
|
+
xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8702
8868
|
}
|
|
8703
8869
|
return xPos;
|
|
8704
8870
|
}
|
|
8705
8871
|
}).y0(function (d) {
|
|
8706
|
-
return
|
|
8872
|
+
return _this55["".concat(yAxis, "Axis")](0);
|
|
8707
8873
|
}).y1(function (d) {
|
|
8708
|
-
return
|
|
8709
|
-
}).curve(d3[curveStyle ||
|
|
8874
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8875
|
+
}).curve(d3[curveStyle || _this55.options.curveStyle]);
|
|
8710
8876
|
};
|
|
8711
8877
|
var xAxis = 'bottom';
|
|
8712
8878
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8746,7 +8912,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8746
8912
|
}, {
|
|
8747
8913
|
key: "renderbar",
|
|
8748
8914
|
value: function renderbar(series, index) {
|
|
8749
|
-
var
|
|
8915
|
+
var _this56 = this;
|
|
8750
8916
|
/* global series index d3 */
|
|
8751
8917
|
var xAxis = 'bottom';
|
|
8752
8918
|
var yAxis = 'left';
|
|
@@ -8913,26 +9079,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8913
9079
|
}
|
|
8914
9080
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8915
9081
|
bars.attr('width', function (d, i) {
|
|
8916
|
-
return Math.abs(getBarWidth.call(
|
|
9082
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8917
9083
|
}).attr('height', function (d, i) {
|
|
8918
|
-
return getBarHeight.call(
|
|
9084
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8919
9085
|
}).attr('x', function (d, i) {
|
|
8920
|
-
return getBarX.call(
|
|
9086
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8921
9087
|
}).attr('y', function (d, i) {
|
|
8922
|
-
return getBarY.call(
|
|
9088
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8923
9089
|
})
|
|
8924
9090
|
// .transition(this.transition)
|
|
8925
9091
|
.attr('fill', function (d) {
|
|
8926
9092
|
return d.y.color || d.color || series.color;
|
|
8927
9093
|
});
|
|
8928
9094
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8929
|
-
return Math.abs(getBarWidth.call(
|
|
9095
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8930
9096
|
}).attr('height', function (d, i) {
|
|
8931
|
-
return getBarHeight.call(
|
|
9097
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8932
9098
|
}).attr('x', function (d, i) {
|
|
8933
|
-
return getBarX.call(
|
|
9099
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8934
9100
|
}).attr('y', function (d, i) {
|
|
8935
|
-
return getBarY.call(
|
|
9101
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8936
9102
|
})
|
|
8937
9103
|
// .transition(this.transition)
|
|
8938
9104
|
.attr('fill', function (d) {
|
|
@@ -8944,26 +9110,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8944
9110
|
this.brushBarsInitialized[series.key] = true;
|
|
8945
9111
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8946
9112
|
brushBars.attr('width', function (d, i) {
|
|
8947
|
-
return Math.abs(getBarWidth.call(
|
|
9113
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8948
9114
|
}).attr('height', function (d, i) {
|
|
8949
|
-
return getBarHeight.call(
|
|
9115
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8950
9116
|
}).attr('x', function (d, i) {
|
|
8951
|
-
return getBarX.call(
|
|
9117
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8952
9118
|
}).attr('y', function (d, i) {
|
|
8953
|
-
return getBarY.call(
|
|
9119
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8954
9120
|
})
|
|
8955
9121
|
// .transition(this.transition)
|
|
8956
9122
|
.attr('fill', function (d) {
|
|
8957
9123
|
return d.y.color || d.color || series.color;
|
|
8958
9124
|
});
|
|
8959
9125
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8960
|
-
return Math.abs(getBarWidth.call(
|
|
9126
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8961
9127
|
}).attr('height', function (d, i) {
|
|
8962
|
-
return getBarHeight.call(
|
|
9128
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8963
9129
|
}).attr('x', function (d, i) {
|
|
8964
|
-
return getBarX.call(
|
|
9130
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8965
9131
|
}).attr('y', function (d, i) {
|
|
8966
|
-
return getBarY.call(
|
|
9132
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8967
9133
|
})
|
|
8968
9134
|
// .transition(this.transition)
|
|
8969
9135
|
.attr('fill', function (d) {
|
|
@@ -8984,7 +9150,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8984
9150
|
}, {
|
|
8985
9151
|
key: "renderLabels",
|
|
8986
9152
|
value: function renderLabels(series, index) {
|
|
8987
|
-
var
|
|
9153
|
+
var _this57 = this;
|
|
8988
9154
|
/* global series index d3 WebsyDesigns */
|
|
8989
9155
|
var xAxis = 'bottom';
|
|
8990
9156
|
var yAxis = 'left';
|
|
@@ -9000,14 +9166,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9000
9166
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9001
9167
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9002
9168
|
labels.attr('x', function (d) {
|
|
9003
|
-
return getLabelX.call(
|
|
9169
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9004
9170
|
}).attr('y', function (d) {
|
|
9005
|
-
return getLabelY.call(
|
|
9171
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9006
9172
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9007
|
-
if (
|
|
9173
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9008
9174
|
return 'transparent';
|
|
9009
9175
|
}
|
|
9010
|
-
return
|
|
9176
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9011
9177
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9012
9178
|
return d.y.label || d.y.value;
|
|
9013
9179
|
}).each(function (d, i) {
|
|
@@ -9041,14 +9207,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9041
9207
|
}
|
|
9042
9208
|
});
|
|
9043
9209
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9044
|
-
return getLabelX.call(
|
|
9210
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9045
9211
|
}).attr('y', function (d) {
|
|
9046
|
-
return getLabelY.call(
|
|
9212
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9047
9213
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9048
|
-
if (
|
|
9214
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9049
9215
|
return 'transparent';
|
|
9050
9216
|
}
|
|
9051
|
-
return
|
|
9217
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9052
9218
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9053
9219
|
return d.y.label || d.y.value;
|
|
9054
9220
|
}).each(function (d, i) {
|
|
@@ -9126,32 +9292,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9126
9292
|
}, {
|
|
9127
9293
|
key: "renderline",
|
|
9128
9294
|
value: function renderline(series, index) {
|
|
9129
|
-
var
|
|
9295
|
+
var _this58 = this;
|
|
9130
9296
|
/* global series index d3 */
|
|
9131
9297
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9132
9298
|
return d3.line().x(function (d) {
|
|
9133
|
-
if (
|
|
9134
|
-
return
|
|
9299
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9300
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9135
9301
|
} else {
|
|
9136
|
-
if (
|
|
9137
|
-
return
|
|
9302
|
+
if (_this58.options.data[xAxis].scale === 'Time') {
|
|
9303
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
|
|
9138
9304
|
} else {
|
|
9139
|
-
var xIndex =
|
|
9140
|
-
var xPos =
|
|
9141
|
-
if (
|
|
9142
|
-
xPos = xPos + (
|
|
9305
|
+
var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9306
|
+
var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9307
|
+
if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9308
|
+
xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9143
9309
|
}
|
|
9144
9310
|
return xPos;
|
|
9145
9311
|
}
|
|
9146
9312
|
}
|
|
9147
9313
|
}).y(function (d) {
|
|
9148
|
-
if (
|
|
9149
|
-
var adjustment =
|
|
9150
|
-
return
|
|
9314
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9315
|
+
var adjustment = _this58.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
|
|
9316
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value)) + adjustment;
|
|
9151
9317
|
} else {
|
|
9152
|
-
return
|
|
9318
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9153
9319
|
}
|
|
9154
|
-
}).curve(d3[curveStyle ||
|
|
9320
|
+
}).curve(d3[curveStyle || _this58.options.curveStyle]);
|
|
9155
9321
|
};
|
|
9156
9322
|
var xAxis = 'bottom';
|
|
9157
9323
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9260,14 +9426,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9260
9426
|
}, {
|
|
9261
9427
|
key: "rendersymbol",
|
|
9262
9428
|
value: function rendersymbol(series, index) {
|
|
9263
|
-
var
|
|
9429
|
+
var _this59 = this;
|
|
9264
9430
|
/* global d3 series index series.key */
|
|
9265
9431
|
var drawSymbol = function drawSymbol(size) {
|
|
9266
9432
|
return d3.symbol()
|
|
9267
9433
|
// .type(d => {
|
|
9268
9434
|
// return d3.symbols[0]
|
|
9269
9435
|
// })
|
|
9270
|
-
.size(size ||
|
|
9436
|
+
.size(size || _this59.options.symbolSize);
|
|
9271
9437
|
};
|
|
9272
9438
|
var xAxis = 'bottom';
|
|
9273
9439
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9293,27 +9459,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9293
9459
|
// else {
|
|
9294
9460
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9295
9461
|
// }
|
|
9296
|
-
var xIndex =
|
|
9297
|
-
var xPos =
|
|
9298
|
-
if (
|
|
9299
|
-
xPos = xPos + (
|
|
9300
|
-
}
|
|
9301
|
-
var adjustment =
|
|
9302
|
-
if (
|
|
9303
|
-
return "translate(".concat(
|
|
9462
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9463
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9464
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9465
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9466
|
+
}
|
|
9467
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9468
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9469
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9304
9470
|
} else {
|
|
9305
|
-
if (
|
|
9306
|
-
xPos =
|
|
9471
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9472
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9307
9473
|
} else {
|
|
9308
|
-
var _xIndex =
|
|
9309
|
-
var _xPos =
|
|
9310
|
-
if (
|
|
9311
|
-
_xPos = _xPos + (
|
|
9474
|
+
var _xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9475
|
+
var _xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
9476
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
9477
|
+
_xPos = _xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
9312
9478
|
}
|
|
9313
9479
|
// return xPos
|
|
9314
9480
|
}
|
|
9315
9481
|
// 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(
|
|
9482
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9317
9483
|
}
|
|
9318
9484
|
});
|
|
9319
9485
|
// Enter
|
|
@@ -9328,27 +9494,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9328
9494
|
}).attr('class', function (d) {
|
|
9329
9495
|
return "symbol symbol_".concat(series.key);
|
|
9330
9496
|
}).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(
|
|
9497
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9498
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9499
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9500
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9501
|
+
}
|
|
9502
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9503
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9504
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9339
9505
|
} else {
|
|
9340
|
-
if (
|
|
9341
|
-
xPos =
|
|
9506
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9507
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9342
9508
|
} else {
|
|
9343
|
-
var _xIndex2 =
|
|
9344
|
-
var _xPos2 =
|
|
9345
|
-
if (
|
|
9346
|
-
_xPos2 = _xPos2 + (
|
|
9509
|
+
var _xIndex2 = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9510
|
+
var _xPos2 = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
9511
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
9512
|
+
_xPos2 = _xPos2 + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
9347
9513
|
}
|
|
9348
9514
|
// return xPos
|
|
9349
9515
|
}
|
|
9350
9516
|
// 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(
|
|
9517
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9352
9518
|
}
|
|
9353
9519
|
});
|
|
9354
9520
|
}
|
|
@@ -9971,7 +10137,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9971
10137
|
}, {
|
|
9972
10138
|
key: "resize",
|
|
9973
10139
|
value: function resize() {
|
|
9974
|
-
var
|
|
10140
|
+
var _this60 = this;
|
|
9975
10141
|
var el = document.getElementById(this.elementId);
|
|
9976
10142
|
if (el) {
|
|
9977
10143
|
// if (this.options.width) {
|
|
@@ -9982,7 +10148,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9982
10148
|
// }
|
|
9983
10149
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9984
10150
|
html += this._data.map(function (d, i) {
|
|
9985
|
-
return
|
|
10151
|
+
return _this60.getLegendItemHTML(d);
|
|
9986
10152
|
}).join('');
|
|
9987
10153
|
html += "\n <div>\n ";
|
|
9988
10154
|
el.innerHTML = html;
|
|
@@ -10126,14 +10292,14 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10126
10292
|
}, {
|
|
10127
10293
|
key: "render",
|
|
10128
10294
|
value: function render() {
|
|
10129
|
-
var
|
|
10295
|
+
var _this61 = this;
|
|
10130
10296
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10131
10297
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10132
10298
|
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
10133
10299
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10134
10300
|
return {
|
|
10135
10301
|
value: s.label || s.key,
|
|
10136
|
-
color: s.color ||
|
|
10302
|
+
color: s.color || _this61.options.colors[i % _this61.options.colors.length]
|
|
10137
10303
|
};
|
|
10138
10304
|
});
|
|
10139
10305
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10187,7 +10353,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10187
10353
|
}
|
|
10188
10354
|
if (this.polygons) {
|
|
10189
10355
|
this.polygons.forEach(function (p) {
|
|
10190
|
-
return
|
|
10356
|
+
return _this61.map.removeLayer(p);
|
|
10191
10357
|
});
|
|
10192
10358
|
}
|
|
10193
10359
|
this.polygons = [];
|
|
@@ -10241,15 +10407,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10241
10407
|
p.options = {};
|
|
10242
10408
|
}
|
|
10243
10409
|
if (!p.options.color) {
|
|
10244
|
-
p.options.color =
|
|
10410
|
+
p.options.color = _this61.options.colors[i % _this61.options.colors.length];
|
|
10245
10411
|
}
|
|
10246
10412
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10247
10413
|
return c.map(function (d) {
|
|
10248
10414
|
return [d.Latitude, d.Longitude];
|
|
10249
10415
|
});
|
|
10250
|
-
}), p.options).addTo(
|
|
10251
|
-
|
|
10252
|
-
|
|
10416
|
+
}), p.options).addTo(_this61.map);
|
|
10417
|
+
_this61.polygons.push(pol);
|
|
10418
|
+
_this61.map.fitBounds(pol.getBounds());
|
|
10253
10419
|
});
|
|
10254
10420
|
}
|
|
10255
10421
|
// if (this.data.markers.length > 0) {
|