@varlet/ui 3.18.2 → 3.19.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/es/action-sheet/ActionItem.mjs +28 -8
- package/es/action-sheet/actionSheet.css +1 -1
- package/es/action-sheet/index.mjs +4 -2
- package/es/action-sheet/style/index.mjs +1 -1
- package/es/alert/alert.css +1 -1
- package/es/badge/Badge.mjs +20 -10
- package/es/badge/badge.css +1 -1
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +34 -20
- package/es/bottom-navigation-item/bottomNavigationItem.css +1 -1
- package/es/checkbox/Checkbox.mjs +45 -22
- package/es/checkbox/checkbox.css +1 -1
- package/es/chip/Chip.mjs +11 -4
- package/es/chip/chip.css +1 -1
- package/es/chip/props.mjs +4 -0
- package/es/date-input/DateInput.mjs +865 -0
- package/es/date-input/DateInputSfc.css +0 -0
- package/es/date-input/TimeSelect.mjs +201 -0
- package/es/date-input/date-input.css +1 -0
- package/es/date-input/index.mjs +12 -0
- package/es/date-input/props.mjs +77 -0
- package/es/date-input/style/index.mjs +14 -0
- package/es/date-picker/DatePicker.mjs +522 -451
- package/es/date-picker/DayPickerPanel.mjs +318 -0
- package/es/date-picker/MonthPickerPanel.mjs +187 -0
- package/es/date-picker/PanelHeader.mjs +332 -0
- package/es/date-picker/YearPickerPanel.mjs +199 -0
- package/es/date-picker/constants.mjs +31 -0
- package/es/date-picker/date-picker.css +1 -1
- package/es/date-picker/props.mjs +6 -9
- package/es/date-picker/style/index.mjs +0 -1
- package/es/date-picker/types.mjs +0 -0
- package/es/field-decorator/fieldDecorator.css +1 -1
- package/es/icon/icon.css +1 -1
- package/es/index.bundle.mjs +7 -1
- package/es/index.mjs +6 -1
- package/es/input/props.mjs +1 -1
- package/es/locale/en-US.mjs +2 -0
- package/es/locale/fa-IR.mjs +2 -0
- package/es/locale/ja-JP.mjs +2 -0
- package/es/locale/zh-CN.mjs +2 -0
- package/es/locale/zh-TW.mjs +2 -0
- package/es/menu-select/MenuSelect.mjs +11 -2
- package/es/menu-select/menuSelect.css +1 -1
- package/es/radio/Radio.mjs +30 -14
- package/es/radio/radio.css +1 -1
- package/es/rail-navigation-item/RailNavigationItem.mjs +33 -19
- package/es/rail-navigation-item/railNavigationItem.css +1 -1
- package/es/rate/Rate.mjs +23 -12
- package/es/rate/rate.css +1 -1
- package/es/select/Select.mjs +10 -1
- package/es/select/select.css +1 -1
- package/es/step/Step.mjs +50 -20
- package/es/step/step.css +1 -1
- package/es/style.mjs +1 -0
- package/es/themes/dark/alert.mjs +2 -2
- package/es/themes/dark/dateInput.mjs +9 -0
- package/es/themes/dark/datePicker.mjs +23 -19
- package/es/themes/dark/index.mjs +3 -2
- package/es/themes/md3-dark/alert.mjs +2 -2
- package/es/themes/md3-dark/dateInput.mjs +9 -0
- package/es/themes/md3-dark/datePicker.mjs +18 -13
- package/es/themes/md3-dark/index.mjs +3 -2
- package/es/themes/md3-light/alert.mjs +2 -2
- package/es/themes/md3-light/dateInput.mjs +9 -0
- package/es/themes/md3-light/datePicker.mjs +18 -13
- package/es/themes/md3-light/index.mjs +3 -2
- package/es/utils/elements.mjs +7 -0
- package/es/utils/shared.mjs +15 -0
- package/es/varlet.css +1 -1
- package/es/varlet.esm.js +11893 -10656
- package/highlight/web-types.en-US.json +599 -73
- package/highlight/web-types.zh-CN.json +572 -67
- package/lib/varlet.cjs.js +5592 -4211
- package/lib/varlet.css +1 -1
- package/package.json +7 -7
- package/types/actionSheet.d.ts +1 -1
- package/types/badge.d.ts +1 -0
- package/types/chip.d.ts +3 -0
- package/types/dateInput.d.ts +96 -0
- package/types/datePicker.d.ts +4 -2
- package/types/index.d.ts +2 -0
- package/types/locale.d.ts +2 -0
- package/types/rate.d.ts +7 -0
- package/types/step.d.ts +3 -0
- package/types/styleVars.d.ts +14 -4
- package/umd/varlet.js +7 -7
- package/es/date-picker/src/day-picker-panel.mjs +0 -385
- package/es/date-picker/src/month-picker-panel.mjs +0 -300
- package/es/date-picker/src/panel-header.mjs +0 -142
- package/es/date-picker/src/year-picker-panel.mjs +0 -311
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { defineComponent } from "vue";
|
|
2
|
+
import VarButton from "../button/index.mjs";
|
|
3
|
+
import VarIcon from "../icon/index.mjs";
|
|
4
|
+
import { t } from "../locale/index.mjs";
|
|
5
|
+
import { injectLocaleProvider } from "../locale-provider/provide.mjs";
|
|
6
|
+
import { createNamespace } from "../utils/components.mjs";
|
|
7
|
+
import { DatePickerTypes, DatePickerUnits, ShiftDirections } from "./constants.mjs";
|
|
8
|
+
const { n } = createNamespace("date-picker-header");
|
|
9
|
+
import { resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock } from "vue";
|
|
10
|
+
function __render__(_ctx, _cache) {
|
|
11
|
+
const _component_var_icon = _resolveComponent("var-icon");
|
|
12
|
+
const _component_var_button = _resolveComponent("var-button");
|
|
13
|
+
return _openBlock(), _createElementBlock(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
class: _normalizeClass([_ctx.n(), _ctx.n(`--${_ctx.type}`)])
|
|
17
|
+
},
|
|
18
|
+
[
|
|
19
|
+
_ctx.type === _ctx.DatePickerUnits.Day ? (_openBlock(), _createElementBlock(
|
|
20
|
+
_Fragment,
|
|
21
|
+
{ key: 0 },
|
|
22
|
+
[
|
|
23
|
+
_createElementVNode(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
class: _normalizeClass(_ctx.n("nav"))
|
|
27
|
+
},
|
|
28
|
+
[
|
|
29
|
+
_createVNode(_component_var_button, {
|
|
30
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
31
|
+
"var-date-picker-header-cover": "",
|
|
32
|
+
round: "",
|
|
33
|
+
text: "",
|
|
34
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("shift-year-preview", _ctx.ShiftDirections.Prev))
|
|
35
|
+
}, {
|
|
36
|
+
default: _withCtx(() => [
|
|
37
|
+
_createVNode(_component_var_icon, { name: "chevron-left" })
|
|
38
|
+
]),
|
|
39
|
+
_: 1
|
|
40
|
+
/* STABLE */
|
|
41
|
+
}, 8, ["class"]),
|
|
42
|
+
_createVNode(_component_var_button, {
|
|
43
|
+
class: _normalizeClass([_ctx.n("text-button"), _ctx.n("year")]),
|
|
44
|
+
"var-date-picker-header-cover": "",
|
|
45
|
+
text: "",
|
|
46
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("open-year-panel"))
|
|
47
|
+
}, {
|
|
48
|
+
default: _withCtx(() => [
|
|
49
|
+
_createElementVNode(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
class: _normalizeClass(_ctx.n("year-value"))
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
_createTextVNode(
|
|
56
|
+
_toDisplayString(_ctx.date.previewYear) + " ",
|
|
57
|
+
1
|
|
58
|
+
/* TEXT */
|
|
59
|
+
),
|
|
60
|
+
_createVNode(_component_var_icon, {
|
|
61
|
+
class: _normalizeClass(_ctx.n("text-button-icon")),
|
|
62
|
+
name: "chevron-down"
|
|
63
|
+
}, null, 8, ["class"])
|
|
64
|
+
],
|
|
65
|
+
2
|
|
66
|
+
/* CLASS */
|
|
67
|
+
)
|
|
68
|
+
]),
|
|
69
|
+
_: 1
|
|
70
|
+
/* STABLE */
|
|
71
|
+
}, 8, ["class"]),
|
|
72
|
+
_createVNode(_component_var_button, {
|
|
73
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
74
|
+
"var-date-picker-header-cover": "",
|
|
75
|
+
round: "",
|
|
76
|
+
text: "",
|
|
77
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("shift-year-preview", _ctx.ShiftDirections.Next))
|
|
78
|
+
}, {
|
|
79
|
+
default: _withCtx(() => [
|
|
80
|
+
_createVNode(_component_var_icon, { name: "chevron-right" })
|
|
81
|
+
]),
|
|
82
|
+
_: 1
|
|
83
|
+
/* STABLE */
|
|
84
|
+
}, 8, ["class"])
|
|
85
|
+
],
|
|
86
|
+
2
|
|
87
|
+
/* CLASS */
|
|
88
|
+
),
|
|
89
|
+
_createElementVNode(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
class: _normalizeClass([_ctx.n("nav"), _ctx.n("nav--month")])
|
|
93
|
+
},
|
|
94
|
+
[
|
|
95
|
+
_createVNode(_component_var_button, {
|
|
96
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
97
|
+
"var-date-picker-header-cover": "",
|
|
98
|
+
round: "",
|
|
99
|
+
text: "",
|
|
100
|
+
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("shift-preview", _ctx.ShiftDirections.Prev))
|
|
101
|
+
}, {
|
|
102
|
+
default: _withCtx(() => [
|
|
103
|
+
_createVNode(_component_var_icon, { name: "chevron-left" })
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
/* STABLE */
|
|
107
|
+
}, 8, ["class"]),
|
|
108
|
+
_createVNode(_component_var_button, {
|
|
109
|
+
class: _normalizeClass([_ctx.n("text-button"), _ctx.n("month")]),
|
|
110
|
+
"var-date-picker-header-cover": "",
|
|
111
|
+
text: "",
|
|
112
|
+
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("open-month-panel"))
|
|
113
|
+
}, {
|
|
114
|
+
default: _withCtx(() => [
|
|
115
|
+
_createTextVNode(
|
|
116
|
+
_toDisplayString(_ctx.getMonthName()) + " ",
|
|
117
|
+
1
|
|
118
|
+
/* TEXT */
|
|
119
|
+
),
|
|
120
|
+
_createVNode(_component_var_icon, {
|
|
121
|
+
class: _normalizeClass(_ctx.n("text-button-icon")),
|
|
122
|
+
name: "chevron-down"
|
|
123
|
+
}, null, 8, ["class"])
|
|
124
|
+
]),
|
|
125
|
+
_: 1
|
|
126
|
+
/* STABLE */
|
|
127
|
+
}, 8, ["class"]),
|
|
128
|
+
_createVNode(_component_var_button, {
|
|
129
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
130
|
+
"var-date-picker-header-cover": "",
|
|
131
|
+
round: "",
|
|
132
|
+
text: "",
|
|
133
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("shift-preview", _ctx.ShiftDirections.Next))
|
|
134
|
+
}, {
|
|
135
|
+
default: _withCtx(() => [
|
|
136
|
+
_createVNode(_component_var_icon, { name: "chevron-right" })
|
|
137
|
+
]),
|
|
138
|
+
_: 1
|
|
139
|
+
/* STABLE */
|
|
140
|
+
}, 8, ["class"])
|
|
141
|
+
],
|
|
142
|
+
2
|
|
143
|
+
/* CLASS */
|
|
144
|
+
)
|
|
145
|
+
],
|
|
146
|
+
64
|
|
147
|
+
/* STABLE_FRAGMENT */
|
|
148
|
+
)) : _ctx.type === _ctx.DatePickerTypes.Month && !_ctx.showPanelToggle ? (_openBlock(), _createElementBlock(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
key: 1,
|
|
152
|
+
class: _normalizeClass(_ctx.n("nav"))
|
|
153
|
+
},
|
|
154
|
+
[
|
|
155
|
+
_createVNode(_component_var_button, {
|
|
156
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
157
|
+
"var-date-picker-header-cover": "",
|
|
158
|
+
round: "",
|
|
159
|
+
text: "",
|
|
160
|
+
onClick: _cache[6] || (_cache[6] = ($event) => _ctx.$emit("shift-preview", _ctx.ShiftDirections.Prev))
|
|
161
|
+
}, {
|
|
162
|
+
default: _withCtx(() => [
|
|
163
|
+
_createVNode(_component_var_icon, { name: "chevron-left" })
|
|
164
|
+
]),
|
|
165
|
+
_: 1
|
|
166
|
+
/* STABLE */
|
|
167
|
+
}, 8, ["class"]),
|
|
168
|
+
_createVNode(_component_var_button, {
|
|
169
|
+
class: _normalizeClass([_ctx.n("text-button"), _ctx.n("year")]),
|
|
170
|
+
"var-date-picker-header-cover": "",
|
|
171
|
+
text: "",
|
|
172
|
+
onClick: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("open-year-panel"))
|
|
173
|
+
}, {
|
|
174
|
+
default: _withCtx(() => [
|
|
175
|
+
_createElementVNode(
|
|
176
|
+
"span",
|
|
177
|
+
{
|
|
178
|
+
class: _normalizeClass(_ctx.n("year-value"))
|
|
179
|
+
},
|
|
180
|
+
[
|
|
181
|
+
_createTextVNode(
|
|
182
|
+
_toDisplayString(_ctx.date.previewYear) + " ",
|
|
183
|
+
1
|
|
184
|
+
/* TEXT */
|
|
185
|
+
),
|
|
186
|
+
_createVNode(_component_var_icon, {
|
|
187
|
+
class: _normalizeClass(_ctx.n("text-button-icon")),
|
|
188
|
+
name: "chevron-down"
|
|
189
|
+
}, null, 8, ["class"])
|
|
190
|
+
],
|
|
191
|
+
2
|
|
192
|
+
/* CLASS */
|
|
193
|
+
)
|
|
194
|
+
]),
|
|
195
|
+
_: 1
|
|
196
|
+
/* STABLE */
|
|
197
|
+
}, 8, ["class"]),
|
|
198
|
+
_createVNode(_component_var_button, {
|
|
199
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
200
|
+
"var-date-picker-header-cover": "",
|
|
201
|
+
round: "",
|
|
202
|
+
text: "",
|
|
203
|
+
onClick: _cache[8] || (_cache[8] = ($event) => _ctx.$emit("shift-preview", _ctx.ShiftDirections.Next))
|
|
204
|
+
}, {
|
|
205
|
+
default: _withCtx(() => [
|
|
206
|
+
_createVNode(_component_var_icon, { name: "chevron-right" })
|
|
207
|
+
]),
|
|
208
|
+
_: 1
|
|
209
|
+
/* STABLE */
|
|
210
|
+
}, 8, ["class"])
|
|
211
|
+
],
|
|
212
|
+
2
|
|
213
|
+
/* CLASS */
|
|
214
|
+
)) : (_openBlock(), _createElementBlock(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
key: 2,
|
|
218
|
+
class: _normalizeClass([_ctx.n("nav"), _ctx.n(`nav--${_ctx.type}`)])
|
|
219
|
+
},
|
|
220
|
+
[
|
|
221
|
+
_createVNode(_component_var_button, {
|
|
222
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
223
|
+
"var-date-picker-header-cover": "",
|
|
224
|
+
round: "",
|
|
225
|
+
text: "",
|
|
226
|
+
onClick: _cache[9] || (_cache[9] = ($event) => _ctx.$emit("shift-preview", _ctx.ShiftDirections.Prev))
|
|
227
|
+
}, {
|
|
228
|
+
default: _withCtx(() => [
|
|
229
|
+
_createVNode(_component_var_icon, { name: "chevron-left" })
|
|
230
|
+
]),
|
|
231
|
+
_: 1
|
|
232
|
+
/* STABLE */
|
|
233
|
+
}, 8, ["class"]),
|
|
234
|
+
_ctx.showPanelToggle ? (_openBlock(), _createBlock(_component_var_button, {
|
|
235
|
+
key: 0,
|
|
236
|
+
class: _normalizeClass([_ctx.n("text-button"), _ctx.n("panel-label")]),
|
|
237
|
+
"var-date-picker-header-cover": "",
|
|
238
|
+
text: "",
|
|
239
|
+
onClick: _cache[10] || (_cache[10] = ($event) => _ctx.$emit("open-date-panel"))
|
|
240
|
+
}, {
|
|
241
|
+
default: _withCtx(() => [
|
|
242
|
+
_createTextVNode(
|
|
243
|
+
_toDisplayString(_ctx.getPanelLabel()) + " ",
|
|
244
|
+
1
|
|
245
|
+
/* TEXT */
|
|
246
|
+
),
|
|
247
|
+
_createVNode(_component_var_icon, {
|
|
248
|
+
class: _normalizeClass(_ctx.n("text-button-icon")),
|
|
249
|
+
name: "chevron-up"
|
|
250
|
+
}, null, 8, ["class"])
|
|
251
|
+
]),
|
|
252
|
+
_: 1
|
|
253
|
+
/* STABLE */
|
|
254
|
+
}, 8, ["class"])) : (_openBlock(), _createElementBlock(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
key: 1,
|
|
258
|
+
class: _normalizeClass([_ctx.n("text-button"), _ctx.n("panel-label")]),
|
|
259
|
+
"var-date-picker-header-cover": ""
|
|
260
|
+
},
|
|
261
|
+
_toDisplayString(_ctx.getPanelLabel()),
|
|
262
|
+
3
|
|
263
|
+
/* TEXT, CLASS */
|
|
264
|
+
)),
|
|
265
|
+
_createVNode(_component_var_button, {
|
|
266
|
+
class: _normalizeClass(_ctx.n("arrow")),
|
|
267
|
+
"var-date-picker-header-cover": "",
|
|
268
|
+
round: "",
|
|
269
|
+
text: "",
|
|
270
|
+
onClick: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("shift-preview", _ctx.ShiftDirections.Next))
|
|
271
|
+
}, {
|
|
272
|
+
default: _withCtx(() => [
|
|
273
|
+
_createVNode(_component_var_icon, { name: "chevron-right" })
|
|
274
|
+
]),
|
|
275
|
+
_: 1
|
|
276
|
+
/* STABLE */
|
|
277
|
+
}, 8, ["class"])
|
|
278
|
+
],
|
|
279
|
+
2
|
|
280
|
+
/* CLASS */
|
|
281
|
+
))
|
|
282
|
+
],
|
|
283
|
+
2
|
|
284
|
+
/* CLASS */
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
const __sfc__ = defineComponent({
|
|
288
|
+
name: "PanelHeader",
|
|
289
|
+
components: {
|
|
290
|
+
VarButton,
|
|
291
|
+
VarIcon
|
|
292
|
+
},
|
|
293
|
+
props: {
|
|
294
|
+
date: {
|
|
295
|
+
type: Object,
|
|
296
|
+
required: true
|
|
297
|
+
},
|
|
298
|
+
type: {
|
|
299
|
+
type: String,
|
|
300
|
+
default: DatePickerTypes.Date
|
|
301
|
+
},
|
|
302
|
+
showPanelToggle: Boolean
|
|
303
|
+
},
|
|
304
|
+
emits: ["open-date-panel", "open-year-panel", "open-month-panel", "shift-year-preview", "shift-preview"],
|
|
305
|
+
setup(props) {
|
|
306
|
+
const { t: pt } = injectLocaleProvider();
|
|
307
|
+
function getMonthName() {
|
|
308
|
+
var _a, _b, _c;
|
|
309
|
+
const month = (_a = (pt || t)("datePickerMonthDict")) == null ? void 0 : _a[props.date.previewMonth];
|
|
310
|
+
return (pt || t)("lang") === "zh-CN" ? (_b = month == null ? void 0 : month.name) != null ? _b : "" : (_c = month == null ? void 0 : month.abbr) != null ? _c : "";
|
|
311
|
+
}
|
|
312
|
+
function getPanelLabel() {
|
|
313
|
+
if (props.type === DatePickerTypes.Month && props.showPanelToggle) {
|
|
314
|
+
return getMonthName();
|
|
315
|
+
}
|
|
316
|
+
return props.date.previewYear;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
n,
|
|
320
|
+
DatePickerTypes,
|
|
321
|
+
DatePickerUnits,
|
|
322
|
+
ShiftDirections,
|
|
323
|
+
getMonthName,
|
|
324
|
+
getPanelLabel
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
__sfc__.render = __render__;
|
|
329
|
+
var stdin_default = __sfc__;
|
|
330
|
+
export {
|
|
331
|
+
stdin_default as default
|
|
332
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { times, toNumber } from "@varlet/shared";
|
|
18
|
+
import { onSmartMounted } from "@varlet/use";
|
|
19
|
+
import { computed, defineComponent, ref, watch } from "vue";
|
|
20
|
+
import VarButton from "../button/index.mjs";
|
|
21
|
+
import { createNamespace } from "../utils/components.mjs";
|
|
22
|
+
import { createDayjs } from "../utils/shared.mjs";
|
|
23
|
+
import { DatePickerTypes, DatePickerUnits, ShiftDirections } from "./constants.mjs";
|
|
24
|
+
const dayjs = createDayjs();
|
|
25
|
+
const { n } = createNamespace("year-picker");
|
|
26
|
+
const { n: nDate } = createNamespace("date-picker");
|
|
27
|
+
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, Transition as _Transition } from "vue";
|
|
28
|
+
function __render__(_ctx, _cache) {
|
|
29
|
+
const _component_var_button = _resolveComponent("var-button");
|
|
30
|
+
return _openBlock(), _createElementBlock("div", null, [
|
|
31
|
+
_createVNode(_Transition, {
|
|
32
|
+
name: `${_ctx.nDate()}${_ctx.reverse ? "-reverse" : ""}-translatex`
|
|
33
|
+
}, {
|
|
34
|
+
default: _withCtx(() => [
|
|
35
|
+
(_openBlock(), _createElementBlock(
|
|
36
|
+
"ul",
|
|
37
|
+
{
|
|
38
|
+
ref: "panel",
|
|
39
|
+
key: _ctx.panelKey,
|
|
40
|
+
class: _normalizeClass(_ctx.n())
|
|
41
|
+
},
|
|
42
|
+
[
|
|
43
|
+
(_openBlock(true), _createElementBlock(
|
|
44
|
+
_Fragment,
|
|
45
|
+
null,
|
|
46
|
+
_renderList(_ctx.yearList, (year) => {
|
|
47
|
+
return _openBlock(), _createElementBlock("li", { key: year }, [
|
|
48
|
+
_createVNode(_component_var_button, _mergeProps({
|
|
49
|
+
type: "primary",
|
|
50
|
+
"var-year-picker-cover": "",
|
|
51
|
+
elevation: _ctx.panelProps.buttonElevation
|
|
52
|
+
}, { ref_for: true }, __spreadValues({}, _ctx.buttonProps(`${year}`)), {
|
|
53
|
+
onClick: ($event) => _ctx.selectYear(year)
|
|
54
|
+
}), {
|
|
55
|
+
default: _withCtx(() => [
|
|
56
|
+
_createTextVNode(
|
|
57
|
+
_toDisplayString(year),
|
|
58
|
+
1
|
|
59
|
+
/* TEXT */
|
|
60
|
+
)
|
|
61
|
+
]),
|
|
62
|
+
_: 2
|
|
63
|
+
/* DYNAMIC */
|
|
64
|
+
}, 1040, ["elevation", "onClick"])
|
|
65
|
+
]);
|
|
66
|
+
}),
|
|
67
|
+
128
|
|
68
|
+
/* KEYED_FRAGMENT */
|
|
69
|
+
))
|
|
70
|
+
],
|
|
71
|
+
2
|
|
72
|
+
/* CLASS */
|
|
73
|
+
))
|
|
74
|
+
]),
|
|
75
|
+
_: 1
|
|
76
|
+
/* STABLE */
|
|
77
|
+
}, 8, ["name"])
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
const __sfc__ = defineComponent({
|
|
81
|
+
name: "YearPickerPanel",
|
|
82
|
+
components: {
|
|
83
|
+
VarButton
|
|
84
|
+
},
|
|
85
|
+
props: {
|
|
86
|
+
preview: {
|
|
87
|
+
type: String
|
|
88
|
+
},
|
|
89
|
+
selection: {
|
|
90
|
+
type: Object,
|
|
91
|
+
required: true
|
|
92
|
+
},
|
|
93
|
+
panelProps: {
|
|
94
|
+
type: Object,
|
|
95
|
+
required: true
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
emits: ["choose-year"],
|
|
99
|
+
setup(props, { emit }) {
|
|
100
|
+
const panel = ref();
|
|
101
|
+
const reverse = ref(false);
|
|
102
|
+
const panelKey = ref(0);
|
|
103
|
+
const page = ref(0);
|
|
104
|
+
const yearList = computed(() => {
|
|
105
|
+
if (!props.preview) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const startYear = Math.floor(toNumber(props.preview) / 100 + page.value) * 100;
|
|
109
|
+
return times(100, (index) => Math.max(0, startYear) + index);
|
|
110
|
+
});
|
|
111
|
+
function isInRange(year) {
|
|
112
|
+
const {
|
|
113
|
+
panelProps: { min, max }
|
|
114
|
+
} = props;
|
|
115
|
+
const isBeforeMax = max ? dayjs(year).isSameOrBefore(dayjs(max), DatePickerUnits.Year) : true;
|
|
116
|
+
const isAfterMin = min ? dayjs(year).isSameOrAfter(dayjs(min), DatePickerUnits.Year) : true;
|
|
117
|
+
return isBeforeMax && isAfterMin;
|
|
118
|
+
}
|
|
119
|
+
function isSelectedYear(year) {
|
|
120
|
+
const {
|
|
121
|
+
selection: { selectedYear, selectedYears, selectedRangeYears },
|
|
122
|
+
panelProps: { multiple, range }
|
|
123
|
+
} = props;
|
|
124
|
+
if (range) {
|
|
125
|
+
if (!selectedRangeYears.length) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
if (selectedRangeYears.length === 1) {
|
|
129
|
+
return dayjs(year).isSame(dayjs(selectedRangeYears[0]), DatePickerUnits.Year);
|
|
130
|
+
}
|
|
131
|
+
const isBeforeMax = dayjs(year).isSameOrBefore(dayjs(selectedRangeYears[1]), DatePickerUnits.Year);
|
|
132
|
+
const isAfterMin = dayjs(year).isSameOrAfter(dayjs(selectedRangeYears[0]), DatePickerUnits.Year);
|
|
133
|
+
return isBeforeMax && isAfterMin;
|
|
134
|
+
}
|
|
135
|
+
return multiple ? selectedYears.includes(year) : selectedYear === year;
|
|
136
|
+
}
|
|
137
|
+
function buttonProps(year) {
|
|
138
|
+
const {
|
|
139
|
+
panelProps: { allowedDates, color, type: pickerType }
|
|
140
|
+
} = props;
|
|
141
|
+
const active = isSelectedYear(year);
|
|
142
|
+
const disabled = !isInRange(year) || (pickerType === DatePickerTypes.Year && allowedDates ? !allowedDates(year) : false);
|
|
143
|
+
return {
|
|
144
|
+
outline: false,
|
|
145
|
+
text: disabled || !active,
|
|
146
|
+
color: active && !disabled ? color : "",
|
|
147
|
+
textColor: "",
|
|
148
|
+
[`${nDate()}-color-cover`]: !active && !disabled,
|
|
149
|
+
class: n("button"),
|
|
150
|
+
disabled
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function selectYear(year) {
|
|
154
|
+
emit("choose-year", year);
|
|
155
|
+
}
|
|
156
|
+
function scrollToView() {
|
|
157
|
+
const activeEl = panel.value.querySelector(".var-button--primary");
|
|
158
|
+
const scrollContainer = panel.value.closest(`.${nDate("body")}`);
|
|
159
|
+
if (!activeEl || !scrollContainer) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
163
|
+
const activeRect = activeEl.getBoundingClientRect();
|
|
164
|
+
scrollContainer.scrollTop += activeRect.top - containerRect.top - (scrollContainer.clientHeight - activeRect.height) / 2;
|
|
165
|
+
}
|
|
166
|
+
function shiftPreview(direction) {
|
|
167
|
+
const isPrevType = direction === ShiftDirections.Prev;
|
|
168
|
+
if (isPrevType && yearList.value[0] <= 0) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
reverse.value = isPrevType;
|
|
172
|
+
panelKey.value += isPrevType ? -1 : 1;
|
|
173
|
+
page.value += isPrevType ? -1 : 1;
|
|
174
|
+
}
|
|
175
|
+
onSmartMounted(scrollToView);
|
|
176
|
+
watch(
|
|
177
|
+
() => props.preview,
|
|
178
|
+
() => {
|
|
179
|
+
page.value = 0;
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
return {
|
|
183
|
+
n,
|
|
184
|
+
buttonProps,
|
|
185
|
+
panel,
|
|
186
|
+
yearList,
|
|
187
|
+
reverse,
|
|
188
|
+
panelKey,
|
|
189
|
+
nDate,
|
|
190
|
+
selectYear,
|
|
191
|
+
shiftPreview
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
__sfc__.render = __render__;
|
|
196
|
+
var stdin_default = __sfc__;
|
|
197
|
+
export {
|
|
198
|
+
stdin_default as default
|
|
199
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { enumOf } from "@varlet/shared";
|
|
2
|
+
const DatePickerTypes = enumOf({
|
|
3
|
+
Year: "year",
|
|
4
|
+
Month: "month",
|
|
5
|
+
Date: "date"
|
|
6
|
+
});
|
|
7
|
+
const DatePickerUnits = enumOf({
|
|
8
|
+
Year: DatePickerTypes.Year,
|
|
9
|
+
Month: DatePickerTypes.Month,
|
|
10
|
+
Day: "day"
|
|
11
|
+
});
|
|
12
|
+
const MonthList = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
|
|
13
|
+
const WeekHeader = ["0", "1", "2", "3", "4", "5", "6"];
|
|
14
|
+
const DatePickerFormats = {
|
|
15
|
+
Year: "YYYY",
|
|
16
|
+
Month: "YYYY-MM",
|
|
17
|
+
Day: "YYYY-MM-D",
|
|
18
|
+
DayPadded: "YYYY-MM-DD"
|
|
19
|
+
};
|
|
20
|
+
const ShiftDirections = enumOf({
|
|
21
|
+
Prev: "prev",
|
|
22
|
+
Next: "next"
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
DatePickerFormats,
|
|
26
|
+
DatePickerTypes,
|
|
27
|
+
DatePickerUnits,
|
|
28
|
+
MonthList,
|
|
29
|
+
ShiftDirections,
|
|
30
|
+
WeekHeader
|
|
31
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --date-picker-border-radius: 4px; --date-picker-font-size: var(--font-size-md); --date-picker-min-width: 290px; --date-picker-main-color: rgba(0, 0, 0, 0.87); --date-picker-title-hint-color: #fff; --date-picker-title-hint-font-size: var(--font-size-md); --date-picker-title-height: 105px; --date-picker-title-padding: 16px; --date-picker-title-background: var(--color-primary); --date-picker-title-color: #fff; --date-picker-title-year-font-size: var(--font-size-md); --date-picker-title-year-font-weight: 500; --date-picker-title-year-margin-bottom: 8px; --date-picker-title-year-min-height: 21px; --date-picker-title-date-height: 48px; --date-picker-title-date-font-size: 34px; --date-picker-title-date-font-weight: 500; --date-picker-title-date-range-font-size: 20px; --date-picker-title-date-justify-content: normal; --date-picker-body-background-color: #fff; --date-picker-body-height: 280px; --date-picker-body-padding: 0; --date-picker-header-padding: 4px 16px; --date-picker-header-color: #555; --date-picker-actions-padding: 0 8px 12px 8px; --date-picker-header-arrow-filter: opacity(0.54); --month-picker-padding: 0 12px; --month-picker-item-width: 33%; --month-picker-item-height: 56px; --month-picker-item-button-max-width: 140px; --year-picker-padding: 0 12px; --year-picker-item-width: 33%; --year-picker-item-height: 56px; --year-picker-item-button-max-width: 140px; --day-picker-content-item-width: 14.28%; --day-picker-content-item-min-height: 21px; --day-picker-content-item-font-size: var(--font-size-sm); --day-picker-content-item-padding: 2px 0; --day-picker-content-item-button-width: 32px; --day-picker-content-item-button-height: 32px; --day-picker-content-item-button-font-size: var(--font-size-sm); --day-picker-head-item-color: rgba(0, 0, 0, 0.38); --day-picker-head-item-padding: 8px 0; --day-picker-head-item-font-weight: 600;}.var-date-picker { -webkit-tap-highlight-color: transparent; border-radius: var(--date-picker-border-radius); contain: layout style; display: flex; width: 100%; flex-direction: column; font-size: var(--date-picker-font-size); position: relative; min-width: var(--date-picker-min-width); overflow: hidden;}.var-date-picker ul { list-style: none; margin: 0; padding: 0;}.var-date-picker__title { min-height: var(--date-picker-title-height); padding: var(--date-picker-title-padding); color: var(--date-picker-title-color); background: var(--date-picker-title-background); display: flex; justify-content: space-between; flex-direction: column; flex-wrap: wrap;}.var-date-picker__title-select { display: inline-flex; align-items: center; justify-content: space-between; margin-bottom: var(--date-picker-title-year-margin-bottom); min-height: var(--date-picker-title-year-min-height);}.var-date-picker__title-hint { color: var(--date-picker-title-hint-color); font-size: var(--date-picker-title-hint-font-size);}.var-date-picker__title-year { cursor: pointer; -webkit-tap-highlight-color: transparent; font-size: var(--date-picker-title-year-font-size); font-weight: var(--date-picker-title-year-font-weight); transition: 0.3s var(--cubic-bezier); margin-bottom: 0;}.var-date-picker__title-year--active { opacity: 1;}.var-date-picker__title-date { height: var(--date-picker-title-date-height); overflow: hidden; font-size: var(--date-picker-title-date-font-size); text-align: left; font-weight: var(--date-picker-title-date-font-weight); position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; display: flex; align-items: center; justify-content: var(--date-picker-title-date-justify-content); opacity: 0.6; transition: 0.3s var(--cubic-bezier);}.var-date-picker__title-date--active { opacity: 1;}.var-date-picker__title-date--range { font-size: var(--date-picker-title-date-range-font-size);}.var-date-picker__body { position: relative; overflow: auto; height: var(--date-picker-body-height); background-color: var(--date-picker-body-background-color); padding: var(--date-picker-body-padding);}.var-date-picker__body::-webkit-scrollbar { display: none; width: 0; background: transparent;}.var-date-picker__actions { background-color: var(--date-picker-body-background-color); padding: var(--date-picker-actions-padding); display: flex; justify-content: flex-end;}.var-date-picker-header { padding: var(--date-picker-header-padding); align-items: center; display: flex; justify-content: space-between; position: relative; color: var(--date-picker-header-color); background-color: var(--date-picker-body-background-color);}.var-date-picker-header__value { flex: 1; text-align: center; position: relative; overflow: hidden; font-weight: 700; cursor: pointer; user-select: none;}.var-date-picker-header__value div { width: 100%;}.var-date-picker-header__arrow[var-date-picker-header-cover] { filter: var(--date-picker-header-arrow-filter);}.var-date-picker .var-month-picker__content { padding: var(--month-picker-padding);}.var-date-picker .var-month-picker__content ul { display: flex; flex-wrap: wrap; justify-content: space-between;}.var-date-picker .var-month-picker__content ul li { width: var(--month-picker-item-width); display: flex; height: var(--month-picker-item-height); align-items: center; justify-content: center;}.var-date-picker .var-month-picker__button[var-month-picker-cover] { width: 100%; max-width: var(--month-picker-item-button-max-width);}.var-date-picker .var-month-picker__button[var-date-picker-color-cover='true'] { color: var(--date-picker-main-color);}.var-date-picker .var-month-picker__button--disabled { color: var(--color-text-disabled) !important; cursor: not-allowed;}.var-date-picker .var-year-picker { padding: var(--year-picker-padding); display: flex; flex-wrap: wrap; justify-content: space-between;}.var-date-picker .var-year-picker li { width: var(--year-picker-item-width); display: flex; height: var(--year-picker-item-height); align-items: center; justify-content: center;}.var-date-picker .var-year-picker__button[var-year-picker-cover] { width: 100%; max-width: var(--year-picker-item-button-max-width);}.var-date-picker .var-year-picker__button[var-date-picker-color-cover='true'] { color: var(--date-picker-main-color);}.var-date-picker .var-year-picker__button--disabled { color: var(--color-text-disabled) !important; cursor: not-allowed;}.var-date-picker .var-day-picker__content ul { display: flex; flex-wrap: wrap;}.var-date-picker .var-day-picker__content ul li { position: relative; display: flex; justify-content: center; width: var(--day-picker-content-item-width); font-size: var(--day-picker-content-item-font-size); padding: var(--day-picker-content-item-padding); min-height: var(--day-picker-content-item-min-height);}.var-date-picker .var-day-picker__head li { color: var(--day-picker-head-item-color); padding: var(--day-picker-head-item-padding); font-weight: var(--day-picker-head-item-font-weight);}.var-date-picker .var-day-picker__button[var-day-picker-cover] { width: var(--day-picker-content-item-button-width); height: var(--day-picker-content-item-button-height); font-size: var(--day-picker-content-item-button-font-size);}.var-date-picker .var-day-picker__button:not(.var-day-picker__button--usable) { cursor: unset;}.var-date-picker .var-day-picker__button[var-date-picker-color-cover='true'] { color: var(--date-picker-main-color);}.var-date-picker .var-day-picker__button--disabled { color: var(--color-text-disabled) !important; cursor: not-allowed;}.var-date-picker-translatey-enter-from { opacity: 0; transform: translateY(100%);}.var-date-picker-translatey-enter-active,.var-date-picker-reverse-translatey-enter-active { transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatey-leave-active,.var-date-picker-reverse-translatey-leave-active { position: absolute; transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatey-leave-to { opacity: 0; transform: translateY(-100%);}.var-date-picker-reverse-translatey-enter-from { opacity: 0; transform: translateY(-100%);}.var-date-picker-reverse-translatey-leave-to { opacity: 0; transform: translateY(100%);}.var-date-picker-panel-fade-enter-from,.var-date-picker-panel-fade-leave-to { transition: 0.3s var(--cubic-bezier); opacity: 0;}.var-date-picker-panel-fade-leave-active { position: absolute;}.var-date-picker-translatex-enter-from { opacity: 0; transform: translateX(100%);}.var-date-picker-reverse-translatex-enter-from { opacity: 0; transform: translateX(-100%);}.var-date-picker-translatex-enter-active,.var-date-picker-reverse-translatex-enter-active { transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatex-leave-active,.var-date-picker-reverse-translatex-leave-active { position: absolute; transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatex-leave-to { opacity: 0; transform: translateX(-100%);}.var-date-picker-reverse-translatex-leave-to { opacity: 0; transform: translateX(100%);}
|
|
1
|
+
:root { --date-picker-border-radius: 4px; --date-picker-font-size: var(--font-size-md); --date-picker-min-width: 290px; --date-picker-main-color: rgba(0, 0, 0, 0.87); --date-picker-title-hint-color: var(--color-on-surface-variant); --date-picker-title-hint-font-size: var(--font-size-md); --date-picker-title-height: 105px; --date-picker-title-padding: 20px 20px 16px; --date-picker-title-background: #fff; --date-picker-title-color: rgba(0, 0, 0, 0.87); --date-picker-title-date-height: 48px; --date-picker-title-date-font-size: 34px; --date-picker-title-date-font-weight: 500; --date-picker-title-date-range-font-size: 20px; --date-picker-title-date-justify-content: normal; --date-picker-body-background-color: #fff; --date-picker-body-height: 304px; --date-picker-body-padding-horizontal: 12px; --date-picker-body-padding: 0 var(--date-picker-body-padding-horizontal) 16px; --date-picker-header-padding: 0 0 16px; --date-picker-header-padding-top-no-title: 20px; --date-picker-header-color: #555; --date-picker-actions-padding: 10px 20px 20px; --date-picker-header-arrow-filter: opacity(1); --month-picker-padding: 0 12px; --month-picker-item-width: 32%; --month-picker-item-height: 46px; --month-picker-item-button-max-width: 140px; --month-picker-item-button-font-weight: normal; --year-picker-padding: 0 12px; --year-picker-item-width: 32%; --year-picker-item-height: 46px; --year-picker-item-button-max-width: 140px; --year-picker-item-button-font-weight: normal; --day-picker-content-item-width: 14.28%; --day-picker-content-item-min-height: 21px; --day-picker-content-item-font-size: var(--font-size-md); --day-picker-content-item-padding: 2px 0; --day-picker-content-item-button-width: 32px; --day-picker-content-item-button-height: 32px; --day-picker-content-item-button-font-size: var(--font-size-md); --day-picker-head-item-font-size: var(--font-size-md); --day-picker-head-item-color: rgba(0, 0, 0, 0.38); --day-picker-head-item-padding: 8px 0; --day-picker-head-item-font-weight: normal; --day-picker-adjacent-item-color: rgba(0, 0, 0, 0.54); --day-picker-disabled-item-color: var(--color-text-disabled);}.var-date-picker { -webkit-tap-highlight-color: transparent; border-radius: var(--date-picker-border-radius); contain: layout style; display: flex; width: 100%; flex-direction: column; font-size: var(--date-picker-font-size); position: relative; min-width: var(--date-picker-min-width); overflow: hidden;}.var-date-picker ul { list-style: none; margin: 0; padding: 0;}.var-date-picker__title { min-height: var(--date-picker-title-height); padding: var(--date-picker-title-padding); color: var(--date-picker-title-color); background: var(--date-picker-title-background); display: flex; justify-content: space-between; flex-direction: column; flex-wrap: wrap;}.var-date-picker__title-select { display: inline-flex; align-items: center; margin-bottom: 8px; min-height: 21px;}.var-date-picker__title-hint { color: var(--date-picker-title-hint-color); font-size: var(--date-picker-title-hint-font-size);}.var-date-picker__title-date { height: var(--date-picker-title-date-height); overflow: hidden; font-size: var(--date-picker-title-date-font-size); text-align: left; font-weight: var(--date-picker-title-date-font-weight); position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; display: flex; align-items: center; justify-content: var(--date-picker-title-date-justify-content); opacity: 0.6; transition: 0.3s var(--cubic-bezier);}.var-date-picker__title-date--active { opacity: 1;}.var-date-picker__title-date--range { font-size: var(--date-picker-title-date-range-font-size);}.var-date-picker__body { position: relative; overflow-x: hidden; overflow-y: auto; height: var(--date-picker-body-height); background-color: var(--date-picker-body-background-color); padding: var(--date-picker-body-padding); scrollbar-width: none;}.var-date-picker__body::-webkit-scrollbar { display: none;}.var-date-picker__panel { position: relative; z-index: 0;}.var-date-picker--no-title .var-date-picker__body { height: calc(var(--date-picker-body-height) + var(--date-picker-header-padding-top-no-title));}.var-date-picker__actions { background-color: var(--date-picker-body-background-color); padding: var(--date-picker-actions-padding); display: flex; justify-content: flex-end;}.var-date-picker-header { padding: var(--date-picker-header-padding); align-items: center; display: flex; justify-content: space-between; position: sticky; top: 0; z-index: 2; color: var(--date-picker-header-color); background-color: var(--date-picker-body-background-color); box-sizing: border-box; width: calc(100% + var(--date-picker-body-padding-horizontal) * 2); margin-left: calc(var(--date-picker-body-padding-horizontal) * -1); margin-right: calc(var(--date-picker-body-padding-horizontal) * -1);}.var-date-picker--no-title .var-date-picker-header { padding-top: var(--date-picker-header-padding-top-no-title);}.var-date-picker-header--day,.var-date-picker-header--month,.var-date-picker-header--year { padding-left: calc(var(--date-picker-body-padding-horizontal) + 4px); padding-right: calc(var(--date-picker-body-padding-horizontal) + 4px);}.var-date-picker-header__year-value { display: flex; align-items: center; justify-content: center; white-space: nowrap;}.var-date-picker-header__nav { display: flex; align-items: center; height: 32px;}.var-date-picker-header__nav--month { margin-left: auto;}.var-date-picker-header__panel-label { min-width: 72px; height: 32px; display: inline-flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; user-select: none; white-space: nowrap;}.var-date-picker-header__text-button[var-date-picker-header-cover] { padding: 0 4px; min-width: 72px; height: 32px; font-size: inherit; font-weight: 700; color: var(--date-picker-header-color); border-radius: var(--button-border-radius); white-space: nowrap;}.var-date-picker-header__text-button[var-date-picker-header-cover] .var-button__content { flex-wrap: nowrap;}.var-date-picker-header__text-button-icon { flex: none; margin-left: 1px; font-size: 16px;}.var-date-picker-header__arrow[var-date-picker-header-cover] { width: 28px; height: 28px; padding: 3px; color: var(--date-picker-header-color); filter: var(--date-picker-header-arrow-filter);}.var-date-picker-header__arrow[var-date-picker-header-cover] .var-icon { font-size: 20px;}.var-date-picker .var-month-picker__content ul { padding: var(--month-picker-padding); display: flex; flex-wrap: wrap; justify-content: space-between;}.var-date-picker .var-month-picker__content ul li { width: var(--month-picker-item-width); display: flex; height: var(--month-picker-item-height); align-items: center; justify-content: center;}.var-date-picker .var-month-picker__button[var-month-picker-cover] { width: 100%; max-width: var(--month-picker-item-button-max-width); font-weight: var(--month-picker-item-button-font-weight);}.var-date-picker .var-month-picker__button[var-month-picker-cover]:disabled { pointer-events: none;}.var-date-picker .var-month-picker__button[var-date-picker-color-cover='true'] { color: var(--date-picker-main-color);}.var-date-picker .var-year-picker { padding: var(--year-picker-padding); display: flex; flex-wrap: wrap; justify-content: space-between;}.var-date-picker .var-year-picker li { width: var(--year-picker-item-width); display: flex; height: var(--year-picker-item-height); align-items: center; justify-content: center;}.var-date-picker .var-year-picker__button[var-year-picker-cover] { width: 100%; max-width: var(--year-picker-item-button-max-width); font-weight: var(--year-picker-item-button-font-weight);}.var-date-picker .var-year-picker__button[var-year-picker-cover]:disabled { pointer-events: none;}.var-date-picker .var-year-picker__button[var-date-picker-color-cover='true'] { color: var(--date-picker-main-color);}.var-date-picker .var-day-picker__content ul { display: flex; flex-wrap: wrap;}.var-date-picker .var-day-picker__content ul li { position: relative; display: flex; justify-content: center; width: var(--day-picker-content-item-width); font-size: var(--day-picker-content-item-font-size); padding: var(--day-picker-content-item-padding); min-height: var(--day-picker-content-item-min-height);}.var-date-picker .var-day-picker__head li { color: var(--day-picker-head-item-color); font-size: var(--day-picker-head-item-font-size); padding: var(--day-picker-head-item-padding); font-weight: var(--day-picker-head-item-font-weight);}.var-date-picker .var-day-picker__button[var-day-picker-cover] { width: var(--day-picker-content-item-button-width); height: var(--day-picker-content-item-button-height); font-size: var(--day-picker-content-item-button-font-size);}.var-date-picker .var-day-picker__button[var-day-picker-cover]:disabled { pointer-events: none; color: var(--day-picker-disabled-item-color);}.var-date-picker .var-day-picker__button:not(.var-day-picker__button--usable):not(.var-day-picker__button--adjacent) { cursor: unset;}.var-date-picker .var-day-picker__button[var-date-picker-color-cover='true'] { color: var(--date-picker-main-color);}.var-date-picker .var-day-picker__button--adjacent[var-date-picker-color-cover='true'] { color: var(--day-picker-adjacent-item-color);}.var-date-picker-translatey-enter-from { opacity: 0; transform: translateY(100%);}.var-date-picker-translatey-enter-active,.var-date-picker-reverse-translatey-enter-active { transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatey-leave-active,.var-date-picker-reverse-translatey-leave-active { position: absolute; transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatey-leave-to { opacity: 0; transform: translateY(-100%);}.var-date-picker-reverse-translatey-enter-from { opacity: 0; transform: translateY(-100%);}.var-date-picker-reverse-translatey-leave-to { opacity: 0; transform: translateY(100%);}.var-date-picker-panel-fade-enter-from,.var-date-picker-panel-fade-leave-to { transition: 0.3s var(--cubic-bezier); opacity: 0;}.var-date-picker-panel-fade-leave-active { position: absolute; top: 0; left: 0; right: 0;}.var-date-picker-translatex-enter-from { opacity: 0; transform: translateX(100%);}.var-date-picker-reverse-translatex-enter-from { opacity: 0; transform: translateX(-100%);}.var-date-picker-translatex-enter-active,.var-date-picker-reverse-translatex-enter-active { transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatex-leave-active,.var-date-picker-reverse-translatex-leave-active { position: absolute; transition: 0.3s var(--cubic-bezier);}.var-date-picker-translatex-leave-to { opacity: 0; transform: translateX(-100%);}.var-date-picker-reverse-translatex-leave-to { opacity: 0; transform: translateX(100%);}
|
package/es/date-picker/props.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { defineListenerProp } from "../utils/components.mjs";
|
|
2
|
-
|
|
3
|
-
const WEEK_HEADER = ["0", "1", "2", "3", "4", "5", "6"];
|
|
2
|
+
import { DatePickerTypes } from "./constants.mjs";
|
|
4
3
|
const props = {
|
|
5
4
|
modelValue: [String, Array],
|
|
6
5
|
type: {
|
|
7
6
|
type: String,
|
|
8
|
-
default:
|
|
7
|
+
default: DatePickerTypes.Date
|
|
9
8
|
},
|
|
10
9
|
hint: String,
|
|
11
10
|
fallbackViewDate: String,
|
|
@@ -30,19 +29,17 @@ const props = {
|
|
|
30
29
|
type: Boolean,
|
|
31
30
|
default: true
|
|
32
31
|
},
|
|
33
|
-
|
|
34
|
-
multiple: Boolean,
|
|
35
|
-
range: Boolean,
|
|
36
|
-
touchable: {
|
|
32
|
+
showTitle: {
|
|
37
33
|
type: Boolean,
|
|
38
34
|
default: true
|
|
39
35
|
},
|
|
36
|
+
readonly: Boolean,
|
|
37
|
+
multiple: Boolean,
|
|
38
|
+
range: Boolean,
|
|
40
39
|
onPreview: defineListenerProp(),
|
|
41
40
|
onChange: defineListenerProp(),
|
|
42
41
|
"onUpdate:modelValue": defineListenerProp()
|
|
43
42
|
};
|
|
44
43
|
export {
|
|
45
|
-
MONTH_LIST,
|
|
46
|
-
WEEK_HEADER,
|
|
47
44
|
props
|
|
48
45
|
};
|
|
File without changes
|