@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.cjs.map +1 -1
- package/dist/index.js +115 -71
- package/dist/index.js.map +1 -1
- package/package.json +21 -4
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(
|
|
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(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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-
|
|
158
|
-
"data-other": String(m.getMonth() !== k),
|
|
150
|
+
"data-rsv": "dp-month",
|
|
159
151
|
"data-active": String(
|
|
160
|
-
|
|
152
|
+
w === p.getFullYear() && b === p.getMonth()
|
|
161
153
|
),
|
|
162
154
|
"data-today": String(
|
|
163
|
-
|
|
155
|
+
w === y.getFullYear() && b === y.getMonth()
|
|
164
156
|
),
|
|
165
|
-
onClick: () => V(b),
|
|
166
|
-
children: m
|
|
157
|
+
onClick: () => V(`${w}-${L(b + 1)}-01`),
|
|
158
|
+
children: m
|
|
167
159
|
},
|
|
168
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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": "
|
|
859
|
-
"data-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
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
|
-
|
|
871
|
-
)) }
|
|
914
|
+
r.row.resource.id
|
|
915
|
+
)) })
|
|
872
916
|
] });
|
|
873
917
|
}
|
|
874
918
|
function Gt({ api: a, options: t }) {
|