@varlet/ui 3.5.0 → 3.5.1-alpha.1726764162524
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/style/index.mjs +1 -1
- package/es/auto-complete/AutoComplete.mjs +1 -2
- package/es/avatar/Avatar.mjs +1 -2
- package/es/badge/Badge.mjs +1 -2
- package/es/button/Button.mjs +1 -2
- package/es/card/Card.mjs +2 -4
- package/es/checkbox/Checkbox.mjs +1 -2
- package/es/collapse/Collapse.mjs +1 -2
- package/es/collapse-item/CollapseItem.mjs +1 -2
- package/es/counter/Counter.mjs +1 -2
- package/es/date-picker/DatePicker.mjs +30 -60
- package/es/date-picker/src/day-picker-panel.mjs +18 -33
- package/es/date-picker/src/month-picker-panel.mjs +21 -39
- package/es/date-picker/src/panel-header.mjs +3 -6
- package/es/date-picker/src/year-picker-panel.mjs +19 -35
- package/es/ellipsis/Ellipsis.mjs +1 -2
- package/es/fab/Fab.mjs +1 -1
- package/es/field-decorator/FieldDecorator.mjs +1 -2
- package/es/form-details/FormDetails.mjs +1 -2
- package/es/hover/index.mjs +1 -2
- package/es/image/Image.mjs +1 -2
- package/es/image-preview/ImagePreview.mjs +1 -2
- package/es/index-bar/IndexBar.mjs +3 -6
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +1 -2
- package/es/loading/Loading.mjs +17 -20
- package/es/menu-option/MenuOption.mjs +1 -2
- package/es/option/Option.mjs +1 -2
- package/es/overlay/Overlay.mjs +1 -2
- package/es/pagination/Pagination.mjs +5 -10
- package/es/picker/Picker.mjs +1 -2
- package/es/popup/Popup.mjs +1 -2
- package/es/progress/Progress.mjs +1 -2
- package/es/radio/Radio.mjs +1 -2
- package/es/rate/Rate.mjs +1 -2
- package/es/result/Empty.mjs +13 -16
- package/es/result/Error.mjs +10 -13
- package/es/result/Info.mjs +10 -13
- package/es/result/Question.mjs +10 -13
- package/es/result/Warning.mjs +10 -13
- package/es/select/Select.mjs +1 -2
- package/es/slider/Slider.mjs +1 -2
- package/es/snackbar/index.mjs +4 -5
- package/es/space/Space.mjs +1 -2
- package/es/step/Step.mjs +1 -2
- package/es/style.css +1 -1
- package/es/swipe/Swipe.mjs +1 -2
- package/es/swipe-item/SwipeItem.mjs +1 -2
- package/es/switch/Switch.mjs +17 -20
- package/es/tabs/Tabs.mjs +1 -2
- package/es/time-picker/TimePicker.mjs +13 -26
- package/es/time-picker/clock.mjs +11 -22
- package/es/time-picker/utils.mjs +4 -8
- package/es/uploader/Uploader.mjs +1 -2
- package/es/utils/elements.mjs +1 -2
- package/es/utils/test.mjs +1 -4
- package/es/varlet.esm.js +5120 -5252
- package/es/watermark/Watermark.mjs +1 -2
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +501 -842
- package/package.json +7 -7
- package/umd/varlet.js +8 -8
|
@@ -29,8 +29,7 @@ import { useClickOutside, useEventListener, useVModel } from "@varlet/use";
|
|
|
29
29
|
import { call, isEmpty, preventDefault, raf, toNumber } from "@varlet/shared";
|
|
30
30
|
import { useForm } from "../form/provide.mjs";
|
|
31
31
|
const { name, n } = createNamespace("auto-complete");
|
|
32
|
-
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode
|
|
33
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
32
|
+
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from "vue";
|
|
34
33
|
const _hoisted_1 = ["tabindex"];
|
|
35
34
|
function __render__(_ctx, _cache) {
|
|
36
35
|
const _component_var_input = _resolveComponent("var-input");
|
package/es/avatar/Avatar.mjs
CHANGED
|
@@ -7,8 +7,7 @@ import { call } from "@varlet/shared";
|
|
|
7
7
|
import { onSmartMounted } from "@varlet/use";
|
|
8
8
|
const isInternalSize = (size) => ["mini", "small", "normal", "large"].includes(size);
|
|
9
9
|
const { name, n, classes } = createNamespace("avatar");
|
|
10
|
-
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock, Fragment as _Fragment, renderSlot as _renderSlot
|
|
11
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
10
|
+
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock, Fragment as _Fragment, renderSlot as _renderSlot } from "vue";
|
|
12
11
|
const _hoisted_1 = ["src", "alt", "lazy-loading", "lazy-error"];
|
|
13
12
|
const _hoisted_2 = ["src", "alt"];
|
|
14
13
|
function __render__(_ctx, _cache) {
|
package/es/badge/Badge.mjs
CHANGED
|
@@ -21,8 +21,7 @@ import { props } from "./props.mjs";
|
|
|
21
21
|
import { createNamespace } from "../utils/components.mjs";
|
|
22
22
|
import { toSizeUnit } from "../utils/elements.mjs";
|
|
23
23
|
const { name, n, classes } = createNamespace("badge");
|
|
24
|
-
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, vShow as _vShow, mergeProps as _mergeProps, createElementVNode as _createElementVNode, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode
|
|
25
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
24
|
+
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, vShow as _vShow, mergeProps as _mergeProps, createElementVNode as _createElementVNode, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode } from "vue";
|
|
26
25
|
const _hoisted_1 = { key: 0 };
|
|
27
26
|
function __render__(_ctx, _cache) {
|
|
28
27
|
const _component_var_icon = _resolveComponent("var-icon");
|
package/es/button/Button.mjs
CHANGED
|
@@ -8,8 +8,7 @@ import { createNamespace, formatElevation } from "../utils/components.mjs";
|
|
|
8
8
|
import { useButtonGroup } from "./provide.mjs";
|
|
9
9
|
import { call, normalizeToArray } from "@varlet/shared";
|
|
10
10
|
const { name, n, classes } = createNamespace("button");
|
|
11
|
-
import { resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createVNode as _createVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives
|
|
12
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
11
|
+
import { resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createVNode as _createVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
|
|
13
12
|
const _hoisted_1 = ["tabindex", "type", "disabled"];
|
|
14
13
|
function __render__(_ctx, _cache) {
|
|
15
14
|
const _component_var_loading = _resolveComponent("var-loading");
|
package/es/card/Card.mjs
CHANGED
|
@@ -30,8 +30,7 @@ import { useZIndex } from "../context/zIndex.mjs";
|
|
|
30
30
|
import { useLock } from "../context/lock.mjs";
|
|
31
31
|
const { name, n, classes } = createNamespace("card");
|
|
32
32
|
const RIPPLE_DELAY = 500;
|
|
33
|
-
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, withCtx as _withCtx, resolveDirective as _resolveDirective, withDirectives as _withDirectives
|
|
34
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
33
|
+
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, withCtx as _withCtx, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
|
|
35
34
|
const _hoisted_1 = ["src", "alt"];
|
|
36
35
|
function __render__(_ctx, _cache) {
|
|
37
36
|
const _component_var_icon = _resolveComponent("var-icon");
|
|
@@ -265,8 +264,7 @@ const __sfc__ = defineComponent({
|
|
|
265
264
|
watch(
|
|
266
265
|
() => props2.floating,
|
|
267
266
|
(value) => {
|
|
268
|
-
if (isRow.value)
|
|
269
|
-
return;
|
|
267
|
+
if (isRow.value) return;
|
|
270
268
|
nextTick(() => {
|
|
271
269
|
value ? floating() : dropdown();
|
|
272
270
|
});
|
package/es/checkbox/Checkbox.mjs
CHANGED
|
@@ -11,8 +11,7 @@ import { useForm } from "../form/provide.mjs";
|
|
|
11
11
|
import { call, preventDefault } from "@varlet/shared";
|
|
12
12
|
import { useEventListener, useVModel } from "@varlet/use";
|
|
13
13
|
const { name, n, classes } = createNamespace("checkbox");
|
|
14
|
-
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, createVNode as _createVNode, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createElementVNode as _createElementVNode
|
|
15
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
14
|
+
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, createVNode as _createVNode, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createElementVNode as _createElementVNode } from "vue";
|
|
16
15
|
const _hoisted_1 = ["tabindex"];
|
|
17
16
|
function __render__(_ctx, _cache) {
|
|
18
17
|
const _component_var_icon = _resolveComponent("var-icon");
|
package/es/collapse/Collapse.mjs
CHANGED
|
@@ -84,8 +84,7 @@ const __sfc__ = defineComponent({
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const toggleAll = (options) => {
|
|
87
|
-
if (props2.accordion)
|
|
88
|
-
return;
|
|
87
|
+
if (props2.accordion) return;
|
|
89
88
|
const matchedItems = collapseItems.filter((item) => {
|
|
90
89
|
var _a;
|
|
91
90
|
const itemValue = (_a = item.name.value) != null ? _a : item.index.value;
|
|
@@ -5,8 +5,7 @@ import { useCollapse } from "./provide.mjs";
|
|
|
5
5
|
import { props } from "./props.mjs";
|
|
6
6
|
import { useCollapseTransition } from "../collapse-transition/useCollapseTransition.mjs";
|
|
7
7
|
const { name, n, classes } = createNamespace("collapse-item");
|
|
8
|
-
import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, vShow as _vShow, withDirectives as _withDirectives, normalizeStyle as _normalizeStyle
|
|
9
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
8
|
+
import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, vShow as _vShow, withDirectives as _withDirectives, normalizeStyle as _normalizeStyle } from "vue";
|
|
10
9
|
const _hoisted_1 = ["aria-expanded", "aria-disabled", "role"];
|
|
11
10
|
function __render__(_ctx, _cache) {
|
|
12
11
|
const _component_var_icon = _resolveComponent("var-icon");
|
package/es/counter/Counter.mjs
CHANGED
|
@@ -12,8 +12,7 @@ import { useValidation, createNamespace, formatElevation } from "../utils/compon
|
|
|
12
12
|
const SPEED = 100;
|
|
13
13
|
const DELAY = 600;
|
|
14
14
|
const { name, n, classes } = createNamespace("counter");
|
|
15
|
-
import { resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, withCtx as _withCtx, vModelText as _vModelText, createElementVNode as _createElementVNode, withDirectives as _withDirectives, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock
|
|
16
|
-
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
15
|
+
import { resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, withCtx as _withCtx, vModelText as _vModelText, createElementVNode as _createElementVNode, withDirectives as _withDirectives, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
17
16
|
const _hoisted_1 = ["inputmode", "readonly", "disabled"];
|
|
18
17
|
function __render__(_ctx, _cache) {
|
|
19
18
|
const _component_var_icon = _resolveComponent("var-icon");
|
|
@@ -364,26 +364,20 @@ const __sfc__ = defineComponent({
|
|
|
364
364
|
const formatRangeDays = chooseRangeDay.value.map((date) => dayjs(date).format("YYYY-MM-DD"));
|
|
365
365
|
return formatRangeDays.length ? `${formatRangeDays[0]} ~ ${formatRangeDays[1]}` : "";
|
|
366
366
|
}
|
|
367
|
-
if (multiple)
|
|
368
|
-
|
|
369
|
-
if (!chooseYear.value || !chooseMonth.value || !chooseDay.value)
|
|
370
|
-
return "";
|
|
367
|
+
if (multiple) return `${chooseDays.value.length}${(pt || t)("datePickerSelected")}`;
|
|
368
|
+
if (!chooseYear.value || !chooseMonth.value || !chooseDay.value) return "";
|
|
371
369
|
const weekIndex = dayjs(`${chooseYear.value}-${chooseMonth.value}-${chooseDay.value}`).day();
|
|
372
370
|
const week = WEEK_HEADER.find((value) => value === `${weekIndex}`);
|
|
373
371
|
const weekName = (_b = (_a = (pt || t)("datePickerWeekDict")) == null ? void 0 : _a[week].name) != null ? _b : "";
|
|
374
372
|
const monthName = (_d = (_c = (pt || t)("datePickerMonthDict")) == null ? void 0 : _c[chooseMonth.value].name) != null ? _d : "";
|
|
375
373
|
const showDay = padStart(chooseDay.value, 2, "0");
|
|
376
|
-
if ((pt || t)("lang") === "zh-CN")
|
|
377
|
-
return `${chooseMonth.value}-${showDay} ${weekName.slice(0, 3)}`;
|
|
374
|
+
if ((pt || t)("lang") === "zh-CN") return `${chooseMonth.value}-${showDay} ${weekName.slice(0, 3)}`;
|
|
378
375
|
return `${weekName.slice(0, 3)}, ${monthName.slice(0, 3)} ${chooseDay.value}`;
|
|
379
376
|
});
|
|
380
377
|
const getPanelType = computed(() => {
|
|
381
|
-
if (props2.type === "year" || isYearPanel.value)
|
|
382
|
-
|
|
383
|
-
if (props2.type === "
|
|
384
|
-
return "month";
|
|
385
|
-
if (props2.type === "date")
|
|
386
|
-
return "date";
|
|
378
|
+
if (props2.type === "year" || isYearPanel.value) return "year";
|
|
379
|
+
if (props2.type === "month" || isMonthPanel.value) return "month";
|
|
380
|
+
if (props2.type === "date") return "date";
|
|
387
381
|
return "";
|
|
388
382
|
});
|
|
389
383
|
const isUntouchable = computed(() => !props2.touchable || !getPanelType.value);
|
|
@@ -410,16 +404,13 @@ const __sfc__ = defineComponent({
|
|
|
410
404
|
watch(
|
|
411
405
|
() => props2.modelValue,
|
|
412
406
|
(value) => {
|
|
413
|
-
if (!checkValue() || invalidFormatDate(value) || !value)
|
|
414
|
-
return;
|
|
407
|
+
if (!checkValue() || invalidFormatDate(value) || !value) return;
|
|
415
408
|
if (props2.range) {
|
|
416
|
-
if (!isArray(value))
|
|
417
|
-
return;
|
|
409
|
+
if (!isArray(value)) return;
|
|
418
410
|
rangeDone.value = value.length !== 1;
|
|
419
411
|
rangeInit(value, props2.type);
|
|
420
412
|
} else if (props2.multiple) {
|
|
421
|
-
if (!isArray(value))
|
|
422
|
-
return;
|
|
413
|
+
if (!isArray(value)) return;
|
|
423
414
|
multipleInit(value, props2.type);
|
|
424
415
|
} else {
|
|
425
416
|
dateInit(value);
|
|
@@ -429,18 +420,15 @@ const __sfc__ = defineComponent({
|
|
|
429
420
|
);
|
|
430
421
|
watch(getPanelType, resetState);
|
|
431
422
|
function clickEl(type) {
|
|
432
|
-
if (type === "year")
|
|
433
|
-
|
|
434
|
-
else if (type === "month")
|
|
435
|
-
isMonthPanel.value = true;
|
|
423
|
+
if (type === "year") isYearPanel.value = true;
|
|
424
|
+
else if (type === "month") isMonthPanel.value = true;
|
|
436
425
|
else {
|
|
437
426
|
isYearPanel.value = false;
|
|
438
427
|
isMonthPanel.value = false;
|
|
439
428
|
}
|
|
440
429
|
}
|
|
441
430
|
function handleTouchstart(event) {
|
|
442
|
-
if (isUntouchable.value)
|
|
443
|
-
return;
|
|
431
|
+
if (isUntouchable.value) return;
|
|
444
432
|
const { clientX, clientY } = event.touches[0];
|
|
445
433
|
startX = clientX;
|
|
446
434
|
startY = clientY;
|
|
@@ -449,8 +437,7 @@ const __sfc__ = defineComponent({
|
|
|
449
437
|
return x >= y && x > 20 ? "x" : "y";
|
|
450
438
|
}
|
|
451
439
|
function handleTouchmove(event) {
|
|
452
|
-
if (isUntouchable.value)
|
|
453
|
-
return;
|
|
440
|
+
if (isUntouchable.value) return;
|
|
454
441
|
const { clientX, clientY } = event.touches[0];
|
|
455
442
|
const x = clientX - startX;
|
|
456
443
|
const y = clientY - startY;
|
|
@@ -459,8 +446,7 @@ const __sfc__ = defineComponent({
|
|
|
459
446
|
}
|
|
460
447
|
function handleTouchend() {
|
|
461
448
|
return __async(this, null, function* () {
|
|
462
|
-
if (isUntouchable.value || touchDirection !== "x")
|
|
463
|
-
return;
|
|
449
|
+
if (isUntouchable.value || touchDirection !== "x") return;
|
|
464
450
|
const componentRef = getPanelType.value === "year" ? yearPanelEl : getPanelType.value === "month" ? monthPanelEl : dayPanelEl;
|
|
465
451
|
yield doubleRaf();
|
|
466
452
|
componentRef.value.forwardRef(checkType);
|
|
@@ -483,35 +469,26 @@ const __sfc__ = defineComponent({
|
|
|
483
469
|
const formatType = type === "year" ? "YYYY" : type === "month" ? "YYYY-MM" : "YYYY-MM-DD";
|
|
484
470
|
const formatDates = multipleDates.value.map((date2) => dayjs(date2).format(formatType));
|
|
485
471
|
const index = formatDates.findIndex((choose) => choose === date);
|
|
486
|
-
if (index === -1)
|
|
487
|
-
|
|
488
|
-
else
|
|
489
|
-
formatDates.splice(index, 1);
|
|
472
|
+
if (index === -1) formatDates.push(date);
|
|
473
|
+
else formatDates.splice(index, 1);
|
|
490
474
|
call(props2["onUpdate:modelValue"], formatDates);
|
|
491
475
|
call(props2.onChange, formatDates);
|
|
492
476
|
}
|
|
493
477
|
function getReverse(dateType, date) {
|
|
494
|
-
if (!chooseYear.value || !chooseMonth.value)
|
|
495
|
-
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
if (dateType === "year")
|
|
499
|
-
return date < toNumber(chooseYear.value);
|
|
500
|
-
if (dateType === "month")
|
|
501
|
-
return date < chooseMonth.value;
|
|
478
|
+
if (!chooseYear.value || !chooseMonth.value) return false;
|
|
479
|
+
if (!isSameYear.value) return chooseYear.value > previewYear.value;
|
|
480
|
+
if (dateType === "year") return date < toNumber(chooseYear.value);
|
|
481
|
+
if (dateType === "month") return date < chooseMonth.value;
|
|
502
482
|
return isSameMonth.value ? date < toNumber(chooseDay.value) : chooseMonth.value > previewMonth.value;
|
|
503
483
|
}
|
|
504
484
|
function getChooseDay(day) {
|
|
505
485
|
const { readonly, range, multiple, onChange, "onUpdate:modelValue": updateModelValue } = props2;
|
|
506
|
-
if (day < 0 || readonly)
|
|
507
|
-
return;
|
|
486
|
+
if (day < 0 || readonly) return;
|
|
508
487
|
reverse.value = getReverse("day", day);
|
|
509
488
|
const date = `${previewYear.value}-${previewMonth.value}-${day}`;
|
|
510
489
|
const formatDate = dayjs(date).format("YYYY-MM-DD");
|
|
511
|
-
if (range)
|
|
512
|
-
|
|
513
|
-
else if (multiple)
|
|
514
|
-
updateMultiple(formatDate, "day");
|
|
490
|
+
if (range) updateRange(formatDate, "day");
|
|
491
|
+
else if (multiple) updateMultiple(formatDate, "day");
|
|
515
492
|
else {
|
|
516
493
|
call(updateModelValue, formatDate);
|
|
517
494
|
call(onChange, formatDate);
|
|
@@ -522,10 +499,8 @@ const __sfc__ = defineComponent({
|
|
|
522
499
|
reverse.value = getReverse("month", month);
|
|
523
500
|
if (type === "month" && !readonly) {
|
|
524
501
|
const date = `${previewYear.value}-${month}`;
|
|
525
|
-
if (range)
|
|
526
|
-
|
|
527
|
-
else if (multiple)
|
|
528
|
-
updateMultiple(date, "month");
|
|
502
|
+
if (range) updateRange(date, "month");
|
|
503
|
+
else if (multiple) updateMultiple(date, "month");
|
|
529
504
|
else {
|
|
530
505
|
call(updateModelValue, date);
|
|
531
506
|
call(onChange, date);
|
|
@@ -545,10 +520,8 @@ const __sfc__ = defineComponent({
|
|
|
545
520
|
const { type, readonly, range, multiple, onChange, onPreview, "onUpdate:modelValue": updateModelValue } = props2;
|
|
546
521
|
reverse.value = getReverse("year", year);
|
|
547
522
|
if (type === "year" && !readonly) {
|
|
548
|
-
if (range)
|
|
549
|
-
|
|
550
|
-
else if (multiple)
|
|
551
|
-
updateMultiple(`${year}`, "year");
|
|
523
|
+
if (range) updateRange(`${year}`, "year");
|
|
524
|
+
else if (multiple) updateMultiple(`${year}`, "year");
|
|
552
525
|
else {
|
|
553
526
|
call(updateModelValue, `${year}`);
|
|
554
527
|
call(onChange, `${year}`);
|
|
@@ -599,8 +572,7 @@ const __sfc__ = defineComponent({
|
|
|
599
572
|
return true;
|
|
600
573
|
}
|
|
601
574
|
function invalidFormatDate(date) {
|
|
602
|
-
if (isArray(date))
|
|
603
|
-
return false;
|
|
575
|
+
if (isArray(date)) return false;
|
|
604
576
|
if (date === "Invalid Date") {
|
|
605
577
|
console.error('[Varlet] DatePicker: "modelValue" is an Invalid Date');
|
|
606
578
|
return true;
|
|
@@ -612,8 +584,7 @@ const __sfc__ = defineComponent({
|
|
|
612
584
|
const formatType = type === "year" ? "YYYY" : type === "month" ? "YYYY-MM" : "YYYY-MM-D";
|
|
613
585
|
const formatDateList = value.map((choose) => dayjs(choose).format(formatType)).slice(0, 2);
|
|
614
586
|
const isValid = rangeDate.value.some((date) => invalidFormatDate(date));
|
|
615
|
-
if (isValid)
|
|
616
|
-
return;
|
|
587
|
+
if (isValid) return;
|
|
617
588
|
rangeDate.value = formatDateList;
|
|
618
589
|
const isChangeOrder = dayjs(rangeDate.value[0]).isAfter(rangeDate.value[1]);
|
|
619
590
|
if (rangeDate.value.length === 2 && isChangeOrder) {
|
|
@@ -628,8 +599,7 @@ const __sfc__ = defineComponent({
|
|
|
628
599
|
}
|
|
629
600
|
function dateInit(value) {
|
|
630
601
|
const formatDate = dayjs(value).format("YYYY-MM-D");
|
|
631
|
-
if (invalidFormatDate(formatDate))
|
|
632
|
-
return;
|
|
602
|
+
if (invalidFormatDate(formatDate)) return;
|
|
633
603
|
const [yearValue, monthValue, dayValue] = formatDate.split("-");
|
|
634
604
|
const monthDes2 = MONTH_LIST.find((month) => month === monthValue);
|
|
635
605
|
chooseMonth.value = monthDes2;
|
|
@@ -106,7 +106,8 @@ function __render__(_ctx, _cache) {
|
|
|
106
106
|
"var-day-picker-cover": "",
|
|
107
107
|
round: "",
|
|
108
108
|
ripple: false,
|
|
109
|
-
elevation: _ctx.componentProps.buttonElevation
|
|
109
|
+
elevation: _ctx.componentProps.buttonElevation,
|
|
110
|
+
ref_for: true
|
|
110
111
|
}, __spreadValues({}, _ctx.buttonProps(day)), {
|
|
111
112
|
onClick: (event) => _ctx.chooseDay(day, event)
|
|
112
113
|
}), {
|
|
@@ -232,10 +233,8 @@ const __sfc__ = defineComponent({
|
|
|
232
233
|
let isBeforeMax = true;
|
|
233
234
|
let isAfterMin = true;
|
|
234
235
|
const previewDate = `${previewYear}-${previewMonth}-${day}`;
|
|
235
|
-
if (max)
|
|
236
|
-
|
|
237
|
-
if (min)
|
|
238
|
-
isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "day");
|
|
236
|
+
if (max) isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "day");
|
|
237
|
+
if (min) isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "day");
|
|
239
238
|
return isBeforeMax && isAfterMin;
|
|
240
239
|
};
|
|
241
240
|
const shouldChoose = (val) => {
|
|
@@ -244,8 +243,7 @@ const __sfc__ = defineComponent({
|
|
|
244
243
|
componentProps: { range }
|
|
245
244
|
} = props;
|
|
246
245
|
if (range) {
|
|
247
|
-
if (!chooseRangeDay.length)
|
|
248
|
-
return false;
|
|
246
|
+
if (!chooseRangeDay.length) return false;
|
|
249
247
|
const isBeforeMax = dayjs(val).isSameOrBefore(dayjs(chooseRangeDay[1]), "day");
|
|
250
248
|
const isAfterMin = dayjs(val).isSameOrAfter(dayjs(chooseRangeDay[0]), "day");
|
|
251
249
|
return isBeforeMax && isAfterMin;
|
|
@@ -269,43 +267,31 @@ const __sfc__ = defineComponent({
|
|
|
269
267
|
} = props;
|
|
270
268
|
const val = `${previewYear}-${previewMonth}-${day}`;
|
|
271
269
|
const dayExist = () => {
|
|
272
|
-
if (range || multiple)
|
|
273
|
-
return shouldChoose(val);
|
|
270
|
+
if (range || multiple) return shouldChoose(val);
|
|
274
271
|
return toNumber(chooseDay2) === day && isSame.value;
|
|
275
272
|
};
|
|
276
273
|
const computeDisabled = () => {
|
|
277
|
-
if (!inRange(day))
|
|
278
|
-
|
|
279
|
-
if (!allowedDates)
|
|
280
|
-
return false;
|
|
274
|
+
if (!inRange(day)) return true;
|
|
275
|
+
if (!allowedDates) return false;
|
|
281
276
|
return !allowedDates(val);
|
|
282
277
|
};
|
|
283
278
|
const disabled = computeDisabled();
|
|
284
279
|
const computeText = () => {
|
|
285
|
-
if (disabled)
|
|
286
|
-
|
|
287
|
-
if (range || multiple)
|
|
288
|
-
return !shouldChoose(val);
|
|
280
|
+
if (disabled) return true;
|
|
281
|
+
if (range || multiple) return !shouldChoose(val);
|
|
289
282
|
return !isSame.value || toNumber(chooseDay2) !== day;
|
|
290
283
|
};
|
|
291
284
|
const computeOutline = () => {
|
|
292
|
-
if (!(isCurrent.value && toNumber(currentDay) === day && props.componentProps.showCurrent))
|
|
293
|
-
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
if (range || multiple)
|
|
297
|
-
return !shouldChoose(val);
|
|
298
|
-
if (isSame.value)
|
|
299
|
-
return chooseDay2 !== currentDay;
|
|
285
|
+
if (!(isCurrent.value && toNumber(currentDay) === day && props.componentProps.showCurrent)) return false;
|
|
286
|
+
if ((range || multiple || isSame.value) && disabled) return true;
|
|
287
|
+
if (range || multiple) return !shouldChoose(val);
|
|
288
|
+
if (isSame.value) return chooseDay2 !== currentDay;
|
|
300
289
|
return true;
|
|
301
290
|
};
|
|
302
291
|
const textColorOrCover = () => {
|
|
303
|
-
if (disabled)
|
|
304
|
-
|
|
305
|
-
if (
|
|
306
|
-
return color != null ? color : "";
|
|
307
|
-
if (dayExist())
|
|
308
|
-
return "";
|
|
292
|
+
if (disabled) return "";
|
|
293
|
+
if (computeOutline()) return color != null ? color : "";
|
|
294
|
+
if (dayExist()) return "";
|
|
309
295
|
return `${nDate()}-color-cover`;
|
|
310
296
|
};
|
|
311
297
|
const isCover = textColorOrCover().startsWith(nDate());
|
|
@@ -325,8 +311,7 @@ const __sfc__ = defineComponent({
|
|
|
325
311
|
};
|
|
326
312
|
const chooseDay = (day, event) => {
|
|
327
313
|
const buttonEl = event.currentTarget;
|
|
328
|
-
if (buttonEl.classList.contains(n("button--disabled")))
|
|
329
|
-
return;
|
|
314
|
+
if (buttonEl.classList.contains(n("button--disabled"))) return;
|
|
330
315
|
emit("choose-day", day);
|
|
331
316
|
};
|
|
332
317
|
const forwardRef = (checkType) => {
|
|
@@ -67,7 +67,8 @@ function __render__(_ctx, _cache) {
|
|
|
67
67
|
type: "primary",
|
|
68
68
|
"var-month-picker-cover": "",
|
|
69
69
|
ripple: false,
|
|
70
|
-
elevation: _ctx.componentProps.buttonElevation
|
|
70
|
+
elevation: _ctx.componentProps.buttonElevation,
|
|
71
|
+
ref_for: true
|
|
71
72
|
}, __spreadValues({}, _ctx.buttonProps(month)), {
|
|
72
73
|
onClick: (event) => _ctx.chooseMonth(month, event)
|
|
73
74
|
}), {
|
|
@@ -153,10 +154,8 @@ const __sfc__ = defineComponent({
|
|
|
153
154
|
let isBeforeMax = true;
|
|
154
155
|
let isAfterMin = true;
|
|
155
156
|
const previewDate = `${previewYear}-${key}`;
|
|
156
|
-
if (max)
|
|
157
|
-
|
|
158
|
-
if (min)
|
|
159
|
-
isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "month");
|
|
157
|
+
if (max) isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "month");
|
|
158
|
+
if (min) isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "month");
|
|
160
159
|
return isBeforeMax && isAfterMin;
|
|
161
160
|
};
|
|
162
161
|
const shouldChoose = (val) => {
|
|
@@ -165,14 +164,12 @@ const __sfc__ = defineComponent({
|
|
|
165
164
|
componentProps: { type, range }
|
|
166
165
|
} = props;
|
|
167
166
|
if (range) {
|
|
168
|
-
if (!chooseRangeMonth.length)
|
|
169
|
-
return false;
|
|
167
|
+
if (!chooseRangeMonth.length) return false;
|
|
170
168
|
const isBeforeMax = dayjs(val).isSameOrBefore(dayjs(chooseRangeMonth[1]), "month");
|
|
171
169
|
const isAfterMin = dayjs(val).isSameOrAfter(dayjs(chooseRangeMonth[0]), "month");
|
|
172
170
|
return isBeforeMax && isAfterMin;
|
|
173
171
|
}
|
|
174
|
-
if (type === "month")
|
|
175
|
-
return chooseMonths.includes(val);
|
|
172
|
+
if (type === "month") return chooseMonths.includes(val);
|
|
176
173
|
return chooseDays.some((value) => value.includes(val));
|
|
177
174
|
};
|
|
178
175
|
const buttonProps = (key) => {
|
|
@@ -183,43 +180,31 @@ const __sfc__ = defineComponent({
|
|
|
183
180
|
} = props;
|
|
184
181
|
const val = `${previewYear}-${key}`;
|
|
185
182
|
const monthExist = () => {
|
|
186
|
-
if (range || multiple)
|
|
187
|
-
return shouldChoose(val);
|
|
183
|
+
if (range || multiple) return shouldChoose(val);
|
|
188
184
|
return chooseMonth2 === key && isSameYear.value;
|
|
189
185
|
};
|
|
190
186
|
const computeDisabled = () => {
|
|
191
|
-
if (!inRange(key))
|
|
192
|
-
|
|
193
|
-
if (!allowedDates)
|
|
194
|
-
return false;
|
|
187
|
+
if (!inRange(key)) return true;
|
|
188
|
+
if (!allowedDates) return false;
|
|
195
189
|
return !allowedDates(val);
|
|
196
190
|
};
|
|
197
191
|
const disabled = computeDisabled();
|
|
198
192
|
const computeText = () => {
|
|
199
|
-
if (disabled)
|
|
200
|
-
|
|
201
|
-
if (range || multiple)
|
|
202
|
-
return !shouldChoose(val);
|
|
193
|
+
if (disabled) return true;
|
|
194
|
+
if (range || multiple) return !shouldChoose(val);
|
|
203
195
|
return !isSameYear.value || chooseMonth2 !== key;
|
|
204
196
|
};
|
|
205
197
|
const computeOutline = () => {
|
|
206
|
-
if (!(isCurrentYear.value && currentMonth === key && props.componentProps.showCurrent))
|
|
207
|
-
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
if (range || multiple)
|
|
211
|
-
return !shouldChoose(val);
|
|
212
|
-
if (isSameYear.value)
|
|
213
|
-
return chooseMonth2 !== currentMonth;
|
|
198
|
+
if (!(isCurrentYear.value && currentMonth === key && props.componentProps.showCurrent)) return false;
|
|
199
|
+
if ((range || multiple || isSameYear.value) && disabled) return true;
|
|
200
|
+
if (range || multiple) return !shouldChoose(val);
|
|
201
|
+
if (isSameYear.value) return chooseMonth2 !== currentMonth;
|
|
214
202
|
return true;
|
|
215
203
|
};
|
|
216
204
|
const textColorOrCover = () => {
|
|
217
|
-
if (disabled)
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
return color != null ? color : "";
|
|
221
|
-
if (monthExist())
|
|
222
|
-
return "";
|
|
205
|
+
if (disabled) return "";
|
|
206
|
+
if (computeOutline()) return color != null ? color : "";
|
|
207
|
+
if (monthExist()) return "";
|
|
223
208
|
return `${nDate()}-color-cover`;
|
|
224
209
|
};
|
|
225
210
|
const isCover = textColorOrCover().startsWith(nDate());
|
|
@@ -235,8 +220,7 @@ const __sfc__ = defineComponent({
|
|
|
235
220
|
};
|
|
236
221
|
const chooseMonth = (month, event) => {
|
|
237
222
|
const buttonEl = event.currentTarget;
|
|
238
|
-
if (buttonEl.classList.contains(n("button--disabled")))
|
|
239
|
-
return;
|
|
223
|
+
if (buttonEl.classList.contains(n("button--disabled"))) return;
|
|
240
224
|
emit("choose-month", month);
|
|
241
225
|
};
|
|
242
226
|
const checkDate = (checkType) => {
|
|
@@ -253,10 +237,8 @@ const __sfc__ = defineComponent({
|
|
|
253
237
|
const {
|
|
254
238
|
componentProps: { min, max }
|
|
255
239
|
} = props;
|
|
256
|
-
if (max)
|
|
257
|
-
|
|
258
|
-
if (min)
|
|
259
|
-
panelBtnDisabled.left = !dayjs(`${toNumber(year) - 1}`).isSameOrAfter(dayjs(min), "year");
|
|
240
|
+
if (max) panelBtnDisabled.right = !dayjs(`${toNumber(year) + 1}`).isSameOrBefore(dayjs(max), "year");
|
|
241
|
+
if (min) panelBtnDisabled.left = !dayjs(`${toNumber(year) - 1}`).isSameOrAfter(dayjs(min), "year");
|
|
260
242
|
},
|
|
261
243
|
{ immediate: true }
|
|
262
244
|
);
|
|
@@ -104,16 +104,13 @@ const __sfc__ = defineComponent({
|
|
|
104
104
|
var _a;
|
|
105
105
|
const { date, type } = props;
|
|
106
106
|
const { previewMonth, previewYear } = date;
|
|
107
|
-
if (type === "year")
|
|
108
|
-
|
|
109
|
-
if (type === "month")
|
|
110
|
-
return toNumber(previewYear) + forwardOrBackNum.value;
|
|
107
|
+
if (type === "year") return previewYear;
|
|
108
|
+
if (type === "month") return toNumber(previewYear) + forwardOrBackNum.value;
|
|
111
109
|
const monthName = (_a = (pt || t)("datePickerMonthDict")) == null ? void 0 : _a[previewMonth].name;
|
|
112
110
|
return (pt || t)("lang") === "zh-CN" ? `${previewYear} ${monthName}` : `${monthName} ${previewYear}`;
|
|
113
111
|
});
|
|
114
112
|
const checkDate = (checkType) => {
|
|
115
|
-
if (checkType === "prev" && props.disabled.left || checkType === "next" && props.disabled.right)
|
|
116
|
-
return;
|
|
113
|
+
if (checkType === "prev" && props.disabled.left || checkType === "next" && props.disabled.right) return;
|
|
117
114
|
emit("check-date", checkType);
|
|
118
115
|
reverse.value = checkType === "prev";
|
|
119
116
|
forwardOrBackNum.value += checkType === "prev" ? -1 : 1;
|