loon-bulma-react 2026.0.66 → 2026.0.68

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.
@@ -1,9 +1,13 @@
1
1
  import { JSDateTime } from './../../../utils/JSDateTime.class';
2
2
  import { Locale } from 'date-fns';
3
3
  import React from 'react';
4
+ import { CalendarType } from '../Props';
4
5
  type MiniViewProps = {
5
6
  /** de viewDate waarop de mini-view start (optioneel, default = vandaag) */
6
7
  viewDate?: JSDateTime | Date;
8
+ /** de geselecteerde datum (optioneel, default = undefined) */
9
+ selectedDate?: JSDateTime | Date | undefined;
10
+ selectedViewType?: CalendarType | undefined;
7
11
  /** opties voor de weergave van de view */
8
12
  options?: MiniViewOptions;
9
13
  /** callback voor een geselecteerde datum (JS Date) */
@@ -21,5 +25,5 @@ type MiniViewOptions = {
21
25
  dateFormat?: string;
22
26
  locale?: Locale;
23
27
  };
24
- export declare function MiniView({ viewDate: vd, options: opts, onDateSelected, onJSDateTimeSelected }: MiniViewProps): React.JSX.Element;
28
+ export declare function MiniView({ viewDate: vd, selectedDate, selectedViewType, options: opts, onDateSelected, onJSDateTimeSelected }: MiniViewProps): React.JSX.Element;
25
29
  export {};
package/dist/index.js CHANGED
@@ -13158,17 +13158,18 @@ var Qg = {
13158
13158
  isAfter(e, t = !1) {
13159
13159
  return t ? this._date.valueOf() >= e.valueOf() : this._date.valueOf() > e.valueOf();
13160
13160
  }
13161
- hasSame(e, t = "millisecond") {
13162
- let n = new Date(e.valueOf());
13163
- switch (t) {
13164
- case "year": return this.yr === n.getFullYear();
13165
- case "month": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1;
13166
- case "day": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate();
13167
- case "hour": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate() && this.hr === n.getHours();
13168
- case "minute": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate() && this.hr === n.getHours() && this.min === n.getMinutes();
13169
- case "second": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate() && this.hr === n.getHours() && this.min === n.getMinutes() && this.sec === n.getSeconds();
13170
- case "millisecond": return this.valueOf() === n.valueOf();
13171
- default: throw Error(`invalid period '${t}' for hasSame()`);
13161
+ hasSame(t, n = "millisecond") {
13162
+ let r = new Date(t.valueOf());
13163
+ switch (n) {
13164
+ case "year": return this.yr === r.getFullYear();
13165
+ case "month": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1;
13166
+ case "week": return this.yr === r.getFullYear() && this.weekNr === e.fromDate(r).weekNr;
13167
+ case "day": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate();
13168
+ case "hour": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate() && this.hr === r.getHours();
13169
+ case "minute": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate() && this.hr === r.getHours() && this.min === r.getMinutes();
13170
+ case "second": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate() && this.hr === r.getHours() && this.min === r.getMinutes() && this.sec === r.getSeconds();
13171
+ case "millisecond": return this.valueOf() === r.valueOf();
13172
+ default: throw Error(`invalid period '${n}' for hasSame()`);
13172
13173
  }
13173
13174
  }
13174
13175
  equals(t) {
@@ -16754,12 +16755,12 @@ var Qy = {
16754
16755
  dateFormat: "EEEE dd MMMM yyyy",
16755
16756
  locale: n_
16756
16757
  };
16757
- function $y({ viewDate: e = r_.now(), options: n, onDateSelected: r, onJSDateTimeSelected: i }) {
16758
- let a = t.useMemo(() => r_.now(), []), [o, s] = t.useState(e instanceof Date ? r_.fromDate(e) : e);
16758
+ function $y({ viewDate: e = r_.now(), selectedDate: n = void 0, selectedViewType: r = void 0, options: i, onDateSelected: a, onJSDateTimeSelected: o }) {
16759
+ let s = t.useMemo(() => r_.now(), []), [c, l] = t.useState(e instanceof Date ? r_.fromDate(e) : e);
16759
16760
  t.useEffect(() => {
16760
- s(e instanceof Date ? r_.fromDate(e) : e);
16761
+ l(e instanceof Date ? r_.fromDate(e) : e);
16761
16762
  }, [e]);
16762
- function c(e) {
16763
+ function u(e) {
16763
16764
  return [
16764
16765
  e.weekNr.toString(),
16765
16766
  e,
@@ -16771,21 +16772,33 @@ function $y({ viewDate: e = r_.now(), options: n, onDateSelected: r, onJSDateTim
16771
16772
  e.plus({ days: 6 })
16772
16773
  ];
16773
16774
  }
16774
- function l(e) {
16775
- typeof e != "string" && (r && r(e.JSDate), i && i(e));
16775
+ function d(e) {
16776
+ typeof e != "string" && (a && a(e.JSDate), o && o(e));
16776
16777
  }
16777
- let u = t.useMemo(() => ({
16778
+ let f = t.useMemo(() => ({
16778
16779
  ...Qy,
16779
- ...n
16780
- }), [n]), d = t.useMemo(() => {
16780
+ ...i
16781
+ }), [i]), p = t.useMemo(() => {
16781
16782
  let e = [""], t = r_.now().startOf("week");
16782
- for (let n = 0; n < 7; n++) e.push(t.toFormat(u.weekDayFormat)), t = t.plus({ days: 1 });
16783
+ for (let n = 0; n < 7; n++) e.push(t.toFormat(f.weekDayFormat)), t = t.plus({ days: 1 });
16783
16784
  return e;
16784
- }, [u.weekDayFormat]), f = t.useMemo(() => {
16785
- let e = o.startOf("month").startOf("week"), t = o.endOf("month").endOf("week"), n = [];
16786
- for (; e <= t;) n = [...n, ...c(e)], e = e.plus({ weeks: 1 });
16787
- return n.length < 42 && (n = [...n, ...c(e)]), n;
16788
- }, [o]);
16785
+ }, [f.weekDayFormat]), m = t.useMemo(() => {
16786
+ let e = c.startOf("month").startOf("week"), t = c.endOf("month").endOf("week"), n = [];
16787
+ for (; e <= t;) n = [...n, ...u(e)], e = e.plus({ weeks: 1 });
16788
+ return n.length < 42 && (n = [...n, ...u(e)]), n;
16789
+ }, [c]);
16790
+ console.log(n, r);
16791
+ function h(e) {
16792
+ if (!n || !r) return !1;
16793
+ let t = n instanceof Date ? r_.fromDate(n) : n;
16794
+ switch (r) {
16795
+ case "w":
16796
+ case "l": return e.hasSame(n, "week");
16797
+ case "m": return e.hasSame(n, "month");
16798
+ case "v": return Math.ceil(e.weekNr / 52 * 13) === Math.ceil(t.weekNr / 52 * 13);
16799
+ default: return e.hasSame(t, "day");
16800
+ }
16801
+ }
16789
16802
  return /* @__PURE__ */ x("div", {
16790
16803
  className: "mini-calendar",
16791
16804
  children: [/* @__PURE__ */ x("div", {
@@ -16793,31 +16806,31 @@ function $y({ viewDate: e = r_.now(), options: n, onDateSelected: r, onJSDateTim
16793
16806
  children: [
16794
16807
  /* @__PURE__ */ b("button", {
16795
16808
  className: "mini-calendar-button is-left",
16796
- onClick: () => s(o.plus({ months: -1 })),
16809
+ onClick: () => l(c.plus({ months: -1 })),
16797
16810
  children: /* @__PURE__ */ b(Fo, { icon: ws })
16798
16811
  }),
16799
16812
  /* @__PURE__ */ b("div", {
16800
16813
  className: "is-flex-grow-1 is-flex-shrink-1",
16801
- children: o.toFormat(u.monthFormat)
16814
+ children: c.toFormat(f.monthFormat)
16802
16815
  }),
16803
16816
  /* @__PURE__ */ b("button", {
16804
16817
  className: "mini-calendar-button is-right",
16805
- onClick: () => s(o.plus({ months: 1 })),
16818
+ onClick: () => l(c.plus({ months: 1 })),
16806
16819
  children: /* @__PURE__ */ b(Fo, { icon: $o })
16807
16820
  })
16808
16821
  ]
16809
16822
  }), /* @__PURE__ */ x("div", {
16810
16823
  className: "mini-calendar-grid",
16811
- children: [d.map((e) => /* @__PURE__ */ b("div", {
16824
+ children: [p.map((e) => /* @__PURE__ */ b("div", {
16812
16825
  className: "mini-calendar-col",
16813
16826
  children: e
16814
- }, e)), f.map((e) => {
16827
+ }, e)), m.map((e) => {
16815
16828
  let t = typeof e == "string" ? "mini-calendar-row" : "mini-calendar-slot";
16816
- typeof e != "string" && e.hasSame(a, "day") && (t += " is-today"), typeof e != "string" && !e.hasSame(o, "month") && (t += " is-other-month");
16817
- let n = typeof e == "string" ? e : e.toFormat(u.dayFormat), r = typeof e == "string" ? "" : e.toFormat(u.dateFormat);
16829
+ typeof e != "string" && h(e) && (t += " is-view-period"), typeof e != "string" && e.hasSame(s, "day") ? t += " is-today" : typeof e != "string" && !e.hasSame(c, "month") && (t += " is-other-month");
16830
+ let n = typeof e == "string" ? e : e.toFormat(f.dayFormat), r = typeof e == "string" ? "" : e.toFormat(f.dateFormat);
16818
16831
  return /* @__PURE__ */ b("div", {
16819
16832
  className: t,
16820
- onClick: () => l(e),
16833
+ onClick: () => d(e),
16821
16834
  children: /* @__PURE__ */ b(tf, {
16822
16835
  content: r,
16823
16836
  delay: [1, .2],
@@ -16917,7 +16930,7 @@ function rb({ event: e, options: n, onClick: r }) {
16917
16930
  e,
16918
16931
  n,
16919
16932
  i
16920
- ]), s = typeof e.title == "function" ? e.title() : e.title, c = `allday-evt-timespan has-text-weight-bold has-text-centered m-1 ${e.allDay ? "is-allday" : "is-timed"} ${r ? "is-clickable" : ""}`.trim(), l = `allday-evt-description m-1 ${e.allDay ? "is-allday" : "is-timed"} ${r ? "is-clickable" : ""}`.trim();
16933
+ ]), s = typeof e.title == "function" ? e.title() : e.title, c = `event-timespan has-text-weight-light has-text-left m-1 ${e.allDay ? "is-allday" : "is-timed"} ${r ? "is-clickable" : ""}`.trim(), l = `event-description m-1 ${e.allDay ? "is-allday" : "is-timed"} ${r ? "is-clickable" : ""}`.trim();
16921
16934
  return /* @__PURE__ */ x(t.Fragment, { children: [/* @__PURE__ */ x("div", {
16922
16935
  className: c,
16923
16936
  onClick: (t) => r && r(e, t),
@@ -16928,14 +16941,23 @@ function rb({ event: e, options: n, onClick: r }) {
16928
16941
  className: "kleurblok mt-1",
16929
16942
  style: o
16930
16943
  }),
16931
- /* @__PURE__ */ b("span", {
16932
- className: "time",
16933
- children: e._startDateTime?.timeHM
16944
+ e.allDay && /* @__PURE__ */ b("span", {
16945
+ className: "mx-2",
16946
+ children: "Hele dag"
16934
16947
  }),
16935
- /* @__PURE__ */ b("span", { children: " - " }),
16936
- /* @__PURE__ */ b("span", {
16937
- className: "time",
16938
- children: e._endDateTime?.timeHM
16948
+ !e.allDay && /* @__PURE__ */ x("span", {
16949
+ className: "mx-2",
16950
+ children: [
16951
+ /* @__PURE__ */ b("span", {
16952
+ className: "time",
16953
+ children: e._startDateTime?.timeHM
16954
+ }),
16955
+ /* @__PURE__ */ b("span", { children: " - " }),
16956
+ /* @__PURE__ */ b("span", {
16957
+ className: "time",
16958
+ children: e._endDateTime?.timeHM
16959
+ })
16960
+ ]
16939
16961
  })
16940
16962
  ]
16941
16963
  }), /* @__PURE__ */ b("div", {
@@ -219,22 +219,23 @@ span.kleurblok {
219
219
  .calendar-listitem-grid {
220
220
  display: grid;
221
221
  grid-template-columns: 10em auto;
222
- grid-template-rows: repeat(auto-fill, 22px);
222
+ grid-auto-rows: 22px;
223
223
  padding: 0.5em;
224
224
  padding-left: 0.25em;
225
225
  border: thin solid $cell-border-color;
226
226
 
227
- .allday-evt-timespan,
228
- .timed-evt-timespan {
227
+ .event-timespan {
229
228
  vertical-align: baseline;
230
-
231
229
  display: grid;
232
- grid-template-columns: 1em 1fr 0.5em 1fr;
230
+ grid-template-columns: 1em 1fr;
233
231
  grid-template-rows: 1fr;
232
+
233
+ // .allday {
234
+ // grid-column: span 3;
235
+ // }
234
236
  }
235
237
 
236
- .allday-evt-description,
237
- .timed-evt-description {
238
+ .event-description {
238
239
  vertical-align: baseline;
239
240
  }
240
241
  }
@@ -51,37 +51,59 @@ $mini-cal-border-radius: 0.75rem;
51
51
  .mini-calendar-row {
52
52
  color: dv.$info;
53
53
  font-size: x-small;
54
- margin-top: auto;
55
- margin-bottom: auto;
54
+ // margin-top: auto;
55
+ // margin-bottom: auto;
56
56
  text-align: center;
57
57
  padding: 0.25em;
58
+ padding-top: 0.75em;
59
+ text-align: center;
60
+ vertical-align: middle;
58
61
  }
62
+
63
+ // .mini-calendar-row {
64
+ // // Week-number cell can react when the first day in that row is in the selected period.
65
+ // &:has(+ .mini-calendar-slot.is-view-period) {
66
+ // font-weight: 700;
67
+ // background-color: #337eff22;
68
+ // }
69
+ // }
70
+
59
71
  .mini-calendar-slot {
60
72
  vertical-align: middle;
61
73
  text-align: center;
62
- border-radius: $mini-cal-border-radius;
63
- transition: background-color 0.1s ease-in-out;
74
+ // border-radius: $mini-cal-border-radius;
75
+ transition: color 0.1s ease-in-out;
64
76
  padding: 0.25em;
65
77
 
66
- &.is-today {
67
- color: dv.$success;
68
- font-weight: bold;
78
+ &.is-other-month {
79
+ color: dv.$text-weak;
80
+ font-weight: 200;
81
+ }
82
+
83
+ &.is-view-period {
84
+ background-color: #337eff22;
85
+
86
+ // color: dv.$info;
69
87
  &:hover {
70
88
  cursor: pointer;
71
- background-color: dv.$success;
72
- color: fn.bulmaFindColorInvert(dv.$success);
89
+ color: dv.$info;
90
+ font-weight: 700;
73
91
  }
74
92
  }
75
93
 
76
- &.is-other-month {
77
- color: dv.$text-weak;
78
- font-weight: 200;
94
+ &.is-today {
95
+ color: dv.$success;
96
+ font-weight: 700;
97
+ &:hover {
98
+ cursor: pointer;
99
+ color: default;
100
+ }
79
101
  }
80
102
 
81
103
  &:hover {
82
104
  cursor: pointer;
83
- background-color: dv.$primary;
84
- color: fn.bulmaFindColorInvert(dv.$primary);
105
+ color: dv.$info;
106
+ font-weight: 700;
85
107
  }
86
108
  }
87
109
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loon-bulma-react",
3
3
  "private": false,
4
- "version": "2026.0.66",
4
+ "version": "2026.0.68",
5
5
  "description": "Bulma &amp; React componenten voor Loon Salarissoftware",
6
6
  "type": "module",
7
7
  "license": "MIT",