@websy/websy-designs 1.0.4 → 1.1.2

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.
@@ -34,6 +34,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
34
34
  WebsyRouter
35
35
  WebsyResultList
36
36
  WebsyTable
37
+ WebsyTable2
37
38
  WebsyChart
38
39
  WebsyChartTooltip
39
40
  WebsyLegend
@@ -45,6 +46,11 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
45
46
  APIService
46
47
  ButtonGroup
47
48
  WebsyUtils
49
+ <<<<<<< HEAD
50
+ WebsyCarousel
51
+ =======
52
+ Pager
53
+ >>>>>>> master
48
54
  */
49
55
 
50
56
  /* global XMLHttpRequest fetch ENV */
@@ -284,6 +290,192 @@ var ButtonGroup = /*#__PURE__*/function () {
284
290
 
285
291
  return ButtonGroup;
286
292
  }();
293
+ /* global */
294
+
295
+
296
+ var WebsyCarousel = /*#__PURE__*/function () {
297
+ function WebsyCarousel(elementId, options) {
298
+ _classCallCheck(this, WebsyCarousel);
299
+
300
+ var DEFAULTS = {
301
+ currentFrame: 0,
302
+ frameDuration: 4000,
303
+ showFrameSelector: true,
304
+ showPrevNext: true
305
+ };
306
+ this.playTimeoutFn = null;
307
+ this.options = _extends({}, DEFAULTS, options);
308
+
309
+ if (!elementId) {
310
+ console.log('No element Id provided');
311
+ }
312
+
313
+ var el = document.getElementById(elementId);
314
+
315
+ if (el) {
316
+ this.elementId = elementId;
317
+ el.addEventListener('click', this.handleClick.bind(this));
318
+ this.render();
319
+ }
320
+ }
321
+
322
+ _createClass(WebsyCarousel, [{
323
+ key: "handleClick",
324
+ value: function handleClick(event) {
325
+ if (event.target.classList.contains('websy-next-arrow')) {
326
+ this.next();
327
+ }
328
+
329
+ if (event.target.classList.contains('websy-prev-arrow')) {
330
+ this.prev();
331
+ }
332
+
333
+ if (event.target.classList.contains('websy-progress-btn' || 'websy-progress-btn-active')) {
334
+ var index = +event.target.getAttribute('data-index');
335
+ var prevFrameIndex = this.options.currentFrame;
336
+ this.options.currentFrame = index;
337
+ this.showFrame(prevFrameIndex, index);
338
+ }
339
+ }
340
+ }, {
341
+ key: "next",
342
+ value: function next() {
343
+ this.pause();
344
+ var prevFrameIndex = this.options.currentFrame;
345
+
346
+ if (this.options.currentFrame === this.options.frames.length - 1) {
347
+ this.options.currentFrame = 0;
348
+ } else {
349
+ this.options.currentFrame++;
350
+ }
351
+
352
+ this.showFrame(prevFrameIndex, this.options.currentFrame); // this.play()
353
+ // document.getElementById(`${this.elementId}_frame_${this.options.currentFrame}`)
354
+ // .style.transform = `translateX(-100%)`
355
+ // if (`${this.options.currentFrame === this.options.frames.length - 1}`) {
356
+ // document.getElementById`${this.elementId}_frame_${this.options.currentFrame}`.style.transform = `translateX('-100%')`
357
+ // }
358
+ }
359
+ }, {
360
+ key: "pause",
361
+ value: function pause() {
362
+ if (this.playTimeoutFn) {
363
+ clearTimeout(this.playTimeoutFn);
364
+ }
365
+ }
366
+ }, {
367
+ key: "play",
368
+ value: function play() {
369
+ var _this2 = this;
370
+
371
+ this.playTimeoutFn = setTimeout(function () {
372
+ var prevFrameIndex = _this2.options.currentFrame;
373
+
374
+ if (_this2.options.currentFrame === _this2.options.frames.length - 1) {
375
+ _this2.options.currentFrame = 0;
376
+ } else {
377
+ _this2.options.currentFrame++;
378
+ }
379
+
380
+ _this2.showFrame(prevFrameIndex, _this2.options.currentFrame);
381
+
382
+ _this2.play();
383
+ }, this.options.frameDuration);
384
+ }
385
+ }, {
386
+ key: "prev",
387
+ value: function prev() {
388
+ this.pause();
389
+ var prevFrameIndex = this.options.currentFrame;
390
+
391
+ if (this.options.currentFrame === 0) {
392
+ this.options.currentFrame = this.options.frames.length - 1;
393
+ } else {
394
+ this.options.currentFrame--;
395
+ }
396
+
397
+ this.showFrame(prevFrameIndex, this.options.currentFrame); // this.play()
398
+ // document.getElementById(`${this.elementId}_frame_${this.options.currentFrame}`)
399
+ // .style.transform = `translateX(100%)`
400
+ }
401
+ }, {
402
+ key: "render",
403
+ value: function render(options) {
404
+ this.options = _extends({}, this.options, options);
405
+ this.resize();
406
+ }
407
+ }, {
408
+ key: "resize",
409
+ value: function resize() {
410
+ var _this3 = this;
411
+
412
+ var el = document.getElementById(this.elementId);
413
+
414
+ if (el) {
415
+ var html = "\n <div class=\"websy-carousel\">\n ";
416
+ this.options.frames.forEach(function (frame, frameIndex) {
417
+ html += "\n <div id=\"".concat(_this3.elementId, "_frame_").concat(frameIndex, "\" class=\"websy-frame-container animate\" style=\"transform: translateX(").concat(frameIndex === 0 ? '0' : '100%', ")\">\n ");
418
+ frame.images.forEach(function (image) {
419
+ html += "\n <div style=\"".concat(image.style || 'position: absolute; width: 100%; height: 100%; top: 0; left: 0;', " background-image: url('").concat(image.url, "')\" class=\"").concat(image.classes || '', " websy-carousel-image\">\n </div>\n ");
420
+ });
421
+ frame.text && frame.text.forEach(function (text) {
422
+ html += "\n <div style=\"".concat(text.style || 'position: absolute; width: 100%; height: 100%; top: 0; left: 0;', "\" class=\"").concat(text.classes || '', " websy-carousel-image\">\n ").concat(text.html, "\n </div>\n ");
423
+ });
424
+ html += "</div>";
425
+ });
426
+
427
+ if (this.options.showFrameSelector === true) {
428
+ html += "<div class=\"websy-btn-parent\">";
429
+ this.options.frames.forEach(function (frame, frameIndex) {
430
+ html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" data-index=\"".concat(frameIndex, "\" id=\"").concat(_this3.elementId, "_selector_").concat(frameIndex, "\" \n class=\"websy-progress-btn ").concat(_this3.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : '', "\">\n <title>Ellipse</title><circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n ");
431
+ });
432
+ html += "</div>";
433
+ }
434
+
435
+ if (this.options.showPrevNext === true) {
436
+ html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n </div>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"websy-next-arrow\">\n <title>Caret Forward</title>\n <path d=\"M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z\"/>\n </svg>\n ";
437
+ }
438
+
439
+ html += "\n </div>\n ";
440
+ el.innerHTML = html;
441
+ } // this.play()
442
+ // this.showFrameSelector()
443
+
444
+ }
445
+ }, {
446
+ key: "showFrame",
447
+ value: function showFrame(prevFrameIndex, currFrameIndex) {
448
+ var prevTranslateX = prevFrameIndex > currFrameIndex ? '100%' : '-100%';
449
+ var nextTranslateX = prevFrameIndex < currFrameIndex ? '100%' : '-100%';
450
+
451
+ if (currFrameIndex === 0 && prevFrameIndex === this.options.frames.length - 1) {
452
+ prevTranslateX = '-100%';
453
+ nextTranslateX = '100%';
454
+ } else if (prevFrameIndex === 0 && currFrameIndex === this.options.frames.length - 1) {
455
+ prevTranslateX = '100%';
456
+ nextTranslateX = '-100%';
457
+ }
458
+
459
+ var prevF = document.getElementById("".concat(this.elementId, "_frame_").concat(prevFrameIndex));
460
+ prevF.style.transform = "translateX(".concat(prevTranslateX, ")");
461
+ var btnInactive = document.getElementById("".concat(this.elementId, "_selector_").concat(prevFrameIndex));
462
+ btnInactive.classList.remove('websy-progress-btn-active');
463
+ var newF = document.getElementById("".concat(this.elementId, "_frame_").concat(currFrameIndex));
464
+ newF.classList.remove('animate');
465
+ newF.style.transform = "translateX(".concat(nextTranslateX, ")");
466
+ setTimeout(function () {
467
+ newF.classList.add('animate');
468
+ newF.style.transform = 'translateX(0%)';
469
+ }, 100);
470
+ var btnActive = document.getElementById("".concat(this.elementId, "_selector_").concat(currFrameIndex));
471
+ btnActive.classList.add('websy-progress-btn-active');
472
+ } // showFrameSelector () {
473
+ // }
474
+
475
+ }]);
476
+
477
+ return WebsyCarousel;
478
+ }();
287
479
 
288
480
  var WebsyDatePicker = /*#__PURE__*/function () {
289
481
  function WebsyDatePicker(elementId, options) {
@@ -292,11 +484,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
292
484
  this.oneDay = 1000 * 60 * 60 * 24;
293
485
  this.currentselection = [];
294
486
  this.validDates = [];
487
+ this.validYears = [];
488
+ this.customRangeSelected = true;
295
489
  var DEFAULTS = {
296
490
  defaultRange: 0,
297
491
  minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
298
492
  maxAllowedDate: this.floorDate(new Date(new Date())),
493
+ minAllowedYear: 1970,
494
+ maxAllowedYear: new Date().getFullYear(),
299
495
  daysOfWeek: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
496
+ mode: 'date',
300
497
  monthMap: {
301
498
  0: 'Jan',
302
499
  1: 'Feb',
@@ -313,35 +510,49 @@ var WebsyDatePicker = /*#__PURE__*/function () {
313
510
  },
314
511
  ranges: []
315
512
  };
316
- DEFAULTS.ranges = [{
317
- label: 'All Dates',
318
- range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
319
- }, {
320
- label: 'Today',
321
- range: [this.floorDate(new Date())]
322
- }, {
323
- label: 'Yesterday',
324
- range: [this.floorDate(new Date().setDate(new Date().getDate() - 1))]
325
- }, {
326
- label: 'Last 7 Days',
327
- range: [this.floorDate(new Date().setDate(new Date().getDate() - 6)), this.floorDate(new Date())]
328
- }, {
329
- label: 'This Month',
330
- range: [this.floorDate(new Date().setDate(1)), this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() + 1) - this.oneDay)]
331
- }, {
332
- label: 'Last Month',
333
- range: [this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 1)), this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth()) - this.oneDay)]
334
- }, {
335
- label: 'This Year',
336
- range: [this.floorDate(new Date("1/1/".concat(new Date().getFullYear()))), this.floorDate(new Date("12/31/".concat(new Date().getFullYear())))]
337
- }, {
338
- label: 'Last Year',
339
- range: [this.floorDate(new Date("1/1/".concat(new Date().getFullYear() - 1))), this.floorDate(new Date("12/31/".concat(new Date().getFullYear() - 1)))]
340
- }];
513
+ DEFAULTS.ranges = {
514
+ date: [{
515
+ label: 'All Dates',
516
+ range: [DEFAULTS.minAllowedDate, DEFAULTS.maxAllowedDate]
517
+ }, {
518
+ label: 'Today',
519
+ range: [this.floorDate(new Date())]
520
+ }, {
521
+ label: 'Yesterday',
522
+ range: [this.floorDate(new Date().setDate(new Date().getDate() - 1))]
523
+ }, {
524
+ label: 'Last 7 Days',
525
+ range: [this.floorDate(new Date().setDate(new Date().getDate() - 6)), this.floorDate(new Date())]
526
+ }, {
527
+ label: 'This Month',
528
+ range: [this.floorDate(new Date().setDate(1)), this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() + 1) - this.oneDay)]
529
+ }, {
530
+ label: 'Last Month',
531
+ range: [this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth() - 1)), this.floorDate(new Date(new Date().setDate(1)).setMonth(new Date().getMonth()) - this.oneDay)]
532
+ }, {
533
+ label: 'This Year',
534
+ range: [this.floorDate(new Date("1/1/".concat(new Date().getFullYear()))), this.floorDate(new Date("12/31/".concat(new Date().getFullYear())))]
535
+ }, {
536
+ label: 'Last Year',
537
+ range: [this.floorDate(new Date("1/1/".concat(new Date().getFullYear() - 1))), this.floorDate(new Date("12/31/".concat(new Date().getFullYear() - 1)))]
538
+ }],
539
+ year: [{
540
+ label: 'All Years',
541
+ range: [DEFAULTS.minAllowedYear, DEFAULTS.maxAllowedYear]
542
+ }, {
543
+ label: 'Last 5 Years',
544
+ range: [new Date().getFullYear() - 4, DEFAULTS.maxAllowedYear]
545
+ }, {
546
+ label: 'Last 10 Years',
547
+ range: [new Date().getFullYear() - 9, DEFAULTS.maxAllowedYear]
548
+ }]
549
+ };
341
550
  this.options = _extends({}, DEFAULTS, options);
342
551
  this.selectedRange = this.options.defaultRange || 0;
343
- this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.defaultRange || 0].range);
552
+ this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][this.options.defaultRange || 0].range);
344
553
  this.priorSelectedDates = null;
554
+ this.priorselection = null;
555
+ this.priorCustomRangeSelected = null;
345
556
 
346
557
  if (!elementId) {
347
558
  console.log('No element Id provided');
@@ -353,7 +564,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
353
564
  if (el) {
354
565
  this.elementId = elementId;
355
566
  el.addEventListener('click', this.handleClick.bind(this));
356
- var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div class='websy-date-picker-header'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[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 </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 <button class='websy-btn websy-dp-cancel'>Cancel</button>\n <button class='websy-btn websy-dp-confirm'>Confirm</button>\n </div>\n </div> \n </div>\n ");
567
+ el.addEventListener('mousedown', this.handleMouseDown.bind(this));
568
+ el.addEventListener('mouseover', this.handleMouseOver.bind(this));
569
+ el.addEventListener('mouseup', this.handleMouseUp.bind(this));
570
+ var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div class='websy-date-picker-header'>\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 </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 <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 ");
357
571
  el.innerHTML = html;
358
572
  this.render();
359
573
  } else {
@@ -371,13 +585,20 @@ var WebsyDatePicker = /*#__PURE__*/function () {
371
585
 
372
586
  if (confirm === true) {
373
587
  if (this.options.onChange) {
374
- this.options.onChange(this.selectedRangeDates);
588
+ if (this.customRangeSelected === true) {
589
+ this.options.onChange(this.selectedRangeDates, true);
590
+ } else {
591
+ this.options.onChange(this.currentselection, false);
592
+ }
375
593
  }
376
594
 
377
595
  this.updateRange();
378
596
  } else {
379
597
  this.selectedRangeDates = _toConsumableArray(this.priorSelectedDates);
380
598
  this.selectedRange = this.priorSelectedRange;
599
+ this.customRangeSelected = this.priorCustomRangeSelected;
600
+ this.currentselection = _toConsumableArray(this.priorselection);
601
+ this.highlightRange();
381
602
  }
382
603
  }
383
604
  }, {
@@ -404,22 +625,65 @@ var WebsyDatePicker = /*#__PURE__*/function () {
404
625
  var index = event.target.getAttribute('data-index');
405
626
  this.selectRange(index);
406
627
  this.updateRange(index);
407
- } else if (event.target.classList.contains('websy-dp-date')) {
408
- if (event.target.classList.contains('websy-disabled-date')) {
409
- return;
410
- }
411
-
412
- var timestamp = event.target.id.split('_')[0];
413
- this.selectDate(+timestamp);
628
+ } else if (event.target.classList.contains('websy-dp-date')) {// if (event.target.classList.contains('websy-disabled-date')) {
629
+ // return
630
+ // }
631
+ // const timestamp = event.target.id.split('_')[0]
632
+ // this.selectDate(+timestamp)
414
633
  } else if (event.target.classList.contains('websy-dp-confirm')) {
415
634
  this.close(true);
416
635
  } else if (event.target.classList.contains('websy-dp-cancel')) {
417
636
  this.close();
418
637
  }
419
638
  }
639
+ }, {
640
+ key: "handleMouseDown",
641
+ value: function handleMouseDown(event) {
642
+ this.mouseDown = true;
643
+ this.dragging = false;
644
+
645
+ if (event.target.classList.contains('websy-dp-date')) {
646
+ if (event.target.classList.contains('websy-disabled-date')) {
647
+ return;
648
+ }
649
+
650
+ if (this.customRangeSelected === true) {
651
+ this.currentselection = [];
652
+ this.customRangeSelected = false;
653
+ }
654
+
655
+ this.mouseDownId = +event.target.id.split('_')[0];
656
+ this.selectDate(this.mouseDownId);
657
+ }
658
+ }
659
+ }, {
660
+ key: "handleMouseOver",
661
+ value: function handleMouseOver(event) {
662
+ if (this.mouseDown === true) {
663
+ if (event.target.classList.contains('websy-dp-date')) {
664
+ if (event.target.classList.contains('websy-disabled-date')) {
665
+ return;
666
+ }
667
+
668
+ if (event.target.id.split('_')[0] !== this.mouseDownId) {
669
+ this.dragging = true;
670
+ this.selectDate(+event.target.id.split('_')[0]);
671
+ }
672
+ }
673
+ }
674
+ }
675
+ }, {
676
+ key: "handleMouseUp",
677
+ value: function handleMouseUp(event) {
678
+ this.mouseDown = false;
679
+ this.dragging = false;
680
+ this.mouseDownId = null;
681
+ }
420
682
  }, {
421
683
  key: "highlightRange",
422
684
  value: function highlightRange() {
685
+ var _this2 = this;
686
+
423
687
  var el = document.getElementById("".concat(this.elementId, "_dateList"));
424
688
  var dateEls = el.querySelectorAll('.websy-dp-date');
425
689
 
@@ -433,27 +697,72 @@ var WebsyDatePicker = /*#__PURE__*/function () {
433
697
  return;
434
698
  }
435
699
 
436
- var daysDiff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay);
700
+ if (this.customRangeSelected === true) {
701
+ var diff;
437
702
 
438
- if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
439
- daysDiff += 1;
440
- }
703
+ if (this.options.mode === 'date') {
704
+ diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay);
441
705
 
442
- for (var _i = 0; _i < daysDiff + 1; _i++) {
443
- var d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
444
- var dateEl = document.getElementById("".concat(d.getTime(), "_date"));
706
+ if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
707
+ diff += 1;
708
+ }
709
+ } else if (this.options.mode === 'year') {
710
+ diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
445
711
 
446
- if (dateEl) {
447
- dateEl.classList.add('selected');
712
+ if (this.selectedRangeDates[this.selectedRangeDates.length - 1] !== this.selectedRangeDates[0]) {// diff += 1
713
+ }
714
+ }
448
715
 
449
- if (d.getTime() === this.selectedRangeDates[0].getTime()) {
450
- dateEl.classList.add('first');
716
+ for (var _i = 0; _i < diff + 1; _i++) {
717
+ var d = void 0;
718
+ var rangeStart = void 0;
719
+ var rangeEnd = void 0;
720
+
721
+ if (this.options.mode === 'date') {
722
+ d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
723
+ d = d.getTime();
724
+ rangeStart = this.selectedRangeDates[0].getTime();
725
+ rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
726
+ } else if (this.options.mode === 'year') {
727
+ d = this.selectedRangeDates[0] + _i;
728
+ rangeStart = this.selectedRangeDates[0];
729
+ rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1];
451
730
  }
452
731
 
453
- if (d.getTime() === this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()) {
454
- dateEl.classList.add('last');
732
+ var dateEl = void 0;
733
+
734
+ if (this.options.mode === 'date') {
735
+ dateEl = document.getElementById("".concat(d.getTime(), "_date"));
736
+ } else if (this.options.mode === 'year') {
737
+ dateEl = document.getElementById("".concat(d, "_year"));
738
+ }
739
+
740
+ if (dateEl) {
741
+ dateEl.classList.add('selected');
742
+
743
+ if (d === rangeStart) {
744
+ dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'last' : 'first'));
745
+ }
746
+
747
+ if (d === rangeEnd) {
748
+ dateEl.classList.add("".concat(this.options.sortDirection === 'desc' ? 'first' : 'last'));
749
+ }
455
750
  }
456
751
  }
752
+ } else {
753
+ this.currentselection.forEach(function (d) {
754
+ var dateEl;
755
+
756
+ if (_this2.options.mode === 'date') {
757
+ dateEl = document.getElementById("".concat(d, "_date"));
758
+ } else if (_this2.options.mode === 'year') {
759
+ dateEl = document.getElementById("".concat(d, "_year"));
760
+ }
761
+
762
+ dateEl.classList.add('selected');
763
+ dateEl.classList.add('first');
764
+ dateEl.classList.add('last');
765
+ });
457
766
  }
458
767
  }
459
768
  }, {
@@ -466,6 +775,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
466
775
  contentEl.classList.add('active');
467
776
  this.priorSelectedDates = _toConsumableArray(this.selectedRangeDates);
468
777
  this.priorSelectedRange = this.selectedRange;
778
+ this.priorselection = _toConsumableArray(this.currentselection);
779
+ this.priorCustomRangeSelected = this.customRangeSelected;
469
780
  this.scrollRangeIntoView();
470
781
  }
471
782
  }, {
@@ -493,61 +804,111 @@ var WebsyDatePicker = /*#__PURE__*/function () {
493
804
  }, {
494
805
  key: "renderDates",
495
806
  value: function renderDates(disabledDates) {
807
+ var _this3 = this;
808
+
496
809
  var disabled = [];
497
810
  this.validDates = [];
811
+ this.validYears = [];
498
812
 
499
813
  if (disabledDates) {
500
814
  disabled = disabledDates.map(function (d) {
815
+ if (_this3.options.mode === 'date') {
816
+ return d.getTime();
817
+ } else if (_this3.options.mode === 'year') {
818
+ return d;
819
+ }
820
+
501
821
  return d.getTime();
502
822
  });
503
823
  } // first disabled all of the ranges
504
824
 
505
825
 
506
- this.options.ranges.forEach(function (r) {
826
+ this.options.ranges[this.options.mode].forEach(function (r) {
507
827
  return r.disabled = true;
508
828
  });
509
- var daysDiff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
829
+ var diff;
830
+
831
+ if (this.options.mode === 'date') {
832
+ diff = Math.ceil((this.options.maxAllowedDate.getTime() - this.options.minAllowedDate.getTime()) / this.oneDay) + 1;
833
+ } else if (this.options.mode === 'year') {
834
+ diff = this.options.maxAllowedYear - this.options.minAllowedYear + 1;
835
+ }
836
+
510
837
  var months = {};
838
+ var yearList = [];
511
839
 
512
- for (var i = 0; i < daysDiff; i++) {
513
- var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
514
- var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
840
+ for (var i = 0; i < diff; i++) {
841
+ if (this.options.mode === 'date') {
842
+ var d = this.floorDate(new Date(this.options.minAllowedDate.getTime() + i * this.oneDay));
843
+ var monthYear = "".concat(this.options.monthMap[d.getMonth()], " ").concat(d.getFullYear());
515
844
 
516
- if (!months[monthYear]) {
517
- months[monthYear] = [];
518
- }
845
+ if (!months[monthYear]) {
846
+ months[monthYear] = [];
847
+ }
519
848
 
520
- if (disabled.indexOf(d.getTime()) === -1) {
521
- this.validDates.push(d.getTime());
522
- }
849
+ if (disabled.indexOf(d.getTime()) === -1) {
850
+ this.validDates.push(d.getTime());
851
+ }
523
852
 
524
- months[monthYear].push({
525
- date: d,
526
- dayOfMonth: d.getDate(),
527
- dayOfWeek: d.getDay(),
528
- id: d.getTime(),
529
- disabled: disabled.indexOf(d.getTime()) !== -1
530
- });
853
+ months[monthYear].push({
854
+ date: d,
855
+ dayOfMonth: d.getDate(),
856
+ dayOfWeek: d.getDay(),
857
+ id: d.getTime(),
858
+ disabled: disabled.indexOf(d.getTime()) !== -1
859
+ });
860
+ } else if (this.options.mode === 'year') {
861
+ var _d = this.options.minAllowedYear + i;
862
+
863
+ yearList.push({
864
+ year: _d,
865
+ id: _d,
866
+ disabled: disabled.indexOf(_d) !== -1
867
+ });
868
+
869
+ if (disabled.indexOf(_d) === -1) {
870
+ this.validYears.push(_d);
871
+ }
872
+ }
531
873
  } // check each range to see if it can be enabled
532
874
 
533
875
 
534
- for (var _i2 = 0; _i2 < this.options.ranges.length; _i2++) {
535
- var r = this.options.ranges[_i2]; // check the first date
876
+ for (var _i2 = 0; _i2 < this.options.ranges[this.options.mode].length; _i2++) {
877
+ var r = this.options.ranges[this.options.mode][_i2];
536
878
 
537
- if (this.validDates.indexOf(r.range[0].getTime()) !== -1) {
538
- r.disabled = false;
539
- } else if (r.range[1]) {
540
- // check the last date
541
- if (this.validDates.indexOf(r.range[1].getTime()) !== -1) {
879
+ if (this.options.mode === 'date') {
880
+ // check the first date
881
+ if (this.validDates.indexOf(r.range[0].getTime()) !== -1) {
542
882
  r.disabled = false;
543
- } else {
544
- // check the full range until a match is found
545
- for (var _i3 = r.range[0].getTime(); _i3 <= r.range[1].getTime(); _i3 += this.oneDay) {
546
- var testDate = this.floorDate(new Date(_i3));
883
+ } else if (r.range[1]) {
884
+ // check the last date
885
+ if (this.validDates.indexOf(r.range[1].getTime()) !== -1) {
886
+ r.disabled = false;
887
+ } else {
888
+ // check the full range until a match is found
889
+ for (var _i3 = r.range[0].getTime(); _i3 <= r.range[1].getTime(); _i3 += this.oneDay) {
890
+ var testDate = this.floorDate(new Date(_i3));
547
891
 
548
- if (this.validDates.indexOf(testDate.getTime()) !== -1) {
549
- r.disabled = false;
550
- break;
892
+ if (this.validDates.indexOf(testDate.getTime()) !== -1) {
893
+ r.disabled = false;
894
+ break;
895
+ }
896
+ }
897
+ }
898
+ }
899
+ } else if (this.options.mode === 'year') {
900
+ if (this.validYears.indexOf(r.range[0]) !== -1) {
901
+ r.disabled = false;
902
+ } else if (r.range[1]) {
903
+ if (this.validYears.indexOf(r.range[1]) !== -1) {
904
+ r.disabled = false;
905
+ } else {
906
+ // check the full range until a match is found
907
+ for (var _i4 = r.range[0]; _i4 <= r.range[1]; _i4++) {
908
+ if (this.validYears.indexOf(r.range[0] + _i4) !== -1) {
909
+ r.disabled = false;
910
+ break;
911
+ }
551
912
  }
552
913
  }
553
914
  }
@@ -555,48 +916,79 @@ var WebsyDatePicker = /*#__PURE__*/function () {
555
916
  }
556
917
 
557
918
  var html = '';
558
- html += "\n <ul class='websy-dp-days-header'>\n ";
559
- html += this.options.daysOfWeek.map(function (d) {
560
- return "<li>".concat(d, "</li>");
561
- }).join('');
562
- html += "\n </ul>\n <div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'>\n ");
563
919
 
564
- for (var key in months) {
565
- html += "\n <div class='websy-dp-month-container'>\n <span id='".concat(key.replace(/\s/g, '_'), "'>").concat(key, "</span>\n <ul>\n ");
920
+ if (this.options.mode === 'date') {
921
+ html += "\n <ul class='websy-dp-days-header'>\n ";
922
+ html += this.options.daysOfWeek.map(function (d) {
923
+ return "<li>".concat(d, "</li>");
924
+ }).join('');
925
+ html += "\n </ul> \n <div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'>\n ");
926
+
927
+ for (var key in months) {
928
+ html += "\n <div class='websy-dp-month-container'>\n <span id='".concat(key.replace(/\s/g, '_'), "'>").concat(key, "</span>\n <ul>\n ");
929
+
930
+ if (months[key][0].dayOfWeek > 0) {
931
+ var paddedDays = [];
566
932
 
567
- if (months[key][0].dayOfWeek > 0) {
568
- var paddedDays = [];
933
+ for (var _i5 = 0; _i5 < months[key][0].dayOfWeek; _i5++) {
934
+ paddedDays.push("<li>&nbsp;</li>");
935
+ }
569
936
 
570
- for (var _i4 = 0; _i4 < months[key][0].dayOfWeek; _i4++) {
571
- paddedDays.push("<li>&nbsp;</li>");
937
+ html += paddedDays.join('');
572
938
  }
573
939
 
574
- html += paddedDays.join('');
940
+ html += months[key].map(function (d) {
941
+ return "<li id='".concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
942
+ }).join('');
943
+ html += "\n </ul>\n </div>\n ";
944
+ }
945
+
946
+ html += '</div>';
947
+ } else if (this.options.mode === 'year') {
948
+ if (this.options.sortDirection === 'desc') {
949
+ yearList.reverse();
575
950
  }
576
951
 
577
- html += months[key].map(function (d) {
578
- return "<li id='".concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
952
+ html += "<div id='".concat(this.elementId, "_dateList' class='websy-dp-date-list'><ul>");
953
+ html += yearList.map(function (d) {
954
+ 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>");
579
955
  }).join('');
580
- html += "\n </ul>\n </div>\n ";
956
+ html += "</ul></div>";
581
957
  }
582
958
 
583
- html += '</div>';
584
959
  return html;
585
960
  }
586
961
  }, {
587
962
  key: "renderRanges",
588
963
  value: function renderRanges() {
589
- var _this2 = this;
964
+ var _this4 = this;
590
965
 
966
+ <<<<<<< HEAD
591
967
  return this.options.ranges.map(function (r, i) {
592
- return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this2.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
968
+ return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this4.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
593
969
  }).join('');
970
+ =======
971
+ return this.options.ranges[this.options.mode].map(function (r, i) {
972
+ return "\n <li data-index='".concat(i, "' class='websy-date-picker-range ").concat(i === _this4.selectedRange ? 'active' : '', " ").concat(r.disabled === true ? 'websy-disabled-range' : '', "'>").concat(r.label, "</li>\n ");
973
+ }).join('') + "<li data-index='-1' class='websy-date-picker-range ".concat(this.selectedRange === -1 ? 'active' : '', "'>Custom</li>");
974
+ >>>>>>> master
594
975
  }
595
976
  }, {
596
977
  key: "scrollRangeIntoView",
597
978
  value: function scrollRangeIntoView() {
598
979
  if (this.selectedRangeDates[0]) {
599
- var el = document.getElementById("".concat(this.selectedRangeDates[0].getTime(), "_date"));
980
+ var el;
981
+
982
+ if (this.options.mode === 'date') {
983
+ el = document.getElementById("".concat(this.selectedRangeDates[0].getTime(), "_date"));
984
+ } else if (this.options.mode === 'year') {
985
+ if (this.options.sortDirection === 'desc') {
986
+ el = document.getElementById("".concat(this.selectedRangeDates[this.selectedRangeDates.length - 1], "_year"));
987
+ } else {
988
+ el = document.getElementById("".concat(this.selectedRangeDates[0], "_year"));
989
+ }
990
+ }
991
+
600
992
  var parentEl = document.getElementById("".concat(this.elementId, "_dateList"));
601
993
 
602
994
  if (el && parentEl) {
@@ -610,18 +1002,33 @@ var WebsyDatePicker = /*#__PURE__*/function () {
610
1002
  if (this.currentselection.length === 0) {
611
1003
  this.currentselection.push(timestamp);
612
1004
  } else {
613
- if (timestamp > this.currentselection[0]) {
614
- this.currentselection.push(timestamp);
1005
+ if (this.dragging === true) {
1006
+ this.currentselection = [this.mouseDownId];
1007
+
1008
+ if (timestamp > this.currentselection[0]) {
1009
+ this.currentselection.push(timestamp);
1010
+ } else {
1011
+ this.currentselection.splice(0, 0, timestamp);
1012
+ }
1013
+
1014
+ this.customRangeSelected = true;
615
1015
  } else {
616
- this.currentselection.splice(0, 0, timestamp);
1016
+ this.currentselection.push(timestamp);
1017
+ this.currentselection.sort(function (a, b) {
1018
+ return a - b;
1019
+ });
1020
+ this.customRangeSelected = false;
617
1021
  }
618
1022
  }
619
1023
 
620
- this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
1024
+ if (this.options.mode === 'date') {
1025
+ this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
1026
+ } else if (this.options.mode === 'year') {
1027
+ this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
1028
+ } // if (this.currentselection.length === 2) {
1029
+ // this.currentselection = []
1030
+ // }
621
1031
 
622
- if (this.currentselection.length === 2) {
623
- this.currentselection = [];
624
- }
625
1032
 
626
1033
  this.selectedRange = -1;
627
1034
  this.highlightRange();
@@ -629,8 +1036,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
629
1036
  }, {
630
1037
  key: "selectRange",
631
1038
  value: function selectRange(index) {
632
- if (this.options.ranges[index]) {
633
- this.selectedRangeDates = _toConsumableArray(this.options.ranges[index].range);
1039
+ if (this.options.ranges[this.options.mode][index]) {
1040
+ this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1041
+ this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
634
1042
  this.selectedRange = +index;
635
1043
  this.highlightRange();
636
1044
  this.close(true);
@@ -640,38 +1048,69 @@ var WebsyDatePicker = /*#__PURE__*/function () {
640
1048
  key: "selectCustomRange",
641
1049
  value: function selectCustomRange(range) {
642
1050
  this.selectedRange = -1;
643
- this.selectedRangeDates = range;
1051
+ this.selectedRangeDates = range; // check if the custom range matches a configured range
1052
+
1053
+ for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
1054
+ if (this.options.ranges[this.options.mode][i].range.length === 1) {
1055
+ if (this.options.ranges[this.options.mode][i].range[0] === range[0]) {
1056
+ this.selectedRange = i;
1057
+ break;
1058
+ }
1059
+ } else if (this.options.ranges[this.options.mode][i].range.length === 2) {
1060
+ if (this.options.ranges[this.options.mode][i].range[0] === range[0] && this.options.ranges[this.options.mode][i].range[1] === range[1]) {
1061
+ this.selectedRange = i;
1062
+ break;
1063
+ }
1064
+ }
1065
+ }
1066
+
644
1067
  this.highlightRange();
645
1068
  this.updateRange();
646
1069
  }
647
1070
  }, {
648
1071
  key: "setDateBounds",
649
1072
  value: function setDateBounds(range) {
650
- if (this.options.ranges[0].label === 'All Dates') {
651
- this.options.ranges[0].range = [range[0], range[1] || range[0]];
1073
+ if (['All Dates', 'All Years'].indexOf(this.options.ranges[this.options.mode][0].label) !== -1) {
1074
+ this.options.ranges[this.options.mode][0].range = [range[0], range[1] || range[0]];
652
1075
  }
653
1076
 
654
- this.options.minAllowedDate = range[0];
655
- this.options.maxAllowedDate = range[1] || range[0];
1077
+ if (this.options.mode === 'date') {
1078
+ this.options.minAllowedDate = range[0];
1079
+ this.options.maxAllowedDate = range[1] || range[0];
1080
+ } else if (this.options.mode === 'year') {
1081
+ this.options.minAllowedYear = range[0];
1082
+ this.options.maxAllowedYear = range[1] || range[0];
1083
+ }
656
1084
  }
657
1085
  }, {
658
1086
  key: "updateRange",
659
1087
  value: function updateRange() {
1088
+ var _this5 = this;
1089
+
660
1090
  var range;
661
1091
 
662
1092
  if (this.selectedRange === -1) {
663
- var start = this.selectedRangeDates[0].toLocaleDateString();
1093
+ var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
1094
+ if (_this5.options.mode === 'date') {
1095
+ return d.toLocaleDateString();
1096
+ } else if (_this5.options.mode === 'year') {
1097
+ return d;
1098
+ }
1099
+ });
1100
+ var start = list[0];
664
1101
  var end = '';
665
1102
 
666
- if (this.selectedRangeDates[1] && this.selectedRangeDates[0].getTime() !== this.selectedRangeDates[1].getTime()) {
667
- end = " - ".concat(this.selectedRangeDates[1].toLocaleDateString());
1103
+ if (this.customRangeSelected === true) {
1104
+ end = " - ".concat(list[list.length - 1]);
1105
+ } else {
1106
+ start = "".concat(list.length, " selected");
668
1107
  }
669
1108
 
670
1109
  range = {
671
1110
  label: "".concat(start).concat(end)
672
1111
  };
673
1112
  } else {
674
- range = this.options.ranges[this.selectedRange];
1113
+ range = this.options.ranges[this.options.mode][this.selectedRange];
675
1114
  }
676
1115
 
677
1116
  var el = document.getElementById(this.elementId);
@@ -703,6 +1142,8 @@ Date.prototype.floor = function () {
703
1142
 
704
1143
  var WebsyDropdown = /*#__PURE__*/function () {
705
1144
  function WebsyDropdown(elementId, options) {
1145
+ var _this6 = this;
1146
+
706
1147
  _classCallCheck(this, WebsyDropdown);
707
1148
 
708
1149
  var DEFAULTS = {
@@ -735,6 +1176,28 @@ var WebsyDropdown = /*#__PURE__*/function () {
735
1176
  el.addEventListener('keyup', this.handleKeyUp.bind(this));
736
1177
  el.addEventListener('mouseout', this.handleMouseOut.bind(this));
737
1178
  el.addEventListener('mousemove', this.handleMouseMove.bind(this));
1179
+ var headerLabel = this.selectedItems.map(function (s) {
1180
+ return _this6.options.items[s].label || _this6.options.items[s].value;
1181
+ }).join(this.options.multiValueDelimiter);
1182
+ var headerValue = this.selectedItems.map(function (s) {
1183
+ return _this6.options.items[s].value || _this6.options.items[s].label;
1184
+ }).join(this.options.multiValueDelimiter);
1185
+ 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 ");
1186
+
1187
+ if (this.options.allowClear === true) {
1188
+ 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 ";
1189
+ }
1190
+
1191
+ 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 ");
1192
+
1193
+ if (this.options.disableSearch !== true) {
1194
+ html += "\n <input id='".concat(this.elementId, "_search' class='websy-dropdown-search' placeholder='").concat(this.options.searchPlaceholder || 'Search', "'>\n ");
1195
+ }
1196
+
1197
+ html += "\n <div id='".concat(this.elementId, "_itemsContainer' class='websy-dropdown-items'>\n <ul id='").concat(this.elementId, "_items'> \n </ul>\n </div><!--\n --><div class='websy-dropdown-custom'></div>\n </div>\n </div>\n ");
1198
+ el.innerHTML = html;
1199
+ var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
1200
+ scrollEl.addEventListener('scroll', this.handleScroll.bind(this));
738
1201
  this.render();
739
1202
  } else {
740
1203
  console.log('No element found with Id', elementId);
@@ -742,6 +1205,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
742
1205
  }
743
1206
 
744
1207
  _createClass(WebsyDropdown, [{
1208
+ key: "appendRows",
1209
+ value: function appendRows() {}
1210
+ }, {
745
1211
  key: "clearSelected",
746
1212
  value: function clearSelected() {
747
1213
  this.selectedItems = [];
@@ -784,6 +1250,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
784
1250
  this.updateSelected(+index);
785
1251
  } else if (event.target.classList.contains('clear')) {
786
1252
  this.clearSelected();
1253
+ } else if (event.target.classList.contains('search')) {
1254
+ var el = document.getElementById("".concat(this.elementId, "_container"));
1255
+ el.classList.toggle('search-open');
787
1256
  }
788
1257
  }
789
1258
  }, {
@@ -864,6 +1333,15 @@ var WebsyDropdown = /*#__PURE__*/function () {
864
1333
  clearTimeout(this.tooltipTimeoutFn);
865
1334
  }
866
1335
  }
1336
+ }, {
1337
+ key: "handleScroll",
1338
+ value: function handleScroll(event) {
1339
+ if (event.target.classList.contains('websy-dropdown-items')) {
1340
+ if (this.options.onScroll) {
1341
+ this.options.onScroll(event);
1342
+ }
1343
+ }
1344
+ }
867
1345
  }, {
868
1346
  key: "open",
869
1347
  value: function open(options) {
@@ -888,7 +1366,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
888
1366
  }, {
889
1367
  key: "render",
890
1368
  value: function render() {
891
- var _this3 = this;
1369
+ <<<<<<< HEAD
1370
+ var _this5 = this;
892
1371
 
893
1372
  if (!this.elementId) {
894
1373
  console.log('No element Id provided for Websy Dropdown');
@@ -897,10 +1376,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
897
1376
 
898
1377
  var el = document.getElementById(this.elementId);
899
1378
  var headerLabel = this.selectedItems.map(function (s) {
900
- return _this3.options.items[s].label || _this3.options.items[s].value;
1379
+ return _this5.options.items[s].label || _this5.options.items[s].value;
901
1380
  }).join(this.options.multiValueDelimiter);
902
1381
  var headerValue = this.selectedItems.map(function (s) {
903
- return _this3.options.items[s].value || _this3.options.items[s].label;
1382
+ return _this5.options.items[s].value || _this5.options.items[s].label;
904
1383
  }).join(this.options.multiValueDelimiter);
905
1384
  var html = "\n <div class='websy-dropdown-container ".concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', "'>\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 <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 ");
906
1385
 
@@ -909,22 +1388,65 @@ var WebsyDropdown = /*#__PURE__*/function () {
909
1388
  }
910
1389
 
911
1390
  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 ");
1391
+ =======
1392
+ if (!this.elementId) {
1393
+ console.log('No element Id provided for Websy Dropdown');
1394
+ return;
1395
+ } // const el = document.getElementById(this.elementId)
1396
+ // const headerLabel = this.selectedItems.map(s => this.options.items[s].label || this.options.items[s].value).join(this.options.multiValueDelimiter)
1397
+ // const headerValue = this.selectedItems.map(s => this.options.items[s].value || this.options.items[s].label).join(this.options.multiValueDelimiter)
1398
+ // let html = `
1399
+ // <div class='websy-dropdown-container ${this.options.disabled ? 'disabled' : ''} ${this.options.disableSearch !== true ? 'with-search' : ''}'>
1400
+ // <div id='${this.elementId}_header' class='websy-dropdown-header ${this.selectedItems.length === 1 ? 'one-selected' : ''} ${this.options.allowClear === true ? 'allow-clear' : ''}'>
1401
+ // <span id='${this.elementId}_headerLabel' class='websy-dropdown-header-label'>${this.options.label}</span>
1402
+ // <span data-info='${headerLabel}' class='websy-dropdown-header-value' id='${this.elementId}_selectedItems'>${headerLabel}</span>
1403
+ // <input class='dropdown-input' id='${this.elementId}_input' name='${this.options.field || this.options.label}' value='${headerValue}'>
1404
+ // <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>
1405
+ // `
1406
+ // if (this.options.allowClear === true) {
1407
+ // html += `
1408
+ // <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>
1409
+ // `
1410
+ // }
1411
+ // html += `
1412
+ // </div>
1413
+ // <div id='${this.elementId}_mask' class='websy-dropdown-mask'></div>
1414
+ // <div id='${this.elementId}_content' class='websy-dropdown-content'>
1415
+ // `
1416
+ // if (this.options.disableSearch !== true) {
1417
+ // html += `
1418
+ // <input id='${this.elementId}_search' class='websy-dropdown-search' placeholder='${this.options.searchPlaceholder || 'Search'}'>
1419
+ // `
1420
+ // }
1421
+ // html += `
1422
+ // <div class='websy-dropdown-items'>
1423
+ // <ul id='${this.elementId}_items'>
1424
+ // </ul>
1425
+ // </div><!--
1426
+ // --><div class='websy-dropdown-custom'></div>
1427
+ // </div>
1428
+ // </div>
1429
+ // `
1430
+ // el.innerHTML = html
1431
+ >>>>>>> master
912
1432
 
913
- if (this.options.disableSearch !== true) {
914
- html += "\n <input id='".concat(this.elementId, "_search' class='websy-dropdown-search' placeholder='").concat(this.options.searchPlaceholder || 'Search', "'>\n ");
915
- }
916
1433
 
917
- html += "\n <div class='websy-dropdown-items'>\n <ul id='".concat(this.elementId, "_items'> \n </ul>\n </div><!--\n --><div class='websy-dropdown-custom'></div>\n </div>\n </div>\n ");
918
- el.innerHTML = html;
919
1434
  this.renderItems();
920
1435
  }
921
1436
  }, {
922
1437
  key: "renderItems",
923
1438
  value: function renderItems() {
924
- var _this4 = this;
1439
+ <<<<<<< HEAD
1440
+ var _this6 = this;
1441
+
1442
+ var html = this.options.items.map(function (r, i) {
1443
+ return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this6.selectedItems.indexOf(i) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
1444
+ =======
1445
+ var _this7 = this;
925
1446
 
926
1447
  var html = this.options.items.map(function (r, i) {
927
- return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this4.selectedItems.indexOf(i) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
1448
+ return "\n <li data-index='".concat(i, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this7.selectedItems.indexOf(i) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
1449
+ >>>>>>> master
928
1450
  }).join('');
929
1451
  var el = document.getElementById("".concat(this.elementId, "_items"));
930
1452
 
@@ -943,7 +1465,11 @@ var WebsyDropdown = /*#__PURE__*/function () {
943
1465
  }, {
944
1466
  key: "updateHeader",
945
1467
  value: function updateHeader(item) {
946
- var _this5 = this;
1468
+ <<<<<<< HEAD
1469
+ var _this7 = this;
1470
+ =======
1471
+ var _this8 = this;
1472
+ >>>>>>> master
947
1473
 
948
1474
  var el = document.getElementById(this.elementId);
949
1475
  var headerEl = document.getElementById("".concat(this.elementId, "_header"));
@@ -981,23 +1507,36 @@ var WebsyDropdown = /*#__PURE__*/function () {
981
1507
 
982
1508
  if (labelEl) {
983
1509
  if (this.selectedItems.length === 1) {
984
- labelEl.innerHTML = item.label;
985
- labelEl.setAttribute('data-info', item.label);
986
- inputEl.value = item.value;
1510
+ if (item) {
1511
+ labelEl.innerHTML = item.label;
1512
+ labelEl.setAttribute('data-info', item.label);
1513
+ inputEl.value = item.value;
1514
+ }
987
1515
  } else if (this.selectedItems.length > 1) {
988
1516
  if (this.options.showCompleteSelectedList === true) {
989
1517
  var selectedLabels = this.selectedItems.map(function (s) {
990
- return _this5.options.items[s].label || _this5.options.items[s].value;
1518
+ <<<<<<< HEAD
1519
+ return _this7.options.items[s].label || _this7.options.items[s].value;
1520
+ }).join(this.options.multiValueDelimiter);
1521
+ var selectedValues = this.selectedItems.map(function (s) {
1522
+ return _this7.options.items[s].value || _this7.options.items[s].label;
1523
+ =======
1524
+ return _this8.options.items[s].label || _this8.options.items[s].value;
991
1525
  }).join(this.options.multiValueDelimiter);
992
1526
  var selectedValues = this.selectedItems.map(function (s) {
993
- return _this5.options.items[s].value || _this5.options.items[s].label;
1527
+ return _this8.options.items[s].value || _this8.options.items[s].label;
1528
+ >>>>>>> master
994
1529
  }).join(this.options.multiValueDelimiter);
995
1530
  labelEl.innerHTML = selectedLabels;
996
1531
  labelEl.setAttribute('data-info', selectedLabels);
997
1532
  inputEl.value = selectedValues;
998
1533
  } else {
999
1534
  var _selectedValues = this.selectedItems.map(function (s) {
1000
- return _this5.options.items[s].value || _this5.options.items[s].label;
1535
+ <<<<<<< HEAD
1536
+ return _this7.options.items[s].value || _this7.options.items[s].label;
1537
+ =======
1538
+ return _this8.options.items[s].value || _this8.options.items[s].label;
1539
+ >>>>>>> master
1001
1540
  }).join(this.options.multiValueDelimiter);
1002
1541
 
1003
1542
  labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
@@ -1103,12 +1642,9 @@ var WebsyForm = /*#__PURE__*/function () {
1103
1642
  var el = document.getElementById(elementId);
1104
1643
 
1105
1644
  if (el) {
1106
- if (this.options.classes) {
1107
- this.options.classes.forEach(function (c) {
1108
- return el.classList.add(c);
1109
- });
1110
- }
1111
-
1645
+ // if (this.options.classes) {
1646
+ // this.options.classes.forEach(c => el.classList.add(c))
1647
+ // }
1112
1648
  el.addEventListener('click', this.handleClick.bind(this));
1113
1649
  el.addEventListener('keyup', this.handleKeyUp.bind(this));
1114
1650
  el.addEventListener('keydown', this.handleKeyDown.bind(this));
@@ -1129,13 +1665,23 @@ var WebsyForm = /*#__PURE__*/function () {
1129
1665
  }, {
1130
1666
  key: "checkRecaptcha",
1131
1667
  value: function checkRecaptcha() {
1132
- var _this6 = this;
1668
+ <<<<<<< HEAD
1669
+ var _this8 = this;
1133
1670
 
1134
1671
  return new Promise(function (resolve, reject) {
1135
- if (_this6.options.useRecaptcha === true) {
1136
- if (_this6.recaptchaValue) {
1137
- _this6.apiService.add('/google/checkrecaptcha', JSON.stringify({
1138
- grecaptcharesponse: _this6.recaptchaValue
1672
+ if (_this8.options.useRecaptcha === true) {
1673
+ if (_this8.recaptchaValue) {
1674
+ _this8.apiService.add('/google/checkrecaptcha', JSON.stringify({
1675
+ grecaptcharesponse: _this8.recaptchaValue
1676
+ =======
1677
+ var _this9 = this;
1678
+
1679
+ return new Promise(function (resolve, reject) {
1680
+ if (_this9.options.useRecaptcha === true) {
1681
+ if (_this9.recaptchaValue) {
1682
+ _this9.apiService.add('/google/checkrecaptcha', JSON.stringify({
1683
+ grecaptcharesponse: _this9.recaptchaValue
1684
+ >>>>>>> master
1139
1685
  })).then(function (response) {
1140
1686
  if (response.success && response.success === true) {
1141
1687
  resolve(true);
@@ -1193,14 +1739,22 @@ var WebsyForm = /*#__PURE__*/function () {
1193
1739
  }, {
1194
1740
  key: "processComponents",
1195
1741
  value: function processComponents(components, callbackFn) {
1196
- var _this7 = this;
1742
+ <<<<<<< HEAD
1743
+ var _this9 = this;
1744
+ =======
1745
+ var _this10 = this;
1746
+ >>>>>>> master
1197
1747
 
1198
1748
  if (components.length === 0) {
1199
1749
  callbackFn();
1200
1750
  } else {
1201
1751
  components.forEach(function (c) {
1202
1752
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
1203
- var comp = new WebsyDesigns[c.component]("".concat(_this7.elementId, "_input_").concat(c.field, "_component"), c.options);
1753
+ <<<<<<< HEAD
1754
+ var comp = new WebsyDesigns[c.component]("".concat(_this9.elementId, "_input_").concat(c.field, "_component"), c.options);
1755
+ =======
1756
+ c.instance = new WebsyDesigns[c.component]("".concat(_this10.elementId, "_input_").concat(c.field, "_component"), c.options);
1757
+ >>>>>>> master
1204
1758
  } else {// some user feedback here
1205
1759
  }
1206
1760
  });
@@ -1221,27 +1775,39 @@ var WebsyForm = /*#__PURE__*/function () {
1221
1775
  }, {
1222
1776
  key: "render",
1223
1777
  value: function render(update, data) {
1224
- var _this8 = this;
1778
+ <<<<<<< HEAD
1779
+ var _this10 = this;
1780
+ =======
1781
+ var _this11 = this;
1782
+ >>>>>>> master
1225
1783
 
1226
1784
  var el = document.getElementById(this.elementId);
1227
1785
  var componentsToProcess = [];
1228
1786
 
1229
1787
  if (el) {
1230
- var html = "\n <form id=\"".concat(this.elementId, "Form\">\n ");
1788
+ var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"").concat(this.options.classes || '', "\">\n ");
1231
1789
  this.options.fields.forEach(function (f, i) {
1232
1790
  if (f.component) {
1233
1791
  componentsToProcess.push(f);
1234
- 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(_this8.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
1792
+ <<<<<<< HEAD
1793
+ 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(_this10.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
1794
+ } else if (f.type === 'longtext') {
1795
+ 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(_this10.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
1796
+ } else {
1797
+ 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(_this10.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
1798
+ =======
1799
+ 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(_this11.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
1235
1800
  } else if (f.type === 'longtext') {
1236
- 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(_this8.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
1801
+ 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(_this11.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
1237
1802
  } else {
1238
- 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(_this8.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
1803
+ 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(_this11.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
1804
+ >>>>>>> master
1239
1805
  }
1240
1806
  });
1241
- html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes, "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
1807
+ html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
1242
1808
 
1243
1809
  if (this.options.cancel) {
1244
- html += "\n --><button class=\"websy-btn cancel ".concat(this.options.cancel.classes, "\">").concat(this.options.cancel.text || 'Cancel', "</button>\n ");
1810
+ html += "\n --><button class=\"websy-btn cancel ".concat(this.options.cancel.classes || '', "\">").concat(this.options.cancel.text || 'Cancel', "</button>\n ");
1245
1811
  }
1246
1812
 
1247
1813
  html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
@@ -1252,8 +1818,13 @@ var WebsyForm = /*#__PURE__*/function () {
1252
1818
 
1253
1819
  el.innerHTML = html;
1254
1820
  this.processComponents(componentsToProcess, function () {
1255
- if (_this8.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
1256
- _this8.recaptchaReady();
1821
+ <<<<<<< HEAD
1822
+ if (_this10.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
1823
+ _this10.recaptchaReady();
1824
+ =======
1825
+ if (_this11.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
1826
+ _this11.recaptchaReady();
1827
+ >>>>>>> master
1257
1828
  }
1258
1829
  });
1259
1830
  }
@@ -1261,7 +1832,11 @@ var WebsyForm = /*#__PURE__*/function () {
1261
1832
  }, {
1262
1833
  key: "submitForm",
1263
1834
  value: function submitForm() {
1264
- var _this9 = this;
1835
+ <<<<<<< HEAD
1836
+ var _this11 = this;
1837
+ =======
1838
+ var _this12 = this;
1839
+ >>>>>>> master
1265
1840
 
1266
1841
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
1267
1842
 
@@ -1275,22 +1850,40 @@ var WebsyForm = /*#__PURE__*/function () {
1275
1850
  data[key] = value;
1276
1851
  });
1277
1852
 
1278
- if (_this9.options.url) {
1279
- _this9.apiService.add(_this9.options.url, data).then(function (result) {
1280
- if (_this9.options.clearAfterSave === true) {
1853
+ <<<<<<< HEAD
1854
+ if (_this11.options.url) {
1855
+ _this11.apiService.add(_this11.options.url, data).then(function (result) {
1856
+ if (_this11.options.clearAfterSave === true) {
1857
+ =======
1858
+ if (_this12.options.url) {
1859
+ _this12.apiService.add(_this12.options.url, data).then(function (result) {
1860
+ if (_this12.options.clearAfterSave === true) {
1861
+ >>>>>>> master
1281
1862
  // this.render()
1282
1863
  formEl.reset();
1283
1864
  }
1284
1865
 
1285
- _this9.options.onSuccess.call(_this9, result);
1866
+ <<<<<<< HEAD
1867
+ _this11.options.onSuccess.call(_this11, result);
1286
1868
  }, function (err) {
1287
1869
  console.log('Error submitting form data:', err);
1288
1870
 
1289
- _this9.options.onError.call(_this9, err);
1871
+ _this11.options.onError.call(_this11, err);
1290
1872
  });
1291
- } else if (_this9.options.submitFn) {
1292
- _this9.options.submitFn(data, function () {
1293
- if (_this9.options.clearAfterSave === true) {
1873
+ } else if (_this11.options.submitFn) {
1874
+ _this11.options.submitFn(data, function () {
1875
+ if (_this11.options.clearAfterSave === true) {
1876
+ =======
1877
+ _this12.options.onSuccess.call(_this12, result);
1878
+ }, function (err) {
1879
+ console.log('Error submitting form data:', err);
1880
+
1881
+ _this12.options.onError.call(_this12, err);
1882
+ });
1883
+ } else if (_this12.options.submitFn) {
1884
+ _this12.options.submitFn(data, function () {
1885
+ if (_this12.options.clearAfterSave === true) {
1886
+ >>>>>>> master
1294
1887
  // this.render()
1295
1888
  formEl.reset();
1296
1889
  }
@@ -1310,17 +1903,28 @@ var WebsyForm = /*#__PURE__*/function () {
1310
1903
  }, {
1311
1904
  key: "data",
1312
1905
  set: function set(d) {
1313
- var _this10 = this;
1906
+ <<<<<<< HEAD
1907
+ var _this12 = this;
1908
+ =======
1909
+ var _this13 = this;
1910
+ >>>>>>> master
1314
1911
 
1315
1912
  if (!this.options.fields) {
1316
1913
  this.options.fields = [];
1317
1914
  }
1318
1915
 
1319
1916
  var _loop = function _loop(key) {
1320
- _this10.options.fields.forEach(function (f) {
1917
+ <<<<<<< HEAD
1918
+ _this12.options.fields.forEach(function (f) {
1321
1919
  if (f.field === key) {
1322
1920
  f.value = d[key];
1323
- var el = document.getElementById("".concat(_this10.elementId, "_input_").concat(f.field));
1921
+ var el = document.getElementById("".concat(_this12.elementId, "_input_").concat(f.field));
1922
+ =======
1923
+ _this13.options.fields.forEach(function (f) {
1924
+ if (f.field === key) {
1925
+ f.value = d[key];
1926
+ var el = document.getElementById("".concat(_this13.elementId, "_input_").concat(f.field));
1927
+ >>>>>>> master
1324
1928
  el.value = f.value;
1325
1929
  }
1326
1930
  });
@@ -1520,10 +2124,6 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
1520
2124
  html += this.renderBlock(this.options.items, 'main', 0);
1521
2125
  html += "</div>";
1522
2126
  el.innerHTML = html;
1523
-
1524
- if (this.options.navigator) {
1525
- this.options.navigator.registerElements(el);
1526
- }
1527
2127
  }
1528
2128
  }
1529
2129
  }, {
@@ -1619,6 +2219,122 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
1619
2219
 
1620
2220
  return WebsyNavigationMenu;
1621
2221
  }();
2222
+ /* global WebsyDesigns */
2223
+
2224
+
2225
+ var Pager = /*#__PURE__*/function () {
2226
+ function Pager(elementId, options) {
2227
+ var _this14 = this;
2228
+
2229
+ _classCallCheck(this, Pager);
2230
+
2231
+ this.elementId = elementId;
2232
+ var DEFAULTS = {
2233
+ pageSizePrefix: 'Show',
2234
+ pageSizeSuffix: 'rows',
2235
+ pageSizeOptions: [{
2236
+ label: '10',
2237
+ value: 10
2238
+ }, {
2239
+ label: '20',
2240
+ value: 20
2241
+ }, {
2242
+ label: '50',
2243
+ value: 50
2244
+ }, {
2245
+ label: '100',
2246
+ value: 100
2247
+ }],
2248
+ selectedPageSize: 20,
2249
+ pageLabel: 'Page',
2250
+ showPageSize: true,
2251
+ activePage: 0,
2252
+ pages: []
2253
+ };
2254
+ this.options = _extends({}, DEFAULTS, options);
2255
+ var el = document.getElementById(this.elementId);
2256
+
2257
+ if (el) {
2258
+ var html = "\n <div class=\"websy-pager-container\">\n ";
2259
+
2260
+ if (this.options.showPageSize === true) {
2261
+ html += "\n ".concat(this.options.pageSizePrefix, " <div id=\"").concat(this.elementId, "_pageSizeSelector\" class=\"websy-page-selector\"></div> ").concat(this.options.pageSizeSuffix, " \n ");
2262
+ }
2263
+
2264
+ html += "\n <ul id=\"".concat(this.elementId, "_pageList\" class=\"websy-page-list\"></ul> \n </div> \n ");
2265
+ el.innerHTML = html;
2266
+ el.addEventListener('click', this.handleClick.bind(this));
2267
+
2268
+ if (this.options.showPageSize === true) {
2269
+ this.pageSizeSelector = new WebsyDesigns.Dropdown("".concat(this.elementId, "_pageSizeSelector"), {
2270
+ selectedItems: [this.options.pageSizeOptions.indexOf(this.options.selectedPageSize)],
2271
+ items: this.pageSizeOptions.map(function (p) {
2272
+ return {
2273
+ label: p.toString(),
2274
+ value: p
2275
+ };
2276
+ }),
2277
+ allowClear: false,
2278
+ disableSearch: true,
2279
+ onItemSelected: function onItemSelected(selectedItem) {
2280
+ if (_this14.options.onChangePageSize) {
2281
+ _this14.options.onChangePageSize(selectedItem.value);
2282
+ }
2283
+ }
2284
+ });
2285
+ }
2286
+
2287
+ this.render();
2288
+ }
2289
+ }
2290
+
2291
+ _createClass(Pager, [{
2292
+ key: "handleClick",
2293
+ value: function handleClick(event) {
2294
+ if (event.target.classList.contains('websy-page-num')) {
2295
+ var pageNum = +event.target.getAttribute('data-index');
2296
+
2297
+ if (this.options.onSetPage) {
2298
+ this.options.onSetPage(this.options.pages[pageNum]);
2299
+ }
2300
+ }
2301
+ }
2302
+ }, {
2303
+ key: "render",
2304
+ value: function render() {
2305
+ var _this15 = this;
2306
+
2307
+ var el = document.getElementById("".concat(this.elementId, "_pageList"));
2308
+
2309
+ if (el) {
2310
+ var pages = this.options.pages.map(function (item, index) {
2311
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this15.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2312
+ });
2313
+ var startIndex = 0;
2314
+
2315
+ if (this.options.pages.length > 8) {
2316
+ startIndex = Math.max(0, this.options.activePage - 4);
2317
+ pages = pages.splice(startIndex, 10);
2318
+
2319
+ if (startIndex > 0) {
2320
+ pages.splice(0, 0, "<li>".concat(this.options.pageLabel, "&nbsp;</li><li data-page=\"0\" class=\"websy-page-num\">First</li><li>...</li>"));
2321
+ } else {
2322
+ pages.splice(0, 0, "<li>".concat(this.options.pageLabel, "&nbsp;</li>"));
2323
+ }
2324
+
2325
+ if (this.options.activePage < this.options.pages.length - 1) {
2326
+ pages.push('<li>...</li>');
2327
+ pages.push("<li data-page=\"".concat(this.options.pages.length - 1, "\" class=\"websy-page-num\">Last</li>"));
2328
+ }
2329
+ }
2330
+
2331
+ el.innerHTML = pages.join('');
2332
+ }
2333
+ }
2334
+ }]);
2335
+
2336
+ return Pager;
2337
+ }();
1622
2338
  /* global WebsyDesigns Blob */
1623
2339
 
1624
2340
 
@@ -1660,58 +2376,107 @@ var WebsyPDFButton = /*#__PURE__*/function () {
1660
2376
  _createClass(WebsyPDFButton, [{
1661
2377
  key: "handleClick",
1662
2378
  value: function handleClick(event) {
1663
- var _this11 = this;
2379
+ <<<<<<< HEAD
2380
+ var _this13 = this;
2381
+ =======
2382
+ var _this16 = this;
2383
+ >>>>>>> master
1664
2384
 
1665
2385
  if (event.target.classList.contains('websy-pdf-button')) {
1666
2386
  this.loader.show();
1667
2387
  setTimeout(function () {
1668
- if (_this11.options.targetId) {
1669
- var el = document.getElementById(_this11.options.targetId);
2388
+ <<<<<<< HEAD
2389
+ if (_this13.options.targetId) {
2390
+ var el = document.getElementById(_this13.options.targetId);
2391
+ =======
2392
+ if (_this16.options.targetId) {
2393
+ var el = document.getElementById(_this16.options.targetId);
2394
+ >>>>>>> master
1670
2395
 
1671
2396
  if (el) {
1672
2397
  var pdfData = {
1673
2398
  options: {}
1674
2399
  };
1675
2400
 
1676
- if (_this11.options.pdfOptions) {
1677
- pdfData.options = _extends({}, _this11.options.pdfOptions);
2401
+ <<<<<<< HEAD
2402
+ if (_this13.options.pdfOptions) {
2403
+ pdfData.options = _extends({}, _this13.options.pdfOptions);
1678
2404
  }
1679
2405
 
1680
- if (_this11.options.header) {
1681
- if (_this11.options.header.elementId) {
1682
- var headerEl = document.getElementById(_this11.options.header.elementId);
2406
+ if (_this13.options.header) {
2407
+ if (_this13.options.header.elementId) {
2408
+ var headerEl = document.getElementById(_this13.options.header.elementId);
2409
+ =======
2410
+ if (_this16.options.pdfOptions) {
2411
+ pdfData.options = _extends({}, _this16.options.pdfOptions);
2412
+ }
2413
+
2414
+ if (_this16.options.header) {
2415
+ if (_this16.options.header.elementId) {
2416
+ var headerEl = document.getElementById(_this16.options.header.elementId);
2417
+ >>>>>>> master
1683
2418
 
1684
2419
  if (headerEl) {
1685
2420
  pdfData.header = headerEl.outerHTML;
1686
2421
 
1687
- if (_this11.options.header.css) {
1688
- pdfData.options.headerCSS = _this11.options.header.css;
2422
+ <<<<<<< HEAD
2423
+ if (_this13.options.header.css) {
2424
+ pdfData.options.headerCSS = _this13.options.header.css;
2425
+ }
2426
+ }
2427
+ } else if (_this13.options.header.html) {
2428
+ pdfData.header = _this13.options.header.html;
2429
+
2430
+ if (_this13.options.header.css) {
2431
+ pdfData.options.headerCSS = _this13.options.header.css;
2432
+ }
2433
+ } else {
2434
+ pdfData.header = _this13.options.header;
2435
+ }
2436
+ }
2437
+
2438
+ if (_this13.options.footer) {
2439
+ if (_this13.options.footer.elementId) {
2440
+ var footerEl = document.getElementById(_this13.options.footer.elementId);
2441
+ =======
2442
+ if (_this16.options.header.css) {
2443
+ pdfData.options.headerCSS = _this16.options.header.css;
1689
2444
  }
1690
2445
  }
1691
- } else if (_this11.options.header.html) {
1692
- pdfData.header = _this11.options.header.html;
2446
+ } else if (_this16.options.header.html) {
2447
+ pdfData.header = _this16.options.header.html;
1693
2448
 
1694
- if (_this11.options.header.css) {
1695
- pdfData.options.headerCSS = _this11.options.header.css;
2449
+ if (_this16.options.header.css) {
2450
+ pdfData.options.headerCSS = _this16.options.header.css;
1696
2451
  }
1697
2452
  } else {
1698
- pdfData.header = _this11.options.header;
2453
+ pdfData.header = _this16.options.header;
1699
2454
  }
1700
2455
  }
1701
2456
 
1702
- if (_this11.options.footer) {
1703
- if (_this11.options.footer.elementId) {
1704
- var footerEl = document.getElementById(_this11.options.footer.elementId);
2457
+ if (_this16.options.footer) {
2458
+ if (_this16.options.footer.elementId) {
2459
+ var footerEl = document.getElementById(_this16.options.footer.elementId);
2460
+ >>>>>>> master
1705
2461
 
1706
2462
  if (footerEl) {
1707
2463
  pdfData.footer = footerEl.outerHTML;
1708
2464
 
1709
- if (_this11.options.footer.css) {
1710
- pdfData.options.footerCSS = _this11.options.footer.css;
2465
+ <<<<<<< HEAD
2466
+ if (_this13.options.footer.css) {
2467
+ pdfData.options.footerCSS = _this13.options.footer.css;
1711
2468
  }
1712
2469
  }
1713
2470
  } else {
1714
- pdfData.footer = _this11.options.footer;
2471
+ pdfData.footer = _this13.options.footer;
2472
+ =======
2473
+ if (_this16.options.footer.css) {
2474
+ pdfData.options.footerCSS = _this16.options.footer.css;
2475
+ }
2476
+ }
2477
+ } else {
2478
+ pdfData.footer = _this16.options.footer;
2479
+ >>>>>>> master
1715
2480
  }
1716
2481
  }
1717
2482
 
@@ -1720,23 +2485,40 @@ var WebsyPDFButton = /*#__PURE__*/function () {
1720
2485
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
1721
2486
  // document.getElementById(`${this.elementId}_form`).submit()
1722
2487
 
1723
- _this11.service.add('', pdfData, {
2488
+ <<<<<<< HEAD
2489
+ _this13.service.add('', pdfData, {
1724
2490
  responseType: 'blob'
1725
2491
  }).then(function (response) {
1726
- _this11.loader.hide();
2492
+ _this13.loader.hide();
2493
+ =======
2494
+ _this16.service.add('', pdfData, {
2495
+ responseType: 'blob'
2496
+ }).then(function (response) {
2497
+ _this16.loader.hide();
2498
+ >>>>>>> master
1727
2499
 
1728
2500
  var blob = new Blob([response], {
1729
2501
  type: 'application/pdf'
1730
2502
  });
1731
2503
  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 ");
1732
2504
 
1733
- if (_this11.options.directDownload === true) {
1734
- msg += "download='".concat(_this11.options.fileName || 'Export', ".pdf'");
2505
+ <<<<<<< HEAD
2506
+ if (_this13.options.directDownload === true) {
2507
+ msg += "download='".concat(_this13.options.fileName || 'Export', ".pdf'");
2508
+ }
2509
+
2510
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this13.options.buttonText, "</button>\n </a>\n </div>\n ");
2511
+
2512
+ _this13.popup.show({
2513
+ =======
2514
+ if (_this16.options.directDownload === true) {
2515
+ msg += "download='".concat(_this16.options.fileName || 'Export', ".pdf'");
1735
2516
  }
1736
2517
 
1737
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this11.options.buttonText, "</button>\n </a>\n </div>\n ");
2518
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this16.options.buttonText, "</button>\n </a>\n </div>\n ");
1738
2519
 
1739
- _this11.popup.show({
2520
+ _this16.popup.show({
2521
+ >>>>>>> master
1740
2522
  message: msg,
1741
2523
  mask: true
1742
2524
  });
@@ -1921,7 +2703,11 @@ var WebsyPubSub = /*#__PURE__*/function () {
1921
2703
 
1922
2704
  var WebsyResultList = /*#__PURE__*/function () {
1923
2705
  function WebsyResultList(elementId, options) {
1924
- var _this12 = this;
2706
+ <<<<<<< HEAD
2707
+ var _this14 = this;
2708
+ =======
2709
+ var _this17 = this;
2710
+ >>>>>>> master
1925
2711
 
1926
2712
  _classCallCheck(this, WebsyResultList);
1927
2713
 
@@ -1949,9 +2735,15 @@ var WebsyResultList = /*#__PURE__*/function () {
1949
2735
 
1950
2736
  if (_typeof(options.template) === 'object' && options.template.url) {
1951
2737
  this.templateService.get(options.template.url).then(function (templateString) {
1952
- _this12.options.template = templateString;
2738
+ <<<<<<< HEAD
2739
+ _this14.options.template = templateString;
2740
+
2741
+ _this14.render();
2742
+ =======
2743
+ _this17.options.template = templateString;
1953
2744
 
1954
- _this12.render();
2745
+ _this17.render();
2746
+ >>>>>>> master
1955
2747
  });
1956
2748
  } else {
1957
2749
  this.render();
@@ -1970,7 +2762,11 @@ var WebsyResultList = /*#__PURE__*/function () {
1970
2762
  }, {
1971
2763
  key: "buildHTML",
1972
2764
  value: function buildHTML(d) {
1973
- var _this13 = this;
2765
+ <<<<<<< HEAD
2766
+ var _this15 = this;
2767
+ =======
2768
+ var _this18 = this;
2769
+ >>>>>>> master
1974
2770
 
1975
2771
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1976
2772
  var html = "";
@@ -1978,7 +2774,11 @@ var WebsyResultList = /*#__PURE__*/function () {
1978
2774
  if (this.options.template) {
1979
2775
  if (d.length > 0) {
1980
2776
  d.forEach(function (row, ix) {
1981
- var template = "".concat(ix > 0 ? '-->' : '').concat(_this13.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
2777
+ <<<<<<< HEAD
2778
+ var template = "".concat(ix > 0 ? '-->' : '').concat(_this15.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
2779
+ =======
2780
+ var template = "".concat(ix > 0 ? '-->' : '').concat(_this18.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
2781
+ >>>>>>> master
1982
2782
 
1983
2783
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
1984
2784
 
@@ -2098,7 +2898,11 @@ var WebsyResultList = /*#__PURE__*/function () {
2098
2898
  }, {
2099
2899
  key: "handleClick",
2100
2900
  value: function handleClick(event) {
2101
- var _this14 = this;
2901
+ <<<<<<< HEAD
2902
+ var _this16 = this;
2903
+ =======
2904
+ var _this19 = this;
2905
+ >>>>>>> master
2102
2906
 
2103
2907
  if (event.target.classList.contains('clickable')) {
2104
2908
  var l = event.target.getAttribute('data-event');
@@ -2116,8 +2920,13 @@ var WebsyResultList = /*#__PURE__*/function () {
2116
2920
  l = l[0];
2117
2921
  params = params.map(function (p) {
2118
2922
  if (typeof p !== 'string' && typeof p !== 'number') {
2119
- if (_this14.rows[+id]) {
2120
- p = _this14.rows[+id][p];
2923
+ <<<<<<< HEAD
2924
+ if (_this16.rows[+id]) {
2925
+ p = _this16.rows[+id][p];
2926
+ =======
2927
+ if (_this19.rows[+id]) {
2928
+ p = _this19.rows[+id][p];
2929
+ >>>>>>> master
2121
2930
  }
2122
2931
  } else if (typeof p === 'string') {
2123
2932
  p = p.replace(/"/g, '').replace(/'/g, '');
@@ -2139,13 +2948,23 @@ var WebsyResultList = /*#__PURE__*/function () {
2139
2948
  }, {
2140
2949
  key: "render",
2141
2950
  value: function render() {
2142
- var _this15 = this;
2951
+ <<<<<<< HEAD
2952
+ var _this17 = this;
2953
+
2954
+ if (this.options.entity) {
2955
+ this.apiService.get(this.options.entity).then(function (results) {
2956
+ _this17.rows = results.rows;
2957
+
2958
+ _this17.resize();
2959
+ =======
2960
+ var _this20 = this;
2143
2961
 
2144
2962
  if (this.options.entity) {
2145
2963
  this.apiService.get(this.options.entity).then(function (results) {
2146
- _this15.rows = results.rows;
2964
+ _this20.rows = results.rows;
2147
2965
 
2148
- _this15.resize();
2966
+ _this20.resize();
2967
+ >>>>>>> master
2149
2968
  });
2150
2969
  } else {
2151
2970
  this.resize();
@@ -2224,7 +3043,11 @@ var WebsyRouter = /*#__PURE__*/function () {
2224
3043
  _createClass(WebsyRouter, [{
2225
3044
  key: "addGroup",
2226
3045
  value: function addGroup(group) {
2227
- var _this16 = this;
3046
+ <<<<<<< HEAD
3047
+ var _this18 = this;
3048
+ =======
3049
+ var _this21 = this;
3050
+ >>>>>>> master
2228
3051
 
2229
3052
  if (!this.groups[group]) {
2230
3053
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
@@ -2232,7 +3055,11 @@ var WebsyRouter = /*#__PURE__*/function () {
2232
3055
  if (els) {
2233
3056
  console.log('els', els);
2234
3057
  this.getClosestParent(els[0], function (parent) {
2235
- _this16.groups[group] = {
3058
+ <<<<<<< HEAD
3059
+ _this18.groups[group] = {
3060
+ =======
3061
+ _this21.groups[group] = {
3062
+ >>>>>>> master
2236
3063
  activeView: '',
2237
3064
  views: [],
2238
3065
  parent: parent.getAttribute('data-view')
@@ -2553,12 +3380,20 @@ var WebsyRouter = /*#__PURE__*/function () {
2553
3380
  }, {
2554
3381
  key: "showComponents",
2555
3382
  value: function showComponents(view) {
2556
- var _this17 = this;
3383
+ <<<<<<< HEAD
3384
+ var _this19 = this;
3385
+ =======
3386
+ var _this22 = this;
3387
+ >>>>>>> master
2557
3388
 
2558
3389
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
2559
3390
  this.options.views[view].components.forEach(function (c) {
2560
3391
  if (typeof c.instance === 'undefined') {
2561
- _this17.prepComponent(c.elementId, c.options);
3392
+ <<<<<<< HEAD
3393
+ _this19.prepComponent(c.elementId, c.options);
3394
+ =======
3395
+ _this22.prepComponent(c.elementId, c.options);
3396
+ >>>>>>> master
2562
3397
 
2563
3398
  c.instance = new c.Component(c.elementId, c.options);
2564
3399
  } else if (c.instance.render) {
@@ -2925,7 +3760,11 @@ var Switch = /*#__PURE__*/function () {
2925
3760
 
2926
3761
  var WebsyTemplate = /*#__PURE__*/function () {
2927
3762
  function WebsyTemplate(elementId, options) {
2928
- var _this18 = this;
3763
+ <<<<<<< HEAD
3764
+ var _this20 = this;
3765
+ =======
3766
+ var _this23 = this;
3767
+ >>>>>>> master
2929
3768
 
2930
3769
  _classCallCheck(this, WebsyTemplate);
2931
3770
 
@@ -2951,9 +3790,15 @@ var WebsyTemplate = /*#__PURE__*/function () {
2951
3790
 
2952
3791
  if (_typeof(options.template) === 'object' && options.template.url) {
2953
3792
  this.templateService.get(options.template.url).then(function (templateString) {
2954
- _this18.options.template = templateString;
3793
+ <<<<<<< HEAD
3794
+ _this20.options.template = templateString;
2955
3795
 
2956
- _this18.render();
3796
+ _this20.render();
3797
+ =======
3798
+ _this23.options.template = templateString;
3799
+
3800
+ _this23.render();
3801
+ >>>>>>> master
2957
3802
  });
2958
3803
  } else {
2959
3804
  this.render();
@@ -2963,7 +3808,11 @@ var WebsyTemplate = /*#__PURE__*/function () {
2963
3808
  _createClass(WebsyTemplate, [{
2964
3809
  key: "buildHTML",
2965
3810
  value: function buildHTML() {
2966
- var _this19 = this;
3811
+ <<<<<<< HEAD
3812
+ var _this21 = this;
3813
+ =======
3814
+ var _this24 = this;
3815
+ >>>>>>> master
2967
3816
 
2968
3817
  var html = "";
2969
3818
 
@@ -3025,14 +3874,22 @@ var WebsyTemplate = /*#__PURE__*/function () {
3025
3874
  }
3026
3875
 
3027
3876
  if (polarity === true) {
3028
- if (typeof _this19.options.data[parts[0]] !== 'undefined' && _this19.options.data[parts[0]] === parts[1]) {
3877
+ <<<<<<< HEAD
3878
+ if (typeof _this21.options.data[parts[0]] !== 'undefined' && _this21.options.data[parts[0]] === parts[1]) {
3879
+ =======
3880
+ if (typeof _this24.options.data[parts[0]] !== 'undefined' && _this24.options.data[parts[0]] === parts[1]) {
3881
+ >>>>>>> master
3029
3882
  // remove the <if> tags
3030
3883
  removeAll = false;
3031
3884
  } else if (parts[0] === parts[1]) {
3032
3885
  removeAll = false;
3033
3886
  }
3034
3887
  } else if (polarity === false) {
3035
- if (typeof _this19.options.data[parts[0]] !== 'undefined' && _this19.options.data[parts[0]] !== parts[1]) {
3888
+ <<<<<<< HEAD
3889
+ if (typeof _this21.options.data[parts[0]] !== 'undefined' && _this21.options.data[parts[0]] !== parts[1]) {
3890
+ =======
3891
+ if (typeof _this24.options.data[parts[0]] !== 'undefined' && _this24.options.data[parts[0]] !== parts[1]) {
3892
+ >>>>>>> master
3036
3893
  // remove the <if> tags
3037
3894
  removeAll = false;
3038
3895
  }
@@ -3231,82 +4088,507 @@ var WebsyUtils = {
3231
4088
  // }
3232
4089
 
3233
4090
  }
3234
- }
4091
+ }
4092
+
4093
+ if (isPercentage === true) {
4094
+ numOut = numOut * 100;
4095
+ }
4096
+
4097
+ if (numOut % 1 > 0) {
4098
+ decimals = 1;
4099
+ }
4100
+
4101
+ if (numOut < 1) {
4102
+ decimals = getZeroDecimals(numOut);
4103
+ }
4104
+
4105
+ numOut = (+numOut).toFixed(decimals);
4106
+
4107
+ if (test === true) {
4108
+ return numOut;
4109
+ }
4110
+
4111
+ if (numOut.replace) {
4112
+ numOut = numOut.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
4113
+ }
4114
+
4115
+ function getDivider(n) {
4116
+ var s = '';
4117
+ var d = 1; // let out
4118
+
4119
+ for (var _i6 = 0; _i6 < ranges.length; _i6++) {
4120
+ if (n >= ranges[_i6].divider) {
4121
+ d = ranges[_i6].divider;
4122
+ s = ranges[_i6].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
4123
+
4124
+ break;
4125
+ }
4126
+ }
4127
+
4128
+ return {
4129
+ divider: d,
4130
+ suffix: s
4131
+ };
4132
+ }
4133
+
4134
+ function getZeroDecimals(n) {
4135
+ var d = 0;
4136
+ n = Math.abs(n);
4137
+
4138
+ if (n === 0) {
4139
+ return 0;
4140
+ }
4141
+
4142
+ while (n < 10) {
4143
+ d++;
4144
+ n = n * 10;
4145
+ }
4146
+
4147
+ return d;
4148
+ }
4149
+
4150
+ return "".concat(numOut).concat(suffix).concat(isPercentage === true ? '%' : '');
4151
+ },
4152
+ toQlikDateNum: function toQlikDateNum(d) {
4153
+ return Math.floor(d.getTime() / 86400000 + 25570);
4154
+ }
4155
+ };
4156
+ /* global WebsyDesigns */
4157
+
4158
+ var WebsyTable = /*#__PURE__*/function () {
4159
+ function WebsyTable(elementId, options) {
4160
+ <<<<<<< HEAD
4161
+ var _this22 = this;
4162
+ =======
4163
+ var _this25 = this;
4164
+ >>>>>>> master
4165
+
4166
+ _classCallCheck(this, WebsyTable);
4167
+
4168
+ var DEFAULTS = {
4169
+ pageSize: 20,
4170
+ paging: 'scroll'
4171
+ };
4172
+ this.elementId = elementId;
4173
+ this.options = _extends({}, DEFAULTS, options);
4174
+ this.rowCount = 0;
4175
+ this.busy = false;
4176
+ this.tooltipTimeoutFn = null;
4177
+ this.data = [];
4178
+ var el = document.getElementById(this.elementId);
4179
+
4180
+ if (el) {
4181
+ var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table ").concat(this.options.paging === 'pages' ? 'with-paging' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <table>\n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n <tfoot id=\"").concat(this.elementId, "_foot\">\n </tfoot>\n </table> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
4182
+
4183
+ if (this.options.paging === 'pages') {
4184
+ html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
4185
+ }
4186
+
4187
+ var pageOptions = [10, 20, 50, 100, 200];
4188
+ el.innerHTML = html;
4189
+
4190
+ if (this.options.paging === 'pages') {
4191
+ this.pageSizeSelector = new WebsyDesigns.Dropdown("".concat(this.elementId, "_pageSizeSelector"), {
4192
+ selectedItems: [pageOptions.indexOf(this.options.pageSize)],
4193
+ items: pageOptions.map(function (p) {
4194
+ return {
4195
+ label: p.toString(),
4196
+ value: p
4197
+ };
4198
+ }),
4199
+ allowClear: false,
4200
+ disableSearch: true,
4201
+ onItemSelected: function onItemSelected(selectedItem) {
4202
+ <<<<<<< HEAD
4203
+ if (_this22.options.onChangePageSize) {
4204
+ _this22.options.onChangePageSize(selectedItem.value);
4205
+ =======
4206
+ if (_this25.options.onChangePageSize) {
4207
+ _this25.options.onChangePageSize(selectedItem.value);
4208
+ >>>>>>> master
4209
+ }
4210
+ }
4211
+ });
4212
+ }
4213
+
4214
+ el.addEventListener('click', this.handleClick.bind(this));
4215
+ el.addEventListener('mouseout', this.handleMouseOut.bind(this));
4216
+ el.addEventListener('mousemove', this.handleMouseMove.bind(this));
4217
+ var scrollEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
4218
+ scrollEl.addEventListener('scroll', this.handleScroll.bind(this));
4219
+ this.loadingDialog = new WebsyDesigns.LoadingDialog("".concat(this.elementId, "_loadingContainer"));
4220
+ this.render();
4221
+ } else {
4222
+ console.error("No element found with ID ".concat(this.elementId));
4223
+ }
4224
+ }
4225
+
4226
+ _createClass(WebsyTable, [{
4227
+ key: "appendRows",
4228
+ value: function appendRows(data) {
4229
+ <<<<<<< HEAD
4230
+ var _this23 = this;
4231
+ =======
4232
+ var _this26 = this;
4233
+ >>>>>>> master
4234
+
4235
+ this.hideError();
4236
+ var bodyHTML = '';
4237
+
4238
+ if (data) {
4239
+ bodyHTML += data.map(function (r, rowIndex) {
4240
+ return '<tr>' + r.map(function (c, i) {
4241
+ <<<<<<< HEAD
4242
+ if (_this23.options.columns[i].show !== false) {
4243
+ =======
4244
+ if (_this26.options.columns[i].show !== false) {
4245
+ >>>>>>> master
4246
+ var style = '';
4247
+
4248
+ if (c.style) {
4249
+ style += c.style;
4250
+ }
4251
+
4252
+ <<<<<<< HEAD
4253
+ if (_this23.options.columns[i].width) {
4254
+ style += "width: ".concat(_this23.options.columns[i].width, "; ");
4255
+ =======
4256
+ if (_this26.options.columns[i].width) {
4257
+ style += "width: ".concat(_this26.options.columns[i].width, "; ");
4258
+ >>>>>>> master
4259
+ }
4260
+
4261
+ if (c.backgroundColor) {
4262
+ style += "background-color: ".concat(c.backgroundColor, "; ");
4263
+
4264
+ if (!c.color) {
4265
+ style += "color: ".concat(WebsyDesigns.Utils.getLightDark(c.backgroundColor), "; ");
4266
+ }
4267
+ }
4268
+
4269
+ if (c.color) {
4270
+ style += "color: ".concat(c.color, "; ");
4271
+ }
4272
+
4273
+ <<<<<<< HEAD
4274
+ if (_this23.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4275
+ return "\n <td \n data-row-index='".concat(_this23.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this23.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(_this23.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this23.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4276
+ } else if ((_this23.options.columns[i].showAsNavigatorLink === true || _this23.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4277
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this23.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this23.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this23.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this23.options.columns[i].linkText || c.value, "</td>\n ");
4278
+ } else {
4279
+ var info = c.value;
4280
+
4281
+ if (_this23.options.columns[i].showAsImage === true) {
4282
+ c.value = "\n <img src='".concat(c.value, "'>\n ");
4283
+ }
4284
+
4285
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this23.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this23.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 ");
4286
+ =======
4287
+ if (_this26.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4288
+ return "\n <td \n data-row-index='".concat(_this26.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this26.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(_this26.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this26.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4289
+ } else if ((_this26.options.columns[i].showAsNavigatorLink === true || _this26.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4290
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this26.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this26.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this26.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this26.options.columns[i].linkText || c.value, "</td>\n ");
4291
+ } else {
4292
+ var info = c.value;
4293
+
4294
+ if (_this26.options.columns[i].showAsImage === true) {
4295
+ c.value = "\n <img src='".concat(c.value, "'>\n ");
4296
+ }
4297
+
4298
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this26.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this26.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 ");
4299
+ >>>>>>> master
4300
+ }
4301
+ }
4302
+ }).join('') + '</tr>';
4303
+ }).join('');
4304
+ this.data = this.data.concat(data);
4305
+ this.rowCount = this.data.length;
4306
+ }
4307
+
4308
+ var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
4309
+ bodyEl.innerHTML += bodyHTML;
4310
+ }
4311
+ }, {
4312
+ key: "buildSearchIcon",
4313
+ value: function buildSearchIcon(field) {
4314
+ return "\n <div>\n <svg\n class=\"tableSearchIcon\"\n data-field=\"".concat(field, "\"\n xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\"/>\n </svg>\n </div>\n ");
4315
+ }
4316
+ }, {
4317
+ key: "handleClick",
4318
+ value: function handleClick(event) {
4319
+ if (event.target.classList.contains('download-button')) {
4320
+ window.viewManager.dataExportController.exportData(this.options.model);
4321
+ }
4322
+
4323
+ if (event.target.classList.contains('sortable-column')) {
4324
+ var colIndex = +event.target.getAttribute('data-index');
4325
+ var column = this.options.columns[colIndex];
4326
+
4327
+ if (this.options.onSort) {
4328
+ this.options.onSort(event, column, colIndex);
4329
+ } else {
4330
+ this.internalSort(column, colIndex);
4331
+ } // const colIndex = +event.target.getAttribute('data-index')
4332
+ // const dimIndex = +event.target.getAttribute('data-dim-index')
4333
+ // const expIndex = +event.target.getAttribute('data-exp-index')
4334
+ // const reverse = event.target.getAttribute('data-reverse') === 'true'
4335
+ // const patchDefs = [{
4336
+ // qOp: 'replace',
4337
+ // qPath: '/qHyperCubeDef/qInterColumnSortOrder',
4338
+ // qValue: JSON.stringify([colIndex])
4339
+ // }]
4340
+ // patchDefs.push({
4341
+ // qOp: 'replace',
4342
+ // qPath: `/qHyperCubeDef/${dimIndex > -1 ? 'qDimensions' : 'qMeasures'}/${dimIndex > -1 ? dimIndex : expIndex}/qDef/qReverseSort`,
4343
+ // qValue: JSON.stringify(reverse)
4344
+ // })
4345
+ // this.options.model.applyPatches(patchDefs) // .then(() => this.render())
4346
+
4347
+ } else if (event.target.classList.contains('tableSearchIcon')) {
4348
+ var field = event.target.getAttribute('data-field');
4349
+ window.viewManager.views.global.objects[1].instance.show(field, {
4350
+ x: event.pageX,
4351
+ y: event.pageY
4352
+ }, function () {
4353
+ event.target.classList.remove('active');
4354
+ });
4355
+ } else if (event.target.classList.contains('clickable')) {
4356
+ var _colIndex = +event.target.getAttribute('data-col-index');
4357
+
4358
+ var rowIndex = +event.target.getAttribute('data-row-index');
4359
+
4360
+ if (this.options.onClick) {
4361
+ this.options.onClick(event, this.data[rowIndex][_colIndex], this.data[rowIndex], this.options.columns[_colIndex]);
4362
+ }
4363
+ } else if (event.target.classList.contains('websy-page-num')) {
4364
+ var pageNum = +event.target.getAttribute('data-page');
4365
+
4366
+ if (this.options.onSetPage) {
4367
+ this.options.onSetPage(pageNum);
4368
+ }
4369
+ }
4370
+ }
4371
+ }, {
4372
+ key: "handleMouseMove",
4373
+ value: function handleMouseMove(event) {
4374
+ if (this.tooltipTimeoutFn) {
4375
+ event.target.classList.remove('websy-delayed-info');
4376
+ clearTimeout(this.tooltipTimeoutFn);
4377
+ }
4378
+
4379
+ if (event.target.tagName === 'TD') {
4380
+ this.tooltipTimeoutFn = setTimeout(function () {
4381
+ event.target.classList.add('websy-delayed-info');
4382
+ }, 500);
4383
+ }
4384
+ }
4385
+ }, {
4386
+ key: "handleMouseOut",
4387
+ value: function handleMouseOut(event) {
4388
+ if (this.tooltipTimeoutFn) {
4389
+ event.target.classList.remove('websy-delayed-info');
4390
+ clearTimeout(this.tooltipTimeoutFn);
4391
+ }
4392
+ }
4393
+ }, {
4394
+ key: "handleScroll",
4395
+ value: function handleScroll(event) {
4396
+ if (this.options.onScroll && this.options.paging === 'scroll') {
4397
+ this.options.onScroll(event);
4398
+ }
4399
+ }
4400
+ }, {
4401
+ key: "hideError",
4402
+ value: function hideError() {
4403
+ var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
4404
+
4405
+ if (containerEl) {
4406
+ containerEl.classList.remove('active');
4407
+ }
4408
+ }
4409
+ }, {
4410
+ key: "hideLoading",
4411
+ value: function hideLoading() {
4412
+ this.loadingDialog.hide();
4413
+ }
4414
+ }, {
4415
+ key: "internalSort",
4416
+ value: function internalSort(column, colIndex) {
4417
+ this.options.columns.forEach(function (c, i) {
4418
+ c.activeSort = i === colIndex;
4419
+ });
4420
+
4421
+ if (column.sortFunction) {
4422
+ this.data = column.sortFunction(this.data, column);
4423
+ } else {
4424
+ var sortProp = 'value';
4425
+ var sortOrder = column.sort === 'asc' ? 'desc' : 'asc';
4426
+ column.sort = sortOrder;
4427
+ var sortType = column.sortType || 'alphanumeric';
4428
+
4429
+ if (column.sortProp) {
4430
+ sortProp = column.sortProp;
4431
+ }
4432
+
4433
+ this.data.sort(function (a, b) {
4434
+ switch (sortType) {
4435
+ case 'numeric':
4436
+ if (sortOrder === 'asc') {
4437
+ return a[colIndex][sortProp] - b[colIndex][sortProp];
4438
+ } else {
4439
+ return b[colIndex][sortProp] - a[colIndex][sortProp];
4440
+ }
4441
+
4442
+ default:
4443
+ if (sortOrder === 'asc') {
4444
+ return a[colIndex][sortProp] > b[colIndex][sortProp] ? 1 : -1;
4445
+ } else {
4446
+ return a[colIndex][sortProp] < b[colIndex][sortProp] ? 1 : -1;
4447
+ }
4448
+
4449
+ }
4450
+ });
4451
+ }
4452
+
4453
+ this.render(this.data);
4454
+ }
4455
+ }, {
4456
+ key: "render",
4457
+ value: function render(data) {
4458
+ <<<<<<< HEAD
4459
+ var _this24 = this;
4460
+ =======
4461
+ var _this27 = this;
4462
+ >>>>>>> master
4463
+
4464
+ if (!this.options.columns) {
4465
+ return;
4466
+ }
3235
4467
 
3236
- if (isPercentage === true) {
3237
- numOut = numOut * 100;
3238
- }
4468
+ this.hideError();
4469
+ this.data = [];
4470
+ this.rowCount = 0;
4471
+ var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
4472
+ bodyEl.innerHTML = '';
3239
4473
 
3240
- if (numOut % 1 > 0) {
3241
- decimals = 1;
3242
- }
4474
+ if (this.options.allowDownload === true) {
4475
+ // doesn't do anything yet
4476
+ var el = document.getElementById(this.elementId);
3243
4477
 
3244
- if (numOut < 1) {
3245
- decimals = getZeroDecimals(numOut);
3246
- }
4478
+ if (el) {
4479
+ el.classList.add('allow-download');
4480
+ } else {
4481
+ el.classList.remove('allow-download');
4482
+ }
4483
+ }
3247
4484
 
3248
- numOut = (+numOut).toFixed(decimals);
4485
+ var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
4486
+ if (c.show !== false) {
4487
+ <<<<<<< HEAD
4488
+ 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 ? _this24.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
4489
+ =======
4490
+ 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 ? _this27.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
4491
+ >>>>>>> master
4492
+ }
4493
+ }).join('') + '</tr>';
4494
+ var headEl = document.getElementById("".concat(this.elementId, "_head"));
4495
+ headEl.innerHTML = headHTML; // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
4496
+ // if (c.show !== false) {
4497
+ // return `
4498
+ // <th></th>
4499
+ // `
4500
+ // }
4501
+ // }).join('') + '</tr>'
4502
+ // const footEl = document.getElementById(`${this.elementId}_foot`)
4503
+ // footEl.innerHTML = footHTML
3249
4504
 
3250
- if (test === true) {
3251
- return numOut;
3252
- }
4505
+ if (this.options.paging === 'pages') {
4506
+ var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
3253
4507
 
3254
- if (numOut.replace) {
3255
- numOut = numOut.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
3256
- }
4508
+ if (pagingEl) {
4509
+ var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
4510
+ <<<<<<< HEAD
4511
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this24.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
4512
+ =======
4513
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this27.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
4514
+ >>>>>>> master
4515
+ });
4516
+ var startIndex = 0;
3257
4517
 
3258
- function getDivider(n) {
3259
- var s = '';
3260
- var d = 1; // let out
4518
+ if (this.options.pageCount > 8) {
4519
+ startIndex = Math.max(0, this.options.pageNum - 4);
4520
+ pages = pages.splice(startIndex, 10);
3261
4521
 
3262
- for (var _i5 = 0; _i5 < ranges.length; _i5++) {
3263
- if (n >= ranges[_i5].divider) {
3264
- d = ranges[_i5].divider;
3265
- s = ranges[_i5].suffix; // out = (n / ranges[i].divider).toFixed(decimals).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$100,')
4522
+ if (startIndex > 0) {
4523
+ pages.splice(0, 0, "<li>Page&nbsp;</li><li data-page=\"0\" class=\"websy-page-num\">First</li><li>...</li>");
4524
+ } else {
4525
+ pages.splice(0, 0, '<li>Page&nbsp;</li>');
4526
+ }
3266
4527
 
3267
- break;
4528
+ if (this.options.pageNum < this.options.pageCount - 1) {
4529
+ pages.push('<li>...</li>');
4530
+ pages.push("<li data-page=\"".concat(this.options.pageCount - 1, "\" class=\"websy-page-num\">Last</li>"));
4531
+ }
4532
+ }
4533
+
4534
+ pagingEl.innerHTML = pages.join('');
3268
4535
  }
3269
4536
  }
3270
4537
 
3271
- return {
3272
- divider: d,
3273
- suffix: s
3274
- };
4538
+ if (data) {
4539
+ // this.data = this.data.concat(data)
4540
+ this.appendRows(data);
4541
+ }
3275
4542
  }
4543
+ }, {
4544
+ key: "showError",
4545
+ value: function showError(options) {
4546
+ var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
3276
4547
 
3277
- function getZeroDecimals(n) {
3278
- var d = 0;
3279
- n = Math.abs(n);
3280
-
3281
- if (n === 0) {
3282
- return 0;
4548
+ if (containerEl) {
4549
+ containerEl.classList.add('active');
3283
4550
  }
3284
4551
 
3285
- while (n < 10) {
3286
- d++;
3287
- n = n * 10;
4552
+ if (options.title) {
4553
+ var titleEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
4554
+
4555
+ if (titleEl) {
4556
+ titleEl.innerHTML = options.title;
4557
+ }
3288
4558
  }
3289
4559
 
3290
- return d;
4560
+ if (options.message) {
4561
+ var messageEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
4562
+
4563
+ if (messageEl) {
4564
+ messageEl.innerHTML = options.message;
4565
+ }
4566
+ }
4567
+ }
4568
+ }, {
4569
+ key: "showLoading",
4570
+ value: function showLoading(options) {
4571
+ this.loadingDialog.show(options);
3291
4572
  }
4573
+ }]);
3292
4574
 
3293
- return "".concat(numOut).concat(suffix).concat(isPercentage === true ? '%' : '');
3294
- },
3295
- toQlikDateNum: function toQlikDateNum(d) {
3296
- return Math.floor(d.getTime() / 86400000 + 25570);
3297
- }
3298
- };
4575
+ return WebsyTable;
4576
+ }();
3299
4577
  /* global WebsyDesigns */
3300
4578
 
3301
- var WebsyTable = /*#__PURE__*/function () {
3302
- function WebsyTable(elementId, options) {
3303
- var _this20 = this;
3304
4579
 
3305
- _classCallCheck(this, WebsyTable);
4580
+ var WebsyTable2 = /*#__PURE__*/function () {
4581
+ function WebsyTable2(elementId, options) {
4582
+ var _this28 = this;
4583
+
4584
+ _classCallCheck(this, WebsyTable2);
3306
4585
 
3307
4586
  var DEFAULTS = {
3308
4587
  pageSize: 20,
3309
- paging: 'scroll'
4588
+ paging: 'scroll',
4589
+ cellSize: 35,
4590
+ virtualScroll: false,
4591
+ leftColumns: 0
3310
4592
  };
3311
4593
  this.elementId = elementId;
3312
4594
  this.options = _extends({}, DEFAULTS, options);
@@ -3317,7 +4599,7 @@ var WebsyTable = /*#__PURE__*/function () {
3317
4599
  var el = document.getElementById(this.elementId);
3318
4600
 
3319
4601
  if (el) {
3320
- var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table ").concat(this.options.paging === 'pages' ? 'with-paging' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <table>\n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n <tfoot id=\"").concat(this.elementId, "_foot\">\n </tfoot>\n </table> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
4602
+ var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <table id=\"").concat(this.elementId, "_table\"> \n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n <tfoot id=\"").concat(this.elementId, "_foot\">\n </tfoot>\n </table> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
3321
4603
 
3322
4604
  if (this.options.paging === 'pages') {
3323
4605
  html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
@@ -3338,8 +4620,8 @@ var WebsyTable = /*#__PURE__*/function () {
3338
4620
  allowClear: false,
3339
4621
  disableSearch: true,
3340
4622
  onItemSelected: function onItemSelected(selectedItem) {
3341
- if (_this20.options.onChangePageSize) {
3342
- _this20.options.onChangePageSize(selectedItem.value);
4623
+ if (_this28.options.onChangePageSize) {
4624
+ _this28.options.onChangePageSize(selectedItem.value);
3343
4625
  }
3344
4626
  }
3345
4627
  });
@@ -3348,6 +4630,9 @@ var WebsyTable = /*#__PURE__*/function () {
3348
4630
  el.addEventListener('click', this.handleClick.bind(this));
3349
4631
  el.addEventListener('mouseout', this.handleMouseOut.bind(this));
3350
4632
  el.addEventListener('mousemove', this.handleMouseMove.bind(this));
4633
+ el.addEventListener('mousedown', this.handleMouseDown.bind(this));
4634
+ el.addEventListener('mouseup', this.handleMouseUp.bind(this));
4635
+ document.addEventListener('mouseup', this.handleGlobalMouseUp.bind(this));
3351
4636
  var scrollEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
3352
4637
  scrollEl.addEventListener('scroll', this.handleScroll.bind(this));
3353
4638
  this.loadingDialog = new WebsyDesigns.LoadingDialog("".concat(this.elementId, "_loadingContainer"));
@@ -3357,48 +4642,53 @@ var WebsyTable = /*#__PURE__*/function () {
3357
4642
  }
3358
4643
  }
3359
4644
 
3360
- _createClass(WebsyTable, [{
4645
+ _createClass(WebsyTable2, [{
3361
4646
  key: "appendRows",
3362
4647
  value: function appendRows(data) {
3363
- var _this21 = this;
4648
+ var _this29 = this;
3364
4649
 
3365
4650
  this.hideError();
4651
+ var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
3366
4652
  var bodyHTML = '';
3367
4653
 
3368
4654
  if (data) {
3369
4655
  bodyHTML += data.map(function (r, rowIndex) {
3370
4656
  return '<tr>' + r.map(function (c, i) {
3371
- if (_this21.options.columns[i].show !== false) {
3372
- var style = '';
4657
+ if (_this29.options.columns[i].show !== false) {
4658
+ var style = "height: ".concat(_this29.options.cellSize, "px; line-height: ").concat(_this29.options.cellSize, "px;");
3373
4659
 
3374
4660
  if (c.style) {
3375
4661
  style += c.style;
3376
4662
  }
3377
4663
 
3378
- if (_this21.options.columns[i].width) {
3379
- style += "width: ".concat(_this21.options.columns[i].width, "; ");
4664
+ if (_this29.options.columns[i].width) {
4665
+ style += "width: ".concat(_this29.options.columns[i].width, "; ");
3380
4666
  }
3381
4667
 
3382
4668
  if (c.backgroundColor) {
3383
4669
  style += "background-color: ".concat(c.backgroundColor, "; ");
4670
+
4671
+ if (!c.color) {
4672
+ style += "color: ".concat(WebsyDesigns.Utils.getLightDark(c.backgroundColor), "; ");
4673
+ }
3384
4674
  }
3385
4675
 
3386
4676
  if (c.color) {
3387
4677
  style += "color: ".concat(c.color, "; ");
3388
4678
  }
3389
4679
 
3390
- if (_this21.options.columns[i].showAsLink === true && c.value.trim() !== '') {
3391
- return "\n <td \n data-row-index='".concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this21.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(_this21.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this21.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
3392
- } else if ((_this21.options.columns[i].showAsNavigatorLink === true || _this21.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
3393
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this21.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this21.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this21.options.columns[i].linkText || c.value, "</td>\n ");
4680
+ if (_this29.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4681
+ return "\n <td \n data-row-index='".concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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(_this29.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4682
+ } else if ((_this29.options.columns[i].showAsNavigatorLink === true || _this29.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4683
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this29.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</td>\n ");
3394
4684
  } else {
3395
4685
  var info = c.value;
3396
4686
 
3397
- if (_this21.options.columns[i].showAsImage === true) {
4687
+ if (_this29.options.columns[i].showAsImage === true) {
3398
4688
  c.value = "\n <img src='".concat(c.value, "'>\n ");
3399
4689
  }
3400
4690
 
3401
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this21.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 ");
4691
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.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 ");
3402
4692
  }
3403
4693
  }
3404
4694
  }).join('') + '</tr>';
@@ -3407,13 +4697,31 @@ var WebsyTable = /*#__PURE__*/function () {
3407
4697
  this.rowCount = this.data.length;
3408
4698
  }
3409
4699
 
3410
- var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
3411
4700
  bodyEl.innerHTML += bodyHTML;
4701
+
4702
+ if (this.options.virtualScroll === true) {
4703
+ // get height of the thead
4704
+ if (this.options.paging !== 'pages') {
4705
+ var headEl = document.getElementById("".concat(this.elementId, "_head"));
4706
+ var vScrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
4707
+ vScrollContainerEl.style.top = "".concat(headEl.clientHeight, "px");
4708
+ }
4709
+
4710
+ var hScrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
4711
+ var left = 0;
4712
+ var cells = bodyEl.querySelectorAll("tr:first-of-type td");
4713
+
4714
+ for (var i = 0; i < this.options.leftColumns; i++) {
4715
+ left += cells[i].offsetWidth || cells[i].clientWidth;
4716
+ }
4717
+
4718
+ hScrollContainerEl.style.left = "".concat(left, "px");
4719
+ }
3412
4720
  }
3413
4721
  }, {
3414
4722
  key: "buildSearchIcon",
3415
- value: function buildSearchIcon(field) {
3416
- return "\n <div>\n <svg\n class=\"tableSearchIcon\"\n data-field=\"".concat(field, "\"\n xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"\n >\n <path d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\"/>\n </svg>\n </div>\n ");
4723
+ value: function buildSearchIcon(columnIndex) {
4724
+ return "\n <div class=\"websy-table-search-icon\" data-col-index=\"".concat(columnIndex, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><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 </div>\n ");
3417
4725
  }
3418
4726
  }, {
3419
4727
  key: "handleClick",
@@ -3446,21 +4754,23 @@ var WebsyTable = /*#__PURE__*/function () {
3446
4754
  // })
3447
4755
  // this.options.model.applyPatches(patchDefs) // .then(() => this.render())
3448
4756
 
3449
- } else if (event.target.classList.contains('tableSearchIcon')) {
3450
- var field = event.target.getAttribute('data-field');
3451
- window.viewManager.views.global.objects[1].instance.show(field, {
3452
- x: event.pageX,
3453
- y: event.pageY
3454
- }, function () {
3455
- event.target.classList.remove('active');
3456
- });
4757
+ } else if (event.target.classList.contains('websy-table-search-icon')) {
4758
+ // let field = event.target.getAttribute('data-field')
4759
+ // window.viewManager.views.global.objects[1].instance.show(field, { x: event.pageX, y: event.pageY }, () => {
4760
+ // event.target.classList.remove('active')
4761
+ // })
4762
+ var _colIndex2 = +event.target.getAttribute('data-col-index');
4763
+
4764
+ if (this.options.columns[_colIndex2].onSearch) {
4765
+ this.options.columns[_colIndex2].onSearch(event, this.options.columns[_colIndex2]);
4766
+ }
3457
4767
  } else if (event.target.classList.contains('clickable')) {
3458
- var _colIndex = +event.target.getAttribute('data-col-index');
4768
+ var _colIndex3 = +event.target.getAttribute('data-col-index');
3459
4769
 
3460
4770
  var rowIndex = +event.target.getAttribute('data-row-index');
3461
4771
 
3462
4772
  if (this.options.onClick) {
3463
- this.options.onClick(event, this.data[rowIndex][_colIndex], this.data[rowIndex], this.options.columns[_colIndex]);
4773
+ this.options.onClick(event, this.data[rowIndex][_colIndex3], this.data[rowIndex], this.options.columns[_colIndex3]);
3464
4774
  }
3465
4775
  } else if (event.target.classList.contains('websy-page-num')) {
3466
4776
  var pageNum = +event.target.getAttribute('data-page');
@@ -3470,6 +4780,36 @@ var WebsyTable = /*#__PURE__*/function () {
3470
4780
  }
3471
4781
  }
3472
4782
  }
4783
+ }, {
4784
+ key: "handleMouseDown",
4785
+ value: function handleMouseDown(event) {
4786
+ if (event.target.classList.contains('websy-scroll-handle')) {
4787
+ this.scrolling = true;
4788
+ var el = document.getElementById(this.elementId);
4789
+ el.classList.add('scrolling');
4790
+ }
4791
+
4792
+ if (event.target.classList.contains('websy-scroll-handle-x')) {
4793
+ var handleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
4794
+ this.handleXStart = handleEl.offsetLeft;
4795
+ this.scrollXStart = event.clientX;
4796
+ this.scrollDirection = 'X';
4797
+ }
4798
+ }
4799
+ }, {
4800
+ key: "handleGlobalMouseUp",
4801
+ value: function handleGlobalMouseUp(event) {
4802
+ this.scrolling = false;
4803
+ var el = document.getElementById(this.elementId);
4804
+ el.classList.remove('scrolling');
4805
+ }
4806
+ }, {
4807
+ key: "handleMouseUp",
4808
+ value: function handleMouseUp(event) {
4809
+ this.scrolling = false;
4810
+ var el = document.getElementById(this.elementId);
4811
+ el.classList.remove('scrolling');
4812
+ }
3473
4813
  }, {
3474
4814
  key: "handleMouseMove",
3475
4815
  value: function handleMouseMove(event) {
@@ -3483,6 +4823,32 @@ var WebsyTable = /*#__PURE__*/function () {
3483
4823
  event.target.classList.add('websy-delayed-info');
3484
4824
  }, 500);
3485
4825
  }
4826
+
4827
+ if (this.scrolling === true && this.options.virtualScroll === true) {
4828
+ var tableContainerEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
4829
+
4830
+ if (this.scrollDirection === 'X') {
4831
+ var handleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle")); // console.log(this.handleXStart + handleEl.offsetWidth + (event.clientX - this.scrollXStart), this.columnParameters.scrollableWidth)
4832
+
4833
+ var startPoint = 0;
4834
+
4835
+ if (this.handleXStart + (event.clientX - this.scrollXStart) < this.columnParameters.scrollableWidth - handleEl.offsetWidth) {
4836
+ handleEl.style.left = "".concat(this.handleXStart + (event.clientX - this.scrollXStart), "px");
4837
+ startPoint = this.handleXStart + (event.clientX - this.scrollXStart);
4838
+ } else {
4839
+ startPoint = this.columnParameters.scrollableWidth - handleEl.offsetWidth;
4840
+ }
4841
+
4842
+ if (this.handleXStart + (event.clientX - this.scrollXStart) < 0) {
4843
+ handleEl.style.left = 0;
4844
+ startPoint = 0;
4845
+ }
4846
+
4847
+ if (this.options.onScrollX) {
4848
+ this.options.onScrollX(startPoint);
4849
+ }
4850
+ }
4851
+ }
3486
4852
  }
3487
4853
  }, {
3488
4854
  key: "handleMouseOut",
@@ -3502,6 +4868,14 @@ var WebsyTable = /*#__PURE__*/function () {
3502
4868
  }, {
3503
4869
  key: "hideError",
3504
4870
  value: function hideError() {
4871
+ var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
4872
+
4873
+ if (el) {
4874
+ el.classList.remove('has-error');
4875
+ }
4876
+
4877
+ var tableEl = document.getElementById("".concat(this.elementId, "_table"));
4878
+ tableEl.classList.remove('hidden');
3505
4879
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
3506
4880
 
3507
4881
  if (containerEl) {
@@ -3557,7 +4931,7 @@ var WebsyTable = /*#__PURE__*/function () {
3557
4931
  }, {
3558
4932
  key: "render",
3559
4933
  value: function render(data) {
3560
- var _this22 = this;
4934
+ var _this30 = this;
3561
4935
 
3562
4936
  if (!this.options.columns) {
3563
4937
  return;
@@ -3578,15 +4952,29 @@ var WebsyTable = /*#__PURE__*/function () {
3578
4952
  } else {
3579
4953
  el.classList.remove('allow-download');
3580
4954
  }
3581
- }
4955
+ } // let colGroupHTML = this.options.columns.map(c => `<col style="${c.width ? 'width: ' + c.width : ''}"></col>`)
4956
+
3582
4957
 
3583
4958
  var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
3584
4959
  if (c.show !== false) {
3585
- 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 ? _this22.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
4960
+ 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 ? _this30.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
3586
4961
  }
3587
4962
  }).join('') + '</tr>';
3588
4963
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
3589
- headEl.innerHTML = headHTML; // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
4964
+ headEl.innerHTML = headHTML;
4965
+ var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
4966
+
4967
+ if (dropdownEl.innerHTML === '') {
4968
+ var dropdownHTML = "";
4969
+ this.options.columns.forEach(function (c, i) {
4970
+ if (c.searchable && c.searchField) {
4971
+ dropdownHTML += "\n <div id=\"".concat(_this30.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
4972
+ }
4973
+ });
4974
+ dropdownEl.innerHTML = dropdownHTML;
4975
+ } // const colGroupEl = document.getElementById(`${this.elementId}_cols`)
4976
+ // colGroupEl.innerHTML = colGroupHTML
4977
+ // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
3590
4978
  // if (c.show !== false) {
3591
4979
  // return `
3592
4980
  // <th></th>
@@ -3596,12 +4984,13 @@ var WebsyTable = /*#__PURE__*/function () {
3596
4984
  // const footEl = document.getElementById(`${this.elementId}_foot`)
3597
4985
  // footEl.innerHTML = footHTML
3598
4986
 
4987
+
3599
4988
  if (this.options.paging === 'pages') {
3600
4989
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
3601
4990
 
3602
4991
  if (pagingEl) {
3603
4992
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
3604
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
4993
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3605
4994
  });
3606
4995
  var startIndex = 0;
3607
4996
 
@@ -3626,13 +5015,20 @@ var WebsyTable = /*#__PURE__*/function () {
3626
5015
  }
3627
5016
 
3628
5017
  if (data) {
3629
- // this.data = this.data.concat(data)
3630
5018
  this.appendRows(data);
3631
5019
  }
3632
5020
  }
3633
5021
  }, {
3634
5022
  key: "showError",
3635
5023
  value: function showError(options) {
5024
+ var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
5025
+
5026
+ if (el) {
5027
+ el.classList.add('has-error');
5028
+ }
5029
+
5030
+ var tableEl = document.getElementById("".concat(this.elementId, "_table"));
5031
+ tableEl.classList.add('hidden');
3636
5032
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
3637
5033
 
3638
5034
  if (containerEl) {
@@ -3648,28 +5044,92 @@ var WebsyTable = /*#__PURE__*/function () {
3648
5044
  }
3649
5045
 
3650
5046
  if (options.message) {
3651
- var messageEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
5047
+ var messageEl = document.getElementById("".concat(this.elementId, "_errorMessage"));
3652
5048
 
3653
5049
  if (messageEl) {
3654
5050
  messageEl.innerHTML = options.message;
3655
5051
  }
3656
5052
  }
3657
5053
  }
5054
+ }, {
5055
+ key: "setHorizontalScroll",
5056
+ value: function setHorizontalScroll(options) {
5057
+ var el = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
5058
+
5059
+ if (options.width) {
5060
+ el.style.width = "".concat(options.width, "px");
5061
+ }
5062
+ }
5063
+ }, {
5064
+ key: "setWidth",
5065
+ value: function setWidth(width) {
5066
+ var el = document.getElementById("".concat(this.elementId, "_table"));
5067
+
5068
+ if (el) {
5069
+ el.style.width = "".concat(width, "px");
5070
+ }
5071
+ }
3658
5072
  }, {
3659
5073
  key: "showLoading",
3660
5074
  value: function showLoading(options) {
3661
5075
  this.loadingDialog.show(options);
3662
5076
  }
5077
+ }, {
5078
+ key: "getColumnParameters",
5079
+ value: function getColumnParameters(values) {
5080
+ var _this31 = this;
5081
+
5082
+ var tableEl = document.getElementById("".concat(this.elementId, "_table"));
5083
+ tableEl.style.tableLayout = 'auto';
5084
+ tableEl.style.width = 'auto';
5085
+ var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5086
+ bodyEl.innerHTML = '<tr>' + values.map(function (c) {
5087
+ return "\n <td \n style='height: ".concat(_this31.options.cellSize, "px; line-height: ").concat(_this31.options.cellSize, "px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
5088
+ }).join('') + '</tr>'; // get height of the first data cell
5089
+
5090
+ var cells = bodyEl.querySelectorAll("tr:first-of-type td");
5091
+ var tableContainerEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
5092
+ var cellHeight = cells[0].offsetHeight || cells[0].clientHeight;
5093
+ var cellWidths = [];
5094
+ var nonScrollableWidth = 0;
5095
+
5096
+ for (var i = 0; i < cells.length; i++) {
5097
+ if (i < this.options.leftColumns) {
5098
+ nonScrollableWidth += values[i].width || cells[i].offsetWidth || cells[i].clientWidth;
5099
+ }
5100
+
5101
+ cellWidths.push(values[i].width || cells[i].offsetWidth || cells[i].clientWidth);
5102
+ } // const cellWidth = firstDataCell.offsetWidth || firstDataCell.clientWidth
5103
+ // tableEl.style.width = ''
5104
+
5105
+
5106
+ this.columnParameters = {
5107
+ cellHeight: cellHeight,
5108
+ cellWidths: cellWidths,
5109
+ availableHeight: tableContainerEl.offsetHeight || tableContainerEl.clientHeight,
5110
+ availableWidth: tableContainerEl.offsetWidth || tableContainerEl.clientWidth,
5111
+ nonScrollableWidth: nonScrollableWidth,
5112
+ scrollableWidth: (tableContainerEl.offsetWidth || tableContainerEl.clientWidth) - nonScrollableWidth
5113
+ };
5114
+ bodyEl.innerHTML = '';
5115
+ tableEl.style.tableLayout = '';
5116
+ tableEl.style.width = '';
5117
+ return this.columnParameters;
5118
+ }
3663
5119
  }]);
3664
5120
 
3665
- return WebsyTable;
5121
+ return WebsyTable2;
3666
5122
  }();
3667
5123
  /* global d3 include WebsyDesigns */
3668
5124
 
3669
5125
 
3670
5126
  var WebsyChart = /*#__PURE__*/function () {
3671
5127
  function WebsyChart(elementId, options) {
3672
- var _this23 = this;
5128
+ <<<<<<< HEAD
5129
+ var _this25 = this;
5130
+ =======
5131
+ var _this32 = this;
5132
+ >>>>>>> master
3673
5133
 
3674
5134
  _classCallCheck(this, WebsyChart);
3675
5135
 
@@ -3717,22 +5177,40 @@ var WebsyChart = /*#__PURE__*/function () {
3717
5177
  this.invertOverride = function (input, input2) {
3718
5178
  var xAxis = 'bottomAxis';
3719
5179
 
3720
- if (_this23.options.orientation === 'horizontal') {
5180
+ <<<<<<< HEAD
5181
+ if (_this25.options.orientation === 'horizontal') {
5182
+ xAxis = 'leftAxis';
5183
+ }
5184
+
5185
+ var width = _this25[xAxis].step();
5186
+
5187
+ var output;
5188
+
5189
+ var domain = _toConsumableArray(_this25[xAxis].domain());
5190
+
5191
+ if (_this25.options.orientation === 'horizontal') {
5192
+ =======
5193
+ if (_this32.options.orientation === 'horizontal') {
3721
5194
  xAxis = 'leftAxis';
3722
5195
  }
3723
5196
 
3724
- var width = _this23[xAxis].step();
5197
+ var width = _this32[xAxis].step();
3725
5198
 
3726
5199
  var output;
3727
5200
 
3728
- var domain = _toConsumableArray(_this23[xAxis].domain());
5201
+ var domain = _toConsumableArray(_this32[xAxis].domain());
3729
5202
 
3730
- if (_this23.options.orientation === 'horizontal') {
5203
+ if (_this32.options.orientation === 'horizontal') {
5204
+ >>>>>>> master
3731
5205
  domain = domain.reverse();
3732
5206
  }
3733
5207
 
3734
5208
  for (var j = 0; j < domain.length; j++) {
3735
- var breakA = _this23[xAxis](domain[j]) - width / 2;
5209
+ <<<<<<< HEAD
5210
+ var breakA = _this25[xAxis](domain[j]) - width / 2;
5211
+ =======
5212
+ var breakA = _this32[xAxis](domain[j]) - width / 2;
5213
+ >>>>>>> master
3736
5214
  var breakB = breakA + width;
3737
5215
 
3738
5216
  if (input > breakA && input <= breakB) {
@@ -3832,10 +5310,17 @@ var WebsyChart = /*#__PURE__*/function () {
3832
5310
  }, {
3833
5311
  key: "handleEventMouseMove",
3834
5312
  value: function handleEventMouseMove(event, d) {
3835
- var _this24 = this;
5313
+ <<<<<<< HEAD
5314
+ var _this26 = this;
5315
+
5316
+ var bisectDate = d3.bisector(function (d) {
5317
+ return _this26.parseX(d.x.value);
5318
+ =======
5319
+ var _this33 = this;
3836
5320
 
3837
5321
  var bisectDate = d3.bisector(function (d) {
3838
- return _this24.parseX(d.x.value);
5322
+ return _this33.parseX(d.x.value);
5323
+ >>>>>>> master
3839
5324
  }).left;
3840
5325
 
3841
5326
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -3874,8 +5359,13 @@ var WebsyChart = /*#__PURE__*/function () {
3874
5359
  }
3875
5360
 
3876
5361
  this.options.data.series.forEach(function (s) {
3877
- if (_this24.options.data[xData].scale !== 'Time') {
3878
- xPoint = _this24[xAxis](_this24.parseX(xLabel));
5362
+ <<<<<<< HEAD
5363
+ if (_this26.options.data[xData].scale !== 'Time') {
5364
+ xPoint = _this26[xAxis](_this26.parseX(xLabel));
5365
+ =======
5366
+ if (_this33.options.data[xData].scale !== 'Time') {
5367
+ xPoint = _this33[xAxis](_this33.parseX(xLabel));
5368
+ >>>>>>> master
3879
5369
  s.data.forEach(function (d) {
3880
5370
  if (d.x.value === xLabel) {
3881
5371
  if (!d.y.color) {
@@ -3890,13 +5380,21 @@ var WebsyChart = /*#__PURE__*/function () {
3890
5380
  var pointA = s.data[index - 1];
3891
5381
  var pointB = s.data[index];
3892
5382
 
3893
- if (_this24.options.orientation === 'horizontal') {
5383
+ <<<<<<< HEAD
5384
+ if (_this26.options.orientation === 'horizontal') {
5385
+ =======
5386
+ if (_this33.options.orientation === 'horizontal') {
5387
+ >>>>>>> master
3894
5388
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
3895
5389
  pointB = _toConsumableArray(s.data).reverse()[index];
3896
5390
  }
3897
5391
 
3898
5392
  if (pointA && !pointB) {
3899
- xPoint = _this24[xAxis](_this24.parseX(pointA.x.value));
5393
+ <<<<<<< HEAD
5394
+ xPoint = _this26[xAxis](_this26.parseX(pointA.x.value));
5395
+ =======
5396
+ xPoint = _this33[xAxis](_this33.parseX(pointA.x.value));
5397
+ >>>>>>> master
3900
5398
  tooltipTitle = pointA.x.value;
3901
5399
 
3902
5400
  if (!pointA.y.color) {
@@ -3906,12 +5404,20 @@ var WebsyChart = /*#__PURE__*/function () {
3906
5404
  tooltipData.push(pointA.y);
3907
5405
 
3908
5406
  if (typeof pointA.x.value.getTime !== 'undefined') {
3909
- tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointA.x.value);
5407
+ <<<<<<< HEAD
5408
+ tooltipTitle = d3.timeFormat(_this26.options.dateFormat || _this26.options.calculatedTimeFormatPattern)(pointA.x.value);
5409
+ =======
5410
+ tooltipTitle = d3.timeFormat(_this33.options.dateFormat || _this33.options.calculatedTimeFormatPattern)(pointA.x.value);
5411
+ >>>>>>> master
3910
5412
  }
3911
5413
  }
3912
5414
 
3913
5415
  if (pointB && !pointA) {
3914
- xPoint = _this24[xAxis](_this24.parseX(pointB.x.value));
5416
+ <<<<<<< HEAD
5417
+ xPoint = _this26[xAxis](_this26.parseX(pointB.x.value));
5418
+ =======
5419
+ xPoint = _this33[xAxis](_this33.parseX(pointB.x.value));
5420
+ >>>>>>> master
3915
5421
  tooltipTitle = pointB.x.value;
3916
5422
 
3917
5423
  if (!pointB.y.color) {
@@ -3921,14 +5427,24 @@ var WebsyChart = /*#__PURE__*/function () {
3921
5427
  tooltipData.push(pointB.y);
3922
5428
 
3923
5429
  if (typeof pointB.x.value.getTime !== 'undefined') {
3924
- tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
5430
+ <<<<<<< HEAD
5431
+ tooltipTitle = d3.timeFormat(_this26.options.dateFormat || _this26.options.calculatedTimeFormatPattern)(pointB.x.value);
5432
+ =======
5433
+ tooltipTitle = d3.timeFormat(_this33.options.dateFormat || _this33.options.calculatedTimeFormatPattern)(pointB.x.value);
5434
+ >>>>>>> master
3925
5435
  }
3926
5436
  }
3927
5437
 
3928
5438
  if (pointA && pointB) {
3929
- var d0 = _this24[xAxis](_this24.parseX(pointA.x.value));
5439
+ <<<<<<< HEAD
5440
+ var d0 = _this26[xAxis](_this26.parseX(pointA.x.value));
5441
+
5442
+ var d1 = _this26[xAxis](_this26.parseX(pointB.x.value));
5443
+ =======
5444
+ var d0 = _this33[xAxis](_this33.parseX(pointA.x.value));
3930
5445
 
3931
- var d1 = _this24[xAxis](_this24.parseX(pointB.x.value));
5446
+ var d1 = _this33[xAxis](_this33.parseX(pointB.x.value));
5447
+ >>>>>>> master
3932
5448
 
3933
5449
  var mid = Math.abs(d0 - d1) / 2;
3934
5450
 
@@ -3937,7 +5453,11 @@ var WebsyChart = /*#__PURE__*/function () {
3937
5453
  tooltipTitle = pointB.x.value;
3938
5454
 
3939
5455
  if (typeof pointB.x.value.getTime !== 'undefined') {
3940
- tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
5456
+ <<<<<<< HEAD
5457
+ tooltipTitle = d3.timeFormat(_this26.options.dateFormat || _this26.options.calculatedTimeFormatPattern)(pointB.x.value);
5458
+ =======
5459
+ tooltipTitle = d3.timeFormat(_this33.options.dateFormat || _this33.options.calculatedTimeFormatPattern)(pointB.x.value);
5460
+ >>>>>>> master
3941
5461
  }
3942
5462
 
3943
5463
  if (!pointB.y.color) {
@@ -3950,7 +5470,11 @@ var WebsyChart = /*#__PURE__*/function () {
3950
5470
  tooltipTitle = pointA.x.value;
3951
5471
 
3952
5472
  if (typeof pointB.x.value.getTime !== 'undefined') {
3953
- tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
5473
+ <<<<<<< HEAD
5474
+ tooltipTitle = d3.timeFormat(_this26.options.dateFormat || _this26.options.calculatedTimeFormatPattern)(pointB.x.value);
5475
+ =======
5476
+ tooltipTitle = d3.timeFormat(_this33.options.dateFormat || _this33.options.calculatedTimeFormatPattern)(pointB.x.value);
5477
+ >>>>>>> master
3954
5478
  }
3955
5479
 
3956
5480
  if (!pointA.y.color) {
@@ -4005,7 +5529,7 @@ var WebsyChart = /*#__PURE__*/function () {
4005
5529
  }
4006
5530
 
4007
5531
  this.tooltip.setHeight(this.plotHeight);
4008
- this.tooltip.show(tooltipTitle, tooltipHTML, posOptions); // }
5532
+ this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions); // }
4009
5533
  // else {
4010
5534
  // xPoint = x0
4011
5535
  // }
@@ -4055,7 +5579,11 @@ var WebsyChart = /*#__PURE__*/function () {
4055
5579
  }, {
4056
5580
  key: "render",
4057
5581
  value: function render(options) {
4058
- var _this25 = this;
5582
+ <<<<<<< HEAD
5583
+ var _this27 = this;
5584
+ =======
5585
+ var _this34 = this;
5586
+ >>>>>>> master
4059
5587
 
4060
5588
  /* global d3 options */
4061
5589
  if (typeof options !== 'undefined') {
@@ -4124,7 +5652,11 @@ var WebsyChart = /*#__PURE__*/function () {
4124
5652
  var legendData = this.options.data.series.map(function (s, i) {
4125
5653
  return {
4126
5654
  value: s.label || s.key,
4127
- color: s.color || _this25.options.colors[i % _this25.options.colors.length]
5655
+ <<<<<<< HEAD
5656
+ color: s.color || _this27.options.colors[i % _this27.options.colors.length]
5657
+ =======
5658
+ color: s.color || _this34.options.colors[i % _this34.options.colors.length]
5659
+ >>>>>>> master
4128
5660
  };
4129
5661
  });
4130
5662
 
@@ -4363,7 +5895,11 @@ var WebsyChart = /*#__PURE__*/function () {
4363
5895
 
4364
5896
  if (this.options.data.bottom.formatter) {
4365
5897
  bAxisFunc.tickFormat(function (d) {
4366
- return _this25.options.data.bottom.formatter(d);
5898
+ <<<<<<< HEAD
5899
+ return _this27.options.data.bottom.formatter(d);
5900
+ =======
5901
+ return _this34.options.data.bottom.formatter(d);
5902
+ >>>>>>> master
4367
5903
  });
4368
5904
  }
4369
5905
 
@@ -4390,8 +5926,13 @@ var WebsyChart = /*#__PURE__*/function () {
4390
5926
 
4391
5927
  if (this.options.margin.axisLeft > 0) {
4392
5928
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
4393
- if (_this25.options.data.left.formatter) {
4394
- d = _this25.options.data.left.formatter(d);
5929
+ <<<<<<< HEAD
5930
+ if (_this27.options.data.left.formatter) {
5931
+ d = _this27.options.data.left.formatter(d);
5932
+ =======
5933
+ if (_this34.options.data.left.formatter) {
5934
+ d = _this34.options.data.left.formatter(d);
5935
+ >>>>>>> master
4395
5936
  }
4396
5937
 
4397
5938
  return d;
@@ -4428,8 +5969,13 @@ var WebsyChart = /*#__PURE__*/function () {
4428
5969
 
4429
5970
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
4430
5971
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
4431
- if (_this25.options.data.right.formatter) {
4432
- d = _this25.options.data.right.formatter(d);
5972
+ <<<<<<< HEAD
5973
+ if (_this27.options.data.right.formatter) {
5974
+ d = _this27.options.data.right.formatter(d);
5975
+ =======
5976
+ if (_this34.options.data.right.formatter) {
5977
+ d = _this34.options.data.right.formatter(d);
5978
+ >>>>>>> master
4433
5979
  }
4434
5980
 
4435
5981
  return d;
@@ -4455,16 +6001,29 @@ var WebsyChart = /*#__PURE__*/function () {
4455
6001
 
4456
6002
  this.options.data.series.forEach(function (series, index) {
4457
6003
  if (!series.key) {
4458
- series.key = _this25.createIdentity();
6004
+ <<<<<<< HEAD
6005
+ series.key = _this27.createIdentity();
6006
+ }
6007
+
6008
+ if (!series.color) {
6009
+ series.color = _this27.options.colors[index % _this27.options.colors.length];
6010
+ }
6011
+
6012
+ _this27["render".concat(series.type || 'bar')](series, index);
6013
+
6014
+ _this27.renderLabels(series, index);
6015
+ =======
6016
+ series.key = _this34.createIdentity();
4459
6017
  }
4460
6018
 
4461
6019
  if (!series.color) {
4462
- series.color = _this25.options.colors[index % _this25.options.colors.length];
6020
+ series.color = _this34.options.colors[index % _this34.options.colors.length];
4463
6021
  }
4464
6022
 
4465
- _this25["render".concat(series.type || 'bar')](series, index);
6023
+ _this34["render".concat(series.type || 'bar')](series, index);
4466
6024
 
4467
- _this25.renderLabels(series, index);
6025
+ _this34.renderLabels(series, index);
6026
+ >>>>>>> master
4468
6027
  });
4469
6028
  }
4470
6029
  }
@@ -4472,17 +6031,30 @@ var WebsyChart = /*#__PURE__*/function () {
4472
6031
  }, {
4473
6032
  key: "renderarea",
4474
6033
  value: function renderarea(series, index) {
4475
- var _this26 = this;
6034
+ <<<<<<< HEAD
6035
+ var _this28 = this;
6036
+ =======
6037
+ var _this35 = this;
6038
+ >>>>>>> master
4476
6039
 
4477
6040
  /* global d3 series index */
4478
6041
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
4479
6042
  return d3.area().x(function (d) {
4480
- return _this26[xAxis](_this26.parseX(d.x.value));
6043
+ <<<<<<< HEAD
6044
+ return _this28[xAxis](_this28.parseX(d.x.value));
6045
+ }).y0(function (d) {
6046
+ return _this28[yAxis](0);
6047
+ }).y1(function (d) {
6048
+ return _this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
6049
+ }).curve(d3[curveStyle || _this28.options.curveStyle]);
6050
+ =======
6051
+ return _this35[xAxis](_this35.parseX(d.x.value));
4481
6052
  }).y0(function (d) {
4482
- return _this26[yAxis](0);
6053
+ return _this35[yAxis](0);
4483
6054
  }).y1(function (d) {
4484
- return _this26[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
4485
- }).curve(d3[curveStyle || _this26.options.curveStyle]);
6055
+ return _this35[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
6056
+ }).curve(d3[curveStyle || _this35.options.curveStyle]);
6057
+ >>>>>>> master
4486
6058
  };
4487
6059
 
4488
6060
  var xAxis = 'bottomAxis';
@@ -4560,7 +6132,7 @@ var WebsyChart = /*#__PURE__*/function () {
4560
6132
  return 0;
4561
6133
  }
4562
6134
  } else {
4563
- if (this.options.grouping === 'stacked') {
6135
+ if (this.options.grouping !== 'stacked') {
4564
6136
  return this[xAxis](this.parseX(d.x.value));
4565
6137
  } else {
4566
6138
  return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
@@ -4570,7 +6142,7 @@ var WebsyChart = /*#__PURE__*/function () {
4570
6142
 
4571
6143
  function getBarY(d, i) {
4572
6144
  if (this.options.orientation === 'horizontal') {
4573
- if (this.options.grouping === 'stacked') {
6145
+ if (this.options.grouping !== 'stacked') {
4574
6146
  return this[xAxis](this.parseX(d.x.value));
4575
6147
  } else {
4576
6148
  return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
@@ -4655,15 +6227,26 @@ var WebsyChart = /*#__PURE__*/function () {
4655
6227
  }, {
4656
6228
  key: "renderline",
4657
6229
  value: function renderline(series, index) {
4658
- var _this27 = this;
6230
+ <<<<<<< HEAD
6231
+ var _this29 = this;
6232
+ =======
6233
+ var _this36 = this;
6234
+ >>>>>>> master
4659
6235
 
4660
6236
  /* global series index d3 */
4661
6237
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
4662
6238
  return d3.line().x(function (d) {
4663
- return _this27[xAxis](_this27.parseX(d.x.value));
6239
+ <<<<<<< HEAD
6240
+ return _this29[xAxis](_this29.parseX(d.x.value));
6241
+ }).y(function (d) {
6242
+ return _this29[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
6243
+ }).curve(d3[curveStyle || _this29.options.curveStyle]);
6244
+ =======
6245
+ return _this36[xAxis](_this36.parseX(d.x.value));
4664
6246
  }).y(function (d) {
4665
- return _this27[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
4666
- }).curve(d3[curveStyle || _this27.options.curveStyle]);
6247
+ return _this36[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
6248
+ }).curve(d3[curveStyle || _this36.options.curveStyle]);
6249
+ >>>>>>> master
4667
6250
  };
4668
6251
 
4669
6252
  var xAxis = 'bottomAxis';
@@ -4701,14 +6284,22 @@ var WebsyChart = /*#__PURE__*/function () {
4701
6284
  }, {
4702
6285
  key: "rendersymbol",
4703
6286
  value: function rendersymbol(series, index) {
4704
- var _this28 = this;
6287
+ <<<<<<< HEAD
6288
+ var _this30 = this;
6289
+ =======
6290
+ var _this37 = this;
6291
+ >>>>>>> master
4705
6292
 
4706
6293
  /* global d3 series index series.key */
4707
6294
  var drawSymbol = function drawSymbol(size) {
4708
6295
  return d3.symbol() // .type(d => {
4709
6296
  // return d3.symbols[0]
4710
6297
  // })
4711
- .size(size || _this28.options.symbolSize);
6298
+ <<<<<<< HEAD
6299
+ .size(size || _this30.options.symbolSize);
6300
+ =======
6301
+ .size(size || _this37.options.symbolSize);
6302
+ >>>>>>> master
4712
6303
  };
4713
6304
 
4714
6305
  var xAxis = 'bottomAxis';
@@ -4726,7 +6317,11 @@ var WebsyChart = /*#__PURE__*/function () {
4726
6317
  symbols.attr('d', function (d) {
4727
6318
  return drawSymbol(d.y.size || series.symbolSize)(d);
4728
6319
  }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
4729
- return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6320
+ <<<<<<< HEAD
6321
+ return "translate(".concat(_this30[xAxis](_this30.parseX(d.x.value)), ", ").concat(_this30[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6322
+ =======
6323
+ return "translate(".concat(_this37[xAxis](_this37.parseX(d.x.value)), ", ").concat(_this37[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6324
+ >>>>>>> master
4730
6325
  }); // Enter
4731
6326
 
4732
6327
  symbols.enter().append('path').attr('d', function (d) {
@@ -4735,7 +6330,11 @@ var WebsyChart = /*#__PURE__*/function () {
4735
6330
  .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
4736
6331
  return "symbol symbol_".concat(series.key);
4737
6332
  }).attr('transform', function (d) {
4738
- return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6333
+ <<<<<<< HEAD
6334
+ return "translate(".concat(_this30[xAxis](_this30.parseX(d.x.value)), ", ").concat(_this30[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6335
+ =======
6336
+ return "translate(".concat(_this37[xAxis](_this37.parseX(d.x.value)), ", ").concat(_this37[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6337
+ >>>>>>> master
4739
6338
  });
4740
6339
  }
4741
6340
  }, {
@@ -4890,7 +6489,11 @@ var WebsyLegend = /*#__PURE__*/function () {
4890
6489
  }, {
4891
6490
  key: "resize",
4892
6491
  value: function resize() {
4893
- var _this29 = this;
6492
+ <<<<<<< HEAD
6493
+ var _this31 = this;
6494
+ =======
6495
+ var _this38 = this;
6496
+ >>>>>>> master
4894
6497
 
4895
6498
  var el = document.getElementById(this.elementId);
4896
6499
 
@@ -4903,7 +6506,11 @@ var WebsyLegend = /*#__PURE__*/function () {
4903
6506
  // }
4904
6507
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
4905
6508
  html += this._data.map(function (d, i) {
4906
- return _this29.getLegendItemHTML(d);
6509
+ <<<<<<< HEAD
6510
+ return _this31.getLegendItemHTML(d);
6511
+ =======
6512
+ return _this38.getLegendItemHTML(d);
6513
+ >>>>>>> master
4907
6514
  }).join('');
4908
6515
  html += "\n <div>\n ";
4909
6516
  el.innerHTML = html;
@@ -5076,7 +6683,11 @@ var WebsyMap = /*#__PURE__*/function () {
5076
6683
  }, {
5077
6684
  key: "render",
5078
6685
  value: function render() {
5079
- var _this30 = this;
6686
+ <<<<<<< HEAD
6687
+ var _this32 = this;
6688
+ =======
6689
+ var _this39 = this;
6690
+ >>>>>>> master
5080
6691
 
5081
6692
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
5082
6693
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -5085,7 +6696,11 @@ var WebsyMap = /*#__PURE__*/function () {
5085
6696
  var legendData = this.options.data.polygons.map(function (s, i) {
5086
6697
  return {
5087
6698
  value: s.label || s.key,
5088
- color: s.color || _this30.options.colors[i % _this30.options.colors.length]
6699
+ <<<<<<< HEAD
6700
+ color: s.color || _this32.options.colors[i % _this32.options.colors.length]
6701
+ =======
6702
+ color: s.color || _this39.options.colors[i % _this39.options.colors.length]
6703
+ >>>>>>> master
5089
6704
  };
5090
6705
  });
5091
6706
  var longestValue = legendData.map(function (s) {
@@ -5149,7 +6764,11 @@ var WebsyMap = /*#__PURE__*/function () {
5149
6764
 
5150
6765
  if (this.polygons) {
5151
6766
  this.polygons.forEach(function (p) {
5152
- return _this30.map.removeLayer(p);
6767
+ <<<<<<< HEAD
6768
+ return _this32.map.removeLayer(p);
6769
+ =======
6770
+ return _this39.map.removeLayer(p);
6771
+ >>>>>>> master
5153
6772
  });
5154
6773
  }
5155
6774
 
@@ -5207,18 +6826,30 @@ var WebsyMap = /*#__PURE__*/function () {
5207
6826
  }
5208
6827
 
5209
6828
  if (!p.options.color) {
5210
- p.options.color = _this30.options.colors[i % _this30.options.colors.length];
6829
+ <<<<<<< HEAD
6830
+ p.options.color = _this32.options.colors[i % _this32.options.colors.length];
6831
+ =======
6832
+ p.options.color = _this39.options.colors[i % _this39.options.colors.length];
6833
+ >>>>>>> master
5211
6834
  }
5212
6835
 
5213
6836
  var pol = L.polygon(p.data.map(function (c) {
5214
6837
  return c.map(function (d) {
5215
6838
  return [d.Latitude, d.Longitude];
5216
6839
  });
5217
- }), p.options).addTo(_this30.map);
6840
+ <<<<<<< HEAD
6841
+ }), p.options).addTo(_this32.map);
6842
+
6843
+ _this32.polygons.push(pol);
6844
+
6845
+ _this32.map.fitBounds(pol.getBounds());
6846
+ =======
6847
+ }), p.options).addTo(_this39.map);
5218
6848
 
5219
- _this30.polygons.push(pol);
6849
+ _this39.polygons.push(pol);
5220
6850
 
5221
- _this30.map.fitBounds(pol.getBounds());
6851
+ _this39.map.fitBounds(pol.getBounds());
6852
+ >>>>>>> master
5222
6853
  });
5223
6854
  } // if (this.data.markers.length > 0) {
5224
6855
  // el.classList.remove('hidden')
@@ -5350,7 +6981,9 @@ var WebsyDesigns = {
5350
6981
  WebsyRouter: WebsyRouter,
5351
6982
  Router: WebsyRouter,
5352
6983
  WebsyTable: WebsyTable,
6984
+ WebsyTable2: WebsyTable2,
5353
6985
  Table: WebsyTable,
6986
+ Table2: WebsyTable2,
5354
6987
  WebsyChart: WebsyChart,
5355
6988
  Chart: WebsyChart,
5356
6989
  WebsyChartTooltip: WebsyChartTooltip,
@@ -5367,6 +7000,7 @@ var WebsyDesigns = {
5367
7000
  Utils: WebsyUtils,
5368
7001
  ButtonGroup: ButtonGroup,
5369
7002
  WebsySwitch: Switch,
7003
+ Pager: Pager,
5370
7004
  Switch: Switch
5371
7005
  };
5372
7006
  WebsyDesigns.service = new WebsyDesigns.APIService('');