@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,647 lines • 305 kB
JavaScript
var No = Object.defineProperty;
var Lo = (t, n, e) => n in t ? No(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
var M = (t, n, e) => Lo(t, typeof n != "symbol" ? n + "" : n, e);
import { ref as y, computed as j, defineComponent as He, watch as ie, onMounted as qe, createVNode as v, mergeProps as Ot, Teleport as Ln, createApp as hn, onUnmounted as Bt, Fragment as dt, nextTick as ut, onBeforeMount as Ro, Transition as Rn, shallowRef as jo, render as sn, h as $o, cloneVNode as Ao, reactive as Ze, createTextVNode as jn, inject as jt, withDirectives as Wo, vShow as qo, onUpdated as _o, onBeforeUnmount as Yo, resolveComponent as zo } from "vue";
import { cloneDeep as $t, isPlainObject as En, isUndefined as Xe, debounce as Uo } from "lodash-es";
import Go from "../button-edit/index.esm.js";
import { useReqAnimationFrame as Xo, getCustomClass as un, withInstall as $n, FormSchemaEntityField$Type as At, FormSchemaEntityFieldTypeName as Pn, FormSchemaEntityFieldType$Type as Qo, useGuid as Jo } from "../common/index.esm.js";
import { useI18n as zt } from "vue-i18n";
import { resolveAppearance as Zo, createPropsResolver as An, getSchemaByTypeForDesigner as Ko } from "../dynamic-resolver/index.esm.js";
import { LocaleService as Ut } from "../locale/index.esm.js";
import "../accordion/index.esm.js";
import "../avatar/index.esm.js";
import "../../designer/button-edit/index.esm.js";
import "../button-group/index.esm.js";
import "../calendar/index.esm.js";
import "../capsule/index.esm.js";
import "../../designer/checkbox/index.esm.js";
import "../../designer/checkbox-group/index.esm.js";
import "../combo-list/index.esm.js";
import "../combo-tree/index.esm.js";
import "../component/index.esm.js";
import "../color-picker/index.esm.js";
import "../content-container/index.esm.js";
import "../date-picker/index.esm.js";
import "../../designer/data-grid/index.esm.js";
import "../dropdown/index.esm.js";
import "../dynamic-form/index.esm.js";
import "../events-editor/index.esm.js";
import "../filter-bar/index.esm.js";
import "../field-selector/index.esm.js";
import "../binding-selector/index.esm.js";
import "../image-cropper/index.esm.js";
import "../../designer/input-group/index.esm.js";
import "../layout/index.esm.js";
import "../list-nav/index.esm.js";
import "../../designer/list-view/index.esm.js";
import "../lookup/index.esm.js";
import "../mapping-editor/index.esm.js";
import "../nav/index.esm.js";
import "../number-range/index.esm.js";
import "../number-spinner/index.esm.js";
import "../order/index.esm.js";
import "../page-header/index.esm.js";
import "../page-footer/index.esm.js";
import "../pagination/index.esm.js";
import "../progress/index.esm.js";
import "../query-solution/index.esm.js";
import "../../designer/radio-group/index.esm.js";
import "../rate/index.esm.js";
import "../response-toolbar/index.esm.js";
import "../response-layout/index.esm.js";
import "../response-layout-editor/index.esm.js";
import "../search-box/index.esm.js";
import "../section/index.esm.js";
import "../smoke-detector/index.esm.js";
import "../splitter/index.esm.js";
import "../step/index.esm.js";
import "../switch/index.esm.js";
import "../tabs/index.esm.js";
import er from "../tags/index.esm.js";
import "../text/index.esm.js";
import "../time-picker/index.esm.js";
import "../transfer/index.esm.js";
import "../tree-view/index.esm.js";
import "../uploader/index.esm.js";
import "../verify-detail/index.esm.js";
import "../video/index.esm.js";
import "../textarea/index.esm.js";
import "../schema-selector/index.esm.js";
import "../../designer/tree-grid/index.esm.js";
import "../event-parameter/index.esm.js";
import "../filter-condition-editor/index.esm.js";
import "../fieldset/index.esm.js";
import "../sort-condition-editor/index.esm.js";
import "../menu-lookup/index.esm.js";
import "../../designer/drawer/index.esm.js";
import "../json-editor/index.esm.js";
import "../property-editor/index.esm.js";
import "../expression-editor/index.esm.js";
import "../code-editor/index.esm.js";
import "../html-template/index.esm.js";
import "../collection-property-editor/index.esm.js";
import "../modal/index.esm.js";
import "../external-container/index.esm.js";
import "../language-textbox/index.esm.js";
import { DgControl as On } from "../designer-canvas/index.esm.js";
import { useResizeObserver as tr } from "@vueuse/core";
import { getHierarchyRow as nr, useIdentify as or, useGroupData as rr, useFilter as ir, useHierarchy as ar, useLoading as sr, useDataView as lr, useSelection as ur, useSelectHierarchyItem as cr, usePagination as dr, useDataViewContainerStyle as fr, useCommandColumn as pr, useSettingColumn as mr, useColumn as hr, useSort as vr, useGroupColumn as gr, useRow as yr, useEdit as br, useVisualDataBound as wr, useVisualDataCell as Cr, useVisualDataRow as xr, useVisualData as Tr, useCellPosition as Mr, useSidebar as Sr, useVirtualScroll as kr, useFitColumn as Er, useFilterHistory as Pr, useColumnFilter as Or, useDragColumn as Br, getColumnHeader as Fr, getSidebar as Ir, getDisableMask as Hr, getHorizontalScrollbar as Dr, getVerticalScrollbar as Vr, getEmpty as Nr, getPagination as Lr, getSummary as Rr } from "../data-view/index.esm.js";
import "../property-panel/index.esm.js";
import "../notify/index.esm.js";
import jr from "../popover/index.esm.js";
function Wn(t, n) {
let e;
function o(u) {
const { properties: d, title: f, ignore: p } = u, h = p && Array.isArray(p), x = Object.keys(d).reduce((E, O) => ((!h || !p.find((P) => P === O)) && (E[O] = d[O].type === "object" && d[O].properties ? o(d[O]) : $t(d[O].default)), E), {});
if (f && (!h || !p.find((E) => E === "id"))) {
const E = f.toLowerCase().replace(/-/g, "_");
x.id = `${E}_${Math.random().toString().slice(2, 6)}`;
}
return x;
}
function r(u) {
const { properties: d, title: f, required: p } = u;
if (p && Array.isArray(p)) {
const h = p.reduce((x, E) => (x[E] = d[E].type === "object" && d[E].properties ? o(d[E]) : $t(d[E].default), x), {});
if (f && p.find((x) => x === "id")) {
const x = f.toLowerCase().replace(/-/g, "_");
h.id = `${x}_${Math.random().toString().slice(2, 6)}`;
}
return h;
}
return {
type: f
};
}
function i(u, d = {}, f) {
const p = t[u];
if (p) {
let h = r(p);
const x = n[u];
return h = x ? x({ getSchemaByType: i }, h, d, f) : h, e != null && e.appendIdentifyForNewControl && e.appendIdentifyForNewControl(h), h;
}
return null;
}
function a(u, d) {
const f = o(d);
return Object.keys(f).reduce((p, h) => (Object.prototype.hasOwnProperty.call(u, h) && (p[h] && En(p[h]) && En(u[h] || !u[h]) ? Object.assign(p[h], u[h] || {}) : p[h] = u[h]), p), f), f;
}
function s(u, d) {
return Object.keys(u).filter((p) => u[p] != null).reduce((p, h) => {
if (d.has(h)) {
const x = d.get(h);
if (typeof x == "string")
p[x] = u[h];
else {
const E = x(h, u[h], u);
Object.assign(p, E);
}
} else
p[h] = u[h];
return p;
}, {});
}
function l(u, d, f = /* @__PURE__ */ new Map()) {
const p = a(u, d);
return s(p, f);
}
function c(u) {
var f;
const d = u.type;
if (d) {
const p = t[d];
if (!p)
return u;
const h = a(u, p), x = ((f = u.editor) == null ? void 0 : f.type) || "";
if (x) {
const E = t[x], O = a(u.editor, E);
h.editor = O;
}
return h;
}
return u;
}
function m(u) {
e = u;
}
return { getSchemaByType: i, resolveSchemaWithDefaultValue: c, resolveSchemaToProps: l, mappingSchemaToProps: s, setDesignerContext: m };
}
const qn = {}, _n = {}, { getSchemaByType: dd, resolveSchemaWithDefaultValue: $r, resolveSchemaToProps: Ar, mappingSchemaToProps: Wr, setDesignerContext: fd } = Wn(qn, _n);
function qr(t = {}) {
function n(c, m, u, d) {
if (typeof u == "number")
return d[c].length === u;
if (typeof u == "object") {
const f = Object.keys(u)[0], p = u[f];
if (f === "not")
return Number(d[c].length) !== Number(p);
if (f === "moreThan")
return Number(d[c].length) >= Number(p);
if (f === "lessThan")
return Number(d[c].length) <= Number(p);
}
return !1;
}
function e(c, m, u, d) {
return d[c] && d[c].propertyValue && String(d[c].propertyValue.value) === String(u);
}
const o = /* @__PURE__ */ new Map([
["length", n],
["getProperty", e]
]);
Object.keys(t).reduce((c, m) => (c.set(m, t[m]), c), o);
function r(c, m) {
const u = c;
return typeof m == "number" ? [{ target: u, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: u, operator: "getProperty", param: c, value: !!m }] : typeof m == "object" ? Object.keys(m).map((d) => {
if (d === "length")
return { target: u, operator: "length", param: null, value: m[d] };
const f = d, p = m[d];
return { target: u, operator: "getProperty", param: f, value: p };
}) : [];
}
function i(c) {
return Object.keys(c).reduce((u, d) => {
const f = r(d, c[d]);
return u.push(...f), u;
}, []);
}
function a(c, m) {
if (o.has(c.operator)) {
const u = o.get(c.operator);
return u && u(c.target, c.param, c.value, m) || !1;
}
return !1;
}
function s(c, m) {
return i(c).reduce((f, p) => f && a(p, m), !0);
}
function l(c, m) {
const u = Object.keys(c), d = u.includes("allOf"), f = u.includes("anyOf"), p = d || f, E = (p ? c[p ? d ? "allOf" : "anyOf" : "allOf"] : [c]).map((P) => s(P, m));
return d ? !E.includes(!1) : E.includes(!0);
}
return { parseValueSchema: l };
}
const _r = {
convertTo: (t, n, e, o) => {
t.appearance || (t.appearance = {}), t.appearance[n] = e;
},
convertFrom: (t, n, e) => t.appearance ? t.appearance[n] : t[n]
}, Yr = {
convertFrom: (t, n, e) => t.buttons && t.buttons.length ? `共 ${t.buttons.length} 项` : "无"
}, zr = {
convertTo: (t, n, e, o) => {
t.editor && (t.editor[n] = e);
},
convertFrom: (t, n, e) => t.editor && Object.prototype.hasOwnProperty.call(t.editor, n) ? t.editor[n] : t[n]
}, q = {
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: "多语输入框" }
}, Ur = {
convertFrom: (t, n, e) => {
var r;
const o = t.editor && t.editor[n] ? t.editor[n] : t[n];
return ((r = q[o]) == null ? void 0 : r.name) || o;
}
}, Gr = {
convertTo: (t, n, e, o) => {
t[n] = t[n];
},
convertFrom: (t, n, e) => t.editor ? e.getRealEditorType(t.editor.type) : ""
}, Xr = {
convertTo: (t, n, e, o) => {
(t.type === "data-grid-column" || t.type === "tree-grid-column") && (t.formatter ? t.formatter[n] = e : t.formatter = {
[n]: e
});
},
convertFrom: (t, n, e) => {
if (t.formatter) {
if (n === "trueText")
return t.formatter.trueText;
if (n === "falseText")
return t.formatter.falseText;
if (n === "prefix")
return t.formatter.prefix;
if (n === "suffix")
return t.formatter.suffix;
if (n === "precision")
return t.formatter.precision;
if (n === "decimal")
return t.formatter.decimal;
if (n === "thousand")
return t.formatter.thousand;
if (n === "tempDateFormat")
return t.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : t.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : t.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : t.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : t.formatter.tempDateFormat || t.formatter.dateFormat || "yyyy-MM-dd";
if (n === "customFormat")
return t.formatter.customFormat;
if (n === "type")
return t.formatter.type || "none";
}
return "none";
}
}, Qr = {
convertTo: (t, n, e, o) => {
t.command ? t.command[n] = e : t.command = {
[n]: e
}, n === "enable" && e && (t.command.commands || (t.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (t, n, e) => t.command && n === "enable" ? t.command.enable : ""
}, Jr = {
convertTo: (t, n, e, o) => {
t.column ? t.column[n] = e : t.column = {
[n]: e
}, n === "fitColumns" && e && (t.column.fitMode || (t.column.fitMode = "average"));
},
convertFrom: (t, n, e) => {
if (t.column) {
if (n === "fitColumns")
return t.column.fitColumns;
if (n === "fitMode")
return t.column.fitMode;
}
return "";
}
}, Zr = {
convertTo: (t, n, e, o) => {
t.summary ? t.summary[n] = e : t.summary = {
[n]: e
}, n === "enable" && e && (t.summary ? t.summary.groupFields || (t.summary.groupFields = []) : t.summary = {
enable: e,
groupFields: []
});
},
convertFrom: (t, n, e) => t.summary && n === "enable" ? t.summary.enable : t.type === "data-grid-column" ? t.enableSummary === void 0 ? !1 : t.enableSummary : ""
}, Kr = {
convertTo: (t, n, e, o) => {
t.group ? t.group[n] = e : t.group = {
[n]: e
}, n === "enable" && e && (t.group ? t.group.groupFields || (t.group.groupFields = []) : t.group = {
enable: e,
groupFields: [],
showSummary: !1
});
},
convertFrom: (t, n, e) => {
if (t.group) {
if (n === "enable")
return t.group.enable;
if (n === "showSummary")
return t.group.showSummary;
}
}
}, ei = {
convertFrom: (t, n) => t.binding ? t.binding.path : "",
convertTo: (t, n, e) => {
if (e && e.length > 0) {
const o = e[0];
t.binding || (t.binding = {}), t.binding.type = "Form", t.binding.path = o.bindingField, t.binding.field = o.id, t.binding.fullPath = o.path, t.path = o.bindingPath;
}
}
}, ti = {
convertTo: (t, n, e, o) => {
t.pagination || (t.pagination = {}), t.pagination[n] = e;
},
convertFrom: (t, n, e) => t.pagination ? t.pagination[n] : t[n]
}, ni = {
convertTo: (t, n, e, o) => {
t.rowNumber || (t.rowNumber = {}), t.rowNumber[n] = e;
},
convertFrom: (t, n, e) => t.rowNumber ? t.rowNumber[n] : t[n]
}, oi = {
convertTo: (t, n, e, o) => {
t.selection || (t.selection = {}), t.selection[n] = e;
},
convertFrom: (t, n, e) => t.selection ? t.selection[n] : t[n]
}, ri = {
convertFrom: (t, n, e) => t[n] && t[n].length ? `共 ${t[n].length} 项` : ""
}, ii = {
convertFrom: (t, n) => t[n] || "",
convertTo: (t, n, e) => {
t[n] = e;
}
}, ai = {
convertTo: (t, n, e, o) => {
t.size || (t.size = {}), t.size[n] = e;
},
convertFrom: (t, n, e) => t.size ? t.size[n] : t[n]
}, si = {
convertFrom: (t, n, e) => {
var o, r;
return (o = t.formatter) != null && o.data && n === "formatterEnumData" && !t.formatterEnumData ? (r = t.formatter) == null ? void 0 : r.data : t.formatterEnumData;
}
}, li = {
convertTo: (t, n, e, o) => {
t.sort || (t.sort = {}), t.sort[n] = e;
},
convertFrom: (t, n, e) => {
var o, r;
if (n === "mode")
return ((o = t.sort) == null ? void 0 : o.mode) || "client";
if (n === "multiSort")
return !!((r = t.sort) != null && r.multiSort);
}
}, ui = {
convertTo: (t, n, e, o) => {
t.filter || (t.filter = {}), t.filter[n] = e;
},
convertFrom: (t, n, e) => {
var o;
if (n === "mode")
return ((o = t.filter) == null ? void 0 : o.mode) || "client";
}
}, ci = {
convertTo: (t, n, e, o) => {
t.rowOption ? t.rowOption[n] = e : t.rowOption = {
[n]: e
};
},
convertFrom: (t, n, e) => {
if (t.rowOption) {
if (n === "customRowStyle")
return t.rowOption.customRowStyle;
if (n === "customCellStyle")
return t.rowOption.customCellStyle;
}
return "";
}
};
function Yn(t, n, e) {
const o = /* @__PURE__ */ new Map([
["/converter/appearance.converter", _r],
["/converter/buttons.converter", Yr],
["/converter/property-editor.converter", zr],
["/converter/items-count.converter", ri],
["/converter/type.converter", Ur],
["/converter/change-editor.converter", Gr],
["/converter/change-formatter.converter", Xr],
["/converter/column-command.converter", Qr],
["/converter/column-option.converter", Jr],
["/converter/summary.converter", Zr],
["/converter/group.converter", Kr],
["/converter/form-group-label.converter", ii],
["/converter/field-selector.converter", ei],
["/converter/pagination.converter", ti],
["/converter/row-number.converter", ni],
["/converter/grid-selection.converter", oi],
["/converter/size.converter", ai],
["/converter/change-formatter-enum.converter", si],
["/converter/grid-sort.converter", li],
["/converter/grid-filter.converter", ui],
["/converter/row-option.converter", ci]
]), r = /* @__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 }]
]), i = qr();
function a(p, h) {
return () => i.parseValueSchema(p, h);
}
function s(p, h, x) {
return p.includes("visible") && h.visible !== void 0 ? typeof h.visible == "boolean" ? () => !!h.visible : h.visible === void 0 ? !0 : a(h.visible, x) : () => !0;
}
function l(p, h, x) {
return p.includes("readonly") && h.readonly !== void 0 ? typeof h.readonly == "boolean" ? () => !!h.readonly : a(h.readonly, x) : () => !1;
}
function c(p, h) {
const x = p.$converter || h;
return typeof x == "string" && x && o.has(x) ? o.get(x) || null : x || null;
}
function m(p, h, x, E, O, P = "", C = "") {
return Object.keys(p).map((b) => {
const B = y(1), F = b, T = p[b], N = Object.keys(T), w = T.title, k = T.type, H = r.get(k) || { type: "input-group", enableClear: !1 }, V = T.editor ? Object.assign({}, H, T.editor) : Object.assign({}, H), A = s(N, T, h), U = l(N, T, h);
V.readonly = V.readonly === void 0 ? U() : V.readonly;
const ee = T.type === "cascade" ? m(T.properties, h, x, E, O, P, C) : [], $ = !0;
let L = c(T, C);
const X = j({
get() {
if (B.value) {
if (["class", "style"].find((de) => de === F) && !L && (L = o.get("/converter/appearance.converter") || null), L && L.convertFrom)
return L.convertFrom(x, b, O, P);
const ue = x[b];
return Object.prototype.hasOwnProperty.call(T, "defaultValue") && (ue === void 0 || typeof ue == "string" && ue === "") ? T.type === "boolean" ? T.defaultValue : T.defaultValue || "" : ue;
}
return null;
},
set(ue) {
B.value += 1, L && L.convertTo ? (L.convertTo(E, b, ue, O, P), L.convertTo(x, b, ue, O, P)) : (E[b] = ue, x[b] = ue);
}
}), { refreshPanelAfterChanged: Y, description: oe, isExpand: we, parentPropertyID: Se } = T, Q = { propertyID: F, propertyName: w, propertyType: k, propertyValue: X, editor: V, visible: A, readonly: U, cascadeConfig: ee, hideCascadeTitle: $, refreshPanelAfterChanged: Y, description: oe, isExpand: we, parentPropertyID: Se };
return h[F] = Q, Q;
});
}
function u(p, h, x = {}) {
const E = {}, O = t[p];
return O && O.categories ? Object.keys(O.categories).map((C) => {
const g = O.categories[C], b = g == null ? void 0 : g.title, B = m(g.properties || {}, E, {}, x, h);
return { categoryId: C, categoryName: b, properties: B };
}) : [];
}
function d(p, h, x, E, O = "") {
const P = h.$ref.schema, C = h.$ref.converter, g = x[P], b = g.type, B = e(g), F = {}, T = t[b];
if (T && T.categories) {
const N = T.categories[p], w = N == null ? void 0 : N.title;
C && Object.keys(N.properties).forEach((V) => {
N.properties[V].$converter = C;
});
const k = (N == null ? void 0 : N.properties) || {}, H = m(k, F, B, g, E, O);
return { categoryId: p, categoryName: w, properties: H };
}
return { categoryId: p, categoryName: "", properties: [] };
}
function f(p, h, x, E, O) {
const P = p.type, C = e(p), g = {};
let b = O || t[P];
if (b && Object.keys(b).length === 0 && x && x.getPropConfig && (b = x.getPropConfig(E)), b && b.categories) {
const B = [];
return Object.keys(b.categories).map((F) => {
const T = b.categories[F];
if (T.$ref) {
B.push(d(F, T, p, h, E));
return;
}
const N = T == null ? void 0 : T.title, w = T == null ? void 0 : T.tabId, k = T == null ? void 0 : T.tabName, H = T == null ? void 0 : T.hide, V = T == null ? void 0 : T.hideTitle, A = m(T.properties || {}, g, C, p, h, E, T.$converter), { setPropertyRelates: U } = T, ee = T == null ? void 0 : T.parentPropertyID;
B.push({ categoryId: F, categoryName: N, tabId: w, tabName: k, hide: H, properties: A, hideTitle: V, setPropertyRelates: U, parentPropertyID: ee });
}), B;
}
return [];
}
return {
getPropertyConfigBySchema: f,
getPropertyConfigByType: u,
propertyConverterMap: o
};
}
const zn = {}, Un = {};
Yn(zn, Un, $r);
const Gn = {}, Xn = {}, { getSchemaByType: pd, resolveSchemaWithDefaultValue: di, resolveSchemaToProps: md, mappingSchemaToProps: hd, setDesignerContext: vd } = Wn(Gn, Xn), Qn = {}, Jn = {};
Yn(Qn, Jn, di);
function Ft(t, n, e = /* @__PURE__ */ new Map(), o = (a, s, l, c) => s, r = {}, i = (a) => a) {
return qn[n.title] = n, _n[n.title] = o, zn[n.title] = r, Un[n.title] = i, Gn[n.title] = n, Xn[n.title] = o, Qn[n.title] = r, Jn[n.title] = i, (a = {}, s = !0) => {
if (!s)
return Wr(a, e);
const l = Ar(a, n, e), c = Object.keys(t).reduce((m, u) => (m[u] = t[u].default, m), {});
return Object.assign(c, l);
};
}
function vn(t, n) {
return { customClass: n.class, customStyle: n.style };
}
const fi = /* @__PURE__ */ new Map([
["appearance", vn]
]), pi = "https://json-schema.org/draft/2020-12/schema", mi = "https://farris-design.gitee.io/time-picker.schema.json", hi = "time-picker", vi = "A Farris Input Component", gi = "object", yi = {
id: {
description: "The unique identifier for a time picker",
type: "string"
},
type: {
description: "The type string of time picker component",
type: "string",
default: "time-picker"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disabled: {
type: "string",
default: !1
},
editable: {
description: "",
type: "boolean",
default: !0
},
placeholder: {
description: "",
type: "string",
default: "请选择时间"
},
readonly: {
description: "",
type: "boolean",
default: !1
},
required: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
},
format: {
description: "",
type: "enum",
default: "HH:mm:ss"
},
showHeader: {
description: "",
type: "boolean",
default: !1
},
use12Hours: {
description: "",
type: "boolean",
default: !1
},
hourStep: {
description: "",
type: "number",
default: 1
},
minuteStep: {
description: "",
type: "number",
default: 1
},
secondStep: {
description: "",
type: "number",
default: 1
},
placement: {
description: "",
type: "string",
default: "auto"
}
}, bi = [
"type"
], wi = [
"id",
"appearance",
"binding",
"visible"
], Ci = {
$schema: pi,
$id: mi,
title: hi,
description: vi,
type: gi,
properties: yi,
required: bi,
ignore: wi
};
function xi(t, n, e) {
return n;
}
const gn = {
/**
* 组件值,这个是与指定的format格式相对应的值
*/
modelValue: { type: String, default: "" },
hourStep: { type: Number, default: 1 },
minuteStep: { type: Number, default: 1 },
secondStep: { type: Number, default: 1 },
popupClassName: { type: String, default: "" },
placeholder: { type: String, default: "请选择时间" },
placement: { type: String, default: "auto" },
/**
* 默认时间控件下拉面板,展开时的值
*/
defaultOpenValue: { type: Date, default: null },
format: { type: String, default: "HH:mm:ss" },
isOpen: { type: Boolean, default: !1 },
showHeader: { type: Boolean, default: !1 },
use12Hours: { type: Boolean, default: !1 },
disabledHours: { type: Function, default: null },
disabledMinutes: { type: Function, default: null },
disabledSeconds: { type: Function, default: null },
/**
* 是否隐藏禁用的元素
*/
hideDisabledElements: { type: Boolean, default: !1 },
disabled: { type: Boolean, default: !1 },
readonly: { type: Boolean, default: !1 },
editable: { type: Boolean, default: !0 }
}, Zn = Ft(gn, Ci, fi, xi), Ti = {
modelValue: {
type: String,
default: ""
},
hourStep: {
type: Number,
default: 1
},
minuteStep: {
type: Number,
default: 1
},
secondStep: {
type: Number,
default: 1
},
defaultOpenValue: {
type: Date,
default: null
},
disabledHours: {
type: Function,
default: null
},
disabledMinutes: {
type: Function,
default: null
},
disabledSeconds: {
type: Function,
default: null
},
format: {
type: String,
default: "HH:mm:ss"
},
isOpen: {
type: Boolean,
default: !1
},
use12Hours: {
type: Boolean,
default: !1
},
showHeader: {
type: Boolean,
default: !1
},
hideDisabledElements: {
type: Boolean,
default: !1
},
inDatePicker: {
type: Boolean,
default: !1
},
headerLabels: {
type: Object,
default: null
}
};
function ge(t) {
const n = Object.prototype.toString.call(t);
return t instanceof Date || typeof t == "object" && n === "[object Date]" ? new t.constructor(+t) : typeof t == "number" || n === "[object Number]" || typeof t == "string" || n === "[object String]" ? new Date(t) : /* @__PURE__ */ new Date(NaN);
}
function fe(t, n) {
return t instanceof Date ? new t.constructor(n) : new Date(n);
}
function Kn(t, n) {
const e = ge(t);
return isNaN(n) ? fe(t, NaN) : (n && e.setDate(e.getDate() + n), e);
}
const eo = 6048e5, Mi = 864e5, Si = 6e4, ki = 36e5, Ei = 1e3;
let Pi = {};
function bt() {
return Pi;
}
function Ke(t, n) {
var s, l, c, m;
const e = bt(), o = (n == null ? void 0 : n.weekStartsOn) ?? ((l = (s = n == null ? void 0 : n.locale) == null ? void 0 : s.options) == null ? void 0 : l.weekStartsOn) ?? e.weekStartsOn ?? ((m = (c = e.locale) == null ? void 0 : c.options) == null ? void 0 : m.weekStartsOn) ?? 0, r = ge(t), i = r.getDay(), a = (i < o ? 7 : 0) + i - o;
return r.setDate(r.getDate() - a), r.setHours(0, 0, 0, 0), r;
}
function yt(t) {
return Ke(t, { weekStartsOn: 1 });
}
function to(t) {
const n = ge(t), e = n.getFullYear(), o = fe(t, 0);
o.setFullYear(e + 1, 0, 4), o.setHours(0, 0, 0, 0);
const r = yt(o), i = fe(t, 0);
i.setFullYear(e, 0, 4), i.setHours(0, 0, 0, 0);
const a = yt(i);
return n.getTime() >= r.getTime() ? e + 1 : n.getTime() >= a.getTime() ? e : e - 1;
}
function Bn(t) {
const n = ge(t);
return n.setHours(0, 0, 0, 0), n;
}
function Wt(t) {
const n = ge(t), e = new Date(
Date.UTC(
n.getFullYear(),
n.getMonth(),
n.getDate(),
n.getHours(),
n.getMinutes(),
n.getSeconds(),
n.getMilliseconds()
)
);
return e.setUTCFullYear(n.getFullYear()), +t - +e;
}
function Oi(t, n) {
const e = Bn(t), o = Bn(n), r = +e - Wt(e), i = +o - Wt(o);
return Math.round((r - i) / Mi);
}
function Bi(t) {
const n = to(t), e = fe(t, 0);
return e.setFullYear(n, 0, 4), e.setHours(0, 0, 0, 0), yt(e);
}
function Fi(t) {
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
}
function no(t) {
if (!Fi(t) && typeof t != "number")
return !1;
const n = ge(t);
return !isNaN(Number(n));
}
function Ii(t) {
const n = ge(t), e = fe(t, 0);
return e.setFullYear(n.getFullYear(), 0, 1), e.setHours(0, 0, 0, 0), e;
}
const Hi = {
lessThanXSeconds: {
one: "less than a second",
other: "less than {{count}} seconds"
},
xSeconds: {
one: "1 second",
other: "{{count}} seconds"
},
halfAMinute: "half a minute",
lessThanXMinutes: {
one: "less than a minute",
other: "less than {{count}} minutes"
},
xMinutes: {
one: "1 minute",
other: "{{count}} minutes"
},
aboutXHours: {
one: "about 1 hour",
other: "about {{count}} hours"
},
xHours: {
one: "1 hour",
other: "{{count}} hours"
},
xDays: {
one: "1 day",
other: "{{count}} days"
},
aboutXWeeks: {
one: "about 1 week",
other: "about {{count}} weeks"
},
xWeeks: {
one: "1 week",
other: "{{count}} weeks"
},
aboutXMonths: {
one: "about 1 month",
other: "about {{count}} months"
},
xMonths: {
one: "1 month",
other: "{{count}} months"
},
aboutXYears: {
one: "about 1 year",
other: "about {{count}} years"
},
xYears: {
one: "1 year",
other: "{{count}} years"
},
overXYears: {
one: "over 1 year",
other: "over {{count}} years"
},
almostXYears: {
one: "almost 1 year",
other: "almost {{count}} years"
}
}, Di = (t, n, e) => {
let o;
const r = Hi[t];
return typeof r == "string" ? o = r : n === 1 ? o = r.one : o = r.other.replace("{{count}}", n.toString()), e != null && e.addSuffix ? e.comparison && e.comparison > 0 ? "in " + o : o + " ago" : o;
};
function ln(t) {
return (n = {}) => {
const e = n.width ? String(n.width) : t.defaultWidth;
return t.formats[e] || t.formats[t.defaultWidth];
};
}
const Vi = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy"
}, Ni = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
}, Li = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
}, Ri = {
date: ln({
formats: Vi,
defaultWidth: "full"
}),
time: ln({
formats: Ni,
defaultWidth: "full"
}),
dateTime: ln({
formats: Li,
defaultWidth: "full"
})
}, ji = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
}, $i = (t, n, e, o) => ji[t];
function Et(t) {
return (n, e) => {
const o = e != null && e.context ? String(e.context) : "standalone";
let r;
if (o === "formatting" && t.formattingValues) {
const a = t.defaultFormattingWidth || t.defaultWidth, s = e != null && e.width ? String(e.width) : a;
r = t.formattingValues[s] || t.formattingValues[a];
} else {
const a = t.defaultWidth, s = e != null && e.width ? String(e.width) : t.defaultWidth;
r = t.values[s] || t.values[a];
}
const i = t.argumentCallback ? t.argumentCallback(n) : n;
return r[i];
};
}
const Ai = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
}, Wi = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
}, qi = {
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
abbreviated: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
wide: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
]
}, _i = {
narrow: ["S", "M", "T", "W", "T", "F", "S"],
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
wide: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
}, Yi = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}
}, zi = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
}
}, Ui = (t, n) => {
const e = Number(t), o = e % 100;
if (o > 20 || o < 10)
switch (o % 10) {
case 1:
return e + "st";
case 2:
return e + "nd";
case 3:
return e + "rd";
}
return e + "th";
}, Gi = {
ordinalNumber: Ui,
era: Et({
values: Ai,
defaultWidth: "wide"
}),
quarter: Et({
values: Wi,
defaultWidth: "wide",
argumentCallback: (t) => t - 1
}),
month: Et({
values: qi,
defaultWidth: "wide"
}),
day: Et({
values: _i,
defaultWidth: "wide"
}),
dayPeriod: Et({
values: Yi,
defaultWidth: "wide",
formattingValues: zi,
defaultFormattingWidth: "wide"
})
};
function Pt(t) {
return (n, e = {}) => {
const o = e.width, r = o && t.matchPatterns[o] || t.matchPatterns[t.defaultMatchWidth], i = n.match(r);
if (!i)
return null;
const a = i[0], s = o && t.parsePatterns[o] || t.parsePatterns[t.defaultParseWidth], l = Array.isArray(s) ? Qi(s, (u) => u.test(a)) : (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
Xi(s, (u) => u.test(a))
);
let c;
c = t.valueCallback ? t.valueCallback(l) : l, c = e.valueCallback ? (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
e.valueCallback(c)
) : c;
const m = n.slice(a.length);
return { value: c, rest: m };
};
}
function Xi(t, n) {
for (const e in t)
if (Object.prototype.hasOwnProperty.call(t, e) && n(t[e]))
return e;
}
function Qi(t, n) {
for (let e = 0; e < t.length; e++)
if (n(t[e]))
return e;
}
function Ji(t) {
return (n, e = {}) => {
const o = n.match(t.matchPattern);
if (!o) return null;
const r = o[0], i = n.match(t.parsePattern);
if (!i) return null;
let a = t.valueCallback ? t.valueCallback(i[0]) : i[0];
a = e.valueCallback ? e.valueCallback(a) : a;
const s = n.slice(r.length);
return { value: a, rest: s };
};
}
const Zi = /^(\d+)(th|st|nd|rd)?/i, Ki = /\d+/i, ea = {
narrow: /^(b|a)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(before christ|before common era|anno domini|common era)/i
}, ta = {
any: [/^b/i, /^(a|c)/i]
}, na = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
}, oa = {
any: [/1/i, /2/i, /3/i, /4/i]
}, ra = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
}, ia = {
narrow: [
/^j/i,
/^f/i,
/^m/i,
/^a/i,
/^m/i,
/^j/i,
/^j/i,
/^a/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i
],
any: [
/^ja/i,
/^f/i,
/^mar/i,
/^ap/i,
/^may/i,
/^jun/i,
/^jul/i,
/^au/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i
]
}, aa = {
narrow: /^[smtwf]/i,
short: /^(su|mo|tu|we|th|fr|sa)/i,
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
}, sa = {
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
}, la = {
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
}, ua = {
any: {
am: /^a/i,
pm: /^p/i,
midnight: /^mi/i,
noon: /^no/i,
morning: /morning/i,
afternoon: /afternoon/i,
evening: /evening/i,
night: /night/i
}
}, ca = {
ordinalNumber: Ji({
matchPattern: Zi,
parsePattern: Ki,
valueCallback: (t) => parseInt(t, 10)
}),
era: Pt({
matchPatterns: ea,
defaultMatchWidth: "wide",
parsePatterns: ta,
defaultParseWidth: "any"
}),
quarter: Pt({
matchPatterns: na,
defaultMatchWidth: "wide",
parsePatterns: oa,
defaultParseWidth: "any",
valueCallback: (t) => t + 1
}),
month: Pt({
matchPatterns: ra,
defaultMatchWidth: "wide",
parsePatterns: ia,
defaultParseWidth: "any"
}),
day: Pt({
matchPatterns: aa,
defaultMatchWidth: "wide",
parsePatterns: sa,
defaultParseWidth: "any"
}),
dayPeriod: Pt({
matchPatterns: la,
defaultMatchWidth: "any",
parsePatterns: ua,
defaultParseWidth: "any"
})
}, oo = {
code: "en-US",
formatDistance: Di,
formatLong: Ri,
formatRelative: $i,
localize: Gi,
match: ca,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
function da(t) {
const n = ge(t);
return Oi(n, Ii(n)) + 1;
}
function ro(t) {
const n = ge(t), e = +yt(n) - +Bi(n);
return Math.round(e / eo) + 1;
}
function yn(t, n) {
var m, u, d, f;
const e = ge(t), o = e.getFullYear(), r = bt(), i = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((u = (m = n == null ? void 0 : n.locale) == null ? void 0 : m.options) == null ? void 0 : u.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((f = (d = r.locale) == null ? void 0 : d.options) == null ? void 0 : f.firstWeekContainsDate) ?? 1, a = fe(t, 0);
a.setFullYear(o + 1, 0, i), a.setHours(0, 0, 0, 0);
const s = Ke(a, n), l = fe(t, 0);
l.setFullYear(o, 0, i), l.setHours(0, 0, 0, 0);
const c = Ke(l, n);
return e.getTime() >= s.getTime() ? o + 1 : e.getTime() >= c.getTime() ? o : o - 1;
}
function fa(t, n) {
var s, l, c, m;
const e = bt(), o = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((l = (s = n == null ? void 0 : n.locale) == null ? void 0 : s.options) == null ? void 0 : l.firstWeekContainsDate) ?? e.firstWeekContainsDate ?? ((m = (c = e.locale) == null ? void 0 : c.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, r = yn(t, n), i = fe(t, 0);
return i.setFullYear(r, 0, o), i.setHours(0, 0, 0, 0), Ke(i, n);
}
function io(t, n) {
const e = ge(t), o = +Ke(e, n) - +fa(e, n);
return Math.round(o / eo) + 1;
}
function ae(t, n) {
const e = t < 0 ? "-" : "", o = Math.abs(t).toString().padStart(n, "0");
return e + o;
}
const Qe = {
// Year
y(t, n) {
const e = t.getFullYear(), o = e > 0 ? e : 1 - e;
return ae(n === "yy" ? o % 100 : o, n.length);
},
// Month
M(t, n) {
const e = t.getMonth();
return n === "M" ? String(e + 1) : ae(e + 1, 2);
},
// Day of the month
d(t, n) {
return ae(t.getDate(), n.length);
},
// AM or PM
a(t, n) {
const e = t.getHours() / 12 >= 1 ? "pm" : "am";
switch (n) {
case "a":
case "aa":
return e.toUpperCase();
case "aaa":
return e;
case "aaaaa":
return e[0];
case "aaaa":
default:
return e === "am" ? "a.m." : "p.m.";
}
},
// Hour [1-12]
h(t, n) {
return ae(t.getHours() % 12 || 12, n.length);
},
// Hour [0-23]
H(t, n) {
return ae(t.getHours(), n.length);
},
// Minute
m(t, n) {
return ae(t.getMinutes(), n.length);
},
// Second
s(t, n) {
return ae(t.getSeconds(), n.length);
},
// Fraction of second
S(t, n) {
const e = n.length, o = t.getMilliseconds(), r = Math.trunc(
o * Math.pow(10, e - 3)
);
return ae(r, n.length);
}
}, mt = {
am: "am",
pm: "pm",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}, Fn = {
// Era
G: function(t, n, e) {
const o = t.getFullYear() > 0 ? 1 : 0;
switch (n) {
case "G":
case "GG":
case "GGG":
return e.era(o, { width: "abbreviated" });
case "GGGGG":
return e.era(o, { width: "narrow" });
case "GGGG":
default:
return e.era(o, { width: "wide" });
}
},
// Year
y: function(t, n, e) {
if (n === "yo") {
const o = t.getFullYear(), r = o > 0 ? o : 1 - o;
return e.ordinalNumber(r, { unit: "year" });
}
return Qe.y(t, n);
},
// Local week-numbering year
Y: function(t, n, e, o) {
const r = yn(t, o), i = r > 0 ? r : 1 - r;
if (n === "YY") {
const a = i % 100;
return ae(a, 2);
}
return n === "Yo" ? e.ordinalNumber(i, { unit: "year" }) : ae(i, n.length);
},
// ISO week-numbering year
R: function(t, n) {
const e = to(t);
return ae(e, n.length);
},
// Extended year. This is a single number designating the year of this calendar system.
// The main difference between `y` and `u` localizers are B.C. years:
// | Year | `y` | `u` |
// |------|-----|-----|
// | AC 1 | 1 | 1 |
// | BC 1 | 1 | 0 |
// | BC 2 | 2 | -1 |
// Also `yy` always returns the last two digits of a year,
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
u: function(t, n) {
const e = t.getFullYear();
return ae(e, n.length);
},
// Quarter
Q: function(t, n, e) {
const o = Math.ceil((t.getMonth() + 1) / 3);
switch (n) {
case "Q":
return String(o);
case "QQ":
return ae(o, 2);
case "Qo":
return e.ordinalNumber(o, { unit: "quarter" });
case "QQQ":
return e.quarter(o, {
width: "abbreviated",
context: "formatting"
});
case "QQQQQ":
return e.quarter(o, {
width: "narrow",
context: "formatting"
});
case "QQQQ":
default:
return e.quarter(o, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone quarter
q: function(t, n, e) {
const o = Math.ceil((t.getMonth() + 1) / 3);
switch (n) {
case "q":
return String(o);
case "qq":
return ae(o, 2);
case "qo":
return e.ordinalNumber(o, { unit: "quarter" });
case "qqq":
return e.quarter(o, {
width: "abbreviated",
context: "standalone"
});
case "qqqqq":
return e.quarter(o, {
width: "narrow",
context: "standalone"
});
case "qqqq":
default:
return e.quarter(o, {
width: "wide",
context: "standalone"
});
}
},
// Month
M: function(t, n, e) {
const o = t.getMonth();
switch (n) {
case "M":
case "MM":
return Qe.M(t, n);
case "Mo":
return e.ordinalNumber(o + 1, { unit: "month" });
case "MMM":
return e.month(o, {
width: "abbreviated",
context: "formatting"
});
case "MMMMM":
return e.month(o, {
width: "narrow",
context: "formatting"
});
case "MMMM":
default:
return e.month(o, { width: "wide", context: "formatting" });
}
},
// Stand-alone month
L: function(t, n, e) {
const o = t.getMonth();
switch (n) {
case "L":
return String(o + 1);
case "LL":
return ae(o + 1, 2);
case "Lo":
return e.ordinalNumber(o + 1, { unit: "month" });
case "LLL":
return e.month(o, {
width: "abbreviated",
context: "standalone"
});
case "LLLLL":
return e.month(o, {
width: "narrow",
context: "standalone"
});
case "LLLL":
default:
return e.month(o, { width: "wide", context: "standalone" });
}
},
// Local week of year
w: function(t, n, e, o) {
const r = io(t, o);
return n === "wo" ? e.ordinalNumber(r, { unit: "week" }) : ae(r, n.length);
},
// ISO week of year
I: function(t, n, e) {
const o = ro(t);
return n === "Io" ? e.ordinalNumber(o, { unit: "week" }) : ae(o, n.length);
},
// Day of the month
d: function(t, n, e) {
return n === "do" ? e.ordinalNumber(t.getDate(), { unit: "date" }) : Qe.d(t, n);
},
// Day of year
D: function(t, n, e) {
const o = da(t);
return n === "Do" ? e.ordinalNumber(o, { unit: "dayOfYear" }) : ae(o, n.length);
},
// Day of week
E: function(t, n, e) {
const o = t.getDay();
switch (n) {
case "E":
case "EE":
case "EEE":
return e.day(o, {
width: "abbreviated",
context: "formatting"
});
case "EEEEE":
return e.day(o, {
width: "narrow",
context: "formatting"
});
case "EEEEEE":
return e.day(o, {
width: "short",
context: "formatting"
});
case "EEEE":
default:
return e.day(o, {
width: "wide",
context: "formatting"
});
}
},
// Local day of week
e: function(t, n, e, o) {
const r = t.getDay(), i = (r - o.weekStartsOn + 8) % 7 || 7;
switch (n) {
case "e":
return String(i);
case "ee":
return ae(i, 2);
case "eo":
return e.ordinalNumber(i, { unit: "day" });
case "eee":
return e.day(r, {
width: "abbreviated",
context: "formatting"
});
case "eeeee":
return e.day(r, {
width: "narrow",
context: "formatting"
});
case "eeeeee":
return e.day(r, {
width: "short",
context: "formatting"
});
case "eeee":
default:
return e.day(r, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone local day of week
c: function(t, n, e, o) {
const r = t.getDay(), i = (r - o.weekStartsOn + 8) % 7