@reservi/preact 1.1.0 → 1.2.0

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
@@ -42,7 +42,10 @@ function pt(a) {
42
42
  }
43
43
  function bt({ api: a, title: t, activeView: r, options: e }) {
44
44
  var T, _, P, j, U;
45
- const o = E(e.locale), i = (_ = (T = e.slots) == null ? void 0 : T.toolbarStart) == null ? void 0 : _.call(T), u = (j = (P = e.slots) == null ? void 0 : P.toolbarEnd) == null ? void 0 : j.call(P), d = pt(e), s = yt.test(r), c = e.firstDay ?? o.firstDay, h = F(null), [g, f] = R(!1), p = l.toDate(a.getDate()), y = l.toDate(e.now ? l.from(e.now) : l.now()), [w, D] = R(p.getFullYear()), [k, S] = R(p.getMonth()), M = new Intl.DateTimeFormat(e.locale, { month: "short" }), at = new Intl.DateTimeFormat(e.locale, { month: "long" }), nt = new Intl.DateTimeFormat(e.locale, { weekday: "short" }), ot = Array.from({ length: 12 }, (m, b) => M.format(new Date(2020, b, 1))), N = () => {
45
+ const o = E(e.locale), i = (_ = (T = e.slots) == null ? void 0 : T.toolbarStart) == null ? void 0 : _.call(T), u = (j = (P = e.slots) == null ? void 0 : P.toolbarEnd) == null ? void 0 : j.call(P), d = pt(e), s = yt.test(r), c = e.firstDay ?? o.firstDay, h = F(null), [g, f] = R(!1), p = l.toDate(a.getDate()), y = l.toDate(e.now ? l.from(e.now) : l.now()), [w, D] = R(p.getFullYear()), [k, S] = R(p.getMonth()), M = new Intl.DateTimeFormat(e.locale, { month: "short" }), at = new Intl.DateTimeFormat(e.locale, { month: "long" }), nt = new Intl.DateTimeFormat(e.locale, { weekday: "short" }), ot = Array.from(
46
+ { length: 12 },
47
+ (m, b) => M.format(new Date(2020, b, 1))
48
+ ), N = () => {
46
49
  const m = l.toDate(a.getDate());
47
50
  D(m.getFullYear()), S(m.getMonth()), f(!0);
48
51
  }, H = (m) => {
@@ -109,67 +112,78 @@ function bt({ api: a, title: t, activeView: r, options: e }) {
109
112
  ]
110
113
  }
111
114
  ),
112
- g && /* @__PURE__ */ v("div", { "data-rsv": "datepicker", "data-rsv-mode": s ? "month" : "day", role: "dialog", "aria-label": t, children: [
113
- /* @__PURE__ */ v("div", { "data-rsv": "dp-head", children: [
114
- /* @__PURE__ */ n(
115
- "button",
116
- {
117
- type: "button",
118
- "data-rsv": "dp-nav",
119
- "aria-label": o.prev,
120
- onClick: () => s ? D((m) => m - 1) : H(-1),
121
- children: I.prev
122
- }
123
- ),
124
- /* @__PURE__ */ n("span", { "data-rsv": "dp-label", children: s ? w : `${at.format(new Date(w, k, 1))} ${w}` }),
125
- /* @__PURE__ */ n(
126
- "button",
127
- {
128
- type: "button",
129
- "data-rsv": "dp-nav",
130
- "aria-label": o.next,
131
- onClick: () => s ? D((m) => m + 1) : H(1),
132
- children: I.next
133
- }
134
- )
135
- ] }),
136
- s ? /* @__PURE__ */ n("div", { "data-rsv": "dp-grid", children: ot.map((m, b) => /* @__PURE__ */ n(
137
- "button",
138
- {
139
- type: "button",
140
- "data-rsv": "dp-month",
141
- "data-active": String(
142
- w === p.getFullYear() && b === p.getMonth()
143
- ),
144
- "data-today": String(w === y.getFullYear() && b === y.getMonth()),
145
- onClick: () => V(`${w}-${L(b + 1)}-01`),
146
- children: m
147
- },
148
- m
149
- )) }) : /* @__PURE__ */ v("div", { "data-rsv": "dp-days", children: [
150
- B.dows.map((m, b) => /* @__PURE__ */ n("div", { "data-rsv": "dp-dow", children: m }, `dow-${b}`)),
151
- B.cells.map((m) => {
152
- const b = `${m.getFullYear()}-${L(m.getMonth() + 1)}-${L(m.getDate())}`;
153
- return /* @__PURE__ */ n(
115
+ g && /* @__PURE__ */ v(
116
+ "div",
117
+ {
118
+ "data-rsv": "datepicker",
119
+ "data-rsv-mode": s ? "month" : "day",
120
+ role: "dialog",
121
+ "aria-label": t,
122
+ children: [
123
+ /* @__PURE__ */ v("div", { "data-rsv": "dp-head", children: [
124
+ /* @__PURE__ */ n(
125
+ "button",
126
+ {
127
+ type: "button",
128
+ "data-rsv": "dp-nav",
129
+ "aria-label": o.prev,
130
+ onClick: () => s ? D((m) => m - 1) : H(-1),
131
+ children: I.prev
132
+ }
133
+ ),
134
+ /* @__PURE__ */ n("span", { "data-rsv": "dp-label", children: s ? w : `${at.format(new Date(w, k, 1))} ${w}` }),
135
+ /* @__PURE__ */ n(
136
+ "button",
137
+ {
138
+ type: "button",
139
+ "data-rsv": "dp-nav",
140
+ "aria-label": o.next,
141
+ onClick: () => s ? D((m) => m + 1) : H(1),
142
+ children: I.next
143
+ }
144
+ )
145
+ ] }),
146
+ s ? /* @__PURE__ */ n("div", { "data-rsv": "dp-grid", children: ot.map((m, b) => /* @__PURE__ */ n(
154
147
  "button",
155
148
  {
156
149
  type: "button",
157
- "data-rsv": "dp-day",
158
- "data-other": String(m.getMonth() !== k),
150
+ "data-rsv": "dp-month",
159
151
  "data-active": String(
160
- m.getFullYear() === p.getFullYear() && m.getMonth() === p.getMonth() && m.getDate() === p.getDate()
152
+ w === p.getFullYear() && b === p.getMonth()
161
153
  ),
162
154
  "data-today": String(
163
- m.getFullYear() === y.getFullYear() && m.getMonth() === y.getMonth() && m.getDate() === y.getDate()
155
+ w === y.getFullYear() && b === y.getMonth()
164
156
  ),
165
- onClick: () => V(b),
166
- children: m.getDate()
157
+ onClick: () => V(`${w}-${L(b + 1)}-01`),
158
+ children: m
167
159
  },
168
- b
169
- );
170
- })
171
- ] })
172
- ] })
160
+ m
161
+ )) }) : /* @__PURE__ */ v("div", { "data-rsv": "dp-days", children: [
162
+ B.dows.map((m, b) => /* @__PURE__ */ n("div", { "data-rsv": "dp-dow", children: m }, `dow-${b}`)),
163
+ B.cells.map((m) => {
164
+ const b = `${m.getFullYear()}-${L(m.getMonth() + 1)}-${L(m.getDate())}`;
165
+ return /* @__PURE__ */ n(
166
+ "button",
167
+ {
168
+ type: "button",
169
+ "data-rsv": "dp-day",
170
+ "data-other": String(m.getMonth() !== k),
171
+ "data-active": String(
172
+ m.getFullYear() === p.getFullYear() && m.getMonth() === p.getMonth() && m.getDate() === p.getDate()
173
+ ),
174
+ "data-today": String(
175
+ m.getFullYear() === y.getFullYear() && m.getMonth() === y.getMonth() && m.getDate() === y.getDate()
176
+ ),
177
+ onClick: () => V(b),
178
+ children: m.getDate()
179
+ },
180
+ b
181
+ );
182
+ })
183
+ ] })
184
+ ]
185
+ }
186
+ )
173
187
  ] }),
174
188
  /* @__PURE__ */ n(
175
189
  "button",
@@ -379,7 +393,16 @@ function St({
379
393
  }) : void 0,
380
394
  children: [
381
395
  u,
382
- t.events.filter((y) => y.display !== "none").map((y) => /* @__PURE__ */ n(et, { api: a, event: y, options: r, sourceDate: c }, y.id)),
396
+ t.events.filter((y) => y.display !== "none").map((y) => /* @__PURE__ */ n(
397
+ et,
398
+ {
399
+ api: a,
400
+ event: y,
401
+ options: r,
402
+ sourceDate: c
403
+ },
404
+ y.id
405
+ )),
383
406
  t.moreCount > 0 && /* @__PURE__ */ v("div", { "data-rsv": "more-anchor", children: [
384
407
  /* @__PURE__ */ n("button", { type: "button", "data-rsv": "more-link", onClick: f, children: E(r.locale).more(t.moreCount) }),
385
408
  d && /* @__PURE__ */ n(
@@ -587,7 +610,16 @@ function Et({ api: a, model: t, options: r }) {
587
610
  }
588
611
  )
589
612
  ] }),
590
- d.timedSegs.filter((h) => h.event.display !== "none").map((h) => /* @__PURE__ */ n($t, { api: a, seg: h, model: t, options: r }, h.event.id)),
613
+ d.timedSegs.filter((h) => h.event.display !== "none").map((h) => /* @__PURE__ */ n(
614
+ $t,
615
+ {
616
+ api: a,
617
+ seg: h,
618
+ model: t,
619
+ options: r
620
+ },
621
+ h.event.id
622
+ )),
591
623
  ((c = t.nowIndicator) == null ? void 0 : c.dayIndex) === s && /* @__PURE__ */ n("div", { "data-rsv": "now-indicator", style: `top:${t.nowIndicator.topPct}%` })
592
624
  ]
593
625
  },
@@ -749,7 +781,11 @@ function rt({
749
781
  tabIndex: 0,
750
782
  style: `position:absolute;left:${t.leftPct}%;width:${t.widthPct}%;top:${t.lane * Y}rem;height:${Y - 0.2}rem;--rsv-event-bg:${e.backgroundColor};--rsv-event-fg:${e.textColor}`,
751
783
  onClick: () => a.trigger("eventClick", { event: e }),
752
- children: x((o = r.slots) == null ? void 0 : o.eventContent, { event: e, isAllDay: e.allDay, timeText: "" }, e.title)
784
+ children: x(
785
+ (o = r.slots) == null ? void 0 : o.eventContent,
786
+ { event: e, isAllDay: e.allDay, timeText: "" },
787
+ e.title
788
+ )
753
789
  }
754
790
  );
755
791
  }
@@ -852,23 +888,31 @@ function Rt({ api: a, model: t, options: r }) {
852
888
  function Ft({ api: a, model: t }) {
853
889
  return /* @__PURE__ */ v("div", { "data-rsv": "resource-daygrid", style: `--rsv-rdg-cols:${t.columns.length}`, children: [
854
890
  /* @__PURE__ */ n("div", { "data-rsv": "rdg-header", role: "row", children: t.columns.map((r) => /* @__PURE__ */ n("div", { "data-rsv": "rdg-col-header", role: "columnheader", children: r.row.resource.title }, r.row.resource.id)) }),
855
- /* @__PURE__ */ n("div", { "data-rsv": "rdg-body", role: "row", children: t.columns.map((r) => /* @__PURE__ */ n("div", { "data-rsv": "rdg-col", "data-rsv-resource-id": r.row.resource.id, children: r.events.map((e) => /* @__PURE__ */ v(
891
+ /* @__PURE__ */ n("div", { "data-rsv": "rdg-body", role: "row", children: t.columns.map((r) => /* @__PURE__ */ n(
856
892
  "div",
857
893
  {
858
- "data-rsv": "event",
859
- "data-all-day": String(e.allDay),
860
- "data-event-id": e.id,
861
- role: "button",
862
- tabIndex: 0,
863
- style: `--rsv-event-bg:${e.backgroundColor};--rsv-event-fg:${e.textColor}`,
864
- onClick: () => a.trigger("eventClick", { event: e }),
865
- children: [
866
- e.allDay ? "" : l.format(e.start, "HH:mm") + " ",
867
- e.title
868
- ]
894
+ "data-rsv": "rdg-col",
895
+ "data-rsv-resource-id": r.row.resource.id,
896
+ children: r.events.map((e) => /* @__PURE__ */ v(
897
+ "div",
898
+ {
899
+ "data-rsv": "event",
900
+ "data-all-day": String(e.allDay),
901
+ "data-event-id": e.id,
902
+ role: "button",
903
+ tabIndex: 0,
904
+ style: `--rsv-event-bg:${e.backgroundColor};--rsv-event-fg:${e.textColor}`,
905
+ onClick: () => a.trigger("eventClick", { event: e }),
906
+ children: [
907
+ e.allDay ? "" : l.format(e.start, "HH:mm") + " ",
908
+ e.title
909
+ ]
910
+ },
911
+ e.id
912
+ ))
869
913
  },
870
- e.id
871
- )) }, r.row.resource.id)) })
914
+ r.row.resource.id
915
+ )) })
872
916
  ] });
873
917
  }
874
918
  function Gt({ api: a, options: t }) {