loon-bulma-react 2023.0.9 → 2023.0.11

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.
@@ -1459,37 +1459,37 @@ var Message = function Message(_ref) {
1459
1459
  title = _ref.title,
1460
1460
  size = _ref.size,
1461
1461
  color = _ref.color;
1462
- var classes = 'message';
1462
+ var className = 'message';
1463
1463
  var icon = faInfo;
1464
1464
  switch (color) {
1465
1465
  case 's':
1466
- classes += ' is-success';
1466
+ className += ' is-success';
1467
1467
  icon = faCheck;
1468
1468
  break;
1469
1469
  case 'd':
1470
- classes += ' is-danger';
1470
+ className += ' is-danger';
1471
1471
  icon = faExclamationTriangle;
1472
1472
  break;
1473
1473
  case 'w':
1474
- classes += ' is-warning';
1474
+ className += ' is-warning';
1475
1475
  icon = faExclamation;
1476
1476
  break;
1477
1477
  case 'p':
1478
- classes += ' is-primary';
1478
+ className += ' is-primary';
1479
1479
  icon = faInfo;
1480
1480
  break;
1481
1481
  case 'l':
1482
- classes += ' is-link';
1482
+ className += ' is-link';
1483
1483
  icon = faInfo;
1484
1484
  break;
1485
1485
  default:
1486
- classes += ' is-info';
1486
+ className += ' is-info';
1487
1487
  icon = faInfo;
1488
1488
  break;
1489
1489
  }
1490
- if (size === 's') classes += ' is-small';else if (size === 'l') classes += ' is-medium';else if (size === 'xl') classes += ' is-large';
1490
+ if (size === 's') className += ' is-small';else if (size === 'l') className += ' is-medium';else if (size === 'xl') className += ' is-large';
1491
1491
  return React.createElement("article", {
1492
- className: classes
1492
+ className: className
1493
1493
  }, title && React.createElement(Header$1, {
1494
1494
  title: title,
1495
1495
  icon: icon
@@ -2055,35 +2055,43 @@ function TabBarItem(_ref2) {
2055
2055
  }
2056
2056
  TabBar.Item = TabBarItem;
2057
2057
 
2058
- function Tag(props) {
2058
+ function Tag(_ref) {
2059
+ var children = _ref.children,
2060
+ color = _ref.color,
2061
+ size = _ref.size,
2062
+ light = _ref.light,
2063
+ rounded = _ref.rounded,
2064
+ tooltip = _ref.tooltip,
2065
+ onDismiss = _ref.onDismiss;
2059
2066
  var classes = 'tag';
2060
- classes += props.light ? ' is-light' : '';
2061
- classes += props.rounded ? ' is-rounded' : '';
2062
- if (props.color === 'p') classes += ' is-primary';else if (props.color === 'i') classes += ' is-info';else if (props.color === 'd') classes += ' is-danger';else if (props.color === 'w') classes += ' is-warning';else if (props.color === 's') classes += ' is-success';else if (props.color === 'dark') classes += ' is-dark';else if (props.color === 'light') classes += ' is-light';else classes += ' is-link';
2063
- if (props.size === 'm') classes += ' is-medium';else if (props.size === 'l') classes += ' is-large';
2067
+ classes += light ? ' is-light' : '';
2068
+ classes += rounded ? ' is-rounded' : '';
2069
+ if (color === 'p') classes += ' is-primary';else if (color === 'i') classes += ' is-info';else if (color === 'd') classes += ' is-danger';else if (color === 'w') classes += ' is-warning';else if (color === 's') classes += ' is-success';else if (color === 'dark') classes += ' is-dark';else if (color === 'light') classes += ' is-light';else classes += ' is-link';
2070
+ if (size === 'm') classes += ' is-medium';else if (size === 'l') classes += ' is-large';
2064
2071
  var handleDismiss = function handleDismiss(e) {
2065
- return props.onDismiss && props.onDismiss(e);
2072
+ return onDismiss && onDismiss(e);
2066
2073
  };
2067
2074
  return React.createElement("span", {
2068
2075
  className: classes,
2069
- title: props.tooltip
2070
- }, props.children, props.onDismiss && React.createElement("button", {
2076
+ title: tooltip
2077
+ }, children, onDismiss && React.createElement("button", {
2071
2078
  className: "delete",
2072
2079
  onClick: function onClick(e) {
2073
2080
  return handleDismiss(e);
2074
2081
  }
2075
2082
  }));
2076
2083
  }
2077
- function Tags(props) {
2084
+ function Tags(_ref2) {
2085
+ var children = _ref2.children,
2086
+ merged = _ref2.merged,
2087
+ size = _ref2.size,
2088
+ alignment = _ref2.alignment,
2089
+ className = _ref2.className;
2078
2090
  var classes = 'tags';
2079
- if (props.size === 'm') classes += ' are-medium';else if (props.size === 'l') classes += ' are-large';
2080
- if (props.alignment === 'r') classes += ' is-right';else if (props.alignment === 'c') classes += ' is-centered';
2081
- if (props.merged) classes += ' has-addons';
2082
- classes = (classes + " " + (typeof props.className == 'function' ? props.className() : props.className)).trim();
2083
- var children = React.Children.map(props.children, function (child) {
2084
- if (child.type === Tag) return child;
2085
- return child;
2086
- });
2091
+ if (size === 'm') classes += ' are-medium';else if (size === 'l') classes += ' are-large';
2092
+ if (alignment === 'r') classes += ' is-right';else if (alignment === 'c') classes += ' is-centered';
2093
+ if (merged) classes += ' has-addons';
2094
+ classes = (classes + " " + className).trim();
2087
2095
  return React.createElement("div", {
2088
2096
  className: classes
2089
2097
  }, children);
@@ -2213,17 +2221,23 @@ function Subtitle(props) {
2213
2221
  }, txt);
2214
2222
  }
2215
2223
  }
2216
- function TitleWithSubtitle(props) {
2217
- var _props$bulmaSize3;
2218
- var bulmaSize = parseInt(((_props$bulmaSize3 = props.bulmaSize) != null ? _props$bulmaSize3 : 3).toString());
2219
- var hSize = typeof props.headingSize == 'string' ? +props.headingSize.replace('h', '') : props.headingSize;
2224
+ function TitleWithSubtitle(_ref) {
2225
+ var bulmaSizeVal = _ref.bulmaSize,
2226
+ headingSize = _ref.headingSize,
2227
+ titleTxt = _ref.titleTxt,
2228
+ subtitleTxt = _ref.subtitleTxt,
2229
+ className = _ref.className;
2230
+ var bulmaSize = parseInt("" + (bulmaSizeVal != null ? bulmaSizeVal : 3));
2231
+ var hSize = typeof headingSize == 'string' ? +headingSize.replace('h', '') : headingSize;
2220
2232
  var heading = hSize || bulmaSize;
2221
- return React.createElement("div", null, React.createElement(Title, {
2222
- txt: props.titleTxt,
2233
+ return React.createElement("div", {
2234
+ className: className
2235
+ }, React.createElement(Title, {
2236
+ txt: titleTxt,
2223
2237
  bulmaSize: bulmaSize,
2224
2238
  headingSize: heading
2225
2239
  }), React.createElement(Subtitle, {
2226
- txt: props.subtitleTxt,
2240
+ txt: subtitleTxt,
2227
2241
  bulmaSize: bulmaSize + 2,
2228
2242
  headingSize: heading + 1
2229
2243
  }));
@@ -2341,8 +2355,8 @@ var ButtonGroup = function ButtonGroup(props) {
2341
2355
  var alignment = props.alignment,
2342
2356
  className = props.className,
2343
2357
  children = props.children;
2344
- var classNames = 'field is-grouped';
2345
- classNames += props.hasAddons ? ' has-addons' : '';
2358
+ var classNames = 'field';
2359
+ classNames += props.hasAddons ? ' has-addons' : ' is-grouped';
2346
2360
  if (alignment === 'c') classNames += ' is-grouped-centered';else if (alignment === 'r') classNames += ' is-grouped-right';else classNames += ' is-grouped-left';
2347
2361
  if (className) classNames += ' ' + className;
2348
2362
  return React.createElement("div", {
@@ -2877,7 +2891,7 @@ var JSDateTime = /*#__PURE__*/function () {
2877
2891
  var ignore = false;
2878
2892
  var allowed = 'ymdhHMsSWtZO';
2879
2893
  (format + ' ').split('').forEach(function (c) {
2880
- if (prevToken == '') counter = 1;else if (!ignore && c === prevToken && allowed.includes(c)) counter++;else if (!ignore && c === prevToken && !allowed.includes(c)) {
2894
+ if (prevToken === '') counter = 1;else if (!ignore && c === prevToken && allowed.includes(c)) counter++;else if (!ignore && c === prevToken && !allowed.includes(c)) {
2881
2895
  counter++;
2882
2896
  rslt += prevToken;
2883
2897
  } else if (!ignore) {
@@ -3104,7 +3118,7 @@ var JSDateTime = /*#__PURE__*/function () {
3104
3118
  key: "weekDay",
3105
3119
  get:
3106
3120
  function get() {
3107
- return this._date.getDay() == 0 ? 7 : this._date.getDay();
3121
+ return this._date.getDay() === 0 ? 7 : this._date.getDay();
3108
3122
  }
3109
3123
  }, {
3110
3124
  key: "hr",
@@ -3323,6 +3337,7 @@ var eventKleurBlockStyleBase = {
3323
3337
  function CalendarColoredItem(_ref) {
3324
3338
  var event = _ref.event,
3325
3339
  options = _ref.options,
3340
+ tooltip = _ref.tooltip,
3326
3341
  _onClick = _ref.onClick,
3327
3342
  desc = _ref.desc;
3328
3343
  var _React$useState = React.useState(false),
@@ -3331,8 +3346,8 @@ function CalendarColoredItem(_ref) {
3331
3346
  var pickTextColor = React.useCallback(calculateTxtColor, []);
3332
3347
  var eventStyle = React.useMemo(function () {
3333
3348
  var bgColor = 'p';
3334
- if (event.evtColor) bgColor = event.evtColor(isHovered);else if (options !== null && options !== void 0 && options.evtColor) bgColor = options.evtColor(event, isHovered);
3335
- if (bgColor === 'p') bgColor = '#113670';else if (bgColor === 'i') bgColor = '#3b59ec';else if (bgColor === 'l') bgColor = '#2f47bc';else if (bgColor === 'd') bgColor = '#d91000';else if (bgColor === 's') bgColor = '#519c43';else if (bgColor === 'w') bgColor = '#eea720';
3349
+ if (event.evtColor) bgColor = typeof event.evtColor === 'function' ? event.evtColor(isHovered) : event.evtColor;else if (options !== null && options !== void 0 && options.evtColor) bgColor = options.evtColor(event, isHovered);
3350
+ if (bgColor === 'p') bgColor = "#0089b6";else if (bgColor === 'i') bgColor = "#3b59ec";else if (bgColor === 'l') bgColor = "2f47bc";else if (bgColor === 'd') bgColor = "#d91000";else if (bgColor === 's') bgColor = "#519c43";else if (bgColor === 'w') bgColor = "#eea720";
3336
3351
  bgColor += isHovered ? 'aa' : 'ff';
3337
3352
  var txtColor = pickTextColor(bgColor);
3338
3353
  return _extends({}, eventStylesBase, {
@@ -3348,6 +3363,7 @@ function CalendarColoredItem(_ref) {
3348
3363
  onClick: function onClick(e) {
3349
3364
  return _onClick && _onClick(event, e);
3350
3365
  },
3366
+ title: tooltip,
3351
3367
  style: eventStyle,
3352
3368
  onMouseEnter: function onMouseEnter() {
3353
3369
  return setHovered(true);
@@ -3361,6 +3377,7 @@ function CalendarColoredItem(_ref) {
3361
3377
  function CalendarItem(_ref) {
3362
3378
  var event = _ref.event,
3363
3379
  options = _ref.options,
3380
+ tooltip = _ref.tooltip,
3364
3381
  _onClick = _ref.onClick,
3365
3382
  desc = _ref.desc;
3366
3383
  var _React$useState = React.useState(false),
@@ -3378,8 +3395,8 @@ function CalendarItem(_ref) {
3378
3395
  }, [isHovered]);
3379
3396
  var eventSpan = React.useMemo(function () {
3380
3397
  var evtColor = 'p';
3381
- if (event.evtColor) evtColor = event.evtColor(isHovered);else if (options !== null && options !== void 0 && options.evtColor) evtColor = options.evtColor(event, isHovered);
3382
- if (evtColor === 'p') evtColor = '#113670';else if (evtColor === 'i') evtColor = '#3b59ec';else if (evtColor === 'l') evtColor = '#2f47bc';else if (evtColor === 'd') evtColor = '#d91000';else if (evtColor === 's') evtColor = '#519c43';else if (evtColor === 'w') evtColor = '#eea720';
3398
+ if (event.evtColor) evtColor = typeof event.evtColor === 'function' ? event.evtColor(isHovered) : event.evtColor;else if (options !== null && options !== void 0 && options.evtColor) evtColor = options.evtColor(event, isHovered);
3399
+ if (evtColor === 'p') evtColor = "#0089b6";else if (evtColor === 'i') evtColor = "#3b59ec";else if (evtColor === 'l') evtColor = "2f47bc";else if (evtColor === 'd') evtColor = "#d91000";else if (evtColor === 's') evtColor = "#519c43";else if (evtColor === 'w') evtColor = "#eea720";
3383
3400
  return _extends({}, eventKleurBlockStyleBase, {
3384
3401
  backgroundColor: evtColor
3385
3402
  });
@@ -3391,6 +3408,7 @@ function CalendarItem(_ref) {
3391
3408
  return _onClick && _onClick(event, e);
3392
3409
  },
3393
3410
  style: eventStyle,
3411
+ title: tooltip,
3394
3412
  onMouseEnter: function onMouseEnter() {
3395
3413
  return setHovered(true);
3396
3414
  },
@@ -3449,7 +3467,7 @@ function MoreEventsView(_ref) {
3449
3467
  desc: function desc(evt) {
3450
3468
  return React.createElement("span", null, typeof evt.title == 'string' ? evt.title : evt.title());
3451
3469
  },
3452
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3470
+ key: "" + (typeof evt.id === 'function' ? evt.id() : evt.id),
3453
3471
  event: evt,
3454
3472
  options: options === null || options === void 0 ? void 0 : options.allday,
3455
3473
  onClick: onEventClick
@@ -3457,7 +3475,7 @@ function MoreEventsView(_ref) {
3457
3475
  desc: function desc(evt) {
3458
3476
  return React.createElement(React.Fragment, null, React.createElement("strong", null, evt.startDateTime.timeHM), React.createElement("span", null, typeof evt.title == 'string' ? evt.title : evt.title()));
3459
3477
  },
3460
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3478
+ key: "" + (typeof evt.id === 'function' ? evt.id() : evt.id),
3461
3479
  event: evt,
3462
3480
  options: options === null || options === void 0 ? void 0 : options.timed,
3463
3481
  onClick: onEventClick
@@ -3531,11 +3549,13 @@ function DayContainer(_ref) {
3531
3549
  }
3532
3550
  }, " ", date.monthLong)), React.createElement("div", null, events.map(function (evt, index) {
3533
3551
  var _options$event, _options$event2, _options$event3, _options$event4;
3552
+ var key = "" + (typeof evt.id === 'function' ? evt.id() : evt.id);
3534
3553
  if (evt.allDay && index < 4) return React.createElement(CalendarColoredItem, {
3535
3554
  desc: function desc(evt) {
3536
- return React.createElement("span", null, typeof evt.title == 'string' ? evt.title : evt.title());
3555
+ return React.createElement("span", null, typeof evt.title === 'string' ? evt.title : evt.title());
3537
3556
  },
3538
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3557
+ tooltip: typeof evt.description === 'function' ? evt.description() : evt.description,
3558
+ key: key,
3539
3559
  event: evt,
3540
3560
  options: options === null || options === void 0 ? void 0 : (_options$event = options.event) === null || _options$event === void 0 ? void 0 : _options$event.allday,
3541
3561
  onClick: onEventClick
@@ -3545,34 +3565,37 @@ function DayContainer(_ref) {
3545
3565
  style: {
3546
3566
  marginLeft: '3px'
3547
3567
  }
3548
- }, typeof evt.title == 'string' ? evt.title : evt.title()));
3568
+ }, typeof evt.title === 'string' ? evt.title : evt.title()));
3549
3569
  },
3550
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3570
+ tooltip: typeof evt.description === 'function' ? evt.description() : evt.description,
3571
+ key: key,
3551
3572
  event: evt,
3552
3573
  options: options === null || options === void 0 ? void 0 : (_options$event2 = options.event) === null || _options$event2 === void 0 ? void 0 : _options$event2.timed,
3553
3574
  onClick: onEventClick
3554
- });else if (index == 4 && events.length > 5) return React.createElement(MoreEventsView, {
3575
+ });else if (index === 4 && events.length > 5) return React.createElement(MoreEventsView, {
3555
3576
  key: date.dateShort + '-more',
3556
3577
  events: events,
3557
3578
  onEventClick: onEventClick,
3558
3579
  options: options === null || options === void 0 ? void 0 : options.event
3559
- });else if (index == 4 && evt.allDay) return React.createElement(CalendarColoredItem, {
3580
+ });else if (index === 4 && evt.allDay) return React.createElement(CalendarColoredItem, {
3560
3581
  desc: function desc(evt) {
3561
- return React.createElement("span", null, typeof evt.title == 'string' ? evt.title : evt.title());
3582
+ return React.createElement("span", null, typeof evt.title === 'string' ? evt.title : evt.title());
3562
3583
  },
3563
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3584
+ tooltip: typeof evt.description === 'function' ? evt.description() : evt.description,
3585
+ key: key,
3564
3586
  event: evt,
3565
3587
  options: options === null || options === void 0 ? void 0 : (_options$event3 = options.event) === null || _options$event3 === void 0 ? void 0 : _options$event3.allday,
3566
3588
  onClick: onEventClick
3567
- });else if (index == 4 && !evt.allDay) return React.createElement(CalendarItem, {
3589
+ });else if (index === 4 && !evt.allDay) return React.createElement(CalendarItem, {
3568
3590
  desc: function desc(evt) {
3569
3591
  return React.createElement(React.Fragment, null, React.createElement("strong", null, evt.startDateTime.timeHM), React.createElement("span", {
3570
3592
  style: {
3571
3593
  marginLeft: '3px'
3572
3594
  }
3573
- }, typeof evt.title == 'string' ? evt.title : evt.title()));
3595
+ }, typeof evt.title === 'string' ? evt.title : evt.title()));
3574
3596
  },
3575
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3597
+ tooltip: typeof evt.description === 'function' ? evt.description() : evt.description,
3598
+ key: key,
3576
3599
  event: evt,
3577
3600
  options: options === null || options === void 0 ? void 0 : (_options$event4 = options.event) === null || _options$event4 === void 0 ? void 0 : _options$event4.timed,
3578
3601
  onClick: onEventClick
@@ -3580,6 +3603,165 @@ function DayContainer(_ref) {
3580
3603
  })));
3581
3604
  }
3582
3605
 
3606
+ function FourweeksView(_ref) {
3607
+ var _options$visibleDays;
3608
+ var vd = _ref.viewDate,
3609
+ options = _ref.options,
3610
+ onEventClick = _ref.onEventClick,
3611
+ onDayClick = _ref.onDayClick,
3612
+ orgEvents = _ref.events;
3613
+ var visibleDays = options !== null && options !== void 0 && options.visibleDays && (options === null || options === void 0 ? void 0 : (_options$visibleDays = options.visibleDays) === null || _options$visibleDays === void 0 ? void 0 : _options$visibleDays.size) !== 0 ? options === null || options === void 0 ? void 0 : options.visibleDays : new Set([1, 2, 3, 4, 5, 6, 7]);
3614
+ var _React$useState = React.useState(vd instanceof Date ? JSDateTime.fromDate(vd, options === null || options === void 0 ? void 0 : options.locale) : vd.clone()),
3615
+ viewDate = _React$useState[0],
3616
+ setViewDate = _React$useState[1];
3617
+ var eventConverterFn = React.useCallback(function (vd, evts) {
3618
+ var _ref2;
3619
+ var periodeNr = Math.ceil(vd.weekNr / 52 * 13);
3620
+ var start = vd.clone();
3621
+ while (Math.ceil(start.weekNr / 52 * 13) === periodeNr) {
3622
+ start = start.plus({
3623
+ days: -1
3624
+ });
3625
+ }
3626
+ var end = vd.clone();
3627
+ while (Math.ceil(end.weekNr / 52 * 13) === periodeNr) {
3628
+ end = end.plus({
3629
+ days: 1
3630
+ });
3631
+ }
3632
+ start = start.plus({
3633
+ days: 1
3634
+ });
3635
+ end = end.plus({
3636
+ days: -1
3637
+ });
3638
+ var events = ((_ref2 = evts != null ? evts : orgEvents) != null ? _ref2 : []).map(function (e) {
3639
+ e.allDay = e.allDay || !e.endDateTime;
3640
+ if (e.startDateTime instanceof Date) e.startDateTime = JSDateTime.fromDate(e.startDateTime, options === null || options === void 0 ? void 0 : options.locale);
3641
+ if (e.endDateTime && e.endDateTime instanceof Date) e.endDateTime = JSDateTime.fromDate(e.endDateTime, options === null || options === void 0 ? void 0 : options.locale);
3642
+ return e;
3643
+ }).filter(function (e) {
3644
+ return e.startDateTime.isBetween([start, end]);
3645
+ });
3646
+ var currDate = start.clone();
3647
+ var datesWithEvents = [];
3648
+ while (currDate <= end) {
3649
+ if (visibleDays.has(currDate.weekDay)) {
3650
+ (function () {
3651
+ var dayStart = currDate.startOf('day');
3652
+ var dayEnd = currDate.endOf('day');
3653
+ var dayEvents = events.filter(function (e) {
3654
+ return e.startDateTime.isBetween([dayStart, dayEnd]);
3655
+ }).sort(function (a, b) {
3656
+ if (a.allDay && !b.allDay) return -1;
3657
+ if (!a.allDay && b.allDay) return 1;
3658
+ return a.startDateTime.valueOf() - b.startDateTime.valueOf();
3659
+ });
3660
+ datesWithEvents.push([currDate, dayEvents]);
3661
+ })();
3662
+ }
3663
+ currDate = currDate.plus({
3664
+ days: 1
3665
+ });
3666
+ }
3667
+ return datesWithEvents;
3668
+ }, []);
3669
+ var _React$useState2 = React.useState(eventConverterFn(viewDate)),
3670
+ datesWithEvents = _React$useState2[0],
3671
+ setDatesWithEvents = _React$useState2[1];
3672
+ React.useEffect(function () {
3673
+ var newVd = vd instanceof Date ? JSDateTime.fromDate(vd, options === null || options === void 0 ? void 0 : options.locale) : vd.clone();
3674
+ setViewDate(newVd);
3675
+ setDatesWithEvents(eventConverterFn(newVd, orgEvents));
3676
+ }, [vd, orgEvents, options === null || options === void 0 ? void 0 : options.locale]);
3677
+ var gridContainerStyles = React.useMemo(function () {
3678
+ return _extends({}, gridContainerStylesBase, {
3679
+ gridTemplateColumns: "30px repeat(" + visibleDays.size + ", 1fr)"
3680
+ });
3681
+ }, [options === null || options === void 0 ? void 0 : options.visibleDays]);
3682
+ return React.createElement(React.Fragment, null, React.createElement("div", {
3683
+ className: "lbr-grid-container",
3684
+ style: gridContainerStyles
3685
+ }, React.createElement(FourweeksHeader, {
3686
+ visibleDays: visibleDays,
3687
+ viewDate: viewDate
3688
+ }), React.createElement(FourweeksViewDayBlocks, {
3689
+ visibleDays: visibleDays,
3690
+ viewDate: viewDate,
3691
+ datesWithEvents: datesWithEvents,
3692
+ options: options,
3693
+ onDayClick: onDayClick,
3694
+ onEventClick: onEventClick
3695
+ })));
3696
+ }
3697
+ function FourweeksHeader(_ref3) {
3698
+ var visibleDays = _ref3.visibleDays,
3699
+ viewDate = _ref3.viewDate;
3700
+ var dayNames = [];
3701
+ var date = viewDate.startOf('week');
3702
+ var end = viewDate.endOf('week');
3703
+ var dayNums = Array.from(visibleDays).sort();
3704
+ var count = 0;
3705
+ while (date <= end && count < 7) {
3706
+ if (dayNums.includes(date.weekDay)) dayNames.push(date.dayLong);
3707
+ date = date.plus({
3708
+ days: 1
3709
+ });
3710
+ count++;
3711
+ }
3712
+ var headerStyles = React.useMemo(function () {
3713
+ return _extends({}, headerContainerStylesBase);
3714
+ }, []);
3715
+ var dayNameStyles = React.useMemo(function () {
3716
+ return _extends({}, headerContainerStylesBase);
3717
+ }, []);
3718
+ return React.createElement(React.Fragment, null, React.createElement("div", {
3719
+ style: headerStyles
3720
+ }), dayNames.map(function (d) {
3721
+ return React.createElement("div", {
3722
+ key: d,
3723
+ style: dayNameStyles
3724
+ }, d);
3725
+ }));
3726
+ }
3727
+ function FourweeksViewDayBlocks(_ref4) {
3728
+ var visibleDays = _ref4.visibleDays,
3729
+ onDayClick = _ref4.onDayClick,
3730
+ onEventClick = _ref4.onEventClick,
3731
+ options = _ref4.options,
3732
+ datesWithEvents = _ref4.datesWithEvents;
3733
+ var weekLength = visibleDays.size;
3734
+ var counter = 0;
3735
+ return React.createElement(React.Fragment, null, datesWithEvents.map(function (_ref5) {
3736
+ var date = _ref5[0],
3737
+ events = _ref5[1];
3738
+ if (counter == weekLength) counter = 0;
3739
+ return React.createElement(React.Fragment, {
3740
+ key: date.ISO
3741
+ }, counter++ === 0 && React.createElement(WeekNumberCell, {
3742
+ weekNr: date.weekNr
3743
+ }), React.createElement(DayContainer, {
3744
+ key: date.ISO,
3745
+ date: date,
3746
+ events: events,
3747
+ onEventClick: onEventClick,
3748
+ onDayClick: onDayClick,
3749
+ options: options
3750
+ }));
3751
+ }));
3752
+ }
3753
+ function WeekNumberCell(_ref6) {
3754
+ var weekNr = _ref6.weekNr;
3755
+ var weekNumStyle = React.useMemo(function () {
3756
+ return _extends({}, weekNumberStylesBase);
3757
+ }, []);
3758
+ return React.createElement("div", {
3759
+ style: _extends({}, weekNumStyle, {
3760
+ borderTopWidth: '0'
3761
+ })
3762
+ }, weekNr);
3763
+ }
3764
+
3583
3765
  function MonthView(_ref) {
3584
3766
  var _options$visibleDays;
3585
3767
  var vd = _ref.viewDate,
@@ -3587,14 +3769,15 @@ function MonthView(_ref) {
3587
3769
  onEventClick = _ref.onEventClick,
3588
3770
  onDayClick = _ref.onDayClick,
3589
3771
  orgEvents = _ref.events;
3590
- var visibleDays = options !== null && options !== void 0 && options.visibleDays && (options === null || options === void 0 ? void 0 : (_options$visibleDays = options.visibleDays) === null || _options$visibleDays === void 0 ? void 0 : _options$visibleDays.size) != 0 ? options === null || options === void 0 ? void 0 : options.visibleDays : new Set([1, 2, 3, 4, 5, 6, 7]);
3772
+ var visibleDays = options !== null && options !== void 0 && options.visibleDays && (options === null || options === void 0 ? void 0 : (_options$visibleDays = options.visibleDays) === null || _options$visibleDays === void 0 ? void 0 : _options$visibleDays.size) !== 0 ? options === null || options === void 0 ? void 0 : options.visibleDays : new Set([1, 2, 3, 4, 5, 6, 7]);
3591
3773
  var _React$useState = React.useState(vd instanceof Date ? JSDateTime.fromDate(vd, options === null || options === void 0 ? void 0 : options.locale) : vd.clone()),
3592
3774
  viewDate = _React$useState[0],
3593
3775
  setViewDate = _React$useState[1];
3594
- var eventConverterFn = React.useCallback(function (vd) {
3776
+ var eventConverterFn = React.useCallback(function (vd, evts) {
3777
+ var _ref2;
3595
3778
  var start = vd.startOf('month').startOf('week').startOf('day');
3596
3779
  var end = vd.endOf('month').endOf('week').startOf('day');
3597
- var events = orgEvents.map(function (e) {
3780
+ var events = ((_ref2 = evts != null ? evts : orgEvents) != null ? _ref2 : []).map(function (e) {
3598
3781
  e.allDay = e.allDay || !e.endDateTime;
3599
3782
  if (e.startDateTime instanceof Date) e.startDateTime = JSDateTime.fromDate(e.startDateTime, options === null || options === void 0 ? void 0 : options.locale);
3600
3783
  if (e.endDateTime && e.endDateTime instanceof Date) e.endDateTime = JSDateTime.fromDate(e.endDateTime, options === null || options === void 0 ? void 0 : options.locale);
@@ -3625,13 +3808,13 @@ function MonthView(_ref) {
3625
3808
  }
3626
3809
  return datesWithEvents;
3627
3810
  }, []);
3628
- var _React$useState2 = React.useState(eventConverterFn(viewDate)),
3811
+ var _React$useState2 = React.useState(eventConverterFn(viewDate, orgEvents)),
3629
3812
  datesWithEvents = _React$useState2[0],
3630
3813
  setDatesWithEvents = _React$useState2[1];
3631
3814
  React.useEffect(function () {
3632
3815
  var newVd = vd instanceof Date ? JSDateTime.fromDate(vd, options === null || options === void 0 ? void 0 : options.locale) : vd.clone();
3633
3816
  setViewDate(newVd);
3634
- setDatesWithEvents(eventConverterFn(newVd));
3817
+ setDatesWithEvents(eventConverterFn(newVd, orgEvents));
3635
3818
  }, [vd, orgEvents, options === null || options === void 0 ? void 0 : options.locale]);
3636
3819
  var gridContainerStyles = React.useMemo(function () {
3637
3820
  return _extends({}, gridContainerStylesBase, {
@@ -3653,9 +3836,9 @@ function MonthView(_ref) {
3653
3836
  onEventClick: onEventClick
3654
3837
  })));
3655
3838
  }
3656
- function MonthViewHeader(_ref2) {
3657
- var visibleDays = _ref2.visibleDays,
3658
- viewDate = _ref2.viewDate;
3839
+ function MonthViewHeader(_ref3) {
3840
+ var visibleDays = _ref3.visibleDays,
3841
+ viewDate = _ref3.viewDate;
3659
3842
  var dayNames = [];
3660
3843
  var date = viewDate.startOf('week');
3661
3844
  var end = viewDate.endOf('week');
@@ -3683,23 +3866,24 @@ function MonthViewHeader(_ref2) {
3683
3866
  }, d);
3684
3867
  }));
3685
3868
  }
3686
- function MonthViewDayBlocks(_ref3) {
3687
- var visibleDays = _ref3.visibleDays,
3688
- onDayClick = _ref3.onDayClick,
3689
- onEventClick = _ref3.onEventClick,
3690
- options = _ref3.options,
3691
- datesWithEvents = _ref3.datesWithEvents;
3869
+ function MonthViewDayBlocks(_ref4) {
3870
+ var visibleDays = _ref4.visibleDays,
3871
+ onDayClick = _ref4.onDayClick,
3872
+ onEventClick = _ref4.onEventClick,
3873
+ options = _ref4.options,
3874
+ datesWithEvents = _ref4.datesWithEvents;
3692
3875
  var weekLength = visibleDays.size;
3693
3876
  var counter = 0;
3694
- return React.createElement(React.Fragment, null, datesWithEvents.map(function (_ref4) {
3695
- var date = _ref4[0],
3696
- events = _ref4[1];
3697
- if (counter == weekLength) counter = 0;
3877
+ return React.createElement(React.Fragment, null, datesWithEvents.map(function (_ref5) {
3878
+ var date = _ref5[0],
3879
+ events = _ref5[1];
3880
+ if (counter === weekLength) counter = 0;
3698
3881
  return React.createElement(React.Fragment, {
3699
3882
  key: date.ISO
3700
- }, counter++ == 0 && React.createElement(WeekNumberCell, {
3883
+ }, counter++ === 0 && React.createElement(WeekNumberCell$1, {
3701
3884
  weekNr: date.weekNr
3702
3885
  }), React.createElement(DayContainer, {
3886
+ key: date.ISO,
3703
3887
  date: date,
3704
3888
  events: events,
3705
3889
  onEventClick: onEventClick,
@@ -3708,8 +3892,8 @@ function MonthViewDayBlocks(_ref3) {
3708
3892
  }));
3709
3893
  }));
3710
3894
  }
3711
- function WeekNumberCell(_ref5) {
3712
- var weekNr = _ref5.weekNr;
3895
+ function WeekNumberCell$1(_ref6) {
3896
+ var weekNr = _ref6.weekNr;
3713
3897
  var weekNumStyle = React.useMemo(function () {
3714
3898
  return _extends({}, weekNumberStylesBase);
3715
3899
  }, []);
@@ -3732,7 +3916,7 @@ function AlldayContainer(_ref) {
3732
3916
  }, events.map(function (e) {
3733
3917
  var _options$event;
3734
3918
  return React.createElement(CalendarItem, {
3735
- key: typeof e.id == 'function' ? e.id() : e.id,
3919
+ key: "" + (typeof e.id === 'function' ? e.id() : e.id),
3736
3920
  event: e,
3737
3921
  onClick: onEventClick,
3738
3922
  options: options === null || options === void 0 ? void 0 : (_options$event = options.event) === null || _options$event === void 0 ? void 0 : _options$event.allday,
@@ -3783,7 +3967,7 @@ function HourSlot(_ref2) {
3783
3967
  options: options === null || options === void 0 ? void 0 : (_options$event = options.event) === null || _options$event === void 0 ? void 0 : _options$event.timed,
3784
3968
  event: evt,
3785
3969
  eventIndex: i,
3786
- key: typeof evt.id == 'function' ? evt.id() : evt.id,
3970
+ key: "" + (typeof evt.id === 'function' ? evt.id() : evt.id),
3787
3971
  desc: function desc(e) {
3788
3972
  return React.createElement(React.Fragment, null, React.createElement("b", null, e.startDateTime.timeHM), React.createElement("span", null, " ", typeof e.title === 'function' ? e.title() : e.title));
3789
3973
  },
@@ -3806,7 +3990,7 @@ function WeekTimedItem(_ref3) {
3806
3990
  var ref = React.useRef(null);
3807
3991
  var eventStyle = React.useMemo(function () {
3808
3992
  var bgColor = 'p';
3809
- if (event.evtColor) bgColor = event.evtColor(isHovered);else if (options !== null && options !== void 0 && options.evtColor) bgColor = options.evtColor(event, isHovered);
3993
+ if (event.evtColor) bgColor = typeof event.evtColor === 'function' ? event.evtColor(isHovered) : event.evtColor;else if (options !== null && options !== void 0 && options.evtColor) bgColor = options.evtColor(event, isHovered);
3810
3994
  if (bgColor === 'p') bgColor = "#0089b6";else if (bgColor === 'i') bgColor = "#3b59ec";else if (bgColor === 'l') bgColor = "2f47bc";else if (bgColor === 'd') bgColor = "#d91000";else if (bgColor === 's') bgColor = "#519c43";else if (bgColor === 'w') bgColor = "#eea720";
3811
3995
  bgColor += isHovered ? 'aa' : 'ff';
3812
3996
  var txtColor = pickTextColor(bgColor);
@@ -3844,24 +4028,25 @@ function WeekTimedItem(_ref3) {
3844
4028
  }, React.createElement("span", null, desc(event)));
3845
4029
  }
3846
4030
 
3847
- function WeekView(props) {
4031
+ function WeekView(_ref) {
3848
4032
  var _options$visibleDays;
3849
- var vd = props.viewDate,
3850
- options = props.options,
3851
- onEventClick = props.onEventClick,
3852
- orgEvents = props.events,
3853
- onDayClick = props.onDayClick;
4033
+ var vd = _ref.viewDate,
4034
+ options = _ref.options,
4035
+ onEventClick = _ref.onEventClick,
4036
+ orgEvents = _ref.events,
4037
+ onDayClick = _ref.onDayClick;
3854
4038
  var _React$useState = React.useState((_options$visibleDays = options === null || options === void 0 ? void 0 : options.visibleDays) != null ? _options$visibleDays : new Set([1, 2, 3, 4, 5, 6, 7])),
3855
4039
  visibleDays = _React$useState[0];
3856
4040
  var _React$useState2 = React.useState(vd instanceof Date ? JSDateTime.fromDate(vd, options === null || options === void 0 ? void 0 : options.locale) : vd.clone()),
3857
4041
  viewDate = _React$useState2[0],
3858
4042
  setViewDate = _React$useState2[1];
3859
- var eventConverterFn = React.useCallback(function (vd) {
4043
+ var eventConverterFn = React.useCallback(function (vd, evts) {
4044
+ var _ref2;
3860
4045
  var start = vd.startOf('week').startOf('day');
3861
4046
  var end = vd.endOf('week').plus({
3862
4047
  days: 1
3863
4048
  }).startOf('day');
3864
- var events = orgEvents.map(function (e) {
4049
+ var events = ((_ref2 = evts != null ? evts : orgEvents) != null ? _ref2 : []).map(function (e) {
3865
4050
  e.allDay = e.allDay || !e.endDateTime;
3866
4051
  if (e.startDateTime instanceof Date) e.startDateTime = JSDateTime.fromDate(e.startDateTime, options === null || options === void 0 ? void 0 : options.locale);
3867
4052
  if (e.endDateTime && e.endDateTime instanceof Date) e.endDateTime = JSDateTime.fromDate(e.endDateTime, options === null || options === void 0 ? void 0 : options.locale);
@@ -3890,16 +4075,16 @@ function WeekView(props) {
3890
4075
  days: 1
3891
4076
  });
3892
4077
  }
3893
- var allday = datesWithEvents.map(function (_ref) {
3894
- var date = _ref[0],
3895
- events = _ref[1];
4078
+ var allday = datesWithEvents.map(function (_ref3) {
4079
+ var date = _ref3[0],
4080
+ events = _ref3[1];
3896
4081
  return [date, events.filter(function (e) {
3897
4082
  return e.allDay;
3898
4083
  })];
3899
4084
  });
3900
- var timed = datesWithEvents.map(function (_ref2) {
3901
- var date = _ref2[0],
3902
- events = _ref2[1];
4085
+ var timed = datesWithEvents.map(function (_ref4) {
4086
+ var date = _ref4[0],
4087
+ events = _ref4[1];
3903
4088
  return [date, events.filter(function (e) {
3904
4089
  return !e.allDay;
3905
4090
  })];
@@ -3915,7 +4100,7 @@ function WeekView(props) {
3915
4100
  React.useEffect(function () {
3916
4101
  var newVd = vd instanceof Date ? JSDateTime.fromDate(vd, options === null || options === void 0 ? void 0 : options.locale) : vd.clone();
3917
4102
  setViewDate(newVd);
3918
- setDatesWithEvents(eventConverterFn(newVd));
4103
+ setDatesWithEvents(eventConverterFn(newVd, orgEvents));
3919
4104
  }, [vd, orgEvents, options === null || options === void 0 ? void 0 : options.visibleDays, options === null || options === void 0 ? void 0 : options.locale]);
3920
4105
  var gridContainerStyles = React.useMemo(function () {
3921
4106
  return _extends({}, gridContainerStylesBase, {
@@ -3939,9 +4124,9 @@ function WeekView(props) {
3939
4124
  height: '60px',
3940
4125
  borderBottom: 'thin solid #e1e1e1'
3941
4126
  })
3942
- }), datesWithEvents.allday.map(function (_ref3) {
3943
- var date = _ref3[0],
3944
- events = _ref3[1];
4127
+ }), datesWithEvents.allday.map(function (_ref5) {
4128
+ var date = _ref5[0],
4129
+ events = _ref5[1];
3945
4130
  return React.createElement(AlldayContainer, {
3946
4131
  key: date.dayShort,
3947
4132
  events: events,
@@ -3953,9 +4138,9 @@ function WeekView(props) {
3953
4138
  key: hour
3954
4139
  }, React.createElement(HourNumber, {
3955
4140
  hour: hour
3956
- }), datesWithEvents.timed.map(function (_ref4) {
3957
- var date = _ref4[0],
3958
- events = _ref4[1];
4141
+ }), datesWithEvents.timed.map(function (_ref6) {
4142
+ var date = _ref6[0],
4143
+ events = _ref6[1];
3959
4144
  var filteredEvts = events.filter(function (e) {
3960
4145
  return e.startDateTime.hour === hour;
3961
4146
  });
@@ -3968,11 +4153,11 @@ function WeekView(props) {
3968
4153
  }));
3969
4154
  })));
3970
4155
  }
3971
- function Header$2(_ref5) {
3972
- var onDayClick = _ref5.onDayClick,
3973
- daysWithEvents = _ref5.daysWithEvents,
3974
- _ref5$options = _ref5.options,
3975
- options = _ref5$options === void 0 ? {} : _ref5$options;
4156
+ function Header$2(_ref7) {
4157
+ var onDayClick = _ref7.onDayClick,
4158
+ daysWithEvents = _ref7.daysWithEvents,
4159
+ _ref7$options = _ref7.options,
4160
+ options = _ref7$options === void 0 ? {} : _ref7$options;
3976
4161
  var headerStyle = React.useMemo(function () {
3977
4162
  return _extends({}, headerContainerStylesBase, {
3978
4163
  cursor: onDayClick ? 'pointer' : undefined
@@ -3995,11 +4180,11 @@ function Header$2(_ref5) {
3995
4180
  color: txtColor
3996
4181
  });
3997
4182
  }, []);
3998
- return React.createElement(React.Fragment, null, daysWithEvents.map(function (_ref6) {
3999
- var date = _ref6[0];
4183
+ return React.createElement(React.Fragment, null, daysWithEvents.map(function (_ref8) {
4184
+ var date = _ref8[0];
4000
4185
  return React.createElement("div", {
4001
4186
  style: dayNameStyles,
4002
- key: date.dateShort,
4187
+ key: date.ISO,
4003
4188
  onClick: function onClick(e) {
4004
4189
  return onDayClick && onDayClick(date, e);
4005
4190
  }
@@ -4016,7 +4201,8 @@ function Header$2(_ref5) {
4016
4201
 
4017
4202
  var Calendar = {
4018
4203
  Month: MonthView,
4019
- Week: WeekView
4204
+ Week: WeekView,
4205
+ Fourweeks: FourweeksView
4020
4206
  };
4021
4207
 
4022
4208
  var InputError = function InputError(_ref) {