@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,607 lines • 111 kB
JavaScript
import { useDateFormat as Yt, FormSchemaEntityFieldTypeName as mn, formatTime as vn, withInstall as hn } from "../../components/common/index.esm.js";
import { datePickerProps as ma, datePickerContainerProps as bn, DatePicker as gn, DatePickerContainer as Mn } from "../../components/date-picker/index.esm.js";
import { defineComponent as Ce, ref as M, inject as St, onMounted as Ht, computed as W, createVNode as p, watch as ee, Fragment as kn, mergeProps as tt } from "vue";
import pn from "../button-edit/index.esm.js";
import { useDesignerComponent as va } from "../../components/designer-canvas/index.esm.js";
import { resolveAppearance as Tn, createPropsResolver as ha } from "../../components/dynamic-resolver/index.esm.js";
import ra from "../input-group/index.esm.js";
import { InputBaseProperty as Dn } from "../../components/property-panel/index.esm.js";
import { cloneDeep as oe } from "lodash-es";
import { FTimePickerTimeView as ua, convertToDate as wn } from "../../components/time-picker/index.esm.js";
import { FButton as On } from "../../components/button/index.esm.js";
function ba(e, t, l) {
return t;
}
const ga = /* @__PURE__ */ new Map([
["appearance", Tn]
]), xn = "https://json-schema.org/draft/2020-12/schema", Pn = "https://farris-design.gitee.io/date-picker.schema.json", Sn = "date-picker", Cn = "A Farris Input Component", Nn = "object", Yn = {
id: {
description: "The unique identifier for date picker",
type: "string"
},
type: {
description: "The type string of date picker",
type: "string",
default: "date-picker"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disabled: {
description: "",
type: "boolean",
default: !1
},
editable: {
description: "",
type: "boolean",
default: !1
},
placeholder: {
description: "",
type: "string",
default: "请选择日期"
},
beginPlaceholder: {
description: "",
type: "string"
},
endPlaceholder: {
description: "",
type: "string"
},
readonly: {
description: "",
type: "boolean",
default: !1
},
required: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
},
displayFormat: {
description: "",
type: "enum",
default: "yyyy-MM-dd"
},
valueFormat: {
description: "",
type: "enum",
default: "yyyy-MM-dd"
},
maxDate: {
description: "",
type: "string"
},
minDate: {
description: "",
type: "string"
},
showTime: {
description: "",
type: "boolean",
default: !1
},
firstDayOfTheWeek: {
description: "",
type: "string",
default: "Sun"
},
enablePeriod: {
description: "",
type: "boolean",
default: !1
},
enableClear: {
description: "",
type: "boolean",
default: !0
},
selectMode: {
description: "",
type: "string",
default: "day"
},
beginValue: {
description: "",
type: "string",
default: ""
},
endValue: {
description: "",
type: "string",
default: ""
},
enableQuickSelect: {
description: "",
type: "boolean",
default: !1
},
showWeekNumber: {
description: "",
type: "boolean",
default: !1
},
onDatePicked: {
type: "object",
default: null
},
defaultTime: {
description: "",
type: "string",
default: ""
}
}, Hn = [
"type"
], Fn = [
"id",
"appearance",
"binding",
"visible"
], In = {
onDatePicked: "日期选择后事件"
}, Bn = {
$schema: xn,
$id: Pn,
title: Sn,
description: Cn,
type: Nn,
properties: Yn,
required: Hn,
ignore: Fn,
events: In
}, En = "https://json-schema.org/draft/2020-12/schema", jn = "https://farris-design.gitee.io/date-view.schema.json", An = "date-view", $n = "A Farris Input Component", Vn = "object", Wn = {
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
}
}, Rn = [
"id",
"type"
], Ln = {
$schema: En,
$id: jn,
title: An,
description: $n,
type: Vn,
properties: Wn,
required: Rn
}, _n = "date-view", zn = "A Farris Component", qn = "object", Kn = {
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"
}
}
}
}, Qn = {
title: _n,
description: zn,
type: qn,
categories: Kn
}, lo = { year: 9999, month: 12, day: 31, hour: 23, minute: 59, second: 59 }, oo = { year: 1900, month: 1, day: 1, hour: 0, minute: 0, second: 0 }, Un = Object.assign({}, ma, {
readonly: {}
}), Ma = ha(ma, Bn, ga, ba), ka = ha(bn, Ln, ga, ba, Qn);
function Jn() {
let e = "zh-CHS";
typeof window < "u" && window.top && window.top.localStorage && window.top.localStorage.languageCode && ({ languageCode: e } = window.top.localStorage);
const t = [
{ id: "yyyy-MM-dd HH:mm:ss", name: "yyyy-MM-dd HH:mm:ss" },
{ id: "yyyy/MM/dd HH:mm:ss", name: "yyyy/MM/dd HH:mm:ss" },
{ id: "yyyyMMddHHmmss", name: "yyyyMMddHHmmss" },
{ id: "yyyy-MM-dd HH:mm", name: "yyyy-MM-dd HH:mm" },
{ id: "yyyy/MM/dd HH:mm", name: "yyyy/MM/dd HH:mm" },
{ id: "yyyyMMddHHmm", name: "yyyyMMddHHmm" }
], l = [
{ id: "yyyy-MM-dd", name: "yyyy-MM-dd" },
{ id: "yyyy/MM/dd", name: "yyyy/MM/dd" },
{ id: "yyyyMMdd", name: "yyyyMMdd" },
{ id: "MM/dd/yyyy", name: "MM/dd/yyyy" }
], y = [
{ id: "yyyy-MM", name: "yyyy-MM" },
{ id: "yyyy/MM", name: "yyyy/MM" },
{ id: "yyyyMM", name: "yyyyMM" }
], a = [
{ id: "MM/dd", name: "MM/dd" },
{ id: "MMdd", name: "MMdd" },
{ id: "MM-dd", name: "MM-dd" }
], i = [
{ id: "yyyy", name: "yyyy" }
];
return e === "zh-CHS" && (t.push(
{ id: "yyyy年MM月dd日 HH时mm分ss秒", name: "yyyy年MM月dd日 HH时mm分ss秒" },
{ id: "yyyy年MM月dd日 HH时mm分", name: "yyyy年MM月dd日 HH时mm分" }
), l.push(
{ id: "yyyy年MM月dd日", name: "yyyy年MM月dd日" }
), y.push(
{ id: "yyyy年MM月", name: "yyyy年MM月" }
), a.push(
{ id: "MM月dd日", name: "MM月dd日" }
), i.push(
{ id: "yyyy年", name: "yyyy年" }
)), e === "zh-CHT" && (t.push(
{ id: "yyyy年MM月dd日 HH時mm分ss秒", name: "yyyy年MM月dd日 HH時mm分ss秒" },
{ id: "yyyy年MM月dd日 HH時mm分", name: "yyyy年MM月dd日 HH時mm分" }
), l.push(
{ id: "yyyy年MM月dd日", name: "yyyy年MM月dd日" }
), y.push(
{ id: "yyyy年MM月", name: "yyyy年MM月" }
), a.push(
{ id: "MM月dd日", name: "MM月dd日" }
), i.push(
{ id: "yyyy年", name: "yyyy年" }
)), { timeFormats: t, yMFormats: y, yMdFormats: l, mdFormats: a, yFormats: i };
}
const Gn = [
{ id: "yyyy-MM-dd", name: "yyyy-MM-dd" },
{ id: "yyyy/MM/dd", name: "yyyy/MM/dd" },
{ id: "MM/dd/yyyy", name: "MM/dd/yyyy" }
], Xn = [
{ id: "yyyy-MM-dd HH:mm:ss", name: "yyyy-MM-dd HH:mm:ss" },
{ id: "yyyy/MM/dd HH:mm:ss", name: "yyyy/MM/dd HH:mm:ss" }
], Zn = [
{ id: "yyyy-MM", name: "yyyy-MM" },
{ id: "yyyy/MM", name: "yyyy/MM" },
{ id: "yyyyMM", name: "yyyyMM" }
], el = [
{ id: "yyyy", name: "yyyy" }
], { timeFormats: tl, yMdFormats: al, yMFormats: ca, mdFormats: nl, yFormats: Tt } = Jn();
class ll extends Dn {
constructor(t, l) {
super(t, l);
}
getDatePickerModes(t) {
return t === "Date" || t === "DateTime" ? [
{ label: "年月日", value: "day" }
] : [
{ label: "年月日", value: "day" },
{ label: "年月", value: "month" },
{ label: "年", value: "year" }
];
}
checkMaxMinDate(t) {
const { minDate: l, maxDate: y, showTime: a } = (t == null ? void 0 : t.editor) || {}, { parseToDate: i, formatTo: g } = Yt();
if (y && typeof y == "string") {
const c = i(y, "yyyy-MM-dd HH:mm:ss");
c && (t.editor.maxDate = g(c, a ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd"));
}
if (l && typeof l == "string") {
const c = i(l, "yyyy-MM-dd HH:mm:ss");
c && (t.editor.minDate = g(c, a ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd"));
}
}
getMinOrMaxDate(t, l = !1) {
return typeof t == "string" && t.trim() || (l ? "9999-12-31 23:59:59" : "1900-01-01 00:00:00");
}
getEditorProperties(t) {
var c, b, T, d, o, m, D, P, S, I, x, r, E, Y, f;
const l = this.getDateFormatOptions(t == null ? void 0 : t.editor), y = this.getValueFormatOptions(t == null ? void 0 : t.editor), a = (b = (c = this.designViewModelField) == null ? void 0 : c.type) == null ? void 0 : b.name, i = this.getDatePickerModes(a);
(T = t == null ? void 0 : t.editor) != null && T.selectMode || (t.editor.selectMode = "day");
const g = this.getExtremeDateFormat(t);
return this.checkMaxMinDate(t), this.getComponentConfig(t, { type: "date-picker" }, {
enableClear: {
description: "是否显示清除按钮",
title: "启用清除",
type: "boolean"
},
selectMode: {
description: "",
title: "显示类型",
type: "string",
refreshPanelAfterChanged: !0,
editor: {
type: "combo-list",
idField: "value",
textField: "label",
valueField: "value",
data: i
}
},
showWeekNumber: {
description: "",
title: "显示第几周",
type: "boolean",
visible: ((d = t == null ? void 0 : t.editor) == null ? void 0 : d.selectMode) === "day"
},
firstDayOfTheWeek: {
description: "",
title: "每周起始日",
type: "string",
editor: {
type: "combo-list",
idField: "value",
valueField: "value",
textField: "label",
data: [
{ label: "星期日", value: "Sun" },
{ label: "星期一", value: "Mon" }
]
},
visible: ((o = t == null ? void 0 : t.editor) == null ? void 0 : o.selectMode) === "day"
},
showTime: {
description: "",
title: "启用时间选择",
type: "boolean",
readonly: ((m = t == null ? void 0 : t.editor) == null ? void 0 : m.fieldType) === "Date",
refreshPanelAfterChanged: !0,
visible: ((D = t == null ? void 0 : t.editor) == null ? void 0 : D.selectMode) === "day"
},
defaultTime: {
description: "",
title: "默认时间",
type: "string",
editor: this.getPropertyEditorParams(t, ["Const", "Variable", "Expression"], "defaultTime", {
constType: "time-picker",
constTime: {
enableClear: !0,
hourStep: 1,
minuteStep: 1,
secondStep: 1
}
}, {
newVariablePrefix: "",
newVariableType: "String"
}),
visible: !1
// propertyData?.editor?.showTime === true
},
displayFormat: {
description: "",
title: "展示格式",
type: "enum",
editor: {
data: l
}
},
valueFormat: {
description: "",
title: "存储格式",
type: "enum",
editor: {
data: y
},
visible: ((P = t == null ? void 0 : t.editor) == null ? void 0 : P.fieldType) === "String"
},
minDate: {
description: "",
title: "最小日期",
type: "string",
editor: this.getPropertyEditorParams(t, ["Const"], "minDate", {
// 'Variable', 'Expression'
constType: "date-picker",
constDateTime: {
enableClear: !0,
selectMode: ((S = t == null ? void 0 : t.editor) == null ? void 0 : S.selectMode) || "day",
displayFormat: g,
valueFormat: g,
minDate: "1900-01-01 00:00:00",
maxDate: this.getMinOrMaxDate((I = t == null ? void 0 : t.editor) == null ? void 0 : I.maxDate, !0),
showTime: (x = t == null ? void 0 : t.editor) == null ? void 0 : x.showTime
}
}, {
newVariablePrefix: "",
newVariableType: "DateTime"
}),
refreshPanelAfterChanged: !0
},
maxDate: {
description: "",
title: "最大日期",
type: "string",
editor: this.getPropertyEditorParams(t, ["Const"], "maxDate", {
// , 'Variable', 'Expression'
constType: "date-picker",
constDateTime: {
enableClear: !0,
selectMode: ((r = t == null ? void 0 : t.editor) == null ? void 0 : r.selectMode) || "day",
displayFormat: g,
valueFormat: g,
minDate: this.getMinOrMaxDate((E = t == null ? void 0 : t.editor) == null ? void 0 : E.minDate),
maxDate: "9999-12-31 23:59:59",
showTime: (Y = t == null ? void 0 : t.editor) == null ? void 0 : Y.showTime
}
}, {
newVariablePrefix: "",
newVariableType: "DateTime"
}),
refreshPanelAfterChanged: !0
},
enableQuickSelect: {
description: "",
title: "启用快速选择",
type: "boolean",
visible: ((f = t == null ? void 0 : t.editor) == null ? void 0 : f.selectMode) === "day"
}
}, this.setEditorPropertyRelates);
}
getExtremeDateFormat(t) {
var l, y, a, i;
if (((l = t == null ? void 0 : t.editor) == null ? void 0 : l.selectMode) === "day")
return "yyyy-MM-dd" + ((y = t == null ? void 0 : t.editor) != null && y.showTime ? " HH:mm:ss" : "");
if (((a = t == null ? void 0 : t.editor) == null ? void 0 : a.selectMode) === "month")
return "yyyy-MM";
if (((i = t == null ? void 0 : t.editor) == null ? void 0 : i.selectMode) === "year")
return "yyyy";
}
getEventPropertyConfig(t) {
const l = this, y = [
{ label: "onDatePicked", name: "日期选择后事件" },
...this.getInputCommonEvents(t)
], a = l.eventsEditorUtils.formProperties(t, l.viewModelId, y);
return {
title: "事件",
hideTitle: !0,
properties: l.createBaseEventProperty(a),
// 这个属性,标记当属性变更得时候触发重新更新属性
refreshPanelAfterChanged: !0,
tabId: "commands",
tabName: "交互",
setPropertyRelates(g, c) {
const b = g.propertyValue;
delete c[l.viewModelId], b && (l.eventsEditorUtils.saveRelatedParameters(c, l.viewModelId, b.events, b), l.updateLinkedLabel(b, c));
const T = l.designViewModelUtils.getDgViewModel(l.viewModelId);
T && l.designViewModelField && T.changeField(l.designViewModelField.id, { valueChanging: c.fieldValueChanging, valueChanged: c.fieldValueChanged });
}
};
}
setEditorPropertyRelates(t, l, y) {
if (!(!t || !l.editor))
switch (t.propertyID) {
case "showTime": {
const a = l.editor;
t.propertyValue ? (a.displayFormat = "yyyy-MM-dd HH:mm:ss", a.valueFormat = "yyyy-MM-dd HH:mm:ss") : (a.displayFormat = "yyyy-MM-dd", a.valueFormat = "yyyy-MM-dd"), l.formatter && (l.formatter.dateFormat = a.displayFormat);
break;
}
case "displayFormat": {
l.formatter && (l.formatter.dateFormat = t.propertyValue);
break;
}
case "selectMode": {
t.propertyValue !== "day" ? (l.editor.showWeekNumber = !1, l.editor.showTime = !1, l.editor.enableQuickSelect = !1, t.propertyValue === "month" ? (l.editor.displayFormat = "yyyy-MM", l.editor.valueFormat = "yyyy-MM") : (l.editor.displayFormat = "yyyy", l.editor.valueFormat = "yyyy")) : (l.editor.displayFormat = "yyyy-MM-dd", l.editor.valueFormat = "yyyy-MM-dd");
break;
}
case "minDate":
case "defaultTime":
case "maxDate":
this.afterMutilEditorChanged(l, t);
}
}
getDateFormatOptions(t) {
const l = t.selectMode || "day";
let y = [];
switch (l) {
case "day": {
const a = [];
t.showTime && a.push(...tl), a.push(...al, ...ca, ...Tt, ...nl), y = a;
break;
}
case "month": {
y = [...ca, ...Tt];
break;
}
case "year": {
y = [...Tt];
break;
}
}
return y;
}
getValueFormatOptions(t) {
switch (t.selectMode || "day") {
case "day": {
let y = [...Gn];
return t.showTime && (y = [...Xn]), y;
}
case "month":
return Zn;
case "year":
return el;
default:
return [];
}
}
/**
* 切换绑定属性
*/
changeBindingField(t, l, y) {
var i;
super.changeBindingField(t, l);
const a = y;
t.editor && ((i = a == null ? void 0 : a.type) != null && i.name) && (t.editor.fieldType = a.type.name, a.type.name === mn.DateTime && (Object.prototype.hasOwnProperty.call(t.editor, "showTime") || (t.editor.showTime = !0), Object.prototype.hasOwnProperty.call(t.editor, "displayFormat") || (t.editor.displayFormat = "yyyy-MM-dd HH:mm:ss"), Object.prototype.hasOwnProperty.call(t.editor, "valueFormat") || (t.editor.valueFormat = "yyyy-MM-dd HH:mm:ss")));
}
}
function ol(e, t) {
const l = e.schema;
function y(a, i) {
return new ll(a, t).getPropertyConfig(l, i);
}
return { getPropsConfig: y };
}
const ot = /* @__PURE__ */ Ce({
name: "FDatePickerDesign",
props: Un,
emits: ["update:modelValue", "datePicked"],
setup(e, t) {
const l = '<span class="f-icon f-icon-date"></span>';
M(e.modelValue);
const y = M(), a = St("designer-host-service"), i = St("design-item-context"), g = ol(i, a), c = va(y, i, g);
Ht(() => {
y.value.componentInstance = c;
}), t.expose(c.value);
const b = W(() => ({
"f-button-edit": !0,
"f-cmp-inputgroup": !0,
"f-button-edit-nowrap": !0,
"f-cmp-datepicker": !0
})), T = W(() => ({
"f-cmp-inputgroup": !0,
"input-group": !0,
// 'f-state-disable': disabled.value,
"f-state-editable": !0,
"align-items-center": !0
// 'f-state-readonly': readonly.value,
// 'f-state-focus': hasFocused.value
}));
function d() {
return p("div", {
class: b.value,
ref: y
}, [p("div", {
class: T.value
}, [p("div", {
class: "f-utils-fill d-flex align-items-center date-range-wrapper"
}, [p(ra, {
showBorder: !1,
editable: !1,
enableClear: !1,
placeholder: e.beginPlaceholder
}, null), p("span", {
class: "f-icon f-icon-orientation-arrow sub-input-spliter"
}, null), p(ra, {
showBorder: !1,
editable: !1,
enableClear: !1,
placeholder: e.endPlaceholder
}, null)]), p("div", {
class: "input-group-append"
}, [p("span", {
class: "input-group-text input-group-append-button"
}, [p("i", {
class: "f-icon f-icon-date"
}, null)])])])]);
}
return () => e.enablePeriod ? d() : p(pn, {
ref: y,
buttonContent: l,
readonly: !0,
editable: !1,
forcePlaceholder: !0,
placeholder: e.placeholder,
enableClear: !0
}, null);
}
}), sl = "Sun", il = "Mon", rl = "Tue", ul = "Wed", cl = "Thu", dl = "Fri", yl = "Sat", Ae = [sl, il, rl, ul, cl, dl, yl];
var fe = /* @__PURE__ */ ((e) => (e[e.previous = 1] = "previous", e[e.current = 2] = "current", e[e.next = 3] = "next", e))(fe || {}), Ne = /* @__PURE__ */ ((e) => (e.Sunday = "Sun", e.Monday = "Mon", e))(Ne || {});
const pa = {
1: "一月",
2: "二月",
3: "三月",
4: "四月",
5: "五月",
6: "六月",
7: "七月",
8: "八月",
9: "九月",
10: "十月",
11: "十一月",
12: "十二月"
}, fl = {
id: { type: String, default: "" },
/** 允许编辑 */
editable: { type: Boolean, default: !1 },
/** 禁用 */
disabled: { type: Boolean, default: !1 },
/** 同disabled */
readonly: { type: Boolean, default: !1 },
/** 禁用日期 */
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 } },
/** 高亮日期 */
highlightDates: { Type: Array, default: [] },
/** 是否高亮周六 */
highlightSaturday: { Type: Boolean, default: !1 },
/** 是否高亮周日 */
highlightSunday: { Type: Boolean, default: !1 },
/** 最晚年限 */
maxDate: { Type: String, default: "9999-12-31 23:59:59" },
/** 最早年限 */
minDate: { Type: String, default: "1900-01-01 00:00:00" },
/** 组件值 */
modelValue: { type: String, default: "" },
/** 每月缩写 */
nameOfMonths: { Type: Object, default: pa },
/** 定界符 */
// periodDelimiter: { Type: String, default: '' },
/** 显示方式 */
selectMode: { Type: String, default: "day" },
/** 存储格式 */
valueFormat: { Type: String, default: "yyyy-MM-dd" },
/** 显示格式 */
displayFormat: { Type: String, default: "yyyy-MM-dd" },
/** 是否允许日期范围 */
enablePeriod: { type: Boolean, default: !1 },
/** 日期区间是否启用分开选择开始、结束日期,默认为 false */
splitSelection: { type: Boolean, default: !1 },
/**
* 作为内嵌编辑器被创建后默认获得焦点
*/
focusOnCreated: { type: Boolean, default: !1 },
/**
* 背景文字
*/
placeholder: { type: String, default: "请选择日期" },
/** 区间——开始提示文字 */
beginPlaceholder: { type: String, default: "开始日期" },
/** 区间——结束提示文字 */
endPlaceholder: { type: String, default: "结束日期" },
/** 区间——开始值 */
beginValue: { type: String, default: "" },
/** 区间——结束值 */
endValue: { type: String, default: "" },
/**
* 作为内嵌编辑器被创建后默认选中文本
*/
selectOnCreated: { type: Boolean, default: !1 },
/**
* 是否展示时分秒
*/
showTime: { type: Boolean, default: !1 },
/** 时间显示模式,与日期并列显示*/
inlineDateTime: { type: Boolean, default: !0 },
showWeekNumber: { type: Boolean, default: !1 },
weekTitle: { type: String, default: "周" },
/** 显示中间图标 */
showMiddleIcon: { type: Boolean, default: !0 },
/** 启用删除 */
enableClear: { type: Boolean, default: !0 },
firstDayOfTheWeek: { type: String, default: Ne.Sunday },
/** 启用快捷选择列表 */
enableQuickSelect: { type: Boolean, default: !1 },
/** 默认时间,默认为空,表示使用当前时间 */
defaultTime: {
type: String,
default: null
}
}, ml = {
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: Ne.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: pa },
/** 二级日期 */
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 }
}, vl = {
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 ve(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 st(e, t) {
return e instanceof Date ? new e.constructor(t) : new Date(t);
}
function $e(e, t) {
const l = ve(e);
return isNaN(t) ? st(e, NaN) : (t && l.setDate(l.getDate() + t), l);
}
function Ft(e, t) {
const l = ve(e);
if (isNaN(t)) return st(e, NaN);
if (!t)
return l;
const y = l.getDate(), a = st(e, l.getTime());
a.setMonth(l.getMonth() + t + 1, 0);
const i = a.getDate();
return y >= i ? a : (l.setFullYear(
a.getFullYear(),
a.getMonth(),
y
), l);
}
let hl = {};
function Ta() {
return hl;
}
function Ct(e, t) {
var c, b, T, d;
const l = Ta(), y = (t == null ? void 0 : t.weekStartsOn) ?? ((b = (c = t == null ? void 0 : t.locale) == null ? void 0 : c.options) == null ? void 0 : b.weekStartsOn) ?? l.weekStartsOn ?? ((d = (T = l.locale) == null ? void 0 : T.options) == null ? void 0 : d.weekStartsOn) ?? 0, a = ve(e), i = a.getDay(), g = (i < y ? 7 : 0) + i - y;
return a.setDate(a.getDate() - g), a.setHours(0, 0, 0, 0), a;
}
function bl(e) {
const t = ve(e);
return t.setHours(0, 0, 0, 0), t;
}
function gl(e, t) {
const l = t * 3;
return Ft(e, l);
}
function Nt(e, t) {
return Ft(e, t * 12);
}
function Ml(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function kl(e) {
if (!Ml(e) && typeof e != "number")
return !1;
const t = ve(e);
return !isNaN(Number(t));
}
function Dt(e) {
const t = ve(e), l = t.getMonth();
return t.setFullYear(t.getFullYear(), l + 1, 0), t.setHours(23, 59, 59, 999), t;
}
function wt(e) {
const t = ve(e), l = t.getMonth(), y = l - l % 3;
return t.setMonth(y, 1), t.setHours(0, 0, 0, 0), t;
}
function Ot(e) {
const t = ve(e);
return t.setDate(1), t.setHours(0, 0, 0, 0), t;
}
function at(e) {
const t = ve(e), l = t.getFullYear();
return t.setFullYear(l + 1, 0, 0), t.setHours(23, 59, 59, 999), t;
}
function nt(e) {
const t = ve(e), l = st(e, 0);
return l.setFullYear(t.getFullYear(), 0, 1), l.setHours(0, 0, 0, 0), l;
}
function da(e, t) {
var c, b, T, d;
const l = Ta(), y = (t == null ? void 0 : t.weekStartsOn) ?? ((b = (c = t == null ? void 0 : t.locale) == null ? void 0 : c.options) == null ? void 0 : b.weekStartsOn) ?? l.weekStartsOn ?? ((d = (T = l.locale) == null ? void 0 : T.options) == null ? void 0 : d.weekStartsOn) ?? 0, a = ve(e), i = a.getDay(), g = (i < y ? -7 : 0) + 6 - (i - y);
return a.setDate(a.getDate() + g), a.setHours(23, 59, 59, 999), a;
}
function xt(e) {
const t = ve(e), l = t.getMonth(), y = l - l % 3 + 3;
return t.setMonth(y, 0), t.setHours(23, 59, 59, 999), t;
}
function pl(e) {
const t = ve(e);
return t.setMilliseconds(0), t;
}
function Le(e, t) {
return $e(e, -t);
}
function Tl() {
return bl(Date.now());
}
function Pt(e, t) {
return Ft(e, -t);
}
function ya(e, t) {
return gl(e, -1);
}
function fa(e, t) {
return Nt(e, -1);
}
function Oe() {
const { formatTo: e, parseToDate: t } = Yt();
function l() {
return { year: 0, month: 0, day: 0 };
}
function y(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 a(r) {
const E = /* @__PURE__ */ new Date();
return r.year || (r.year = E.getFullYear()), r.month || (r.month = E.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 g(r) {
return Ae.indexOf(r);
}
function c(r) {
return y(r).getTime();
}
function b(r) {
return Math.round(c(r) / 1e3);
}
function T(r, E, Y) {
const f = c(E), k = c(Y), w = c(r);
return k - w > w - f ? E : Y;
}
function d() {
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 o(r, E) {
const Y = E.match(/[^(DdMmYy)]{1,}/g), f = {};
if (Y) {
let k = Y[0];
Y[0] !== Y[1] && (k = Y[0] + Y[1], Y[2] && Y[1] !== Y[2] && (k += Y[2]));
const w = new RegExp("[" + k + "]"), G = r.split(w), _ = E.split(w);
for (let Q = 0; Q < _.length; Q++)
_[Q].indexOf("yyyy") !== -1 && (f.year = Number(G[Q])), _[Q].indexOf("M") !== -1 && (f.month = Number(G[Q] || "1")), _[Q].indexOf("d") !== -1 && (f.day = Number(G[Q] || "1"));
} else {
const k = (E + "").indexOf("yyyy"), w = (E + "").indexOf("MM"), G = (E + "").indexOf("dd");
if (k >= 0) {
const _ = r.substring(k, k + 4);
f.year = Number(_);
}
w >= 0 && (f.month = Number(r.substring(w, w + 2) || "1")), G >= 0 && (f.day = Number(r.substring(G, G + 2) || "01"));
}
return f.year === void 0 && (f.year = d().year), f;
}
function m(r) {
return {
year: r.getFullYear(),
month: r.getMonth() + 1,
day: r.getDate(),
hour: r.getHours(),
minute: r.getMinutes(),
second: r.getSeconds()
};
}
function D(r, E = !0) {
const Y = new Date(1900, 1, 1, 0, 0, 0), f = new Date(9999, 12, 31, 23, 59, 59), k = E ? Y : f;
let w;
return r instanceof Date ? w = r : typeof r == "string" ? w = r.trim() ? t(r, "yyyy-MM-dd HH:mm:ss") : k : w = k, kl(w) || (w = k), {
year: w.getFullYear(),
month: w.getMonth() + 1,
day: w.getDate(),
hour: w.getHours(),
minute: w.getMinutes(),
second: w.getSeconds()
};
}
function P(r) {
return D(r, !0);
}
function S(r) {
return D(r, !1);
}
function I(r, E = !1) {
if (r && typeof r == "string") {
const Y = r.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (Y.length >= 2)
return {
hour: parseInt(Y[0], 10),
minute: parseInt(Y[1]),
second: parseInt(Y[2] || "0") || 0
};
} else {
const Y = /* @__PURE__ */ new Date(), f = Y.getHours(), k = Y.getMinutes(), w = Y.getSeconds();
return E ? { hour: 0, minute: 0, second: 0 } : { hour: f, minute: k, second: w };
}
return { hour: 0, minute: 0, second: 0 };
}
function x(r) {
if (r && typeof r == "string") {
const k = r.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (k.length >= 2)
return {
hour: k[0],
minute: k[1],
second: k[2] ? k[2] : 0
};
}
return { hour: 23, minute: 59, second: 59 };
}
return {
emptyDate: l,
getDate: y,
getDate2: a,
getDayNumber: i,
getEpocTime: b,
getNearDate: T,
getWeekdayIndex: g,
getTimeInMilliseconds: c,
getToday: d,
getDateObject: o,
getMinDate: P,
getMaxDate: S,
getTimeValue: I,
getEndTimeValue: x,
convertDateToDateObject: m
};
}
function xe() {
const { getTimeInMilliseconds: e } = Oe();
function t(o) {
return o && o.year !== 0 && o.month !== 0 && o.day !== 0;
}
function l(o) {
return o && o.year !== 0 && o.month !== 0;
}
function y(o) {
return o && o.year !== 0;
}
function a(o, m) {
return e(o) < e(m);
}
function i(o, m) {
return e(o) <= e(m);
}
function g(o, m) {
return e(o) === e(m);
}
function c(o, m) {
const D = e(m);
return e(o.from) === D || e(o.to) === D;
}
function b(o, m) {
return !m || !t(m.to) || !t(m.from) ? !1 : i(m.from, o) && i(o, m.to);
}
function T(o, m) {
return t(m) && e(o) >= e(m);
}
function d(o, m) {
return t(m) && e(o) <= e(m);
}
return {
isDateEarlier: a,
equal: g,
inPeriod: b,
isPoint: c,
equalOrEarlier: i,
isInitializedDate: t,
isInitializedMonth: l,
isInitializedYear: y,
isMonthDisabledByDisableSince: T,
isMonthDisabledByDisableUntil: d
};
}
function It() {
const { getTimeInMilliseconds: e } = Oe(), { isInitializedDate: t } = xe();
function l(a, i) {
return t(i) && e(a) < e(i);
}
function y(a, i) {
return t(i) && e(a) > e(i);
}
return { isMonthDisabledByDisableSince: y, isMonthDisabledByDisableUntil: l };
}
function Bt() {
const { getToday: e } = Oe(), { isMonthDisabledByDisableSince: t, isMonthDisabledByDisableUntil: l } = It();
function y(d) {
const o = { displayTextOfMonth: "", month: 0, year: 0, displayTextOfYear: "" };
if (d) {
const m = d.match(/[^0-9]/), D = m && m.length ? m[0] : "", P = d.split(D);
o.month = P[0].length === 2 ? Number(P[0]) : Number(P[1]), o.year = P[0].length === 2 ? Number(P[1]) : Number(P[0]);
}
return o;
}
function a(d, o) {
return new Date(o, d, 0).getDate();
}
function i(d, o, m) {
return new Date(d, o - 1, m, 0, 0, 0, 0);
}
function g(d, o) {
const m = i(o, d, 1);
return m.setMonth(m.getMonth() - 1), a(m.getMonth() + 1, m.getFullYear());
}
function c(d, o, m, D) {
const P = e(), S = [], { year: I } = o, x = 3, r = { year: m.year, month: m.month, day: m.day }, E = { year: D.year, month: D.month, day: D.day };
for (let Y = 1; Y <= 12; Y += x) {
const f = [];
for (let k = Y; k < Y + x; k++) {
const w = t({ year: I, month: k, day: 1 }, r) || l({ year: I, month: k, day: a(k, I || 0) }, E);
f.push({
month: k,
displayText: d[k],
isCurrent: k === P.month && I === P.year,
disable: w,
date: { year: I, month: k }
});
}
S.push(f);
}
return S;
}
function b(d, o) {
const m = {
year: d === 12 ? o + 1 : o
}, D = d === 12 ? 1 : d + 1;
return m.month = D, m;
}
function T(d, o) {
const m = {
year: d === 1 ? o - 1 : o
}, D = d === 1 ? 12 : d - 1;
return m.month = D, m;
}
return { daysInMonth: a, daysInPreMonth: g, generateMonths: c, parseDefaultMonth: y, getNextMonth: b, getPreviousMonth: T };
}
const Dl = /* @__PURE__ */ Ce({
name: "FDatePickerCalendarNavbar",
props: vl,
emits: ["clickMonth", "clickYear", "prePage", "preRecord", "nextRecord", "nextPage"],
setup(e, t) {
const l = M(e.ariaLabelPrevMonth), y = M(e.ariaLabelNextMonth), a = M(e.dateFormat), i = M(e.disablePrePage), g = M(e.disablePreRecord), c = M(e.disableNextRecord), b = M(e.disableNextPage), T = M(e.activeMonth), d = M(e.years), o = M(e.selectingMonth), m = M(e.selectingYear), D = M(e.selectMode), P = M(!0), S = M(!0), {
isMonthDisabledByDisableSince: I,
isMonthDisabledByDisableUntil: x
} = It(), {
daysInMonth: r
} = Bt();
ee(() => e.selectingMonth, (O, V) => {
o.value = O;
}), ee(() => e.selectingYear, (O, V) => {
m.value = O;
});
const E = (O, V) => ({
year: V === 1 ? O - 1 : O,
month: V === 1 ? 12 : V - 1,
day: r(V === 1 ? 12 : V - 1, V === 1 ? O - 1 : O)
}), Y = (O, V) => ({
year: V === 12 ? O + 1 : O,
month: V === 12 ? 1 : V + 1,
day: 1
}), f = (O) => ({
year: O - 1,
month: 12,
day: 31
}), k = (O) => ({
year: O + 1,
month: 1,
day: 1
});
function w(O, V, se, ie, me = "page") {
me === "page" ? (i.value = se || O, b.value = ie || V) : me === "record" && (g.value = se || O, c.value = ie || V);
}
function G(O, V) {
const {
minDate: se,
maxDate: ie,
minYear: me,
maxYear: he
} = e, ge = se ? x(f(O), se) : !0, Ve = ie ? I(k(V), ie) : !0;
w(ge, Ve, O <= me, V >= he);
}
function _(O, V) {
var me, he;
const se = O || ((me = d.value[0][1]) == null ? void 0 : me.year), ie = V || ((he = d.value[3][1]) == null ? void 0 : he.year);
se !== void 0 && ie !== void 0 && G(se, ie);
}
function Q(O, V) {
const {
minDate: se,
maxDate: ie,
minYear: me,
maxYear: he
} = e, ge = E(V, O), Ve = Y(V, O), Pe = se ? x(ge, {
year: se.year,
month: se.month,
day: se.day
}) : !0, it = ie ? I(Ve, {
year: ie.year,
month: ie.month,
day: ie.day
}) : !0;
w(Pe, it, O === 1 && V === me, O === 12 && V === he, "record"), _(V, V);
}
function $(O) {
const {
minDate: V,
maxDate: se,
minYear: ie,
maxYear: me
} = e, he = V ? x(f(O), V) : !0, ge = se ? I(k(O), se) : !0;
w(he, ge, O === ie, O === me);
}
ee(() => e.selectingMonth, (O, V) => {
O && $(T.value.year);
}), ee(() => e.selectingYear, (O, V) => {
O && _();
}), ee(() => e.years, (O, V) => {
d.value = O, m.value && _();
}), ee(() => e.activeMonth, () => {
const O = e.activeMonth;
O && (T.value = {
month: O.month,
year: O.year,
displayTextOfMonth: O.displayTextOfMonth,
displayTextOfYear: O.displayTextOfYear
}, !e.selectingMonth && !e.selectingYear ? Q(T.value.month, T.value.year) : e.selectingMonth ? $(T.value.year) : _());
}, {
immediate: !0
});
const j = W(() => ({
"f-datepicker-header": !0,
monthYearSelBarBorder: o.value || m.value
})), B = W(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": i.value
})), h = W(() => !o.value && !m.value), N = W(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": g.value
})), H = W(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": c.value
})), C = W(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": b.value
})), q = W(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-yearLabel": P.value,
"f-datepicker-labelBtnNotEdit": !P.value
})), U = W(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-monthLabel": S.value,
"f-datepicker-labelBtnNotEdit": !S.value
})), te = W(() => {
const O = a.value ? a.value.indexOf("yyyy") : 0, V = a.value ? a.value.indexOf("MM") : 0;
return O > V ? "MM-yyyy" : "yyyy-MM";
});
function re(O) {
O.stopPropagation(), !i.value && t.emit("prePage");
}
function K(O) {
O.stopPropagation(), !g.value && t.emit("preRecord");
}
function ne(O) {
O.stopPropagation(), t.emit("clickYear");
}
function R(O) {
O.stopPropagation(), t.emit("clickMonth");
}
function X(O) {
O.stopPropagation(), !c.value && t.emit("nextRecord");
}
function ae(O) {
O.stopPropagation(), !b.value && t.emit("nextPage");
}
const ye = W(() => {
const O = {};
return D.value === "year" && (O.cursor = "default"), O;
});
function de() {
return p("button", {
type: "button",
style: ye.value,
class: q.value,
onClick: (O) => {
P.value && ne(O);
},
tabindex: P.value ? "0" : "-1",
disabled: D.value === "year"
}, [m.value ? d.value.length > 3 ? d.value[0][1].year + " - " + d.value[3][1].year : "" : T.value.displayTextOfYear]);
}
function be() {
return !m.value && D.value !== "month" && p("button", {
type: "button",
class: U.value,
onClick: (O) => {
S.value && R(O);
},
tabindex: S.value ? "0" : "-1"
}, [T.value.displayTextOfMonth]);
}
const le = {
opacity: 0.4,
cursor: "default"
};
return () => p("div", {
class: j.value,
style: "height:40px; overflow:hidden;"
}, [p("div", {
class: "f-datepicker-prev-btn"
}, [p("button", {
type: "button",
class: B.value,
style: i.value ? le : {},
onClick: re
}, [p("i", {
class: "f-icon f-icon-arrow-double-60-left"
}, null)]), h.value && p("button", {
style: g.value ? le : {},
type: "button",
"aria-label": l.value,
class: N.value,
onClick: K
}, [p("i", {
class: "f-icon f-icon-arrow-chevron-left"
}, null)])]), p("div", {
class: "f-datepicker-monthYearText"
}, [te.value === "yyyy-MM" ? [de(), be()] : [be(), de()]]), p("div", {
class: "f-datepicker-next-btn"
}, [h.value && p("button", {
style: c.value ? le : {},
type: "button",
"aria-label": y.value,
class: H.value,
onClick: X
}, [p("i", {
class: "f-icon f-icon-arrow-chevron-right"
}, null)]), p("button", {
style: b.value ? le : {},
type: "button",
class: C.value,
onClick: ae
}, [p("i", {
class: "f-icon f-icon-arrow-double-60-right"
}, null)])])]);
}
}), wl = {
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: Ne.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 Et() {
function e(t) {
const l = t.key || t.keyCode;
return l === "Enter" || l === 13 ? 13 : l === "Escape" || l === 27 ? 27 : l === " " || l === 32 ? 32 : l === "ArrowLeft" || l === 37 ? 37 : l === "ArrowUp" || l === 38 ? 38 : l === "ArrowRight" || l === 39 ? 39 : l === "ArrowDown" || l === 40 ? 40 : l === "Tab" || l === 9 ? 9 : l === "Shift" || l === 16 ? 16 : -1;
}
return { getKeyCodeFromEvent: e };
}
const Ol = /* @__PURE__ */ Ce({
name: "FDatePickerCalendarView",
props: wl,
emits: ["click", "clickWeek", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const l = M(e.dates), y = M(e.daysInWeek), a = M(e.enableKeyboadNavigate), i = M(e.enableMarkCurrent), g = M(e.enablePeriod), c = M(e.selected), b = M(e.selectedPeriod), T = M(e.selectedWeek), d = M(e.selectMode), o = M(e.showWeekNumber), m = M(e.weekTitle || "周");
ee(() => e.dates, () => {
l.value = e.dates;
}), ee(() => e.selected, () => {
c.value = e.selected;
}), ee(() => e.enablePeriod, (h, N) => {
h !== N && (g.value = h);
}), ee(() => e.selectedPeriod, (h) => {
b.value = h;
}), ee(() => e.selectedWeek, (h) => {
T.value = h;
});
const {
equal: D,
inPeriod: P,
isInitializedDate: S,
equalOrEarlier: I,
isPoint: x
} = xe(), {
getKeyCodeFromEvent: r
} = Et(), E = (h) => {
const N = !!T.value && h.numberInTheYear === T.value.numberInTheYear;
return {
"f-datepicker-selectWeek": d.value === "week",
"f-datepicker-selectedWeek": d.value === "week" && N
};
};
function Y(h) {
return P(h, b.value);
}
function f(h) {
if (!b.value)
return !1;
const N = {
from: {
year: b.value.from.year,
month: b.value.from.month,
day: b.value.from.day
},
to: {
year: b.value.to.year,
month: b.value.to.month,
day: b.value.to.day
}
};
return !!b.value && x(N, h);
}
function k(h) {
return !!c.value && D({
year: c.value.year,
month: c.value.month,
day: c.value.day
}, {
year: h.year,
month: h.month,
day: h.day
});
}
const w = (h, N, H) => {
const C = d.value !== "week" && h.tag === fe.current && (g.value && Y(h.date) && !f(h.date) || h.range), q = h.tag === fe.previous || h.tag === fe.next, U = {
"f-datepicker-range": C,
"f-datepicker-no-currmonth": q,
"f-datepicker-disabled": h.disable,
"f-datepicker-singledate": !h.disable
}, te = `d_${N}_${H}`;
return U[te] = !0, U;
}, G = (h) => {
const N = d.value !== "week" && h.tag === fe.current && (!g.value && k(h.date) || g.value && f(h.date)), H = h.isCurrent && i.value, C = h.highlight && (h.tag === fe.previous || h.tag === fe.next || h.disable);
return {
"f-datepicker-date": !0,
"f-datepicker-selected": N,
"f-datepicker-current": H,
"f-datepicker-opacity": C,
"f-datepicker-highlight": h.highlight,
"f-datepicker-disabled": h.disable
};
};
function _(h, N) {
N.disable || d.value === "week" || (h.stopPropagation(), t.emit("click", {
event: h,
dayItem: N
}));
}
function Q(h, N) {
d.value === "week" && (h.stopPropagation(), t.emit("clickWeek", N));
}
function $(h, N) {
const H = r(h);
H !== ke.tab && (h.preventDefault(), H === ke.enter || H === ke.space ? _(h, N) : a.value && t.emit("keyDown", N.date));
}
function j(h) {
if (b.value && S(b.value.from) && (!S(b.value.to) || JSON.stringify(b.value.from) === JSON.stringify(b.value.to))) {
const {
from: N
} = b.value;
l.value.forEach((H) => {
H.days.forEach((C) => {
C.range = I(N, C.date) && I(C.date, h.date) || I(C.date, N) && I(h.date, C.date);
});
}), t.emit("mouseEnter", h.date);
}
}
function B() {
l.value.forEach((h) => {
h.days.forEach((N) => {
N.range = !1;
});
}), t.emit("mouseLeave");
}
return () => p(kn, null, [p("div", {
class: "f-datepicker-table-wrapper"
}, [p("table", {
class: "f-datepicker-table",
cellpadding: "0"
}, [p("thead", null, [p("tr", null, [o.value && p("th", {
class: "f-datepicker-weeknbr-title",
style: "padding-bottom: 8px;padding-top: 4px"
}, [m.value]), y.value && y.value.map((h) => p("th", {
scope: "col",
style: "padding-bottom: 8px;padding-top: 4px"
}, [h]))])]), p("tbody", null, [l.value && l.value.map((h, N) => p("tr", {
class: E(h),
onClick: (H) => Q(H, h)
}, [o.value && p("td", {
class: "f-datepicker-weeknbr"
}, [p("div", {
class: "f-datepicker-date"
}, [h.numberInTheYear])]), h.days && h.days.map((H, C) => p("td", {
id: `d_${N}_${C}`,
tabindex: "0",
class: w(H, N, C),
onKeydown: (q) => $(q, H),
onMouseenter: () => j(H),
onMouseleave: () => B()
}, [H.marked && H.marked.marked && p("span", {
class: "f-datepicker-markdate",
style: {
"background-color": H.marked.color
}
}, null), p("div", {
class: G(H),
onClick: (q) => _(q, H)
}, [H.date.day])]))]))])])])]);
}
}), xl = {
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, de