@varlet/ui 3.18.1 → 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/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 +95 -46
- 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 +61 -22
- 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/slider/Slider.mjs +1 -1
- package/es/step/Step.mjs +50 -20
- package/es/step/step.css +1 -1
- package/es/style.mjs +1 -0
- package/es/switch/Switch.mjs +1 -1
- 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 +11926 -10653
- package/highlight/web-types.en-US.json +599 -73
- package/highlight/web-types.zh-CN.json +572 -67
- package/lib/varlet.cjs.js +5616 -4186
- 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
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { toNumber } from "@varlet/shared";
|
|
2
|
-
import { computed, defineComponent, ref, watch } from "vue";
|
|
3
|
-
import VarButton from "../../button/index.mjs";
|
|
4
|
-
import VarIcon from "../../icon/index.mjs";
|
|
5
|
-
import { t } from "../../locale/index.mjs";
|
|
6
|
-
import { injectLocaleProvider } from "../../locale-provider/provide.mjs";
|
|
7
|
-
import { createNamespace } from "../../utils/components.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, openBlock as _openBlock, createElementBlock as _createElementBlock, Transition as _Transition, createElementVNode as _createElementVNode } 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())
|
|
17
|
-
},
|
|
18
|
-
[
|
|
19
|
-
_createVNode(_component_var_button, {
|
|
20
|
-
class: _normalizeClass(_ctx.n("arrow")),
|
|
21
|
-
"var-date-picker-header-cover": "",
|
|
22
|
-
round: "",
|
|
23
|
-
text: "",
|
|
24
|
-
disabled: _ctx.disabled.left,
|
|
25
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.checkDate("prev"))
|
|
26
|
-
}, {
|
|
27
|
-
default: _withCtx(() => [
|
|
28
|
-
_createVNode(_component_var_icon, { name: "chevron-left" })
|
|
29
|
-
]),
|
|
30
|
-
_: 1
|
|
31
|
-
/* STABLE */
|
|
32
|
-
}, 8, ["class", "disabled"]),
|
|
33
|
-
_createElementVNode(
|
|
34
|
-
"div",
|
|
35
|
-
{
|
|
36
|
-
class: _normalizeClass(_ctx.n("value")),
|
|
37
|
-
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("check-panel"))
|
|
38
|
-
},
|
|
39
|
-
[
|
|
40
|
-
_createVNode(_Transition, {
|
|
41
|
-
name: `var-date-picker${_ctx.reverse ? "-reverse" : ""}-translatex`
|
|
42
|
-
}, {
|
|
43
|
-
default: _withCtx(() => [
|
|
44
|
-
(_openBlock(), _createElementBlock(
|
|
45
|
-
"div",
|
|
46
|
-
{ key: _ctx.showDate },
|
|
47
|
-
_toDisplayString(_ctx.showDate),
|
|
48
|
-
1
|
|
49
|
-
/* TEXT */
|
|
50
|
-
))
|
|
51
|
-
]),
|
|
52
|
-
_: 1
|
|
53
|
-
/* STABLE */
|
|
54
|
-
}, 8, ["name"])
|
|
55
|
-
],
|
|
56
|
-
2
|
|
57
|
-
/* CLASS */
|
|
58
|
-
),
|
|
59
|
-
_createVNode(_component_var_button, {
|
|
60
|
-
class: _normalizeClass(_ctx.n("arrow")),
|
|
61
|
-
"var-date-picker-header-cover": "",
|
|
62
|
-
round: "",
|
|
63
|
-
text: "",
|
|
64
|
-
disabled: _ctx.disabled.right,
|
|
65
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.checkDate("next"))
|
|
66
|
-
}, {
|
|
67
|
-
default: _withCtx(() => [
|
|
68
|
-
_createVNode(_component_var_icon, { name: "chevron-right" })
|
|
69
|
-
]),
|
|
70
|
-
_: 1
|
|
71
|
-
/* STABLE */
|
|
72
|
-
}, 8, ["class", "disabled"])
|
|
73
|
-
],
|
|
74
|
-
2
|
|
75
|
-
/* CLASS */
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
const __sfc__ = defineComponent({
|
|
79
|
-
name: "PanelHeader",
|
|
80
|
-
components: {
|
|
81
|
-
VarButton,
|
|
82
|
-
VarIcon
|
|
83
|
-
},
|
|
84
|
-
props: {
|
|
85
|
-
date: {
|
|
86
|
-
type: Object,
|
|
87
|
-
required: true
|
|
88
|
-
},
|
|
89
|
-
type: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: "date"
|
|
92
|
-
},
|
|
93
|
-
disabled: {
|
|
94
|
-
type: Object,
|
|
95
|
-
required: true
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
emits: ["check-panel", "check-date"],
|
|
99
|
-
setup(props, { emit }) {
|
|
100
|
-
const reverse = ref(false);
|
|
101
|
-
const forwardOrBackNum = ref(0);
|
|
102
|
-
const { t: pt } = injectLocaleProvider();
|
|
103
|
-
const showDate = computed(() => {
|
|
104
|
-
var _a;
|
|
105
|
-
const { date, type } = props;
|
|
106
|
-
const { previewMonth, previewYear } = date;
|
|
107
|
-
if (type === "year") {
|
|
108
|
-
return previewYear;
|
|
109
|
-
}
|
|
110
|
-
if (type === "month") {
|
|
111
|
-
return toNumber(previewYear) + forwardOrBackNum.value;
|
|
112
|
-
}
|
|
113
|
-
const monthName = (_a = (pt || t)("datePickerMonthDict")) == null ? void 0 : _a[previewMonth].name;
|
|
114
|
-
return (pt || t)("lang") === "zh-CN" ? `${previewYear} ${monthName}` : `${monthName} ${previewYear}`;
|
|
115
|
-
});
|
|
116
|
-
const checkDate = (checkType) => {
|
|
117
|
-
if (checkType === "prev" && props.disabled.left || checkType === "next" && props.disabled.right) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
emit("check-date", checkType);
|
|
121
|
-
reverse.value = checkType === "prev";
|
|
122
|
-
forwardOrBackNum.value += checkType === "prev" ? -1 : 1;
|
|
123
|
-
};
|
|
124
|
-
watch(
|
|
125
|
-
() => props.date,
|
|
126
|
-
() => {
|
|
127
|
-
forwardOrBackNum.value = 0;
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
return {
|
|
131
|
-
n,
|
|
132
|
-
reverse,
|
|
133
|
-
showDate,
|
|
134
|
-
checkDate
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
__sfc__.render = __render__;
|
|
139
|
-
var stdin_default = __sfc__;
|
|
140
|
-
export {
|
|
141
|
-
stdin_default as default
|
|
142
|
-
};
|
|
@@ -1,311 +0,0 @@
|
|
|
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 { toNumber } from "@varlet/shared";
|
|
18
|
-
import { onSmartMounted } from "@varlet/use";
|
|
19
|
-
import dayjs from "dayjs/esm/index.js";
|
|
20
|
-
import {
|
|
21
|
-
computed,
|
|
22
|
-
defineComponent,
|
|
23
|
-
reactive,
|
|
24
|
-
ref,
|
|
25
|
-
watch
|
|
26
|
-
} from "vue";
|
|
27
|
-
import VarButton from "../../button/index.mjs";
|
|
28
|
-
import VarSticky from "../../sticky/index.mjs";
|
|
29
|
-
import { createNamespace } from "../../utils/components.mjs";
|
|
30
|
-
import PanelHeader from "./panel-header.mjs";
|
|
31
|
-
const { n, classes } = createNamespace("year-picker");
|
|
32
|
-
const { n: nDate } = createNamespace("date-picker");
|
|
33
|
-
import { resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, mergeProps as _mergeProps, normalizeClass as _normalizeClass, Transition as _Transition } from "vue";
|
|
34
|
-
function __render__(_ctx, _cache) {
|
|
35
|
-
const _component_panel_header = _resolveComponent("panel-header");
|
|
36
|
-
const _component_var_sticky = _resolveComponent("var-sticky");
|
|
37
|
-
const _component_var_button = _resolveComponent("var-button");
|
|
38
|
-
return _openBlock(), _createElementBlock("div", null, [
|
|
39
|
-
_createVNode(_component_var_sticky, { "css-mode": "" }, {
|
|
40
|
-
default: _withCtx(() => [
|
|
41
|
-
_createVNode(_component_panel_header, {
|
|
42
|
-
ref: "headerEl",
|
|
43
|
-
type: "year",
|
|
44
|
-
date: {
|
|
45
|
-
previewYear: `${_ctx.yearList[0]} ~ ${_ctx.yearList[_ctx.yearList.length - 1]}`
|
|
46
|
-
},
|
|
47
|
-
disabled: _ctx.panelBtnDisabled,
|
|
48
|
-
onCheckDate: _ctx.checkDate
|
|
49
|
-
}, null, 8, ["date", "disabled", "onCheckDate"])
|
|
50
|
-
]),
|
|
51
|
-
_: 1
|
|
52
|
-
/* STABLE */
|
|
53
|
-
}),
|
|
54
|
-
_createVNode(_Transition, {
|
|
55
|
-
name: `${_ctx.nDate()}${_ctx.reverse ? "-reverse" : ""}-translatex`
|
|
56
|
-
}, {
|
|
57
|
-
default: _withCtx(() => [
|
|
58
|
-
(_openBlock(), _createElementBlock(
|
|
59
|
-
"ul",
|
|
60
|
-
{
|
|
61
|
-
ref: "panel",
|
|
62
|
-
key: _ctx.panelKey,
|
|
63
|
-
class: _normalizeClass(_ctx.n())
|
|
64
|
-
},
|
|
65
|
-
[
|
|
66
|
-
(_openBlock(true), _createElementBlock(
|
|
67
|
-
_Fragment,
|
|
68
|
-
null,
|
|
69
|
-
_renderList(_ctx.yearList, (year) => {
|
|
70
|
-
return _openBlock(), _createElementBlock("li", { key: year }, [
|
|
71
|
-
_createVNode(_component_var_button, _mergeProps({
|
|
72
|
-
type: "primary",
|
|
73
|
-
"var-year-picker-cover": "",
|
|
74
|
-
ripple: false,
|
|
75
|
-
elevation: _ctx.componentProps.buttonElevation
|
|
76
|
-
}, { ref_for: true }, __spreadValues({}, _ctx.buttonProps(`${year}`)), {
|
|
77
|
-
onClick: (event) => _ctx.chooseYear(year, event)
|
|
78
|
-
}), {
|
|
79
|
-
default: _withCtx(() => [
|
|
80
|
-
_createTextVNode(
|
|
81
|
-
_toDisplayString(year),
|
|
82
|
-
1
|
|
83
|
-
/* TEXT */
|
|
84
|
-
)
|
|
85
|
-
]),
|
|
86
|
-
_: 2
|
|
87
|
-
/* DYNAMIC */
|
|
88
|
-
}, 1040, ["elevation", "onClick"])
|
|
89
|
-
]);
|
|
90
|
-
}),
|
|
91
|
-
128
|
|
92
|
-
/* KEYED_FRAGMENT */
|
|
93
|
-
))
|
|
94
|
-
],
|
|
95
|
-
2
|
|
96
|
-
/* CLASS */
|
|
97
|
-
))
|
|
98
|
-
]),
|
|
99
|
-
_: 1
|
|
100
|
-
/* STABLE */
|
|
101
|
-
}, 8, ["name"])
|
|
102
|
-
]);
|
|
103
|
-
}
|
|
104
|
-
const __sfc__ = defineComponent({
|
|
105
|
-
name: "YearPickerPanel",
|
|
106
|
-
components: {
|
|
107
|
-
VarButton,
|
|
108
|
-
VarSticky,
|
|
109
|
-
PanelHeader
|
|
110
|
-
},
|
|
111
|
-
props: {
|
|
112
|
-
choose: {
|
|
113
|
-
type: Object,
|
|
114
|
-
required: true
|
|
115
|
-
},
|
|
116
|
-
current: {
|
|
117
|
-
type: String,
|
|
118
|
-
required: true
|
|
119
|
-
},
|
|
120
|
-
preview: {
|
|
121
|
-
type: String
|
|
122
|
-
},
|
|
123
|
-
componentProps: {
|
|
124
|
-
type: Object,
|
|
125
|
-
required: true
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
emits: ["choose-year"],
|
|
129
|
-
setup(props, { emit }) {
|
|
130
|
-
const [currentYear] = props.current.split("-");
|
|
131
|
-
const panel = ref();
|
|
132
|
-
const headerEl = ref(null);
|
|
133
|
-
const reverse = ref(false);
|
|
134
|
-
const panelKey = ref(0);
|
|
135
|
-
const page = ref(0);
|
|
136
|
-
const panelBtnDisabled = reactive({
|
|
137
|
-
left: false,
|
|
138
|
-
right: false
|
|
139
|
-
});
|
|
140
|
-
const yearList = computed(() => {
|
|
141
|
-
if (!props.preview) {
|
|
142
|
-
return [];
|
|
143
|
-
}
|
|
144
|
-
const startYear = Math.floor(toNumber(props.preview) / 100 + page.value) * 100;
|
|
145
|
-
return Array.from(Array(100), (_v, k) => Math.max(0, startYear) + k);
|
|
146
|
-
});
|
|
147
|
-
const shouldChoose = (val) => {
|
|
148
|
-
const {
|
|
149
|
-
choose: { chooseMonths, chooseDays, chooseYears, chooseRangeYear },
|
|
150
|
-
componentProps: { type, range }
|
|
151
|
-
} = props;
|
|
152
|
-
if (range) {
|
|
153
|
-
if (!chooseRangeYear.length) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
const isBeforeMax = dayjs(val).isSameOrBefore(dayjs(chooseRangeYear[1]), "year");
|
|
157
|
-
const isAfterMin = dayjs(val).isSameOrAfter(dayjs(chooseRangeYear[0]), "year");
|
|
158
|
-
return isBeforeMax && isAfterMin;
|
|
159
|
-
}
|
|
160
|
-
if (type === "year") {
|
|
161
|
-
return chooseYears.includes(val);
|
|
162
|
-
}
|
|
163
|
-
if (type === "month") {
|
|
164
|
-
return chooseMonths.some((value) => value.includes(val));
|
|
165
|
-
}
|
|
166
|
-
return chooseDays.some((value) => value.includes(val));
|
|
167
|
-
};
|
|
168
|
-
const inRange = (year) => {
|
|
169
|
-
const {
|
|
170
|
-
componentProps: { min, max }
|
|
171
|
-
} = props;
|
|
172
|
-
const isBeforeMax = max ? dayjs(year).isSameOrBefore(dayjs(max), "year") : true;
|
|
173
|
-
const isAfterMin = min ? dayjs(year).isSameOrAfter(dayjs(min), "year") : true;
|
|
174
|
-
return isBeforeMax && isAfterMin;
|
|
175
|
-
};
|
|
176
|
-
const buttonProps = (year) => {
|
|
177
|
-
const {
|
|
178
|
-
choose: { chooseYear: chooseYear2 },
|
|
179
|
-
componentProps: { allowedDates, color, multiple, range }
|
|
180
|
-
} = props;
|
|
181
|
-
const yearExist = () => {
|
|
182
|
-
if (range || multiple) {
|
|
183
|
-
return shouldChoose(year);
|
|
184
|
-
}
|
|
185
|
-
return chooseYear2 === year;
|
|
186
|
-
};
|
|
187
|
-
const computeDisabled = () => {
|
|
188
|
-
if (!inRange(year)) {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
if (!allowedDates) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
return !allowedDates(year);
|
|
195
|
-
};
|
|
196
|
-
const disabled = computeDisabled();
|
|
197
|
-
const computeText = () => {
|
|
198
|
-
if (disabled) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
if (range || multiple) {
|
|
202
|
-
return !shouldChoose(year);
|
|
203
|
-
}
|
|
204
|
-
return chooseYear2 !== year;
|
|
205
|
-
};
|
|
206
|
-
const computeOutline = () => {
|
|
207
|
-
if (!(currentYear === year && props.componentProps.showCurrent)) {
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
if ((range || multiple) && disabled) {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
if (range || multiple) {
|
|
214
|
-
return !shouldChoose(year);
|
|
215
|
-
}
|
|
216
|
-
return chooseYear2 !== currentYear;
|
|
217
|
-
};
|
|
218
|
-
const textColorOrCover = () => {
|
|
219
|
-
if (disabled) {
|
|
220
|
-
return "";
|
|
221
|
-
}
|
|
222
|
-
if (computeOutline()) {
|
|
223
|
-
return color != null ? color : "";
|
|
224
|
-
}
|
|
225
|
-
if (yearExist()) {
|
|
226
|
-
return "";
|
|
227
|
-
}
|
|
228
|
-
return `${nDate()}-color-cover`;
|
|
229
|
-
};
|
|
230
|
-
const isCover = textColorOrCover().startsWith(nDate());
|
|
231
|
-
return {
|
|
232
|
-
outline: computeOutline(),
|
|
233
|
-
text: computeText(),
|
|
234
|
-
color: !computeText() ? color : "",
|
|
235
|
-
textColor: isCover ? "" : textColorOrCover(),
|
|
236
|
-
[`${nDate()}-color-cover`]: isCover,
|
|
237
|
-
class: classes(n("button"), [disabled, n("button--disabled")]),
|
|
238
|
-
disabled
|
|
239
|
-
};
|
|
240
|
-
};
|
|
241
|
-
const chooseYear = (year, event) => {
|
|
242
|
-
const buttonEl = event.currentTarget;
|
|
243
|
-
if (buttonEl.classList.contains(n("button--disabled"))) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
emit("choose-year", year);
|
|
247
|
-
};
|
|
248
|
-
const scrollToView = () => {
|
|
249
|
-
var _a;
|
|
250
|
-
const activeEl = (_a = panel.value.querySelector(".var-button--primary")) != null ? _a : panel.value.querySelector(".var-button--outline");
|
|
251
|
-
activeEl == null ? void 0 : activeEl.scrollIntoView({
|
|
252
|
-
block: "center"
|
|
253
|
-
});
|
|
254
|
-
};
|
|
255
|
-
const checkDate = (checkType) => {
|
|
256
|
-
const isPrevType = checkType === "prev";
|
|
257
|
-
reverse.value = isPrevType;
|
|
258
|
-
panelKey.value += isPrevType ? -1 : 1;
|
|
259
|
-
page.value += isPrevType ? -1 : 1;
|
|
260
|
-
};
|
|
261
|
-
const forwardRef = (checkType) => {
|
|
262
|
-
headerEl.value.checkDate(checkType);
|
|
263
|
-
};
|
|
264
|
-
onSmartMounted(scrollToView);
|
|
265
|
-
watch(
|
|
266
|
-
() => props.preview,
|
|
267
|
-
() => {
|
|
268
|
-
page.value = 0;
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
|
-
watch(
|
|
272
|
-
() => [yearList.value, props.componentProps.max, props.componentProps.min],
|
|
273
|
-
(newVal) => {
|
|
274
|
-
const [list, max, min] = newVal;
|
|
275
|
-
if (max) {
|
|
276
|
-
panelBtnDisabled.right = !dayjs(`${toNumber(list[list.length - 1])}`).isSameOrBefore(dayjs(max), "year");
|
|
277
|
-
}
|
|
278
|
-
if (min) {
|
|
279
|
-
panelBtnDisabled.left = !dayjs(`${toNumber(list[0])}`).isSameOrAfter(dayjs(min), "year");
|
|
280
|
-
}
|
|
281
|
-
if (toNumber(list[0] <= 0)) {
|
|
282
|
-
panelBtnDisabled.left = false;
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
immediate: true
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
return {
|
|
290
|
-
n,
|
|
291
|
-
classes,
|
|
292
|
-
buttonProps,
|
|
293
|
-
panel,
|
|
294
|
-
headerEl,
|
|
295
|
-
yearList,
|
|
296
|
-
reverse,
|
|
297
|
-
panelKey,
|
|
298
|
-
panelBtnDisabled,
|
|
299
|
-
nDate,
|
|
300
|
-
checkDate,
|
|
301
|
-
chooseYear,
|
|
302
|
-
forwardRef,
|
|
303
|
-
toNumber
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
__sfc__.render = __render__;
|
|
308
|
-
var stdin_default = __sfc__;
|
|
309
|
-
export {
|
|
310
|
-
stdin_default as default
|
|
311
|
-
};
|