@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,707 lines (1,706 loc) • 115 kB
JavaScript
import { useDateFormat as Yt, EVENT_PROPERTY_TAB_IDS as ma, FormSchemaEntityFieldTypeName as va, formatTime as ha, withInstall as ba } from "../../components/common/index.esm.js";
import { datePickerProps as vn, datePickerContainerProps as ga, DatePicker as Ma, DatePickerContainer as pa } from "../../components/date-picker/index.esm.js";
import { defineComponent as Ce, ref as M, inject as St, onMounted as Ht, computed as R, createVNode as T, watch as Z, Fragment as ka, mergeProps as tt } from "vue";
import Ta from "../button-edit/index.esm.js";
import { useDesignerComponent as hn } from "../../components/designer-canvas/index.esm.js";
import { resolveAppearance as wa, createPropsResolver as bn } from "../../components/dynamic-resolver/index.esm.js";
import un from "../input-group/index.esm.js";
import { InputBaseProperty as Da } from "../../components/property-panel/index.esm.js";
import { cloneDeep as oe } from "lodash-es";
import { FTimePickerTimeView as dn, convertToDate as xa } from "../../components/time-picker/index.esm.js";
import { FButton as Oa } from "../../components/button/index.esm.js";
function gn(e, t, l) {
return t;
}
const Mn = /* @__PURE__ */ new Map([
["appearance", wa]
]), Pa = "https://json-schema.org/draft/2020-12/schema", Sa = "https://farris-design.gitee.io/date-picker.schema.json", Ca = "date-picker", Na = "A Farris Input Component", Ya = "object", Ha = {
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
},
hourStep: {
description: "",
type: "number",
default: 1
},
minuteStep: {
description: "",
type: "number",
default: 1
},
secondStep: {
description: "",
type: "number",
default: 1
},
expandable: {
description: "",
type: "boolean",
default: !1
},
expandMode: {
description: "",
type: "string",
default: "text"
},
expandContent: {
description: "",
type: "string",
default: ""
},
expandDisabled: {
description: "",
type: "boolean",
default: !1
},
defaultTime: {
description: "",
type: "string",
default: ""
},
onExpandClick: {
description: "",
type: "string",
default: ""
}
}, Fa = [
"type"
], Ia = [
"id",
"appearance",
"binding",
"visible"
], Ba = {
onDatePicked: "日期选择后事件"
}, Ea = {
$schema: Pa,
$id: Sa,
title: Ca,
description: Na,
type: Ya,
properties: Ha,
required: Fa,
ignore: Ia,
events: Ba
}, $a = "https://json-schema.org/draft/2020-12/schema", Aa = "https://farris-design.gitee.io/date-view.schema.json", Va = "date-view", ja = "A Farris Input Component", Wa = "object", Ra = {
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
}
}, _a = [
"id",
"type"
], La = {
$schema: $a,
$id: Aa,
title: Va,
description: ja,
type: Wa,
properties: Ra,
required: _a
}, za = "date-view", qa = "A Farris Component", Ka = "object", Qa = {
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"
}
}
}
}, Ua = {
title: za,
description: qa,
type: Ka,
categories: Qa
}, oo = { year: 9999, month: 12, day: 31, hour: 23, minute: 59, second: 59 }, so = { year: 1900, month: 1, day: 1, hour: 0, minute: 0, second: 0 }, Ja = Object.assign({}, vn, {
readonly: {}
}), pn = bn(vn, Ea, Mn, gn), kn = bn(ga, La, Mn, gn, Ua);
function Ga() {
var h;
let e = "zh-CHS";
typeof window < "u" && window.top && ((h = window.top.localStorage) != null && h.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" }
], f = [
{ id: "yyyy-MM", name: "yyyy-MM" },
{ id: "yyyy/MM", name: "yyyy/MM" },
{ id: "yyyyMM", name: "yyyyMM" }
], n = [
{ 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日" }
), f.push(
{ id: "yyyy年MM月", name: "yyyy年MM月" }
), n.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日" }
), f.push(
{ id: "yyyy年MM月", name: "yyyy年MM月" }
), n.push(
{ id: "MM月dd日", name: "MM月dd日" }
), i.push(
{ id: "yyyy年", name: "yyyy年" }
)), { timeFormats: t, yMFormats: f, yMdFormats: l, mdFormats: n, yFormats: i };
}
const Xa = [
{ id: "yyyy-MM-dd", name: "yyyy-MM-dd" },
{ id: "yyyy/MM/dd", name: "yyyy/MM/dd" },
{ id: "MM/dd/yyyy", name: "MM/dd/yyyy" }
], Za = [
{ 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" }
], el = [
{ id: "yyyy-MM", name: "yyyy-MM" },
{ id: "yyyy/MM", name: "yyyy/MM" },
{ id: "yyyyMM", name: "yyyyMM" }
], tl = [
{ id: "yyyy", name: "yyyy" }
], { timeFormats: nl, yMdFormats: al, yMFormats: cn, mdFormats: ll, yFormats: Tt } = Ga();
class ol extends Da {
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: f, showTime: n } = (t == null ? void 0 : t.editor) || {}, { parseToDate: i, formatTo: h } = Yt();
if (f && typeof f == "string") {
const u = i(f, "yyyy-MM-dd HH:mm:ss");
u && (t.editor.maxDate = h(u, n ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd"));
}
if (l && typeof l == "string") {
const u = i(l, "yyyy-MM-dd HH:mm:ss");
u && (t.editor.minDate = h(u, n ? "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 u, g, w, d, o, m, D, P, S, I, O, Y, y, B, c, p, k;
const l = this.getDateFormatOptions(t == null ? void 0 : t.editor), f = this.getValueFormatOptions(t == null ? void 0 : t.editor), n = (g = (u = this.designViewModelField) == null ? void 0 : u.type) == null ? void 0 : g.name, i = this.getDatePickerModes(n);
(w = t == null ? void 0 : t.editor) != null && w.selectMode || (t.editor.selectMode = "day");
const h = this.getExtremeDateFormat(t);
return this.checkMaxMinDate(t), this.getComponentConfig(t, { type: "date-picker" }, {
enableClear: {
description: "是否显示清除按钮",
title: "启用清除按钮",
type: "boolean"
},
editable: {
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"
},
hourStep: {
description: "",
title: "时步长",
type: "number",
editor: {
min: 1,
max: 12,
useThousands: !1,
needValid: !0
},
visible: ((P = t == null ? void 0 : t.editor) == null ? void 0 : P.showTime) === !0
},
minuteStep: {
description: "",
title: "分步长",
type: "number",
editor: {
min: 1,
max: 30,
useThousands: !1,
needValid: !0
},
visible: ((S = t == null ? void 0 : t.editor) == null ? void 0 : S.showTime) === !0
},
secondStep: {
description: "",
title: "秒步长",
type: "number",
editor: {
min: 1,
max: 30,
useThousands: !1,
needValid: !0
},
visible: t.editor.showTime === !0
},
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: f
},
visible: ((I = t == null ? void 0 : t.editor) == null ? void 0 : I.fieldType) === "String"
},
minDate: {
description: "",
title: "最小日期",
type: "string",
editor: this.getPropertyEditorParams(t, ["Const"], "minDate", {
// 'Variable', 'Expression'
constType: "date-picker",
constDateTime: {
enableClear: !0,
selectMode: ((O = t == null ? void 0 : t.editor) == null ? void 0 : O.selectMode) || "day",
displayFormat: h,
valueFormat: h,
minDate: "1900-01-01 00:00:00",
maxDate: this.getMinOrMaxDate((Y = t == null ? void 0 : t.editor) == null ? void 0 : Y.maxDate, !0),
showTime: (y = t == null ? void 0 : t.editor) == null ? void 0 : y.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: ((B = t == null ? void 0 : t.editor) == null ? void 0 : B.selectMode) || "day",
displayFormat: h,
valueFormat: h,
minDate: this.getMinOrMaxDate((c = t == null ? void 0 : t.editor) == null ? void 0 : c.minDate),
maxDate: "9999-12-31 23:59:59",
showTime: (p = t == null ? void 0 : t.editor) == null ? void 0 : p.showTime
}
}, {
newVariablePrefix: "",
newVariableType: "DateTime"
}),
refreshPanelAfterChanged: !0
},
enableQuickSelect: {
description: "",
title: "启用快速选择",
type: "boolean",
visible: ((k = t == null ? void 0 : t.editor) == null ? void 0 : k.selectMode) === "day"
}
}, this.setEditorPropertyRelates);
}
getExtremeDateFormat(t) {
var l, f, n, i;
if (((l = t == null ? void 0 : t.editor) == null ? void 0 : l.selectMode) === "day")
return "yyyy-MM-dd" + ((f = t == null ? void 0 : t.editor) != null && f.showTime ? " HH:mm:ss" : "");
if (((n = t == null ? void 0 : t.editor) == null ? void 0 : n.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, f = [
{ label: "onDatePicked", name: "日期选择后事件" },
...this.getInputCommonEvents(t)
], n = l.eventsEditorUtils.formProperties(t, l.viewModelId, f), i = l.createBaseEventProperty(n);
return this.appendFieldValueChangeEvents(t, f), {
title: "事件",
hideTitle: !0,
properties: i,
// 这个属性,标记当属性变更得时候触发重新更新属性
refreshPanelAfterChanged: !0,
tabId: ma,
tabName: "交互",
setPropertyRelates(h, u) {
const g = h.propertyValue;
delete t[l.viewModelId], g && (g.setPropertyRelates = this.setPropertyRelates, l.eventsEditorUtils.saveRelatedParameters(t, l.viewModelId, g.events, g), l.updateLinkedLabel(g, t));
const w = l.designViewModelUtils.getDgViewModel(l.viewModelId);
w && l.designViewModelField && w.changeField(l.designViewModelField.id, {
valueChanging: t.fieldValueChanging || "",
valueChanged: t.fieldValueChanged || ""
});
}
};
}
setEditorPropertyRelates(t, l, f) {
if (!(!t || !l.editor))
switch (t.propertyID) {
case "showTime": {
const n = l.editor;
t.propertyValue ? (n.displayFormat = "yyyy-MM-dd HH:mm:ss", n.valueFormat = "yyyy-MM-dd HH:mm:ss") : (n.displayFormat = "yyyy-MM-dd", n.valueFormat = "yyyy-MM-dd"), l.formatter && (l.formatter.dateFormat = n.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 f = [];
switch (l) {
case "day": {
const n = [];
t.showTime && n.push(...nl), n.push(...al, ...cn, ...Tt, ...ll), f = n;
break;
}
case "month": {
f = [...cn, ...Tt];
break;
}
case "year": {
f = [...Tt];
break;
}
}
return f;
}
getValueFormatOptions(t) {
switch (t.selectMode || "day") {
case "day": {
let f = [...Xa];
return t.showTime && (f = [...Za]), f;
}
case "month":
return el;
case "year":
return tl;
default:
return [];
}
}
/**
* 切换绑定属性
*/
changeBindingField(t, l, f) {
var i;
super.changeBindingField(t, l);
const n = f;
t.editor && ((i = n == null ? void 0 : n.type) != null && i.name) && (t.editor.fieldType = n.type.name, n.type.name === va.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 sl(e, t) {
const l = e.schema;
function f(n, i) {
return new ol(n, t).getPropertyConfig(l, i);
}
return { getPropsConfig: f };
}
const ot = /* @__PURE__ */ Ce({
name: "FDatePickerDesign",
props: Ja,
emits: ["update:modelValue", "datePicked"],
setup(e, t) {
const l = '<span class="f-icon f-icon-date"></span>';
M(e.modelValue);
const f = M(), n = St("designer-host-service"), i = St("design-item-context"), h = sl(i, n), u = hn(f, i, h);
Ht(() => {
f.value.componentInstance = u;
}), t.expose(u.value);
const g = R(() => ({
"f-button-edit": !0,
"f-cmp-inputgroup": !0,
"f-button-edit-nowrap": !0,
"f-cmp-datepicker": !0
})), w = R(() => ({
"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 T("div", {
class: g.value,
ref: f
}, [T("div", {
class: w.value
}, [T("div", {
class: "f-utils-fill d-flex align-items-center date-range-wrapper"
}, [T(un, {
showBorder: !1,
editable: !1,
enableClear: !1,
placeholder: e.beginPlaceholder
}, null), T("span", {
class: "f-icon f-icon-orientation-arrow sub-input-spliter"
}, null), T(un, {
showBorder: !1,
editable: !1,
enableClear: !1,
placeholder: e.endPlaceholder
}, null)]), T("div", {
class: "input-group-append"
}, [T("span", {
class: "input-group-text input-group-append-button"
}, [T("i", {
class: "f-icon f-icon-date"
}, null)])])])]);
}
return () => e.enablePeriod ? d() : T(Ta, {
ref: f,
buttonContent: l,
readonly: !0,
editable: !1,
forcePlaceholder: !0,
placeholder: e.placeholder,
expandable: e.expandable,
expandMode: e.expandMode,
expandContent: e.expandContent,
expandDisabled: e.expandDisabled
}, null);
}
}), il = "Sun", rl = "Mon", ul = "Tue", dl = "Wed", cl = "Thu", yl = "Fri", fl = "Sat", Ae = [il, rl, ul, dl, cl, yl, fl];
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 Tn = {
1: "一月",
2: "二月",
3: "三月",
4: "四月",
5: "五月",
6: "六月",
7: "七月",
8: "八月",
9: "九月",
10: "十月",
11: "十一月",
12: "十二月"
}, ml = {
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: [] },
/**
* 禁用周末
* @default false
*/
disableWeekends: { Type: Boolean, default: !1 },
/**
* 禁用至该范围
*/
disableUntil: { Type: Object, default: { year: 0, month: 0, day: 0 } },
/**
* 高亮日期
* @default []
*/
highlightDates: { Type: Array, default: [] },
/**
* 高亮周六
* @default false
*/
highlightSaturday: { Type: Boolean, default: !1 },
/**
* 高亮周日
* @default false
*/
highlightSunday: { Type: Boolean, default: !1 },
/**
* 最晚年限
*/
maxDate: { Type: String, default: "" },
/**
* 最早年限
*/
minDate: { Type: String, default: "" },
/**
* 组件值
*/
modelValue: { type: String, default: "" },
/**
* 月名称缩写
* @default defaultNameOfMonths
*/
nameOfMonths: { Type: Object, default: Tn },
/** 定界符 */
// periodDelimiter: { Type: String, default: '' },
/**
* 显示方式
*/
selectMode: { Type: String, default: "day" },
/**
* 储存日期格式
* @default 'yyyy-MM-dd'
*/
valueFormat: { Type: String, default: "yyyy-MM-dd" },
/**
* 显示日期格式
* @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 },
hourStep: { type: Number, default: 1 },
minuteStep: { type: Number, default: 1 },
secondStep: { type: Number, default: 1 },
/**
* 是否可扩展
*/
expandable: { type: Boolean, default: !1 },
/**
* 扩展模式 text | button
*/
expandMode: { type: String, default: "text" },
/**
* 扩展文本内容
*/
expandContent: { type: String, default: "" },
/**
* 扩展按钮是否禁用
*/
expandDisabled: { type: Boolean, default: !1 },
/**
* 默认时间,默认为空,表示使用当前时间
*/
defaultTime: {
type: String,
default: null
},
popupClass: { type: String, default: "" }
}, vl = {
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: Tn },
/** 二级日期 */
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 },
hourStep: { type: Number, default: 1 },
minuteStep: { type: Number, default: 1 },
secondStep: { type: Number, default: 1 },
/** 默认时间 */
defaultTime: { type: String, default: null }
}, hl = {
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 Ve(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 f = l.getDate(), n = st(e, l.getTime());
n.setMonth(l.getMonth() + t + 1, 0);
const i = n.getDate();
return f >= i ? n : (l.setFullYear(
n.getFullYear(),
n.getMonth(),
f
), l);
}
let bl = {};
function wn() {
return bl;
}
function Ct(e, t) {
var u, g, w, d;
const l = wn(), f = (t == null ? void 0 : t.weekStartsOn) ?? ((g = (u = t == null ? void 0 : t.locale) == null ? void 0 : u.options) == null ? void 0 : g.weekStartsOn) ?? l.weekStartsOn ?? ((d = (w = l.locale) == null ? void 0 : w.options) == null ? void 0 : d.weekStartsOn) ?? 0, n = ve(e), i = n.getDay(), h = (i < f ? 7 : 0) + i - f;
return n.setDate(n.getDate() - h), n.setHours(0, 0, 0, 0), n;
}
function gl(e) {
const t = ve(e);
return t.setHours(0, 0, 0, 0), t;
}
function Ml(e, t) {
const l = t * 3;
return Ft(e, l);
}
function Nt(e, t) {
return Ft(e, t * 12);
}
function pl(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function kl(e) {
if (!pl(e) && typeof e != "number")
return !1;
const t = ve(e);
return !isNaN(Number(t));
}
function wt(e) {
const t = ve(e), l = t.getMonth();
return t.setFullYear(t.getFullYear(), l + 1, 0), t.setHours(23, 59, 59, 999), t;
}
function Dt(e) {
const t = ve(e), l = t.getMonth(), f = l - l % 3;
return t.setMonth(f, 1), t.setHours(0, 0, 0, 0), t;
}
function xt(e) {
const t = ve(e);
return t.setDate(1), t.setHours(0, 0, 0, 0), t;
}
function nt(e) {
const t = ve(e), l = t.getFullYear();
return t.setFullYear(l + 1, 0, 0), t.setHours(23, 59, 59, 999), t;
}
function at(e) {
const t = ve(e), l = st(e, 0);
return l.setFullYear(t.getFullYear(), 0, 1), l.setHours(0, 0, 0, 0), l;
}
function yn(e, t) {
var u, g, w, d;
const l = wn(), f = (t == null ? void 0 : t.weekStartsOn) ?? ((g = (u = t == null ? void 0 : t.locale) == null ? void 0 : u.options) == null ? void 0 : g.weekStartsOn) ?? l.weekStartsOn ?? ((d = (w = l.locale) == null ? void 0 : w.options) == null ? void 0 : d.weekStartsOn) ?? 0, n = ve(e), i = n.getDay(), h = (i < f ? -7 : 0) + 6 - (i - f);
return n.setDate(n.getDate() + h), n.setHours(23, 59, 59, 999), n;
}
function Ot(e) {
const t = ve(e), l = t.getMonth(), f = l - l % 3 + 3;
return t.setMonth(f, 0), t.setHours(23, 59, 59, 999), t;
}
function Tl(e) {
const t = ve(e);
return t.setMilliseconds(0), t;
}
function _e(e, t) {
return Ve(e, -t);
}
function wl() {
return gl(Date.now());
}
function Pt(e, t) {
return Ft(e, -t);
}
function fn(e, t) {
return Ml(e, -1);
}
function mn(e, t) {
return Nt(e, -1);
}
function xe() {
const { formatTo: e, parseToDate: t } = Yt();
function l() {
return { year: 0, month: 0, day: 0 };
}
function f(y) {
return new Date(
y.year || 0,
y.month ? y.month - 1 : 0,
y.day || 0,
y.hour ? y.hour : 0,
y.minute ? y.minute : 0,
y.second ? y.second : 0,
0
);
}
function n(y) {
const B = /* @__PURE__ */ new Date();
return y.year || (y.year = B.getFullYear()), y.month || (y.month = B.getMonth() + 1), y.day || (y.day = 1), new Date(
y.year,
y.month - 1,
y.day,
y.hour ? y.hour : 0,
y.minute ? y.minute : 0,
y.second ? y.second : 0,
0
);
}
function i(y) {
return new Date(
y.year || 1,
(y.month || 1) - 1,
y.day,
y.hour ? y.hour : 0,
y.minute ? y.minute : 0,
y.second ? y.second : 0,
0
).getDay();
}
function h(y) {
return Ae.indexOf(y);
}
function u(y) {
return f(y).getTime();
}
function g(y) {
return Math.round(u(y) / 1e3);
}
function w(y, B, c) {
const p = u(B), k = u(c), V = u(y);
return k - V > V - p ? B : c;
}
function d() {
const y = /* @__PURE__ */ new Date();
return {
year: y.getFullYear(),
month: y.getMonth() + 1,
day: y.getDate(),
hour: y.getHours(),
minute: y.getMinutes(),
second: y.getSeconds()
};
}
function o(y, B) {
const c = B.match(/[^(DdMmYy)]{1,}/g), p = {};
if (c) {
let k = c[0];
c[0] !== c[1] && (k = c[0] + c[1], c[2] && c[1] !== c[2] && (k += c[2]));
const V = new RegExp("[" + k + "]"), z = y.split(V), U = B.split(V);
for (let E = 0; E < U.length; E++)
U[E].indexOf("yyyy") !== -1 && (p.year = Number(z[E])), U[E].indexOf("M") !== -1 && (p.month = Number(z[E] || "1")), U[E].indexOf("d") !== -1 && (p.day = Number(z[E] || "1"));
} else {
const k = (B + "").indexOf("yyyy"), V = (B + "").indexOf("MM"), z = (B + "").indexOf("dd");
if (k >= 0) {
const U = y.substring(k, k + 4);
p.year = Number(U);
}
V >= 0 && (p.month = Number(y.substring(V, V + 2) || "1")), z >= 0 && (p.day = Number(y.substring(z, z + 2) || "01"));
}
return p.year === void 0 && (p.year = d().year), p;
}
function m(y) {
return {
year: y.getFullYear(),
month: y.getMonth() + 1,
day: y.getDate(),
hour: y.getHours(),
minute: y.getMinutes(),
second: y.getSeconds()
};
}
function D(y, B = !0) {
const c = new Date(1900, 1, 1, 0, 0, 0), p = new Date(9999, 12, 31, 23, 59, 59), k = B ? c : p;
let V;
return y instanceof Date ? V = y : typeof y == "string" ? V = y.trim() ? t(y, "yyyy-MM-dd HH:mm:ss") : k : V = k, kl(V) || (V = k), {
year: V.getFullYear(),
month: V.getMonth() + 1,
day: V.getDate(),
hour: V.getHours(),
minute: V.getMinutes(),
second: V.getSeconds()
};
}
function P(y) {
return D(y, !0);
}
function S(y) {
return D(y, !1);
}
function I(y, B = !1) {
if (y && typeof y == "string") {
const c = y.replace("时", ":").replace("分", ":").replace("秒", "").split(":");
if (c.length >= 2)
return {
hour: parseInt(c[0], 10),
minute: parseInt(c[1]),
second: parseInt(c[2] || "0") || 0
};
} else {
const c = /* @__PURE__ */ new Date(), p = c.getHours(), k = c.getMinutes(), V = c.getSeconds();
return B ? { hour: 0, minute: 0, second: 0 } : { hour: p, minute: k, second: V };
}
return { hour: 0, minute: 0, second: 0 };
}
function O(y) {
if (y && typeof y == "string") {
const k = y.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 };
}
function Y(y, B, c) {
const { year: p } = y, k = String(y.month).padStart(2, "0"), V = String(y.day).padStart(2, "0");
if (B === "year")
return `${p}`;
if (B === "month")
return `${p}-${k}`;
let z = `${p}-${k}-${V}`;
if (c && (y.hour !== void 0 || y.minute !== void 0 || y.second !== void 0)) {
const U = String(y.hour || 0).padStart(2, "0"), E = String(y.minute || 0).padStart(2, "0"), A = String(y.second || 0).padStart(2, "0");
z += ` ${U}:${E}:${A}`;
}
return z;
}
return {
emptyDate: l,
getDate: f,
getDate2: n,
getDayNumber: i,
getEpocTime: g,
getNearDate: w,
getWeekdayIndex: h,
getTimeInMilliseconds: u,
getToday: d,
getDateObject: o,
getMinDate: P,
getMaxDate: S,
getTimeValue: I,
getEndTimeValue: O,
convertDateToDateObject: m,
formatDateObject: Y
};
}
function Oe() {
const { getTimeInMilliseconds: e } = xe();
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 f(o) {
return o && o.year !== 0;
}
function n(o, m) {
return e(o) < e(m);
}
function i(o, m) {
return e(o) <= e(m);
}
function h(o, m) {
return e(o) === e(m);
}
function u(o, m) {
const D = e(m);
return e(o.from) === D || e(o.to) === D;
}
function g(o, m) {
return !m || !t(m.to) || !t(m.from) ? !1 : i(m.from, o) && i(o, m.to);
}
function w(o, m) {
return t(m) && e(o) >= e(m);
}
function d(o, m) {
return t(m) && e(o) <= e(m);
}
return {
isDateEarlier: n,
equal: h,
inPeriod: g,
isPoint: u,
equalOrEarlier: i,
isInitializedDate: t,
isInitializedMonth: l,
isInitializedYear: f,
isMonthDisabledByDisableSince: w,
isMonthDisabledByDisableUntil: d
};
}
function It() {
const { getTimeInMilliseconds: e } = xe(), { isInitializedDate: t } = Oe();
function l(n, i) {
return t(i) && e(n) < e(i);
}
function f(n, i) {
return t(i) && e(n) > e(i);
}
return { isMonthDisabledByDisableSince: f, isMonthDisabledByDisableUntil: l };
}
function Bt() {
const { getToday: e } = xe(), { isMonthDisabledByDisableSince: t, isMonthDisabledByDisableUntil: l } = It();
function f(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 n(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 h(d, o) {
const m = i(o, d, 1);
return m.setMonth(m.getMonth() - 1), n(m.getMonth() + 1, m.getFullYear());
}
function u(d, o, m, D) {
const P = e(), S = [], { year: I } = o, O = 3, Y = { year: m.year, month: m.month, day: m.day }, y = { year: D.year, month: D.month, day: D.day };
for (let B = 1; B <= 12; B += O) {
const c = [];
for (let p = B; p < B + O; p++) {
const k = t({ year: I, month: p, day: 1 }, Y) || l({ year: I, month: p, day: n(p, I || 0) }, y);
c.push({
month: p,
displayText: d[p],
isCurrent: p === P.month && I === P.year,
disable: k,
date: { year: I, month: p }
});
}
S.push(c);
}
return S;
}
function g(d, o) {
const m = {
year: d === 12 ? o + 1 : o
}, D = d === 12 ? 1 : d + 1;
return m.month = D, m;
}
function w(d, o) {
const m = {
year: d === 1 ? o - 1 : o
}, D = d === 1 ? 12 : d - 1;
return m.month = D, m;
}
return { daysInMonth: n, daysInPreMonth: h, generateMonths: u, parseDefaultMonth: f, getNextMonth: g, getPreviousMonth: w };
}
const Dl = /* @__PURE__ */ Ce({
name: "FDatePickerCalendarNavbar",
props: hl,
emits: ["clickMonth", "clickYear", "prePage", "preRecord", "nextRecord", "nextPage"],
setup(e, t) {
const l = M(e.ariaLabelPrevMonth), f = M(e.ariaLabelNextMonth), n = M(e.dateFormat), i = M(e.disablePrePage), h = M(e.disablePreRecord), u = M(e.disableNextRecord), g = M(e.disableNextPage), w = 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: O
} = It(), {
daysInMonth: Y
} = Bt();
Z(() => e.selectingMonth, (x, W) => {
o.value = x;
}), Z(() => e.selectingYear, (x, W) => {
m.value = x;
});
const y = (x, W) => ({
year: W === 1 ? x - 1 : x,
month: W === 1 ? 12 : W - 1,
day: Y(W === 1 ? 12 : W - 1, W === 1 ? x - 1 : x)
}), B = (x, W) => ({
year: W === 12 ? x + 1 : x,
month: W === 12 ? 1 : W + 1,
day: 1
}), c = (x) => ({
year: x - 1,
month: 12,
day: 31
}), p = (x) => ({
year: x + 1,
month: 1,
day: 1
});
function k(x, W, se, ie, me = "page") {
me === "page" ? (i.value = se || x, g.value = ie || W) : me === "record" && (h.value = se || x, u.value = ie || W);
}
function V(x, W) {
const {
minDate: se,
maxDate: ie,
minYear: me,
maxYear: he
} = e, ge = se ? O(c(x), se) : !0, je = ie ? I(p(W), ie) : !0;
k(ge, je, x <= me, W >= he);
}
function z(x, W) {
var me, he;
const se = x || ((me = d.value[0][1]) == null ? void 0 : me.year), ie = W || ((he = d.value[3][1]) == null ? void 0 : he.year);
se !== void 0 && ie !== void 0 && V(se, ie);
}
function U(x, W) {
const {
minDate: se,
maxDate: ie,
minYear: me,
maxYear: he
} = e, ge = y(W, x), je = B(W, x), Pe = se ? O(ge, {
year: se.year,
month: se.month,
day: se.day
}) : !0, it = ie ? I(je, {
year: ie.year,
month: ie.month,
day: ie.day
}) : !0;
k(Pe, it, x === 1 && W === me, x === 12 && W === he, "record"), z(W, W);
}
function E(x) {
const {
minDate: W,
maxDate: se,
minYear: ie,
maxYear: me
} = e, he = W ? O(c(x), W) : !0, ge = se ? I(p(x), se) : !0;
k(he, ge, x === ie, x === me);
}
Z(() => e.selectingMonth, (x, W) => {
x && E(w.value.year);
}), Z(() => e.selectingYear, (x, W) => {
x && z();
}), Z(() => e.years, (x, W) => {
d.value = x, m.value && z();
}), Z(() => e.activeMonth, () => {
const x = e.activeMonth;
x && (w.value = {
month: x.month,
year: x.year,
displayTextOfMonth: x.displayTextOfMonth,
displayTextOfYear: x.displayTextOfYear
}, !e.selectingMonth && !e.selectingYear ? U(w.value.month, w.value.year) : e.selectingMonth ? E(w.value.year) : z());
}, {
immediate: !0
});
const A = R(() => ({
"f-datepicker-header": !0,
monthYearSelBarBorder: o.value || m.value
})), $ = R(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": i.value
})), b = R(() => !o.value && !m.value), N = R(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": h.value
})), H = R(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": u.value
})), C = R(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-header-btn-disabled": g.value
})), K = R(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-yearLabel": P.value,
"f-datepicker-labelBtnNotEdit": !P.value
})), J = R(() => ({
"f-datepicker-header-btn": !0,
"f-datepicker-monthLabel": S.value,
"f-datepicker-labelBtnNotEdit": !S.value
})), ne = R(() => {
const x = n.value ? n.value.indexOf("yyyy") : 0, W = n.value ? n.value.indexOf("MM") : 0;
return x > W ? "MM-yyyy" : "yyyy-MM";
});
function re(x) {
x.stopPropagation(), !i.value && t.emit("prePage");
}
function Q(x) {
x.stopPropagation(), !h.value && t.emit("preRecord");
}
function ae(x) {
x.stopPropagation(), t.emit("clickYear");
}
function _(x) {
x.stopPropagation(), t.emit("clickMonth");
}
function G(x) {
x.stopPropagation(), !u.value && t.emit("nextRecord");
}
function te(x) {
x.stopPropagation(), !g.value && t.emit("nextPage");
}
const ye = R(() => {
const x = {};
return D.value === "year" && (x.cursor = "default"), x;
});
function ce() {
return T("button", {
type: "button",
style: ye.value,
class: K.value,
onClick: (x) => {
P.value && ae(x);
},
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 : "" : w.value.displayTextOfYear]);
}
function be() {
return !m.value && D.value !== "month" && T("button", {
type: "button",
class: J.value,
onClick: (x) => {
S.value && _(x);
},
tabindex: S.value ? "0" : "-1"
}, [w.value.displayTextOfMonth]);
}
const le = {
opacity: 0.4,
cursor: "default"
};
return () => T("div", {
class: A.value,
style: "height:40px; overflow:hidden;"
}, [T("div", {
class: "f-datepicker-prev-btn"
}, [T("button", {
type: "button",
class: $.value,
style: i.value ? le : {},
onClick: re
}, [T("i", {
class: "f-icon f-icon-arrow-double-60-left"
}, null)]), b.value && T("button", {
style: h.value ? le : {},
type: "button",
"aria-label": l.value,
class: N.value,
onClick: Q
}, [T("i", {
class: "f-icon f-icon-arrow-chevron-left"
}, null)])]), T("div", {
class: "f-datepicker-monthYearText"
}, [ne.value === "yyyy-MM" ? [ce(), be()] : [be(), ce()]]), T("div", {
class: "f-datepicker-next-btn"
}, [b.value && T("button", {
style: u.value ? le : {},
type: "button",
"aria-label": f.value,
class: H.value,
onClick: G
}, [T("i", {
class: "f-icon f-icon-arrow-chevron-right"
}, null)]), T("button", {
style: g.value ? le : {},
type: "button",
class: C.value,
onClick: te
}, [T("i", {
class: "f-icon f-icon-arrow-double-60-right"
}, null)])])]);
}
}), xl = {
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 pe = /* @__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))(pe || {});
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: xl,
emits: ["click", "clickWeek", "keyDown", "mouseEnter", "mouseLeave"],
setup(e, t) {
const l = M(e.dates), f = M(e.daysInWeek), n = M(e.enableKeyboadNavigate), i = M(e.enableMarkCurrent), h = M(e.enablePeriod), u = M(e.selected), g = M(e.selectedPeriod), w = M(e.selectedWeek), d = M(e.selectMode), o = M(e.showWeekNumber), m = M(e.weekTitle || "周");
Z(() => e.dates, () => {
l.value = e.dates;
}), Z(() => e.selected, () => {
u.value = e.selected;
}), Z(() => e.enablePeriod, (b, N) => {
b !== N && (h.value = b);
}), Z(() => e.selectedPeriod, (b) => {
g.value = b;
}), Z(() => e.selectedWeek, (b) => {
w.value = b;
});
const {
equal: D,
inPeriod: P,
isInitializedDate: S,
equalOrEarlier: I,
isPoint: O
} = Oe(), {
getKeyCodeFromEvent: Y
} = Et(), y = (b) => {
const N = !!w.value && b.numberInTheYear === w.value.numberInTheYear;
return {
"f-datepicker-selectWeek": d.value === "week",
"f-datepicker-selectedWeek": d.value === "week" && N
};
};
function B(b) {
return P(b, g.value);
}
function c(b) {
if (!g.value)
return !1;
const N = {
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 && O(N, b);
}
function p(b) {
return !!u.value && D({
year: u.value.year,
month: u.value.month,
day: u.value.day
}, {
year: b.year,
month: b.month,
day: b.day
});
}