ayongui
Version:
62 lines (61 loc) • 1.61 kB
JavaScript
import { j as t } from "../../../react/jsx-runtime.mjs";
import { useRef as f, useState as l, useEffect as C } from "react";
import y from "../base-calendar/index.mjs";
import i from "../select/index.mjs";
const F = (s) => {
const {
style: h,
value: x,
yearsRange: d = [1970, 2099],
selectedMode: O = "noSelect",
startOfWeek: j,
disabled: R = !1,
dayCellRender: S = null,
dateSelected: k = () => {
},
onChange: v = (e) => {
}
} = s, c = { width: 120, height: 100, ...h }, n = f(null), [a, u] = l([]), [r, m] = l([]);
C(() => {
const e = n.current.handleCreateDatePicker().months, o = n.current.handleCreateDatePicker(d).years.slice(0, 58);
u(e), m(o);
}, []);
const g = (e) => {
n.current.onYearChange(e);
}, p = (e) => {
n.current.onMonthChange(e);
};
return /* @__PURE__ */ t.jsx(
y,
{
ref: n,
...s,
style: c,
headerRender: ({ curYear: e, curMonth: o }) => /* @__PURE__ */ t.jsx(t.Fragment, { children: r.length && a.length && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
/* @__PURE__ */ t.jsx(
i,
{
style: { width: 80, marginRight: "20px" },
value: e,
defaultValue: e,
options: r,
onChange: g
}
),
/* @__PURE__ */ t.jsx(
i,
{
style: { width: 80, marginBottom: 20 },
value: o + 1,
defaultValue: o + 1,
options: a,
onChange: p
}
)
] }) })
}
);
};
export {
F as default
};