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