Rebuild all components
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s

This commit is contained in:
2026-04-21 18:00:17 +02:00
parent d900659d88
commit 16afea2768
67 changed files with 1820 additions and 2132 deletions

View File

@@ -1,15 +1,14 @@
// components/Calendar.js
import { $, Tag, Watch } from "sigpro";
import { $, Tag } from "sigpro";
export const Calendar = (props) => {
const { value, range = false, hour = false, onChange, class: className = "" } = props;
const internalDate = $(new Date());
const hoverDate = $(null);
const startHour = $(0);
const endHour = $(0);
const isRangeMode = () => {
const r = typeof range === "function" ? range() : range;
const r = typeof props.range === "function" ? props.range() : props.range;
return r === true;
};
@@ -24,8 +23,7 @@ export const Calendar = (props) => {
};
const getCurrentValue = () => {
const v = value;
return typeof v === "function" ? v() : v;
return typeof props.value === "function" ? props.value() : props.value;
};
const selectDate = (date) => {
@@ -37,9 +35,9 @@ export const Calendar = (props) => {
const newValue = {
start: dateStr,
end: null,
...(hour && { startHour: startHour() }),
...(props.hour && { startHour: startHour() }),
};
onChange?.(newValue);
props.onChange?.(newValue);
} else {
const start = current.start;
let newValue;
@@ -48,15 +46,15 @@ export const Calendar = (props) => {
} else {
newValue = { start, end: dateStr };
}
if (hour) {
if (props.hour) {
newValue.startHour = current.startHour !== undefined ? current.startHour : startHour();
newValue.endHour = endHour();
}
onChange?.(newValue);
props.onChange?.(newValue);
}
} else {
const newValue = hour ? `${dateStr}T${String(startHour()).padStart(2, "0")}:00:00` : dateStr;
onChange?.(newValue);
const newValue = props.hour ? `${dateStr}T${String(startHour()).padStart(2, "0")}:00:00` : dateStr;
props.onChange?.(newValue);
}
};
@@ -88,7 +86,7 @@ export const Calendar = (props) => {
]);
};
return Tag("div", { class: `p-4 bg-base-100 border border-base-300 shadow-2xl rounded-box w-80 select-none ${className}`.trim() }, [
return Tag("div", { class: `p-4 bg-base-100 border border-base-300 shadow-2xl rounded-box w-80 select-none ${props.class ?? ''}`.trim() }, [
Tag("div", { class: "flex justify-between items-center mb-4 gap-1" }, [
Tag("div", { class: "flex gap-0.5" }, [
Tag("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(-1) },
@@ -162,7 +160,7 @@ export const Calendar = (props) => {
}
]),
hour ? Tag("div", { class: "mt-3 pt-2 border-t border-base-300" }, [
props.hour ? Tag("div", { class: "mt-3 pt-2 border-t border-base-300" }, [
isRangeMode()
? Tag("div", { class: "flex gap-4" }, [
HourSlider({ value: startHour, onChange: (h) => startHour(h) }),