@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,489 lines • 134 kB
JavaScript
import { defineComponent as ge, ref as y, watch as ee, createVNode as O, Fragment as hn, computed as A, onMounted as Re, mergeProps as Ie, inject as Ct } from "vue";
import { useDateFormat as lt, formatTime as Ta, FormSchemaEntityFieldTypeName as Da } from "../common/index.esm.js";
import { cloneDeep as ae, isPlainObject as ln } from "lodash-es";
import { FTimePickerTimeView as sn, convertToDate as Oa } from "../time-picker/index.esm.js";
import { FButton as wa } from "../button/index.esm.js";
import { resolveAppearance as Sa, createPropsResolver as Pa } from "../dynamic-resolver/index.esm.js";
import xa from "../button-edit/index.esm.js";
import { FInputGroup as un } from "../input-group/index.esm.js";
import Ca from "../popover/index.esm.js";
import { useI18n as Fa } from "vue-i18n";
import Na from "../../designer/button-edit/index.esm.js";
import cn from "../../designer/input-group/index.esm.js";
import { useDesignerComponent as bn } from "../designer-canvas/index.esm.js";
import { InputBaseProperty as Ya } from "../property-panel/index.esm.js";
const $a = "Sun", Ha = "Mon", Ea = "Tue", Ba = "Wed", Wa = "Thu", ja = "Fri", Ia = "Sat", Ne = [$a, Ha, Ea, Ba, Wa, ja, Ia], Ir = { Sun: "日", Mon: "一", Tue: "二", Wed: "三", Thu: "四", Fri: "五", Sat: "六" };
var de = /* @__PURE__ */ ((e) => (e[e.previous = 1] = "previous", e[e.current = 2] = "current", e[e.next = 3] = "next", e))(de || {}), Te = /* @__PURE__ */ ((e) => (e.Sunday = "Sun", e.Monday = "Mon", e))(Te || {});
const Ra = {
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: Te.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 ve = /* @__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))(ve || {});
function Ht() {
function e(t) {
const n = t.key || t.keyCode;
return n === "Enter" || n === 13 ? 13 : n === "Escape" || n === 27 ? 27 : n === " " || n === 32 ? 32 : n === "ArrowLeft" || n === 37 ? 37 : n === "ArrowUp" || n === 38 ? 38 : n === "ArrowRight" || n === 39 ? 39 : n === "ArrowDown" || n === 40 ? 40 : n === "Tab" || n === 9 ? 9 : n === "Shift" || n === 16 ? 16 : -1;
}
return { getKeyCodeFromEvent: e };
}
function ye(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 ot(e, t) {
return e instanceof Date ? new e.constructor(t) : new Date(t);
}
function rt(e, t) {
const n = ye(e);
return isNaN(t) ? ot(e, NaN) : (t && n.setDate(n.getDate() + t), n);
}
function Et(e, t) {
const n = ye(e);
if (isNaN(t)) return ot(e, NaN);
if (!t)
return n;
const a = n.getDate(), o = ot(e, n.getTime());
o.setMonth(n.getMonth() + t + 1, 0);
const g = o.getDate();
return a >= g ? o : (n.setFullYear(
o.getFullYear(),
o.getMonth(),
a
), n);
}
let Aa = {};
function gn() {
return Aa;
}
function tt(e, t) {
var h, S, d, u;
const n = gn(), a = (t == null ? void 0 : t.weekStartsOn) ?? ((S = (h = t == null ? void 0 : t.locale) == null ? void 0 : h.options) == null ? void 0 : S.weekStartsOn) ?? n.weekStartsOn ?? ((u = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : u.weekStartsOn) ?? 0, o = ye(e), g = o.getDay(), T = (g < a ? 7 : 0) + g - a;
return o.setDate(o.getDate() - T), o.setHours(0, 0, 0, 0), o;
}
function La(e) {
const t = ye(e);
return t.setHours(0, 0, 0, 0), t;
}
function Va(e, t) {
const n = t * 3;
return Et(e, n);
}
function qa(e, t) {
const n = t * 7;
return rt(e, n);
}
function _a(e, t) {
return Et(e, t * 12);
}
function za(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function Qa(e) {
if (!za(e) && typeof e != "number")
return !1;
const t = ye(e);
return !isNaN(Number(t));
}
function Dt(e) {
const t = ye(e), n = t.getMonth();
return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t;
}
function Ot(e) {
const t = ye(e), n = t.getMonth(), a = n - n % 3;
return t.setMonth(a, 1), t.setHours(0, 0, 0, 0), t;
}
function nt(e) {
const t = ye(e);
return t.setDate(1), t.setHours(0, 0, 0, 0), t;
}
function wt(e) {
const t = ye(e), n = t.getFullYear();
return t.setFullYear(n + 1, 0, 0), t.setHours(23, 59, 59, 999), t;
}
function St(e) {
const t = ye(e), n = ot(e, 0);
return n.setFullYear(t.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
}
function dn(e, t) {
var h, S, d, u;
const n = gn(), a = (t == null ? void 0 : t.weekStartsOn) ?? ((S = (h = t == null ? void 0 : t.locale) == null ? void 0 : h.options) == null ? void 0 : S.weekStartsOn) ?? n.weekStartsOn ?? ((u = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : u.weekStartsOn) ?? 0, o = ye(e), g = o.getDay(), T = (g < a ? -7 : 0) + 6 - (g - a);
return o.setDate(o.getDate() + T), o.setHours(23, 59, 59, 999), o;
}
function Pt(e) {
const t = ye(e), n = t.getMonth(), a = n - n % 3 + 3;
return t.setMonth(a, 0), t.setHours(23, 59, 59, 999), t;
}
function je(e, t) {
return rt(e, -t);
}
function J() {
return La(Date.now());
}
function at(e, t) {
return Et(e, -t);
}
function fn(e, t) {
return Va(e, -t);
}
function yn(e, t) {
return qa(e, -t);
}
function mn(e, t) {
return _a(e, -t);
}
function Me() {
const { formatTo: e, parseToDate: t } = lt();
function n() {
return { year: 0, month: 0, day: 0 };
}
function a(i) {
return new Date(
i.year || 0,
i.month ? i.month - 1 : 0,
i.day || 0,
i.hour ? i.hour : 0,
i.minute ? i.minute : 0,
i.second ? i.second : 0,
0
);
}
function o(i) {
const W = /* @__PURE__ */ new Date();
return i.year || (i.year = W.getFullYear()), i.month || (i.month = W.getMonth() + 1), i.day || (i.day = 1), new Date(
i.year,
i.month - 1,
i.day,
i.hour ? i.hour : 0,
i.minute ? i.minute : 0,
i.second ? i.second : 0,
0
);
}
function g(i) {
return new Date(
i.year || 1,
(i.month || 1) - 1,
i.day,
i.hour ? i.hour : 0,
i.minute ? i.minute : 0,
i.second ? i.second : 0,
0
).getDay();
}
function T(i) {
return Ne.indexOf(i);
}
function h(i) {
return a(i).getTime();
}
function S(i) {
return Math.round(h(i) / 1e3);
}
function d(i, W, B) {
const R = h(W), f = h(B), P = h(i);
return f - P > P - R ? W : B;
}
function u() {
const i = /* @__PURE__ */ new Date();
return {
year: i.getFullYear(),
month: i.getMonth() + 1,
day: i.getDate(),
hour: i.getHours(),
minute: i.getMinutes(),
second: i.getSeconds()
};
}
function l(i, W) {
const B = W.match(/[^(DdMmYy)]{1,}/g), R = {};
if (B) {
let f = B[0];
B[0] !== B[1] && (f = B[0] + B[1], B[2] && B[1] !== B[2] && (f += B[2]));
const P = new RegExp("[" + f + "]"), E = i.split(P), $ = W.split(P);
for (let q = 0; q < $.length; q++)
$[q].indexOf("yyyy") !== -1 && (R.year = Number(E[q])), $[q].indexOf("M") !== -1 && (R.month = Number(E[q] || "1")), $[q].indexOf("d") !== -1 && (R.day = Number(E[q] || "1"));
} else {
const f = (W + "").indexOf("yyyy"), P = (W + "").indexOf("MM"), E = (W + "").indexOf("dd");
if (f >= 0) {
const $ = i.substring(f, f + 4);
R.year = Number($);
}
P >= 0 && (R.month = Number(i.substring(P, P + 2) || "1")), E >= 0 && (R.day = Number(i.substring(E, E + 2) || "01"));
}
return R.year === void 0 && (R.year = u().year), R;
}
function s(i) {
return {
year: i.getFullYear(),
month: i.getMonth() + 1,
day: i.getDate(),
hour: i.getHours(),
minute: i.getMinutes(),
second: i.getSeconds()
};
}
function p(i, W = !0) {
const B = new Date(1900, 1, 1, 0, 0, 0), R = new Date(9999, 12, 31, 23, 59, 59), f = W ? B : R;
let P;
return i instanceof Date ? P = i : typeof i == "string" ? P = i.trim() ? t(i, "yyyy-MM-dd HH:mm:ss") : f : P = f, Qa(P) || (P = f), {
year: P.getFullYear(),
month: P.getMonth() + 1,
day: P.getDate(),
hour: P.getHours(),
minute: P.getMinutes(),
second: P.getSeconds()
};
}
function c(i) {
return p(i, !0);
}
function M(i) {
return p(i, !1);
}
function k(i, W = !1) {
if (i) {
const B = i.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (B.length >= 2)
return {
hour: parseInt(B[0], 10),
minute: parseInt(B[1]),
second: parseInt(B[2] || "0") || 0
};
} else {
const B = /* @__PURE__ */ new Date(), R = B.getHours(), f = B.getMinutes(), P = B.getSeconds();
return W ? { hour: 0, minute: 0, second: 0 } : { hour: R, minute: f, second: P };
}
return { hour: 0, minute: 0, second: 0 };
}
function D(i) {
if (i) {
const f = i.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (f.length >= 2)
return {
hour: f[0],
minute: f[1],
second: f[2] ? f[2] : 0
};
}
return { hour: 23, minute: 59, second: 59 };
}
return {
emptyDate: n,
getDate: a,
getDate2: o,
getDayNumber: g,
getEpocTime: S,
getNearDate: d,
getWeekdayIndex: T,
getTimeInMilliseconds: h,
getToday: u,
getDateObject: l,
getMinDate: c,
getMaxDate: M,
getTimeValue: k,
getEndTimeValue: D,
convertDateToDateObject: s
};
}
function De() {
const { getTimeInMilliseconds: e } = Me();
function t(l) {
return l && l.year !== 0 && l.month !== 0 && l.day !== 0;
}
function n(l) {
return l && l.year !== 0 && l.month !== 0;
}
function a(l) {
return l && l.year !== 0;
}
function o(l, s) {
return e(l) < e(s);
}
function g(l, s) {
return e(l) <= e(s);
}
function T(l, s) {
return e(l) === e(s);
}
function h(l, s) {
const p = e(s);
return e(l.from) === p || e(l.to) === p;
}
function S(l, s) {
return !s || !t(s.to) || !t(s.from) ? !1 : g(s.from, l) && g(l, s.to);
}
function d(l, s) {
return t(s) && e(l) >= e(s);
}
function u(l, s) {
return t(s) && e(l) <= e(s);
}
return {
isDateEarlier: o,
equal: T,
inPeriod: S,
isPoint: h,
equalOrEarlier: g,
isInitializedDate: t,
isInitializedMonth: n,
isInitializedYear: a,
isMonthDisabledByDisableSince: d,
isMonthDisabledByDisableUntil: u
};
}
const Ft = /* @__PURE__ */ ge({
name: "FDatePickerCalendarView",
props: Ra,
emits: ["click", "clickWeek", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const n = y(e.dates), a = y(e.daysInWeek), o = y(e.enableKeyboadNavigate), g = y(e.enableMarkCurrent), T = y(e.enablePeriod), h = y(e.selected), S = y(e.selectedPeriod), d = y(e.selectedWeek), u = y(e.selectMode), l = y(e.showWeekNumber), s = y(e.weekTitle || "周");
ee(() => e.dates, () => {
n.value = e.dates;
}), ee(() => e.selected, () => {
h.value = e.selected;
}), ee(() => e.enablePeriod, (v, H) => {
v !== H && (T.value = v);
}), ee(() => e.selectedPeriod, (v) => {
S.value = v;
}), ee(() => e.selectedWeek, (v) => {
d.value = v;
});
const {
equal: p,
inPeriod: c,
isInitializedDate: M,
equalOrEarlier: k,
isPoint: D
} = De(), {
getKeyCodeFromEvent: i
} = Ht(), W = (v) => {
const H = !!d.value && v.numberInTheYear === d.value.numberInTheYear && v.year === d.value.year;
return {
"f-datepicker-selectWeek": u.value === "week",
"f-datepicker-selectedWeek": u.value === "week" && H
};
};
function B(v) {
return c(v, S.value);
}
function R(v) {
if (!S.value)
return !1;
const H = {
from: {
year: S.value.from.year,
month: S.value.from.month,
day: S.value.from.day
},
to: {
year: S.value.to.year,
month: S.value.to.month,
day: S.value.to.day
}
};
return !!S.value && D(H, v);
}
function f(v) {
return !!h.value && p({
year: h.value.year,
month: h.value.month,
day: h.value.day
}, {
year: v.year,
month: v.month,
day: v.day
});
}
const P = (v, H, x) => {
const I = u.value !== "week" && v.tag === de.current && (T.value && B(v.date) && !R(v.date) || v.range), F = v.tag === de.previous || v.tag === de.next, L = {
"f-datepicker-range": I,
"f-datepicker-no-currmonth": F,
"f-datepicker-disabled": v.disable,
"f-datepicker-singledate": !v.disable
}, X = `d_${H}_${x}`;
return L[X] = !0, L;
}, E = (v) => {
const H = u.value !== "week" && v.tag === de.current && (!T.value && f(v.date) || T.value && R(v.date)), x = v.isCurrent && g.value, I = v.highlight && (v.tag === de.previous || v.tag === de.next || v.disable);
return {
"f-datepicker-date": !0,
"f-datepicker-selected": H,
"f-datepicker-current": x,
"f-datepicker-opacity": I,
"f-datepicker-highlight": v.highlight,
"f-datepicker-disabled": v.disable
};
};
function $(v, H) {
H.disable || u.value === "week" || (v.stopPropagation(), t.emit("click", {
event: v,
dayItem: H
}));
}
function q(v, H) {
u.value === "week" && (v.stopPropagation(), t.emit("clickWeek", H));
}
function z(v, H) {
const x = i(v);
x !== ve.tab && (v.preventDefault(), x === ve.enter || x === ve.space ? $(v, H) : o.value && t.emit("keyDown", H.date));
}
function N(v) {
if (S.value && M(S.value.from) && (!M(S.value.to) || JSON.stringify(S.value.from) === JSON.stringify(S.value.to))) {
const {
from: H
} = S.value;
n.value.forEach((x) => {
x.days.forEach((I) => {
I.range = k(H, I.date) && k(I.date, v.date) || k(I.date, H) && k(v.date, I.date);
});
}), t.emit("mouseEnter", v.date);
}
}
function V() {
n.value.forEach((v) => {
v.days.forEach((H) => {
H.range = !1;
});
}), t.emit("mouseLeave");
}
return () => O(hn, null, [O("div", {
class: "f-datepicker-table-wrapper"
}, [O("table", {
class: "f-datepicker-table",
cellpadding: "0"
}, [O("thead", null, [O("tr", null, [l.value && O("th", {
class: "f-datepicker-weeknbr-title",
style: "padding-bottom: 8px;padding-top: 4px"
}, [s.value]), a.value && a.value.map((v) => O("th", {
scope: "col",
style: "padding-bottom: 8px;padding-top: 4px"
}, [v]))])]), O("tbody", null, [n.value && n.value.map((v, H) => O("tr", {
class: W(v),
onClick: (x) => q(x, v)
}, [l.value && O("td", {
class: "f-datepicker-weeknbr"
}, [O("div", {
class: "f-datepicker-date"
}, [v.numberInTheYear])]), v.days && v.days.map((x, I) => O("td", {
id: `d_${H}_${I}`,
tabindex: "0",
class: P(x, H, I),
onKeydown: (F) => z(F, x),
onMouseenter: () => N(x),
onMouseleave: () => V()
}, [x.marked && x.marked.marked && O("span", {
class: "f-datepicker-markdate",
style: {
"background-color": x.marked.color
}
}, null), O("div", {
class: E(x),
onClick: (F) => $(F, x)
}, [x.date.day])]))]))])])])]);
}
}), Ua = {
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" }
}, Nt = /* @__PURE__ */ ge({
name: "FDatePickerCalendarNavbar",
props: Ua,
emits: ["clickMonth", "clickYear", "prePage", "preRecord", "nextRecord", "nextPage"],
setup(e, t) {
const n = y(e.ariaLabelPrevMonth), a = y(e.ariaLabelNextMonth), o = y(e.dateFormat), g = y(e.disablePrePage), T = y(e.disablePreRecord), h = y(e.disableNextRecord), S = y(e.disableNextPage), d = y(e.activeMonth), u = y(e.years), l = y(e.selectingMonth), s = y(e.selectingYear), p = y(e.selectMode), c = y(!0), M = y(!0);
ee(() => e.selectingMonth, (F, L) => {
l.value = F;
}), ee(() => e.selectingYear, (F, L) => {
s.value = F;
}), ee(() => e.years, (F, L) => {
u.value = F;
}), ee(() => e.activeMonth, () => {
var F, L, X, C;
d.value = {
month: (F = e.activeMonth) == null ? void 0 : F.month,
year: (L = e.activeMonth) == null ? void 0 : L.year,
displayTextOfMonth: (X = e.activeMonth) == null ? void 0 : X.displayTextOfMonth,
displayTextOfYear: (C = e.activeMonth) == null ? void 0 : C.displayTextOfYear
};
});
const k = A(() => ({
"f-datepicker-header": !0,
monthYearSelBarBorder: l.value || s.value
})), D = A(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": g.value
})), i = A(() => !l.value && !s.value), W = A(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": T.value
})), B = A(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": h.value
})), R = A(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": S.value
})), f = A(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-yearLabel": c.value,
"f-datepicker-labelBtnNotEdit": !c.value
})), P = A(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-monthLabel": M.value,
"f-datepicker-labelBtnNotEdit": !M.value
})), E = A(() => {
const F = o.value ? o.value.indexOf("yyyy") : 0, L = o.value ? o.value.indexOf("MM") : 0;
return F > L ? "MM-yyyy" : "yyyy-MM";
});
function $(F) {
F.stopPropagation(), t.emit("prePage");
}
function q(F) {
F.stopPropagation(), t.emit("preRecord");
}
function z(F) {
F.stopPropagation(), t.emit("clickYear");
}
function N(F) {
F.stopPropagation(), t.emit("clickMonth");
}
function V(F) {
F.stopPropagation(), t.emit("nextRecord");
}
function v(F) {
F.stopPropagation(), t.emit("nextPage");
}
const H = A(() => {
const F = {};
return p.value === "year" && (F.cursor = "default"), F;
});
function x() {
return O("button", {
type: "button",
style: H.value,
class: f.value,
onClick: (F) => {
c.value && z(F);
},
tabindex: c.value ? "0" : "-1",
disabled: p.value === "year"
}, [s.value ? u.value.length > 3 ? u.value[0][1].year + " - " + u.value[3][1].year : "" : d.value.displayTextOfYear]);
}
function I() {
return !s.value && p.value !== "month" && O("button", {
type: "button",
class: P.value,
onClick: (F) => {
M.value && N(F);
},
tabindex: M.value ? "0" : "-1"
}, [d.value.displayTextOfMonth]);
}
return () => O("div", {
class: k.value,
style: "height:40px; overflow:hidden;"
}, [O("div", {
class: "f-datepicker-prev-btn"
}, [O("button", {
type: "button",
class: D.value,
onClick: $
}, [O("i", {
class: "f-icon f-icon-arrow-double-60-left"
}, null)]), i.value && O("button", {
type: "button",
"aria-label": n.value,
class: W.value,
onClick: q
}, [O("i", {
class: "f-icon f-icon-arrow-chevron-left"
}, null)])]), O("div", {
class: "f-datepicker-monthYearText"
}, [E.value === "yyyy-MM" ? [x(), I()] : [I(), x()]]), O("div", {
class: "f-datepicker-next-btn"
}, [i.value && O("button", {
type: "button",
"aria-label": a.value,
class: B.value,
onClick: V
}, [O("i", {
class: "f-icon f-icon-arrow-chevron-right"
}, null)]), O("button", {
type: "button",
class: R.value,
onClick: v
}, [O("i", {
class: "f-icon f-icon-arrow-double-60-right"
}, null)])])]);
}
}), Mn = {
1: "一月",
2: "二月",
3: "三月",
4: "四月",
5: "五月",
6: "六月",
7: "七月",
8: "八月",
9: "九月",
10: "十月",
11: "十一月",
12: "十二月"
}, pn = /* @__PURE__ */ new Map([
["appearance", Sa]
]);
function kn(e, t, n) {
return t;
}
const Ga = "https://json-schema.org/draft/2020-12/schema", Ja = "https://farris-design.gitee.io/date-view.schema.json", Xa = "date-view", Za = "A Farris Input Component", Ka = "object", eo = {
id: {
description: "The unique identifier for date picker",
type: "string"
},
type: {
description: "The type string of date picker",
type: "string",
default: "date-view"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
disable: {
type: "string",
default: !1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, to = [
"id",
"type"
], no = {
$schema: Ga,
$id: Ja,
title: Xa,
description: Za,
type: Ka,
properties: eo,
required: to
}, ao = "date-view", oo = "A Farris Component", ro = "object", lo = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
},
behavior: {
description: "Basic Infomation",
title: "行为",
properties: {
visible: {
description: "",
title: "可见",
type: "boolean"
}
}
}
}, io = {
title: ao,
description: oo,
type: ro,
categories: lo
}, Tn = {
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: Te.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: Mn },
/** 二级日期 */
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 },
/** 启用快捷选择 */
enableQuickSelect: { type: Boolean, default: !1 }
}, Dn = Pa(Tn, no, pn, kn, io), so = {
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" }
}, Yt = /* @__PURE__ */ ge({
name: "FDatePickerMonthView",
props: so,
emits: ["click", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const n = y(e.months), a = y(e.enableMarkCurrent), o = y(e.enableKeyboadNavigate), g = y(e.enablePeriod), T = y(e.selected), h = y(e.selectedPeriod), {
equal: S,
inPeriod: d,
isInitializedDate: u,
equalOrEarlier: l
} = De(), {
getKeyCodeFromEvent: s
} = Ht();
ee(() => e.months, () => {
n.value = e.months;
}), ee(() => e.selected, () => {
T.value = e.selected;
}), ee(() => e.selectedPeriod, (f) => {
h.value = f;
});
function p(f, P) {
f.stopPropagation(), !P.disable && t.emit("click", P.date);
}
function c(f, P) {
const E = s(f);
E !== ve.tab && (f.preventDefault(), E === ve.enter || E === ve.space ? p(f, P) : o.value && t.emit("keyDown", P));
}
function M(f) {
h.value && u(h.value.from) && !u(h.value.to) && (n.value.forEach((P) => {
P.forEach((E) => {
E.range = !!h.value && (l(h.value.from, E.date) && l(E.date, f.date) || l(E.date, h.value.from) && l(f.date, E.date));
});
}), t.emit("mouseEnter", f));
}
function k() {
n.value.forEach((f) => {
f.forEach((P) => {
P.range = !1;
});
}), t.emit("mouseLeave");
}
const D = (f, P) => f.year === P.year && f.month === P.month;
function i(f) {
return !!T.value && D(T.value, f);
}
function W(f) {
return !!h.value && (D(h.value.from, f) || D(h.value.to, f));
}
function B(f) {
return d(f, h.value);
}
const R = (f) => ({
"f-datepicker-month-cell": !0,
"f-datepicker-current": f.isCurrent && a.value,
"f-datepicker-selected": (!g.value || e.selectMode === "week") && i(f.date) || g.value && W(f.date),
"f-datepicker-disabled": f.disable,
"f-datepicker-range": B(f.date) || f.range
});
return () => O("div", {
class: "f-datepicker-table-wrapper"
}, [O("table", {
class: "f-datepicker-table"
}, [O("tbody", null, [n.value && n.value.map((f, P) => O("tr", null, [f.map((E, $) => O("td", {
id: `m_${P}_${$}`,
class: `m_${P}_${$}`,
onKeydown: (q) => c(q, E),
onMouseenter: () => M(E),
onMouseleave: () => k(),
tabindex: "0",
style: "width: 33.3%"
}, [O("div", {
class: "f-datepicker-month",
onClick: (q) => p(q, E)
}, [O("span", {
class: R(E)
}, [E.displayText])])]))]))])])]);
}
}), uo = {
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" }
}, $t = /* @__PURE__ */ ge({
name: "FDatePickerYearView",
props: uo,
emits: ["click", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const n = y(e.years), a = y(e.enableMarkCurrent), o = y(e.enableKeyboadNavigate), g = y(e.enablePeriod), T = y(e.selected), h = y(e.selectedPeriod), {
equal: S,
inPeriod: d,
isInitializedDate: u,
equalOrEarlier: l
} = De(), {
getKeyCodeFromEvent: s
} = Ht();
ee(() => e.years, () => {
n.value = e.years;
}), ee(() => e.selected, () => {
T.value = e.selected;
});
const p = (f, P) => {
const E = `y_${f}_${P}`, $ = {
"f-datepicker-no-currmonth": f === 0 && P === 0 || f === 3 && P === 2
};
return $[E] = !0, $;
};
function c(f) {
return d(f, h.value);
}
function M(f) {
return !!T.value && S({
year: T.value.year
}, f);
}
function k(f) {
return !!h.value && (S({
year: h.value.from.year
}, f) || S({
year: h.value.to.year
}, f));
}
const D = (f) => ({
"f-datepicker-year-cell": !0,
"f-datepicker-current": f.isCurrent && a.value,
"f-datepicker-selected": (!g.value || e.selectMode === "week") && M(f.date) || g.value && k(f.date),
"f-datepicker-disabled": f.disable,
"f-datepicker-range": c(f.date) || f.range
});
function i(f, P) {
f.stopPropagation(), !P.disable && t.emit("click", P);
}
function W(f, P) {
const E = s(f);
E !== ve.tab && (f.preventDefault(), E === ve.enter || E === ve.space ? i(f, P) : o.value && t.emit("keyDown", P));
}
function B(f) {
h.value && u(h.value.from) && !u(h.value.to) && (n.value.forEach((P) => {
P.forEach((E) => {
E.range = !!h.value && (l(h.value.from, E.date) && l(E.date, f.date) || l(E.date, h.value.from) && l(f.date, E.date));
});
}), t.emit("mouseEnter", f));
}
function R() {
n.value.forEach((f) => {
f.forEach((P) => {
P.range = !1;
});
}), t.emit("mouseLeave");
}
return () => O("table", {
class: "f-datepicker-table-wrapper"
}, [O("tbody", {
class: "f-datepicker-table"
}, [n.value && n.value.map((f, P) => O("tr", null, [f.map((E, $) => O("td", {
id: "y_{yi}_{i}",
class: p(P, $),
onKeydown: (q) => W(q, E),
onMouseenter: () => B(E),
onMouseleave: () => R(),
tabindex: "0"
}, [O("div", {
class: "f-datepicker-year",
onClick: (q) => i(q, E)
}, [O("span", {
class: D(E)
}, [E.year])])]))]))])]);
}
});
function Ae() {
function e(o) {
return new Date(
o.year || 0,
(o.month || 1) - 1,
o.day,
o.hour ? o.hour : 0,
o.minute ? o.minute : 0,
o.second ? o.second : 0,
0
).getDay();
}
function t(o) {
if (!o)
return 1;
if (!/^\d+$/.test(o.value))
return -1;
let g = Number(o.value);
return (o.format.length === 1 && o.value.length !== 1 && g < 10 || o.format.length === 1 && o.value.length !== 2 && g >= 10 || o.format.length === 2 && o.value.length > 2) && (g = -1), g;
}
function n(o, g) {
if (o.value) {
for (let T = 1; T <= 12; T++)
if (o.value.toLowerCase() === g[T].toLowerCase())
return T;
}
return -1;
}
function a(o) {
const g = new Date(o.year || 0, (o.month || 1) - 1, o.day, 0, 0, 0, 0);
return g.setDate(g.getDate() + (g.getDay() === 0 ? -3 : 4 - g.getDay())), Math.round((g.getTime() - new Date(g.getFullYear(), 0, 4).getTime()) / 864e5 / 7) + 1;
}
return { getNumberByValue: t, getDayNumber: e, getMonthNumberByMonthName: n, getWeekNumber: a };
}
function On(e, t, n, a, o, g, T, h) {
const { getTimeInMilliseconds: S, getWeekdayIndex: d } = Me(), { isInitializedDate: u } = De(), { getDayNumber: l } = Ae();
function s(p) {
if (p.year && p.year < e || p.year && p.year > t)
return !0;
const c = S(p), M = p.hour !== void 0;
if (u(a) && (M ? c : c + 24 * 60 * 60 * 1e3 - 1) < S(a) || u(n) && c > S(n))
return !0;
if (T) {
const D = l(p);
if (D === 0 || D === 6)
return !0;
}
const k = l(p);
return !!(h.length > 0 && h.find((i) => d(i) === k) || o.length > 0 && o.find((i) => (i.year === 0 || i.year === p.year) && (i.month === 0 || i.month === p.month) && i.day === p.day) || g.length > 0 && g.find((i) => u(i.from) && u(i.to) && c >= S(i.from) && c <= S(i.to)));
}
return { isDisabledDate: s };
}
function co() {
const { getDayNumber: e } = Ae();
function t(a, o, g) {
let T = [];
T = o.reduce((S, d) => {
const u = d.dates.map((l) => ({ date: l, color: d.color }));
return [...S, ...u];
}, T);
const h = T.find((S) => (S.date.year === 0 || S.date.year === a.year) && (S.date.month === 0 || S.date.month === a.month) && S.date.day === a.day);
if (h)
return { marked: !0, color: h.color };
if (g && g.marked) {
const S = e(a);
if (S === 0 || S === 6)
return { marked: !0, color: g.color };
}
return { marked: !1, color: "" };
}
function n(a, o, g, T) {
const h = e(a);
return o && h === 0 || g && h === 6 ? !0 : !!T.find((d) => (d.year === 0 || d.year === a.year) && (d.month === 0 || d.month === a.month) && d.day === a.day);
}
return { isHighlightedDate: n, isMarkedDate: t };
}
function wn() {
const { getTimeInMilliseconds: e } = Me(), { isInitializedDate: t } = De();
function n(o, g) {
return t(g) && e(o) < e(g);
}
function a(o, g) {
return t(g) && e(o) > e(g);
}
return { isMonthDisabledByDisableSince: a, isMonthDisabledByDisableUntil: n };
}
function Sn() {
const { getToday: e } = Me(), { isMonthDisabledByDisableSince: t, isMonthDisabledByDisableUntil: n } = wn();
function a(u) {
const l = { displayTextOfMonth: "", month: 0, year: 0, displayTextOfYear: "" };
if (u) {
const s = u.match(/[^0-9]/), p = s && s.length ? s[0] : "", c = u.split(p);
l.month = c[0].length === 2 ? Number(c[0]) : Number(c[1]), l.year = c[0].length === 2 ? Number(c[1]) : Number(c[0]);
}
return l;
}
function o(u, l) {
return new Date(l, u, 0).getDate();
}
function g(u, l, s) {
return new Date(u, l - 1, s, 0, 0, 0, 0);
}
function T(u, l) {
const s = g(l, u, 1);
return s.setMonth(s.getMonth() - 1), o(s.getMonth() + 1, s.getFullYear());
}
function h(u, l, s, p) {
const c = e(), M = [], { year: k } = l, D = 3, i = { year: s.year, month: s.month, day: s.day }, W = { year: p.year, month: p.month, day: p.day };
for (let B = 1; B <= 12; B += D) {
const R = [];
for (let f = B; f < B + D; f++) {
const P = t({ year: k, month: f, day: 1 }, i) || n({ year: k, month: f, day: o(f, k || 0) }, W);
R.push({
month: f,
displayText: u[f],
isCurrent: f === c.month && k === c.year,
disable: P,
date: { year: k, month: f }
});
}
M.push(R);
}
return M;
}
function S(u, l) {
const s = {
year: u === 12 ? l + 1 : l
}, p = u === 12 ? 1 : u + 1;
return s.month = p, s;
}
function d(u, l) {
const s = {
year: u === 1 ? l - 1 : l
}, p = u === 1 ? 12 : u - 1;
return s.month = p, s;
}
return { daysInMonth: o, daysInPreMonth: T, generateMonths: h, parseDefaultMonth: a, getNextMonth: S, getPreviousMonth: d };
}
function fo({ isDisabledDate: e }) {
const { getToday: t } = Me(), { daysInMonth: n, daysInPreMonth: a, getNextMonth: o, getPreviousMonth: g } = Sn(), { isHighlightedDate: T, isMarkedDate: h } = co(), { getWeekNumber: S } = Ae();
function d(p) {
const c = Ne.indexOf(p);
return c > 0 ? 7 - c : 0;
}
function u(p, c, M) {
const k = /* @__PURE__ */ new Date();
k.setDate(1), k.setMonth(c - 1), k.setFullYear(p);
const D = k.getDay() + M;
return D >= 7 ? D - 7 : D;
}
function l(p, c, M, k, D) {
return p === D.day && c === D.month && M === D.year && k === de.current;
}
function s(p, c, M, k, D, i, W, B, R) {
const f = [], P = t(), E = u(c, p, d(M)), $ = n(p, c), q = a(p, c);
let z = 1, N = de.previous;
for (let V = 1; V < 7; V++) {
const v = [];
if (V === 1) {
const I = q - E + 1;
for (let L = I; L <= q; L++) {
const X = {
year: p === 1 ? c - 1 : c,
month: p === 1 ? 12 : p - 1,
day: L
}, C = l(L, p, c, N, P), _ = e(X), oe = h(X, k, D), Z = T(X, B, W, i);
v.push({ date: X, tag: N, isCurrent: C, disable: _, marked: oe, highlight: Z });
}
N = de.current;
const F = 7 - v.length;
for (let L = 0; L < F; L++) {
const X = { year: c, month: p, day: z }, C = l(z, p, c, N, P), _ = e(X), oe = h(X, k, D), Z = T(X, B, W, i);
v.push({ date: X, tag: N, isCurrent: C, disable: _, marked: oe, highlight: Z }), z++;
}
} else
for (let I = 1; I <= 7; I++) {
z > $ && (z = 1, N = de.next);
const F = {
year: N === de.next && p === 12 ? c + 1 : c,
month: N === de.current ? p : N === de.next && p < 12 ? p + 1 : 1,
day: z
}, L = l(z, p, c, N, P), X = e(F), C = h(F, k, D), _ = T(F, B, W, i);
v.push({ date: F, tag: N, isCurrent: L, disable: X, marked: C, highlight: _ }), z++;
}
const H = M === Te.Monday ? 0 : 6, x = S(v[H].date);
f.push({ days: v, numberInTheYear: x, year: c });
}
return f;
}
return { generateCalendar: s };
}
function yo() {
const { getToday: e } = Me();
function t(n, a, o, g, T, h) {
const S = [], d = n - n % 10, { year: u, month: l } = a, s = e(), p = 3, c = d + 10;
for (let M = d - 1; M < c; M += p) {
const k = [];
for (let D = M; D < M + p; D++) {
const i = D < o || D > g;
k.push({
year: D,
isCurrent: D === s.year,
selected: D === u,
disable: i,
date: { year: D }
});
}
S.push(k);
}
return S;
}
return { generateYears: t };
}
function mo() {
function e(o, g, T) {
const h = [];
if (T) {
let S = T[0];
T[0] !== T[1] && (S = T[0] + T[1], T[2] && T[1] !== T[2] && (S += T[2]));
const d = new RegExp("[" + S + "]"), u = o.split(d), l = g.split(d);
for (let s = 0; s < l.length; s++)
l[s].indexOf("yyyy") !== -1 && (h[0] = { value: u[s], format: l[s] }), l[s].indexOf("M") !== -1 && (h[1] = u[s] === void 0 ? { value: "1", format: l[s] } : { value: u[s], format: l[s] }), l[s].indexOf("d") !== -1 && (h[2] = u[s] === void 0 ? { value: "1", format: l[s] } : { value: u[s], format: l[s] });
} else {
const S = (g + "").indexOf("yyyy"), d = (g + "").indexOf("MM"), u = (g + "").indexOf("dd");
S >= 0 && (h[0] = { value: o.substring(S, S + 4), format: g.substring(S, S + 4) }), d >= 0 && (h[1] = { value: o.substring(d, d + 2), format: g.substring(d, d + 2) }), u >= 0 && (h[2] = { value: o.substring(u, u + 2), format: g.substring(u, u + 2) });
}
return h;
}
function t(o) {
return o < 10 ? "0" + Number(o) : String(o);
}
function n(o, g) {
const T = o.match(/[^(DdMmYy)]{1,}/g), h = o.indexOf(g);
return h < 0 ? o : h === 0 ? T ? o.substring(3) : o.substring(2) : h + 2 === o.length ? T ? o.substring(0, o.length - 3) : o.substring(0, o.length - 2) : T ? o.substring(0, h) + o.substring(h + 3) : o.substring(0, h) + o.substring(h + 2);
}
function a(o, g, T) {
!o.month && g.indexOf("MM") === -1 && (g = n(g, "MM")), !o.day && g.indexOf("dd") === -1 && (g = n(g, "dd"));
let h = g.replace("yyyy", String(o.year));
return g.indexOf("M") === -1 ? h = h.replace("MM", "01") : (g.indexOf("MMM") !== -1 && (h = h.replace("MMM", T[o.month || 1])), g.indexOf("MM") !== -1 ? h = h.replace("MM", t(o.month || 1)) : h = h.replace("M", String(o.month || 1))), g.indexOf("dd") === -1 ? h = h.replace("dd", "01") : g.indexOf("dd") !== -1 ? h = h.replace("dd", t(o.day || 1)) : h = h.replace("d", String(o.day || 1)), h = h.replace("MM", "mm").replace("HH", t(o.hour || 0)).replace("mm", t(o.minute || 0)).replace("ss", t(o.second || 0)), h && h.length > 2 ? h : "";
}
return { getDateValue: e, formatDate: a, preZero: t, remove: n };
}
function vo(e) {
const { displayFormat: t, minYear: n, maxYear: a, selectMode: o, valueFormat: g, showTime: T, periodDelimiter: h } = e, { emptyDate: S, getToday: d } = Me(), { getDateValue: u, preZero: l } = mo(), { getNumberByValue: s, getMonthNumberByMonthName: p, getWeekNumber: c } = Ae(), { equalOrEarlier: M, isInitializedDate: k, isDateEarlier: D } = De(), { isDisabledDate: i } = On(
e.minYear,
e.maxYear,
e.disableSince,
e.disableUntil,
e.disableDates,
e.disablePeriod,
e.disableWeekends,
e.disableWeekdays
), W = y(e.nameOfMonths), B = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function R() {
const N = d();
switch (o) {
case "month":
return {
startMonth: { month: 0, year: N.year },
endMonth: { month: 0, year: N.year + 1 }
};
case "year":
return {
startMonth: { month: 0, year: N.year },
endMonth: { month: 0, year: N.year + 10 }
};
default: {
const V = { month: N.month, year: N.year };
let v = { month: N.month + 1, year: N.year };
return N.month >= 12 && (v = { month: 1, year: N.year + 1 }), { startMonth: V, endMonth: v };
}
}
}
function f(N, V = !1) {
let v = T, H = t, x = N;
return V && (H = g.replace(/[年,月]/g, "-").replace(/[日]/, "").replace(/[时,分]/g, ":").replace(/[秒]/g, ""), x = x.replace(/[年,月]/g, "-").replace(/[日]/, "").replace(/[时,分]/g, ":").replace(/[秒]/g, ""), (x[x.length - 1] === "-" || x[x.length - 1] === ":") && (x = x.substring(0, x.length - 1)), !T && g.toLocaleLowerCase().indexOf("hh:mm") > -1 && (v = !0)), { actualFormat: H, shouldDisplayTime: v, targetDateString: x };
}
function P(N, V = !1) {
const v = { year: 0, month: 0, day: 0 };
if (!N)
return v;
const { actualFormat: H, shouldDisplayTime: x, targetDateString: I } = f(N, V), F = H.indexOf("MMM") !== -1;
let L = I, X = 0, C = 0, _ = 0, oe = H.match(/[^(DdMmYy)]{1,}/g);
if (x && I) {
L = I.split(" ")[0], Object.assign(v, { hour: 0, minute: 0, second: 0 });
const le = I.split(" ")[1];
if (le) {
const ie = le.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
ie[0] && (X = Number(ie[0].substr(0, 2)), X = isNaN(X) ? 0 : X), ie[1] && (C = Number(ie[1].substr(0, 2)), C = isNaN(C) ? 0 : C), ie[2] && (_ = Number(ie[2].substr(0, 2)), _ = isNaN(_) ? 0 : _);
} else if (oe = null, /^\d{1,}$/.test(I)) {
const me = H;
L = I.substr(0, 8);
let se = I.substr(8);
se && (me.includes("HH") && se && (X = +se.slice(0, 2), se = se.slice(2)), me.includes("mm") && se && (C = +se.slice(0, 2), se = se.slice(2)), me.includes("ss") && se && (_ = +se.slice(0, 2)));
}
} else
L = I ? I.split(" ")[0] : "";
const Z = u(L, H, oe), Y = s(Z[0]), U = F ? p(Z[1], W.value) : s(Z[1]), re = s(Z[2]);
if (o === "year")
return { year: Y, month: 1, day: 1 };
if (U !== -1 && re !== -1 && Y !== -1) {
if (Y < n || Y > a || U < 1 || U > 12)
return v;
const le = T ? { year: Y, month: U, day: re, hour: X, minute: C, second: _ } : { year: Y, month: U, day: re };
return i(le) || ((Y % 400 === 0 || Y % 100 !== 0 && Y % 4 === 0) && (B[1] = 29), re < 1 || re > B[U - 1]) ? v : o === "month" ? { year: le.year, month: le.month } : o === "year" ? { year: le.year } : le;
}
return v;
}
function E(N) {
let V = {
from: { year: 0, month: 0, day: 0 },
to: { year: 0, month: 0, day: 0 }
};
if (N && N.length) {
const v = N.split(h || "~");
if (v && v.length === 2) {
const [H, x] = v;
let I = H ? P(H, !0) : null, F = x ? P(x, !0) : null;
if (!I && F && (I = { ...F }), !F && I && (F = { ...I }), !I && !F)
return V;
V = { from: I, to: F };
}
}
return V;
}
function $(N, V) {
const { from: v, to: H } = N, x = k(v), I = k(H) && JSON.stringify(v) !== JSON.stringify(H);
if (x && I)
N.from = V, N.to = S();
else if (!x)
N.from = V, !I && e.showTime && (N.to = V);
else {
if (D(V, v)) {
const L = v;
N.to = L, N.from = V;
} else
N.to = V;
return { from: N.from, to: N.to, emit: !0 };
}
return { from: N.from, to: N.to };
}
function q(N) {
const V = l(N.getHours()), v = l(N.getMinutes()), H = l(N.getSeconds());
return `${V}:${v}:${H}`;
}
function z(N) {
const V = E(N), v = V.from, H = V.to;
if (k(v) && k(H)) {
const x = l(v.hour || 0), I = l(v.minute || 0), F = l(v.second || 0), L = `${x}:${I}:${F}`, X = l(H.hour || 0), C = l(H.minute || 0), _ = l(H.second || 0), oe = `${X}:${C}:${_}`, Z = {
year: v.year || 1,
month: v.month || 1,
displayTextOfMonth: W.value[v.month || "1"],
displayTextOfYear: `${v.year}`
}, Y = {
year: H.year || 1,
month: H.month || 1,
displayTextOfMonth: W.value[H.month || "1"],
displayTextOfYear: `${H.year}`
};
if (v.month === H.month && v.year === H.year)
if (!N)
Y.month >= 12 ? (Y.month = 1, Y.year = Y.year + 1) : (Y.month = Y.month + 1, o === "month" && (Y.year = Y.year + 1), Y.displayTextOfMonth = W.value[Y.month]);
else {
const ie = N.split("~"), me = ie[0], se = ie[1];
!me && se ? (Z.month === 1 ? (Z.year = Z.year - 1, Z.month = 12) : Z.month = Z.month - 1, Z.displayTextOfMonth = W.value[Z.month]) : (Y.month === 12 ? (Y.year = Y.year + 1, Y.month = 1) : Y.month = Y.month + 1, Y.displayTextOfMonth = W.value[Y.month]);
}
else o === "month" && v.year === H.year && (Y.year = Y.year + 1);
Y.displayTextOfYear = `${Y.year}`;
const U = e.firstDayOfTheWeek === Te.Sunday ? H : v, le = { numberInTheYear: c(U), year: U.year };
return { beginDateActiveMonth: Z, endDateActiveMonth: Y, dateRange: V, beginTime: L, endTime: oe, selectedWeekInfo: le };
}
return { dateRange: V };
}
return { normalizeDate: P, normalizeDateRange: E, setNewDateRange: $, getActiveMonth: z, getTimeStr: q, getMonthAndYear: R };
}
function ho() {
function e(t, n) {
if (n === Te.Monday) {
t.setDate(t.getDate() - (t.getDay() + 6) % 7);
const a = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
t.setDate(t.getDate() + 6);
const o = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
return { from: a, to: o };
} else {
t.getDay() !== 0 && t.setDate(t.getDate() - t.getDay());
const a = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
t.setDate(t.getDate() + 6 - t.getDay());
const o = {
year: t.getFullYear(),
month: t.getMonth() + 1,
day: t.getDate()
};
return {
from: a,
to: o
};
}
}
return { getNowWeekTime: e };
}
function bo(e, t) {
const {
locales: n
} = e, {
quickSelectors: a
} = n, o = [{
label: "今天",
value: J(),
description: "选择今天日期",
code: "today"
}, {
label: "昨天",
value: je(J(), 1),
description: "选择昨天日期",
code: "yesterday"
}, {
label: "明天",
value: rt(J(), 1),
description: "选择明天日期",
code: "tomorrow"
}, {
label: "本周一",
value: tt(J(), {
weekStartsOn: 1
}),
description: "本周一",
code: "thisMonday"
}, {
label: "下周一",
value: rt(tt(J(), {
weekStartsOn: 1
}), 7),
description: "下周一",
code: "nextMonday"
}, {
label: "本月初",
value: nt(J()),
description: "本月第一天",
code: "firstDayOfMonth"
}, {
label: "本月末",
value: Dt(J()),
description: "本月最后一天",
code: "lastDayOfMonth"
}, {
label: "上月初",
value: nt(at(J(), 1)),
description: "上月第一天",
code: "firstDayOfLastMonth"
}, {
label: "年初",
value: St(J()),
description: "今年第一天",
code: "firstDayOfYear"
}, {
label: "年末",
value: wt(J()),
description: "今年最后一天",
code: "lastDayOfYear"
}, {
label: "本季度初",
value: Ot(J()),
description: "本季度第一天",
code: "firstDayOfQuarter"
}, {
label: "本季度末",
value: Pt(J()),
description: "本季度最后一天",
code: "lastDayOfQuarter"
}], g = [{
label: "今天",
value: [J(), J()],
description: "选择今天日期",
code: "today"
}, {
label: "昨天",
value: [je(J(), 1), je(J(), 1)],
description: "选择昨天日期",
code: "yesterday"
}, {
label: "本周",
value: [tt(J(), {
weekStartsOn: 1
}), dn(J(), {
weekStartsOn: 1
})],
description: "本周一至周日",
code: "thisWeek"
}, {
label: "上周",
value: [tt(yn(J(), 1)), dn(yn(J(), 1)