dk-plus
Version:
211 lines (210 loc) • 9.03 kB
JavaScript
import v from "./index2.js";
import { resolveComponent as f, openBlock as l, createElementBlock as a, normalizeClass as p, normalizeStyle as u, createElementVNode as k, createBlock as i, createVNode as b, toDisplayString as y, Transition as V, withCtx as P, Teleport as A, withDirectives as m, withModifiers as s, Fragment as w, renderList as h, createCommentVNode as n, vShow as g } from "vue";
import B from "../../_virtual/index.js";
const D = {
key: 1,
class: "dk-date-picker_range"
}, R = { class: "dk-date-picker_range-separator" }, F = {
key: 0,
class: "dk-date-picker_shortcuts"
}, S = ["disabled", "onClick"], z = {
key: 3,
class: "dk-date-picker_footer"
}, U = ["disabled"], $ = ["disabled"], W = {
key: 0,
class: "dk-date-picker_shortcuts"
}, E = ["disabled", "onClick"], T = {
key: 3,
class: "dk-date-picker_footer"
}, I = ["disabled"], O = ["disabled"];
function K(e, d, M, N, L, j) {
const t = f("dk-input"), r = f("dk-date-picker-panel");
return l(), a("div", {
ref: "rootRef",
class: p(["dk-date-picker", { "is-disabled": e.disabled }]),
style: u(e.rootStyle),
onKeydown: d[16] || (d[16] = (...o) => e.onKeydown && e.onKeydown(...o))
}, [
k("div", {
ref: "triggerRef",
class: "dk-date-picker_trigger",
onClick: d[3] || (d[3] = (...o) => e.openDropdown && e.openDropdown(...o))
}, [
e.isRange ? (l(), a("div", D, [
b(t, {
id: Array.isArray(e.id) && e.id[0] || "",
modelValue: e.startText,
"onUpdate:modelValue": d[1] || (d[1] = (o) => e.startText = o),
disabled: e.disabled,
readonly: e.readonly || !e.editable,
clearable: !1,
placeholder: e.startPlaceholder,
width: "auto",
size: e.size,
name: Array.isArray(e.name) && e.name[0] || "",
"prefix-icon": e.resolvedPrefixIcon,
onFocus: e.onFocus,
onBlur: e.onBlur
}, null, 8, ["id", "modelValue", "disabled", "readonly", "placeholder", "size", "name", "prefix-icon", "onFocus", "onBlur"]),
k("span", R, y(e.rangeSeparator), 1),
b(t, {
id: Array.isArray(e.id) && e.id[1] || "",
modelValue: e.endText,
"onUpdate:modelValue": d[2] || (d[2] = (o) => e.endText = o),
disabled: e.disabled,
readonly: e.readonly || !e.editable,
clearable: e.clearable,
placeholder: e.endPlaceholder,
width: "auto",
size: e.size,
name: Array.isArray(e.name) && e.name[1] || "",
"clear-icon": e.resolvedClearIcon,
onFocus: e.onFocus,
onBlur: e.onBlur
}, null, 8, ["id", "modelValue", "disabled", "readonly", "clearable", "placeholder", "size", "name", "clear-icon", "onFocus", "onBlur"])
])) : (l(), i(t, {
key: 0,
id: typeof e.id == "string" ? e.id : "",
modelValue: e.text,
"onUpdate:modelValue": d[0] || (d[0] = (o) => e.text = o),
disabled: e.disabled,
readonly: e.readonly || !e.editable,
clearable: e.clearable,
placeholder: e.placeholder,
width: e.width,
size: e.size,
name: typeof e.name == "string" ? e.name : "",
"prefix-icon": e.resolvedPrefixIcon,
"clear-icon": e.resolvedClearIcon,
onFocus: e.onFocus,
onBlur: e.onBlur
}, null, 8, ["id", "modelValue", "disabled", "readonly", "clearable", "placeholder", "width", "size", "name", "prefix-icon", "clear-icon", "onFocus", "onBlur"]))
], 512),
b(V, { name: "Dk-trigger" }, {
default: P(() => [
e.teleported ? (l(), i(A, {
key: 0,
to: "body"
}, [
m(k("div", {
ref: "dropdownRef",
class: p(["dk-date-picker_dropdown", e.popperClass]),
style: u([e.dropdownStyle, e.popperStyle]),
onMousedown: d[8] || (d[8] = s(() => {
}, ["prevent"])),
onClick: d[9] || (d[9] = s(() => {
}, ["stop"]))
}, [
e.shortcuts && e.shortcuts.length ? (l(), a("div", F, [
(l(!0), a(w, null, h(e.shortcuts, (o) => (l(), a("button", {
key: o.text,
type: "button",
class: "dk-date-picker_shortcut",
disabled: e.disabled,
onClick: (C) => e.applyShortcut(o)
}, y(o.text), 9, S))), 128))
])) : n("", !0),
e.isRange ? (l(), i(r, {
key: 2,
"model-value": e.toPanelValue(e.draftRange[0] || e.draftRange[1]),
disabled: e.disabled,
width: e.panelWidth,
"first-day-of-week": e.firstDayOfWeek,
"disabled-date": e.disabledDate,
"onUpdate:modelValue": e.onPickRange,
onPanelChange: d[5] || (d[5] = (o) => e.$emit("panel-change", o))
}, null, 8, ["model-value", "disabled", "width", "first-day-of-week", "disabled-date", "onUpdate:modelValue"])) : (l(), i(r, {
key: 1,
"model-value": e.toPanelValue(e.draft),
disabled: e.disabled,
width: e.panelWidth,
"first-day-of-week": e.firstDayOfWeek,
"disabled-date": e.disabledDate,
"onUpdate:modelValue": e.onPickSingle,
onPanelChange: d[4] || (d[4] = (o) => e.$emit("panel-change", o))
}, null, 8, ["model-value", "disabled", "width", "first-day-of-week", "disabled-date", "onUpdate:modelValue"])),
e.showFooter ? (l(), a("div", z, [
e.clearable ? (l(), a("button", {
key: 0,
type: "button",
class: "dk-date-picker_footer-btn",
disabled: e.disabled,
onClick: d[6] || (d[6] = (...o) => e.onClear && e.onClear(...o))
}, "\u6E05\u7A7A", 8, U)) : n("", !0),
e.showConfirm ? (l(), a("button", {
key: 1,
type: "button",
class: "dk-date-picker_footer-btn primary",
disabled: e.disabled,
onClick: d[7] || (d[7] = (...o) => e.onConfirm && e.onConfirm(...o))
}, "\u786E\u5B9A", 8, $)) : n("", !0)
])) : n("", !0)
], 38), [
[g, e.open]
])
])) : m((l(), a("div", {
key: 1,
ref: "dropdownRef",
class: p(["dk-date-picker_dropdown", e.popperClass]),
style: u([e.popperStyle]),
onMousedown: d[14] || (d[14] = s(() => {
}, ["prevent"])),
onClick: d[15] || (d[15] = s(() => {
}, ["stop"]))
}, [
e.shortcuts && e.shortcuts.length ? (l(), a("div", W, [
(l(!0), a(w, null, h(e.shortcuts, (o) => (l(), a("button", {
key: o.text,
type: "button",
class: "dk-date-picker_shortcut",
disabled: e.disabled,
onClick: (C) => e.applyShortcut(o)
}, y(o.text), 9, E))), 128))
])) : n("", !0),
e.isRange ? (l(), i(r, {
key: 2,
"model-value": e.toPanelValue(e.draftRange[0] || e.draftRange[1]),
disabled: e.disabled,
width: e.panelWidth,
"first-day-of-week": e.firstDayOfWeek,
"disabled-date": e.disabledDate,
"onUpdate:modelValue": e.onPickRange,
onPanelChange: d[11] || (d[11] = (o) => e.$emit("panel-change", o))
}, null, 8, ["model-value", "disabled", "width", "first-day-of-week", "disabled-date", "onUpdate:modelValue"])) : (l(), i(r, {
key: 1,
"model-value": e.toPanelValue(e.draft),
disabled: e.disabled,
width: e.panelWidth,
"first-day-of-week": e.firstDayOfWeek,
"disabled-date": e.disabledDate,
"onUpdate:modelValue": e.onPickSingle,
onPanelChange: d[10] || (d[10] = (o) => e.$emit("panel-change", o))
}, null, 8, ["model-value", "disabled", "width", "first-day-of-week", "disabled-date", "onUpdate:modelValue"])),
e.showFooter ? (l(), a("div", T, [
e.clearable ? (l(), a("button", {
key: 0,
type: "button",
class: "dk-date-picker_footer-btn",
disabled: e.disabled,
onClick: d[12] || (d[12] = (...o) => e.onClear && e.onClear(...o))
}, "\u6E05\u7A7A", 8, I)) : n("", !0),
e.showConfirm ? (l(), a("button", {
key: 1,
type: "button",
class: "dk-date-picker_footer-btn primary",
disabled: e.disabled,
onClick: d[13] || (d[13] = (...o) => e.onConfirm && e.onConfirm(...o))
}, "\u786E\u5B9A", 8, O)) : n("", !0)
])) : n("", !0)
], 38)), [
[g, e.open]
])
]),
_: 1
})
], 38);
}
const J = /* @__PURE__ */ B(v, [["render", K]]);
export {
J as default
};