UNPKG

@layui/layui-vue

Version:

a component library for Vue 3 base on layui-vue

20 lines (19 loc) 2.04 kB
import { defineComponent as f, computed as c, provide as y, openBlock as P, createBlock as x, mergeProps as l, unref as a, withCtx as n, createVNode as B, renderSlot as C, normalizeProps as k, guardReactiveProps as g } from "vue"; /* empty css */ import t from "dayjs"; import z from "dayjs/plugin/customParseFormat.js"; import _ from "dayjs/plugin/isSameOrBefore.js"; import S from "dayjs/plugin/isSameOrAfter.js"; import b from "dayjs/plugin/objectSupport.js"; import { DATE_PICKER_CONTEXT as h } from "./interface.js"; import { useProps as v } from "./hook/useProps.js"; import { useDatePicker as D } from "./hook/useDatePicker.js"; import T from "./component/common/InputBlock.js"; 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: {} }, setup(m) { t.extend(z), t.extend(_), t.extend(S), t.extend(b); const e = m, { size: p } = v(e), { RenderComponent: s, renderComponentProps: o, datePickerContext: d } = D(e), i = c(() => e.inputFormat ?? o.value.inputFormat); return y(h, d), (r, E) => (P(), x(T, l({ ...e, ...r.$attrs }, { format: i.value, size: a(p) }), { default: n(({ onPick: u }) => [B(a(s), l(a(o), { onPick: u }), { footer: n(() => [C(r.$slots, "footer", k(g({ props: e })))]), _: 2 }, 1040, ["onPick"])]), _: 3 }, 16, ["format", "size"])); } }); export { L as default };