@websy/websy-designs 1.1.1 → 1.1.4
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/websy-designs.debug.js +184 -0
- package/dist/websy-designs.js +373 -186
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/index.js +8 -8
- package/package.json +2 -2
package/dist/websy-designs.js
CHANGED
|
@@ -46,6 +46,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
46
46
|
APIService
|
|
47
47
|
ButtonGroup
|
|
48
48
|
WebsyUtils
|
|
49
|
+
WebsyCarousel
|
|
49
50
|
Pager
|
|
50
51
|
*/
|
|
51
52
|
|
|
@@ -286,6 +287,192 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
286
287
|
|
|
287
288
|
return ButtonGroup;
|
|
288
289
|
}();
|
|
290
|
+
/* global */
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
var WebsyCarousel = /*#__PURE__*/function () {
|
|
294
|
+
function WebsyCarousel(elementId, options) {
|
|
295
|
+
_classCallCheck(this, WebsyCarousel);
|
|
296
|
+
|
|
297
|
+
var DEFAULTS = {
|
|
298
|
+
currentFrame: 0,
|
|
299
|
+
frameDuration: 4000,
|
|
300
|
+
showFrameSelector: true,
|
|
301
|
+
showPrevNext: true
|
|
302
|
+
};
|
|
303
|
+
this.playTimeoutFn = null;
|
|
304
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
305
|
+
|
|
306
|
+
if (!elementId) {
|
|
307
|
+
console.log('No element Id provided');
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
var el = document.getElementById(elementId);
|
|
311
|
+
|
|
312
|
+
if (el) {
|
|
313
|
+
this.elementId = elementId;
|
|
314
|
+
el.addEventListener('click', this.handleClick.bind(this));
|
|
315
|
+
this.render();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
_createClass(WebsyCarousel, [{
|
|
320
|
+
key: "handleClick",
|
|
321
|
+
value: function handleClick(event) {
|
|
322
|
+
if (event.target.classList.contains('websy-next-arrow')) {
|
|
323
|
+
this.next();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (event.target.classList.contains('websy-prev-arrow')) {
|
|
327
|
+
this.prev();
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (event.target.classList.contains('websy-progress-btn' || 'websy-progress-btn-active')) {
|
|
331
|
+
var index = +event.target.getAttribute('data-index');
|
|
332
|
+
var prevFrameIndex = this.options.currentFrame;
|
|
333
|
+
this.options.currentFrame = index;
|
|
334
|
+
this.showFrame(prevFrameIndex, index);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}, {
|
|
338
|
+
key: "next",
|
|
339
|
+
value: function next() {
|
|
340
|
+
this.pause();
|
|
341
|
+
var prevFrameIndex = this.options.currentFrame;
|
|
342
|
+
|
|
343
|
+
if (this.options.currentFrame === this.options.frames.length - 1) {
|
|
344
|
+
this.options.currentFrame = 0;
|
|
345
|
+
} else {
|
|
346
|
+
this.options.currentFrame++;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
this.showFrame(prevFrameIndex, this.options.currentFrame);
|
|
350
|
+
this.play(); // document.getElementById(`${this.elementId}_frame_${this.options.currentFrame}`)
|
|
351
|
+
// .style.transform = `translateX(-100%)`
|
|
352
|
+
// if (`${this.options.currentFrame === this.options.frames.length - 1}`) {
|
|
353
|
+
// document.getElementById`${this.elementId}_frame_${this.options.currentFrame}`.style.transform = `translateX('-100%')`
|
|
354
|
+
// }
|
|
355
|
+
}
|
|
356
|
+
}, {
|
|
357
|
+
key: "pause",
|
|
358
|
+
value: function pause() {
|
|
359
|
+
if (this.playTimeoutFn) {
|
|
360
|
+
clearTimeout(this.playTimeoutFn);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}, {
|
|
364
|
+
key: "play",
|
|
365
|
+
value: function play() {
|
|
366
|
+
var _this2 = this;
|
|
367
|
+
|
|
368
|
+
this.playTimeoutFn = setTimeout(function () {
|
|
369
|
+
var prevFrameIndex = _this2.options.currentFrame;
|
|
370
|
+
|
|
371
|
+
if (_this2.options.currentFrame === _this2.options.frames.length - 1) {
|
|
372
|
+
_this2.options.currentFrame = 0;
|
|
373
|
+
} else {
|
|
374
|
+
_this2.options.currentFrame++;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
_this2.showFrame(prevFrameIndex, _this2.options.currentFrame);
|
|
378
|
+
|
|
379
|
+
_this2.play();
|
|
380
|
+
}, this.options.frameDuration);
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
key: "prev",
|
|
384
|
+
value: function prev() {
|
|
385
|
+
this.pause();
|
|
386
|
+
var prevFrameIndex = this.options.currentFrame;
|
|
387
|
+
|
|
388
|
+
if (this.options.currentFrame === 0) {
|
|
389
|
+
this.options.currentFrame = this.options.frames.length - 1;
|
|
390
|
+
} else {
|
|
391
|
+
this.options.currentFrame--;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
this.showFrame(prevFrameIndex, this.options.currentFrame);
|
|
395
|
+
this.play(); // document.getElementById(`${this.elementId}_frame_${this.options.currentFrame}`)
|
|
396
|
+
// .style.transform = `translateX(100%)`
|
|
397
|
+
}
|
|
398
|
+
}, {
|
|
399
|
+
key: "render",
|
|
400
|
+
value: function render(options) {
|
|
401
|
+
this.options = _extends({}, this.options, options);
|
|
402
|
+
this.resize();
|
|
403
|
+
}
|
|
404
|
+
}, {
|
|
405
|
+
key: "resize",
|
|
406
|
+
value: function resize() {
|
|
407
|
+
var _this3 = this;
|
|
408
|
+
|
|
409
|
+
var el = document.getElementById(this.elementId);
|
|
410
|
+
|
|
411
|
+
if (el) {
|
|
412
|
+
var html = "\n <div class=\"websy-carousel\">\n ";
|
|
413
|
+
this.options.frames.forEach(function (frame, frameIndex) {
|
|
414
|
+
html += "\n <div id=\"".concat(_this3.elementId, "_frame_").concat(frameIndex, "\" class=\"websy-frame-container animate\" style=\"transform: translateX(").concat(frameIndex === 0 ? '0' : '100%', ")\">\n ");
|
|
415
|
+
frame.images.forEach(function (image) {
|
|
416
|
+
html += "\n <div style=\"".concat(image.style || 'position: absolute; width: 100%; height: 100%; top: 0; left: 0;', " background-image: url('").concat(image.url, "')\" class=\"").concat(image.classes || '', " websy-carousel-image\">\n </div>\n ");
|
|
417
|
+
});
|
|
418
|
+
frame.text && frame.text.forEach(function (text) {
|
|
419
|
+
html += "\n <div style=\"".concat(text.style || 'position: absolute; width: 100%; height: 100%; top: 0; left: 0;', "\" class=\"").concat(text.classes || '', " websy-carousel-image\">\n ").concat(text.html, "\n </div>\n ");
|
|
420
|
+
});
|
|
421
|
+
html += "</div>";
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
if (this.options.showFrameSelector === true) {
|
|
425
|
+
html += "<div class=\"websy-btn-parent\">";
|
|
426
|
+
this.options.frames.forEach(function (frame, frameIndex) {
|
|
427
|
+
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" 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 <title>Ellipse</title><circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n ");
|
|
428
|
+
});
|
|
429
|
+
html += "</div>";
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (this.options.showPrevNext === true) {
|
|
433
|
+
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n </div>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"websy-next-arrow\">\n <title>Caret Forward</title>\n <path d=\"M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z\"/>\n </svg>\n ";
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
html += "\n </div>\n ";
|
|
437
|
+
el.innerHTML = html;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
this.play(); // this.showFrameSelector()
|
|
441
|
+
}
|
|
442
|
+
}, {
|
|
443
|
+
key: "showFrame",
|
|
444
|
+
value: function showFrame(prevFrameIndex, currFrameIndex) {
|
|
445
|
+
var prevTranslateX = prevFrameIndex > currFrameIndex ? '100%' : '-100%';
|
|
446
|
+
var nextTranslateX = prevFrameIndex < currFrameIndex ? '100%' : '-100%';
|
|
447
|
+
|
|
448
|
+
if (currFrameIndex === 0 && prevFrameIndex === this.options.frames.length - 1) {
|
|
449
|
+
prevTranslateX = '-100%';
|
|
450
|
+
nextTranslateX = '100%';
|
|
451
|
+
} else if (prevFrameIndex === 0 && currFrameIndex === this.options.frames.length - 1) {
|
|
452
|
+
prevTranslateX = '100%';
|
|
453
|
+
nextTranslateX = '-100%';
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
var prevF = document.getElementById("".concat(this.elementId, "_frame_").concat(prevFrameIndex));
|
|
457
|
+
prevF.style.transform = "translateX(".concat(prevTranslateX, ")");
|
|
458
|
+
var btnInactive = document.getElementById("".concat(this.elementId, "_selector_").concat(prevFrameIndex));
|
|
459
|
+
btnInactive.classList.remove('websy-progress-btn-active');
|
|
460
|
+
var newF = document.getElementById("".concat(this.elementId, "_frame_").concat(currFrameIndex));
|
|
461
|
+
newF.classList.remove('animate');
|
|
462
|
+
newF.style.transform = "translateX(".concat(nextTranslateX, ")");
|
|
463
|
+
setTimeout(function () {
|
|
464
|
+
newF.classList.add('animate');
|
|
465
|
+
newF.style.transform = 'translateX(0%)';
|
|
466
|
+
}, 100);
|
|
467
|
+
var btnActive = document.getElementById("".concat(this.elementId, "_selector_").concat(currFrameIndex));
|
|
468
|
+
btnActive.classList.add('websy-progress-btn-active');
|
|
469
|
+
} // showFrameSelector () {
|
|
470
|
+
// }
|
|
471
|
+
|
|
472
|
+
}]);
|
|
473
|
+
|
|
474
|
+
return WebsyCarousel;
|
|
475
|
+
}();
|
|
289
476
|
|
|
290
477
|
var WebsyDatePicker = /*#__PURE__*/function () {
|
|
291
478
|
function WebsyDatePicker(elementId, options) {
|
|
@@ -492,7 +679,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
492
679
|
}, {
|
|
493
680
|
key: "highlightRange",
|
|
494
681
|
value: function highlightRange() {
|
|
495
|
-
var
|
|
682
|
+
var _this4 = this;
|
|
496
683
|
|
|
497
684
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
498
685
|
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
@@ -563,9 +750,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
563
750
|
this.currentselection.forEach(function (d) {
|
|
564
751
|
var dateEl;
|
|
565
752
|
|
|
566
|
-
if (
|
|
753
|
+
if (_this4.options.mode === 'date') {
|
|
567
754
|
dateEl = document.getElementById("".concat(d, "_date"));
|
|
568
|
-
} else if (
|
|
755
|
+
} else if (_this4.options.mode === 'year') {
|
|
569
756
|
dateEl = document.getElementById("".concat(d, "_year"));
|
|
570
757
|
}
|
|
571
758
|
|
|
@@ -614,7 +801,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
614
801
|
}, {
|
|
615
802
|
key: "renderDates",
|
|
616
803
|
value: function renderDates(disabledDates) {
|
|
617
|
-
var
|
|
804
|
+
var _this5 = this;
|
|
618
805
|
|
|
619
806
|
var disabled = [];
|
|
620
807
|
this.validDates = [];
|
|
@@ -622,9 +809,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
622
809
|
|
|
623
810
|
if (disabledDates) {
|
|
624
811
|
disabled = disabledDates.map(function (d) {
|
|
625
|
-
if (
|
|
812
|
+
if (_this5.options.mode === 'date') {
|
|
626
813
|
return d.getTime();
|
|
627
|
-
} else if (
|
|
814
|
+
} else if (_this5.options.mode === 'year') {
|
|
628
815
|
return d;
|
|
629
816
|
}
|
|
630
817
|
|
|
@@ -771,10 +958,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
771
958
|
}, {
|
|
772
959
|
key: "renderRanges",
|
|
773
960
|
value: function renderRanges() {
|
|
774
|
-
var
|
|
961
|
+
var _this6 = this;
|
|
775
962
|
|
|
776
963
|
return this.options.ranges[this.options.mode].map(function (r, i) {
|
|
777
|
-
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i ===
|
|
964
|
+
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this6.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
|
|
778
965
|
}).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
|
|
779
966
|
}
|
|
780
967
|
}, {
|
|
@@ -889,15 +1076,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
889
1076
|
}, {
|
|
890
1077
|
key: "updateRange",
|
|
891
1078
|
value: function updateRange() {
|
|
892
|
-
var
|
|
1079
|
+
var _this7 = this;
|
|
893
1080
|
|
|
894
1081
|
var range;
|
|
895
1082
|
|
|
896
1083
|
if (this.selectedRange === -1) {
|
|
897
1084
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
898
|
-
if (
|
|
1085
|
+
if (_this7.options.mode === 'date') {
|
|
899
1086
|
return d.toLocaleDateString();
|
|
900
|
-
} else if (
|
|
1087
|
+
} else if (_this7.options.mode === 'year') {
|
|
901
1088
|
return d;
|
|
902
1089
|
}
|
|
903
1090
|
});
|
|
@@ -946,7 +1133,7 @@ Date.prototype.floor = function () {
|
|
|
946
1133
|
|
|
947
1134
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
948
1135
|
function WebsyDropdown(elementId, options) {
|
|
949
|
-
var
|
|
1136
|
+
var _this8 = this;
|
|
950
1137
|
|
|
951
1138
|
_classCallCheck(this, WebsyDropdown);
|
|
952
1139
|
|
|
@@ -981,10 +1168,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
981
1168
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
982
1169
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
983
1170
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
984
|
-
return
|
|
1171
|
+
return _this8.options.items[s].label || _this8.options.items[s].value;
|
|
985
1172
|
}).join(this.options.multiValueDelimiter);
|
|
986
1173
|
var headerValue = this.selectedItems.map(function (s) {
|
|
987
|
-
return
|
|
1174
|
+
return _this8.options.items[s].value || _this8.options.items[s].label;
|
|
988
1175
|
}).join(this.options.multiValueDelimiter);
|
|
989
1176
|
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerLabel, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n <svg class='arrow' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg> \n ");
|
|
990
1177
|
|
|
@@ -1216,10 +1403,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1216
1403
|
}, {
|
|
1217
1404
|
key: "renderItems",
|
|
1218
1405
|
value: function renderItems() {
|
|
1219
|
-
var
|
|
1406
|
+
var _this9 = this;
|
|
1220
1407
|
|
|
1221
1408
|
var html = this.options.items.map(function (r, i) {
|
|
1222
|
-
return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1409
|
+
return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this9.selectedItems.indexOf(i) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1223
1410
|
}).join('');
|
|
1224
1411
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1225
1412
|
|
|
@@ -1238,7 +1425,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1238
1425
|
}, {
|
|
1239
1426
|
key: "updateHeader",
|
|
1240
1427
|
value: function updateHeader(item) {
|
|
1241
|
-
var
|
|
1428
|
+
var _this10 = this;
|
|
1242
1429
|
|
|
1243
1430
|
var el = document.getElementById(this.elementId);
|
|
1244
1431
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1284,17 +1471,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1284
1471
|
} else if (this.selectedItems.length > 1) {
|
|
1285
1472
|
if (this.options.showCompleteSelectedList === true) {
|
|
1286
1473
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1287
|
-
return
|
|
1474
|
+
return _this10.options.items[s].label || _this10.options.items[s].value;
|
|
1288
1475
|
}).join(this.options.multiValueDelimiter);
|
|
1289
1476
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1290
|
-
return
|
|
1477
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1291
1478
|
}).join(this.options.multiValueDelimiter);
|
|
1292
1479
|
labelEl.innerHTML = selectedLabels;
|
|
1293
1480
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1294
1481
|
inputEl.value = selectedValues;
|
|
1295
1482
|
} else {
|
|
1296
1483
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1297
|
-
return
|
|
1484
|
+
return _this10.options.items[s].value || _this10.options.items[s].label;
|
|
1298
1485
|
}).join(this.options.multiValueDelimiter);
|
|
1299
1486
|
|
|
1300
1487
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1423,13 +1610,13 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1423
1610
|
}, {
|
|
1424
1611
|
key: "checkRecaptcha",
|
|
1425
1612
|
value: function checkRecaptcha() {
|
|
1426
|
-
var
|
|
1613
|
+
var _this11 = this;
|
|
1427
1614
|
|
|
1428
1615
|
return new Promise(function (resolve, reject) {
|
|
1429
|
-
if (
|
|
1430
|
-
if (
|
|
1431
|
-
|
|
1432
|
-
grecaptcharesponse:
|
|
1616
|
+
if (_this11.options.useRecaptcha === true) {
|
|
1617
|
+
if (_this11.recaptchaValue) {
|
|
1618
|
+
_this11.apiService.add('/google/checkrecaptcha', JSON.stringify({
|
|
1619
|
+
grecaptcharesponse: _this11.recaptchaValue
|
|
1433
1620
|
})).then(function (response) {
|
|
1434
1621
|
if (response.success && response.success === true) {
|
|
1435
1622
|
resolve(true);
|
|
@@ -1487,14 +1674,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1487
1674
|
}, {
|
|
1488
1675
|
key: "processComponents",
|
|
1489
1676
|
value: function processComponents(components, callbackFn) {
|
|
1490
|
-
var
|
|
1677
|
+
var _this12 = this;
|
|
1491
1678
|
|
|
1492
1679
|
if (components.length === 0) {
|
|
1493
1680
|
callbackFn();
|
|
1494
1681
|
} else {
|
|
1495
1682
|
components.forEach(function (c) {
|
|
1496
1683
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1497
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
1684
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this12.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1498
1685
|
} else {// some user feedback here
|
|
1499
1686
|
}
|
|
1500
1687
|
});
|
|
@@ -1515,7 +1702,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1515
1702
|
}, {
|
|
1516
1703
|
key: "render",
|
|
1517
1704
|
value: function render(update, data) {
|
|
1518
|
-
var
|
|
1705
|
+
var _this13 = this;
|
|
1519
1706
|
|
|
1520
1707
|
var el = document.getElementById(this.elementId);
|
|
1521
1708
|
var componentsToProcess = [];
|
|
@@ -1525,11 +1712,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1525
1712
|
this.options.fields.forEach(function (f, i) {
|
|
1526
1713
|
if (f.component) {
|
|
1527
1714
|
componentsToProcess.push(f);
|
|
1528
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(
|
|
1715
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this13.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
1529
1716
|
} else if (f.type === 'longtext') {
|
|
1530
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(
|
|
1717
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this13.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
1531
1718
|
} else {
|
|
1532
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
1719
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this13.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
1533
1720
|
}
|
|
1534
1721
|
});
|
|
1535
1722
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -1546,8 +1733,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1546
1733
|
|
|
1547
1734
|
el.innerHTML = html;
|
|
1548
1735
|
this.processComponents(componentsToProcess, function () {
|
|
1549
|
-
if (
|
|
1550
|
-
|
|
1736
|
+
if (_this13.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
1737
|
+
_this13.recaptchaReady();
|
|
1551
1738
|
}
|
|
1552
1739
|
});
|
|
1553
1740
|
}
|
|
@@ -1555,7 +1742,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1555
1742
|
}, {
|
|
1556
1743
|
key: "submitForm",
|
|
1557
1744
|
value: function submitForm() {
|
|
1558
|
-
var
|
|
1745
|
+
var _this14 = this;
|
|
1559
1746
|
|
|
1560
1747
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1561
1748
|
|
|
@@ -1569,22 +1756,22 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1569
1756
|
data[key] = value;
|
|
1570
1757
|
});
|
|
1571
1758
|
|
|
1572
|
-
if (
|
|
1573
|
-
|
|
1574
|
-
if (
|
|
1759
|
+
if (_this14.options.url) {
|
|
1760
|
+
_this14.apiService.add(_this14.options.url, data).then(function (result) {
|
|
1761
|
+
if (_this14.options.clearAfterSave === true) {
|
|
1575
1762
|
// this.render()
|
|
1576
1763
|
formEl.reset();
|
|
1577
1764
|
}
|
|
1578
1765
|
|
|
1579
|
-
|
|
1766
|
+
_this14.options.onSuccess.call(_this14, result);
|
|
1580
1767
|
}, function (err) {
|
|
1581
1768
|
console.log('Error submitting form data:', err);
|
|
1582
1769
|
|
|
1583
|
-
|
|
1770
|
+
_this14.options.onError.call(_this14, err);
|
|
1584
1771
|
});
|
|
1585
|
-
} else if (
|
|
1586
|
-
|
|
1587
|
-
if (
|
|
1772
|
+
} else if (_this14.options.submitFn) {
|
|
1773
|
+
_this14.options.submitFn(data, function () {
|
|
1774
|
+
if (_this14.options.clearAfterSave === true) {
|
|
1588
1775
|
// this.render()
|
|
1589
1776
|
formEl.reset();
|
|
1590
1777
|
}
|
|
@@ -1604,17 +1791,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1604
1791
|
}, {
|
|
1605
1792
|
key: "data",
|
|
1606
1793
|
set: function set(d) {
|
|
1607
|
-
var
|
|
1794
|
+
var _this15 = this;
|
|
1608
1795
|
|
|
1609
1796
|
if (!this.options.fields) {
|
|
1610
1797
|
this.options.fields = [];
|
|
1611
1798
|
}
|
|
1612
1799
|
|
|
1613
1800
|
var _loop = function _loop(key) {
|
|
1614
|
-
|
|
1801
|
+
_this15.options.fields.forEach(function (f) {
|
|
1615
1802
|
if (f.field === key) {
|
|
1616
1803
|
f.value = d[key];
|
|
1617
|
-
var el = document.getElementById("".concat(
|
|
1804
|
+
var el = document.getElementById("".concat(_this15.elementId, "_input_").concat(f.field));
|
|
1618
1805
|
el.value = f.value;
|
|
1619
1806
|
}
|
|
1620
1807
|
});
|
|
@@ -1914,7 +2101,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
1914
2101
|
|
|
1915
2102
|
var Pager = /*#__PURE__*/function () {
|
|
1916
2103
|
function Pager(elementId, options) {
|
|
1917
|
-
var
|
|
2104
|
+
var _this16 = this;
|
|
1918
2105
|
|
|
1919
2106
|
_classCallCheck(this, Pager);
|
|
1920
2107
|
|
|
@@ -1967,8 +2154,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
1967
2154
|
allowClear: false,
|
|
1968
2155
|
disableSearch: true,
|
|
1969
2156
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
1970
|
-
if (
|
|
1971
|
-
|
|
2157
|
+
if (_this16.options.onChangePageSize) {
|
|
2158
|
+
_this16.options.onChangePageSize(selectedItem.value);
|
|
1972
2159
|
}
|
|
1973
2160
|
}
|
|
1974
2161
|
});
|
|
@@ -1992,13 +2179,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
1992
2179
|
}, {
|
|
1993
2180
|
key: "render",
|
|
1994
2181
|
value: function render() {
|
|
1995
|
-
var
|
|
2182
|
+
var _this17 = this;
|
|
1996
2183
|
|
|
1997
2184
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
1998
2185
|
|
|
1999
2186
|
if (el) {
|
|
2000
2187
|
var pages = this.options.pages.map(function (item, index) {
|
|
2001
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2188
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this17.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2002
2189
|
});
|
|
2003
2190
|
var startIndex = 0;
|
|
2004
2191
|
|
|
@@ -2066,58 +2253,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2066
2253
|
_createClass(WebsyPDFButton, [{
|
|
2067
2254
|
key: "handleClick",
|
|
2068
2255
|
value: function handleClick(event) {
|
|
2069
|
-
var
|
|
2256
|
+
var _this18 = this;
|
|
2070
2257
|
|
|
2071
2258
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2072
2259
|
this.loader.show();
|
|
2073
2260
|
setTimeout(function () {
|
|
2074
|
-
if (
|
|
2075
|
-
var el = document.getElementById(
|
|
2261
|
+
if (_this18.options.targetId) {
|
|
2262
|
+
var el = document.getElementById(_this18.options.targetId);
|
|
2076
2263
|
|
|
2077
2264
|
if (el) {
|
|
2078
2265
|
var pdfData = {
|
|
2079
2266
|
options: {}
|
|
2080
2267
|
};
|
|
2081
2268
|
|
|
2082
|
-
if (
|
|
2083
|
-
pdfData.options = _extends({},
|
|
2269
|
+
if (_this18.options.pdfOptions) {
|
|
2270
|
+
pdfData.options = _extends({}, _this18.options.pdfOptions);
|
|
2084
2271
|
}
|
|
2085
2272
|
|
|
2086
|
-
if (
|
|
2087
|
-
if (
|
|
2088
|
-
var headerEl = document.getElementById(
|
|
2273
|
+
if (_this18.options.header) {
|
|
2274
|
+
if (_this18.options.header.elementId) {
|
|
2275
|
+
var headerEl = document.getElementById(_this18.options.header.elementId);
|
|
2089
2276
|
|
|
2090
2277
|
if (headerEl) {
|
|
2091
2278
|
pdfData.header = headerEl.outerHTML;
|
|
2092
2279
|
|
|
2093
|
-
if (
|
|
2094
|
-
pdfData.options.headerCSS =
|
|
2280
|
+
if (_this18.options.header.css) {
|
|
2281
|
+
pdfData.options.headerCSS = _this18.options.header.css;
|
|
2095
2282
|
}
|
|
2096
2283
|
}
|
|
2097
|
-
} else if (
|
|
2098
|
-
pdfData.header =
|
|
2284
|
+
} else if (_this18.options.header.html) {
|
|
2285
|
+
pdfData.header = _this18.options.header.html;
|
|
2099
2286
|
|
|
2100
|
-
if (
|
|
2101
|
-
pdfData.options.headerCSS =
|
|
2287
|
+
if (_this18.options.header.css) {
|
|
2288
|
+
pdfData.options.headerCSS = _this18.options.header.css;
|
|
2102
2289
|
}
|
|
2103
2290
|
} else {
|
|
2104
|
-
pdfData.header =
|
|
2291
|
+
pdfData.header = _this18.options.header;
|
|
2105
2292
|
}
|
|
2106
2293
|
}
|
|
2107
2294
|
|
|
2108
|
-
if (
|
|
2109
|
-
if (
|
|
2110
|
-
var footerEl = document.getElementById(
|
|
2295
|
+
if (_this18.options.footer) {
|
|
2296
|
+
if (_this18.options.footer.elementId) {
|
|
2297
|
+
var footerEl = document.getElementById(_this18.options.footer.elementId);
|
|
2111
2298
|
|
|
2112
2299
|
if (footerEl) {
|
|
2113
2300
|
pdfData.footer = footerEl.outerHTML;
|
|
2114
2301
|
|
|
2115
|
-
if (
|
|
2116
|
-
pdfData.options.footerCSS =
|
|
2302
|
+
if (_this18.options.footer.css) {
|
|
2303
|
+
pdfData.options.footerCSS = _this18.options.footer.css;
|
|
2117
2304
|
}
|
|
2118
2305
|
}
|
|
2119
2306
|
} else {
|
|
2120
|
-
pdfData.footer =
|
|
2307
|
+
pdfData.footer = _this18.options.footer;
|
|
2121
2308
|
}
|
|
2122
2309
|
}
|
|
2123
2310
|
|
|
@@ -2126,23 +2313,23 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2126
2313
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2127
2314
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2128
2315
|
|
|
2129
|
-
|
|
2316
|
+
_this18.service.add('', pdfData, {
|
|
2130
2317
|
responseType: 'blob'
|
|
2131
2318
|
}).then(function (response) {
|
|
2132
|
-
|
|
2319
|
+
_this18.loader.hide();
|
|
2133
2320
|
|
|
2134
2321
|
var blob = new Blob([response], {
|
|
2135
2322
|
type: 'application/pdf'
|
|
2136
2323
|
});
|
|
2137
2324
|
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 ");
|
|
2138
2325
|
|
|
2139
|
-
if (
|
|
2140
|
-
msg += "download='".concat(
|
|
2326
|
+
if (_this18.options.directDownload === true) {
|
|
2327
|
+
msg += "download='".concat(_this18.options.fileName || 'Export', ".pdf'");
|
|
2141
2328
|
}
|
|
2142
2329
|
|
|
2143
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2330
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this18.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2144
2331
|
|
|
2145
|
-
|
|
2332
|
+
_this18.popup.show({
|
|
2146
2333
|
message: msg,
|
|
2147
2334
|
mask: true
|
|
2148
2335
|
});
|
|
@@ -2327,7 +2514,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2327
2514
|
|
|
2328
2515
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2329
2516
|
function WebsyResultList(elementId, options) {
|
|
2330
|
-
var
|
|
2517
|
+
var _this19 = this;
|
|
2331
2518
|
|
|
2332
2519
|
_classCallCheck(this, WebsyResultList);
|
|
2333
2520
|
|
|
@@ -2355,9 +2542,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2355
2542
|
|
|
2356
2543
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2357
2544
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2358
|
-
|
|
2545
|
+
_this19.options.template = templateString;
|
|
2359
2546
|
|
|
2360
|
-
|
|
2547
|
+
_this19.render();
|
|
2361
2548
|
});
|
|
2362
2549
|
} else {
|
|
2363
2550
|
this.render();
|
|
@@ -2376,7 +2563,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2376
2563
|
}, {
|
|
2377
2564
|
key: "buildHTML",
|
|
2378
2565
|
value: function buildHTML(d) {
|
|
2379
|
-
var
|
|
2566
|
+
var _this20 = this;
|
|
2380
2567
|
|
|
2381
2568
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2382
2569
|
var html = "";
|
|
@@ -2384,7 +2571,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2384
2571
|
if (this.options.template) {
|
|
2385
2572
|
if (d.length > 0) {
|
|
2386
2573
|
d.forEach(function (row, ix) {
|
|
2387
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
2574
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this20.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2388
2575
|
|
|
2389
2576
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2390
2577
|
|
|
@@ -2504,7 +2691,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2504
2691
|
}, {
|
|
2505
2692
|
key: "handleClick",
|
|
2506
2693
|
value: function handleClick(event) {
|
|
2507
|
-
var
|
|
2694
|
+
var _this21 = this;
|
|
2508
2695
|
|
|
2509
2696
|
if (event.target.classList.contains('clickable')) {
|
|
2510
2697
|
var l = event.target.getAttribute('data-event');
|
|
@@ -2522,8 +2709,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2522
2709
|
l = l[0];
|
|
2523
2710
|
params = params.map(function (p) {
|
|
2524
2711
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
2525
|
-
if (
|
|
2526
|
-
p =
|
|
2712
|
+
if (_this21.rows[+id]) {
|
|
2713
|
+
p = _this21.rows[+id][p];
|
|
2527
2714
|
}
|
|
2528
2715
|
} else if (typeof p === 'string') {
|
|
2529
2716
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -2545,13 +2732,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2545
2732
|
}, {
|
|
2546
2733
|
key: "render",
|
|
2547
2734
|
value: function render() {
|
|
2548
|
-
var
|
|
2735
|
+
var _this22 = this;
|
|
2549
2736
|
|
|
2550
2737
|
if (this.options.entity) {
|
|
2551
2738
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
2552
|
-
|
|
2739
|
+
_this22.rows = results.rows;
|
|
2553
2740
|
|
|
2554
|
-
|
|
2741
|
+
_this22.resize();
|
|
2555
2742
|
});
|
|
2556
2743
|
} else {
|
|
2557
2744
|
this.resize();
|
|
@@ -2630,7 +2817,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2630
2817
|
_createClass(WebsyRouter, [{
|
|
2631
2818
|
key: "addGroup",
|
|
2632
2819
|
value: function addGroup(group) {
|
|
2633
|
-
var
|
|
2820
|
+
var _this23 = this;
|
|
2634
2821
|
|
|
2635
2822
|
if (!this.groups[group]) {
|
|
2636
2823
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
@@ -2638,7 +2825,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2638
2825
|
if (els) {
|
|
2639
2826
|
console.log('els', els);
|
|
2640
2827
|
this.getClosestParent(els[0], function (parent) {
|
|
2641
|
-
|
|
2828
|
+
_this23.groups[group] = {
|
|
2642
2829
|
activeView: '',
|
|
2643
2830
|
views: [],
|
|
2644
2831
|
parent: parent.getAttribute('data-view')
|
|
@@ -2959,12 +3146,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2959
3146
|
}, {
|
|
2960
3147
|
key: "showComponents",
|
|
2961
3148
|
value: function showComponents(view) {
|
|
2962
|
-
var
|
|
3149
|
+
var _this24 = this;
|
|
2963
3150
|
|
|
2964
3151
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
2965
3152
|
this.options.views[view].components.forEach(function (c) {
|
|
2966
3153
|
if (typeof c.instance === 'undefined') {
|
|
2967
|
-
|
|
3154
|
+
_this24.prepComponent(c.elementId, c.options);
|
|
2968
3155
|
|
|
2969
3156
|
c.instance = new c.Component(c.elementId, c.options);
|
|
2970
3157
|
} else if (c.instance.render) {
|
|
@@ -3331,7 +3518,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3331
3518
|
|
|
3332
3519
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3333
3520
|
function WebsyTemplate(elementId, options) {
|
|
3334
|
-
var
|
|
3521
|
+
var _this25 = this;
|
|
3335
3522
|
|
|
3336
3523
|
_classCallCheck(this, WebsyTemplate);
|
|
3337
3524
|
|
|
@@ -3357,9 +3544,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3357
3544
|
|
|
3358
3545
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3359
3546
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3360
|
-
|
|
3547
|
+
_this25.options.template = templateString;
|
|
3361
3548
|
|
|
3362
|
-
|
|
3549
|
+
_this25.render();
|
|
3363
3550
|
});
|
|
3364
3551
|
} else {
|
|
3365
3552
|
this.render();
|
|
@@ -3369,7 +3556,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3369
3556
|
_createClass(WebsyTemplate, [{
|
|
3370
3557
|
key: "buildHTML",
|
|
3371
3558
|
value: function buildHTML() {
|
|
3372
|
-
var
|
|
3559
|
+
var _this26 = this;
|
|
3373
3560
|
|
|
3374
3561
|
var html = "";
|
|
3375
3562
|
|
|
@@ -3431,14 +3618,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3431
3618
|
}
|
|
3432
3619
|
|
|
3433
3620
|
if (polarity === true) {
|
|
3434
|
-
if (typeof
|
|
3621
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] === parts[1]) {
|
|
3435
3622
|
// remove the <if> tags
|
|
3436
3623
|
removeAll = false;
|
|
3437
3624
|
} else if (parts[0] === parts[1]) {
|
|
3438
3625
|
removeAll = false;
|
|
3439
3626
|
}
|
|
3440
3627
|
} else if (polarity === false) {
|
|
3441
|
-
if (typeof
|
|
3628
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] !== parts[1]) {
|
|
3442
3629
|
// remove the <if> tags
|
|
3443
3630
|
removeAll = false;
|
|
3444
3631
|
}
|
|
@@ -3706,7 +3893,7 @@ var WebsyUtils = {
|
|
|
3706
3893
|
|
|
3707
3894
|
var WebsyTable = /*#__PURE__*/function () {
|
|
3708
3895
|
function WebsyTable(elementId, options) {
|
|
3709
|
-
var
|
|
3896
|
+
var _this27 = this;
|
|
3710
3897
|
|
|
3711
3898
|
_classCallCheck(this, WebsyTable);
|
|
3712
3899
|
|
|
@@ -3744,8 +3931,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3744
3931
|
allowClear: false,
|
|
3745
3932
|
disableSearch: true,
|
|
3746
3933
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3747
|
-
if (
|
|
3748
|
-
|
|
3934
|
+
if (_this27.options.onChangePageSize) {
|
|
3935
|
+
_this27.options.onChangePageSize(selectedItem.value);
|
|
3749
3936
|
}
|
|
3750
3937
|
}
|
|
3751
3938
|
});
|
|
@@ -3766,7 +3953,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3766
3953
|
_createClass(WebsyTable, [{
|
|
3767
3954
|
key: "appendRows",
|
|
3768
3955
|
value: function appendRows(data) {
|
|
3769
|
-
var
|
|
3956
|
+
var _this28 = this;
|
|
3770
3957
|
|
|
3771
3958
|
this.hideError();
|
|
3772
3959
|
var bodyHTML = '';
|
|
@@ -3774,15 +3961,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3774
3961
|
if (data) {
|
|
3775
3962
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
3776
3963
|
return '<tr>' + r.map(function (c, i) {
|
|
3777
|
-
if (
|
|
3964
|
+
if (_this28.options.columns[i].show !== false) {
|
|
3778
3965
|
var style = '';
|
|
3779
3966
|
|
|
3780
3967
|
if (c.style) {
|
|
3781
3968
|
style += c.style;
|
|
3782
3969
|
}
|
|
3783
3970
|
|
|
3784
|
-
if (
|
|
3785
|
-
style += "width: ".concat(
|
|
3971
|
+
if (_this28.options.columns[i].width) {
|
|
3972
|
+
style += "width: ".concat(_this28.options.columns[i].width, "; ");
|
|
3786
3973
|
}
|
|
3787
3974
|
|
|
3788
3975
|
if (c.backgroundColor) {
|
|
@@ -3797,18 +3984,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3797
3984
|
style += "color: ".concat(c.color, "; ");
|
|
3798
3985
|
}
|
|
3799
3986
|
|
|
3800
|
-
if (
|
|
3801
|
-
return "\n <td \n data-row-index='".concat(
|
|
3802
|
-
} else if ((
|
|
3803
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
3987
|
+
if (_this28.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
3988
|
+
return "\n <td \n data-row-index='".concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this28.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(_this28.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this28.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
3989
|
+
} else if ((_this28.options.columns[i].showAsNavigatorLink === true || _this28.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
3990
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this28.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this28.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this28.options.columns[i].linkText || c.value, "</td>\n ");
|
|
3804
3991
|
} else {
|
|
3805
3992
|
var info = c.value;
|
|
3806
3993
|
|
|
3807
|
-
if (
|
|
3994
|
+
if (_this28.options.columns[i].showAsImage === true) {
|
|
3808
3995
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
3809
3996
|
}
|
|
3810
3997
|
|
|
3811
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
3998
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this28.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this28.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 ");
|
|
3812
3999
|
}
|
|
3813
4000
|
}
|
|
3814
4001
|
}).join('') + '</tr>';
|
|
@@ -3967,7 +4154,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3967
4154
|
}, {
|
|
3968
4155
|
key: "render",
|
|
3969
4156
|
value: function render(data) {
|
|
3970
|
-
var
|
|
4157
|
+
var _this29 = this;
|
|
3971
4158
|
|
|
3972
4159
|
if (!this.options.columns) {
|
|
3973
4160
|
return;
|
|
@@ -3992,7 +4179,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3992
4179
|
|
|
3993
4180
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
3994
4181
|
if (c.show !== false) {
|
|
3995
|
-
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ?
|
|
4182
|
+
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ? _this29.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
3996
4183
|
}
|
|
3997
4184
|
}).join('') + '</tr>';
|
|
3998
4185
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4011,7 +4198,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4011
4198
|
|
|
4012
4199
|
if (pagingEl) {
|
|
4013
4200
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4014
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4201
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this29.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4015
4202
|
});
|
|
4016
4203
|
var startIndex = 0;
|
|
4017
4204
|
|
|
@@ -4079,7 +4266,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4079
4266
|
|
|
4080
4267
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4081
4268
|
function WebsyTable2(elementId, options) {
|
|
4082
|
-
var
|
|
4269
|
+
var _this30 = this;
|
|
4083
4270
|
|
|
4084
4271
|
_classCallCheck(this, WebsyTable2);
|
|
4085
4272
|
|
|
@@ -4120,8 +4307,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4120
4307
|
allowClear: false,
|
|
4121
4308
|
disableSearch: true,
|
|
4122
4309
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4123
|
-
if (
|
|
4124
|
-
|
|
4310
|
+
if (_this30.options.onChangePageSize) {
|
|
4311
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
4125
4312
|
}
|
|
4126
4313
|
}
|
|
4127
4314
|
});
|
|
@@ -4145,7 +4332,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4145
4332
|
_createClass(WebsyTable2, [{
|
|
4146
4333
|
key: "appendRows",
|
|
4147
4334
|
value: function appendRows(data) {
|
|
4148
|
-
var
|
|
4335
|
+
var _this31 = this;
|
|
4149
4336
|
|
|
4150
4337
|
this.hideError();
|
|
4151
4338
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4154,15 +4341,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4154
4341
|
if (data) {
|
|
4155
4342
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4156
4343
|
return '<tr>' + r.map(function (c, i) {
|
|
4157
|
-
if (
|
|
4158
|
-
var style = "height: ".concat(
|
|
4344
|
+
if (_this31.options.columns[i].show !== false) {
|
|
4345
|
+
var style = "height: ".concat(_this31.options.cellSize, "px; line-height: ").concat(_this31.options.cellSize, "px;");
|
|
4159
4346
|
|
|
4160
4347
|
if (c.style) {
|
|
4161
4348
|
style += c.style;
|
|
4162
4349
|
}
|
|
4163
4350
|
|
|
4164
|
-
if (
|
|
4165
|
-
style += "width: ".concat(
|
|
4351
|
+
if (_this31.options.columns[i].width) {
|
|
4352
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
4166
4353
|
}
|
|
4167
4354
|
|
|
4168
4355
|
if (c.backgroundColor) {
|
|
@@ -4177,18 +4364,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4177
4364
|
style += "color: ".concat(c.color, "; ");
|
|
4178
4365
|
}
|
|
4179
4366
|
|
|
4180
|
-
if (
|
|
4181
|
-
return "\n <td \n data-row-index='".concat(
|
|
4182
|
-
} else if ((
|
|
4183
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4367
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4368
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
4369
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4370
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4184
4371
|
} else {
|
|
4185
4372
|
var info = c.value;
|
|
4186
4373
|
|
|
4187
|
-
if (
|
|
4374
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
4188
4375
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4189
4376
|
}
|
|
4190
4377
|
|
|
4191
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4378
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
4192
4379
|
}
|
|
4193
4380
|
}
|
|
4194
4381
|
}).join('') + '</tr>';
|
|
@@ -4431,7 +4618,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4431
4618
|
}, {
|
|
4432
4619
|
key: "render",
|
|
4433
4620
|
value: function render(data) {
|
|
4434
|
-
var
|
|
4621
|
+
var _this32 = this;
|
|
4435
4622
|
|
|
4436
4623
|
if (!this.options.columns) {
|
|
4437
4624
|
return;
|
|
@@ -4457,7 +4644,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4457
4644
|
|
|
4458
4645
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4459
4646
|
if (c.show !== false) {
|
|
4460
|
-
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\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 ?
|
|
4647
|
+
return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this32.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
4461
4648
|
}
|
|
4462
4649
|
}).join('') + '</tr>';
|
|
4463
4650
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4468,7 +4655,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4468
4655
|
var dropdownHTML = "";
|
|
4469
4656
|
this.options.columns.forEach(function (c, i) {
|
|
4470
4657
|
if (c.searchable && c.searchField) {
|
|
4471
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
4658
|
+
dropdownHTML += "\n <div id=\"".concat(_this32.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
4472
4659
|
}
|
|
4473
4660
|
});
|
|
4474
4661
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -4490,7 +4677,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4490
4677
|
|
|
4491
4678
|
if (pagingEl) {
|
|
4492
4679
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4493
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4680
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4494
4681
|
});
|
|
4495
4682
|
var startIndex = 0;
|
|
4496
4683
|
|
|
@@ -4577,14 +4764,14 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4577
4764
|
}, {
|
|
4578
4765
|
key: "getColumnParameters",
|
|
4579
4766
|
value: function getColumnParameters(values) {
|
|
4580
|
-
var
|
|
4767
|
+
var _this33 = this;
|
|
4581
4768
|
|
|
4582
4769
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
4583
4770
|
tableEl.style.tableLayout = 'auto';
|
|
4584
4771
|
tableEl.style.width = 'auto';
|
|
4585
4772
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
4586
4773
|
bodyEl.innerHTML = '<tr>' + values.map(function (c) {
|
|
4587
|
-
return "\n <td \n style='height: ".concat(
|
|
4774
|
+
return "\n <td \n style='height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
4588
4775
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
4589
4776
|
|
|
4590
4777
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -4625,7 +4812,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4625
4812
|
|
|
4626
4813
|
var WebsyChart = /*#__PURE__*/function () {
|
|
4627
4814
|
function WebsyChart(elementId, options) {
|
|
4628
|
-
var
|
|
4815
|
+
var _this34 = this;
|
|
4629
4816
|
|
|
4630
4817
|
_classCallCheck(this, WebsyChart);
|
|
4631
4818
|
|
|
@@ -4673,22 +4860,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4673
4860
|
this.invertOverride = function (input, input2) {
|
|
4674
4861
|
var xAxis = 'bottomAxis';
|
|
4675
4862
|
|
|
4676
|
-
if (
|
|
4863
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
4677
4864
|
xAxis = 'leftAxis';
|
|
4678
4865
|
}
|
|
4679
4866
|
|
|
4680
|
-
var width =
|
|
4867
|
+
var width = _this34[xAxis].step();
|
|
4681
4868
|
|
|
4682
4869
|
var output;
|
|
4683
4870
|
|
|
4684
|
-
var domain = _toConsumableArray(
|
|
4871
|
+
var domain = _toConsumableArray(_this34[xAxis].domain());
|
|
4685
4872
|
|
|
4686
|
-
if (
|
|
4873
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
4687
4874
|
domain = domain.reverse();
|
|
4688
4875
|
}
|
|
4689
4876
|
|
|
4690
4877
|
for (var j = 0; j < domain.length; j++) {
|
|
4691
|
-
var breakA =
|
|
4878
|
+
var breakA = _this34[xAxis](domain[j]) - width / 2;
|
|
4692
4879
|
var breakB = breakA + width;
|
|
4693
4880
|
|
|
4694
4881
|
if (input > breakA && input <= breakB) {
|
|
@@ -4788,10 +4975,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4788
4975
|
}, {
|
|
4789
4976
|
key: "handleEventMouseMove",
|
|
4790
4977
|
value: function handleEventMouseMove(event, d) {
|
|
4791
|
-
var
|
|
4978
|
+
var _this35 = this;
|
|
4792
4979
|
|
|
4793
4980
|
var bisectDate = d3.bisector(function (d) {
|
|
4794
|
-
return
|
|
4981
|
+
return _this35.parseX(d.x.value);
|
|
4795
4982
|
}).left;
|
|
4796
4983
|
|
|
4797
4984
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -4830,8 +5017,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4830
5017
|
}
|
|
4831
5018
|
|
|
4832
5019
|
this.options.data.series.forEach(function (s) {
|
|
4833
|
-
if (
|
|
4834
|
-
xPoint =
|
|
5020
|
+
if (_this35.options.data[xData].scale !== 'Time') {
|
|
5021
|
+
xPoint = _this35[xAxis](_this35.parseX(xLabel));
|
|
4835
5022
|
s.data.forEach(function (d) {
|
|
4836
5023
|
if (d.x.value === xLabel) {
|
|
4837
5024
|
if (!d.y.color) {
|
|
@@ -4846,13 +5033,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4846
5033
|
var pointA = s.data[index - 1];
|
|
4847
5034
|
var pointB = s.data[index];
|
|
4848
5035
|
|
|
4849
|
-
if (
|
|
5036
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
4850
5037
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
4851
5038
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
4852
5039
|
}
|
|
4853
5040
|
|
|
4854
5041
|
if (pointA && !pointB) {
|
|
4855
|
-
xPoint =
|
|
5042
|
+
xPoint = _this35[xAxis](_this35.parseX(pointA.x.value));
|
|
4856
5043
|
tooltipTitle = pointA.x.value;
|
|
4857
5044
|
|
|
4858
5045
|
if (!pointA.y.color) {
|
|
@@ -4862,12 +5049,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4862
5049
|
tooltipData.push(pointA.y);
|
|
4863
5050
|
|
|
4864
5051
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
4865
|
-
tooltipTitle = d3.timeFormat(
|
|
5052
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
4866
5053
|
}
|
|
4867
5054
|
}
|
|
4868
5055
|
|
|
4869
5056
|
if (pointB && !pointA) {
|
|
4870
|
-
xPoint =
|
|
5057
|
+
xPoint = _this35[xAxis](_this35.parseX(pointB.x.value));
|
|
4871
5058
|
tooltipTitle = pointB.x.value;
|
|
4872
5059
|
|
|
4873
5060
|
if (!pointB.y.color) {
|
|
@@ -4877,14 +5064,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4877
5064
|
tooltipData.push(pointB.y);
|
|
4878
5065
|
|
|
4879
5066
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
4880
|
-
tooltipTitle = d3.timeFormat(
|
|
5067
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
4881
5068
|
}
|
|
4882
5069
|
}
|
|
4883
5070
|
|
|
4884
5071
|
if (pointA && pointB) {
|
|
4885
|
-
var d0 =
|
|
5072
|
+
var d0 = _this35[xAxis](_this35.parseX(pointA.x.value));
|
|
4886
5073
|
|
|
4887
|
-
var d1 =
|
|
5074
|
+
var d1 = _this35[xAxis](_this35.parseX(pointB.x.value));
|
|
4888
5075
|
|
|
4889
5076
|
var mid = Math.abs(d0 - d1) / 2;
|
|
4890
5077
|
|
|
@@ -4893,7 +5080,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4893
5080
|
tooltipTitle = pointB.x.value;
|
|
4894
5081
|
|
|
4895
5082
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
4896
|
-
tooltipTitle = d3.timeFormat(
|
|
5083
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
4897
5084
|
}
|
|
4898
5085
|
|
|
4899
5086
|
if (!pointB.y.color) {
|
|
@@ -4906,7 +5093,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4906
5093
|
tooltipTitle = pointA.x.value;
|
|
4907
5094
|
|
|
4908
5095
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
4909
|
-
tooltipTitle = d3.timeFormat(
|
|
5096
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
4910
5097
|
}
|
|
4911
5098
|
|
|
4912
5099
|
if (!pointA.y.color) {
|
|
@@ -5011,7 +5198,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5011
5198
|
}, {
|
|
5012
5199
|
key: "render",
|
|
5013
5200
|
value: function render(options) {
|
|
5014
|
-
var
|
|
5201
|
+
var _this36 = this;
|
|
5015
5202
|
|
|
5016
5203
|
/* global d3 options */
|
|
5017
5204
|
if (typeof options !== 'undefined') {
|
|
@@ -5080,7 +5267,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5080
5267
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5081
5268
|
return {
|
|
5082
5269
|
value: s.label || s.key,
|
|
5083
|
-
color: s.color ||
|
|
5270
|
+
color: s.color || _this36.options.colors[i % _this36.options.colors.length]
|
|
5084
5271
|
};
|
|
5085
5272
|
});
|
|
5086
5273
|
|
|
@@ -5319,7 +5506,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5319
5506
|
|
|
5320
5507
|
if (this.options.data.bottom.formatter) {
|
|
5321
5508
|
bAxisFunc.tickFormat(function (d) {
|
|
5322
|
-
return
|
|
5509
|
+
return _this36.options.data.bottom.formatter(d);
|
|
5323
5510
|
});
|
|
5324
5511
|
}
|
|
5325
5512
|
|
|
@@ -5346,8 +5533,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5346
5533
|
|
|
5347
5534
|
if (this.options.margin.axisLeft > 0) {
|
|
5348
5535
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5349
|
-
if (
|
|
5350
|
-
d =
|
|
5536
|
+
if (_this36.options.data.left.formatter) {
|
|
5537
|
+
d = _this36.options.data.left.formatter(d);
|
|
5351
5538
|
}
|
|
5352
5539
|
|
|
5353
5540
|
return d;
|
|
@@ -5384,8 +5571,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5384
5571
|
|
|
5385
5572
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
5386
5573
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5387
|
-
if (
|
|
5388
|
-
d =
|
|
5574
|
+
if (_this36.options.data.right.formatter) {
|
|
5575
|
+
d = _this36.options.data.right.formatter(d);
|
|
5389
5576
|
}
|
|
5390
5577
|
|
|
5391
5578
|
return d;
|
|
@@ -5411,16 +5598,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5411
5598
|
|
|
5412
5599
|
this.options.data.series.forEach(function (series, index) {
|
|
5413
5600
|
if (!series.key) {
|
|
5414
|
-
series.key =
|
|
5601
|
+
series.key = _this36.createIdentity();
|
|
5415
5602
|
}
|
|
5416
5603
|
|
|
5417
5604
|
if (!series.color) {
|
|
5418
|
-
series.color =
|
|
5605
|
+
series.color = _this36.options.colors[index % _this36.options.colors.length];
|
|
5419
5606
|
}
|
|
5420
5607
|
|
|
5421
|
-
|
|
5608
|
+
_this36["render".concat(series.type || 'bar')](series, index);
|
|
5422
5609
|
|
|
5423
|
-
|
|
5610
|
+
_this36.renderLabels(series, index);
|
|
5424
5611
|
});
|
|
5425
5612
|
}
|
|
5426
5613
|
}
|
|
@@ -5428,17 +5615,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5428
5615
|
}, {
|
|
5429
5616
|
key: "renderarea",
|
|
5430
5617
|
value: function renderarea(series, index) {
|
|
5431
|
-
var
|
|
5618
|
+
var _this37 = this;
|
|
5432
5619
|
|
|
5433
5620
|
/* global d3 series index */
|
|
5434
5621
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
5435
5622
|
return d3.area().x(function (d) {
|
|
5436
|
-
return
|
|
5623
|
+
return _this37[xAxis](_this37.parseX(d.x.value));
|
|
5437
5624
|
}).y0(function (d) {
|
|
5438
|
-
return
|
|
5625
|
+
return _this37[yAxis](0);
|
|
5439
5626
|
}).y1(function (d) {
|
|
5440
|
-
return
|
|
5441
|
-
}).curve(d3[curveStyle ||
|
|
5627
|
+
return _this37[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
5628
|
+
}).curve(d3[curveStyle || _this37.options.curveStyle]);
|
|
5442
5629
|
};
|
|
5443
5630
|
|
|
5444
5631
|
var xAxis = 'bottomAxis';
|
|
@@ -5611,15 +5798,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5611
5798
|
}, {
|
|
5612
5799
|
key: "renderline",
|
|
5613
5800
|
value: function renderline(series, index) {
|
|
5614
|
-
var
|
|
5801
|
+
var _this38 = this;
|
|
5615
5802
|
|
|
5616
5803
|
/* global series index d3 */
|
|
5617
5804
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
5618
5805
|
return d3.line().x(function (d) {
|
|
5619
|
-
return
|
|
5806
|
+
return _this38[xAxis](_this38.parseX(d.x.value));
|
|
5620
5807
|
}).y(function (d) {
|
|
5621
|
-
return
|
|
5622
|
-
}).curve(d3[curveStyle ||
|
|
5808
|
+
return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
5809
|
+
}).curve(d3[curveStyle || _this38.options.curveStyle]);
|
|
5623
5810
|
};
|
|
5624
5811
|
|
|
5625
5812
|
var xAxis = 'bottomAxis';
|
|
@@ -5657,14 +5844,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5657
5844
|
}, {
|
|
5658
5845
|
key: "rendersymbol",
|
|
5659
5846
|
value: function rendersymbol(series, index) {
|
|
5660
|
-
var
|
|
5847
|
+
var _this39 = this;
|
|
5661
5848
|
|
|
5662
5849
|
/* global d3 series index series.key */
|
|
5663
5850
|
var drawSymbol = function drawSymbol(size) {
|
|
5664
5851
|
return d3.symbol() // .type(d => {
|
|
5665
5852
|
// return d3.symbols[0]
|
|
5666
5853
|
// })
|
|
5667
|
-
.size(size ||
|
|
5854
|
+
.size(size || _this39.options.symbolSize);
|
|
5668
5855
|
};
|
|
5669
5856
|
|
|
5670
5857
|
var xAxis = 'bottomAxis';
|
|
@@ -5682,7 +5869,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5682
5869
|
symbols.attr('d', function (d) {
|
|
5683
5870
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
5684
5871
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
5685
|
-
return "translate(".concat(
|
|
5872
|
+
return "translate(".concat(_this39[xAxis](_this39.parseX(d.x.value)), ", ").concat(_this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
5686
5873
|
}); // Enter
|
|
5687
5874
|
|
|
5688
5875
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -5691,7 +5878,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5691
5878
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
5692
5879
|
return "symbol symbol_".concat(series.key);
|
|
5693
5880
|
}).attr('transform', function (d) {
|
|
5694
|
-
return "translate(".concat(
|
|
5881
|
+
return "translate(".concat(_this39[xAxis](_this39.parseX(d.x.value)), ", ").concat(_this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
5695
5882
|
});
|
|
5696
5883
|
}
|
|
5697
5884
|
}, {
|
|
@@ -5846,7 +6033,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
5846
6033
|
}, {
|
|
5847
6034
|
key: "resize",
|
|
5848
6035
|
value: function resize() {
|
|
5849
|
-
var
|
|
6036
|
+
var _this40 = this;
|
|
5850
6037
|
|
|
5851
6038
|
var el = document.getElementById(this.elementId);
|
|
5852
6039
|
|
|
@@ -5859,7 +6046,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
5859
6046
|
// }
|
|
5860
6047
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
5861
6048
|
html += this._data.map(function (d, i) {
|
|
5862
|
-
return
|
|
6049
|
+
return _this40.getLegendItemHTML(d);
|
|
5863
6050
|
}).join('');
|
|
5864
6051
|
html += "\n <div>\n ";
|
|
5865
6052
|
el.innerHTML = html;
|
|
@@ -6032,7 +6219,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6032
6219
|
}, {
|
|
6033
6220
|
key: "render",
|
|
6034
6221
|
value: function render() {
|
|
6035
|
-
var
|
|
6222
|
+
var _this41 = this;
|
|
6036
6223
|
|
|
6037
6224
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6038
6225
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6041,7 +6228,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6041
6228
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6042
6229
|
return {
|
|
6043
6230
|
value: s.label || s.key,
|
|
6044
|
-
color: s.color ||
|
|
6231
|
+
color: s.color || _this41.options.colors[i % _this41.options.colors.length]
|
|
6045
6232
|
};
|
|
6046
6233
|
});
|
|
6047
6234
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6105,7 +6292,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6105
6292
|
|
|
6106
6293
|
if (this.polygons) {
|
|
6107
6294
|
this.polygons.forEach(function (p) {
|
|
6108
|
-
return
|
|
6295
|
+
return _this41.map.removeLayer(p);
|
|
6109
6296
|
});
|
|
6110
6297
|
}
|
|
6111
6298
|
|
|
@@ -6163,18 +6350,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6163
6350
|
}
|
|
6164
6351
|
|
|
6165
6352
|
if (!p.options.color) {
|
|
6166
|
-
p.options.color =
|
|
6353
|
+
p.options.color = _this41.options.colors[i % _this41.options.colors.length];
|
|
6167
6354
|
}
|
|
6168
6355
|
|
|
6169
6356
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6170
6357
|
return c.map(function (d) {
|
|
6171
6358
|
return [d.Latitude, d.Longitude];
|
|
6172
6359
|
});
|
|
6173
|
-
}), p.options).addTo(
|
|
6360
|
+
}), p.options).addTo(_this41.map);
|
|
6174
6361
|
|
|
6175
|
-
|
|
6362
|
+
_this41.polygons.push(pol);
|
|
6176
6363
|
|
|
6177
|
-
|
|
6364
|
+
_this41.map.fitBounds(pol.getBounds());
|
|
6178
6365
|
});
|
|
6179
6366
|
} // if (this.data.markers.length > 0) {
|
|
6180
6367
|
// el.classList.remove('hidden')
|