@w-run/wdesign-ui 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +208 -127
- package/dist/index.d.ts +1010 -80
- package/dist/parts/WdAffix.js +159 -0
- package/dist/parts/WdAiMessage.js +277 -0
- package/dist/parts/WdAlert.js +92 -0
- package/dist/parts/WdAnchor.js +159 -0
- package/dist/parts/WdAudioPlayer.js +1024 -0
- package/dist/parts/WdAvatar.js +6 -0
- package/dist/parts/WdAvatarGroup.js +46 -0
- package/dist/parts/WdBacktop.js +120 -0
- package/dist/parts/WdBadge.js +61 -0
- package/dist/parts/WdBento.js +40 -0
- package/dist/parts/WdBentoItem.js +43 -0
- package/dist/parts/WdBottomSheet.js +263 -0
- package/dist/parts/WdBreadcrumb.js +64 -0
- package/dist/parts/WdButton.js +94 -0
- package/dist/parts/WdCalendar.js +11 -0
- package/dist/parts/WdCard.js +113 -0
- package/dist/parts/WdCarousel.js +365 -0
- package/dist/parts/WdCascader.js +386 -0
- package/dist/parts/WdCheckbox.js +81 -0
- package/dist/parts/WdCollapse.js +135 -0
- package/dist/parts/WdColorPicker.js +592 -0
- package/dist/parts/WdCommand.js +357 -0
- package/dist/parts/WdContainer.js +37 -0
- package/dist/parts/WdCountdown.js +163 -0
- package/dist/parts/WdDanmaku.js +6 -0
- package/dist/parts/WdDatePicker.js +169 -0
- package/dist/parts/WdDateTimePicker.js +162 -0
- package/dist/parts/WdDescriptions.js +146 -0
- package/dist/parts/WdDivider.js +64 -0
- package/dist/parts/WdDrawer.js +176 -0
- package/dist/parts/WdDropdown.js +140 -0
- package/dist/parts/WdEmpty.js +79 -0
- package/dist/parts/WdExplorer.js +336 -0
- package/dist/parts/WdFileList.js +177 -0
- package/dist/parts/WdForm.js +111 -0
- package/dist/parts/WdFormItem.js +156 -0
- package/dist/parts/WdGrid.js +40 -0
- package/dist/parts/WdGroup.js +68 -0
- package/dist/parts/WdImagePreview.js +274 -0
- package/dist/parts/WdInput.js +10 -0
- package/dist/parts/WdInputNumber.js +253 -0
- package/dist/parts/WdListItem.js +60 -0
- package/dist/parts/WdLoading.js +128 -0
- package/dist/parts/WdMarkdown.js +172 -0
- package/dist/parts/WdMarquee.js +80 -0
- package/dist/parts/WdMasonry.js +40 -0
- package/dist/parts/WdMediaCard.js +302 -0
- package/dist/parts/WdMentions.js +277 -0
- package/dist/parts/WdModal.js +149 -0
- package/dist/parts/WdNav.js +311 -0
- package/dist/parts/WdNotification.js +112 -0
- package/dist/parts/WdOtp.js +107 -0
- package/dist/parts/WdPagination.js +252 -0
- package/dist/parts/WdPopconfirm.js +214 -0
- package/dist/parts/WdPopover.js +203 -0
- package/dist/parts/WdPostItem.js +84 -0
- package/dist/parts/WdProgress.js +48 -0
- package/dist/parts/WdProgressRing.js +101 -0
- package/dist/parts/WdPullRefresh.js +167 -0
- package/dist/parts/WdQRCode.js +1909 -0
- package/dist/parts/WdRadioGroup.js +95 -0
- package/dist/parts/WdRate.js +128 -0
- package/dist/parts/WdResult.js +86 -0
- package/dist/parts/WdScrollbar.js +186 -0
- package/dist/parts/WdSegmented.js +11 -0
- package/dist/parts/WdSelect.js +465 -0
- package/dist/parts/WdSkeleton.js +69 -0
- package/dist/parts/WdSlider.js +100 -0
- package/dist/parts/WdSortableList.js +291 -0
- package/dist/parts/WdSpace.js +46 -0
- package/dist/parts/WdSparkline.js +148 -0
- package/dist/parts/WdSpinner.js +6 -0
- package/dist/parts/WdSplitter.js +183 -0
- package/dist/parts/WdStatBar.js +202 -0
- package/dist/parts/WdStatistic.js +131 -0
- package/dist/parts/WdSteps.js +110 -0
- package/dist/parts/WdSwitch.js +63 -0
- package/dist/parts/WdTabBar.js +84 -0
- package/dist/parts/WdTable.js +589 -0
- package/dist/parts/WdTabs.js +219 -0
- package/dist/parts/WdTag.js +6 -0
- package/dist/parts/WdTagInput.js +181 -0
- package/dist/parts/WdTimePicker.js +12 -0
- package/dist/parts/WdTimeline.js +145 -0
- package/dist/parts/WdTooltip.js +108 -0
- package/dist/parts/WdTour.js +264 -0
- package/dist/parts/WdTransfer.js +446 -0
- package/dist/parts/WdTree.js +322 -0
- package/dist/parts/WdUpload.js +309 -0
- package/dist/parts/WdVideoPlayer.js +1006 -0
- package/dist/parts/WdVirtualList.js +169 -0
- package/dist/parts/WdWatermark.js +150 -0
- package/dist/parts/chunk-3LVE72ZK.js +361 -0
- package/dist/parts/chunk-5HYOQ52I.js +101 -0
- package/dist/parts/chunk-7M3MUL3B.js +275 -0
- package/dist/parts/chunk-AOTJ63HN.js +15 -0
- package/dist/parts/chunk-AXEF2U2A.js +41 -0
- package/dist/parts/chunk-CY3QOSFP.js +645 -0
- package/dist/parts/chunk-G7NN4A6J.js +40 -0
- package/dist/parts/chunk-HAKYCUAR.js +9 -0
- package/dist/parts/chunk-JDE4AHBR.js +160 -0
- package/dist/parts/chunk-LT3NTWIT.js +117 -0
- package/dist/parts/chunk-OGHYFT7B.js +387 -0
- package/dist/parts/chunk-Q34U2HES.js +261 -0
- package/dist/parts/chunk-RLSVPJHM.js +10 -0
- package/dist/parts/chunk-U2CDKD2T.js +30 -0
- package/dist/parts/chunk-UYUNYHZD.js +40 -0
- package/dist/parts/chunk-VUJL2HGD.js +23 -0
- package/dist/parts/chunk-WCFG5KNT.js +51 -0
- package/dist/parts/chunk-WDDAALPI.js +42 -0
- package/dist/parts/chunk-WFXLDBP2.js +149 -0
- package/dist/style/affix.css +566 -0
- package/dist/style/ai-msg.css +572 -13
- package/dist/style/alert.css +577 -5
- package/dist/style/anchor.css +630 -0
- package/dist/style/audio.css +658 -67
- package/dist/style/avatar.css +575 -12
- package/dist/style/backtop.css +625 -0
- package/dist/style/badge.css +595 -11
- package/dist/style/bento.css +763 -0
- package/dist/style/bottom-sheet.css +776 -0
- package/dist/style/breadcrumb.css +579 -4
- package/dist/style/button.css +631 -36
- package/dist/style/calendar.css +1512 -0
- package/dist/style/card.css +683 -6
- package/dist/style/carousel.css +573 -4
- package/dist/style/cascader.css +862 -0
- package/dist/style/checkbox.css +584 -7
- package/dist/style/chevron.css +543 -1
- package/dist/style/collapse.css +586 -7
- package/dist/style/colorpicker.css +876 -0
- package/dist/style/command.css +572 -13
- package/dist/style/container.css +543 -0
- package/dist/style/countdown.css +722 -0
- package/dist/style/danmaku.css +644 -0
- package/dist/style/datepicker.css +606 -128
- package/dist/style/datetime-picker.css +714 -0
- package/dist/style/descriptions.css +604 -11
- package/dist/style/divider.css +544 -2
- package/dist/style/dot.css +556 -1
- package/dist/style/drawer.css +609 -11
- package/dist/style/dropdown.css +565 -3
- package/dist/style/empty.css +624 -3
- package/dist/style/explorer.css +632 -24
- package/dist/style/file-list.css +577 -5
- package/dist/style/flip.css +600 -0
- package/dist/style/form.css +550 -8
- package/dist/style/grid.css +614 -0
- package/dist/style/group.css +560 -16
- package/dist/style/icon-btn.css +570 -4
- package/dist/style/image-preview.css +652 -8
- package/dist/style/input-number.css +680 -0
- package/dist/style/input.css +571 -8
- package/dist/style/list.css +553 -4
- package/dist/style/loading.css +667 -0
- package/dist/style/markdown.css +592 -20
- package/dist/style/marquee.css +678 -0
- package/dist/style/masonry.css +614 -0
- package/dist/style/media-card.css +1229 -0
- package/dist/style/mentions.css +690 -0
- package/dist/style/modal.css +626 -15
- package/dist/style/nav.css +1046 -0
- package/dist/style/notification.css +556 -7
- package/dist/style/otp.css +567 -7
- package/dist/style/pagination.css +571 -11
- package/dist/style/popconfirm.css +568 -10
- package/dist/style/popover.css +645 -15
- package/dist/style/post-item.css +548 -6
- package/dist/style/progress-ring.css +640 -0
- package/dist/style/progress.css +543 -1
- package/dist/style/pull-refresh.css +637 -0
- package/dist/style/qrcode.css +613 -0
- package/dist/style/radio.css +584 -5
- package/dist/style/rate.css +594 -1
- package/dist/style/result.css +546 -3
- package/dist/style/scroll-reveal.css +613 -0
- package/dist/style/scrollbar.css +644 -0
- package/dist/style/segmented-picker.css +573 -14
- package/dist/style/segmented.css +711 -7
- package/dist/style/select.css +682 -26
- package/dist/style/skeleton.css +559 -0
- package/dist/style/slider.css +565 -4
- package/dist/style/sortable.css +593 -7
- package/dist/style/space.css +543 -0
- package/dist/style/sparkline.css +606 -0
- package/dist/style/spinner.css +559 -0
- package/dist/style/splitter.css +711 -0
- package/dist/style/stat-bar.css +767 -0
- package/dist/style/statistic.css +552 -7
- package/dist/style/steps.css +633 -9
- package/dist/style/switch.css +585 -4
- package/dist/style/tab-bar.css +647 -0
- package/dist/style/table.css +886 -36
- package/dist/style/tabs.css +599 -10
- package/dist/style/tag-input.css +710 -0
- package/dist/style/tag.css +603 -18
- package/dist/style/time-picker.css +749 -0
- package/dist/style/timeline.css +575 -14
- package/dist/style/toast.css +567 -6
- package/dist/style/tooltip.css +564 -5
- package/dist/style/tour.css +683 -0
- package/dist/style/transfer.css +858 -0
- package/dist/style/tree.css +613 -16
- package/dist/style/typography.css +884 -3
- package/dist/style/upload.css +602 -13
- package/dist/style/vlist.css +543 -1
- package/dist/style/vplayer.css +799 -57
- package/dist/style/watermark.css +570 -0
- package/dist/wdesign-ui.css +18055 -7262
- package/dist/wdesign-ui.esm.js +8976 -5044
- package/package.json +99 -13
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WdSpinner_default
|
|
3
|
+
} from "./chunk-WDDAALPI.js";
|
|
4
|
+
import {
|
|
5
|
+
useDismiss
|
|
6
|
+
} from "./chunk-WFXLDBP2.js";
|
|
7
|
+
import {
|
|
8
|
+
useFormItemA11y
|
|
9
|
+
} from "./chunk-VUJL2HGD.js";
|
|
10
|
+
import {
|
|
11
|
+
WdIcon_default
|
|
12
|
+
} from "./chunk-Q34U2HES.js";
|
|
13
|
+
|
|
14
|
+
// .lib-build/WdCalendar.ts
|
|
15
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
16
|
+
import { unref as _unref, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createVNode as _createVNode, withModifiers as _withModifiers, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps } from "vue";
|
|
17
|
+
import { computed, nextTick, ref, watch } from "vue";
|
|
18
|
+
var _hoisted_1 = ["aria-label"];
|
|
19
|
+
var _hoisted_2 = { class: "wd-calendar__head" };
|
|
20
|
+
var _hoisted_3 = ["aria-expanded"];
|
|
21
|
+
var _hoisted_4 = { class: "wd-calendar__year" };
|
|
22
|
+
var _hoisted_5 = { class: "wd-calendar__mon" };
|
|
23
|
+
var _hoisted_6 = { class: "wd-calendar__navs" };
|
|
24
|
+
var _hoisted_7 = ["aria-label", "onClick"];
|
|
25
|
+
var _hoisted_8 = ["aria-label", "onClick"];
|
|
26
|
+
var _hoisted_9 = {
|
|
27
|
+
class: "wd-calendar__week",
|
|
28
|
+
role: "row"
|
|
29
|
+
};
|
|
30
|
+
var _hoisted_10 = {
|
|
31
|
+
class: "wd-calendar__grid",
|
|
32
|
+
role: "rowgroup"
|
|
33
|
+
};
|
|
34
|
+
var _hoisted_11 = ["aria-selected", "disabled", "tabindex", "onFocus", "onClick"];
|
|
35
|
+
var _hoisted_12 = { class: "wd-calendar__day" };
|
|
36
|
+
var _hoisted_13 = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "wd-calendar__today-bar",
|
|
39
|
+
"aria-hidden": "true"
|
|
40
|
+
};
|
|
41
|
+
var _hoisted_14 = {
|
|
42
|
+
key: 1,
|
|
43
|
+
class: "wd-calendar__text",
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
};
|
|
46
|
+
var _hoisted_15 = {
|
|
47
|
+
key: 2,
|
|
48
|
+
class: "wd-calendar__marks",
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
};
|
|
51
|
+
var _hoisted_16 = {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: "wd-calendar__mark-more"
|
|
54
|
+
};
|
|
55
|
+
var _hoisted_17 = {
|
|
56
|
+
key: 1,
|
|
57
|
+
class: "wd-calendar__foot"
|
|
58
|
+
};
|
|
59
|
+
var _hoisted_18 = {
|
|
60
|
+
key: 2,
|
|
61
|
+
class: "wd-calendar__loading",
|
|
62
|
+
role: "status",
|
|
63
|
+
"aria-live": "polite"
|
|
64
|
+
};
|
|
65
|
+
var WdCalendar_default = /* @__PURE__ */ _defineComponent({
|
|
66
|
+
...{ name: "WdCalendar" },
|
|
67
|
+
__name: "WdCalendar",
|
|
68
|
+
props: {
|
|
69
|
+
modelValue: { type: String, required: false, default: void 0 },
|
|
70
|
+
defaultValue: { type: String, required: false, default: "" },
|
|
71
|
+
month: { type: String, required: false, default: "" },
|
|
72
|
+
weekStart: { type: Number, required: false, default: 1 },
|
|
73
|
+
min: { type: String, required: false, default: "" },
|
|
74
|
+
max: { type: String, required: false, default: "" },
|
|
75
|
+
clearable: { type: Boolean, required: false, default: true },
|
|
76
|
+
showToday: { type: Boolean, required: false, default: true },
|
|
77
|
+
size: { type: String, required: false, default: "md" },
|
|
78
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
79
|
+
loading: { type: Boolean, required: false, default: false },
|
|
80
|
+
mode: { type: String, required: false, default: "single" },
|
|
81
|
+
marks: { type: Object, required: false, default: () => ({}) },
|
|
82
|
+
markSize: { type: Number, required: false, default: 5 },
|
|
83
|
+
compact: { type: Boolean, required: false, default: false },
|
|
84
|
+
texts: { type: Object, required: false, default: () => ({}) }
|
|
85
|
+
},
|
|
86
|
+
emits: ["update:modelValue", "change", "update:month"],
|
|
87
|
+
setup(__props, { emit: __emit }) {
|
|
88
|
+
const formA11y = useFormItemA11y();
|
|
89
|
+
const props = __props;
|
|
90
|
+
const emit = __emit;
|
|
91
|
+
function pad(n) {
|
|
92
|
+
return n < 10 ? "0" + n : String(n);
|
|
93
|
+
}
|
|
94
|
+
function toKey(d) {
|
|
95
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
96
|
+
}
|
|
97
|
+
function parseKey(s) {
|
|
98
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
99
|
+
if (!m) return null;
|
|
100
|
+
const d = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
101
|
+
return isNaN(d.getTime()) ? null : d;
|
|
102
|
+
}
|
|
103
|
+
function todayKey() {
|
|
104
|
+
return toKey(/* @__PURE__ */ new Date());
|
|
105
|
+
}
|
|
106
|
+
const inner = ref(props.defaultValue);
|
|
107
|
+
const isControlled = computed(() => props.modelValue !== void 0);
|
|
108
|
+
const selected = computed(() => isControlled.value ? props.modelValue : inner.value);
|
|
109
|
+
const view = ref({ y: 0, m: 0 });
|
|
110
|
+
function initView() {
|
|
111
|
+
const base = props.month ? /^(\d{4})-(\d{2})$/.exec(props.month) : null;
|
|
112
|
+
if (base) {
|
|
113
|
+
view.value = { y: Number(base[1]), m: Number(base[2]) - 1 };
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const sel = parseKey(selected.value);
|
|
117
|
+
const d = sel ?? /* @__PURE__ */ new Date();
|
|
118
|
+
view.value = { y: d.getFullYear(), m: d.getMonth() };
|
|
119
|
+
}
|
|
120
|
+
initView();
|
|
121
|
+
watch(
|
|
122
|
+
() => props.month,
|
|
123
|
+
(v) => {
|
|
124
|
+
const m = /^(\d{4})-(\d{2})$/.exec(v || "");
|
|
125
|
+
if (m) view.value = { y: Number(m[1]), m: Number(m[2]) - 1 };
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
const WEEK_LABELS = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
129
|
+
const weekHeads = computed(() => {
|
|
130
|
+
const arr = [...WEEK_LABELS];
|
|
131
|
+
return props.weekStart === 1 ? [...arr.slice(1), arr[0]] : arr;
|
|
132
|
+
});
|
|
133
|
+
const cells = computed(() => {
|
|
134
|
+
const { y, m } = view.value;
|
|
135
|
+
const first = new Date(y, m, 1);
|
|
136
|
+
const firstDow = first.getDay();
|
|
137
|
+
const lead = (firstDow - props.weekStart + 7) % 7;
|
|
138
|
+
const daysInMonth = new Date(y, m + 1, 0).getDate();
|
|
139
|
+
const prevMonthDays = new Date(y, m, 0).getDate();
|
|
140
|
+
const out = [];
|
|
141
|
+
const tk = todayKey();
|
|
142
|
+
const sel = selected.value;
|
|
143
|
+
const minD = parseKey(props.min);
|
|
144
|
+
const maxD = parseKey(props.max);
|
|
145
|
+
const startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
146
|
+
const makeCell = (d, inMonth) => {
|
|
147
|
+
const key = toKey(d);
|
|
148
|
+
const isRange = props.mode === "range";
|
|
149
|
+
const { start, end } = isRange ? rangeSelected.value : { start: "", end: "" };
|
|
150
|
+
return {
|
|
151
|
+
key,
|
|
152
|
+
day: d.getDate(),
|
|
153
|
+
inMonth,
|
|
154
|
+
isToday: key === tk,
|
|
155
|
+
// 区间模式下"选中"由起终点单独表达,避免整块高亮混淆
|
|
156
|
+
isSelected: isRange ? false : key === sel,
|
|
157
|
+
isRangeStart: isRange && key === start,
|
|
158
|
+
isRangeEnd: isRange && key === end,
|
|
159
|
+
/*
|
|
160
|
+
* 区间内部:只有真的选完(非 pending)才铺底条。
|
|
161
|
+
* 半选状态下只高亮起点,不预判终点 ——
|
|
162
|
+
* 否则鼠标还没移到终点,中间就凭空出现一条色带。
|
|
163
|
+
*/
|
|
164
|
+
inRange: isRange && !rangePending.value && !!start && !!end && key > start && key < end,
|
|
165
|
+
marks: marksOf(key),
|
|
166
|
+
text: props.compact ? "" : props.texts[key] || "",
|
|
167
|
+
disabled: !!minD && d < startOfDay(minD) || !!maxD && d > startOfDay(maxD)
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
for (let i = lead - 1; i >= 0; i--) {
|
|
171
|
+
const day = prevMonthDays - i;
|
|
172
|
+
const d = new Date(y, m - 1, day);
|
|
173
|
+
out.push(makeCell(d, false));
|
|
174
|
+
}
|
|
175
|
+
for (let day = 1; day <= daysInMonth; day++) {
|
|
176
|
+
out.push(makeCell(new Date(y, m, day), true));
|
|
177
|
+
}
|
|
178
|
+
while (out.length < 42) {
|
|
179
|
+
const day = out.length - lead - daysInMonth + 1;
|
|
180
|
+
out.push(makeCell(new Date(y, m + 1, day), false));
|
|
181
|
+
}
|
|
182
|
+
return out;
|
|
183
|
+
});
|
|
184
|
+
const monthLabel = computed(() => `${view.value.y} \u5E74 ${view.value.m + 1} \u6708`);
|
|
185
|
+
const rangeStart = ref("");
|
|
186
|
+
const rangeEnd = ref("");
|
|
187
|
+
const rangePending = ref(false);
|
|
188
|
+
const root = ref(null);
|
|
189
|
+
const pickerOpen = ref(false);
|
|
190
|
+
const yearList = computed(() => {
|
|
191
|
+
const cur = (/* @__PURE__ */ new Date()).getFullYear();
|
|
192
|
+
const out = [];
|
|
193
|
+
for (let y = cur - 30; y <= cur + 10; y++) out.push(y);
|
|
194
|
+
return out;
|
|
195
|
+
});
|
|
196
|
+
function openPicker() {
|
|
197
|
+
pickerOpen.value = true;
|
|
198
|
+
}
|
|
199
|
+
function closePicker() {
|
|
200
|
+
pickerOpen.value = false;
|
|
201
|
+
}
|
|
202
|
+
function pickYear(y) {
|
|
203
|
+
view.value = { y, m: view.value.m };
|
|
204
|
+
emit("update:month", `${y}-${pad(view.value.m + 1)}`);
|
|
205
|
+
}
|
|
206
|
+
function pickMonth(m) {
|
|
207
|
+
view.value = { y: view.value.y, m };
|
|
208
|
+
emit("update:month", `${view.value.y}-${pad(m + 1)}`);
|
|
209
|
+
pickerOpen.value = false;
|
|
210
|
+
}
|
|
211
|
+
useDismiss([root], () => {
|
|
212
|
+
pickerOpen.value = false;
|
|
213
|
+
}, pickerOpen);
|
|
214
|
+
const yearColRef = ref(null);
|
|
215
|
+
const monthColRef = ref(null);
|
|
216
|
+
watch(pickerOpen, async (v) => {
|
|
217
|
+
if (!v) return;
|
|
218
|
+
await nextTick();
|
|
219
|
+
const yEl = yearColRef.value?.querySelector(".is-on");
|
|
220
|
+
yEl?.scrollIntoView({ block: "center" });
|
|
221
|
+
const mEl = monthColRef.value?.querySelector(".is-on");
|
|
222
|
+
mEl?.scrollIntoView({ block: "center" });
|
|
223
|
+
});
|
|
224
|
+
const rangeSelected = computed(() => {
|
|
225
|
+
if (props.mode !== "range") return { start: "", end: "", pending: false };
|
|
226
|
+
const mv = props.modelValue || "";
|
|
227
|
+
if (mv.includes("~")) {
|
|
228
|
+
const [a, b] = mv.split("~");
|
|
229
|
+
return { start: a || "", end: b || "", pending: rangePending.value };
|
|
230
|
+
}
|
|
231
|
+
return { start: rangeStart.value, end: rangeEnd.value, pending: rangePending.value };
|
|
232
|
+
});
|
|
233
|
+
function inRange(key) {
|
|
234
|
+
const { start, end } = rangeSelected.value;
|
|
235
|
+
if (!start || !end) return false;
|
|
236
|
+
return key >= start && key <= end;
|
|
237
|
+
}
|
|
238
|
+
function pickRange(cell) {
|
|
239
|
+
if (props.disabled || props.loading) return;
|
|
240
|
+
const { start, pending } = rangeSelected.value;
|
|
241
|
+
if (!pending) {
|
|
242
|
+
rangeStart.value = cell.key;
|
|
243
|
+
rangeEnd.value = "";
|
|
244
|
+
rangePending.value = true;
|
|
245
|
+
if (!isControlled.value) inner.value = cell.key;
|
|
246
|
+
emit("update:modelValue", cell.key);
|
|
247
|
+
emit("change", cell.key);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const a = start || cell.key;
|
|
251
|
+
const b = cell.key;
|
|
252
|
+
const [s1, s2] = a <= b ? [a, b] : [b, a];
|
|
253
|
+
rangeStart.value = s1;
|
|
254
|
+
rangeEnd.value = s2;
|
|
255
|
+
rangePending.value = false;
|
|
256
|
+
if (!isControlled.value) inner.value = `${s1}~${s2}`;
|
|
257
|
+
emit("update:modelValue", `${s1}~${s2}`);
|
|
258
|
+
emit("change", `${s1}~${s2}`);
|
|
259
|
+
}
|
|
260
|
+
function marksOf(key) {
|
|
261
|
+
const raw = props.marks[key];
|
|
262
|
+
if (!raw) return [];
|
|
263
|
+
const arr = Array.isArray(raw) ? raw : [raw];
|
|
264
|
+
return arr.map((m) => typeof m === "string" ? { color: m } : m);
|
|
265
|
+
}
|
|
266
|
+
function shiftMonth(delta) {
|
|
267
|
+
let m = view.value.m + delta;
|
|
268
|
+
let y = view.value.y;
|
|
269
|
+
while (m < 0) {
|
|
270
|
+
m += 12;
|
|
271
|
+
y--;
|
|
272
|
+
}
|
|
273
|
+
while (m > 11) {
|
|
274
|
+
m -= 12;
|
|
275
|
+
y++;
|
|
276
|
+
}
|
|
277
|
+
view.value = { y, m };
|
|
278
|
+
emit("update:month", `${y}-${pad(m + 1)}`);
|
|
279
|
+
const base = parseKey(cursor.value) ?? parseKey(selected.value);
|
|
280
|
+
if (!base) return;
|
|
281
|
+
const lastDay = new Date(y, m + 1, 0).getDate();
|
|
282
|
+
const day = Math.min(base.getDate(), lastDay);
|
|
283
|
+
cursor.value = toKey(new Date(y, m, day));
|
|
284
|
+
}
|
|
285
|
+
function pick(cell) {
|
|
286
|
+
if (props.disabled || props.loading || cell.disabled) return;
|
|
287
|
+
if (props.mode === "range") {
|
|
288
|
+
pickRange(cell);
|
|
289
|
+
if (!cell.inMonth) {
|
|
290
|
+
const d = parseKey(cell.key);
|
|
291
|
+
if (d) view.value = { y: d.getFullYear(), m: d.getMonth() };
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (!isControlled.value) inner.value = cell.key;
|
|
296
|
+
cursor.value = cell.key;
|
|
297
|
+
emit("update:modelValue", cell.key);
|
|
298
|
+
emit("change", cell.key);
|
|
299
|
+
if (!cell.inMonth) {
|
|
300
|
+
const d = parseKey(cell.key);
|
|
301
|
+
if (d) view.value = { y: d.getFullYear(), m: d.getMonth() };
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function goToday() {
|
|
305
|
+
if (props.disabled || props.loading) return;
|
|
306
|
+
const d = /* @__PURE__ */ new Date();
|
|
307
|
+
const key = toKey(d);
|
|
308
|
+
view.value = { y: d.getFullYear(), m: d.getMonth() };
|
|
309
|
+
if (props.min && key < props.min || props.max && key > props.max) return;
|
|
310
|
+
pick({ key, day: d.getDate(), inMonth: true, isToday: true, isSelected: false, disabled: false });
|
|
311
|
+
}
|
|
312
|
+
function clear() {
|
|
313
|
+
if (props.disabled || props.loading) return;
|
|
314
|
+
if (!isControlled.value) inner.value = "";
|
|
315
|
+
emit("update:modelValue", "");
|
|
316
|
+
emit("change", "");
|
|
317
|
+
}
|
|
318
|
+
const cursor = ref("");
|
|
319
|
+
watch(
|
|
320
|
+
() => [selected.value, view.value.y, view.value.m],
|
|
321
|
+
() => {
|
|
322
|
+
if (!cursor.value) cursor.value = selected.value || toKey(new Date(view.value.y, view.value.m, 1));
|
|
323
|
+
},
|
|
324
|
+
{ immediate: true }
|
|
325
|
+
);
|
|
326
|
+
function moveCursor(next) {
|
|
327
|
+
cursor.value = toKey(next);
|
|
328
|
+
if (next.getMonth() !== view.value.m || next.getFullYear() !== view.value.y) {
|
|
329
|
+
view.value = { y: next.getFullYear(), m: next.getMonth() };
|
|
330
|
+
emit("update:month", `${next.getFullYear()}-${pad(next.getMonth() + 1)}`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
function commitCursor() {
|
|
334
|
+
const d = parseKey(cursor.value);
|
|
335
|
+
if (!d) return;
|
|
336
|
+
const key = toKey(d);
|
|
337
|
+
if (props.min && key < props.min || props.max && key > props.max) return;
|
|
338
|
+
view.value = { y: d.getFullYear(), m: d.getMonth() };
|
|
339
|
+
pick({ key, day: d.getDate(), inMonth: true, isToday: key === todayKey(), isSelected: false, disabled: false });
|
|
340
|
+
}
|
|
341
|
+
function onKeydown(e) {
|
|
342
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
343
|
+
if (!cursor.value) return;
|
|
344
|
+
e.preventDefault();
|
|
345
|
+
commitCursor();
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const cur = parseKey(cursor.value) ?? parseKey(selected.value) ?? new Date(view.value.y, view.value.m, 1);
|
|
349
|
+
let next = null;
|
|
350
|
+
if (e.key === "ArrowLeft") next = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() - 1);
|
|
351
|
+
else if (e.key === "ArrowRight") next = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() + 1);
|
|
352
|
+
else if (e.key === "ArrowUp") next = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() - 7);
|
|
353
|
+
else if (e.key === "ArrowDown") next = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() + 7);
|
|
354
|
+
else if (e.key === "PageUp") shiftMonth(-1);
|
|
355
|
+
else if (e.key === "PageDown") shiftMonth(1);
|
|
356
|
+
if (next) {
|
|
357
|
+
e.preventDefault();
|
|
358
|
+
moveCursor(next);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return (_ctx, _cache) => {
|
|
362
|
+
return _openBlock(), _createElementBlock("div", _mergeProps({
|
|
363
|
+
ref_key: "root",
|
|
364
|
+
ref: root,
|
|
365
|
+
class: ["wd-calendar", [
|
|
366
|
+
`wd-calendar--${__props.size}`,
|
|
367
|
+
{ "is-disabled": __props.disabled, "is-loading": __props.loading },
|
|
368
|
+
{
|
|
369
|
+
// 区间已选完(非 pending)才画端点色带
|
|
370
|
+
"is-range-complete": __props.mode === "range" && !rangePending.value && !!rangeSelected.value.start && !!rangeSelected.value.end,
|
|
371
|
+
"wd-calendar--compact": __props.compact
|
|
372
|
+
}
|
|
373
|
+
]],
|
|
374
|
+
tabindex: "0",
|
|
375
|
+
role: "grid",
|
|
376
|
+
"aria-label": monthLabel.value,
|
|
377
|
+
onKeydown
|
|
378
|
+
}, _unref(formA11y).attrs.value), [
|
|
379
|
+
_createCommentVNode(" \u5934\u90E8\uFF1A\u7FFB\u6708 "),
|
|
380
|
+
_createCommentVNode("\n \u5934\u90E8\uFF1A\u53C2\u8003\u300C2026/07\u300D\u5F0F\u7684\u6392\u7248 \u2014\u2014 \u5927\u53F7\u5E74\u4EFD + \u4E3B\u8272\u659C\u6760 + \u6708\u4EFD\uFF0C\u6574\u4F53\u5DE6\u5BF9\u9F50\uFF1B\n \u7FFB\u9875\u6309\u94AE\u6536\u5728\u53F3\u4FA7\uFF0C\u4E0D\u518D\u5DE6\u53F3\u5939\u7740\u6807\u9898\u3002\n \u8FD9\u6837\u6807\u9898\u662F\u7EDD\u5BF9\u7684\u65F6\u95F4\u951A\u70B9\uFF0C\u7FFB\u9875\u53EA\u662F\u9644\u5E26\u7684\u6B21\u8981\u64CD\u4F5C\u3002\n "),
|
|
381
|
+
_createElementVNode("div", _hoisted_2, [
|
|
382
|
+
_createElementVNode("button", {
|
|
383
|
+
type: "button",
|
|
384
|
+
class: "wd-calendar__month",
|
|
385
|
+
"aria-expanded": pickerOpen.value,
|
|
386
|
+
"aria-label": "\u9009\u62E9\u5E74\u4EFD\u548C\u6708\u4EFD",
|
|
387
|
+
onClick: _withModifiers(openPicker, ["stop"])
|
|
388
|
+
}, [
|
|
389
|
+
_createElementVNode(
|
|
390
|
+
"span",
|
|
391
|
+
_hoisted_4,
|
|
392
|
+
_toDisplayString(view.value.y),
|
|
393
|
+
1
|
|
394
|
+
/* TEXT */
|
|
395
|
+
),
|
|
396
|
+
_cache[3] || (_cache[3] = _createElementVNode(
|
|
397
|
+
"span",
|
|
398
|
+
{
|
|
399
|
+
class: "wd-calendar__slash",
|
|
400
|
+
"aria-hidden": "true"
|
|
401
|
+
},
|
|
402
|
+
"/",
|
|
403
|
+
-1
|
|
404
|
+
/* CACHED */
|
|
405
|
+
)),
|
|
406
|
+
_createElementVNode(
|
|
407
|
+
"span",
|
|
408
|
+
_hoisted_5,
|
|
409
|
+
_toDisplayString(pad(view.value.m + 1)),
|
|
410
|
+
1
|
|
411
|
+
/* TEXT */
|
|
412
|
+
),
|
|
413
|
+
_createVNode(_unref(WdIcon_default), {
|
|
414
|
+
name: "chevron-down",
|
|
415
|
+
size: 14,
|
|
416
|
+
class: "wd-calendar__month-caret",
|
|
417
|
+
"aria-hidden": "true"
|
|
418
|
+
})
|
|
419
|
+
], 8, _hoisted_3),
|
|
420
|
+
_createElementVNode("div", _hoisted_6, [
|
|
421
|
+
_createElementVNode("button", {
|
|
422
|
+
type: "button",
|
|
423
|
+
class: "wd-calendar__nav",
|
|
424
|
+
"aria-label": "\u4E0A\u4E2A\u6708",
|
|
425
|
+
onClick: _cache[0] || (_cache[0] = ($event) => shiftMonth(-1))
|
|
426
|
+
}, [
|
|
427
|
+
_createVNode(_unref(WdIcon_default), {
|
|
428
|
+
name: "chevron-left",
|
|
429
|
+
size: 15,
|
|
430
|
+
"aria-hidden": "true"
|
|
431
|
+
})
|
|
432
|
+
]),
|
|
433
|
+
_createElementVNode("button", {
|
|
434
|
+
type: "button",
|
|
435
|
+
class: "wd-calendar__nav",
|
|
436
|
+
"aria-label": "\u4E0B\u4E2A\u6708",
|
|
437
|
+
onClick: _cache[1] || (_cache[1] = ($event) => shiftMonth(1))
|
|
438
|
+
}, [
|
|
439
|
+
_createVNode(_unref(WdIcon_default), {
|
|
440
|
+
name: "chevron-right",
|
|
441
|
+
size: 15,
|
|
442
|
+
"aria-hidden": "true"
|
|
443
|
+
})
|
|
444
|
+
])
|
|
445
|
+
])
|
|
446
|
+
]),
|
|
447
|
+
_createCommentVNode(" \u5E74\u6708\u5FEB\u901F\u9009\u62E9\u5F39\u5C42 "),
|
|
448
|
+
pickerOpen.value ? (_openBlock(), _createElementBlock("div", {
|
|
449
|
+
key: 0,
|
|
450
|
+
class: "wd-calendar__picker",
|
|
451
|
+
onClick: _cache[2] || (_cache[2] = _withModifiers(() => {
|
|
452
|
+
}, ["stop"]))
|
|
453
|
+
}, [
|
|
454
|
+
_createElementVNode(
|
|
455
|
+
"div",
|
|
456
|
+
{
|
|
457
|
+
class: "wd-calendar__picker-col",
|
|
458
|
+
ref_key: "yearColRef",
|
|
459
|
+
ref: yearColRef
|
|
460
|
+
},
|
|
461
|
+
[
|
|
462
|
+
(_openBlock(true), _createElementBlock(
|
|
463
|
+
_Fragment,
|
|
464
|
+
null,
|
|
465
|
+
_renderList(yearList.value, (y) => {
|
|
466
|
+
return _openBlock(), _createElementBlock("button", {
|
|
467
|
+
key: y,
|
|
468
|
+
type: "button",
|
|
469
|
+
class: _normalizeClass(["wd-calendar__picker-opt", { "is-on": y === view.value.y }]),
|
|
470
|
+
"aria-label": `${y} \u5E74`,
|
|
471
|
+
onClick: ($event) => pickYear(y)
|
|
472
|
+
}, _toDisplayString(y), 11, _hoisted_7);
|
|
473
|
+
}),
|
|
474
|
+
128
|
|
475
|
+
/* KEYED_FRAGMENT */
|
|
476
|
+
))
|
|
477
|
+
],
|
|
478
|
+
512
|
|
479
|
+
/* NEED_PATCH */
|
|
480
|
+
),
|
|
481
|
+
_createElementVNode(
|
|
482
|
+
"div",
|
|
483
|
+
{
|
|
484
|
+
class: "wd-calendar__picker-col",
|
|
485
|
+
ref_key: "monthColRef",
|
|
486
|
+
ref: monthColRef
|
|
487
|
+
},
|
|
488
|
+
[
|
|
489
|
+
(_openBlock(), _createElementBlock(
|
|
490
|
+
_Fragment,
|
|
491
|
+
null,
|
|
492
|
+
_renderList(12, (m) => {
|
|
493
|
+
return _createElementVNode("button", {
|
|
494
|
+
key: m,
|
|
495
|
+
type: "button",
|
|
496
|
+
class: _normalizeClass(["wd-calendar__picker-opt", { "is-on": m - 1 === view.value.m }]),
|
|
497
|
+
"aria-label": `${m} \u6708`,
|
|
498
|
+
onClick: ($event) => pickMonth(m - 1)
|
|
499
|
+
}, _toDisplayString(pad(m)), 11, _hoisted_8);
|
|
500
|
+
}),
|
|
501
|
+
64
|
|
502
|
+
/* STABLE_FRAGMENT */
|
|
503
|
+
))
|
|
504
|
+
],
|
|
505
|
+
512
|
|
506
|
+
/* NEED_PATCH */
|
|
507
|
+
)
|
|
508
|
+
])) : _createCommentVNode("v-if", true),
|
|
509
|
+
_createCommentVNode(" \u661F\u671F\u8868\u5934 "),
|
|
510
|
+
_createElementVNode("div", _hoisted_9, [
|
|
511
|
+
(_openBlock(true), _createElementBlock(
|
|
512
|
+
_Fragment,
|
|
513
|
+
null,
|
|
514
|
+
_renderList(weekHeads.value, (w) => {
|
|
515
|
+
return _openBlock(), _createElementBlock(
|
|
516
|
+
"span",
|
|
517
|
+
{
|
|
518
|
+
key: w,
|
|
519
|
+
class: "wd-calendar__weekday",
|
|
520
|
+
role: "columnheader"
|
|
521
|
+
},
|
|
522
|
+
_toDisplayString(w),
|
|
523
|
+
1
|
|
524
|
+
/* TEXT */
|
|
525
|
+
);
|
|
526
|
+
}),
|
|
527
|
+
128
|
|
528
|
+
/* KEYED_FRAGMENT */
|
|
529
|
+
))
|
|
530
|
+
]),
|
|
531
|
+
_createCommentVNode("\n \u65E5\u671F\u7F51\u683C\u3002\n \u683C\u5B50\u4E0A\u7528 roving tabindex\uFF1A42 \u4E2A\u53EF Tab \u7684\u683C\u5B50\u610F\u5473\u7740\u7528\u6237\u8981\u6309 42 \u6B21\u624D\u51FA\u5F97\u53BB\uFF0C\n \u6240\u4EE5\u53EA\u6709\u300C\u5149\u6807\u683C\u300D\u7559\u5728 Tab \u5E8F\u5217\u91CC\uFF08tabindex=0\uFF09\uFF0C\u5176\u4F59 -1\uFF0C\u65B9\u5411\u952E\u5728\u7EC4\u5185\u79FB\u52A8\u3002\n "),
|
|
532
|
+
_createElementVNode("div", _hoisted_10, [
|
|
533
|
+
(_openBlock(true), _createElementBlock(
|
|
534
|
+
_Fragment,
|
|
535
|
+
null,
|
|
536
|
+
_renderList(cells.value, (c) => {
|
|
537
|
+
return _openBlock(), _createElementBlock("button", {
|
|
538
|
+
key: c.key,
|
|
539
|
+
type: "button",
|
|
540
|
+
class: _normalizeClass(["wd-calendar__cell", {
|
|
541
|
+
"is-out": !c.inMonth,
|
|
542
|
+
"is-today": c.isToday,
|
|
543
|
+
"is-selected": c.isSelected,
|
|
544
|
+
"is-disabled": c.disabled,
|
|
545
|
+
"is-range-start": c.isRangeStart,
|
|
546
|
+
"is-range-end": c.isRangeEnd,
|
|
547
|
+
"in-range": c.inRange && !c.isRangeStart && !c.isRangeEnd,
|
|
548
|
+
"is-cursor": c.key === cursor.value
|
|
549
|
+
}]),
|
|
550
|
+
role: "gridcell",
|
|
551
|
+
"aria-selected": c.isSelected || c.isRangeStart || c.isRangeEnd,
|
|
552
|
+
disabled: c.disabled,
|
|
553
|
+
tabindex: c.key === cursor.value ? 0 : -1,
|
|
554
|
+
onFocus: ($event) => cursor.value = c.key,
|
|
555
|
+
onClick: ($event) => pick(c)
|
|
556
|
+
}, [
|
|
557
|
+
_createElementVNode(
|
|
558
|
+
"span",
|
|
559
|
+
_hoisted_12,
|
|
560
|
+
_toDisplayString(c.day),
|
|
561
|
+
1
|
|
562
|
+
/* TEXT */
|
|
563
|
+
),
|
|
564
|
+
_createCommentVNode(" \u4ECA\u5929\uFF1A\u5E95\u90E8\u5706\u89D2\u77ED\u6A2A\u7EBF\uFF08\u538B\u5728\u6587\u5B57\u5C42\u4E0A\uFF0C\u4E0D\u5360\u4F4D\uFF09 "),
|
|
565
|
+
c.isToday ? (_openBlock(), _createElementBlock("span", _hoisted_13)) : _createCommentVNode("v-if", true),
|
|
566
|
+
_createCommentVNode(" \u5E95\u90E8\u9644\u5C5E\u6587\u5B57\uFF08\u519C\u5386/\u8282\u5047\u65E5\uFF09\uFF1A\u7EDD\u5BF9\u5B9A\u4F4D\uFF0C\u4E0D\u5360\u4F4D\uFF0C\u4E0D\u5F71\u54CD\u884C\u9AD8 "),
|
|
567
|
+
c.text ? (_openBlock(), _createElementBlock(
|
|
568
|
+
"span",
|
|
569
|
+
_hoisted_14,
|
|
570
|
+
_toDisplayString(c.text),
|
|
571
|
+
1
|
|
572
|
+
/* TEXT */
|
|
573
|
+
)) : _createCommentVNode("v-if", true),
|
|
574
|
+
_createCommentVNode("\n \u6807\u8BB0\u70B9\uFF1A\u53F3\u4E0A\u89D2\uFF0C\u6700\u591A 3 \u4E2A\uFF0C\u8D85\u51FA +N\n "),
|
|
575
|
+
c.marks.length ? (_openBlock(), _createElementBlock("span", _hoisted_15, [
|
|
576
|
+
(_openBlock(true), _createElementBlock(
|
|
577
|
+
_Fragment,
|
|
578
|
+
null,
|
|
579
|
+
_renderList(c.marks.slice(0, 3), (m, i) => {
|
|
580
|
+
return _openBlock(), _createElementBlock(
|
|
581
|
+
"i",
|
|
582
|
+
{
|
|
583
|
+
key: i,
|
|
584
|
+
class: "wd-calendar__mark",
|
|
585
|
+
style: _normalizeStyle({
|
|
586
|
+
background: m.color || "var(--wd-red)",
|
|
587
|
+
width: __props.markSize + "px",
|
|
588
|
+
height: __props.markSize + "px"
|
|
589
|
+
})
|
|
590
|
+
},
|
|
591
|
+
null,
|
|
592
|
+
4
|
|
593
|
+
/* STYLE */
|
|
594
|
+
);
|
|
595
|
+
}),
|
|
596
|
+
128
|
|
597
|
+
/* KEYED_FRAGMENT */
|
|
598
|
+
)),
|
|
599
|
+
c.marks.length > 3 ? (_openBlock(), _createElementBlock(
|
|
600
|
+
"span",
|
|
601
|
+
_hoisted_16,
|
|
602
|
+
" +" + _toDisplayString(c.marks.length - 3),
|
|
603
|
+
1
|
|
604
|
+
/* TEXT */
|
|
605
|
+
)) : _createCommentVNode("v-if", true)
|
|
606
|
+
])) : _createCommentVNode("v-if", true)
|
|
607
|
+
], 42, _hoisted_11);
|
|
608
|
+
}),
|
|
609
|
+
128
|
|
610
|
+
/* KEYED_FRAGMENT */
|
|
611
|
+
))
|
|
612
|
+
]),
|
|
613
|
+
_createCommentVNode(" \u5E95\u90E8\u64CD\u4F5C "),
|
|
614
|
+
__props.clearable || __props.showToday ? (_openBlock(), _createElementBlock("div", _hoisted_17, [
|
|
615
|
+
__props.clearable ? (_openBlock(), _createElementBlock("button", {
|
|
616
|
+
key: 0,
|
|
617
|
+
type: "button",
|
|
618
|
+
class: "wd-calendar__action",
|
|
619
|
+
onClick: clear
|
|
620
|
+
}, "\u6E05\u7A7A")) : _createCommentVNode("v-if", true),
|
|
621
|
+
__props.showToday ? (_openBlock(), _createElementBlock("button", {
|
|
622
|
+
key: 1,
|
|
623
|
+
type: "button",
|
|
624
|
+
class: "wd-calendar__action",
|
|
625
|
+
onClick: goToday
|
|
626
|
+
}, "\u4ECA\u5929")) : _createCommentVNode("v-if", true)
|
|
627
|
+
])) : _createCommentVNode("v-if", true),
|
|
628
|
+
__props.loading ? (_openBlock(), _createElementBlock("div", _hoisted_18, [
|
|
629
|
+
_createVNode(WdSpinner_default, { size: "sm" }),
|
|
630
|
+
_cache[4] || (_cache[4] = _createElementVNode(
|
|
631
|
+
"span",
|
|
632
|
+
null,
|
|
633
|
+
"\u52A0\u8F7D\u4E2D\u2026",
|
|
634
|
+
-1
|
|
635
|
+
/* CACHED */
|
|
636
|
+
))
|
|
637
|
+
])) : _createCommentVNode("v-if", true)
|
|
638
|
+
], 16, _hoisted_1);
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
export {
|
|
644
|
+
WdCalendar_default
|
|
645
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// .lib-build/controllable.ts
|
|
2
|
+
import { computed, getCurrentInstance, ref, watch } from "vue";
|
|
3
|
+
function useControllable(opts) {
|
|
4
|
+
const { modelValue, defaultValue, fallback, onChange } = opts;
|
|
5
|
+
const inst = getCurrentInstance();
|
|
6
|
+
const providedAtSetup = (() => {
|
|
7
|
+
if (opts.isProvided) return null;
|
|
8
|
+
const vp = inst?.vnode?.props;
|
|
9
|
+
if (!vp) return modelValue.value !== void 0;
|
|
10
|
+
return "modelValue" in vp || "model-value" in vp;
|
|
11
|
+
})();
|
|
12
|
+
const controlled = computed(
|
|
13
|
+
() => opts.isProvided ? opts.isProvided() : !!providedAtSetup
|
|
14
|
+
);
|
|
15
|
+
const inner = ref(
|
|
16
|
+
defaultValue?.value !== void 0 ? defaultValue.value : fallback
|
|
17
|
+
);
|
|
18
|
+
const value = computed(() => controlled.value ? modelValue.value : inner.value);
|
|
19
|
+
function set(next) {
|
|
20
|
+
if (!controlled.value) inner.value = next;
|
|
21
|
+
onChange?.(next);
|
|
22
|
+
}
|
|
23
|
+
watch(
|
|
24
|
+
() => modelValue.value,
|
|
25
|
+
(v) => {
|
|
26
|
+
if (controlled.value && v !== void 0) inner.value = v;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
watch(
|
|
30
|
+
() => defaultValue?.value,
|
|
31
|
+
(v) => {
|
|
32
|
+
if (!controlled.value && v !== void 0) inner.value = v;
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
return { value, set, controlled, inner };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
useControllable
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// .lib-build/pop-duration.ts
|
|
2
|
+
var reduce = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3
|
+
function popDuration(enter = 200, leave = 140) {
|
|
4
|
+
return reduce() ? { enter: 1, leave: 1 } : { enter, leave };
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
popDuration
|
|
9
|
+
};
|