yc-design-vue 2.2.6 → 2.2.9
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/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/es/Anchor/Anchor.vue.d.ts +1 -1
- package/es/Anchor/index.d.ts +3 -3
- package/es/Breadcrumb/BreadcrumbSeparator.vue.js +1 -1
- package/es/DatePicker/{YcDatePicker.vue.d.ts → DatePicker.vue.d.ts} +2 -2
- package/es/DatePicker/DatePicker.vue.js +335 -0
- package/es/DatePicker/DatePicker.vue3.js +5 -0
- package/es/DatePicker/{YcMonthPicker.vue.js → MonthPicker.vue.js} +75 -69
- package/es/DatePicker/MonthPicker.vue3.js +5 -0
- package/es/DatePicker/WeekPicker.vue.js +301 -0
- package/es/DatePicker/WeekPicker.vue3.js +5 -0
- package/es/DatePicker/{YcYearPicker.vue.js → YearPicker.vue.js} +57 -54
- package/es/DatePicker/YearPicker.vue3.js +5 -0
- package/es/DatePicker/component/PickerPanel.vue.d.ts +2 -0
- package/es/DatePicker/component/PickerPanel.vue.js +26 -29
- package/es/DatePicker/hooks/useContext.js +1 -1
- package/es/DatePicker/hooks/userPicker.d.ts +3 -0
- package/es/DatePicker/hooks/userPicker.js +27 -2
- package/es/DatePicker/index.css +3 -3
- package/es/DatePicker/index.d.ts +7 -7
- package/es/DatePicker/index.js +8 -8
- package/es/DatePicker/type.d.ts +5 -5
- package/es/TimePicker/TimePicker.vue.d.ts +5 -98
- package/es/TimePicker/TimePicker.vue.js +20 -15
- package/es/TimePicker/TimePickerPanel.vue.d.ts +1 -3
- package/es/TimePicker/TimePickerPanel.vue.js +89 -56
- package/es/TimePicker/hooks/useContext.d.ts +6 -0
- package/es/TimePicker/hooks/useContext.js +9 -0
- package/es/TimePicker/index.css +1 -1
- package/es/TimePicker/index.d.ts +10 -49
- package/es/TimePicker/type.d.ts +3 -0
- package/es/Transfer/TransferPanel.vue.js +1 -1
- package/es/Typography/TypographyBase.vue.js +2 -2
- package/es/Upload/UploadFileList.vue.js +1 -1
- package/es/Upload/UploadPictureCard.vue.js +1 -1
- package/es/_shared/icons/IconCopy.vue.js +24 -1
- package/es/_shared/icons/IconCopy.vue2.js +1 -24
- package/es/_shared/icons/IconDelete.vue.js +1 -24
- package/es/_shared/icons/IconDelete.vue2.js +24 -1
- package/es/_shared/icons/IconEdit.vue.js +24 -1
- package/es/_shared/icons/IconEdit.vue2.js +1 -24
- package/es/_shared/icons/IconSeparator.vue.js +1 -24
- package/es/_shared/icons/IconSeparator.vue2.js +24 -1
- package/es/index.d.ts +6 -6
- package/es/index.js +4 -4
- package/es/style.css +1 -1
- package/lib/Anchor/Anchor.vue.d.ts +1 -1
- package/lib/Anchor/index.d.ts +3 -3
- package/lib/Breadcrumb/BreadcrumbSeparator.vue.js +1 -1
- package/lib/DatePicker/{YcDatePicker.vue.d.ts → DatePicker.vue.d.ts} +2 -2
- package/lib/DatePicker/DatePicker.vue.js +1 -0
- package/lib/DatePicker/DatePicker.vue3.js +1 -0
- package/lib/DatePicker/MonthPicker.vue.js +1 -0
- package/lib/DatePicker/MonthPicker.vue3.js +1 -0
- package/lib/DatePicker/WeekPicker.vue.js +1 -0
- package/lib/DatePicker/WeekPicker.vue3.js +1 -0
- package/lib/DatePicker/YearPicker.vue.js +1 -0
- package/lib/DatePicker/{YcDatePicker.vue3.js → YearPicker.vue3.js} +1 -1
- package/lib/DatePicker/component/PickerPanel.vue.d.ts +2 -0
- package/lib/DatePicker/component/PickerPanel.vue.js +1 -1
- package/lib/DatePicker/hooks/useContext.js +1 -1
- package/lib/DatePicker/hooks/userPicker.d.ts +3 -0
- package/lib/DatePicker/hooks/userPicker.js +1 -1
- package/lib/DatePicker/index.css +3 -3
- package/lib/DatePicker/index.d.ts +7 -7
- package/lib/DatePicker/index.js +1 -1
- package/lib/DatePicker/type.d.ts +5 -5
- package/lib/TimePicker/TimePicker.vue.d.ts +5 -98
- package/lib/TimePicker/TimePicker.vue.js +1 -1
- package/lib/TimePicker/TimePickerPanel.vue.d.ts +1 -3
- package/lib/TimePicker/TimePickerPanel.vue.js +1 -1
- package/lib/TimePicker/hooks/useContext.d.ts +6 -0
- package/lib/TimePicker/hooks/useContext.js +1 -1
- package/lib/TimePicker/index.css +1 -1
- package/lib/TimePicker/index.d.ts +10 -49
- package/lib/TimePicker/type.d.ts +3 -0
- package/lib/Transfer/TransferPanel.vue.js +1 -1
- package/lib/Typography/TypographyBase.vue.js +1 -1
- package/lib/Upload/UploadFileList.vue.js +1 -1
- package/lib/Upload/UploadPictureCard.vue.js +1 -1
- package/lib/_shared/icons/IconCopy.vue.js +1 -1
- package/lib/_shared/icons/IconCopy.vue2.js +1 -1
- package/lib/_shared/icons/IconDelete.vue.js +1 -1
- package/lib/_shared/icons/IconDelete.vue2.js +1 -1
- package/lib/_shared/icons/IconEdit.vue.js +1 -1
- package/lib/_shared/icons/IconEdit.vue2.js +1 -1
- package/lib/_shared/icons/IconSeparator.vue.js +1 -1
- package/lib/_shared/icons/IconSeparator.vue2.js +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/es/DatePicker/YcDatePicker.vue.js +0 -298
- package/es/DatePicker/YcDatePicker.vue3.js +0 -5
- package/es/DatePicker/YcMonthPicker.vue3.js +0 -5
- package/es/DatePicker/YcWeekPicker.vue.js +0 -295
- package/es/DatePicker/YcWeekPicker.vue3.js +0 -5
- package/es/DatePicker/YcYearPicker.vue3.js +0 -5
- package/lib/DatePicker/YcDatePicker.vue.js +0 -1
- package/lib/DatePicker/YcMonthPicker.vue.js +0 -1
- package/lib/DatePicker/YcMonthPicker.vue3.js +0 -1
- package/lib/DatePicker/YcWeekPicker.vue.js +0 -1
- package/lib/DatePicker/YcWeekPicker.vue3.js +0 -1
- package/lib/DatePicker/YcYearPicker.vue.js +0 -1
- package/lib/DatePicker/YcYearPicker.vue3.js +0 -1
- package/{lib/DatePicker/YcMonthPicker.vue.d.ts → es/DatePicker/MonthPicker.vue.d.ts} +1 -1
- package/{lib/DatePicker/YcWeekPicker.vue.d.ts → es/DatePicker/WeekPicker.vue.d.ts} +1 -1
- package/es/DatePicker/{YcYearPicker.vue.d.ts → YearPicker.vue.d.ts} +1 -1
- package/{es/DatePicker/YcMonthPicker.vue.d.ts → lib/DatePicker/MonthPicker.vue.d.ts} +1 -1
- package/{es/DatePicker/YcWeekPicker.vue.d.ts → lib/DatePicker/WeekPicker.vue.d.ts} +1 -1
- package/lib/DatePicker/{YcYearPicker.vue.d.ts → YearPicker.vue.d.ts} +1 -1
@@ -0,0 +1,301 @@
|
|
1
|
+
import { defineComponent, useSlots, ref, watch, createElementBlock, openBlock, Fragment, createVNode, createBlock, unref, withCtx, createSlots, createElementVNode, renderSlot, renderList, normalizeClass, normalizeStyle } from "vue";
|
2
|
+
import usePicker from "./hooks/userPicker.js";
|
3
|
+
import "../node_modules/b-tween/dist/b-tween.es.js";
|
4
|
+
import dayjs from "../node_modules/dayjs/dayjs.min.js";
|
5
|
+
import "../node_modules/tinycolor2/esm/tinycolor.js";
|
6
|
+
import "../_shared/utils/dom.js";
|
7
|
+
import "../_shared/utils/locale.js";
|
8
|
+
import "../_shared/utils/time.js";
|
9
|
+
import _sfc_main$4 from "./component/PickerHeader.vue.js";
|
10
|
+
/* empty css */
|
11
|
+
import _sfc_main$5 from "./component/PickerWeekHeader.vue.js";
|
12
|
+
/* empty css */
|
13
|
+
import _sfc_main$6 from "./component/PickerCell.vue.js";
|
14
|
+
/* empty css */
|
15
|
+
import _sfc_main$1 from "./component/PickerPanel.vue.js";
|
16
|
+
/* empty css */
|
17
|
+
import _sfc_main$7 from "./component/PickerInput.vue.js";
|
18
|
+
/* empty css */
|
19
|
+
import _sfc_main$2 from "./YearPicker.vue.js";
|
20
|
+
/* empty css */
|
21
|
+
import _sfc_main$3 from "./MonthPicker.vue.js";
|
22
|
+
/* empty css */
|
23
|
+
const _hoisted_1 = {
|
24
|
+
key: 2,
|
25
|
+
class: "yc-panel-week"
|
26
|
+
};
|
27
|
+
const _hoisted_2 = { class: "yc-panel-week-inner" };
|
28
|
+
const _hoisted_3 = { class: "yc-picker-body" };
|
29
|
+
const _hoisted_4 = ["onClick"];
|
30
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
31
|
+
...{
|
32
|
+
name: "WeekPicker",
|
33
|
+
inheritAttrs: false
|
34
|
+
},
|
35
|
+
__name: "WeekPicker",
|
36
|
+
props: {
|
37
|
+
modelValue: { default: void 0 },
|
38
|
+
defaultValue: { default: "" },
|
39
|
+
dayStartOfWeek: { default: 0 },
|
40
|
+
locale: { default: () => ({}) },
|
41
|
+
hideTrigger: { type: Boolean, default: false },
|
42
|
+
allowClear: { type: Boolean, default: false },
|
43
|
+
readonly: { type: Boolean, default: false },
|
44
|
+
error: { type: Boolean, default: false },
|
45
|
+
size: { default: void 0 },
|
46
|
+
shortcuts: { default: () => [] },
|
47
|
+
shortcutsPosition: { default: "bottom" },
|
48
|
+
position: { default: "bl" },
|
49
|
+
popupVisible: { type: Boolean, default: void 0 },
|
50
|
+
defaultPopupVisible: { type: Boolean, default: false },
|
51
|
+
triggerProps: { default: () => ({}) },
|
52
|
+
unmountOnClose: { type: Boolean, default: false },
|
53
|
+
placeholder: { default: "" },
|
54
|
+
disabled: { type: Boolean, default: false },
|
55
|
+
disabledDate: { type: Function, default: void 0 },
|
56
|
+
disabledTime: {},
|
57
|
+
pickerValue: { default: void 0 },
|
58
|
+
defaultPickerValue: { default: "" },
|
59
|
+
popupContainer: { default: void 0 },
|
60
|
+
valueFormat: { default: "YYYY-MM-DD" },
|
61
|
+
format: { default: "gggg-wo" },
|
62
|
+
previewShortcut: { type: Boolean, default: true },
|
63
|
+
showConfirmBtn: { type: Boolean, default: false },
|
64
|
+
disabledInput: { type: Boolean, default: false },
|
65
|
+
abbreviation: { type: Boolean, default: true }
|
66
|
+
},
|
67
|
+
emits: ["update:modelValue", "update:popupVisible", "update:pickerValue", "change", "select", "ok", "picker-value-change", "popup-visible-change", "clear", "select-shortcut"],
|
68
|
+
setup(__props, { emit: __emit }) {
|
69
|
+
const $slots = useSlots();
|
70
|
+
const props = __props;
|
71
|
+
const emits = __emit;
|
72
|
+
const {
|
73
|
+
computedValue,
|
74
|
+
locale,
|
75
|
+
abbreviation,
|
76
|
+
dayStartOfWeek,
|
77
|
+
curMonth,
|
78
|
+
curYear,
|
79
|
+
showMonthPicker,
|
80
|
+
showYearPicker,
|
81
|
+
DefinePanel,
|
82
|
+
ReusePanel,
|
83
|
+
getDateFromFormat,
|
84
|
+
isCellInView,
|
85
|
+
isToday,
|
86
|
+
isSelected,
|
87
|
+
getWeeksOfMonth,
|
88
|
+
handleConfirm,
|
89
|
+
handleSelect,
|
90
|
+
handleShortcut
|
91
|
+
} = usePicker({
|
92
|
+
props,
|
93
|
+
emits
|
94
|
+
});
|
95
|
+
const weekData = ref([]);
|
96
|
+
const handleDateChange = (dateType, type) => {
|
97
|
+
if (dateType == "year") {
|
98
|
+
curYear.value = type == "pre" ? curYear.value - 1 : curYear.value + 1;
|
99
|
+
weekData.value = getWeeksOfMonth(curYear.value, curMonth.value);
|
100
|
+
} else {
|
101
|
+
const base = dayjs().set("year", curYear.value).set("month", curMonth.value);
|
102
|
+
const date = type == "pre" ? base.subtract(1, "month") : base.add(1, "month");
|
103
|
+
curYear.value = date.year();
|
104
|
+
curMonth.value = date.month();
|
105
|
+
weekData.value = getWeeksOfMonth(curYear.value, curMonth.value);
|
106
|
+
}
|
107
|
+
};
|
108
|
+
watch(
|
109
|
+
() => computedValue.value,
|
110
|
+
(val) => {
|
111
|
+
const date = val ? getDateFromFormat(val) : /* @__PURE__ */ new Date();
|
112
|
+
curYear.value = date.getFullYear();
|
113
|
+
curMonth.value = date.getMonth();
|
114
|
+
weekData.value = getWeeksOfMonth(curYear.value, curMonth.value);
|
115
|
+
},
|
116
|
+
{
|
117
|
+
immediate: true
|
118
|
+
}
|
119
|
+
);
|
120
|
+
return (_ctx, _cache) => {
|
121
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
122
|
+
createVNode(unref(DefinePanel), null, {
|
123
|
+
default: withCtx(() => [
|
124
|
+
createVNode(_sfc_main$1, {
|
125
|
+
locale: unref(locale),
|
126
|
+
"preview-shortcut": _ctx.previewShortcut,
|
127
|
+
shortcuts: _ctx.shortcuts,
|
128
|
+
"shortcuts-position": _ctx.shortcutsPosition,
|
129
|
+
"confirm-btn-disabled": !unref(computedValue),
|
130
|
+
"show-confirm-btn": _ctx.showConfirmBtn,
|
131
|
+
"show-footer": !unref(showYearPicker) && !unref(showMonthPicker),
|
132
|
+
onConfirm: unref(handleConfirm),
|
133
|
+
onShortcutSelect: unref(handleShortcut)
|
134
|
+
}, createSlots({
|
135
|
+
default: withCtx(() => [
|
136
|
+
unref(showYearPicker) ? (openBlock(), createBlock(_sfc_main$2, {
|
137
|
+
key: 0,
|
138
|
+
"model-value": `${unref(curYear)}`,
|
139
|
+
"hide-trigger": "",
|
140
|
+
"value-format": "YYYY",
|
141
|
+
onChange: _cache[0] || (_cache[0] = (_, date) => {
|
142
|
+
curYear.value = date.getFullYear();
|
143
|
+
weekData.value = unref(getWeeksOfMonth)(unref(curYear), unref(curMonth));
|
144
|
+
showYearPicker.value = false;
|
145
|
+
})
|
146
|
+
}, null, 8, ["model-value"])) : unref(showMonthPicker) ? (openBlock(), createBlock(_sfc_main$3, {
|
147
|
+
key: 1,
|
148
|
+
"model-value": `${unref(curYear)}-${unref(curMonth) + 1 < 10 ? `0${unref(curMonth) + 1}` : unref(curMonth) + 1}`,
|
149
|
+
"hide-trigger": "",
|
150
|
+
"value-format": "YYYY-MM",
|
151
|
+
onChange: _cache[1] || (_cache[1] = (_, date) => {
|
152
|
+
curMonth.value = date.getMonth();
|
153
|
+
weekData.value = unref(getWeeksOfMonth)(unref(curYear), unref(curMonth));
|
154
|
+
showMonthPicker.value = false;
|
155
|
+
})
|
156
|
+
}, null, 8, ["model-value"])) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
157
|
+
createElementVNode("div", _hoisted_2, [
|
158
|
+
createVNode(_sfc_main$4, {
|
159
|
+
year: unref(curYear),
|
160
|
+
month: unref(curMonth),
|
161
|
+
type: "week",
|
162
|
+
onPrevClick: _cache[2] || (_cache[2] = ($event) => handleDateChange("month", "pre")),
|
163
|
+
onNextClick: _cache[3] || (_cache[3] = ($event) => handleDateChange("month", "next")),
|
164
|
+
onPrevDoubleClick: _cache[4] || (_cache[4] = ($event) => handleDateChange("year", "pre")),
|
165
|
+
onNextDoubleClick: _cache[5] || (_cache[5] = ($event) => handleDateChange("year", "next")),
|
166
|
+
onYearClick: _cache[6] || (_cache[6] = ($event) => showYearPicker.value = true),
|
167
|
+
onMonthClick: _cache[7] || (_cache[7] = ($event) => showMonthPicker.value = true)
|
168
|
+
}, createSlots({ _: 2 }, [
|
169
|
+
$slots["icon-prev"] ? {
|
170
|
+
name: "icon-prev-double",
|
171
|
+
fn: withCtx(() => [
|
172
|
+
renderSlot(_ctx.$slots, "icon-next")
|
173
|
+
]),
|
174
|
+
key: "0"
|
175
|
+
} : void 0,
|
176
|
+
$slots["icon-next"] ? {
|
177
|
+
name: "icon-next-double",
|
178
|
+
fn: withCtx(() => [
|
179
|
+
renderSlot(_ctx.$slots, "icon-next")
|
180
|
+
]),
|
181
|
+
key: "1"
|
182
|
+
} : void 0,
|
183
|
+
$slots["icon-prev-double"] ? {
|
184
|
+
name: "icon-prev-double",
|
185
|
+
fn: withCtx(() => [
|
186
|
+
renderSlot(_ctx.$slots, "icon-next-double")
|
187
|
+
]),
|
188
|
+
key: "2"
|
189
|
+
} : void 0,
|
190
|
+
$slots["icon-next-double"] ? {
|
191
|
+
name: "icon-next-double",
|
192
|
+
fn: withCtx(() => [
|
193
|
+
renderSlot(_ctx.$slots, "icon-next-double")
|
194
|
+
]),
|
195
|
+
key: "3"
|
196
|
+
} : void 0
|
197
|
+
]), 1032, ["year", "month"]),
|
198
|
+
createVNode(_sfc_main$5, {
|
199
|
+
locale: unref(locale),
|
200
|
+
abbreviation: unref(abbreviation),
|
201
|
+
"day-start-of-week": unref(dayStartOfWeek)
|
202
|
+
}, null, 8, ["locale", "abbreviation", "day-start-of-week"]),
|
203
|
+
createElementVNode("div", _hoisted_3, [
|
204
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(weekData.value, ({ label, time, value }, i) => {
|
205
|
+
var _a;
|
206
|
+
return openBlock(), createElementBlock("div", {
|
207
|
+
key: i,
|
208
|
+
class: normalizeClass([
|
209
|
+
"yc-picker-row",
|
210
|
+
"yc-picker-week-row",
|
211
|
+
{
|
212
|
+
"yc-picker-week-row-disabled": (_a = _ctx.disabledDate) == null ? void 0 : _a.call(_ctx, value),
|
213
|
+
"yc-picker-week-row-selected": unref(isSelected)(value, "week")
|
214
|
+
}
|
215
|
+
]),
|
216
|
+
onClick: ($event) => unref(handleSelect)(value)
|
217
|
+
}, [
|
218
|
+
createVNode(_sfc_main$6, {
|
219
|
+
"cell-in-view": false,
|
220
|
+
value: label
|
221
|
+
}, null, 8, ["value"]),
|
222
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(time, ({ value: date, label: label2 }, k) => {
|
223
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
224
|
+
key: k,
|
225
|
+
value: label2,
|
226
|
+
"cell-in-view": unref(isCellInView)(date, "week"),
|
227
|
+
"is-today": unref(isToday)(date, "week"),
|
228
|
+
hoverable: false,
|
229
|
+
class: normalizeClass({
|
230
|
+
"yc-week-picker-cell-first": !i,
|
231
|
+
"yc-week-picker-cell-last": i == time.length - 1
|
232
|
+
})
|
233
|
+
}, createSlots({ _: 2 }, [
|
234
|
+
$slots.cell ? {
|
235
|
+
name: "cell",
|
236
|
+
fn: withCtx(() => [
|
237
|
+
renderSlot(_ctx.$slots, "cell", { date })
|
238
|
+
]),
|
239
|
+
key: "0"
|
240
|
+
} : void 0
|
241
|
+
]), 1032, ["value", "cell-in-view", "is-today", "class"]);
|
242
|
+
}), 128))
|
243
|
+
], 10, _hoisted_4);
|
244
|
+
}), 128))
|
245
|
+
])
|
246
|
+
])
|
247
|
+
]))
|
248
|
+
]),
|
249
|
+
_: 2
|
250
|
+
}, [
|
251
|
+
$slots.extra ? {
|
252
|
+
name: "extra",
|
253
|
+
fn: withCtx(() => [
|
254
|
+
renderSlot(_ctx.$slots, "extra")
|
255
|
+
]),
|
256
|
+
key: "0"
|
257
|
+
} : void 0
|
258
|
+
]), 1032, ["locale", "preview-shortcut", "shortcuts", "shortcuts-position", "confirm-btn-disabled", "show-confirm-btn", "show-footer", "onConfirm", "onShortcutSelect"])
|
259
|
+
]),
|
260
|
+
_: 3
|
261
|
+
}),
|
262
|
+
!_ctx.hideTrigger ? (openBlock(), createBlock(_sfc_main$7, {
|
263
|
+
key: 0,
|
264
|
+
class: normalizeClass(_ctx.$attrs.class),
|
265
|
+
style: normalizeStyle(_ctx.$attrs.style),
|
266
|
+
type: "week"
|
267
|
+
}, createSlots({
|
268
|
+
content: withCtx(() => [
|
269
|
+
createVNode(unref(ReusePanel))
|
270
|
+
]),
|
271
|
+
_: 2
|
272
|
+
}, [
|
273
|
+
$slots.default ? {
|
274
|
+
name: "trigger",
|
275
|
+
fn: withCtx(() => [
|
276
|
+
renderSlot(_ctx.$slots, "default")
|
277
|
+
]),
|
278
|
+
key: "0"
|
279
|
+
} : void 0,
|
280
|
+
$slots["suffix-icon"] ? {
|
281
|
+
name: "suffix-icon",
|
282
|
+
fn: withCtx(() => [
|
283
|
+
renderSlot(_ctx.$slots, "suffix-icon")
|
284
|
+
]),
|
285
|
+
key: "1"
|
286
|
+
} : void 0,
|
287
|
+
$slots.prefix ? {
|
288
|
+
name: "prefix",
|
289
|
+
fn: withCtx(() => [
|
290
|
+
renderSlot(_ctx.$slots, "prefix")
|
291
|
+
]),
|
292
|
+
key: "2"
|
293
|
+
} : void 0
|
294
|
+
]), 1032, ["class", "style"])) : (openBlock(), createBlock(unref(ReusePanel), { key: 1 }))
|
295
|
+
], 64);
|
296
|
+
};
|
297
|
+
}
|
298
|
+
});
|
299
|
+
export {
|
300
|
+
_sfc_main as default
|
301
|
+
};
|
@@ -9,13 +9,14 @@ import _sfc_main$1 from "./component/PickerPanel.vue.js";
|
|
9
9
|
import _sfc_main$4 from "./component/PickerInput.vue.js";
|
10
10
|
/* empty css */
|
11
11
|
const _hoisted_1 = { class: "yc-panel-year" };
|
12
|
-
const _hoisted_2 = { class: "yc-
|
12
|
+
const _hoisted_2 = { class: "yc-panel-year-inner" };
|
13
|
+
const _hoisted_3 = { class: "yc-picker-body" };
|
13
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
14
15
|
...{
|
15
16
|
name: "YearPicker",
|
16
17
|
inheritAttrs: false
|
17
18
|
},
|
18
|
-
__name: "
|
19
|
+
__name: "YearPicker",
|
19
20
|
props: {
|
20
21
|
modelValue: { default: void 0 },
|
21
22
|
defaultValue: { default: "" },
|
@@ -102,59 +103,61 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
102
103
|
}, createSlots({
|
103
104
|
default: withCtx(() => [
|
104
105
|
createElementVNode("div", _hoisted_1, [
|
105
|
-
createVNode(_sfc_main$2, {
|
106
|
-
type: "year",
|
107
|
-
onPrevDoubleClick: _cache[0] || (_cache[0] = ($event) => handleYearChange("pre")),
|
108
|
-
onNextDoubleClick: _cache[1] || (_cache[1] = ($event) => handleYearChange("next"))
|
109
|
-
}, createSlots({
|
110
|
-
default: withCtx(() => [
|
111
|
-
createTextVNode(toDisplayString(unref(curYear)) + "-" + toDisplayString(unref(curYear) + 10) + " ", 1)
|
112
|
-
]),
|
113
|
-
_: 2
|
114
|
-
}, [
|
115
|
-
$slots["icon-prev-double"] ? {
|
116
|
-
name: "icon-prev-double",
|
117
|
-
fn: withCtx(() => [
|
118
|
-
renderSlot(_ctx.$slots, "icon-next-double")
|
119
|
-
]),
|
120
|
-
key: "0"
|
121
|
-
} : void 0,
|
122
|
-
$slots["icon-next-double"] ? {
|
123
|
-
name: "icon-next-double",
|
124
|
-
fn: withCtx(() => [
|
125
|
-
renderSlot(_ctx.$slots, "icon-next-double")
|
126
|
-
]),
|
127
|
-
key: "1"
|
128
|
-
} : void 0
|
129
|
-
]), 1024),
|
130
106
|
createElementVNode("div", _hoisted_2, [
|
131
|
-
(
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
107
|
+
createVNode(_sfc_main$2, {
|
108
|
+
type: "year",
|
109
|
+
onPrevDoubleClick: _cache[0] || (_cache[0] = ($event) => handleYearChange("pre")),
|
110
|
+
onNextDoubleClick: _cache[1] || (_cache[1] = ($event) => handleYearChange("next"))
|
111
|
+
}, createSlots({
|
112
|
+
default: withCtx(() => [
|
113
|
+
createTextVNode(toDisplayString(unref(curYear)) + "-" + toDisplayString(unref(curYear) + 10) + " ", 1)
|
114
|
+
]),
|
115
|
+
_: 2
|
116
|
+
}, [
|
117
|
+
$slots["icon-prev-double"] ? {
|
118
|
+
name: "icon-prev-double",
|
119
|
+
fn: withCtx(() => [
|
120
|
+
renderSlot(_ctx.$slots, "icon-next-double")
|
121
|
+
]),
|
122
|
+
key: "0"
|
123
|
+
} : void 0,
|
124
|
+
$slots["icon-next-double"] ? {
|
125
|
+
name: "icon-next-double",
|
126
|
+
fn: withCtx(() => [
|
127
|
+
renderSlot(_ctx.$slots, "icon-next-double")
|
128
|
+
]),
|
129
|
+
key: "1"
|
130
|
+
} : void 0
|
131
|
+
]), 1024),
|
132
|
+
createElementVNode("div", _hoisted_3, [
|
133
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(yearData.value, (row, i) => {
|
134
|
+
return openBlock(), createElementBlock("div", {
|
135
|
+
key: i,
|
136
|
+
class: "yc-picker-row"
|
137
|
+
}, [
|
138
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(row, ({ value: date, label }, k) => {
|
139
|
+
var _a;
|
140
|
+
return openBlock(), createBlock(_sfc_main$3, {
|
141
|
+
key: k,
|
142
|
+
value: label,
|
143
|
+
"cell-in-view": unref(isCellInView)(date, "year"),
|
144
|
+
"is-today": unref(isToday)(date, "year"),
|
145
|
+
"is-selected": unref(isSelected)(date, "year"),
|
146
|
+
disabled: (_a = _ctx.disabledDate) == null ? void 0 : _a.call(_ctx, date),
|
147
|
+
onClick: ($event) => unref(handleSelect)(date)
|
148
|
+
}, createSlots({ _: 2 }, [
|
149
|
+
$slots.cell ? {
|
150
|
+
name: "cell",
|
151
|
+
fn: withCtx(() => [
|
152
|
+
renderSlot(_ctx.$slots, "cell", { date })
|
153
|
+
]),
|
154
|
+
key: "0"
|
155
|
+
} : void 0
|
156
|
+
]), 1032, ["value", "cell-in-view", "is-today", "is-selected", "disabled", "onClick"]);
|
157
|
+
}), 128))
|
158
|
+
]);
|
159
|
+
}), 128))
|
160
|
+
])
|
158
161
|
])
|
159
162
|
])
|
160
163
|
]),
|
@@ -7,6 +7,7 @@ type __VLS_Props = {
|
|
7
7
|
confirmBtnDisabled: boolean;
|
8
8
|
showConfirmBtn: boolean;
|
9
9
|
showNow?: boolean;
|
10
|
+
showFooter?: boolean;
|
10
11
|
};
|
11
12
|
declare function __VLS_template(): {
|
12
13
|
attrs: Partial<{}>;
|
@@ -28,6 +29,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
28
29
|
"onShortcut-select"?: ((shortcut: ShortcutType, hover: boolean) => any) | undefined;
|
29
30
|
}>, {
|
30
31
|
showNow: boolean;
|
32
|
+
showFooter: boolean;
|
31
33
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
32
34
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
33
35
|
export default _default;
|
@@ -10,7 +10,10 @@ import { getSlotFunction } from "../../_shared/utils/vue-utils.js";
|
|
10
10
|
import Button from "../../Button/index.js";
|
11
11
|
import Link from "../../Link/index.js";
|
12
12
|
const _hoisted_1 = { class: "yc-picker-panel-wrapper" };
|
13
|
-
const _hoisted_2 = {
|
13
|
+
const _hoisted_2 = {
|
14
|
+
key: 0,
|
15
|
+
class: "yc-picker-footer"
|
16
|
+
};
|
14
17
|
const _hoisted_3 = {
|
15
18
|
key: 0,
|
16
19
|
class: "yc-picker-footer-extra-wrapper"
|
@@ -32,28 +35,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
32
35
|
previewShortcut: { type: Boolean },
|
33
36
|
confirmBtnDisabled: { type: Boolean },
|
34
37
|
showConfirmBtn: { type: Boolean },
|
35
|
-
showNow: { type: Boolean, default: false }
|
38
|
+
showNow: { type: Boolean, default: false },
|
39
|
+
showFooter: { type: Boolean, default: true }
|
36
40
|
},
|
37
41
|
emits: ["confirm", "now-click", "shortcut-select"],
|
38
42
|
setup(__props) {
|
39
|
-
const props = __props;
|
40
43
|
const { define: DefineShortcuts, reuse: ReuseShortcuts } = createReusableTemplate();
|
41
44
|
const { t } = useI18n();
|
42
|
-
const getOkText = () => {
|
43
|
-
var _a;
|
44
|
-
const key = "datePicker.ok";
|
45
|
-
return ((_a = props.locale) == null ? void 0 : _a[key]) || t(key);
|
46
|
-
};
|
47
|
-
const getTodayText = () => {
|
48
|
-
var _a;
|
49
|
-
const key = "datePicker.today";
|
50
|
-
return ((_a = props.locale) == null ? void 0 : _a[key]) || t(key);
|
51
|
-
};
|
52
|
-
const getNowText = () => {
|
53
|
-
var _a;
|
54
|
-
const key = "datePicker.now";
|
55
|
-
return ((_a = props.locale) == null ? void 0 : _a[key]) || t(key);
|
56
|
-
};
|
57
45
|
return (_ctx, _cache) => {
|
58
46
|
var _a, _b, _c, _d;
|
59
47
|
return openBlock(), createElementBlock("div", {
|
@@ -90,7 +78,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
90
78
|
["left", "right"].includes(_ctx.shortcutsPosition) && ((_a = _ctx.shortcuts) == null ? void 0 : _a.length) ? (openBlock(), createBlock(unref(ReuseShortcuts), { key: 0 })) : createCommentVNode("", true),
|
91
79
|
createElementVNode("div", _hoisted_1, [
|
92
80
|
renderSlot(_ctx.$slots, "default"),
|
93
|
-
|
81
|
+
_ctx.showFooter ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
94
82
|
_ctx.$slots.extra ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
95
83
|
renderSlot(_ctx.$slots, "extra")
|
96
84
|
])) : createCommentVNode("", true),
|
@@ -106,9 +94,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
106
94
|
size: "mini",
|
107
95
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("now-click"))
|
108
96
|
}, {
|
109
|
-
default: withCtx(() =>
|
110
|
-
|
111
|
-
|
97
|
+
default: withCtx(() => {
|
98
|
+
var _a2;
|
99
|
+
return [
|
100
|
+
createTextVNode(toDisplayString(((_a2 = _ctx.locale) == null ? void 0 : _a2["datePicker.now"]) || unref(t)("datePicker.now")), 1)
|
101
|
+
];
|
102
|
+
}),
|
112
103
|
_: 1
|
113
104
|
})) : createCommentVNode("", true),
|
114
105
|
_ctx.showConfirmBtn ? (openBlock(), createBlock(unref(Button), {
|
@@ -118,9 +109,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
118
109
|
size: "mini",
|
119
110
|
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("confirm", $event))
|
120
111
|
}, {
|
121
|
-
default: withCtx(() =>
|
122
|
-
|
123
|
-
|
112
|
+
default: withCtx(() => {
|
113
|
+
var _a2;
|
114
|
+
return [
|
115
|
+
createTextVNode(toDisplayString(((_a2 = _ctx.locale) == null ? void 0 : _a2["datePicker.ok"]) || unref(t)("datePicker.ok")), 1)
|
116
|
+
];
|
117
|
+
}),
|
124
118
|
_: 1
|
125
119
|
}, 8, ["disabled"])) : createCommentVNode("", true)
|
126
120
|
])) : createCommentVNode("", true),
|
@@ -128,13 +122,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
128
122
|
createVNode(unref(Link), {
|
129
123
|
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("now-click"))
|
130
124
|
}, {
|
131
|
-
default: withCtx(() =>
|
132
|
-
|
133
|
-
|
125
|
+
default: withCtx(() => {
|
126
|
+
var _a2;
|
127
|
+
return [
|
128
|
+
createTextVNode(toDisplayString(((_a2 = _ctx.locale) == null ? void 0 : _a2["datePicker.today"]) || unref(t)("datePicker.today")), 1)
|
129
|
+
];
|
130
|
+
}),
|
134
131
|
_: 1
|
135
132
|
})
|
136
133
|
])) : createCommentVNode("", true)
|
137
|
-
])
|
134
|
+
])) : createCommentVNode("", true)
|
138
135
|
])
|
139
136
|
], 2);
|
140
137
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { toRefs, provide, computed, inject, ref } from "vue";
|
2
|
-
const PICKER_TRIGGER_CONTEXT = "picker
|
2
|
+
const PICKER_TRIGGER_CONTEXT = "picker-context";
|
3
3
|
function usePickerInputContext() {
|
4
4
|
const provide$1 = (context, props) => {
|
5
5
|
const { computedVisible, computedValue, formatValue, emits } = context;
|
@@ -5,6 +5,7 @@ export default function usePicker(params: {
|
|
5
5
|
emits: BasePickerEmits;
|
6
6
|
}): {
|
7
7
|
formatValue: import('vue').ComputedRef<string>;
|
8
|
+
timePickerValue: import('vue').WritableComputedRef<DatePickerValue, DatePickerValue>;
|
8
9
|
computedValue: import('vue').WritableComputedRef<DatePickerValue, DatePickerValue>;
|
9
10
|
computedVisible: import('vue').WritableComputedRef<boolean, boolean>;
|
10
11
|
computedPickerValue: import('vue').WritableComputedRef<DatePickerValue, DatePickerValue>;
|
@@ -15,6 +16,8 @@ export default function usePicker(params: {
|
|
15
16
|
showMonthPicker: import('vue').Ref<boolean, boolean>;
|
16
17
|
curMonth: import('vue').Ref<number, number>;
|
17
18
|
curYear: import('vue').Ref<number, number>;
|
19
|
+
valueFormat: import('vue').Ref<any, any>;
|
20
|
+
showConfirmBtn: import('vue').ComputedRef<any>;
|
18
21
|
DefinePanel: import('@vueuse/core').DefineTemplateComponent<Record<string, any>, Record<"default", undefined>>;
|
19
22
|
ReusePanel: import('@vueuse/core').ReuseTemplateComponent<Record<string, any>, Record<"default", undefined>>;
|
20
23
|
t: (key: string, ...args: any[]) => string;
|
@@ -21,7 +21,8 @@ function usePicker(params) {
|
|
21
21
|
format,
|
22
22
|
valueFormat,
|
23
23
|
dayStartOfWeek,
|
24
|
-
showConfirmBtn,
|
24
|
+
showConfirmBtn: _showConfirmBtn,
|
25
|
+
showTime,
|
25
26
|
locale,
|
26
27
|
abbreviation
|
27
28
|
} = toRefs(props);
|
@@ -55,6 +56,26 @@ function usePicker(params) {
|
|
55
56
|
if (!date) return "";
|
56
57
|
return format.value && computedValue.value ? dayjs(date).format(format.value) : computedValue.value;
|
57
58
|
});
|
59
|
+
const timePickerValue = computed({
|
60
|
+
get() {
|
61
|
+
return computedValue.value;
|
62
|
+
},
|
63
|
+
set(val) {
|
64
|
+
const date = dayjs(val, valueFormat.value);
|
65
|
+
const curDate = getDateFromFormat(computedValue.value);
|
66
|
+
computedValue.value = curDate ? new Date(
|
67
|
+
curDate.getFullYear(),
|
68
|
+
curDate.getMonth(),
|
69
|
+
curDate.getDate(),
|
70
|
+
date.hour(),
|
71
|
+
date.minute(),
|
72
|
+
date.second()
|
73
|
+
) : date.toDate();
|
74
|
+
}
|
75
|
+
});
|
76
|
+
const showConfirmBtn = computed(() => {
|
77
|
+
return (showTime == null ? void 0 : showTime.value) ? showTime == null ? void 0 : showTime.value : _showConfirmBtn.value;
|
78
|
+
});
|
58
79
|
const { define: DefinePanel, reuse: ReusePanel } = createReusableTemplate();
|
59
80
|
const { t } = useI18n();
|
60
81
|
let oldDate;
|
@@ -112,8 +133,9 @@ function usePicker(params) {
|
|
112
133
|
computedVisible.value = false;
|
113
134
|
};
|
114
135
|
const handleNowClick = () => {
|
115
|
-
isConfirm = true;
|
116
136
|
computedValue.value = /* @__PURE__ */ new Date();
|
137
|
+
if (showTime == null ? void 0 : showTime.value) return;
|
138
|
+
isConfirm = true;
|
117
139
|
computedVisible.value = false;
|
118
140
|
};
|
119
141
|
const getDateFromFormat = (val) => {
|
@@ -181,6 +203,7 @@ function usePicker(params) {
|
|
181
203
|
);
|
182
204
|
return {
|
183
205
|
formatValue,
|
206
|
+
timePickerValue,
|
184
207
|
computedValue,
|
185
208
|
computedVisible,
|
186
209
|
computedPickerValue,
|
@@ -191,6 +214,8 @@ function usePicker(params) {
|
|
191
214
|
showMonthPicker,
|
192
215
|
curMonth,
|
193
216
|
curYear,
|
217
|
+
valueFormat,
|
218
|
+
showConfirmBtn,
|
194
219
|
DefinePanel,
|
195
220
|
ReusePanel,
|
196
221
|
t,
|