@websy/websy-designs 1.2.5 → 1.2.7
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/websy-designs-server.js +4 -4
- package/dist/websy-designs-es6.debug.js +564 -31
- package/dist/websy-designs-es6.js +693 -253
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +519 -30
- package/dist/websy-designs.js +678 -225
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +2 -1
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _websyDesignsQlikPluginEs = _interopRequireDefault(require("@websy/websy-designs-qlik-plugin/dist/websy-designs-qlik-plugin-es6"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
11
|
|
|
8
12
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
9
13
|
|
|
@@ -27,33 +31,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
27
31
|
|
|
28
32
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
33
|
|
|
30
|
-
/* global
|
|
31
|
-
include
|
|
32
|
-
WebsyPopupDialog
|
|
33
|
-
WebsyLoadingDialog
|
|
34
|
-
WebsyNavigationMenu
|
|
35
|
-
WebsyPubSub
|
|
36
|
-
WebsyForm
|
|
37
|
-
WebsyDatePicker
|
|
38
|
-
WebsyDropdown
|
|
39
|
-
WebsyRouter
|
|
40
|
-
WebsyResultList
|
|
41
|
-
WebsyTable
|
|
42
|
-
WebsyTable2
|
|
43
|
-
WebsyChart
|
|
44
|
-
WebsyChartTooltip
|
|
45
|
-
WebsyLegend
|
|
46
|
-
WebsyMap
|
|
47
|
-
WebsyKPI
|
|
48
|
-
WebsyPDFButton
|
|
49
|
-
Switch
|
|
50
|
-
WebsyTemplate
|
|
51
|
-
APIService
|
|
52
|
-
ButtonGroup
|
|
53
|
-
WebsyUtils
|
|
54
|
-
Pager
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
34
|
/* global XMLHttpRequest fetch ENV */
|
|
58
35
|
var APIService = /*#__PURE__*/function () {
|
|
59
36
|
function APIService() {
|
|
@@ -301,16 +278,25 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
301
278
|
this.currentselection = [];
|
|
302
279
|
this.validDates = [];
|
|
303
280
|
this.validYears = [];
|
|
281
|
+
this.validHours = [];
|
|
304
282
|
this.customRangeSelected = true;
|
|
305
283
|
this.shiftPressed = false;
|
|
306
284
|
var DEFAULTS = {
|
|
307
285
|
defaultRange: 0,
|
|
308
286
|
allowClear: true,
|
|
287
|
+
hideRanges: false,
|
|
309
288
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
310
289
|
maxAllowedDate: this.floorDate(new Date(new Date())),
|
|
311
290
|
minAllowedYear: 1970,
|
|
312
291
|
maxAllowedYear: new Date().getFullYear(),
|
|
313
292
|
daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
293
|
+
monthsOfYear: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
294
|
+
hours: new Array(24).fill(0).map(function (d, i) {
|
|
295
|
+
return {
|
|
296
|
+
text: (i < 10 ? '0' : '') + i + ':00',
|
|
297
|
+
num: 1 / 24 * i
|
|
298
|
+
};
|
|
299
|
+
}),
|
|
314
300
|
mode: 'date',
|
|
315
301
|
monthMap: {
|
|
316
302
|
0: 'Jan',
|
|
@@ -363,6 +349,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
363
349
|
}, {
|
|
364
350
|
label: 'Last 10 Years',
|
|
365
351
|
range: [new Date().getFullYear() - 9, DEFAULTS.maxAllowedYear]
|
|
352
|
+
}],
|
|
353
|
+
monthyear: [{
|
|
354
|
+
label: 'All',
|
|
355
|
+
range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
|
|
356
|
+
}, {
|
|
357
|
+
label: 'Last 12 Months',
|
|
358
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 12))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
359
|
+
}, {
|
|
360
|
+
label: 'Last 18 Months',
|
|
361
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 18))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
362
|
+
}, {
|
|
363
|
+
label: 'Last 24 Months',
|
|
364
|
+
range: [this.floorDate(new Date(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 24))), this.floorDate(new Date(new Date().setDate(1)))]
|
|
365
|
+
}],
|
|
366
|
+
hour: [{
|
|
367
|
+
label: 'All',
|
|
368
|
+
range: ['00:00', '23:00']
|
|
366
369
|
}]
|
|
367
370
|
};
|
|
368
371
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -387,13 +390,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
387
390
|
el.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
388
391
|
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
389
392
|
document.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
390
|
-
var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div id=\"").concat(this.elementId, "_header\" class='websy-date-picker-header ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg 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 ");
|
|
393
|
+
var html = "\n <div class='websy-date-picker-container ".concat(this.options.mode, "'>\n <span class='websy-dropdown-header-label'>").concat(this.options.label || 'Date', "</span>\n <div id=\"").concat(this.elementId, "_header\" class='websy-date-picker-header ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg 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 ");
|
|
391
394
|
|
|
392
395
|
if (this.options.allowClear === true) {
|
|
393
396
|
html += "\n <svg class='clear-selection' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n ";
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
html += "\n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content'>\n <div class='websy-date-picker-ranges'>\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <span class=\"dp-footnote\">Click and drag or hold Shift and click to select a range of values</span>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
|
|
399
|
+
html += "\n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content ").concat(this.options.hideRanges === true ? 'hide-ranges' : '', "'>\n <div class='websy-date-picker-ranges' >\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <span class=\"dp-footnote\">Click and drag or hold Shift and click to select a range of values</span>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
|
|
397
400
|
el.innerHTML = html;
|
|
398
401
|
this.render();
|
|
399
402
|
} else {
|
|
@@ -404,6 +407,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
404
407
|
_createClass(WebsyDatePicker, [{
|
|
405
408
|
key: "close",
|
|
406
409
|
value: function close(confirm) {
|
|
410
|
+
var _this2 = this;
|
|
411
|
+
|
|
407
412
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
408
413
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
409
414
|
var el = document.getElementById(this.elementId);
|
|
@@ -417,10 +422,31 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
417
422
|
|
|
418
423
|
if (confirm === true) {
|
|
419
424
|
if (this.options.onChange) {
|
|
425
|
+
console.log('confirm', this.selectedRangeDates);
|
|
426
|
+
console.log('confirm', this.currentselection);
|
|
427
|
+
|
|
420
428
|
if (this.customRangeSelected === true) {
|
|
421
|
-
this.options.
|
|
429
|
+
if (this.options.mode === 'hour') {
|
|
430
|
+
var hoursOut = [];
|
|
431
|
+
|
|
432
|
+
for (var i = this.selectedRangeDates[0]; i < this.selectedRangeDates[1] + 1; i++) {
|
|
433
|
+
hoursOut.push(this.options.hours[i]);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
this.options.onChange(hoursOut, true);
|
|
437
|
+
} else {
|
|
438
|
+
this.options.onChange(this.selectedRangeDates, true);
|
|
439
|
+
}
|
|
422
440
|
} else {
|
|
423
|
-
this.options.
|
|
441
|
+
if (this.options.mode === 'hour') {
|
|
442
|
+
var _hoursOut = this.selectedRangeDates.map(function (h) {
|
|
443
|
+
return _this2.options.hours[h];
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
this.options.onChange(_hoursOut, true);
|
|
447
|
+
} else {
|
|
448
|
+
this.options.onChange(this.currentselection, false);
|
|
449
|
+
}
|
|
424
450
|
}
|
|
425
451
|
}
|
|
426
452
|
|
|
@@ -490,7 +516,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
490
516
|
value: function handleMouseDown(event) {
|
|
491
517
|
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
492
518
|
this.mouseDownId = this.currentselection[this.currentselection.length - 1];
|
|
493
|
-
this.selectDate(+event.target.id.split('_')[
|
|
519
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
494
520
|
} else {
|
|
495
521
|
this.mouseDown = true;
|
|
496
522
|
this.dragging = false;
|
|
@@ -505,7 +531,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
505
531
|
this.customRangeSelected = false;
|
|
506
532
|
}
|
|
507
533
|
|
|
508
|
-
this.mouseDownId = +event.target.id.split('_')[
|
|
534
|
+
this.mouseDownId = +event.target.id.split('_')[1];
|
|
509
535
|
this.selectDate(this.mouseDownId);
|
|
510
536
|
}
|
|
511
537
|
}
|
|
@@ -519,9 +545,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
519
545
|
return;
|
|
520
546
|
}
|
|
521
547
|
|
|
522
|
-
if (event.target.id.split('_')[
|
|
548
|
+
if (event.target.id.split('_')[1] !== this.mouseDownId) {
|
|
523
549
|
this.dragging = true;
|
|
524
|
-
this.selectDate(+event.target.id.split('_')[
|
|
550
|
+
this.selectDate(+event.target.id.split('_')[1]);
|
|
525
551
|
}
|
|
526
552
|
}
|
|
527
553
|
}
|
|
@@ -536,7 +562,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
536
562
|
}, {
|
|
537
563
|
key: "highlightRange",
|
|
538
564
|
value: function highlightRange() {
|
|
539
|
-
var
|
|
565
|
+
var _this3 = this;
|
|
540
566
|
|
|
541
567
|
var el = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
542
568
|
var dateEls = el.querySelectorAll('.websy-dp-date');
|
|
@@ -553,6 +579,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
553
579
|
|
|
554
580
|
if (this.customRangeSelected === true) {
|
|
555
581
|
console.log('if date selection', this.currentselection);
|
|
582
|
+
console.log('if month selection', this.currentselection.map(function (d) {
|
|
583
|
+
return new Date(d);
|
|
584
|
+
}));
|
|
556
585
|
var diff;
|
|
557
586
|
|
|
558
587
|
if (this.options.mode === 'date') {
|
|
@@ -564,6 +593,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
564
593
|
|
|
565
594
|
if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
|
|
566
595
|
}
|
|
596
|
+
} else if (this.options.mode === 'monthyear') {
|
|
597
|
+
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
598
|
+
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
599
|
+
console.log('year diff', yearDiff);
|
|
600
|
+
console.log('diff', diff);
|
|
601
|
+
} else if (this.options.mode === 'hour') {
|
|
602
|
+
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
567
603
|
}
|
|
568
604
|
|
|
569
605
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -580,14 +616,29 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
580
616
|
d = this.selectedRangeDates[0] + _i;
|
|
581
617
|
rangeStart = this.selectedRangeDates[0];
|
|
582
618
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
619
|
+
} else if (this.options.mode === 'monthyear') {
|
|
620
|
+
d = new Date(this.selectedRangeDates[0].getTime()).setMonth(this.selectedRangeDates[0].getMonth() + _i);
|
|
621
|
+
rangeStart = this.selectedRangeDates[0].getTime();
|
|
622
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
623
|
+
} else if (this.options.mode === 'hour') {
|
|
624
|
+
d = this.selectedRangeDates[0] + _i;
|
|
625
|
+
rangeStart = this.selectedRangeDates[0];
|
|
626
|
+
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
|
|
583
627
|
}
|
|
584
628
|
|
|
585
629
|
var dateEl = void 0;
|
|
586
630
|
|
|
587
631
|
if (this.options.mode === 'date') {
|
|
588
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
632
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_date"));
|
|
589
633
|
} else if (this.options.mode === 'year') {
|
|
590
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
634
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
635
|
+
} else if (this.options.mode === 'monthyear') {
|
|
636
|
+
console.log('d', d);
|
|
637
|
+
console.log(this.selectedRangeDates);
|
|
638
|
+
console.log(rangeStart, rangeEnd);
|
|
639
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
640
|
+
} else if (this.options.mode === 'hour') {
|
|
641
|
+
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
591
642
|
}
|
|
592
643
|
|
|
593
644
|
if (dateEl) {
|
|
@@ -606,10 +657,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
606
657
|
this.currentselection.forEach(function (d) {
|
|
607
658
|
var dateEl;
|
|
608
659
|
|
|
609
|
-
if (
|
|
610
|
-
dateEl = document.getElementById("".concat(d, "_date"));
|
|
611
|
-
} else if (
|
|
612
|
-
dateEl = document.getElementById("".concat(d, "_year"));
|
|
660
|
+
if (_this3.options.mode === 'date') {
|
|
661
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_date"));
|
|
662
|
+
} else if (_this3.options.mode === 'year') {
|
|
663
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_year"));
|
|
664
|
+
} else if (_this3.options.mode === 'monthyear') {
|
|
665
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_monthyear"));
|
|
666
|
+
} else if (_this3.options.mode === 'hour') {
|
|
667
|
+
dateEl = document.getElementById("".concat(_this3.elementId, "_").concat(d, "_hour"));
|
|
613
668
|
}
|
|
614
669
|
|
|
615
670
|
dateEl.classList.add('selected');
|
|
@@ -663,17 +718,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
663
718
|
}, {
|
|
664
719
|
key: "renderDates",
|
|
665
720
|
value: function renderDates(disabledDates) {
|
|
666
|
-
var
|
|
721
|
+
var _this4 = this;
|
|
667
722
|
|
|
668
723
|
var disabled = [];
|
|
669
724
|
this.validDates = [];
|
|
670
725
|
this.validYears = [];
|
|
726
|
+
this.validHours = [];
|
|
727
|
+
this.monthYears = {};
|
|
728
|
+
this.monthYearMonths = [];
|
|
671
729
|
|
|
672
730
|
if (disabledDates) {
|
|
673
731
|
disabled = disabledDates.map(function (d) {
|
|
674
|
-
if (
|
|
732
|
+
if (_this4.options.mode === 'date') {
|
|
675
733
|
return d.getTime();
|
|
676
|
-
} else if (
|
|
734
|
+
} else if (_this4.options.mode === 'year') {
|
|
735
|
+
return d;
|
|
736
|
+
} else if (_this4.options.mode === 'monthyear') {//
|
|
737
|
+
} else if (_this4.options.mode === 'hour') {
|
|
677
738
|
return d;
|
|
678
739
|
}
|
|
679
740
|
|
|
@@ -691,13 +752,17 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
691
752
|
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
692
753
|
} else if (this.options.mode === 'year') {
|
|
693
754
|
diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
|
|
755
|
+
} else if (this.options.mode === 'monthyear') {
|
|
756
|
+
diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
|
|
757
|
+
} else if (this.options.mode === 'hour') {
|
|
758
|
+
diff = 24;
|
|
694
759
|
}
|
|
695
760
|
|
|
696
761
|
var months = {};
|
|
697
762
|
var yearList = [];
|
|
698
763
|
|
|
699
764
|
for (var i = 0; i < diff; i++) {
|
|
700
|
-
if (this.options.mode === 'date') {
|
|
765
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
701
766
|
var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
|
|
702
767
|
var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
703
768
|
|
|
@@ -705,6 +770,21 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
705
770
|
months[monthYear] = [];
|
|
706
771
|
}
|
|
707
772
|
|
|
773
|
+
if (!this.monthYears[d.getFullYear()]) {
|
|
774
|
+
this.monthYears[d.getFullYear()] = [];
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
778
|
+
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
779
|
+
this.monthYears[d.getFullYear()].push({
|
|
780
|
+
date: new Date(d.setDate(1)),
|
|
781
|
+
month: this.options.monthMap[d.getMonth()],
|
|
782
|
+
monthNum: d.getMonth(),
|
|
783
|
+
year: d.getFullYear(),
|
|
784
|
+
id: d.setDate(1)
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
|
|
708
788
|
if (disabled.indexOf(d.getTime()) === -1) {
|
|
709
789
|
this.validDates.push(d.getTime());
|
|
710
790
|
}
|
|
@@ -728,14 +808,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
728
808
|
if (disabled.indexOf(_d) === -1) {
|
|
729
809
|
this.validYears.push(_d);
|
|
730
810
|
}
|
|
811
|
+
} else if (this.options.mode === 'hour') {//
|
|
731
812
|
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
if (this.options.mode === 'hour') {
|
|
816
|
+
this.options.hours.forEach(function (h) {
|
|
817
|
+
if (disabled.indexOf(h.text) === -1) {
|
|
818
|
+
_this4.validHours.push(h);
|
|
819
|
+
}
|
|
820
|
+
});
|
|
732
821
|
} // check each range to see if it can be enabled
|
|
733
822
|
|
|
734
823
|
|
|
735
824
|
for (var _i2 = 0; _i2 < this.options.ranges[this.options.mode].length; _i2++) {
|
|
736
825
|
var r = this.options.ranges[this.options.mode][_i2];
|
|
737
826
|
|
|
738
|
-
if (this.options.mode === 'date') {
|
|
827
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
739
828
|
// check the first date
|
|
740
829
|
if (this.validDates.indexOf(r.range[0].getTime()) !== -1) {
|
|
741
830
|
r.disabled = false;
|
|
@@ -771,6 +860,23 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
771
860
|
}
|
|
772
861
|
}
|
|
773
862
|
}
|
|
863
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
864
|
+
} else if (this.options.mode === 'hour') {
|
|
865
|
+
if (this.validDates.indexOf(r.range[0]) !== -1) {
|
|
866
|
+
r.disabled = false;
|
|
867
|
+
} else if (r.range[1]) {
|
|
868
|
+
if (this.validDates.indexOf(r.range[1]) !== -1) {
|
|
869
|
+
r.disabled = false;
|
|
870
|
+
} else {
|
|
871
|
+
// check the full range until a match is found
|
|
872
|
+
for (var _i5 = r.range[0]; _i5 <= r.range[1]; _i5++) {
|
|
873
|
+
if (this.validDates.indexOf(r.range[0] + _i5) !== -1) {
|
|
874
|
+
r.disabled = false;
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
774
880
|
}
|
|
775
881
|
}
|
|
776
882
|
|
|
@@ -789,7 +895,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
789
895
|
if (months[key][0].dayOfWeek > 0) {
|
|
790
896
|
var paddedDays = [];
|
|
791
897
|
|
|
792
|
-
for (var
|
|
898
|
+
for (var _i6 = 0; _i6 < months[key][0].dayOfWeek; _i6++) {
|
|
793
899
|
paddedDays.push("<li> </li>");
|
|
794
900
|
}
|
|
795
901
|
|
|
@@ -797,7 +903,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
797
903
|
}
|
|
798
904
|
|
|
799
905
|
html += months[key].map(function (d) {
|
|
800
|
-
return "<li id='".concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
906
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
|
|
801
907
|
}).join('');
|
|
802
908
|
html += "\n </ul>\n </div>\n ";
|
|
803
909
|
}
|
|
@@ -810,7 +916,36 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
810
916
|
|
|
811
917
|
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
812
918
|
html += yearList.map(function (d) {
|
|
813
|
-
return "<li id='".concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
919
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_year' class='websy-dp-date websy-dp-year ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.year, "</li>");
|
|
920
|
+
}).join('');
|
|
921
|
+
html += "</ul></div>";
|
|
922
|
+
} else if (this.options.mode === 'monthyear') {
|
|
923
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-monthyear-container'>");
|
|
924
|
+
|
|
925
|
+
for (var year in this.monthYears) {
|
|
926
|
+
html += "\n <ul>\n <li>".concat(year, "</li>\n ");
|
|
927
|
+
|
|
928
|
+
if (this.monthYears[year][0].monthNum > 0) {
|
|
929
|
+
var paddedMonths = [];
|
|
930
|
+
|
|
931
|
+
for (var _i7 = 0; _i7 < this.monthYears[year][0].monthNum; _i7++) {
|
|
932
|
+
paddedMonths.push("<li> </li>");
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
html += paddedMonths.join('');
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
html += this.monthYears[year].map(function (d) {
|
|
939
|
+
return "<li id='".concat(_this4.elementId, "_").concat(d.id, "_monthyear' data-year='").concat(d.year, "' class='websy-dp-date websy-dp-monthyear'>").concat(d.month, "</li>");
|
|
940
|
+
}).join('');
|
|
941
|
+
html += "</ul>";
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
html += "</div>";
|
|
945
|
+
} else if (this.options.mode === 'hour') {
|
|
946
|
+
html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
|
|
947
|
+
html += this.options.hours.map(function (h) {
|
|
948
|
+
return "<li id='".concat(_this4.elementId, "_").concat(+h.text.split(':')[0], "_hour' data-hour='").concat(h.text, "' class='websy-dp-date websy-dp-hour'>").concat(h.text, "</li>");
|
|
814
949
|
}).join('');
|
|
815
950
|
html += "</ul></div>";
|
|
816
951
|
}
|
|
@@ -820,10 +955,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
820
955
|
}, {
|
|
821
956
|
key: "renderRanges",
|
|
822
957
|
value: function renderRanges() {
|
|
823
|
-
var
|
|
958
|
+
var _this5 = this;
|
|
824
959
|
|
|
825
960
|
return this.options.ranges[this.options.mode].map(function (r, i) {
|
|
826
|
-
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i ===
|
|
961
|
+
return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this5.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
|
|
827
962
|
}).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
|
|
828
963
|
}
|
|
829
964
|
}, {
|
|
@@ -833,13 +968,15 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
833
968
|
var el;
|
|
834
969
|
|
|
835
970
|
if (this.options.mode === 'date') {
|
|
836
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
971
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0].getTime(), "_date"));
|
|
837
972
|
} else if (this.options.mode === 'year') {
|
|
838
973
|
if (this.options.sortDirection === 'desc') {
|
|
839
|
-
el = document.getElementById("".concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
974
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
|
|
840
975
|
} else {
|
|
841
|
-
el = document.getElementById("".concat(this.selectedRangeDates[0], "_year"));
|
|
976
|
+
el = document.getElementById("".concat(this.elementId, "_").concat(this.selectedRangeDates[0], "_year"));
|
|
842
977
|
}
|
|
978
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
979
|
+
} else if (this.options.mode === 'hour') {//
|
|
843
980
|
}
|
|
844
981
|
|
|
845
982
|
var parentEl = document.getElementById("".concat(this.elementId, "_dateList"));
|
|
@@ -865,8 +1002,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
865
1002
|
}
|
|
866
1003
|
|
|
867
1004
|
this.customRangeSelected = true;
|
|
1005
|
+
console.log('current selection', this.currentselection);
|
|
868
1006
|
} else {
|
|
869
|
-
this.currentselection.
|
|
1007
|
+
var index = this.currentselection.indexOf(timestamp);
|
|
1008
|
+
|
|
1009
|
+
if (index !== -1) {
|
|
1010
|
+
this.currentselection.splice(index, 1);
|
|
1011
|
+
} else {
|
|
1012
|
+
this.currentselection.push(timestamp);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
870
1015
|
this.currentselection.sort(function (a, b) {
|
|
871
1016
|
return a - b;
|
|
872
1017
|
});
|
|
@@ -874,10 +1019,14 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
874
1019
|
}
|
|
875
1020
|
}
|
|
876
1021
|
|
|
877
|
-
if (this.options.mode === 'date') {
|
|
1022
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
878
1023
|
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
|
|
1024
|
+
console.log('selected range', this.selectedRangeDates);
|
|
879
1025
|
} else if (this.options.mode === 'year') {
|
|
880
1026
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1027
|
+
} else if (this.options.mode === 'monthyear') {//
|
|
1028
|
+
} else if (this.options.mode === 'hour') {
|
|
1029
|
+
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
881
1030
|
} // if (this.currentselection.length === 2) {
|
|
882
1031
|
// this.currentselection = []
|
|
883
1032
|
// }
|
|
@@ -933,7 +1082,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
933
1082
|
}, {
|
|
934
1083
|
key: "setDateBounds",
|
|
935
1084
|
value: function setDateBounds(range) {
|
|
936
|
-
if (['All Dates', 'All Years'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
1085
|
+
if (['All Dates', 'All Years', 'All'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
|
|
937
1086
|
this.options.ranges[this.options.mode][0].range = [range[0], range[1] || range[0]];
|
|
938
1087
|
}
|
|
939
1088
|
|
|
@@ -943,24 +1092,38 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
943
1092
|
} else if (this.options.mode === 'year') {
|
|
944
1093
|
this.options.minAllowedYear = range[0];
|
|
945
1094
|
this.options.maxAllowedYear = range[1] || range[0];
|
|
1095
|
+
} else if (this.options.mode === 'monthyear') {
|
|
1096
|
+
this.options.minAllowedDate = range[0];
|
|
1097
|
+
this.options.maxAllowedDate = range[1] || range[0];
|
|
1098
|
+
} else if (this.options.mode === 'hour') {
|
|
1099
|
+
this.options.minAllowedHour = range[0];
|
|
1100
|
+
this.options.maxAllowedHour = range[1] || range[0];
|
|
946
1101
|
}
|
|
947
1102
|
}
|
|
948
1103
|
}, {
|
|
949
1104
|
key: "updateRange",
|
|
950
1105
|
value: function updateRange() {
|
|
951
|
-
var
|
|
1106
|
+
var _this6 = this;
|
|
952
1107
|
|
|
953
1108
|
var range;
|
|
954
1109
|
|
|
955
1110
|
if (this.selectedRange === -1) {
|
|
956
1111
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
957
|
-
if (
|
|
1112
|
+
if (_this6.options.mode === 'date') {
|
|
958
1113
|
if (!d.toLocaleDateString) {
|
|
959
1114
|
d = new Date(d);
|
|
960
1115
|
}
|
|
961
1116
|
|
|
962
1117
|
return d.toLocaleDateString();
|
|
963
|
-
} else if (
|
|
1118
|
+
} else if (_this6.options.mode === 'year') {
|
|
1119
|
+
return d;
|
|
1120
|
+
} else if (_this6.options.mode === 'monthyear') {
|
|
1121
|
+
if (!d.getMonth) {
|
|
1122
|
+
d = new Date(d);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
return "".concat(_this6.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
|
|
1126
|
+
} else if (_this6.options.mode === 'hour') {
|
|
964
1127
|
return d;
|
|
965
1128
|
}
|
|
966
1129
|
});
|
|
@@ -973,6 +1136,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
973
1136
|
start = "".concat(list.length, " selected");
|
|
974
1137
|
}
|
|
975
1138
|
|
|
1139
|
+
if (this.options.mode === 'hour') {
|
|
1140
|
+
start = this.options.hours[start].text;
|
|
1141
|
+
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
976
1144
|
range = {
|
|
977
1145
|
label: "".concat(start).concat(end)
|
|
978
1146
|
};
|
|
@@ -1009,7 +1177,7 @@ Date.prototype.floor = function () {
|
|
|
1009
1177
|
|
|
1010
1178
|
var WebsyDropdown = /*#__PURE__*/function () {
|
|
1011
1179
|
function WebsyDropdown(elementId, options) {
|
|
1012
|
-
var
|
|
1180
|
+
var _this7 = this;
|
|
1013
1181
|
|
|
1014
1182
|
_classCallCheck(this, WebsyDropdown);
|
|
1015
1183
|
|
|
@@ -1023,7 +1191,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1023
1191
|
disabled: false,
|
|
1024
1192
|
minSearchCharacters: 2,
|
|
1025
1193
|
showCompleteSelectedList: false,
|
|
1026
|
-
closeAfterSelection: true
|
|
1194
|
+
closeAfterSelection: true,
|
|
1195
|
+
customActions: []
|
|
1027
1196
|
};
|
|
1028
1197
|
this.options = _extends({}, DEFAULTS, options);
|
|
1029
1198
|
|
|
@@ -1052,12 +1221,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1052
1221
|
el.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
1053
1222
|
el.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
1054
1223
|
var headerLabel = this.selectedItems.map(function (s) {
|
|
1055
|
-
return
|
|
1224
|
+
return _this7.options.items[s].label || _this7.options.items[s].value;
|
|
1056
1225
|
}).join(this.options.multiValueDelimiter);
|
|
1057
1226
|
var headerValue = this.selectedItems.map(function (s) {
|
|
1058
|
-
return
|
|
1227
|
+
return _this7.options.items[s].value || _this7.options.items[s].label;
|
|
1059
1228
|
}).join(this.options.multiValueDelimiter);
|
|
1060
|
-
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 ");
|
|
1229
|
+
var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, " ").concat(this.options.customActions.length > 0 ? 'with-actions' : '', "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <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 ");
|
|
1061
1230
|
|
|
1062
1231
|
if (this.options.allowClear === true) {
|
|
1063
1232
|
html += "\n <svg class='clear' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n ";
|
|
@@ -1065,6 +1234,14 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1065
1234
|
|
|
1066
1235
|
html += " \n </div>\n <div id='".concat(this.elementId, "_mask' class='websy-dropdown-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-dropdown-content'>\n ");
|
|
1067
1236
|
|
|
1237
|
+
if (this.options.customActions.length > 0) {
|
|
1238
|
+
html += "\n <div class='websy-dropdown-action-container'>\n <button class='websy-dropdown-action-button'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\">><circle cx=\"256\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><circle cx=\"416\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><circle cx=\"96\" cy=\"256\" r=\"32\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </button>\n <ul id='".concat(this.elementId, "_actionContainer'>\n ");
|
|
1239
|
+
this.options.customActions.forEach(function (a, i) {
|
|
1240
|
+
html += "\n <li class='websy-dropdown-custom-action' data-index='".concat(i, "'>").concat(a.label, "</li>\n ");
|
|
1241
|
+
});
|
|
1242
|
+
html += "\n </ul>\n </div>\n ";
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1068
1245
|
if (this.options.disableSearch !== true) {
|
|
1069
1246
|
html += "\n <input id='".concat(this.elementId, "_search' class='websy-dropdown-search' placeholder='").concat(this.options.searchPlaceholder || 'Search', "'>\n ");
|
|
1070
1247
|
}
|
|
@@ -1098,6 +1275,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1098
1275
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
1099
1276
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1100
1277
|
var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
|
|
1278
|
+
var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1279
|
+
|
|
1280
|
+
if (actionEl) {
|
|
1281
|
+
actionEl.classList.remove('active');
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1101
1284
|
var el = document.getElementById(this.elementId);
|
|
1102
1285
|
|
|
1103
1286
|
if (el) {
|
|
@@ -1140,6 +1323,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1140
1323
|
} else if (event.target.classList.contains('search')) {
|
|
1141
1324
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
1142
1325
|
el.classList.toggle('search-open');
|
|
1326
|
+
} else if (event.target.classList.contains('websy-dropdown-custom-action')) {
|
|
1327
|
+
var actionIndex = +event.target.getAttribute('data-index');
|
|
1328
|
+
|
|
1329
|
+
if (this.options.customActions[actionIndex] && this.options.customActions[actionIndex].fn) {
|
|
1330
|
+
this.options.customActions[actionIndex].fn();
|
|
1331
|
+
}
|
|
1332
|
+
} else if (event.target.classList.contains('websy-dropdown-action-button')) {
|
|
1333
|
+
var _el = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1334
|
+
|
|
1335
|
+
if (_el) {
|
|
1336
|
+
_el.classList.toggle('active');
|
|
1337
|
+
}
|
|
1143
1338
|
}
|
|
1144
1339
|
}
|
|
1145
1340
|
}, {
|
|
@@ -1312,10 +1507,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1312
1507
|
}, {
|
|
1313
1508
|
key: "renderItems",
|
|
1314
1509
|
value: function renderItems() {
|
|
1315
|
-
var
|
|
1510
|
+
var _this8 = this;
|
|
1316
1511
|
|
|
1317
1512
|
var html = this.options.items.map(function (r, i) {
|
|
1318
|
-
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(
|
|
1513
|
+
return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this8.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
|
|
1319
1514
|
}).join('');
|
|
1320
1515
|
var el = document.getElementById("".concat(this.elementId, "_items"));
|
|
1321
1516
|
|
|
@@ -1334,7 +1529,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1334
1529
|
}, {
|
|
1335
1530
|
key: "updateHeader",
|
|
1336
1531
|
value: function updateHeader(item) {
|
|
1337
|
-
var
|
|
1532
|
+
var _this9 = this;
|
|
1338
1533
|
|
|
1339
1534
|
var el = document.getElementById(this.elementId);
|
|
1340
1535
|
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
@@ -1381,17 +1576,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1381
1576
|
} else if (this.selectedItems.length > 1) {
|
|
1382
1577
|
if (this.options.showCompleteSelectedList === true) {
|
|
1383
1578
|
var selectedLabels = this.selectedItems.map(function (s) {
|
|
1384
|
-
return
|
|
1579
|
+
return _this9.options.items[s].label || _this9.options.items[s].value;
|
|
1385
1580
|
}).join(this.options.multiValueDelimiter);
|
|
1386
1581
|
var selectedValues = this.selectedItems.map(function (s) {
|
|
1387
|
-
return
|
|
1582
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1388
1583
|
}).join(this.options.multiValueDelimiter);
|
|
1389
1584
|
labelEl.innerHTML = selectedLabels;
|
|
1390
1585
|
labelEl.setAttribute('data-info', selectedLabels);
|
|
1391
1586
|
inputEl.value = selectedValues;
|
|
1392
1587
|
} else {
|
|
1393
1588
|
var _selectedValues = this.selectedItems.map(function (s) {
|
|
1394
|
-
return
|
|
1589
|
+
return _this9.options.items[s].value || _this9.options.items[s].label;
|
|
1395
1590
|
}).join(this.options.multiValueDelimiter);
|
|
1396
1591
|
|
|
1397
1592
|
labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
|
|
@@ -1528,16 +1723,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1528
1723
|
}, {
|
|
1529
1724
|
key: "checkRecaptcha",
|
|
1530
1725
|
value: function checkRecaptcha() {
|
|
1531
|
-
var
|
|
1726
|
+
var _this10 = this;
|
|
1532
1727
|
|
|
1533
1728
|
return new Promise(function (resolve, reject) {
|
|
1534
|
-
if (
|
|
1729
|
+
if (_this10.options.useRecaptcha === true) {
|
|
1535
1730
|
// if (this.recaptchaValue) {
|
|
1536
1731
|
grecaptcha.ready(function () {
|
|
1537
1732
|
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
1538
1733
|
action: 'submit'
|
|
1539
1734
|
}).then(function (token) {
|
|
1540
|
-
|
|
1735
|
+
_this10.apiService.add('google/checkrecaptcha', {
|
|
1541
1736
|
grecaptcharesponse: token
|
|
1542
1737
|
}).then(function (response) {
|
|
1543
1738
|
if (response.success && response.success === true) {
|
|
@@ -1600,14 +1795,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1600
1795
|
}, {
|
|
1601
1796
|
key: "processComponents",
|
|
1602
1797
|
value: function processComponents(components, callbackFn) {
|
|
1603
|
-
var
|
|
1798
|
+
var _this11 = this;
|
|
1604
1799
|
|
|
1605
1800
|
if (components.length === 0) {
|
|
1606
1801
|
callbackFn();
|
|
1607
1802
|
} else {
|
|
1608
1803
|
components.forEach(function (c) {
|
|
1609
1804
|
if (typeof WebsyDesigns[c.component] !== 'undefined') {
|
|
1610
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
1805
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this11.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
1611
1806
|
} else {// some user feedback here
|
|
1612
1807
|
}
|
|
1613
1808
|
});
|
|
@@ -1628,7 +1823,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1628
1823
|
}, {
|
|
1629
1824
|
key: "render",
|
|
1630
1825
|
value: function render(update, data) {
|
|
1631
|
-
var
|
|
1826
|
+
var _this12 = this;
|
|
1632
1827
|
|
|
1633
1828
|
var el = document.getElementById(this.elementId);
|
|
1634
1829
|
var componentsToProcess = [];
|
|
@@ -1638,11 +1833,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1638
1833
|
this.options.fields.forEach(function (f, i) {
|
|
1639
1834
|
if (f.component) {
|
|
1640
1835
|
componentsToProcess.push(f);
|
|
1641
|
-
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(
|
|
1836
|
+
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(_this12.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
1642
1837
|
} else if (f.type === 'longtext') {
|
|
1643
|
-
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(
|
|
1838
|
+
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(_this12.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
1644
1839
|
} else {
|
|
1645
|
-
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(
|
|
1840
|
+
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(_this12.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
1646
1841
|
}
|
|
1647
1842
|
});
|
|
1648
1843
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
@@ -1659,7 +1854,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1659
1854
|
|
|
1660
1855
|
el.innerHTML = html;
|
|
1661
1856
|
this.processComponents(componentsToProcess, function () {
|
|
1662
|
-
if (
|
|
1857
|
+
if (_this12.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
|
|
1663
1858
|
}
|
|
1664
1859
|
});
|
|
1665
1860
|
}
|
|
@@ -1667,7 +1862,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1667
1862
|
}, {
|
|
1668
1863
|
key: "submitForm",
|
|
1669
1864
|
value: function submitForm() {
|
|
1670
|
-
var
|
|
1865
|
+
var _this13 = this;
|
|
1671
1866
|
|
|
1672
1867
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
1673
1868
|
|
|
@@ -1681,32 +1876,32 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1681
1876
|
data[key] = value;
|
|
1682
1877
|
});
|
|
1683
1878
|
|
|
1684
|
-
if (
|
|
1685
|
-
var
|
|
1879
|
+
if (_this13.options.url) {
|
|
1880
|
+
var _this13$apiService;
|
|
1686
1881
|
|
|
1687
|
-
var params = [
|
|
1882
|
+
var params = [_this13.options.url];
|
|
1688
1883
|
|
|
1689
|
-
if (
|
|
1690
|
-
params.push(
|
|
1884
|
+
if (_this13.options.mode === 'update') {
|
|
1885
|
+
params.push(_this13.options.id);
|
|
1691
1886
|
}
|
|
1692
1887
|
|
|
1693
1888
|
params.push(data);
|
|
1694
1889
|
|
|
1695
|
-
(
|
|
1696
|
-
if (
|
|
1890
|
+
(_this13$apiService = _this13.apiService)[_this13.options.mode].apply(_this13$apiService, params).then(function (result) {
|
|
1891
|
+
if (_this13.options.clearAfterSave === true) {
|
|
1697
1892
|
// this.render()
|
|
1698
1893
|
formEl.reset();
|
|
1699
1894
|
}
|
|
1700
1895
|
|
|
1701
|
-
|
|
1896
|
+
_this13.options.onSuccess.call(_this13, result);
|
|
1702
1897
|
}, function (err) {
|
|
1703
1898
|
console.log('Error submitting form data:', err);
|
|
1704
1899
|
|
|
1705
|
-
|
|
1900
|
+
_this13.options.onError.call(_this13, err);
|
|
1706
1901
|
});
|
|
1707
|
-
} else if (
|
|
1708
|
-
|
|
1709
|
-
if (
|
|
1902
|
+
} else if (_this13.options.submitFn) {
|
|
1903
|
+
_this13.options.submitFn(data, function () {
|
|
1904
|
+
if (_this13.options.clearAfterSave === true) {
|
|
1710
1905
|
// this.render()
|
|
1711
1906
|
formEl.reset();
|
|
1712
1907
|
}
|
|
@@ -1726,17 +1921,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1726
1921
|
}, {
|
|
1727
1922
|
key: "data",
|
|
1728
1923
|
set: function set(d) {
|
|
1729
|
-
var
|
|
1924
|
+
var _this14 = this;
|
|
1730
1925
|
|
|
1731
1926
|
if (!this.options.fields) {
|
|
1732
1927
|
this.options.fields = [];
|
|
1733
1928
|
}
|
|
1734
1929
|
|
|
1735
1930
|
var _loop = function _loop(key) {
|
|
1736
|
-
|
|
1931
|
+
_this14.options.fields.forEach(function (f) {
|
|
1737
1932
|
if (f.field === key) {
|
|
1738
1933
|
f.value = d[key];
|
|
1739
|
-
var el = document.getElementById("".concat(
|
|
1934
|
+
var el = document.getElementById("".concat(_this14.elementId, "_input_").concat(f.field));
|
|
1740
1935
|
el.value = f.value;
|
|
1741
1936
|
}
|
|
1742
1937
|
});
|
|
@@ -1752,6 +1947,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
1752
1947
|
|
|
1753
1948
|
return WebsyForm;
|
|
1754
1949
|
}();
|
|
1950
|
+
/* global include */
|
|
1951
|
+
|
|
1952
|
+
|
|
1953
|
+
var WebsyIcons = {
|
|
1954
|
+
'search-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" xml:space=\"preserve\">\n<path d=\"M481.4,468.6c-17.2-17.2-34.4-34.4-51.6-51.6c-27.4-27.4-54.8-54.8-82.2-82.2c-4.8-4.8-9.5-9.5-14.3-14.3\n\tc29.4-32.5,47.4-75.5,47.4-122.7C380.7,97,298.7,15,197.9,15S15,97,15,197.9s82,182.9,182.9,182.9c47.2,0,90.3-18,122.7-47.4\n\tc15.7,15.7,31.4,31.4,47.1,47.1c27.4,27.4,54.8,54.8,82.2,82.2c6.3,6.3,12.5,12.5,18.8,18.8C476.8,489.6,489.6,476.8,481.4,468.6z\n\t M35,197.9C35,108.1,108.1,35,197.9,35s162.9,73.1,162.9,162.9s-73.1,162.9-162.9,162.9S35,287.7,35,197.9z\"/>\n</svg>\n\n ",
|
|
1955
|
+
'bag-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<path d=\"M456.6,472.3H43.4c-5.3,0-10.2-2.1-13.7-6c-3.6-3.9-5.2-9.2-4.5-14.4l37-285.4c1.2-9,9-15.9,18.2-15.9h339.2\n\tc9.2,0,17,6.8,18.2,15.8l37,285.4c0.7,5.2-1,10.5-4.5,14.4l0,0C466.8,470.1,461.9,472.3,456.6,472.3z M46.5,451.2h407l-36.3-279.6\n\tH82.8L46.5,451.2z\"/>\n<g>\n\t<path d=\"M361.3,157.1C357.3,94.8,308.4,46,249.9,46c-28,0-54.8,11.1-75.4,31.4c-20.7,20.3-33.5,47.9-35.9,77.8l-21.5-1.6\n\t\tc2.8-34.8,17.7-67.1,42.1-91C183.9,38.3,216.1,25,249.9,25c34.2,0,66.6,13.6,91.5,38.3c24.5,24.3,39.2,57.2,41.5,92.5L361.3,157.1z\n\t\t\"/>\n</g>\n</svg>\n\n ",
|
|
1956
|
+
'user-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" style=\"enable-background:new 0 0 500 500;\" xml:space=\"preserve\">\n<g>\n\t<path d=\"M248,260.5c-62,0-112.5-52.8-112.5-117.7S186,25,248,25s112.5,52.8,112.5,117.7S310,260.5,248,260.5z M248,45.9\n\t\tc-51,0-92.5,43.4-92.5,96.8s41.5,96.8,92.5,96.8c51,0,92.5-43.4,92.5-96.8S299,45.9,248,45.9z\"/>\n</g>\n<path d=\"M45,475C45,475,45,475,45,475c0-118.3,92-214.5,205-214.5c113,0,205,96.2,205,214.5c0,0,0,0,0,0h20c0,0,0,0,0,0\n\tc0-62.9-23.4-122-65.9-166.5c-42.5-44.5-99-69-159.1-69s-116.6,24.5-159.1,69C48.4,353,25,412.1,25,475c0,0,0,0,0,0H45z\"/>\n</svg>\n\n "
|
|
1957
|
+
};
|
|
1755
1958
|
|
|
1756
1959
|
var WebsyLoadingDialog = /*#__PURE__*/function () {
|
|
1757
1960
|
function WebsyLoadingDialog(elementId, options) {
|
|
@@ -2040,7 +2243,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2040
2243
|
|
|
2041
2244
|
var Pager = /*#__PURE__*/function () {
|
|
2042
2245
|
function Pager(elementId, options) {
|
|
2043
|
-
var
|
|
2246
|
+
var _this15 = this;
|
|
2044
2247
|
|
|
2045
2248
|
_classCallCheck(this, Pager);
|
|
2046
2249
|
|
|
@@ -2093,8 +2296,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2093
2296
|
allowClear: false,
|
|
2094
2297
|
disableSearch: true,
|
|
2095
2298
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2096
|
-
if (
|
|
2097
|
-
|
|
2299
|
+
if (_this15.options.onChangePageSize) {
|
|
2300
|
+
_this15.options.onChangePageSize(selectedItem.value);
|
|
2098
2301
|
}
|
|
2099
2302
|
}
|
|
2100
2303
|
});
|
|
@@ -2118,13 +2321,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2118
2321
|
}, {
|
|
2119
2322
|
key: "render",
|
|
2120
2323
|
value: function render() {
|
|
2121
|
-
var
|
|
2324
|
+
var _this16 = this;
|
|
2122
2325
|
|
|
2123
2326
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2124
2327
|
|
|
2125
2328
|
if (el) {
|
|
2126
2329
|
var pages = this.options.pages.map(function (item, index) {
|
|
2127
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2330
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this16.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2128
2331
|
});
|
|
2129
2332
|
var startIndex = 0;
|
|
2130
2333
|
|
|
@@ -2192,58 +2395,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2192
2395
|
_createClass(WebsyPDFButton, [{
|
|
2193
2396
|
key: "handleClick",
|
|
2194
2397
|
value: function handleClick(event) {
|
|
2195
|
-
var
|
|
2398
|
+
var _this17 = this;
|
|
2196
2399
|
|
|
2197
2400
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
2198
2401
|
this.loader.show();
|
|
2199
2402
|
setTimeout(function () {
|
|
2200
|
-
if (
|
|
2201
|
-
var el = document.getElementById(
|
|
2403
|
+
if (_this17.options.targetId) {
|
|
2404
|
+
var el = document.getElementById(_this17.options.targetId);
|
|
2202
2405
|
|
|
2203
2406
|
if (el) {
|
|
2204
2407
|
var pdfData = {
|
|
2205
2408
|
options: {}
|
|
2206
2409
|
};
|
|
2207
2410
|
|
|
2208
|
-
if (
|
|
2209
|
-
pdfData.options = _extends({},
|
|
2411
|
+
if (_this17.options.pdfOptions) {
|
|
2412
|
+
pdfData.options = _extends({}, _this17.options.pdfOptions);
|
|
2210
2413
|
}
|
|
2211
2414
|
|
|
2212
|
-
if (
|
|
2213
|
-
if (
|
|
2214
|
-
var headerEl = document.getElementById(
|
|
2415
|
+
if (_this17.options.header) {
|
|
2416
|
+
if (_this17.options.header.elementId) {
|
|
2417
|
+
var headerEl = document.getElementById(_this17.options.header.elementId);
|
|
2215
2418
|
|
|
2216
2419
|
if (headerEl) {
|
|
2217
2420
|
pdfData.header = headerEl.outerHTML;
|
|
2218
2421
|
|
|
2219
|
-
if (
|
|
2220
|
-
pdfData.options.headerCSS =
|
|
2422
|
+
if (_this17.options.header.css) {
|
|
2423
|
+
pdfData.options.headerCSS = _this17.options.header.css;
|
|
2221
2424
|
}
|
|
2222
2425
|
}
|
|
2223
|
-
} else if (
|
|
2224
|
-
pdfData.header =
|
|
2426
|
+
} else if (_this17.options.header.html) {
|
|
2427
|
+
pdfData.header = _this17.options.header.html;
|
|
2225
2428
|
|
|
2226
|
-
if (
|
|
2227
|
-
pdfData.options.headerCSS =
|
|
2429
|
+
if (_this17.options.header.css) {
|
|
2430
|
+
pdfData.options.headerCSS = _this17.options.header.css;
|
|
2228
2431
|
}
|
|
2229
2432
|
} else {
|
|
2230
|
-
pdfData.header =
|
|
2433
|
+
pdfData.header = _this17.options.header;
|
|
2231
2434
|
}
|
|
2232
2435
|
}
|
|
2233
2436
|
|
|
2234
|
-
if (
|
|
2235
|
-
if (
|
|
2236
|
-
var footerEl = document.getElementById(
|
|
2437
|
+
if (_this17.options.footer) {
|
|
2438
|
+
if (_this17.options.footer.elementId) {
|
|
2439
|
+
var footerEl = document.getElementById(_this17.options.footer.elementId);
|
|
2237
2440
|
|
|
2238
2441
|
if (footerEl) {
|
|
2239
2442
|
pdfData.footer = footerEl.outerHTML;
|
|
2240
2443
|
|
|
2241
|
-
if (
|
|
2242
|
-
pdfData.options.footerCSS =
|
|
2444
|
+
if (_this17.options.footer.css) {
|
|
2445
|
+
pdfData.options.footerCSS = _this17.options.footer.css;
|
|
2243
2446
|
}
|
|
2244
2447
|
}
|
|
2245
2448
|
} else {
|
|
2246
|
-
pdfData.footer =
|
|
2449
|
+
pdfData.footer = _this17.options.footer;
|
|
2247
2450
|
}
|
|
2248
2451
|
}
|
|
2249
2452
|
|
|
@@ -2252,31 +2455,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
2252
2455
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
2253
2456
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
2254
2457
|
|
|
2255
|
-
|
|
2458
|
+
_this17.service.add('', pdfData, {
|
|
2256
2459
|
responseType: 'blob'
|
|
2257
2460
|
}).then(function (response) {
|
|
2258
|
-
|
|
2461
|
+
_this17.loader.hide();
|
|
2259
2462
|
|
|
2260
2463
|
var blob = new Blob([response], {
|
|
2261
2464
|
type: 'application/pdf'
|
|
2262
2465
|
});
|
|
2263
2466
|
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 ");
|
|
2264
2467
|
|
|
2265
|
-
if (
|
|
2468
|
+
if (_this17.options.directDownload === true) {
|
|
2266
2469
|
var fileName;
|
|
2267
2470
|
|
|
2268
|
-
if (typeof
|
|
2269
|
-
fileName =
|
|
2471
|
+
if (typeof _this17.options.fileName === 'function') {
|
|
2472
|
+
fileName = _this17.options.fileName() || 'Export';
|
|
2270
2473
|
} else {
|
|
2271
|
-
fileName =
|
|
2474
|
+
fileName = _this17.options.fileName || 'Export';
|
|
2272
2475
|
}
|
|
2273
2476
|
|
|
2274
2477
|
msg += "download='".concat(fileName, ".pdf'");
|
|
2275
2478
|
}
|
|
2276
2479
|
|
|
2277
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
2480
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this17.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2278
2481
|
|
|
2279
|
-
|
|
2482
|
+
_this17.popup.show({
|
|
2280
2483
|
message: msg,
|
|
2281
2484
|
mask: true
|
|
2282
2485
|
});
|
|
@@ -2458,12 +2661,242 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
2458
2661
|
|
|
2459
2662
|
return WebsyPubSub;
|
|
2460
2663
|
}();
|
|
2664
|
+
|
|
2665
|
+
var ResponsiveText = /*#__PURE__*/function () {
|
|
2666
|
+
function ResponsiveText(elementId, options) {
|
|
2667
|
+
var _this18 = this;
|
|
2668
|
+
|
|
2669
|
+
_classCallCheck(this, ResponsiveText);
|
|
2670
|
+
|
|
2671
|
+
var DEFAULTS = {
|
|
2672
|
+
textAlign: 'center',
|
|
2673
|
+
verticalAlign: 'flex-end',
|
|
2674
|
+
wrapText: false
|
|
2675
|
+
};
|
|
2676
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
2677
|
+
this.elementId = elementId;
|
|
2678
|
+
this.canvas = document.createElement('canvas');
|
|
2679
|
+
window.addEventListener('resize', function () {
|
|
2680
|
+
return _this18.render();
|
|
2681
|
+
});
|
|
2682
|
+
var el = document.getElementById(this.elementId);
|
|
2683
|
+
|
|
2684
|
+
if (el) {
|
|
2685
|
+
this.render();
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
_createClass(ResponsiveText, [{
|
|
2690
|
+
key: "css",
|
|
2691
|
+
value: function css(element, property) {
|
|
2692
|
+
return window.getComputedStyle(element, null).getPropertyValue(property);
|
|
2693
|
+
}
|
|
2694
|
+
}, {
|
|
2695
|
+
key: "render",
|
|
2696
|
+
value: function render(text) {
|
|
2697
|
+
if (typeof text !== 'undefined') {
|
|
2698
|
+
this.options.text = text;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
if (this.options.text) {
|
|
2702
|
+
var wrappingRequired = false;
|
|
2703
|
+
var el = document.getElementById(this.elementId);
|
|
2704
|
+
var cx = this.canvas.getContext('2d');
|
|
2705
|
+
var f = 0;
|
|
2706
|
+
var fits = false; // let el = document.getElementById(`${layout.qInfo.qId}_responsiveInner`)
|
|
2707
|
+
|
|
2708
|
+
var height = el.clientHeight;
|
|
2709
|
+
|
|
2710
|
+
if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('%') !== -1) {
|
|
2711
|
+
var p = +this.options.maxHeight.replace('%', '');
|
|
2712
|
+
|
|
2713
|
+
if (!isNaN(p)) {
|
|
2714
|
+
this.options.maxHeight = Math.floor(height * (p / 100));
|
|
2715
|
+
}
|
|
2716
|
+
} else if (typeof this.options.maxHeight === 'string' && this.options.maxHeight.indexOf('px') !== -1) {
|
|
2717
|
+
this.options.maxHeight = +this.options.maxHeight.replace('px', '');
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('%') !== -1) {
|
|
2721
|
+
var _p = +this.options.minHeight.replace('%', '');
|
|
2722
|
+
|
|
2723
|
+
if (!isNaN(_p)) {
|
|
2724
|
+
this.options.minHeight = Math.floor(height * (_p / 100));
|
|
2725
|
+
}
|
|
2726
|
+
} else if (typeof this.options.minHeight === 'string' && this.options.minHeight.indexOf('px') !== -1) {
|
|
2727
|
+
this.options.minHeight = +this.options.minHeight.replace('px', '');
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
var fontFamily = this.css(el, 'font-family');
|
|
2731
|
+
var fontWeight = this.css(el, 'font-weight');
|
|
2732
|
+
var allowedWidth = el.clientWidth;
|
|
2733
|
+
|
|
2734
|
+
if (allowedWidth === 0) {
|
|
2735
|
+
// check for a max-width property
|
|
2736
|
+
if (el.style.maxWidth && el.style.maxWidth !== 'auto') {
|
|
2737
|
+
if (el.parentElement.clientWidth > 0) {
|
|
2738
|
+
var calc = el.style.maxWidth;
|
|
2739
|
+
|
|
2740
|
+
if (calc.indexOf('calc') !== -1) {
|
|
2741
|
+
// this logic currently only handles calc statements using % and px
|
|
2742
|
+
// and only + or - formulas
|
|
2743
|
+
calc = calc.replace('calc(', '').replace(')', '');
|
|
2744
|
+
calc = calc.split(' ');
|
|
2745
|
+
|
|
2746
|
+
if (calc[0].indexOf('px') !== -1) {
|
|
2747
|
+
allowedWidth = calc[0].replace('px', '');
|
|
2748
|
+
} else if (calc[0].indexOf('%') !== -1) {
|
|
2749
|
+
allowedWidth = el.parentElement.clientWidth * (+calc[0].replace('%', '') / 100);
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
if (calc[2] && calc[4]) {
|
|
2753
|
+
// this means we have an operator and a second value
|
|
2754
|
+
// handle -
|
|
2755
|
+
if (calc[2] === '-') {
|
|
2756
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
2757
|
+
allowedWidth -= +calc[4].replace('px', '');
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
if (calc[2] === '+') {
|
|
2762
|
+
if (calc[4].indexOf('px') !== -1) {
|
|
2763
|
+
allowedWidth += +calc[4].replace('px', '');
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
} else if (calc.indexOf('px') !== -1) {
|
|
2768
|
+
allowedWidth = +calc.replace('px', '');
|
|
2769
|
+
} else if (calc.indexOf('%') !== -1) {
|
|
2770
|
+
allowedWidth = el.parentElement.clientWidth * (+calc.replace('%', '') / 100);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
} // console.log('max height', this.options.maxHeight);
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
var innerElHeight = el.clientHeight;
|
|
2778
|
+
|
|
2779
|
+
while (fits === false) {
|
|
2780
|
+
f++;
|
|
2781
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
2782
|
+
var measurements = cx.measureText(this.options.text); // add support for safari where some elements end up with zero height
|
|
2783
|
+
|
|
2784
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
2785
|
+
// get the closest parent that has a height
|
|
2786
|
+
var heightFound = false;
|
|
2787
|
+
var currEl = el;
|
|
2788
|
+
|
|
2789
|
+
while (heightFound === false) {
|
|
2790
|
+
if (currEl.clientHeight > 0) {
|
|
2791
|
+
innerElHeight = currEl.clientHeight;
|
|
2792
|
+
heightFound = true;
|
|
2793
|
+
} else if (currEl.parentNode) {
|
|
2794
|
+
currEl = currEl.parentNode;
|
|
2795
|
+
} else {
|
|
2796
|
+
// prevent the loop from running indefinitely
|
|
2797
|
+
heightFound = true;
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
2803
|
+
f = this.options.maxHeight;
|
|
2804
|
+
height = measurements.actualBoundingBoxAscent;
|
|
2805
|
+
fits = true;
|
|
2806
|
+
} else if (measurements.width > allowedWidth || measurements.actualBoundingBoxAscent >= innerElHeight) {
|
|
2807
|
+
f--;
|
|
2808
|
+
height = measurements.actualBoundingBoxAscent;
|
|
2809
|
+
fits = true;
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
if (this.options.minHeight === '') {
|
|
2814
|
+
this.options.minHeight = undefined;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
if (typeof this.options.minHeight !== 'undefined') {
|
|
2818
|
+
if (this.options.minHeight > f && this.options.wrapText === true) {
|
|
2819
|
+
// we run the process again but this time separating the words onto separate lines
|
|
2820
|
+
// this currently only supports wrapping onto 2 lines
|
|
2821
|
+
wrappingRequired = true;
|
|
2822
|
+
fits = false;
|
|
2823
|
+
f = this.options.minHeight;
|
|
2824
|
+
var spaceCount = this.options.text.match(/ /g);
|
|
2825
|
+
|
|
2826
|
+
if (spaceCount && spaceCount.length > 0) {
|
|
2827
|
+
spaceCount = spaceCount.length;
|
|
2828
|
+
var words = this.options.text.split(' ');
|
|
2829
|
+
|
|
2830
|
+
while (fits === false) {
|
|
2831
|
+
f++;
|
|
2832
|
+
cx.font = "".concat(fontWeight, " ").concat(f, "px ").concat(fontFamily);
|
|
2833
|
+
|
|
2834
|
+
for (var i = spaceCount; i > 0; i--) {
|
|
2835
|
+
var fitsCount = 0;
|
|
2836
|
+
var lines = [words.slice(0, i).join(' '), words.slice(i, words.length).join(' ')];
|
|
2837
|
+
var longestLine = lines.reduce(function (a, b) {
|
|
2838
|
+
return a.length > b.length ? a : b;
|
|
2839
|
+
}, ''); // lines.forEach(l => {
|
|
2840
|
+
|
|
2841
|
+
var _measurements = cx.measureText(longestLine); // add support for safari where some elements end up with zero height
|
|
2842
|
+
|
|
2843
|
+
|
|
2844
|
+
if (navigator.userAgent.indexOf('Safari') !== -1) {
|
|
2845
|
+
// get the closest parent that has a height
|
|
2846
|
+
var _heightFound = false;
|
|
2847
|
+
var _currEl = el;
|
|
2848
|
+
|
|
2849
|
+
while (_heightFound === false) {
|
|
2850
|
+
if (_currEl.clientHeight > 0) {
|
|
2851
|
+
innerElHeight = _currEl.clientHeight;
|
|
2852
|
+
_heightFound = true;
|
|
2853
|
+
} else if (_currEl.parentNode) {
|
|
2854
|
+
_currEl = _currEl.parentNode;
|
|
2855
|
+
} else {
|
|
2856
|
+
// prevent the loop from running indefinitely
|
|
2857
|
+
_heightFound = true;
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
if (typeof this.options.maxHeight !== 'undefined' && f === this.options.maxHeight) {
|
|
2863
|
+
f = this.options.maxHeight;
|
|
2864
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
2865
|
+
fits = true;
|
|
2866
|
+
break;
|
|
2867
|
+
} else if (_measurements.width > allowedWidth || _measurements.actualBoundingBoxAscent >= innerElHeight / 2 * 0.75) {
|
|
2868
|
+
f--;
|
|
2869
|
+
height = _measurements.actualBoundingBoxAscent;
|
|
2870
|
+
fits = true;
|
|
2871
|
+
break;
|
|
2872
|
+
} // })
|
|
2873
|
+
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
if (typeof this.options.minHeight !== 'undefined' && this.options.minHeight > f) {
|
|
2879
|
+
f = this.options.minHeight;
|
|
2880
|
+
}
|
|
2881
|
+
} else if (this.options.minHeight > f) {
|
|
2882
|
+
f = this.options.minHeight;
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
var spanHeight = Math.min(innerElHeight, height);
|
|
2887
|
+
el.innerHTML = "\n <div \n class='websy-responsive-text' \n style='\n justify-content: ".concat(this.options.verticalAlign, ";\n font-size: ").concat(f, "px;\n font-weight: ").concat(fontWeight || 'normal', ";\n '\n > \n <span\n style='\n white-space: ").concat(this.options.wrapText === true ? 'normal' : 'nowrap', ";\n height: ").concat(Math.floor(wrappingRequired === true ? spanHeight * (1 * 1 / 3) * 2 : spanHeight), "px;\n line-height: ").concat(Math.ceil(wrappingRequired === true ? f * 1.2 : spanHeight), "px;\n justify-content: ").concat(this.options.textAlign, ";\n text-align: ").concat(this.options.textAlign, ";\n '\n >").concat(this.options.text, "</span>\n </div>\n ");
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}]);
|
|
2891
|
+
|
|
2892
|
+
return ResponsiveText;
|
|
2893
|
+
}();
|
|
2461
2894
|
/* global WebsyDesigns */
|
|
2462
2895
|
|
|
2463
2896
|
|
|
2464
2897
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
2465
2898
|
function WebsyResultList(elementId, options) {
|
|
2466
|
-
var
|
|
2899
|
+
var _this19 = this;
|
|
2467
2900
|
|
|
2468
2901
|
_classCallCheck(this, WebsyResultList);
|
|
2469
2902
|
|
|
@@ -2491,9 +2924,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2491
2924
|
|
|
2492
2925
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
2493
2926
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
2494
|
-
|
|
2927
|
+
_this19.options.template = templateString;
|
|
2495
2928
|
|
|
2496
|
-
|
|
2929
|
+
_this19.render();
|
|
2497
2930
|
});
|
|
2498
2931
|
} else {
|
|
2499
2932
|
this.render();
|
|
@@ -2512,7 +2945,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2512
2945
|
}, {
|
|
2513
2946
|
key: "buildHTML",
|
|
2514
2947
|
value: function buildHTML(d) {
|
|
2515
|
-
var
|
|
2948
|
+
var _this20 = this;
|
|
2516
2949
|
|
|
2517
2950
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2518
2951
|
var html = "";
|
|
@@ -2520,7 +2953,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2520
2953
|
if (this.options.template) {
|
|
2521
2954
|
if (d.length > 0) {
|
|
2522
2955
|
d.forEach(function (row, ix) {
|
|
2523
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(
|
|
2956
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(_this20.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
2524
2957
|
|
|
2525
2958
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
2526
2959
|
|
|
@@ -2640,7 +3073,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2640
3073
|
}, {
|
|
2641
3074
|
key: "handleClick",
|
|
2642
3075
|
value: function handleClick(event) {
|
|
2643
|
-
var
|
|
3076
|
+
var _this21 = this;
|
|
2644
3077
|
|
|
2645
3078
|
if (event.target.classList.contains('clickable')) {
|
|
2646
3079
|
var l = event.target.getAttribute('data-event');
|
|
@@ -2658,8 +3091,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2658
3091
|
l = l[0];
|
|
2659
3092
|
params = params.map(function (p) {
|
|
2660
3093
|
if (typeof p !== 'string' && typeof p !== 'number') {
|
|
2661
|
-
if (
|
|
2662
|
-
p =
|
|
3094
|
+
if (_this21.rows[+id]) {
|
|
3095
|
+
p = _this21.rows[+id][p];
|
|
2663
3096
|
}
|
|
2664
3097
|
} else if (typeof p === 'string') {
|
|
2665
3098
|
p = p.replace(/"/g, '').replace(/'/g, '');
|
|
@@ -2681,13 +3114,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
2681
3114
|
}, {
|
|
2682
3115
|
key: "render",
|
|
2683
3116
|
value: function render() {
|
|
2684
|
-
var
|
|
3117
|
+
var _this22 = this;
|
|
2685
3118
|
|
|
2686
3119
|
if (this.options.entity) {
|
|
2687
3120
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
2688
|
-
|
|
3121
|
+
_this22.rows = results.rows;
|
|
2689
3122
|
|
|
2690
|
-
|
|
3123
|
+
_this22.resize();
|
|
2691
3124
|
});
|
|
2692
3125
|
} else {
|
|
2693
3126
|
this.resize();
|
|
@@ -2766,14 +3199,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
2766
3199
|
_createClass(WebsyRouter, [{
|
|
2767
3200
|
key: "addGroup",
|
|
2768
3201
|
value: function addGroup(group) {
|
|
2769
|
-
var
|
|
3202
|
+
var _this23 = this;
|
|
2770
3203
|
|
|
2771
3204
|
if (!this.groups[group]) {
|
|
2772
3205
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
2773
3206
|
|
|
2774
3207
|
if (els) {
|
|
2775
3208
|
this.getClosestParent(els[0], function (parent) {
|
|
2776
|
-
|
|
3209
|
+
_this23.groups[group] = {
|
|
2777
3210
|
activeView: '',
|
|
2778
3211
|
views: [],
|
|
2779
3212
|
parent: parent.getAttribute('data-view')
|
|
@@ -3098,12 +3531,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3098
3531
|
}, {
|
|
3099
3532
|
key: "showComponents",
|
|
3100
3533
|
value: function showComponents(view) {
|
|
3101
|
-
var
|
|
3534
|
+
var _this24 = this;
|
|
3102
3535
|
|
|
3103
3536
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
3104
3537
|
this.options.views[view].components.forEach(function (c) {
|
|
3105
3538
|
if (typeof c.instance === 'undefined') {
|
|
3106
|
-
|
|
3539
|
+
_this24.prepComponent(c.elementId, c.options);
|
|
3107
3540
|
|
|
3108
3541
|
c.instance = new c.Component(c.elementId, c.options);
|
|
3109
3542
|
} else if (c.instance.render) {
|
|
@@ -3472,7 +3905,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3472
3905
|
|
|
3473
3906
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
3474
3907
|
function WebsyTemplate(elementId, options) {
|
|
3475
|
-
var
|
|
3908
|
+
var _this25 = this;
|
|
3476
3909
|
|
|
3477
3910
|
_classCallCheck(this, WebsyTemplate);
|
|
3478
3911
|
|
|
@@ -3498,9 +3931,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3498
3931
|
|
|
3499
3932
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3500
3933
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3501
|
-
|
|
3934
|
+
_this25.options.template = templateString;
|
|
3502
3935
|
|
|
3503
|
-
|
|
3936
|
+
_this25.render();
|
|
3504
3937
|
});
|
|
3505
3938
|
} else {
|
|
3506
3939
|
this.render();
|
|
@@ -3510,7 +3943,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3510
3943
|
_createClass(WebsyTemplate, [{
|
|
3511
3944
|
key: "buildHTML",
|
|
3512
3945
|
value: function buildHTML() {
|
|
3513
|
-
var
|
|
3946
|
+
var _this26 = this;
|
|
3514
3947
|
|
|
3515
3948
|
var html = "";
|
|
3516
3949
|
|
|
@@ -3572,14 +4005,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
3572
4005
|
}
|
|
3573
4006
|
|
|
3574
4007
|
if (polarity === true) {
|
|
3575
|
-
if (typeof
|
|
4008
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] === parts[1]) {
|
|
3576
4009
|
// remove the <if> tags
|
|
3577
4010
|
removeAll = false;
|
|
3578
4011
|
} else if (parts[0] === parts[1]) {
|
|
3579
4012
|
removeAll = false;
|
|
3580
4013
|
}
|
|
3581
4014
|
} else if (polarity === false) {
|
|
3582
|
-
if (typeof
|
|
4015
|
+
if (typeof _this26.options.data[parts[0]] !== 'undefined' && _this26.options.data[parts[0]] !== parts[1]) {
|
|
3583
4016
|
// remove the <if> tags
|
|
3584
4017
|
removeAll = false;
|
|
3585
4018
|
}
|
|
@@ -3825,10 +4258,10 @@ var WebsyUtils = {
|
|
|
3825
4258
|
var s = '';
|
|
3826
4259
|
var d = 1; // let out
|
|
3827
4260
|
|
|
3828
|
-
for (var
|
|
3829
|
-
if (n >= ranges[
|
|
3830
|
-
d = ranges[
|
|
3831
|
-
s = ranges[
|
|
4261
|
+
for (var _i8 = 0; _i8 < ranges.length; _i8++) {
|
|
4262
|
+
if (n >= ranges[_i8].divider) {
|
|
4263
|
+
d = ranges[_i8].divider;
|
|
4264
|
+
s = ranges[_i8].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
|
|
3832
4265
|
|
|
3833
4266
|
break;
|
|
3834
4267
|
}
|
|
@@ -3866,7 +4299,7 @@ var WebsyUtils = {
|
|
|
3866
4299
|
|
|
3867
4300
|
var WebsyTable = /*#__PURE__*/function () {
|
|
3868
4301
|
function WebsyTable(elementId, options) {
|
|
3869
|
-
var
|
|
4302
|
+
var _this27 = this;
|
|
3870
4303
|
|
|
3871
4304
|
_classCallCheck(this, WebsyTable);
|
|
3872
4305
|
|
|
@@ -3904,8 +4337,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3904
4337
|
allowClear: false,
|
|
3905
4338
|
disableSearch: true,
|
|
3906
4339
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3907
|
-
if (
|
|
3908
|
-
|
|
4340
|
+
if (_this27.options.onChangePageSize) {
|
|
4341
|
+
_this27.options.onChangePageSize(selectedItem.value);
|
|
3909
4342
|
}
|
|
3910
4343
|
}
|
|
3911
4344
|
});
|
|
@@ -3926,7 +4359,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3926
4359
|
_createClass(WebsyTable, [{
|
|
3927
4360
|
key: "appendRows",
|
|
3928
4361
|
value: function appendRows(data) {
|
|
3929
|
-
var
|
|
4362
|
+
var _this28 = this;
|
|
3930
4363
|
|
|
3931
4364
|
this.hideError();
|
|
3932
4365
|
var bodyHTML = '';
|
|
@@ -3934,15 +4367,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3934
4367
|
if (data) {
|
|
3935
4368
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
3936
4369
|
return '<tr>' + r.map(function (c, i) {
|
|
3937
|
-
if (
|
|
4370
|
+
if (_this28.options.columns[i].show !== false) {
|
|
3938
4371
|
var style = '';
|
|
3939
4372
|
|
|
3940
4373
|
if (c.style) {
|
|
3941
4374
|
style += c.style;
|
|
3942
4375
|
}
|
|
3943
4376
|
|
|
3944
|
-
if (
|
|
3945
|
-
style += "width: ".concat(
|
|
4377
|
+
if (_this28.options.columns[i].width) {
|
|
4378
|
+
style += "width: ".concat(_this28.options.columns[i].width, "; ");
|
|
3946
4379
|
}
|
|
3947
4380
|
|
|
3948
4381
|
if (c.backgroundColor) {
|
|
@@ -3957,18 +4390,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
3957
4390
|
style += "color: ".concat(c.color, "; ");
|
|
3958
4391
|
}
|
|
3959
4392
|
|
|
3960
|
-
if (
|
|
3961
|
-
return "\n <td \n data-row-index='".concat(
|
|
3962
|
-
} else if ((
|
|
3963
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4393
|
+
if (_this28.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4394
|
+
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 ");
|
|
4395
|
+
} else if ((_this28.options.columns[i].showAsNavigatorLink === true || _this28.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4396
|
+
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='websy-trigger 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 ");
|
|
3964
4397
|
} else {
|
|
3965
4398
|
var info = c.value;
|
|
3966
4399
|
|
|
3967
|
-
if (
|
|
4400
|
+
if (_this28.options.columns[i].showAsImage === true) {
|
|
3968
4401
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
3969
4402
|
}
|
|
3970
4403
|
|
|
3971
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4404
|
+
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 ");
|
|
3972
4405
|
}
|
|
3973
4406
|
}
|
|
3974
4407
|
}).join('') + '</tr>';
|
|
@@ -4140,7 +4573,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4140
4573
|
}, {
|
|
4141
4574
|
key: "render",
|
|
4142
4575
|
value: function render(data) {
|
|
4143
|
-
var
|
|
4576
|
+
var _this29 = this;
|
|
4144
4577
|
|
|
4145
4578
|
if (!this.options.columns) {
|
|
4146
4579
|
return;
|
|
@@ -4165,7 +4598,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4165
4598
|
|
|
4166
4599
|
var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
|
|
4167
4600
|
if (c.show !== false) {
|
|
4168
|
-
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 ?
|
|
4601
|
+
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 ");
|
|
4169
4602
|
}
|
|
4170
4603
|
}).join('') + '</tr>';
|
|
4171
4604
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4184,7 +4617,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4184
4617
|
|
|
4185
4618
|
if (pagingEl) {
|
|
4186
4619
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4187
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
4620
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this29.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4188
4621
|
});
|
|
4189
4622
|
var startIndex = 0;
|
|
4190
4623
|
|
|
@@ -4252,7 +4685,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4252
4685
|
|
|
4253
4686
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
4254
4687
|
function WebsyTable2(elementId, options) {
|
|
4255
|
-
var
|
|
4688
|
+
var _this30 = this;
|
|
4256
4689
|
|
|
4257
4690
|
_classCallCheck(this, WebsyTable2);
|
|
4258
4691
|
|
|
@@ -4293,8 +4726,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4293
4726
|
allowClear: false,
|
|
4294
4727
|
disableSearch: true,
|
|
4295
4728
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4296
|
-
if (
|
|
4297
|
-
|
|
4729
|
+
if (_this30.options.onChangePageSize) {
|
|
4730
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
4298
4731
|
}
|
|
4299
4732
|
}
|
|
4300
4733
|
});
|
|
@@ -4318,7 +4751,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4318
4751
|
_createClass(WebsyTable2, [{
|
|
4319
4752
|
key: "appendRows",
|
|
4320
4753
|
value: function appendRows(data) {
|
|
4321
|
-
var
|
|
4754
|
+
var _this31 = this;
|
|
4322
4755
|
|
|
4323
4756
|
this.hideError();
|
|
4324
4757
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -4327,15 +4760,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4327
4760
|
if (data) {
|
|
4328
4761
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4329
4762
|
return '<tr>' + r.map(function (c, i) {
|
|
4330
|
-
if (
|
|
4331
|
-
var style = "height: ".concat(
|
|
4763
|
+
if (_this31.options.columns[i].show !== false) {
|
|
4764
|
+
var style = "height: ".concat(_this31.options.cellSize, "px; line-height: ").concat(_this31.options.cellSize, "px;");
|
|
4332
4765
|
|
|
4333
4766
|
if (c.style) {
|
|
4334
4767
|
style += c.style;
|
|
4335
4768
|
}
|
|
4336
4769
|
|
|
4337
|
-
if (
|
|
4338
|
-
style += "width: ".concat(
|
|
4770
|
+
if (_this31.options.columns[i].width) {
|
|
4771
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
4339
4772
|
}
|
|
4340
4773
|
|
|
4341
4774
|
if (c.backgroundColor) {
|
|
@@ -4350,18 +4783,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4350
4783
|
style += "color: ".concat(c.color, "; ");
|
|
4351
4784
|
}
|
|
4352
4785
|
|
|
4353
|
-
if (
|
|
4354
|
-
return "\n <td \n data-row-index='".concat(
|
|
4355
|
-
} else if ((
|
|
4356
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
4786
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
4787
|
+
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 ");
|
|
4788
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
4789
|
+
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='websy-trigger 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 ");
|
|
4357
4790
|
} else {
|
|
4358
4791
|
var info = c.value;
|
|
4359
4792
|
|
|
4360
|
-
if (
|
|
4793
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
4361
4794
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4362
4795
|
}
|
|
4363
4796
|
|
|
4364
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
4797
|
+
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 ");
|
|
4365
4798
|
}
|
|
4366
4799
|
}
|
|
4367
4800
|
}).join('') + '</tr>';
|
|
@@ -4486,7 +4919,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4486
4919
|
value: function handleGlobalMouseUp(event) {
|
|
4487
4920
|
this.scrolling = false;
|
|
4488
4921
|
var el = document.getElementById(this.elementId);
|
|
4489
|
-
|
|
4922
|
+
|
|
4923
|
+
if (el) {
|
|
4924
|
+
el.classList.remove('scrolling');
|
|
4925
|
+
}
|
|
4490
4926
|
}
|
|
4491
4927
|
}, {
|
|
4492
4928
|
key: "handleMouseUp",
|
|
@@ -4616,7 +5052,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4616
5052
|
}, {
|
|
4617
5053
|
key: "render",
|
|
4618
5054
|
value: function render(data) {
|
|
4619
|
-
var
|
|
5055
|
+
var _this32 = this;
|
|
4620
5056
|
|
|
4621
5057
|
if (!this.options.columns) {
|
|
4622
5058
|
return;
|
|
@@ -4652,7 +5088,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4652
5088
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
4653
5089
|
}
|
|
4654
5090
|
|
|
4655
|
-
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 ?
|
|
5091
|
+
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 ? _this32.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
4656
5092
|
}
|
|
4657
5093
|
}).join('') + '</tr>';
|
|
4658
5094
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -4663,7 +5099,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4663
5099
|
var dropdownHTML = "";
|
|
4664
5100
|
this.options.columns.forEach(function (c, i) {
|
|
4665
5101
|
if (c.searchable && c.searchField) {
|
|
4666
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5102
|
+
dropdownHTML += "\n <div id=\"".concat(_this32.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
4667
5103
|
}
|
|
4668
5104
|
});
|
|
4669
5105
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -4685,7 +5121,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4685
5121
|
|
|
4686
5122
|
if (pagingEl) {
|
|
4687
5123
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
4688
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5124
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
4689
5125
|
});
|
|
4690
5126
|
var startIndex = 0;
|
|
4691
5127
|
|
|
@@ -4772,7 +5208,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4772
5208
|
}, {
|
|
4773
5209
|
key: "getColumnParameters",
|
|
4774
5210
|
value: function getColumnParameters(values) {
|
|
4775
|
-
var
|
|
5211
|
+
var _this33 = this;
|
|
4776
5212
|
|
|
4777
5213
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
4778
5214
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -4780,10 +5216,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4780
5216
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
4781
5217
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
4782
5218
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
4783
|
-
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 ?
|
|
5219
|
+
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 ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
4784
5220
|
}).join('') + '</tr>';
|
|
4785
5221
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
4786
|
-
return "\n <td \n style='height: ".concat(
|
|
5222
|
+
return "\n <td \n style='height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
4787
5223
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
4788
5224
|
|
|
4789
5225
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -4804,8 +5240,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4804
5240
|
|
|
4805
5241
|
|
|
4806
5242
|
if (accWidth < (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) {
|
|
4807
|
-
for (var
|
|
4808
|
-
cellWidths[
|
|
5243
|
+
for (var _i9 = this.options.leftColumns; _i9 < cellWidths.length; _i9++) {
|
|
5244
|
+
cellWidths[_i9] = ((tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth) / (cellWidths.length - this.options.leftColumns);
|
|
4809
5245
|
}
|
|
4810
5246
|
} // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
|
|
4811
5247
|
// tableEl.style.width = ''
|
|
@@ -4833,7 +5269,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
4833
5269
|
|
|
4834
5270
|
var WebsyChart = /*#__PURE__*/function () {
|
|
4835
5271
|
function WebsyChart(elementId, options) {
|
|
4836
|
-
var
|
|
5272
|
+
var _this34 = this;
|
|
4837
5273
|
|
|
4838
5274
|
_classCallCheck(this, WebsyChart);
|
|
4839
5275
|
|
|
@@ -4882,22 +5318,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4882
5318
|
this.invertOverride = function (input, input2) {
|
|
4883
5319
|
var xAxis = 'bottomAxis';
|
|
4884
5320
|
|
|
4885
|
-
if (
|
|
5321
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
4886
5322
|
xAxis = 'leftAxis';
|
|
4887
5323
|
}
|
|
4888
5324
|
|
|
4889
|
-
var width =
|
|
5325
|
+
var width = _this34[xAxis].step();
|
|
4890
5326
|
|
|
4891
5327
|
var output;
|
|
4892
5328
|
|
|
4893
|
-
var domain = _toConsumableArray(
|
|
5329
|
+
var domain = _toConsumableArray(_this34[xAxis].domain());
|
|
4894
5330
|
|
|
4895
|
-
if (
|
|
5331
|
+
if (_this34.options.orientation === 'horizontal') {
|
|
4896
5332
|
domain = domain.reverse();
|
|
4897
5333
|
}
|
|
4898
5334
|
|
|
4899
5335
|
for (var j = 0; j < domain.length; j++) {
|
|
4900
|
-
var breakA =
|
|
5336
|
+
var breakA = _this34[xAxis](domain[j]) - width / 2;
|
|
4901
5337
|
var breakB = breakA + width;
|
|
4902
5338
|
|
|
4903
5339
|
if (input > breakA && input <= breakB) {
|
|
@@ -4997,10 +5433,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
4997
5433
|
}, {
|
|
4998
5434
|
key: "handleEventMouseMove",
|
|
4999
5435
|
value: function handleEventMouseMove(event, d) {
|
|
5000
|
-
var
|
|
5436
|
+
var _this35 = this;
|
|
5001
5437
|
|
|
5002
5438
|
var bisectDate = d3.bisector(function (d) {
|
|
5003
|
-
return
|
|
5439
|
+
return _this35.parseX(d.x.value);
|
|
5004
5440
|
}).left;
|
|
5005
5441
|
|
|
5006
5442
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -5039,8 +5475,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5039
5475
|
}
|
|
5040
5476
|
|
|
5041
5477
|
this.options.data.series.forEach(function (s) {
|
|
5042
|
-
if (
|
|
5043
|
-
xPoint =
|
|
5478
|
+
if (_this35.options.data[xData].scale !== 'Time') {
|
|
5479
|
+
xPoint = _this35[xAxis](_this35.parseX(xLabel));
|
|
5044
5480
|
s.data.forEach(function (d) {
|
|
5045
5481
|
if (d.x.value === xLabel) {
|
|
5046
5482
|
if (!tooltipTitle) {
|
|
@@ -5059,13 +5495,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5059
5495
|
var pointA = s.data[index - 1];
|
|
5060
5496
|
var pointB = s.data[index];
|
|
5061
5497
|
|
|
5062
|
-
if (
|
|
5498
|
+
if (_this35.options.orientation === 'horizontal') {
|
|
5063
5499
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
5064
5500
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
5065
5501
|
}
|
|
5066
5502
|
|
|
5067
5503
|
if (pointA && !pointB) {
|
|
5068
|
-
xPoint =
|
|
5504
|
+
xPoint = _this35[xAxis](_this35.parseX(pointA.x.value));
|
|
5069
5505
|
tooltipTitle = pointA.x.value;
|
|
5070
5506
|
|
|
5071
5507
|
if (!pointA.y.color) {
|
|
@@ -5075,12 +5511,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5075
5511
|
tooltipData.push(pointA.y);
|
|
5076
5512
|
|
|
5077
5513
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
5078
|
-
tooltipTitle = d3.timeFormat(
|
|
5514
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
5079
5515
|
}
|
|
5080
5516
|
}
|
|
5081
5517
|
|
|
5082
5518
|
if (pointB && !pointA) {
|
|
5083
|
-
xPoint =
|
|
5519
|
+
xPoint = _this35[xAxis](_this35.parseX(pointB.x.value));
|
|
5084
5520
|
tooltipTitle = pointB.x.value;
|
|
5085
5521
|
|
|
5086
5522
|
if (!pointB.y.color) {
|
|
@@ -5090,14 +5526,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5090
5526
|
tooltipData.push(pointB.y);
|
|
5091
5527
|
|
|
5092
5528
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5093
|
-
tooltipTitle = d3.timeFormat(
|
|
5529
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5094
5530
|
}
|
|
5095
5531
|
}
|
|
5096
5532
|
|
|
5097
5533
|
if (pointA && pointB) {
|
|
5098
|
-
var d0 =
|
|
5534
|
+
var d0 = _this35[xAxis](_this35.parseX(pointA.x.value));
|
|
5099
5535
|
|
|
5100
|
-
var d1 =
|
|
5536
|
+
var d1 = _this35[xAxis](_this35.parseX(pointB.x.value));
|
|
5101
5537
|
|
|
5102
5538
|
var mid = Math.abs(d0 - d1) / 2;
|
|
5103
5539
|
|
|
@@ -5106,7 +5542,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5106
5542
|
tooltipTitle = pointB.x.value;
|
|
5107
5543
|
|
|
5108
5544
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5109
|
-
tooltipTitle = d3.timeFormat(
|
|
5545
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5110
5546
|
}
|
|
5111
5547
|
|
|
5112
5548
|
if (!pointB.y.color) {
|
|
@@ -5119,7 +5555,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5119
5555
|
tooltipTitle = pointA.x.value;
|
|
5120
5556
|
|
|
5121
5557
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
5122
|
-
tooltipTitle = d3.timeFormat(
|
|
5558
|
+
tooltipTitle = d3.timeFormat(_this35.options.dateFormat || _this35.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
5123
5559
|
}
|
|
5124
5560
|
|
|
5125
5561
|
if (!pointA.y.color) {
|
|
@@ -5224,7 +5660,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5224
5660
|
}, {
|
|
5225
5661
|
key: "render",
|
|
5226
5662
|
value: function render(options) {
|
|
5227
|
-
var
|
|
5663
|
+
var _this36 = this;
|
|
5228
5664
|
|
|
5229
5665
|
/* global d3 options WebsyUtils */
|
|
5230
5666
|
if (typeof options !== 'undefined') {
|
|
@@ -5293,7 +5729,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5293
5729
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
5294
5730
|
return {
|
|
5295
5731
|
value: s.label || s.key,
|
|
5296
|
-
color: s.color ||
|
|
5732
|
+
color: s.color || _this36.options.colors[i % _this36.options.colors.length]
|
|
5297
5733
|
};
|
|
5298
5734
|
});
|
|
5299
5735
|
|
|
@@ -5545,7 +5981,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5545
5981
|
|
|
5546
5982
|
if (this.options.data.bottom.formatter) {
|
|
5547
5983
|
bAxisFunc.tickFormat(function (d) {
|
|
5548
|
-
return
|
|
5984
|
+
return _this36.options.data.bottom.formatter(d);
|
|
5549
5985
|
});
|
|
5550
5986
|
}
|
|
5551
5987
|
|
|
@@ -5571,8 +6007,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5571
6007
|
|
|
5572
6008
|
if (this.options.margin.axisLeft > 0) {
|
|
5573
6009
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5574
|
-
if (
|
|
5575
|
-
d =
|
|
6010
|
+
if (_this36.options.data.left.formatter) {
|
|
6011
|
+
d = _this36.options.data.left.formatter(d);
|
|
5576
6012
|
}
|
|
5577
6013
|
|
|
5578
6014
|
return d;
|
|
@@ -5609,8 +6045,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5609
6045
|
|
|
5610
6046
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
5611
6047
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
5612
|
-
if (
|
|
5613
|
-
d =
|
|
6048
|
+
if (_this36.options.data.right.formatter) {
|
|
6049
|
+
d = _this36.options.data.right.formatter(d);
|
|
5614
6050
|
}
|
|
5615
6051
|
|
|
5616
6052
|
return d;
|
|
@@ -5636,16 +6072,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5636
6072
|
|
|
5637
6073
|
this.options.data.series.forEach(function (series, index) {
|
|
5638
6074
|
if (!series.key) {
|
|
5639
|
-
series.key =
|
|
6075
|
+
series.key = _this36.createIdentity();
|
|
5640
6076
|
}
|
|
5641
6077
|
|
|
5642
6078
|
if (!series.color) {
|
|
5643
|
-
series.color =
|
|
6079
|
+
series.color = _this36.options.colors[index % _this36.options.colors.length];
|
|
5644
6080
|
}
|
|
5645
6081
|
|
|
5646
|
-
|
|
6082
|
+
_this36["render".concat(series.type || 'bar')](series, index);
|
|
5647
6083
|
|
|
5648
|
-
|
|
6084
|
+
_this36.renderLabels(series, index);
|
|
5649
6085
|
});
|
|
5650
6086
|
}
|
|
5651
6087
|
}
|
|
@@ -5653,17 +6089,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5653
6089
|
}, {
|
|
5654
6090
|
key: "renderarea",
|
|
5655
6091
|
value: function renderarea(series, index) {
|
|
5656
|
-
var
|
|
6092
|
+
var _this37 = this;
|
|
5657
6093
|
|
|
5658
6094
|
/* global d3 series index */
|
|
5659
6095
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
5660
6096
|
return d3.area().x(function (d) {
|
|
5661
|
-
return
|
|
6097
|
+
return _this37[xAxis](_this37.parseX(d.x.value));
|
|
5662
6098
|
}).y0(function (d) {
|
|
5663
|
-
return
|
|
6099
|
+
return _this37[yAxis](0);
|
|
5664
6100
|
}).y1(function (d) {
|
|
5665
|
-
return
|
|
5666
|
-
}).curve(d3[curveStyle ||
|
|
6101
|
+
return _this37[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6102
|
+
}).curve(d3[curveStyle || _this37.options.curveStyle]);
|
|
5667
6103
|
};
|
|
5668
6104
|
|
|
5669
6105
|
var xAxis = 'bottomAxis';
|
|
@@ -5838,15 +6274,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5838
6274
|
}, {
|
|
5839
6275
|
key: "renderline",
|
|
5840
6276
|
value: function renderline(series, index) {
|
|
5841
|
-
var
|
|
6277
|
+
var _this38 = this;
|
|
5842
6278
|
|
|
5843
6279
|
/* global series index d3 */
|
|
5844
6280
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
5845
6281
|
return d3.line().x(function (d) {
|
|
5846
|
-
return
|
|
6282
|
+
return _this38[xAxis](_this38.parseX(d.x.value));
|
|
5847
6283
|
}).y(function (d) {
|
|
5848
|
-
return
|
|
5849
|
-
}).curve(d3[curveStyle ||
|
|
6284
|
+
return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
6285
|
+
}).curve(d3[curveStyle || _this38.options.curveStyle]);
|
|
5850
6286
|
};
|
|
5851
6287
|
|
|
5852
6288
|
var xAxis = 'bottomAxis';
|
|
@@ -5884,14 +6320,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5884
6320
|
}, {
|
|
5885
6321
|
key: "rendersymbol",
|
|
5886
6322
|
value: function rendersymbol(series, index) {
|
|
5887
|
-
var
|
|
6323
|
+
var _this39 = this;
|
|
5888
6324
|
|
|
5889
6325
|
/* global d3 series index series.key */
|
|
5890
6326
|
var drawSymbol = function drawSymbol(size) {
|
|
5891
6327
|
return d3.symbol() // .type(d => {
|
|
5892
6328
|
// return d3.symbols[0]
|
|
5893
6329
|
// })
|
|
5894
|
-
.size(size ||
|
|
6330
|
+
.size(size || _this39.options.symbolSize);
|
|
5895
6331
|
};
|
|
5896
6332
|
|
|
5897
6333
|
var xAxis = 'bottomAxis';
|
|
@@ -5909,7 +6345,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5909
6345
|
symbols.attr('d', function (d) {
|
|
5910
6346
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
5911
6347
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
5912
|
-
return "translate(".concat(
|
|
6348
|
+
return "translate(".concat(_this39[xAxis](_this39.parseX(d.x.value)), ", ").concat(_this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
5913
6349
|
}); // Enter
|
|
5914
6350
|
|
|
5915
6351
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -5918,7 +6354,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5918
6354
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
5919
6355
|
return "symbol symbol_".concat(series.key);
|
|
5920
6356
|
}).attr('transform', function (d) {
|
|
5921
|
-
return "translate(".concat(
|
|
6357
|
+
return "translate(".concat(_this39[xAxis](_this39.parseX(d.x.value)), ", ").concat(_this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
5922
6358
|
});
|
|
5923
6359
|
}
|
|
5924
6360
|
}, {
|
|
@@ -6073,7 +6509,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6073
6509
|
}, {
|
|
6074
6510
|
key: "resize",
|
|
6075
6511
|
value: function resize() {
|
|
6076
|
-
var
|
|
6512
|
+
var _this40 = this;
|
|
6077
6513
|
|
|
6078
6514
|
var el = document.getElementById(this.elementId);
|
|
6079
6515
|
|
|
@@ -6086,7 +6522,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
6086
6522
|
// }
|
|
6087
6523
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
6088
6524
|
html += this._data.map(function (d, i) {
|
|
6089
|
-
return
|
|
6525
|
+
return _this40.getLegendItemHTML(d);
|
|
6090
6526
|
}).join('');
|
|
6091
6527
|
html += "\n <div>\n ";
|
|
6092
6528
|
el.innerHTML = html;
|
|
@@ -6234,8 +6670,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6234
6670
|
var el = document.getElementById(this.elementId);
|
|
6235
6671
|
|
|
6236
6672
|
if (el) {
|
|
6237
|
-
if (typeof d3 === 'undefined') {
|
|
6238
|
-
console.error('d3 library has not been loaded');
|
|
6673
|
+
if (typeof d3 === 'undefined') {// console.error('d3 library has not been loaded')
|
|
6239
6674
|
}
|
|
6240
6675
|
|
|
6241
6676
|
if (typeof L === 'undefined') {
|
|
@@ -6259,7 +6694,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6259
6694
|
}, {
|
|
6260
6695
|
key: "render",
|
|
6261
6696
|
value: function render() {
|
|
6262
|
-
var
|
|
6697
|
+
var _this41 = this;
|
|
6263
6698
|
|
|
6264
6699
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6265
6700
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -6268,7 +6703,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6268
6703
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6269
6704
|
return {
|
|
6270
6705
|
value: s.label || s.key,
|
|
6271
|
-
color: s.color ||
|
|
6706
|
+
color: s.color || _this41.options.colors[i % _this41.options.colors.length]
|
|
6272
6707
|
};
|
|
6273
6708
|
});
|
|
6274
6709
|
var longestValue = legendData.map(function (s) {
|
|
@@ -6332,7 +6767,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6332
6767
|
|
|
6333
6768
|
if (this.polygons) {
|
|
6334
6769
|
this.polygons.forEach(function (p) {
|
|
6335
|
-
return
|
|
6770
|
+
return _this41.map.removeLayer(p);
|
|
6336
6771
|
});
|
|
6337
6772
|
}
|
|
6338
6773
|
|
|
@@ -6390,18 +6825,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6390
6825
|
}
|
|
6391
6826
|
|
|
6392
6827
|
if (!p.options.color) {
|
|
6393
|
-
p.options.color =
|
|
6828
|
+
p.options.color = _this41.options.colors[i % _this41.options.colors.length];
|
|
6394
6829
|
}
|
|
6395
6830
|
|
|
6396
6831
|
var pol = L.polygon(p.data.map(function (c) {
|
|
6397
6832
|
return c.map(function (d) {
|
|
6398
6833
|
return [d.Latitude, d.Longitude];
|
|
6399
6834
|
});
|
|
6400
|
-
}), p.options).addTo(
|
|
6835
|
+
}), p.options).addTo(_this41.map);
|
|
6401
6836
|
|
|
6402
|
-
|
|
6837
|
+
_this41.polygons.push(pol);
|
|
6403
6838
|
|
|
6404
|
-
|
|
6839
|
+
_this41.map.fitBounds(pol.getBounds());
|
|
6405
6840
|
});
|
|
6406
6841
|
} // if (this.data.markers.length > 0) {
|
|
6407
6842
|
// el.classList.remove('hidden')
|
|
@@ -6553,7 +6988,12 @@ var WebsyDesigns = {
|
|
|
6553
6988
|
ButtonGroup: ButtonGroup,
|
|
6554
6989
|
WebsySwitch: Switch,
|
|
6555
6990
|
Pager: Pager,
|
|
6556
|
-
Switch: Switch
|
|
6991
|
+
Switch: Switch,
|
|
6992
|
+
ResponsiveText: ResponsiveText,
|
|
6993
|
+
WebsyResponsiveText: ResponsiveText,
|
|
6994
|
+
QlikPlugin: _websyDesignsQlikPluginEs["default"],
|
|
6995
|
+
Icons: WebsyIcons,
|
|
6996
|
+
WebsyIcons: WebsyIcons
|
|
6557
6997
|
};
|
|
6558
6998
|
WebsyDesigns.service = new WebsyDesigns.APIService('');
|
|
6559
6999
|
var _default = WebsyDesigns;
|