@layui/layui-vue
Version:
a component library for Vue 3 base on layui-vue
21 lines (20 loc) • 2.1 kB
JavaScript
import { defineComponent as f, computed as c, provide as y, openBlock as P, createBlock as x, mergeProps as l, unref as o, withCtx as n, createVNode as B, renderSlot as C, normalizeProps as k, guardReactiveProps as g } from "vue";
import t from "dayjs";
import z from "dayjs/plugin/customParseFormat.js";
import _ from "dayjs/plugin/isSameOrAfter.js";
import S from "dayjs/plugin/isSameOrBefore.js";
import b from "dayjs/plugin/objectSupport.js";
import h from "./component/common/InputBlock.js";
import { useDatePicker as v } from "./hook/useDatePicker.js";
import { useProps as D } from "./hook/useProps.js";
import { DATE_PICKER_CONTEXT as T } from "./interface.js";
/* empty css */
const L = f({ name: "LayDatePicker", __name: "index", props: { name: {}, modelValue: { default: null }, type: { default: "date" }, disabled: { type: Boolean, default: !1 }, readonly: { type: Boolean, default: !1 }, placeholder: {}, allowClear: { type: Boolean, default: !1 }, simple: { type: Boolean, default: !1 }, max: {}, min: {}, range: { type: Boolean, default: !1 }, rangeSeparator: { default: "至" }, size: { default: "md" }, prefixIcon: { default: "layui-icon-date" }, suffixIcon: { default: "" }, timestamp: { type: Boolean, default: !1 }, format: {}, inputFormat: {}, defaultValue: { default: null }, defaultTime: { default: null }, contentStyle: { type: [Boolean, null, String, Object, Array] }, contentClass: {}, disabledDate: {}, yearPage: { default: 15 }, shortcuts: {}, static: { type: Boolean, default: !1 }, teleportProps: {} }, setup(p) {
const e = p;
t.extend(z), t.extend(S), t.extend(_), t.extend(b);
const { size: s } = D(e), { RenderComponent: d, renderComponentProps: a, datePickerContext: m } = v(e), i = c(() => e.inputFormat ?? a.value.inputFormat);
return y(T, m), (r, E) => (P(), x(h, l({ ...e, ...r.$attrs }, { format: i.value, size: o(s) }), { default: n(({ onPick: u }) => [B(o(d), l(o(a), { onPick: u }), { footer: n(() => [C(r.$slots, "footer", k(g({ props: e })))]), _: 2 }, 1040, ["onPick"])]), _: 3 }, 16, ["format", "size"]));
} });
export {
L as default
};