UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,521 lines 51.6 kB
import { ref as O, computed as V, defineComponent as L, watch as G, createVNode as y, onMounted as ee, inject as ke } from "vue"; import { cloneDeep as oe, isPlainObject as ae } from "lodash-es"; import { getSchemaByTypeForDesigner as Me } from "../dynamic-resolver/index.esm.js"; function ie(e, t) { let n; function p(d) { const { properties: h, title: l, ignore: i } = d, o = i && Array.isArray(i), u = Object.keys(h).reduce((s, r) => ((!o || !i.find((c) => c === r)) && (s[r] = h[r].type === "object" && h[r].properties ? p(h[r]) : oe(h[r].default)), s), {}); if (l && (!o || !i.find((s) => s === "id"))) { const s = l.toLowerCase().replace(/-/g, "_"); u.id = `${s}_${Math.random().toString().slice(2, 6)}`; } return u; } function k(d) { const { properties: h, title: l, required: i } = d; if (i && Array.isArray(i)) { const o = i.reduce((u, s) => (u[s] = h[s].type === "object" && h[s].properties ? p(h[s]) : oe(h[s].default), u), {}); if (l && i.find((u) => u === "id")) { const u = l.toLowerCase().replace(/-/g, "_"); o.id = `${u}_${Math.random().toString().slice(2, 6)}`; } return o; } return { type: l }; } function g(d, h = {}, l) { const i = e[d]; if (i) { let o = k(i); const u = t[d]; return o = u ? u({ getSchemaByType: g }, o, h, l) : o, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(o), o; } return null; } function f(d, h) { const l = p(h); return Object.keys(l).reduce((i, o) => (Object.prototype.hasOwnProperty.call(d, o) && (i[o] && ae(i[o]) && ae(d[o] || !d[o]) ? Object.assign(i[o], d[o] || {}) : i[o] = d[o]), i), l), l; } function v(d, h) { return Object.keys(d).filter((i) => d[i] != null).reduce((i, o) => { if (h.has(o)) { const u = h.get(o); if (typeof u == "string") i[u] = d[o]; else { const s = u(o, d[o], d); Object.assign(i, s); } } else i[o] = d[o]; return i; }, {}); } function P(d, h, l = /* @__PURE__ */ new Map()) { const i = f(d, h); return v(i, l); } function a(d) { var l; const h = d.type; if (h) { const i = e[h]; if (!i) return d; const o = f(d, i), u = ((l = d.editor) == null ? void 0 : l.type) || ""; if (u) { const s = e[u], r = f(d.editor, s); o.editor = r; } return o; } return d; } function b(d) { n = d; } return { getSchemaByType: g, resolveSchemaWithDefaultValue: a, resolveSchemaToProps: P, mappingSchemaToProps: v, setDesignerContext: b }; } const se = {}, ce = {}, { getSchemaByType: St, resolveSchemaWithDefaultValue: Se, resolveSchemaToProps: Pe, mappingSchemaToProps: Fe, setDesignerContext: Pt } = ie(se, ce); function Oe(e = {}) { function t(a, b, d, h) { if (typeof d == "number") return h[a].length === d; if (typeof d == "object") { const l = Object.keys(d)[0], i = d[l]; if (l === "not") return Number(h[a].length) !== Number(i); if (l === "moreThan") return Number(h[a].length) >= Number(i); if (l === "lessThan") return Number(h[a].length) <= Number(i); } return !1; } function n(a, b, d, h) { return h[a] && h[a].propertyValue && String(h[a].propertyValue.value) === String(d); } const p = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((a, b) => (a.set(b, e[b]), a), p); function k(a, b) { const d = a; return typeof b == "number" ? [{ target: d, operator: "length", param: null, value: Number(b) }] : typeof b == "boolean" ? [{ target: d, operator: "getProperty", param: a, value: !!b }] : typeof b == "object" ? Object.keys(b).map((h) => { if (h === "length") return { target: d, operator: "length", param: null, value: b[h] }; const l = h, i = b[h]; return { target: d, operator: "getProperty", param: l, value: i }; }) : []; } function g(a) { return Object.keys(a).reduce((d, h) => { const l = k(h, a[h]); return d.push(...l), d; }, []); } function f(a, b) { if (p.has(a.operator)) { const d = p.get(a.operator); return d && d(a.target, a.param, a.value, b) || !1; } return !1; } function v(a, b) { return g(a).reduce((l, i) => l && f(i, b), !0); } function P(a, b) { const d = Object.keys(a), h = d.includes("allOf"), l = d.includes("anyOf"), i = h || l, s = (i ? a[i ? h ? "allOf" : "anyOf" : "allOf"] : [a]).map((c) => v(c, b)); return h ? !s.includes(!1) : s.includes(!0); } return { parseValueSchema: P }; } const Ce = { convertTo: (e, t, n, p) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, Ne = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, je = { convertTo: (e, t, n, p) => { e.editor && (e.editor[t] = n); }, convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t] }, le = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", name: "容器" }, "input-group": { type: "input-group", name: "文本" }, textarea: { type: "textarea", name: "多行文本" }, lookup: { type: "lookup", name: "帮助" }, "number-spinner": { type: "number-spinner", name: "数值" }, "date-picker": { type: "date-picker", name: "日期" }, switch: { type: "switch", name: "开关" }, "radio-group": { type: "radio-group", name: "单选组" }, "check-box": { type: "check-box", name: "复选框" }, "check-group": { type: "check-group", name: "复选框组" }, "combo-list": { type: "combo-list", name: "下拉列表" }, "response-form": { type: "response-form", name: "卡片面板" }, "response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" }, "response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" }, "tree-grid": { type: "tree-grid", name: "树表格" }, "tree-grid-column": { type: "tree-grid-column", name: "树表格列" }, "data-grid": { type: "data-grid", name: "表格" }, "data-grid-column": { type: "data-grid-column", name: "表格列" }, module: { type: "Module", name: "模块" }, component: { type: "component", name: "组件" }, tabs: { type: "tabs", name: "标签页" }, "tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" }, "tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" }, "html-template": { type: "html-template", name: "模板容器" }, "time-picker": { type: "time-picker", name: "时间选择" }, section: { type: "section", name: "分组面板" }, "section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" }, "section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" }, splitter: { type: "splitter", name: "分栏面板" }, "splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" }, "component-ref": { type: "component-ref", name: "组件引用节点" }, uploader: { type: "uploader", name: "附件上传" }, "page-header": { type: "page-header", name: "页头" }, "page-footer": { type: "page-footer", name: "页脚" }, "tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" }, "external-container": { type: "external-container", name: "外部容器", icon: "content-container" }, "list-nav": { type: "list-nav", name: "列表导航" }, "list-view": { type: "list-view", name: "列表" }, "filter-bar": { type: "filter-bar", name: "筛选条" }, "language-textbox": { type: "language-textbox", name: "多语输入框" } }, Ee = { convertFrom: (e, t, n) => { var k; const p = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((k = le[p]) == null ? void 0 : k.name) || p; } }, We = { convertTo: (e, t, n, p) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, Ve = { convertTo: (e, t, n, p) => { (e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = { [t]: n }); }, convertFrom: (e, t, n) => { if (e.formatter) { if (t === "trueText") return e.formatter.trueText; if (t === "falseText") return e.formatter.falseText; if (t === "prefix") return e.formatter.prefix; if (t === "suffix") return e.formatter.suffix; if (t === "precision") return e.formatter.precision; if (t === "decimal") return e.formatter.decimal; if (t === "thousand") return e.formatter.thousand; if (t === "tempDateFormat") return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd"; if (t === "customFormat") return e.formatter.customFormat; if (t === "type") return e.formatter.type || "none"; } return "none"; } }, $e = { convertTo: (e, t, n, p) => { e.command ? e.command[t] = n : e.command = { [t]: n }, t === "enable" && n && (e.command.commands || (e.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ])); }, convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : "" }, Be = { convertTo: (e, t, n, p) => { e.column ? e.column[t] = n : e.column = { [t]: n }, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average")); }, convertFrom: (e, t, n) => { if (e.column) { if (t === "fitColumns") return e.column.fitColumns; if (t === "fitMode") return e.column.fitMode; } return ""; } }, Ae = { convertTo: (e, t, n, p) => { e.summary ? e.summary[t] = n : e.summary = { [t]: n }, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = { enable: n, groupFields: [] }); }, convertFrom: (e, t, n) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : "" }, Re = { convertTo: (e, t, n, p) => { e.group ? e.group[t] = n : e.group = { [t]: n }, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = { enable: n, groupFields: [], showSummary: !1 }); }, convertFrom: (e, t, n) => { if (e.group) { if (t === "enable") return e.group.enable; if (t === "showSummary") return e.group.showSummary; } } }, He = { convertFrom: (e, t) => e.binding ? e.binding.path : "", convertTo: (e, t, n) => { if (n && n.length > 0) { const p = n[0]; e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = p.bindingField, e.binding.field = p.id, e.binding.fullPath = p.path, e.path = p.bindingPath; } } }, qe = { convertTo: (e, t, n, p) => { e.pagination || (e.pagination = {}), e.pagination[t] = n; }, convertFrom: (e, t, n) => e.pagination ? e.pagination[t] : e[t] }, xe = { convertTo: (e, t, n, p) => { e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = n; }, convertFrom: (e, t, n) => e.rowNumber ? e.rowNumber[t] : e[t] }, Ge = { convertTo: (e, t, n, p) => { e.selection || (e.selection = {}), e.selection[t] = n; }, convertFrom: (e, t, n) => e.selection ? e.selection[t] : e[t] }, ze = { convertFrom: (e, t, n) => e[t] && e[t].length ? `共 ${e[t].length} 项` : "" }, _e = { convertFrom: (e, t) => e[t] || "", convertTo: (e, t, n) => { e[t] = n; } }, Le = { convertTo: (e, t, n, p) => { e.size || (e.size = {}), e.size[t] = n; }, convertFrom: (e, t, n) => e.size ? e.size[t] : e[t] }, Ye = { convertFrom: (e, t, n) => { var p, k; return (p = e.formatter) != null && p.data && t === "formatterEnumData" && !e.formatterEnumData ? (k = e.formatter) == null ? void 0 : k.data : e.formatterEnumData; } }, Ue = { convertTo: (e, t, n, p) => { e.sort || (e.sort = {}), e.sort[t] = n; }, convertFrom: (e, t, n) => { var p, k; if (t === "mode") return ((p = e.sort) == null ? void 0 : p.mode) || "client"; if (t === "multiSort") return !!((k = e.sort) != null && k.multiSort); } }, Je = { convertTo: (e, t, n, p) => { e.filter || (e.filter = {}), e.filter[t] = n; }, convertFrom: (e, t, n) => { var p; if (t === "mode") return ((p = e.filter) == null ? void 0 : p.mode) || "client"; } }, Qe = { convertTo: (e, t, n, p) => { e.rowOption ? e.rowOption[t] = n : e.rowOption = { [t]: n }; }, convertFrom: (e, t, n) => { if (e.rowOption) { if (t === "customRowStyle") return e.rowOption.customRowStyle; if (t === "customCellStyle") return e.rowOption.customCellStyle; } return ""; } }; function ue(e, t, n) { const p = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", Ce], ["/converter/buttons.converter", Ne], ["/converter/property-editor.converter", je], ["/converter/items-count.converter", ze], ["/converter/type.converter", Ee], ["/converter/change-editor.converter", We], ["/converter/change-formatter.converter", Ve], ["/converter/column-command.converter", $e], ["/converter/column-option.converter", Be], ["/converter/summary.converter", Ae], ["/converter/group.converter", Re], ["/converter/form-group-label.converter", _e], ["/converter/field-selector.converter", He], ["/converter/pagination.converter", qe], ["/converter/row-number.converter", xe], ["/converter/grid-selection.converter", Ge], ["/converter/size.converter", Le], ["/converter/change-formatter-enum.converter", Ye], ["/converter/grid-sort.converter", Ue], ["/converter/grid-filter.converter", Je], ["/converter/row-option.converter", Qe] ]), k = /* @__PURE__ */ new Map([ ["string", { type: "input-group", enableClear: !1 }], ["boolean", { type: "combo-list", textField: "name", valueField: "value", idField: "value", enableClear: !1, editable: !1, data: [ { value: !0, name: "是" }, { value: !1, name: "否" } ] }], ["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }], ["array", { type: "button-edit" }], ["number", { type: "number-spinner", placeholder: "" }], ["events-editor", { type: "events-editor", hide: !0 }] ]), g = Oe(); function f(i, o) { return () => g.parseValueSchema(i, o); } function v(i, o, u) { return i.includes("visible") && o.visible !== void 0 ? typeof o.visible == "boolean" ? () => !!o.visible : o.visible === void 0 ? !0 : f(o.visible, u) : () => !0; } function P(i, o, u) { return i.includes("readonly") && o.readonly !== void 0 ? typeof o.readonly == "boolean" ? () => !!o.readonly : f(o.readonly, u) : () => !1; } function a(i, o) { const u = i.$converter || o; return typeof u == "string" && u && p.has(u) ? p.get(u) || null : u || null; } function b(i, o, u, s, r, c = "", w = "") { return Object.keys(i).map((M) => { const C = O(1), j = M, T = i[M], W = Object.keys(T), $ = T.title, m = T.type, N = k.get(m) || { type: "input-group", enableClear: !1 }, F = T.editor ? Object.assign({}, N, T.editor) : Object.assign({}, N), E = v(W, T, o), S = P(W, T, o); F.readonly = F.readonly === void 0 ? S() : F.readonly; const A = T.type === "cascade" ? b(T.properties, o, u, s, r, c, w) : [], R = !0; let B = a(T, w); const H = V({ get() { if (C.value) { if (["class", "style"].find((Te) => Te === j) && !B && (B = p.get("/converter/appearance.converter") || null), B && B.convertFrom) return B.convertFrom(u, M, r, c); const q = u[M]; return Object.prototype.hasOwnProperty.call(T, "defaultValue") && (q === void 0 || typeof q == "string" && q === "") ? T.type === "boolean" ? T.defaultValue : T.defaultValue || "" : q; } return null; }, set(q) { C.value += 1, B && B.convertTo ? (B.convertTo(s, M, q, r, c), B.convertTo(u, M, q, r, c)) : (s[M] = q, u[M] = q); } }), { refreshPanelAfterChanged: z, description: we, isExpand: be, parentPropertyID: De } = T, re = { propertyID: j, propertyName: $, propertyType: m, propertyValue: H, editor: F, visible: E, readonly: S, cascadeConfig: A, hideCascadeTitle: R, refreshPanelAfterChanged: z, description: we, isExpand: be, parentPropertyID: De }; return o[j] = re, re; }); } function d(i, o, u = {}) { const s = {}, r = e[i]; return r && r.categories ? Object.keys(r.categories).map((w) => { const D = r.categories[w], M = D == null ? void 0 : D.title, C = b(D.properties || {}, s, {}, u, o); return { categoryId: w, categoryName: M, properties: C }; }) : []; } function h(i, o, u, s, r = "") { const c = o.$ref.schema, w = o.$ref.converter, D = u[c], M = D.type, C = n(D), j = {}, T = e[M]; if (T && T.categories) { const W = T.categories[i], $ = W == null ? void 0 : W.title; w && Object.keys(W.properties).forEach((F) => { W.properties[F].$converter = w; }); const m = (W == null ? void 0 : W.properties) || {}, N = b(m, j, C, D, s, r); return { categoryId: i, categoryName: $, properties: N }; } return { categoryId: i, categoryName: "", properties: [] }; } function l(i, o, u, s, r) { const c = i.type, w = n(i), D = {}; let M = r || e[c]; if (M && Object.keys(M).length === 0 && u && u.getPropConfig && (M = u.getPropConfig(s)), M && M.categories) { const C = []; return Object.keys(M.categories).map((j) => { const T = M.categories[j]; if (T.$ref) { C.push(h(j, T, i, o, s)); return; } const W = T == null ? void 0 : T.title, $ = T == null ? void 0 : T.tabId, m = T == null ? void 0 : T.tabName, N = T == null ? void 0 : T.hide, F = T == null ? void 0 : T.hideTitle, E = b(T.properties || {}, D, w, i, o, s, T.$converter), { setPropertyRelates: S } = T, A = T == null ? void 0 : T.parentPropertyID; C.push({ categoryId: j, categoryName: W, tabId: $, tabName: m, hide: N, properties: E, hideTitle: F, setPropertyRelates: S, parentPropertyID: A }); }), C; } return []; } return { getPropertyConfigBySchema: l, getPropertyConfigByType: d, propertyConverterMap: p }; } const de = {}, fe = {}; ue(de, fe, Se); const ve = {}, ye = {}, { getSchemaByType: Ft, resolveSchemaWithDefaultValue: Xe, resolveSchemaToProps: Ot, mappingSchemaToProps: Ct, setDesignerContext: Nt } = ie(ve, ye), me = {}, pe = {}; ue(me, pe, Xe); function Ze(e, t, n = /* @__PURE__ */ new Map(), p = (f, v, P, a) => v, k = {}, g = (f) => f) { return se[t.title] = t, ce[t.title] = p, de[t.title] = k, fe[t.title] = g, ve[t.title] = t, ye[t.title] = p, me[t.title] = k, pe[t.title] = g, (f = {}, v = !0) => { if (!v) return Fe(f, n); const P = Pe(f, t, n), a = Object.keys(e).reduce((b, d) => (b[d] = e[d].default, b), {}); return Object.assign(a, P); }; } function Ie(e, t) { return { customClass: t.class, customStyle: t.style }; } const Ke = /* @__PURE__ */ new Map([ ["appearance", Ie] ]); function et(e, t, n) { return t; } const tt = "https://json-schema.org/draft/2020-12/schema", nt = "https://farris-design.gitee.io/calendar.schema.json", rt = "calendar", ot = "A Farris Input Component", at = "object", it = { id: { description: "The unique identifier for calendar", type: "string" }, type: { description: "The type string of calendar", type: "string", default: "calendar" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} } }, st = [ "id", "type" ], ct = { $schema: tt, $id: nt, title: rt, description: ot, type: at, properties: it, required: st }, lt = "calendar", ut = "A Farris Component", dt = "object", ft = { basic: { description: "Basic Infomation", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "waiting for modification", enum: [] } } } } }, vt = { title: lt, description: ut, type: dt, categories: ft }, te = { events: { Type: Array, default: [] }, firstDayOfTheWeek: { type: String, default: "Sun." } }, he = Ze(te, ct, Ke, et, vt), Y = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var x = /* @__PURE__ */ ((e) => (e[e.previous = 1] = "previous", e[e.current = 2] = "current", e[e.next = 3] = "next", e))(x || {}); function K() { function e() { return { year: 0, month: 0, day: 0 }; } function t(a) { return new Date( a.year || 0, a.month ? a.month - 1 : 0, a.day || 0, a.hour ? a.hour : 0, a.minute ? a.minute : 0, a.second ? a.second : 0, 0 ); } function n(a) { const b = /* @__PURE__ */ new Date(); return a.year || (a.year = b.getFullYear()), a.month || (a.month = b.getMonth() + 1), a.day || (a.day = 1), new Date( a.year, a.month - 1, a.day, a.hour ? a.hour : 0, a.minute ? a.minute : 0, a.second ? a.second : 0, 0 ); } function p(a) { return new Date( a.year || 1, (a.month || 1) - 1, a.day, a.hour ? a.hour : 0, a.minute ? a.minute : 0, a.second ? a.second : 0, 0 ).getDay(); } function k(a) { return Y.indexOf(a); } function g(a) { return t(a).getTime(); } function f(a) { return Math.round(g(a) / 1e3); } function v(a, b, d) { const h = g(b), l = g(d), i = g(a); return l - i > i - h ? b : d; } function P() { const a = /* @__PURE__ */ new Date(); return { year: a.getFullYear(), month: a.getMonth() + 1, day: a.getDate(), hour: a.getHours(), minute: a.getMinutes(), second: a.getSeconds() }; } return { emptyDate: e, getDate: t, getDate2: n, getDayNumber: p, getEpocTime: f, getNearDate: v, getWeekdayIndex: k, getTimeInMilliseconds: g, getToday: P }; } function yt() { function e(g, f) { return new Date(f, g, 0).getDate(); } function t(g, f, v) { return new Date(g, f - 1, v, 0, 0, 0, 0); } function n(g, f) { const v = t(f, g, 1); return v.setMonth(v.getMonth() - 1), e(v.getMonth() + 1, v.getFullYear()); } function p(g, f) { const v = { year: g === 12 ? f + 1 : f }, P = g === 12 ? 1 : g + 1; return v.month = P, v; } function k(g, f) { const v = { year: g === 1 ? f - 1 : f }, P = g === 1 ? 12 : g - 1; return v.month = P, v; } return { daysInMonth: e, daysInPreMonth: n, getNextMonth: p, getPreviousMonth: k }; } function ge() { const { getToday: e, getDayNumber: t } = K(), { daysInMonth: n, daysInPreMonth: p, getNextMonth: k, getPreviousMonth: g } = yt(); function f(o) { const u = Y.indexOf(o); return u > 0 ? 7 - u : 0; } function v(o) { const { day: u, month: s, year: r } = o; if (u === void 0 || s === void 0 || r === void 0) throw new Error("invalided date."); const c = u === 1, w = c ? p(s, r) : u - 1, D = c ? s - 1 : s, M = D < 1, C = M ? 12 : D; return { year: M ? r - 1 : r, month: C, day: w }; } function P(o) { const { day: u, month: s, year: r } = o; if (u === void 0 || s === void 0 || r === void 0) throw new Error("invalided date."); const c = n(s, r), w = u === c, D = w ? 1 : u + 1, M = w ? s + 1 : s, C = M > 12, j = C ? 1 : M; return { year: C ? r + 1 : r, month: j, day: D }; } function a(o) { const u = g(o.month || 1, o.year || 1), s = n(u.month || 1, u.year || 1); return { day: (o.day || 1) <= s ? o.day : s, month: u.month, year: u.year }; } function b(o) { const u = k(o.month || 1, o.year || 1), s = n(u.month || 1, u.year || 1); return { day: (o.day || 1) <= s ? o.day : s, month: u.month, year: u.year }; } function d(o) { const s = (o.day || 1) - 7, r = s < 1, c = r ? n(o.month || 1, o.year || 1) + s : s, w = r ? g(o.month || 1, o.year || 1) : o; return { day: c, month: w.month, year: w.year }; } function h(o) { const s = (o.day || 1) + 7, r = n(o.month || 1, o.year || 1), c = s > r, w = c ? s - r : s, D = c ? k(o.month || 1, o.year || 1) : o; return { day: w, month: D.month, year: D.year }; } function l(o, u, s, r) { const c = { day: o, month: u, year: s }, D = f(r) === 0 ? 1 : 0, M = t(c) + D, C = e(); let j = v(c); const T = []; for (let F = M - 1; F >= 1; F--) { const E = j.month !== c.month ? x.previous : x.current, S = j.month === u && j.day === C.day && j.month === C.month && j.year === C.year; T.push({ date: j, monthTag: E, isCurrent: S }), F > 1 && (j = v(j)); } let W = P(c); const $ = []; for (let F = M + 1; F <= 7; F++) { const E = j.month !== c.month ? x.next : x.current, S = W.day === C.day && W.month === C.month && W.year === C.year; $.push({ date: W, monthTag: E, isCurrent: S }), F < 7 && (W = P(W)); } const m = o === C.day && u === C.month && s === C.year; return { days: [...T.reverse(), { date: c, monthTag: x.current, isCurrent: m }, ...$], weekNumber: 0, year: s }; } function i(o, u, s) { const r = [], c = n(o, u); for (let w = 1; w <= c; w += 7) { const D = l(w, o, u, s); r.push(D); } return r; } return { getMonthlyCalendar: i, getWeeklyCalendar: l, getPreviousDay: v, getNextDay: P, getDayInPreviousWeek: d, getDayInNextWeek: h, getDayInPreviousMonth: a, getDayInNextMonth: b }; } function U() { const { getTimeInMilliseconds: e } = K(); 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 p(l) { return l && l.year !== 0; } function k(l, i) { return e(l) < e(i); } function g(l, i) { return e(l) <= e(i); } function f(l, i) { return e(l) === e(i); } function v(l, i) { const o = e(i); return e(l.from) === o || e(l.to) === o; } function P(l, i) { return !i || !t(i.to) || !t(i.from) ? !1 : g(i.from, l) && g(l, i.to); } function a(l, i) { return t(i) && e(l) >= e(i); } function b(l, i) { return t(i) && e(l) <= e(i); } function d(l, i) { return e({ year: l.year, month: l.month, day: l.day }) === e({ year: i.year, month: i.month, day: i.day }); } function h(l, i) { return e({ hour: l.hour, minute: l.minute, second: l.second }) === e({ hour: i.hour, minute: i.minute, second: i.second }); } return { isDateEarlier: k, equal: f, inPeriod: P, isPoint: v, equalOrEarlier: g, isInitializedDate: t, isInitializedMonth: n, isInitializedYear: p, isMonthDisabledByDisableSince: a, isMonthDisabledByDisableUntil: b, sameTime: h, sameDay: d }; } const ne = { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec" }, mt = { activeView: { Type: Number, default: 3 }, title: { Type: String, default: "" }, dailyViewTitle: { Type: String, default: "Day" }, weeklyViewTitle: { Type: String, default: "Week" }, monthlyViewTitle: { Type: String, default: "Month" } }, Q = /* @__PURE__ */ L({ name: "FCalendarHeader", props: mt, emits: ["ViewChange", "Previous", "Next", "ResetToToday"], setup(e, t) { const n = O(e.title), p = O(e.dailyViewTitle), k = O(e.weeklyViewTitle), g = O(e.monthlyViewTitle), f = 2, v = 62, P = O(e.activeView), a = O("Today"); G(() => e.title, () => { n.value = e.title; }); const b = V(() => ({ top: `${f}px`, left: `${P.value * (f + 1) + (P.value - 1) * (v + 1)}px` })), d = V(() => P.value === 1 ? p.value : P.value === 2 ? k.value : g.value); function h() { P.value = 1, t.emit("ViewChange", 1); } function l() { P.value = 2, t.emit("ViewChange", 2); } function i() { P.value = 3, t.emit("ViewChange", 3); } function o() { t.emit("Previous", P.value); } function u() { t.emit("Next", P.value); } function s() { t.emit("ResetToToday"); } return () => y("div", { class: "f-calendar-header" }, [y("div", { class: "f-calendar-title" }, [n.value]), y("div", { class: "f-calendar-navigator" }, [y("div", { class: "f-calendar-navigator-today btn btn-default", onClick: () => s() }, [a.value]), y("div", { class: "f-calendar-navigator-button-group" }, [y("div", { class: "f-calendar-navigator-previous btn btn-default", onClick: () => o() }, [y("i", { class: "f-icon f-icon-arrow-chevron-left" }, null)]), y("div", { class: "f-calendar-navigator-next btn btn-default", onClick: () => u() }, [y("i", { class: "f-icon f-icon-arrow-chevron-right" }, null)])])]), y("div", { class: "f-calendar-view-switch" }, [y("div", { class: "f-calendar-view-switch-panel" }, [y("span", { class: "f-calendar-view-switch-daily", onClick: (r) => h() }, [p.value]), y("span", { class: "f-calendar-view-switch-weekly", onClick: (r) => l() }, [k.value]), y("span", { class: "f-calendar-view-switch-monthly", onClick: (r) => i() }, [g.value])]), y("div", { class: "f-calendar-view-switch-active-view", style: b.value }, [d.value])])]); } }), pt = { dates: { Type: Array, default: [] }, daysInWeek: { Type: Array, default: Y }, enableKeyboadNavigate: { Type: Boolean, default: !0 }, enableMarkCurrent: { Type: Boolean, default: !0 }, events: { Type: Array, default: [] }, activeDay: { Type: Object, default: null } }; var J = /* @__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))(J || {}); 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 }; } const X = /* @__PURE__ */ L({ name: "FCalendarMonthView", props: pt, emits: ["click", "keyDown"], setup(e, t) { const n = O(e.daysInWeek), p = O(e.enableKeyboadNavigate), k = O(e.enableMarkCurrent), g = O(e.activeDay), f = O(e.events), { equal: v, sameDay: P } = U(), { getKeyCodeFromEvent: a } = ht(); function b(s, r) { return s.forEach((c) => { c.days.forEach((w) => { const D = r.filter((M) => P(M.starts, w.date)); D && D.length && (w.events = [...D]); }); }), s; } const d = O(b(e.dates, f.value)); G(() => e.dates, () => { d.value = b(e.dates, f.value); }), G(() => e.activeDay, () => { g.value = e.activeDay; }), G(() => e.events, () => { f.value = e.events; }); function h(s) { return !!g.value && v({ year: g.value.year, month: g.value.month, day: g.value.day }, s); } const l = (s, r, c) => { const D = { "f-datepicker-no-currmonth": s.monthTag === x.previous || s.monthTag === x.next }, M = `d_${r}_${c}`; return D[M] = !0, D; }, i = (s) => { const r = s.monthTag === x.current && h(s.date), c = s.isCurrent && k.value; return { "f-calendar-month-view-date": !0, "f-calendar-month-view-selected": r, "f-calendar-month-view-current": c }; }; function o(s, r) { s.stopPropagation(), t.emit("click", r.date); } function u(s, r) { const c = a(s); c !== J.tab && (s.preventDefault(), c === J.enter || c === J.space ? o(s, r) : p.value && t.emit("keyDown", r.date)); } return () => y("div", { class: "f-calendar-month-view" }, [y("table", { class: "f-datepicker-table", cellpadding: "0" }, [y("thead", null, [y("tr", null, [n.value && n.value.map((s) => y("th", { scope: "col", style: "padding: 4px 4px 8px" }, [s]))])]), y("tbody", null, [d.value && d.value.map((s, r) => y("tr", null, [s.days && s.days.map((c, w) => y("td", { id: `d_${r}_${w}`, tabindex: "0", class: l(c, r, w), onClick: (D) => o(D, c), onKeydown: (D) => u(D, c) }, [y("div", { class: "f-calendar-month-view-title" }, [y("div", { class: i(c) }, [c.date.day]), y("div", { class: "f-calendar-month-view-date-month" }, [c.date.day === 1 ? ne[c.date.month || 1] : ""])]), c.events && c.events.length && c.events.map((D) => y("div", { class: "f-calendar-month-view-event-item" }, [D.title]))]))]))])])]); } }), gt = { daysInWeek: { Type: Array, default: Y }, enableMarkCurrent: { Type: Boolean, default: !0 }, events: { Type: Array, default: [] }, week: { Type: Object, default: { days: [], weekNumber: 0, year: 0 } } }, Z = /* @__PURE__ */ L({ name: "FCalendarWeekView", props: gt, emits: [], setup(e) { const t = O(), n = O(), p = O(e.daysInWeek), k = O(e.week), g = O(e.enableMarkCurrent), f = O(e.events), v = O([]), { equal: P } = U(); function a(r) { return k.value.days.map((w) => { const D = { year: w.date.year, month: w.date.month, day: w.date.day, hour: r.hour, minute: r.minute, second: r.second }, M = f.value.filter((C) => P(C.starts, D)); return { day: D, events: M }; }); } function b() { const r = []; for (let c = 0; c < 24; c++) { const w = { hour: c, minute: 0, second: 0 }, D = { hour: c, minute: 30, second: 0 }, M = a(w), C = a(D); r.push({ time: w, events: M, title: c > 0 ? `${c}:00` : "", part: "upper" }), r.push({ time: D, events: C, title: `${c}:30`, part: "lower" }); } v.value = r; } b(), G(() => e.week, () => { k.value = e.week, b(); }), G(() => e.events, () => { f.value = e.events, b(); }); const d = (r) => ({ "f-calendar-week-view-date": !0, "f-calendar-week-view-current": r.isCurrent && g.value }); function h() { return y("div", { class: "f-calendar-week-view-header" }, [y("div", { class: "f-calendar-week-view-header-corner" }, null), y("div", { class: "f-calendar-week-view-header-primary" }, [y("div", { class: "f-calendar-week-view-header-columns" }, [p.value.map((r, c) => y("div", { class: "f-calendar-week-view-header-cell" }, [y("div", { class: d(k.value.days[c]) }, [k.value.days[c].date.day]), y("span", null, [r])]))])])]); } function l() { return y("div", { class: "f-calendar-week-view-content-side" }, [y("div", { class: "f-calendar-side" }, [v.value.map((r) => y("div", { class: "f-calendar-side-row" }, [y("div", { class: "f-calendar-side-row-number" }, [r.part === "upper" ? r.title : ""])]))])]); } function i(r) { return { "f-calendar-week-view-item": !0, "f-calendar-week-view-item-upper": r.part === "upper", "f-calendar-week-view-item-lower": r.part === "lower" }; } function o(r) { const j = (r.starts.hour || 0) + (r.starts.minute || 0) / 60; return { height: `${44 * ((r.ends.hour || 0) + (r.ends.minute || 0) / 60 - j) - 2 - 2 - 1 - 1}px` }; } function u() { return v.value.map((r) => y("div", { class: i(r) }, [r.events.map((c) => y("div", { class: "f-calendar-week-view-item-cell" }, [c.events.length > 0 && c.events.map((w) => y("div", { class: "f-calendar-event", style: o(w) }, [w.title]))]))])); } function s() { return y("div", { ref: n, class: "f-calendar-content-primary" }, [y("div", { class: "f-calendar-content-data" }, [u()])]); } return ee(() => { t.value && t.value.scrollTo(0, 250); }), () => y("div", { class: "f-calendar-week-view" }, [h(), y("div", { class: "f-calendar-week-view-content", ref: t }, [l(), s()])]); } }), wt = { day: { Type: Object, default: {} }, dayInWeek: { Type: String, default: "" }, enableMarkCurrent: { Type: Boolean, default: !0 }, events: { Type: Array, default: [] } }, I = /* @__PURE__ */ L({ name: "FCalendarDayView", props: wt, emits: [], setup(e) { const t = O(), n = O(), p = O(e.dayInWeek), k = O(e.day), g = O(e.enableMarkCurrent), f = O(e.events), v = O([]), { equal: P } = U(); function a(r) { const c = { year: k.value.date.year, month: k.value.date.month, day: k.value.date.day, hour: r.hour, minute: r.minute, second: r.second }, w = f.value.filter((D) => P(D.starts, c)); return [{ day: c, events: w }]; } function b() { const r = []; for (let c = 0; c < 24; c++) { const w = { hour: c, minute: 0, second: 0 }, D = { hour: c, minute: 30, second: 0 }, M = a(w), C = a(D); r.push({ time: w, events: M, title: c > 0 ? `${c}:00` : "", part: "upper" }), r.push({ time: D, events: C, title: `${c}:30`, part: "lower" }); } v.value = r; } b(), G(() => e.day, () => { k.value = e.day, b(); }), G(() => e.events, () => { f.value = e.events, b(); }); const d = (r) => ({ "f-calendar-day-view-date": !0, "f-calendar-day-view-current": r.isCurrent && g.value }); function h() { return y("div", { class: "f-calendar-day-view-header" }, [y("div", { class: "f-calendar-day-view-header-corner" }, null), y("div", { class: "f-calendar-day-view-header-primary" }, [y("div", { class: "f-calendar-day-view-header-columns" }, [y("div", { class: "f-calendar-day-view-header-cell" }, [y("div", { class: d(k.value) }, [k.value.date.day]), y("span", null, [p.value])])])])]); } function l() { return y("div", { class: "f-calendar-day-view-content-side" }, [y("div", { class: "f-calendar-side" }, [v.value.map((r) => y("div", { class: "f-calendar-side-row" }, [y("div", { class: "f-calendar-side-row-number" }, [r.part === "upper" ? r.title : ""])]))])]); } function i(r) { return { "f-calendar-day-view-item": !0, "f-calendar-day-view-item-upper": r.part === "upper", "f-calendar-day-view-item-lower": r.part === "lower" }; } function o(r) { const j = (r.starts.hour || 0) + (r.starts.minute || 0) / 60; return { height: `${44 * ((r.ends.hour || 0) + (r.ends.minute || 0) / 60 - j) - 2 - 2 - 1 - 1}px` }; } function u() { return v.value.map((r) => y("div", { class: i(r) }, [r.events.map((c) => y("div", { class: "f-calendar-day-view-item-cell" }, [c.events.length > 0 && c.events.map((w) => y("div", { class: "f-calendar-event", style: o(w) }, [w.title]))]))])); } function s() { return y("div", { ref: n, class: "f-calendar-content-primary" }, [y("div", { class: "f-calendar-content-data" }, [u()])]); } return ee(() => { t.value && t.value.scrollTo(0, 250); }), () => y("div", { class: "f-calendar-day-view" }, [h(), y("div", { class: "f-calendar-day-view-content", ref: t }, [l(), s()])]); } }), _ = /* @__PURE__ */ L({ name: "FCalendar", props: te, emits: [], setup(e) { const { sameDay: t } = U(), { getToday: n } = K(), p = O(e.firstDayOfTheWeek), k = O(e.events), g = n(), f = O({ year: g.year || 1, month: g.month || 1, day: g.day || 1 }), v = O(3), { getMonthlyCalendar: P, getWeeklyCalendar: a, getPreviousDay: b, getNextDay: d, getDayInPreviousWeek: h, getDayInNextWeek: l, getDayInPreviousMonth: i, getDayInNextMonth: o } = ge(), u = V(() => `${ne[f.value.month || 1]} ${f.value.year}`), s = V(() => P(f.value.month || 1, f.value.year || 1, p.value)), r = V(() => a(f.value.day || 1, f.value.month || 1, f.value.year || 1, p.value)), c = V(() => r.value.days.find((m) => t(m.date, f.value)) || r.value.days[1]), w = V(() => { const m = r.value.days.findIndex((F) => t(F.date, f.value)), N = m > -1 ? m : 1; return Y[N]; }), D = V(() => v.value === 3), M = V(() => v.value === 2), C = V(() => v.value === 1); function j(m) { v.value = m; } function T(m) { m === 1 && (f.value = b(f.value)), m === 2 && (f.value = h(f.value)), m === 3 && (f.value = i(f.value)); } function W(m) { m === 1 && (f.value = d(f.value)), m === 2 && (f.value = l(f.value)), m === 3 && (f.value = o(f.value)); } function $() { f.value = { year: g.year || 1, month: g.month || 1, day: g.day || 1 }; } return () => y("div", { class: "f-calendar" }, [y(Q, { activeView: v.value, title: u.value, onViewChange: (m) => j(m), onPrevious: (m) => T(m), onNext: (m) => W(m), onResetToToday: () => $() }, null), y("div", null, [C.value && y(I, { day: c.value, dayInWeek: w.value, events: k.value }, null), M.value && y(Z, { week: r.value, events: k.value }, null), D.value && y(X, { activeDay: f.value, dates: s.value, events: k.value }, null)])]); } }); function bt(e, t, n) { var $; const p = "", k = "", g = O(); let f; function v() { return (t == null ? void 0 : t.schema.componentType) !== "frame"; } function P() { return !1; } function a() { return (t == null ? void 0 : t.schema.componentType) !== "frame"; } function b() { return (t == null ? void 0 : t.schema.componentType) === "frame"; } function d(m) { if (!m || !m.value) return null; if (m.value.schema && m.value.schema.type === "component") return m.value; const N = O(m == null ? void 0 : m.value.parent), F = d(N); return F || null; } function h(m = t) { var S; const { componentInstance: N, designerItemElementRef: F } = m; if (!N || !N.value) return null; const { getCustomButtons: E } = N.value; return N.value.canMove || E && ((S = E()) != null && S.length) ? F : h(m.parent); } function l(m) { return !!n; } function i() { return (t == null ? void 0 : t.schema.label) || (t == null ? void 0 : t.schema.title) || (t == null ? void 0 : t.schema.name); } function o() { } function u(m, N) { var F; !m || !N || (F = t == null ? void 0 : t.setupContext) == null || F.emit("dragEnd"); } function s(m, N) { const { componentType: F } = m; let E = Me(F, m, N); const S = F.toLowerCase().replace(/-/g, "_"); return E && !E.id && E.type === F && (E.id = `${S}_${Math.random().toString().slice(2, 6)}`), E; } function r(m) { } function c(...m) { } function w(m) { if (!m) return; const N = t == null ? void 0 : t.schema, { formSchemaUtils: F } = m; if (N && F.getExpressions().length) { const E = F.getExpressions().findIndex((S) => S.target === N.id); E > -1 && F.getExpressions().splice(E, 1); } } function D(m) { if (!m || !(t != null && t.schema)) return; const N = t.schema, { formSchemaUtils: F } = m; F.removeCommunicationInComponent(N); } function M(m) { w(m), D(m), t != null && t.schema.contents && t.schema.contents.map((N) => { let F = N.id; N.type === "component-ref" && (F = N.component); const E = e.value.querySelectorAll(`#${F}-design-item`); E != null && E.length && Array.from(E).map((S) => { var A; (A = S == null ? void 0 : S.componentInstance) != null && A.value.onRemoveComponent && S.componentInstance.value.onRemoveComponent(m); }); }); } function C() { } function j(m) { var F, E; if (!((F = t == null ? void 0 : t.schema) != null && F.id)) return; !f && m && (f = m.formSchemaUtils); let N = ""; { const { text: S, title: A, label: R, mainTitle: B, name: H, type: z } = t.schema; N = S || A || R || B || H || ((E = le[z]) == null ? void 0 : E.name); } N && f.getControlBasicInfoMap().set(t.schema.id, { componentTitle: N, parentPathName: N }); } function T(m) { var S; const { changeObject: N } = m, { propertyID: F, propertyValue: E } = N; if (["text", "title", "label", "name", "mainTitle"].includes((S = m == null ? void 0 : m.changeObject) == null ? void 0 : S.propertyID) && F && E && (j(), f)) { const A = f.getControlBasicInfoMap(), R = A.keys().toArray().filter((B) => { var H, z; return ((H = A.get(B)) == null ? void 0 : H.reliedComponentId) === ((z = t == null ? void 0 : t.schema) == null ? void 0 : z.id); }); R != null && R.length && R.forEach((B) => { const H = A.get(B).parentPathName.split(" > "); H[0] = E, A.get(B).parentPathName = H.join(" > "); }); } } function W(m) { T(m); } return g.value = { canMove: v(), canSelectParent: P(), canDelete: a(), canNested: !b(), contents: t == null ? void 0 : t.schema.contents, elementRef: e, parent: ($ = t == null ? void 0 : t.parent) == null ? void 0 : $.componentInstance, schema: t == null ? void 0 : t.schema, styles: p, designerClass: k, canAccepts: l, getBelongedComponentInstance: d, getDraggableDesignItemElement: h, getDraggingDisplayText: i, getPropConfig: c, getDragScopeElement: o, onAcceptMovedChildElement: u, onChildElementMovedOut: r, addNewChildComponentSchema: s, triggerBelongedComponentToMoveWhenMoved: O(!1), triggerBelongedComponentToDeleteWhenDeleted: O(!1), onRemoveComponent: M, getCustomButtons: C, onPropertyChanged: W, setComponentBasicInfoMap: j, updateContextSchema: t == null ? void 0 : t.updateContextSchema }, g; } const Dt = /* @__PURE__ */ L({ name: "FCalendarDesign", props: te, emits: [], setup(e, t) { const { sameDay: n } = U(), { getToday: p } = K(), k = O(e.firstDayOfTheWeek), g = O(e.events), f = p(), v = O({ year: f.year || 1, month: f.month || 1, day: f.day || 1 }), P = O(3), a = O(), b = ke("design-item-context"), d = bt(a, b); ee(() => { a.value.componentInstance = d; }), t.expose(d.value); const { getMonthlyCalendar: h, getWeeklyCalendar: l, getPreviousDay: i, getNextDay: o, getDayInPreviousWeek: u, getDayInNextWeek: s, getDayInPreviousMonth: r, getDayInNextMonth: c } = ge(), w = V(() => `${ne[v.value.month || 1]} ${v.value.year}`), D = V(() => h(v.value.month || 1, v.value.year || 1, k.value)), M = V(() => l(v.value.day || 1, v.value.month || 1, v.value.year || 1, k.value)), C = V(() => M.value.days.find((S) => n(S.date, v.value)) || M.value.days[1]), j = V(() => { const S = M.value.days.findIndex((R) => n(R.date, v.value)), A = S > -1 ? S : 1; return Y[A]; }), T = V(() => P.value === 3), W = V(() => P.value === 2), $ = V(() => P.value === 1); function m(S) { P.value = S; } function N(S) { S === 1 && (v.value = i(v.value)), S === 2 && (v.value = u(v.value)), S === 3 && (v.value = r(v.value)); } function F(S) { S === 1 && (v.value = o(v.value)), S === 2 && (v.value = s(v.value)), S === 3 && (v.value = c(v.value)); } function E() { v.value = { year: f.year || 1, m