@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,456 lines • 110 kB
JavaScript
import { defineComponent as Ne, ref as c, watch as X, createVNode as D, Fragment as Ct, computed as L, onMounted as Ft, mergeProps as _e } from "vue";
import { useDateFormat as it, formatTime as yn, isMobilePhone as ya } from "../common/index.esm.js";
import { cloneDeep as se } from "lodash-es";
import { FTimePickerTimeView as va, convertToDate as vn } from "../time-picker/index.esm.js";
import { FButton as mn } from "../button/index.esm.js";
import hn from "../button-edit/index.esm.js";
import { FInputGroup as ma } from "../input-group/index.esm.js";
import bn from "../popover/index.esm.js";
import ha from "../date-picker/index.esm.js";
import { LocaleService as gn } from "../locale/index.esm.js";
const Mn = "Sun", kn = "Mon", Dn = "Tue", Tn = "Wed", pn = "Thu", On = "Fri", wn = "Sat", je = [Mn, kn, Dn, Tn, pn, On, wn], vl = { Sun: "日", Mon: "一", Tue: "二", Wed: "三", Thu: "四", Fri: "五", Sat: "六" };
var he = /* @__PURE__ */ ((e) => (e[e.previous = 1] = "previous", e[e.current = 2] = "current", e[e.next = 3] = "next", e))(he || {}), Ce = /* @__PURE__ */ ((e) => (e.Sunday = "Sun", e.Monday = "Mon", e))(Ce || {});
const Sn = {
dates: { Type: Array, default: [] },
daysInWeek: { Type: Array, default: [] },
enableKeyboadNavigate: { Type: Boolean, default: !0 },
enableMarkCurrent: { Type: Boolean, default: !0 },
enablePeriod: { Type: Boolean, default: !1 },
firstDayOfTheWeek: { Type: String, default: Ce.Sunday },
selected: { Type: Object, default: null },
selectedPeriod: { Type: Object, default: null },
selectedWeek: { Type: Object, default: null },
selectMode: { Type: String, default: "day" },
showWeekNumber: { Type: Boolean, default: !1 },
weekTitle: { Type: String, default: "Week" }
};
var ke = /* @__PURE__ */ ((e) => (e[e.enter = 13] = "enter", e[e.esc = 27] = "esc", e[e.space = 32] = "space", e[e.leftArrow = 37] = "leftArrow", e[e.upArrow = 38] = "upArrow", e[e.rightArrow = 39] = "rightArrow", e[e.downArrow = 40] = "downArrow", e[e.tab = 9] = "tab", e[e.shift = 16] = "shift", e))(ke || {});
function jt() {
function e(t) {
const f = t.key || t.keyCode;
return f === "Enter" || f === 13 ? 13 : f === "Escape" || f === 27 ? 27 : f === " " || f === 32 ? 32 : f === "ArrowLeft" || f === 37 ? 37 : f === "ArrowUp" || f === 38 ? 38 : f === "ArrowRight" || f === 39 ? 39 : f === "ArrowDown" || f === 40 ? 40 : f === "Tab" || f === 9 ? 9 : f === "Shift" || f === 16 ? 16 : -1;
}
return { getKeyCodeFromEvent: e };
}
function be(e) {
const t = Object.prototype.toString.call(e);
return e instanceof Date || typeof e == "object" && t === "[object Date]" ? new e.constructor(+e) : typeof e == "number" || t === "[object Number]" || typeof e == "string" || t === "[object String]" ? new Date(e) : /* @__PURE__ */ new Date(NaN);
}
function ut(e, t) {
return e instanceof Date ? new e.constructor(t) : new Date(t);
}
function Ve(e, t) {
const f = be(e);
return isNaN(t) ? ut(e, NaN) : (t && f.setDate(f.getDate() + t), f);
}
function Vt(e, t) {
const f = be(e);
if (isNaN(t)) return ut(e, NaN);
if (!t)
return f;
const b = f.getDate(), n = ut(e, f.getTime());
n.setMonth(f.getMonth() + t + 1, 0);
const i = n.getDate();
return b >= i ? n : (f.setFullYear(
n.getFullYear(),
n.getMonth(),
b
), f);
}
let xn = {};
function ka() {
return xn;
}
function Wt(e, t) {
var d, g, p, s;
const f = ka(), b = (t == null ? void 0 : t.weekStartsOn) ?? ((g = (d = t == null ? void 0 : t.locale) == null ? void 0 : d.options) == null ? void 0 : g.weekStartsOn) ?? f.weekStartsOn ?? ((s = (p = f.locale) == null ? void 0 : p.options) == null ? void 0 : s.weekStartsOn) ?? 0, n = be(e), i = n.getDay(), M = (i < b ? 7 : 0) + i - b;
return n.setDate(n.getDate() - M), n.setHours(0, 0, 0, 0), n;
}
function Pn(e) {
const t = be(e);
return t.setHours(0, 0, 0, 0), t;
}
function Yn(e, t) {
const f = t * 3;
return Vt(e, f);
}
function Bt(e, t) {
return Vt(e, t * 12);
}
function Nn(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function Cn(e) {
if (!Nn(e) && typeof e != "number")
return !1;
const t = be(e);
return !isNaN(Number(t));
}
function wt(e) {
const t = be(e), f = t.getMonth();
return t.setFullYear(t.getFullYear(), f + 1, 0), t.setHours(23, 59, 59, 999), t;
}
function St(e) {
const t = be(e), f = t.getMonth(), b = f - f % 3;
return t.setMonth(b, 1), t.setHours(0, 0, 0, 0), t;
}
function xt(e) {
const t = be(e);
return t.setDate(1), t.setHours(0, 0, 0, 0), t;
}
function lt(e) {
const t = be(e), f = t.getFullYear();
return t.setFullYear(f + 1, 0, 0), t.setHours(23, 59, 59, 999), t;
}
function ot(e) {
const t = be(e), f = ut(e, 0);
return f.setFullYear(t.getFullYear(), 0, 1), f.setHours(0, 0, 0, 0), f;
}
function ba(e, t) {
var d, g, p, s;
const f = ka(), b = (t == null ? void 0 : t.weekStartsOn) ?? ((g = (d = t == null ? void 0 : t.locale) == null ? void 0 : d.options) == null ? void 0 : g.weekStartsOn) ?? f.weekStartsOn ?? ((s = (p = f.locale) == null ? void 0 : p.options) == null ? void 0 : s.weekStartsOn) ?? 0, n = be(e), i = n.getDay(), M = (i < b ? -7 : 0) + 6 - (i - b);
return n.setDate(n.getDate() + M), n.setHours(23, 59, 59, 999), n;
}
function Pt(e) {
const t = be(e), f = t.getMonth(), b = f - f % 3 + 3;
return t.setMonth(b, 0), t.setHours(23, 59, 59, 999), t;
}
function Wn(e) {
const t = be(e);
return t.setMilliseconds(0), t;
}
function qe(e, t) {
return Ve(e, -t);
}
function Bn() {
return Pn(Date.now());
}
function Yt(e, t) {
return Vt(e, -t);
}
function ga(e, t) {
return Yn(e, -1);
}
function Ma(e, t) {
return Bt(e, -1);
}
function Oe() {
const { formatTo: e, parseToDate: t } = it();
function f() {
return { year: 0, month: 0, day: 0 };
}
function b(r) {
return new Date(
r.year || 0,
r.month ? r.month - 1 : 0,
r.day || 0,
r.hour ? r.hour : 0,
r.minute ? r.minute : 0,
r.second ? r.second : 0,
0
);
}
function n(r) {
const A = /* @__PURE__ */ new Date();
return r.year || (r.year = A.getFullYear()), r.month || (r.month = A.getMonth() + 1), r.day || (r.day = 1), new Date(
r.year,
r.month - 1,
r.day,
r.hour ? r.hour : 0,
r.minute ? r.minute : 0,
r.second ? r.second : 0,
0
);
}
function i(r) {
return new Date(
r.year || 1,
(r.month || 1) - 1,
r.day,
r.hour ? r.hour : 0,
r.minute ? r.minute : 0,
r.second ? r.second : 0,
0
).getDay();
}
function M(r) {
return je.indexOf(r);
}
function d(r) {
return b(r).getTime();
}
function g(r) {
return Math.round(d(r) / 1e3);
}
function p(r, A, W) {
const y = d(A), T = d(W), w = d(r);
return T - w > w - y ? A : W;
}
function s() {
const r = /* @__PURE__ */ new Date();
return {
year: r.getFullYear(),
month: r.getMonth() + 1,
day: r.getDate(),
hour: r.getHours(),
minute: r.getMinutes(),
second: r.getSeconds()
};
}
function l(r, A) {
const W = A.match(/[^(DdMmYy)]{1,}/g), y = {};
if (W) {
let T = W[0];
W[0] !== W[1] && (T = W[0] + W[1], W[2] && W[1] !== W[2] && (T += W[2]));
const w = new RegExp("[" + T + "]"), U = r.split(w), _ = A.split(w);
for (let K = 0; K < _.length; K++)
_[K].indexOf("yyyy") !== -1 && (y.year = Number(U[K])), _[K].indexOf("M") !== -1 && (y.month = Number(U[K] || "1")), _[K].indexOf("d") !== -1 && (y.day = Number(U[K] || "1"));
} else {
const T = (A + "").indexOf("yyyy"), w = (A + "").indexOf("MM"), U = (A + "").indexOf("dd");
if (T >= 0) {
const _ = r.substring(T, T + 4);
y.year = Number(_);
}
w >= 0 && (y.month = Number(r.substring(w, w + 2) || "1")), U >= 0 && (y.day = Number(r.substring(U, U + 2) || "01"));
}
return y.year === void 0 && (y.year = s().year), y;
}
function v(r) {
return {
year: r.getFullYear(),
month: r.getMonth() + 1,
day: r.getDate(),
hour: r.getHours(),
minute: r.getMinutes(),
second: r.getSeconds()
};
}
function S(r, A = !0) {
const W = new Date(1900, 1, 1, 0, 0, 0), y = new Date(9999, 12, 31, 23, 59, 59), T = A ? W : y;
let w;
return r instanceof Date ? w = r : typeof r == "string" ? w = r.trim() ? t(r, "yyyy-MM-dd HH:mm:ss") : T : w = T, Cn(w) || (w = T), {
year: w.getFullYear(),
month: w.getMonth() + 1,
day: w.getDate(),
hour: w.getHours(),
minute: w.getMinutes(),
second: w.getSeconds()
};
}
function P(r) {
return S(r, !0);
}
function N(r) {
return S(r, !1);
}
function E(r, A = !1) {
if (r && typeof r == "string") {
const W = r.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (W.length >= 2)
return {
hour: parseInt(W[0], 10),
minute: parseInt(W[1]),
second: parseInt(W[2] || "0") || 0
};
} else {
const W = /* @__PURE__ */ new Date(), y = W.getHours(), T = W.getMinutes(), w = W.getSeconds();
return A ? { hour: 0, minute: 0, second: 0 } : { hour: y, minute: T, second: w };
}
return { hour: 0, minute: 0, second: 0 };
}
function x(r) {
if (r && typeof r == "string") {
const T = r.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (T.length >= 2)
return {
hour: T[0],
minute: T[1],
second: T[2] ? T[2] : 0
};
}
return { hour: 23, minute: 59, second: 59 };
}
return {
emptyDate: f,
getDate: b,
getDate2: n,
getDayNumber: i,
getEpocTime: g,
getNearDate: p,
getWeekdayIndex: M,
getTimeInMilliseconds: d,
getToday: s,
getDateObject: l,
getMinDate: P,
getMaxDate: N,
getTimeValue: E,
getEndTimeValue: x,
convertDateToDateObject: v
};
}
function xe() {
const { getTimeInMilliseconds: e } = Oe();
function t(l) {
return l && l.year !== 0 && l.month !== 0 && l.day !== 0;
}
function f(l) {
return l && l.year !== 0 && l.month !== 0;
}
function b(l) {
return l && l.year !== 0;
}
function n(l, v) {
return e(l) < e(v);
}
function i(l, v) {
return e(l) <= e(v);
}
function M(l, v) {
return e(l) === e(v);
}
function d(l, v) {
const S = e(v);
return e(l.from) === S || e(l.to) === S;
}
function g(l, v) {
return !v || !t(v.to) || !t(v.from) ? !1 : i(v.from, l) && i(l, v.to);
}
function p(l, v) {
return t(v) && e(l) >= e(v);
}
function s(l, v) {
return t(v) && e(l) <= e(v);
}
return {
isDateEarlier: n,
equal: M,
inPeriod: g,
isPoint: d,
equalOrEarlier: i,
isInitializedDate: t,
isInitializedMonth: f,
isInitializedYear: b,
isMonthDisabledByDisableSince: p,
isMonthDisabledByDisableUntil: s
};
}
const $t = /* @__PURE__ */ Ne({
name: "FDatePickerCalendarView",
props: Sn,
emits: ["click", "clickWeek", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const f = c(e.dates), b = c(e.daysInWeek), n = c(e.enableKeyboadNavigate), i = c(e.enableMarkCurrent), M = c(e.enablePeriod), d = c(e.selected), g = c(e.selectedPeriod), p = c(e.selectedWeek), s = c(e.selectMode), l = c(e.showWeekNumber), v = c(e.weekTitle || "周");
X(() => e.dates, () => {
f.value = e.dates;
}), X(() => e.selected, () => {
d.value = e.selected;
}), X(() => e.enablePeriod, (m, B) => {
m !== B && (M.value = m);
}), X(() => e.selectedPeriod, (m) => {
g.value = m;
}), X(() => e.selectedWeek, (m) => {
p.value = m;
});
const {
equal: S,
inPeriod: P,
isInitializedDate: N,
equalOrEarlier: E,
isPoint: x
} = xe(), {
getKeyCodeFromEvent: r
} = jt(), A = (m) => {
const B = !!p.value && m.numberInTheYear === p.value.numberInTheYear;
return {
"f-datepicker-selectWeek": s.value === "week",
"f-datepicker-selectedWeek": s.value === "week" && B
};
};
function W(m) {
return P(m, g.value);
}
function y(m) {
if (!g.value)
return !1;
const B = {
from: {
year: g.value.from.year,
month: g.value.from.month,
day: g.value.from.day
},
to: {
year: g.value.to.year,
month: g.value.to.month,
day: g.value.to.day
}
};
return !!g.value && x(B, m);
}
function T(m) {
return !!d.value && S({
year: d.value.year,
month: d.value.month,
day: d.value.day
}, {
year: m.year,
month: m.month,
day: m.day
});
}
const w = (m, B, H) => {
const Y = s.value !== "week" && m.tag === he.current && (M.value && W(m.date) && !y(m.date) || m.range), Q = m.tag === he.previous || m.tag === he.next, Z = {
"f-datepicker-range": Y,
"f-datepicker-no-currmonth": Q,
"f-datepicker-disabled": m.disable,
"f-datepicker-singledate": !m.disable
}, ae = `d_${B}_${H}`;
return Z[ae] = !0, Z;
}, U = (m) => {
const B = s.value !== "week" && m.tag === he.current && (!M.value && T(m.date) || M.value && y(m.date)), H = m.isCurrent && i.value, Y = m.highlight && (m.tag === he.previous || m.tag === he.next || m.disable);
return {
"f-datepicker-date": !0,
"f-datepicker-selected": B,
"f-datepicker-current": H,
"f-datepicker-opacity": Y,
"f-datepicker-highlight": m.highlight,
"f-datepicker-disabled": m.disable
};
};
function _(m, B) {
B.disable || s.value === "week" || (m.stopPropagation(), t.emit("click", {
event: m,
dayItem: B
}));
}
function K(m, B) {
s.value === "week" && (m.stopPropagation(), t.emit("clickWeek", B));
}
function V(m, B) {
const H = r(m);
H !== ke.tab && (m.preventDefault(), H === ke.enter || H === ke.space ? _(m, B) : n.value && t.emit("keyDown", B.date));
}
function R(m) {
if (g.value && N(g.value.from) && (!N(g.value.to) || JSON.stringify(g.value.from) === JSON.stringify(g.value.to))) {
const {
from: B
} = g.value;
f.value.forEach((H) => {
H.days.forEach((Y) => {
Y.range = E(B, Y.date) && E(Y.date, m.date) || E(Y.date, B) && E(m.date, Y.date);
});
}), t.emit("mouseEnter", m.date);
}
}
function C() {
f.value.forEach((m) => {
m.days.forEach((B) => {
B.range = !1;
});
}), t.emit("mouseLeave");
}
return () => D(Ct, null, [D("div", {
class: "f-datepicker-table-wrapper"
}, [D("table", {
class: "f-datepicker-table",
cellpadding: "0"
}, [D("thead", null, [D("tr", null, [l.value && D("th", {
class: "f-datepicker-weeknbr-title",
style: "padding-bottom: 8px;padding-top: 4px"
}, [v.value]), b.value && b.value.map((m) => D("th", {
scope: "col",
style: "padding-bottom: 8px;padding-top: 4px"
}, [m]))])]), D("tbody", null, [f.value && f.value.map((m, B) => D("tr", {
class: A(m),
onClick: (H) => K(H, m)
}, [l.value && D("td", {
class: "f-datepicker-weeknbr"
}, [D("div", {
class: "f-datepicker-date"
}, [m.numberInTheYear])]), m.days && m.days.map((H, Y) => D("td", {
id: `d_${B}_${Y}`,
tabindex: "0",
class: w(H, B, Y),
onKeydown: (Q) => V(Q, H),
onMouseenter: () => R(H),
onMouseleave: () => C()
}, [H.marked && H.marked.marked && D("span", {
class: "f-datepicker-markdate",
style: {
"background-color": H.marked.color
}
}, null), D("div", {
class: U(H),
onClick: (Q) => _(Q, H)
}, [H.date.day])]))]))])])])]);
}
}), $n = {
activeMonth: { type: Object, require: !0 },
ariaLabelPrevMonth: { type: String, default: "" },
ariaLabelNextMonth: { type: String, default: "" },
dateFormat: { type: String, default: "yyyy-MM-dd" },
disablePrePage: { type: Boolean, default: !1 },
disablePreRecord: { type: Boolean, default: !1 },
disableNextRecord: { type: Boolean, default: !1 },
disableNextPage: { type: Boolean, default: !1 },
years: { type: Array, default: [[{}]] },
selectingMonth: { type: Boolean, default: !1 },
selectingYear: { type: Boolean, default: !1 },
selectMode: { type: String, default: "day" },
minDate: { type: Object },
maxDate: { type: Object },
minYear: { type: Number, default: 1900 },
maxYear: { type: Number, default: 9999 }
};
function Lt() {
const { getTimeInMilliseconds: e } = Oe(), { isInitializedDate: t } = xe();
function f(n, i) {
return t(i) && e(n) < e(i);
}
function b(n, i) {
return t(i) && e(n) > e(i);
}
return { isMonthDisabledByDisableSince: b, isMonthDisabledByDisableUntil: f };
}
function At() {
const { getToday: e } = Oe(), { isMonthDisabledByDisableSince: t, isMonthDisabledByDisableUntil: f } = Lt();
function b(s) {
const l = { displayTextOfMonth: "", month: 0, year: 0, displayTextOfYear: "" };
if (s) {
const v = s.match(/[^0-9]/), S = v && v.length ? v[0] : "", P = s.split(S);
l.month = P[0].length === 2 ? Number(P[0]) : Number(P[1]), l.year = P[0].length === 2 ? Number(P[1]) : Number(P[0]);
}
return l;
}
function n(s, l) {
return new Date(l, s, 0).getDate();
}
function i(s, l, v) {
return new Date(s, l - 1, v, 0, 0, 0, 0);
}
function M(s, l) {
const v = i(l, s, 1);
return v.setMonth(v.getMonth() - 1), n(v.getMonth() + 1, v.getFullYear());
}
function d(s, l, v, S) {
const P = e(), N = [], { year: E } = l, x = 3, r = { year: v.year, month: v.month, day: v.day }, A = { year: S.year, month: S.month, day: S.day };
for (let W = 1; W <= 12; W += x) {
const y = [];
for (let T = W; T < W + x; T++) {
const w = t({ year: E, month: T, day: 1 }, r) || f({ year: E, month: T, day: n(T, E || 0) }, A);
y.push({
month: T,
displayText: s[T],
isCurrent: T === P.month && E === P.year,
disable: w,
date: { year: E, month: T }
});
}
N.push(y);
}
return N;
}
function g(s, l) {
const v = {
year: s === 12 ? l + 1 : l
}, S = s === 12 ? 1 : s + 1;
return v.month = S, v;
}
function p(s, l) {
const v = {
year: s === 1 ? l - 1 : l
}, S = s === 1 ? 12 : s - 1;
return v.month = S, v;
}
return { daysInMonth: n, daysInPreMonth: M, generateMonths: d, parseDefaultMonth: b, getNextMonth: g, getPreviousMonth: p };
}
const Ht = /* @__PURE__ */ Ne({
name: "FDatePickerCalendarNavbar",
props: $n,
emits: ["clickMonth", "clickYear", "prePage", "preRecord", "nextRecord", "nextPage"],
setup(e, t) {
const f = c(e.ariaLabelPrevMonth), b = c(e.ariaLabelNextMonth), n = c(e.dateFormat), i = c(e.disablePrePage), M = c(e.disablePreRecord), d = c(e.disableNextRecord), g = c(e.disableNextPage), p = c(e.activeMonth), s = c(e.years), l = c(e.selectingMonth), v = c(e.selectingYear), S = c(e.selectMode), P = c(!0), N = c(!0), {
isMonthDisabledByDisableSince: E,
isMonthDisabledByDisableUntil: x
} = Lt(), {
daysInMonth: r
} = At();
X(() => e.selectingMonth, (k, j) => {
l.value = k;
}), X(() => e.selectingYear, (k, j) => {
v.value = k;
});
const A = (k, j) => ({
year: j === 1 ? k - 1 : k,
month: j === 1 ? 12 : j - 1,
day: r(j === 1 ? 12 : j - 1, j === 1 ? k - 1 : k)
}), W = (k, j) => ({
year: j === 12 ? k + 1 : k,
month: j === 12 ? 1 : j + 1,
day: 1
}), y = (k) => ({
year: k - 1,
month: 12,
day: 31
}), T = (k) => ({
year: k + 1,
month: 1,
day: 1
});
function w(k, j, ne, te, ye = "page") {
ye === "page" ? (i.value = ne || k, g.value = te || j) : ye === "record" && (M.value = ne || k, d.value = te || j);
}
function U(k, j) {
const {
minDate: ne,
maxDate: te,
minYear: ye,
maxYear: ve
} = e, me = ne ? x(y(k), ne) : !0, Pe = te ? E(T(j), te) : !0;
w(me, Pe, k <= ye, j >= ve);
}
function _(k, j) {
var ye, ve;
const ne = k || ((ye = s.value[0][1]) == null ? void 0 : ye.year), te = j || ((ve = s.value[3][1]) == null ? void 0 : ve.year);
ne !== void 0 && te !== void 0 && U(ne, te);
}
function K(k, j) {
const {
minDate: ne,
maxDate: te,
minYear: ye,
maxYear: ve
} = e, me = A(j, k), Pe = W(j, k), De = ne ? x(me, {
year: ne.year,
month: ne.month,
day: ne.day
}) : !0, Le = te ? E(Pe, {
year: te.year,
month: te.month,
day: te.day
}) : !0;
w(De, Le, k === 1 && j === ye, k === 12 && j === ve, "record"), _(j, j);
}
function V(k) {
const {
minDate: j,
maxDate: ne,
minYear: te,
maxYear: ye
} = e, ve = j ? x(y(k), j) : !0, me = ne ? E(T(k), ne) : !0;
w(ve, me, k === te, k === ye);
}
X(() => e.selectingMonth, (k, j) => {
k && V(p.value.year);
}), X(() => e.selectingYear, (k, j) => {
k && _();
}), X(() => e.years, (k, j) => {
s.value = k, v.value && _();
}), X(() => e.activeMonth, () => {
const k = e.activeMonth;
k && (p.value = {
month: k.month,
year: k.year,
displayTextOfMonth: k.displayTextOfMonth,
displayTextOfYear: k.displayTextOfYear
}, !e.selectingMonth && !e.selectingYear ? K(p.value.month, p.value.year) : e.selectingMonth ? V(p.value.year) : _());
}, {
immediate: !0
});
const R = L(() => ({
"f-datepicker-header": !0,
monthYearSelBarBorder: l.value || v.value
})), C = L(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": i.value
})), m = L(() => !l.value && !v.value), B = L(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": M.value
})), H = L(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": d.value
})), Y = L(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": g.value
})), Q = L(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-yearLabel": P.value,
"f-datepicker-labelBtnNotEdit": !P.value
})), Z = L(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-monthLabel": N.value,
"f-datepicker-labelBtnNotEdit": !N.value
})), ae = L(() => {
const k = n.value ? n.value.indexOf("yyyy") : 0, j = n.value ? n.value.indexOf("MM") : 0;
return k > j ? "MM-yyyy" : "yyyy-MM";
});
function ue(k) {
k.stopPropagation(), !i.value && t.emit("prePage");
}
function J(k) {
k.stopPropagation(), !M.value && t.emit("preRecord");
}
function oe(k) {
k.stopPropagation(), t.emit("clickYear");
}
function O(k) {
k.stopPropagation(), t.emit("clickMonth");
}
function F(k) {
k.stopPropagation(), !d.value && t.emit("nextRecord");
}
function G(k) {
k.stopPropagation(), !g.value && t.emit("nextPage");
}
const ie = L(() => {
const k = {};
return S.value === "year" && (k.cursor = "default"), k;
});
function de() {
return D("button", {
type: "button",
style: ie.value,
class: Q.value,
onClick: (k) => {
P.value && oe(k);
},
tabindex: P.value ? "0" : "-1",
disabled: S.value === "year"
}, [v.value ? s.value.length > 3 ? s.value[0][1].year + " - " + s.value[3][1].year : "" : p.value.displayTextOfYear]);
}
function ge() {
return !v.value && S.value !== "month" && D("button", {
type: "button",
class: Z.value,
onClick: (k) => {
N.value && O(k);
},
tabindex: N.value ? "0" : "-1"
}, [p.value.displayTextOfMonth]);
}
const $ = {
opacity: 0.4,
cursor: "default"
};
return () => D("div", {
class: R.value,
style: "height:40px; overflow:hidden;"
}, [D("div", {
class: "f-datepicker-prev-btn"
}, [D("button", {
type: "button",
class: C.value,
style: i.value ? $ : {},
onClick: ue
}, [D("i", {
class: "f-icon f-icon-arrow-double-60-left"
}, null)]), m.value && D("button", {
style: M.value ? $ : {},
type: "button",
"aria-label": f.value,
class: B.value,
onClick: J
}, [D("i", {
class: "f-icon f-icon-arrow-chevron-left"
}, null)])]), D("div", {
class: "f-datepicker-monthYearText"
}, [ae.value === "yyyy-MM" ? [de(), ge()] : [ge(), de()]]), D("div", {
class: "f-datepicker-next-btn"
}, [m.value && D("button", {
style: d.value ? $ : {},
type: "button",
"aria-label": b.value,
class: H.value,
onClick: F
}, [D("i", {
class: "f-icon f-icon-arrow-chevron-right"
}, null)]), D("button", {
style: g.value ? $ : {},
type: "button",
class: Y.value,
onClick: G
}, [D("i", {
class: "f-icon f-icon-arrow-double-60-right"
}, null)])])]);
}
}), Da = {
1: "一月",
2: "二月",
3: "三月",
4: "四月",
5: "五月",
6: "六月",
7: "七月",
8: "八月",
9: "九月",
10: "十月",
11: "十一月",
12: "十二月"
}, Hn = {
locales: { type: Object, default: {} },
/** */
top: { type: Number, default: 0 },
/** */
left: { type: Number, default: 0 },
/** 位置 */
position: { type: String, default: "bottom" },
/** 是否允许日期范围 */
enablePeriod: { type: Boolean, default: !1 },
dateFormat: { type: String, default: "yyyy-MM-dd" },
valueFormat: { type: String, default: "yyyy-MM-dd" },
dates: { type: Array, default: [] },
/** 禁用日期 */
disableDates: { Type: Array, default: [] },
/** 禁用范围 */
disablePeriod: { Type: Array, default: [] },
/** 自...禁用 */
disableSince: { Type: Object, default: { year: 0, month: 0, day: 0 } },
/** 禁用特定日 */
disableWeekdays: { Type: Array, default: [] },
/** 禁用周末 */
disableWeekends: { Type: Boolean, default: !1 },
/** 到...禁用 */
disableUntil: { Type: Object, default: { year: 0, month: 0, day: 0 } },
/** 是否允许键盘定位 */
enableKeyboadNavigate: { type: Boolean, default: !0 },
/** 是否启用标记当前 */
enableMarkCurrent: { type: Boolean, default: !0 },
/** 每周第一天 */
firstDayOfTheWeek: { type: String, default: Ce.Sunday },
/** 高亮日期 */
highlightDates: { Type: Array, default: [] },
/** 是否高亮周六 */
highlightSaturday: { Type: Boolean, default: !1 },
/** 是否高亮周日 */
highlightSunday: { Type: Boolean, default: !1 },
/** 最晚年限 */
maxYear: { Type: Number, default: 1e4 },
/** 最早年限 */
minYear: { Type: Number, default: 1 },
/** 模式;Embedded;popup; */
mode: { Type: String, default: "Embedded" },
/** 月份 */
months: { type: Array, default: [[]] },
/** 月份名称 */
nameOfMonths: { Type: Object, default: Da },
/** 二级日期 */
secondaryDates: { type: Array, default: [] },
/** 二级月份 */
secondaryMonths: { type: Array, default: [[]] },
/** 选择的时间*/
selectedDate: { type: Object, default: null },
/** 日期范围组件结束日期 */
selectedSecondDate: { type: Object, default: null },
/** 选择的月份 */
selectedMonth: { type: Object, default: null },
/** 选择周 */
selectedWeek: { type: Object, default: null },
/** 选择方式 */
selectMode: { type: String, default: "day" },
/** 显示第几周 */
showWeekNumber: { type: Boolean, default: !1 },
/** 每周标题 */
weekTitle: { type: String, default: "周" },
/** 年份 */
years: { Type: Array, default: [[]] },
/** 日期时间值 */
value: { type: String, default: null },
/** 是否展示时分秒 */
showTime: { type: Boolean, default: !1 },
inlineDateTime: { type: Boolean, default: !0 },
/** 启用快捷选择 */
enableQuickSelect: { type: Boolean, default: !1 },
/** 默认时间 */
defaultTime: { type: String, default: null }
}, In = {
months: { Type: Array, default: [[]] },
enableMarkCurrent: { Type: Boolean, default: !1 },
enableKeyboadNavigate: { Type: Boolean, default: !0 },
enablePeriod: { Type: Boolean, default: !1 },
selected: { Type: Object, default: null },
selectedPeriod: { Type: Object, default: null },
selectMode: { Type: String, default: "day" }
}, It = /* @__PURE__ */ Ne({
name: "FDatePickerMonthView",
props: In,
emits: ["click", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const f = c(e.months), b = c(e.enableMarkCurrent), n = c(e.enableKeyboadNavigate), i = c(e.enablePeriod), M = c(e.selected), d = c(e.selectedPeriod), {
inPeriod: g,
isInitializedDate: p,
equalOrEarlier: s
} = xe(), {
getKeyCodeFromEvent: l
} = jt();
X(() => e.months, () => {
f.value = e.months;
}), X(() => e.selected, () => {
M.value = e.selected;
}), X(() => e.selectedPeriod, (y) => {
d.value = y;
});
function v(y, T) {
y.stopPropagation(), !T.disable && t.emit("click", T.date);
}
function S(y, T) {
const w = l(y);
w !== ke.tab && (y.preventDefault(), w === ke.enter || w === ke.space ? v(y, T) : n.value && t.emit("keyDown", T));
}
function P(y) {
d.value && p(d.value.from) && !p(d.value.to) && (f.value.forEach((T) => {
T.forEach((w) => {
w.range = !!d.value && (s(d.value.from, w.date) && s(w.date, y.date) || s(w.date, d.value.from) && s(y.date, w.date));
});
}), t.emit("mouseEnter", y));
}
function N() {
f.value.forEach((y) => {
y.forEach((T) => {
T.range = !1;
});
}), t.emit("mouseLeave");
}
const E = (y, T) => y.year === T.year && y.month === T.month;
function x(y) {
return !!M.value && E(M.value, y);
}
function r(y) {
return !!d.value && (E(d.value.from, y) || E(d.value.to, y));
}
function A(y) {
return g(y, d.value);
}
const W = (y) => ({
"f-datepicker-month-cell": !0,
"f-datepicker-current": y.isCurrent && b.value,
"f-datepicker-selected": (!i.value || e.selectMode === "week") && x(y.date) || i.value && r(y.date),
"f-datepicker-disabled": y.disable,
"f-datepicker-range": A({
...y.date,
day: 1
}) || y.range
});
return () => D("div", {
class: "f-datepicker-table-wrapper"
}, [D("table", {
class: "f-datepicker-table"
}, [D("tbody", null, [f.value && f.value.map((y, T) => D("tr", null, [y.map((w, U) => D("td", {
id: `m_${T}_${U}`,
class: `m_${T}_${U}`,
onKeydown: (_) => S(_, w),
onMouseenter: () => P(w),
onMouseleave: () => N(),
tabindex: "0",
style: "width: 33.3%"
}, [D("div", {
class: "f-datepicker-month",
onClick: (_) => v(_, w)
}, [D("span", {
class: W(w)
}, [w.displayText])])]))]))])])]);
}
}), En = {
years: { Type: Array, default: [[]] },
enableKeyboadNavigate: { Type: Boolean, default: !0 },
enableMarkCurrent: { Type: Boolean, default: !0 },
enablePeriod: { Type: Boolean, default: !1 },
selected: { Type: Object, default: null },
selectedPeriod: { Type: Object, default: null },
selectMode: { Type: String, default: "day" }
}, Et = /* @__PURE__ */ Ne({
name: "FDatePickerYearView",
props: En,
emits: ["click", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const f = c(e.years), b = c(e.enableMarkCurrent), n = c(e.enableKeyboadNavigate), i = c(e.enablePeriod), M = c(e.selected), d = c(e.selectedPeriod), {
equal: g,
isInitializedDate: p,
equalOrEarlier: s
} = xe(), {
getKeyCodeFromEvent: l
} = jt();
X(() => e.years, () => {
f.value = e.years;
}), X(() => e.selected, () => {
M.value = e.selected;
});
const v = (y, T) => {
const w = `y_${y}_${T}`, U = {
"f-datepicker-no-currmonth": y === 0 && T === 0 || y === 3 && T === 2
};
return U[w] = !0, U;
};
function S(y) {
if (!d.value)
return !1;
const {
from: T,
to: w
} = d.value;
return !p(w) || !p(T) ? !1 : y != null && y.year && (T != null && T.year) && (w != null && w.year) ? y.year >= T.year && y.year <= w.year : !1;
}
function P(y) {
return !!M.value && g({
year: M.value.year
}, y);
}
function N(y) {
return !!d.value && (g({
year: d.value.from.year
}, y) || g({
year: d.value.to.year
}, y));
}
const E = (y) => ({
"f-datepicker-year-cell": !0,
"f-datepicker-current": y.isCurrent && b.value,
"f-datepicker-selected": (!i.value || e.selectMode === "week") && P(y.date) || i.value && N(y.date),
"f-datepicker-disabled": y.disable,
"f-datepicker-range": S(y.date) || y.range
});
function x(y, T) {
y.stopPropagation(), !T.disable && t.emit("click", T);
}
function r(y, T) {
const w = l(y);
w !== ke.tab && (y.preventDefault(), w === ke.enter || w === ke.space ? x(y, T) : n.value && t.emit("keyDown", T));
}
function A(y) {
d.value && p(d.value.from) && !p(d.value.to) && (f.value.forEach((T) => {
T.forEach((w) => {
w.range = !!d.value && (s(d.value.from, w.date) && s(w.date, y.date) || s(w.date, d.value.from) && s(y.date, w.date));
});
}), t.emit("mouseEnter", y));
}
function W() {
f.value.forEach((y) => {
y.forEach((T) => {
T.range = !1;
});
}), t.emit("mouseLeave");
}
return () => D("table", {
class: "f-datepicker-table-wrapper"
}, [D("tbody", {
class: "f-datepicker-table"
}, [f.value && f.value.map((y, T) => D("tr", null, [y.map((w, U) => D("td", {
id: "y_{yi}_{i}",
class: v(T, U),
onKeydown: (_) => r(_, w),
onMouseenter: () => A(w),
onMouseleave: () => W(),
tabindex: "0"
}, [D("div", {
class: "f-datepicker-year",
onClick: (_) => x(_, w)
}, [D("span", {
class: E(w)
}, [w.year])])]))]))])]);
}
});
function ze() {
function e(n) {
return new Date(
n.year || 0,
(n.month || 1) - 1,
n.day,
n.hour ? n.hour : 0,
n.minute ? n.minute : 0,
n.second ? n.second : 0,
0
).getDay();
}
function t(n) {
if (!n)
return 1;
if (!/^\d+$/.test(n.value))
return -1;
let i = Number(n.value);
return (n.format.length === 1 && n.value.length !== 1 && i < 10 || n.format.length === 1 && n.value.length !== 2 && i >= 10 || n.format.length === 2 && n.value.length > 2) && (i = -1), i;
}
function f(n, i) {
if (n.value) {
for (let M = 1; M <= 12; M++)
if (n.value.toLowerCase() === i[M].toLowerCase())
return M;
}
return -1;
}
function b(n) {
const i = new Date(n.year || 0, (n.month || 1) - 1, n.day, 0, 0, 0, 0);
return i.setDate(i.getDate() + (i.getDay() === 0 ? -3 : 4 - i.getDay())), Math.round((i.getTime() - new Date(i.getFullYear(), 0, 4).getTime()) / 864e5 / 7) + 1;
}
return { getNumberByValue: t, getDayNumber: e, getMonthNumberByMonthName: f, getWeekNumber: b };
}
function Ta(e, t, f, b, n, i, M, d) {
const { getTimeInMilliseconds: g, getWeekdayIndex: p } = Oe(), { isInitializedDate: s } = xe(), { getDayNumber: l } = ze();
function v(S) {
if (S.year && S.year < e || S.year && S.year > t)
return !0;
const P = g(S), N = S.hour !== void 0;
if (s(b) && (N ? P : P + 24 * 60 * 60 * 1e3 - 1) < g(b) || s(f) && P > g(f))
return !0;
if (M) {
const x = l(S);
if (x === 0 || x === 6)
return !0;
}
const E = l(S);
return !!(d.length > 0 && d.find((r) => p(r) === E) || n.length > 0 && n.find((r) => (r.year === 0 || r.year === S.year) && (r.month === 0 || r.month === S.month) && r.day === S.day) || i.length > 0 && i.find((r) => s(r.from) && s(r.to) && P >= g(r.from) && P <= g(r.to)));
}
return { isDisabledDate: v };
}
function Fn() {
const { getDayNumber: e } = ze();
function t(b, n, i) {
let M = [];
M = n.reduce((g, p) => {
const s = p.dates.map((l) => ({ date: l, color: p.color }));
return [...g, ...s];
}, M);
const d = M.find((g) => (g.date.year === 0 || g.date.year === b.year) && (g.date.month === 0 || g.date.month === b.month) && g.date.day === b.day);
if (d)
return { marked: !0, color: d.color };
if (i && i.marked) {
const g = e(b);
if (g === 0 || g === 6)
return { marked: !0, color: i.color };
}
return { marked: !1, color: "" };
}
function f(b, n, i, M) {
const d = e(b);
return n && d === 0 || i && d === 6 ? !0 : !!M.find((p) => (p.year === 0 || p.year === b.year) && (p.month === 0 || p.month === b.month) && p.day === b.day);
}
return { isHighlightedDate: f, isMarkedDate: t };
}
function jn({ isDisabledDate: e }) {
const { getToday: t } = Oe(), { daysInMonth: f, daysInPreMonth: b } = At(), { isHighlightedDate: n, isMarkedDate: i } = Fn(), { getWeekNumber: M } = ze();
function d(l) {
const v = je.indexOf(l);
return v > 0 ? 7 - v : 0;
}
function g(l, v, S) {
const P = /* @__PURE__ */ new Date();
P.setDate(1), P.setMonth(v - 1), P.setFullYear(l);
const N = P.getDay() + S;
return N >= 7 ? N - 7 : N;
}
function p(l, v, S, P, N) {
return l === N.day && v === N.month && S === N.year && P === he.current;
}
function s(l, v, S, P, N, E, x, r, A) {
const W = [], y = t(), T = g(v, l, d(S)), w = f(l, v), U = b(l, v);
let _ = 1, K = he.previous;
for (let V = 1; V < 7; V++) {
const R = [];
if (V === 1) {
const B = U - T + 1;
for (let Y = B; Y <= U; Y++) {
const Q = {
year: l === 1 ? v - 1 : v,
month: l === 1 ? 12 : l - 1,
day: Y
}, Z = p(Y, l, v, K, y), ae = e(Q), ue = i(Q, P, N), J = n(Q, r, x, E);
R.push({ date: Q, tag: K, isCurrent: Z, disable: ae, marked: ue, highlight: J });
}
K = he.current;
const H = 7 - R.length;
for (let Y = 0; Y < H; Y++) {
const Q = { year: v, month: l, day: _ }, Z = p(_, l, v, K, y), ae = e(Q), ue = i(Q, P, N), J = n(Q, r, x, E);
R.push({ date: Q, tag: K, isCurrent: Z, disable: ae, marked: ue, highlight: J }), _++;
}
} else
for (let B = 1; B <= 7; B++) {
_ > w && (_ = 1, K = he.next);
const H = {
year: K === he.next && l === 12 ? v + 1 : v,
month: K === he.current ? l : K === he.next && l < 12 ? l + 1 : 1,
day: _
}, Y = p(_, l, v, K, y), Q = e(H), Z = i(H, P, N), ae = n(H, r, x, E);
R.push({ date: H, tag: K, isCurrent: Y, disable: Q, marked: Z, highlight: ae }), _++;
}
const C = S === Ce.Monday ? 0 : 6, m = M(R[C].date);
W.push({ days: R, numberInTheYear: m, year: v });
}
return W;
}
return { generateCalendar: s };
}
function Vn() {
const { getToday: e } = Oe();
function t(f, b, n, i, M, d) {
const g = [], p = f - f % 10, { year: s, month: l } = b, v = e(), S = 3, P = p + 10;
for (let N = p - 1; N < P; N += S) {
const E = [];
for (let x = N; x < N + S; x++) {
const r = x < n || x > i;
E.push({
year: x,
isCurrent: x === v.year,
selected: x === s,
disable: r,
date: { year: x }
});
}
g.push(E);
}
return g;
}
return { generateYears: t };
}
function Ln() {
function e(n, i, M) {
const d = [];
if (M) {
let g = M[0];
M[0] !== M[1] && (g = M[0] + M[1], M[2] && M[1] !== M[2] && (g += M[2]));
const p = new RegExp("[" + g + "]"), s = n.split(p), l = i.split(p);
for (let v = 0; v < l.length; v++)
l[v].indexOf("yyyy") !== -1 && (d[0] = { value: s[v], format: l[v] }), l[v].indexOf("M") !== -1 && (d[1] = s[v] === void 0 ? { value: "1", format: l[v] } : { value: s[v], format: l[v] }), l[v].indexOf("d") !== -1 && (d[2] = s[v] === void 0 ? { value: "1", format: l[v] } : { value: s[v], format: l[v] });
} else {
const g = (i + "").indexOf("yyyy"), p = (i + "").indexOf("MM"), s = (i + "").indexOf("dd");
g >= 0 && (d[0] = { value: n.substring(g, g + 4), format: i.substring(g, g + 4) }), p >= 0 && (d[1] = { value: n.substring(p, p + 2), format: i.substring(p, p + 2) }), s >= 0 && (d[2] = { value: n.substring(s, s + 2), format: i.substring(s, s + 2) });
}
return d;
}
function t(n) {
return n < 10 ? "0" + Number(n) : String(n);
}
function f(n, i) {
const M = n.match(/[^(DdMmYy)]{1,}/g), d = n.indexOf(i);
return d < 0 ? n : d === 0 ? M ? n.substring(3) : n.substring(2) : d + 2 === n.length ? M ? n.substring(0, n.length - 3) : n.substring(0, n.length - 2) : M ? n.substring(0, d) + n.substring(d + 3) : n.substring(0, d) + n.substring(d + 2);
}
function b(n, i, M) {
!n.month && i.indexOf("MM") === -1 && (i = f(i, "MM")), !n.day && i.indexOf("dd") === -1 && (i = f(i, "dd"));
let d = i.replace("yyyy", String(n.year));
return i.indexOf("M") === -1 ? d = d.replace("MM", "01") : (i.indexOf("MMM") !== -1 && (d = d.replace("MMM", M[n.month || 1])), i.indexOf("MM") !== -1 ? d = d.replace("MM", t(n.month || 1)) : d = d.replace("M", String(n.month || 1))), i.indexOf("dd") === -1 ? d = d.replace("dd", "01") : i.indexOf("dd") !== -1 ? d = d.replace("dd", t(n.day || 1)) : d = d.replace("d", String(n.day || 1)), d = d.replace("MM", "mm").replace("HH", t(n.hour || 0)).replace("mm", t(n.minute || 0)).replace("ss", t(n.second || 0)), d && d.length > 2 ? d : "";
}
return { getDateValue: e, formatDate: b, preZero: t, remove: f };
}
function An(e) {
const { displayFormat: t, minYear: f, maxYear: b, selectMode: n, valueFormat: i, showTime: M, periodDelimiter: d } = e, { emptyDate: g, getToday: p } = Oe(), { getDateValue: s, preZero: l } = Ln(), { getNumberByValue: v, getMonthNumberByMonthName: S, getWeekNumber: P } = ze(), { isInitializedDate: N, isDateEarlier: E } = xe(), { isDisabledDate: x } = Ta(
e.minYear,
e.maxYear,
e.disableSince,
e.disableUntil,
e.disableDates,
e.disablePeriod,
e.disableWeekends,
e.disableWeekdays
), r = c(e.nameOfMonths), A = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function W() {
const V = p(), R = V.year, C = V.month;
switch (n) {
case "month":
return {
startMonth: { month: 0, year: R },
endMonth: { month: 0, year: R + 1 }
};
case "year":
return {
startMonth: { month: 0, year: R },
endMonth: { month: 0, year: R + 10 }
};
default: {
const m = { month: C, year: R };
let B = { month: C + 1, year: R };
return C >= 12 && (B = { month: 1, year: R + 1 }), { startMonth: m, endMonth: B };
}
}
}
function y(V, R = !1) {
let C = M, m = t, B = V;
return R && (m = i.replace(/[年,月]/g, "-").replace(/[日]/, "").replace(/[时,分]/g, ":").replace(/[秒]/g, ""), B = B.replace(/[年,月]/g, "-").replace(/[日]/, "").replace(/[时,分]/g, ":").replace(/[秒]/g, ""), (B[B.length - 1] === "-" || B[B.length - 1] === ":") && (B = B.substring(0, B.length - 1)), !M && i.toLocaleLowerCase().indexOf("hh:mm") > -1 && (C = !0)), { actualFormat: m, shouldDisplayTime: C, targetDateString: B };
}
function T(V, R = !1) {
const C = { year: 0, month: 0, day: 0 };
if (!V)
return C;
const { actualFormat: m, shouldDisplayTime: B, targetDateString: H } = y(V, R), Y = m.indexOf("MMM") !== -1;
let Q = H, Z = 0, ae = 0, ue = 0, J = m.match(/[^(DdMmYy)]{1,}/g);
if (B && H) {
Q = H.split(" ")[0], Object.assign(C, { hour: 0, minute: 0, second: 0 });
const ie = H.split(" ")[1];
if (ie) {
const de = ie.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
de[0] && (Z = Number(de[0].substr(0, 2)), Z = isNaN(Z) ? 0 : Z), de[1] && (ae = Number(de[1].substr(0, 2)), ae = isNaN(ae) ? 0 : ae), de[2] && (ue = Number(de[2].substr(0, 2)), ue = isNaN(ue) ? 0 : ue);
} else if (J = null, /^\d{1,}$/.test(H)) {
const ge = m;
Q = H.substr(0, 8);
let $ = H.substr(8);
$ && (ge.includes("HH") && $ && (Z = +$.slice(0, 2), $ = $.slice(2)), ge.includes("mm") && $ && (ae = +$.slice(0, 2), $ = $.slice(2)), ge.includes("ss") && $ && (ue = +$.slice(0, 2)));
}
} else
Q = H ? H.split(" ")[0] : "";
const oe = s(Q, m, J), O = v(oe[0]), F = Y ? S(oe[1], r.value) : v(oe[1]), G = v(oe[2]);
if (n === "year")
return { year: O, month: 1, day: 1 };
if (F !== -1 && G !== -1 && O !== -1) {
if (O < f || O > b || F < 1 || F > 12)
return C;
const ie = M ? { year: O, month: F, day: G, hour: Z, minute: ae, second: ue } : { year: O, month: F, day: G };
return x(ie) || ((O % 400 === 0 || O % 100 !== 0 && O % 4 === 0) && (A[1] = 29), G < 1 || G > A[F - 1]) ? C : n === "month" ? { year: ie.year, month: ie.month } : n === "year" ? { year: ie.year } : ie;
}
return C;
}
function w(V) {
let R = {
from: { year: 0, month: 0, day: 0 },
to: { year: 0, month: 0, day: 0 }
};
if (V && V.length) {
const C = V.split(d || "~");
if (C && C.length === 2) {
const [m, B] = C;
let H = m ? T(m, !0) : null, Y = B ? T(B, !0) : null;
if (!H && Y && (H = { ...Y }), !Y && H && (Y = { ...H }), !H && !Y)
return R;
R = { from: H, to: Y };
}
}
return R;
}
function U(V, R) {
const { from: C, to: m } = V, B = N(C), H = N(m) && JSON.stringify(C) !== JSON.stringify(m);
if (B && H)
V.from = R, V.to = g();
else if (!B)
V.from = R, !H && e.showTime && (V.to = R);
else {
if (E(R, C)) {
const Q = C;
V.to = Q, V.from = R;
} else
V.to = R;
return { from: V.from, to: V.to, emit: !0 };
}
return { from: V.from, to: V.to };
}
function _(V) {
const R = l(V.getHours()), C = l(V.getMinutes()), m = l(V.getSeconds());
return `${R}:${C}:${m}`;
}
function K(V) {
const R = w(V), C = R.from, m = R.to;
if (N(C) && N(m)) {
const B = l(C.hour || 0), H = l(C.minute || 0), Y = l(C.second || 0), Q = `${B}:${H}:${Y}`, Z = l(m.hour || 0), ae = l(m.minute || 0), ue = l(m.second || 0), J = `${Z}:${ae}:${ue}`, oe = {
year: C.year || 1,
month: C.month || 1,
displayTextOfMonth: r.value[C.month || "1"],
displayTextOfYear: `${C.year}`
}, O = {
year: m.year || 1,
month: m.month || 1,
displayTextOfMonth: r.value[m.month || "1"],
displayTextOfYear: `${m.year}`
};
if (C.month === m.month && C.year === m.year)
if (!V)
O.month >= 12 ? (O.month = 1, O.year = O.year + 1) : (O.month = O.month + 1, n === "month" && (O.year = O.year + 1), O.displayTextOfMonth = r.value[O.month]);
else {
const de = V.split("~"), ge = de[0], $ = de[1];
!ge && $ ? (oe.month === 1 ? (oe.year = oe.year - 1, oe.month = 12) : oe.month = oe.month - 1, oe.displayTextOfMonth = r.value[oe.month]) : (O.month === 12 ? (O.year = O.year + 1, O.month = 1) : O.month = O.month + 1, O.displayTextOfMonth = r.value[O.month]);
}
else n === "month" && C.year === m.year && (O.year = O.year + 1);
O.displayTextOfYear = `${O.year}`;
const F = e.firstDayOfTheWeek === Ce.Sunday ? m : C, ie = { numberInTheYear: P(F), year: F.year };
return { beginDateActiveMonth: oe, endDateActiveMonth: O, dateRange: R, beginTime: Q, endTime: J, selectedWeekInfo: ie };
}
return { dateRange: R };
}
return { normalizeDate: T, normalizeDateRange: w, setNewDateRange: U, getActiveMonth: K, getTimeStr: _, getMonthAndYear: W };
}
function Rn() {
function e(t, f) {
if (f === Ce.Monday) {
t.setDate(t.getDate() - (t.getDay() + 6) % 7);
const b = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
t.setDate(t.getDate() + 6);
const n = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
return { from: b, to: n };
} else {
t.getDay() !== 0 && t.setDate(t.getDate() - t.getDay());
const b = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
t.setDate(t.getDate() + 6 - t.getDay());
const n = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
return {
from: b,
to: n
};
}
}
return { getNowWeekTime: e };
}
function rt(e, t = 0) {
return Ve(Wt(e, {
weekStartsOn: t
}), t ? 0 : 1);
}
function qn(e, t) {
const {
locales: f
} = e, {
quickSelectors: b
} = f, n = e.showTime ? Wn(Date.now()) : Bn(), i = e.firstDayOfTheWeek === "Mon" ? 1 : 0, M = [
{
label: "今天",
value: n,
description: "选择今天日期",
code: "today"
},
{
label: "昨天",
value: qe(n, 1),
description: "选择昨天日期",
code: "yesterday"
},
{
label: "明天",
value: Ve(n, 1),
description: "选择明天日期",
code: "tomorrow"
},
{
label: "本周一",
value: rt(n, i),
description: "本周一",
code: "thisMonday"
},
{
label: "下周一",
value: Ve(rt(n, i), 7),
description: "下周一",
code: "nextMonday"
},
{
label: "本月初",
value: xt(n),
description: "本月第一天",
code: "firstDayOfMonth"
},
{
label: "本月末",
value: wt(n),
description: "本月最后一天",
code: "lastDayOfMonth"
},
// { label: '上月初', value: startOfMonth(subMonths(todayDate, 1)), description: '上月第一天', code: 'firstDayOfLastMonth' },
{
label: "年初",
value: o