@nutui/nutui 4.0.12-beta.1 → 4.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nutui.es.js +1 -1
- package/dist/nutui.js +1 -1
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +50 -50
- package/dist/styles/themes/jdb.scss +50 -50
- package/dist/styles/themes/jddkh.scss +50 -50
- package/dist/styles/themes/jdt.scss +50 -50
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,36 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { reactive, computed, onBeforeMount, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, renderSlot } from "vue";
|
|
21
|
+
import Picker from "./Picker.js";
|
|
22
|
+
import { c as createComponent, a as isDate$1, p as padZero } from "./component-81a4c1d0.js";
|
|
23
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
24
|
+
import "./pxCheck-c6b9f6b7.js";
|
|
25
|
+
import "./index-7a7385e4.js";
|
|
19
26
|
import "../locale/lang";
|
|
20
|
-
const { componentName
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
const { componentName, create, translate } = createComponent("date-picker");
|
|
28
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
29
|
+
function isDate(val) {
|
|
30
|
+
return isDate$1(val) && !isNaN(val.getTime());
|
|
23
31
|
}
|
|
24
|
-
const
|
|
25
|
-
day:
|
|
26
|
-
year:
|
|
27
|
-
month:
|
|
28
|
-
hour:
|
|
29
|
-
minute:
|
|
30
|
-
seconds:
|
|
31
|
-
}
|
|
32
|
+
const zhCNType = {
|
|
33
|
+
day: translate("day"),
|
|
34
|
+
year: translate("year"),
|
|
35
|
+
month: translate("month"),
|
|
36
|
+
hour: translate("hour"),
|
|
37
|
+
minute: translate("minute"),
|
|
38
|
+
seconds: translate("seconds")
|
|
39
|
+
};
|
|
40
|
+
const _sfc_main = create({
|
|
32
41
|
components: {
|
|
33
|
-
[
|
|
42
|
+
[Picker.name]: Picker
|
|
34
43
|
},
|
|
35
44
|
props: {
|
|
36
45
|
modelValue: null,
|
|
@@ -52,7 +61,7 @@ const ne = {
|
|
|
52
61
|
},
|
|
53
62
|
isShowChinese: {
|
|
54
63
|
type: Boolean,
|
|
55
|
-
default:
|
|
64
|
+
default: false
|
|
56
65
|
},
|
|
57
66
|
minuteStep: {
|
|
58
67
|
type: Number,
|
|
@@ -60,13 +69,13 @@ const ne = {
|
|
|
60
69
|
},
|
|
61
70
|
minDate: {
|
|
62
71
|
type: Date,
|
|
63
|
-
default: () => new Date(
|
|
64
|
-
validator:
|
|
72
|
+
default: () => new Date(currentYear - 10, 0, 1),
|
|
73
|
+
validator: isDate
|
|
65
74
|
},
|
|
66
75
|
maxDate: {
|
|
67
76
|
type: Date,
|
|
68
|
-
default: () => new Date(
|
|
69
|
-
validator:
|
|
77
|
+
default: () => new Date(currentYear + 10, 11, 31),
|
|
78
|
+
validator: isDate
|
|
70
79
|
},
|
|
71
80
|
formatter: {
|
|
72
81
|
type: Function,
|
|
@@ -75,7 +84,7 @@ const ne = {
|
|
|
75
84
|
// 是否开启3D效果
|
|
76
85
|
threeDimensional: {
|
|
77
86
|
type: Boolean,
|
|
78
|
-
default:
|
|
87
|
+
default: true
|
|
79
88
|
},
|
|
80
89
|
// 惯性滚动 时长
|
|
81
90
|
swipeDuration: {
|
|
@@ -85,7 +94,7 @@ const ne = {
|
|
|
85
94
|
filter: Function,
|
|
86
95
|
showToolbar: {
|
|
87
96
|
type: Boolean,
|
|
88
|
-
default:
|
|
97
|
+
default: true
|
|
89
98
|
},
|
|
90
99
|
visibleOptionNum: {
|
|
91
100
|
type: [Number, String],
|
|
@@ -97,185 +106,279 @@ const ne = {
|
|
|
97
106
|
}
|
|
98
107
|
},
|
|
99
108
|
emits: ["click", "cancel", "change", "confirm", "update:modelValue"],
|
|
100
|
-
setup(
|
|
101
|
-
const
|
|
109
|
+
setup(props, { emit }) {
|
|
110
|
+
const state = reactive({
|
|
102
111
|
currentDate: /* @__PURE__ */ new Date(),
|
|
103
|
-
title:
|
|
112
|
+
title: props.title,
|
|
104
113
|
selectedValue: []
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
});
|
|
115
|
+
const formatValue = (value) => {
|
|
116
|
+
if (!isDate(value)) {
|
|
117
|
+
value = props.minDate;
|
|
118
|
+
}
|
|
119
|
+
let timestmp = Math.max(value.getTime(), props.minDate.getTime());
|
|
120
|
+
timestmp = Math.min(timestmp, props.maxDate.getTime());
|
|
121
|
+
return new Date(timestmp);
|
|
109
122
|
};
|
|
110
|
-
function
|
|
111
|
-
return 32 - new Date(
|
|
123
|
+
function getMonthEndDay(year, month) {
|
|
124
|
+
return 32 - new Date(year, month - 1, 32).getDate();
|
|
112
125
|
}
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
const getBoundary = (type, value) => {
|
|
127
|
+
const boundary = type == "min" ? props.minDate : props.maxDate;
|
|
128
|
+
const year = boundary.getFullYear();
|
|
129
|
+
let month = 1;
|
|
130
|
+
let date = 1;
|
|
131
|
+
let hour = 0;
|
|
132
|
+
let minute = 0;
|
|
133
|
+
if (type === "max") {
|
|
134
|
+
month = 12;
|
|
135
|
+
date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
136
|
+
hour = 23;
|
|
137
|
+
minute = 59;
|
|
138
|
+
}
|
|
139
|
+
const seconds = minute;
|
|
140
|
+
if (value.getFullYear() === year) {
|
|
141
|
+
month = boundary.getMonth() + 1;
|
|
142
|
+
if (value.getMonth() + 1 === month) {
|
|
143
|
+
date = boundary.getDate();
|
|
144
|
+
if (value.getDate() === date) {
|
|
145
|
+
hour = boundary.getHours();
|
|
146
|
+
if (value.getHours() === hour) {
|
|
147
|
+
minute = boundary.getMinutes();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
[`${type}Year`]: year,
|
|
154
|
+
[`${type}Month`]: month,
|
|
155
|
+
[`${type}Date`]: date,
|
|
156
|
+
[`${type}Hour`]: hour,
|
|
157
|
+
[`${type}Minute`]: minute,
|
|
158
|
+
[`${type}Seconds`]: seconds
|
|
125
159
|
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
160
|
+
};
|
|
161
|
+
const ranges = computed(() => {
|
|
162
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", state.currentDate);
|
|
163
|
+
const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", state.currentDate);
|
|
164
|
+
let result = [
|
|
129
165
|
{
|
|
130
166
|
type: "year",
|
|
131
|
-
range: [
|
|
167
|
+
range: [minYear, maxYear]
|
|
132
168
|
},
|
|
133
169
|
{
|
|
134
170
|
type: "month",
|
|
135
|
-
range: [
|
|
171
|
+
range: [minMonth, maxMonth]
|
|
136
172
|
},
|
|
137
173
|
{
|
|
138
174
|
type: "day",
|
|
139
|
-
range: [
|
|
175
|
+
range: [minDate, maxDate]
|
|
140
176
|
},
|
|
141
177
|
{
|
|
142
178
|
type: "hour",
|
|
143
|
-
range: [
|
|
179
|
+
range: [minHour, maxHour]
|
|
144
180
|
},
|
|
145
181
|
{
|
|
146
182
|
type: "minute",
|
|
147
|
-
range: [
|
|
183
|
+
range: [minMinute, maxMinute]
|
|
148
184
|
},
|
|
149
185
|
{
|
|
150
186
|
type: "seconds",
|
|
151
|
-
range: [
|
|
187
|
+
range: [minSeconds, maxSeconds]
|
|
152
188
|
}
|
|
153
|
-
]
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
189
|
+
];
|
|
190
|
+
return generateList(result);
|
|
191
|
+
});
|
|
192
|
+
const columns = computed(() => {
|
|
193
|
+
const val = ranges.value.map((res, columnIndex) => {
|
|
194
|
+
return generateValue(res.range[0], res.range[1], getDateIndex(res.type), res.type, columnIndex);
|
|
195
|
+
});
|
|
196
|
+
return val;
|
|
197
|
+
});
|
|
198
|
+
const changeHandler = ({
|
|
199
|
+
columnIndex,
|
|
200
|
+
selectedValue,
|
|
201
|
+
selectedOptions
|
|
158
202
|
}) => {
|
|
159
|
-
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
160
|
-
let
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
203
|
+
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(props.type)) {
|
|
204
|
+
let formatDate = [];
|
|
205
|
+
selectedValue.forEach((item) => {
|
|
206
|
+
formatDate.push(item);
|
|
207
|
+
});
|
|
208
|
+
if (props.type == "month-day" && formatDate.length < 3) {
|
|
209
|
+
formatDate.unshift(new Date(state.currentDate || props.minDate || props.maxDate).getFullYear());
|
|
210
|
+
}
|
|
211
|
+
if (props.type == "year-month" && formatDate.length < 3) {
|
|
212
|
+
formatDate.push(new Date(state.currentDate || props.minDate || props.maxDate).getDate());
|
|
213
|
+
}
|
|
214
|
+
const year = Number(formatDate[0]);
|
|
215
|
+
const month = Number(formatDate[1]) - 1;
|
|
216
|
+
const day = Math.min(Number(formatDate[2]), getMonthEndDay(Number(formatDate[0]), Number(formatDate[1])));
|
|
217
|
+
let date = null;
|
|
218
|
+
if (props.type === "date" || props.type === "month-day" || props.type === "year-month") {
|
|
219
|
+
date = new Date(year, month, day);
|
|
220
|
+
} else if (props.type === "datetime") {
|
|
221
|
+
date = new Date(year, month, day, Number(formatDate[3]), Number(formatDate[4]));
|
|
222
|
+
} else if (props.type === "datehour") {
|
|
223
|
+
date = new Date(year, month, day, Number(formatDate[3]));
|
|
224
|
+
}
|
|
225
|
+
state.currentDate = formatValue(date);
|
|
167
226
|
}
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
227
|
+
emit("change", { columnIndex, selectedValue, selectedOptions });
|
|
228
|
+
};
|
|
229
|
+
const formatterOption = (type, value) => {
|
|
230
|
+
const { formatter, isShowChinese } = props;
|
|
231
|
+
let fOption = null;
|
|
232
|
+
if (formatter) {
|
|
233
|
+
fOption = formatter(type, { text: padZero(value, 2), value: padZero(value, 2) });
|
|
234
|
+
} else {
|
|
235
|
+
const padMin = padZero(value, 2);
|
|
236
|
+
const fatter = isShowChinese ? zhCNType[type] : "";
|
|
237
|
+
fOption = { text: padMin + fatter, value: padMin };
|
|
238
|
+
}
|
|
239
|
+
return fOption;
|
|
240
|
+
};
|
|
241
|
+
const generateValue = (min, max, val, type, columnIndex) => {
|
|
242
|
+
const arr = [];
|
|
243
|
+
let index2 = 0;
|
|
244
|
+
while (min <= max) {
|
|
245
|
+
arr.push(formatterOption(type, min));
|
|
246
|
+
if (type === "minute") {
|
|
247
|
+
min += props.minuteStep;
|
|
248
|
+
} else {
|
|
249
|
+
min++;
|
|
250
|
+
}
|
|
251
|
+
if (min <= val) {
|
|
252
|
+
index2++;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
state.selectedValue[columnIndex] = arr[index2].value;
|
|
256
|
+
return props.filter ? props.filter(type, arr) : arr;
|
|
257
|
+
};
|
|
258
|
+
const getDateIndex = (type) => {
|
|
259
|
+
if (type === "year") {
|
|
260
|
+
return state.currentDate.getFullYear();
|
|
261
|
+
} else if (type === "month") {
|
|
262
|
+
return state.currentDate.getMonth() + 1;
|
|
263
|
+
} else if (type === "day") {
|
|
264
|
+
return state.currentDate.getDate();
|
|
265
|
+
} else if (type === "hour") {
|
|
266
|
+
return state.currentDate.getHours();
|
|
267
|
+
} else if (type === "minute") {
|
|
268
|
+
return state.currentDate.getMinutes();
|
|
269
|
+
} else if (type === "seconds") {
|
|
270
|
+
return state.currentDate.getSeconds();
|
|
177
271
|
}
|
|
178
|
-
return
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
o("confirm", e);
|
|
189
|
-
}, N = (e) => {
|
|
190
|
-
switch (t.type) {
|
|
272
|
+
return 0;
|
|
273
|
+
};
|
|
274
|
+
const closeHandler = (val) => {
|
|
275
|
+
emit("cancel", val);
|
|
276
|
+
};
|
|
277
|
+
const confirm = (val) => {
|
|
278
|
+
emit("confirm", val);
|
|
279
|
+
};
|
|
280
|
+
const generateList = (list) => {
|
|
281
|
+
switch (props.type) {
|
|
191
282
|
case "date":
|
|
192
|
-
|
|
283
|
+
list = list.slice(0, 3);
|
|
193
284
|
break;
|
|
194
285
|
case "datetime":
|
|
195
|
-
|
|
286
|
+
list = list.slice(0, 5);
|
|
196
287
|
break;
|
|
197
288
|
case "time":
|
|
198
|
-
|
|
289
|
+
list = list.slice(3, 6);
|
|
199
290
|
break;
|
|
200
291
|
case "year-month":
|
|
201
|
-
|
|
292
|
+
list = list.slice(0, 2);
|
|
202
293
|
break;
|
|
203
294
|
case "month-day":
|
|
204
|
-
|
|
295
|
+
list = list.slice(1, 3);
|
|
205
296
|
break;
|
|
206
297
|
case "datehour":
|
|
207
|
-
|
|
298
|
+
list = list.slice(0, 4);
|
|
208
299
|
break;
|
|
209
300
|
case "hour-minute":
|
|
210
|
-
|
|
301
|
+
list = list.slice(3, 5);
|
|
211
302
|
break;
|
|
212
303
|
}
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
304
|
+
return list;
|
|
305
|
+
};
|
|
306
|
+
const getSelectedValue = (time) => {
|
|
307
|
+
const res = [
|
|
308
|
+
time.getFullYear(),
|
|
309
|
+
time.getMonth() + 1,
|
|
310
|
+
time.getDate(),
|
|
311
|
+
time.getHours(),
|
|
312
|
+
time.getMinutes(),
|
|
313
|
+
time.getSeconds()
|
|
222
314
|
];
|
|
223
|
-
return
|
|
315
|
+
return generateList(res.map((i) => String(i)));
|
|
224
316
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
(
|
|
230
|
-
|
|
231
|
-
|
|
317
|
+
onBeforeMount(() => {
|
|
318
|
+
state.currentDate = formatValue(props.modelValue);
|
|
319
|
+
});
|
|
320
|
+
watch(
|
|
321
|
+
() => props.modelValue,
|
|
322
|
+
(value) => {
|
|
323
|
+
const newValues = formatValue(value);
|
|
324
|
+
const isSameValue = JSON.stringify(newValues) === JSON.stringify(state.currentDate);
|
|
325
|
+
if (!isSameValue) {
|
|
326
|
+
state.currentDate = newValues;
|
|
327
|
+
state.selectedValue = getSelectedValue(newValues);
|
|
328
|
+
}
|
|
232
329
|
}
|
|
233
|
-
)
|
|
234
|
-
|
|
235
|
-
(
|
|
236
|
-
|
|
330
|
+
);
|
|
331
|
+
watch(
|
|
332
|
+
() => state.currentDate,
|
|
333
|
+
(newValues) => {
|
|
334
|
+
const isSameValue = JSON.stringify(newValues) === JSON.stringify(props.modelValue);
|
|
335
|
+
if (!isSameValue) {
|
|
336
|
+
emit("update:modelValue", newValues);
|
|
337
|
+
}
|
|
237
338
|
}
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
(
|
|
241
|
-
|
|
339
|
+
);
|
|
340
|
+
watch(
|
|
341
|
+
() => props.title,
|
|
342
|
+
(val) => {
|
|
343
|
+
state.title = val;
|
|
242
344
|
}
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
345
|
+
);
|
|
346
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
347
|
+
changeHandler,
|
|
348
|
+
closeHandler,
|
|
349
|
+
confirm,
|
|
350
|
+
columns
|
|
248
351
|
});
|
|
249
352
|
}
|
|
250
353
|
});
|
|
251
|
-
function
|
|
252
|
-
const
|
|
253
|
-
return
|
|
254
|
-
modelValue:
|
|
255
|
-
"onUpdate:modelValue":
|
|
256
|
-
okText:
|
|
257
|
-
cancelText:
|
|
258
|
-
onCancel:
|
|
259
|
-
columns:
|
|
260
|
-
onChange:
|
|
261
|
-
title:
|
|
262
|
-
onConfirm:
|
|
263
|
-
threeDimensional:
|
|
264
|
-
swipeDuration:
|
|
265
|
-
showToolbar:
|
|
266
|
-
visibleOptionNum:
|
|
267
|
-
optionHeight:
|
|
354
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
355
|
+
const _component_nut_picker = resolveComponent("nut-picker");
|
|
356
|
+
return openBlock(), createBlock(_component_nut_picker, {
|
|
357
|
+
modelValue: _ctx.selectedValue,
|
|
358
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.selectedValue = $event),
|
|
359
|
+
okText: _ctx.okText,
|
|
360
|
+
cancelText: _ctx.cancelText,
|
|
361
|
+
onCancel: _ctx.closeHandler,
|
|
362
|
+
columns: _ctx.columns,
|
|
363
|
+
onChange: _ctx.changeHandler,
|
|
364
|
+
title: _ctx.title,
|
|
365
|
+
onConfirm: _ctx.confirm,
|
|
366
|
+
threeDimensional: _ctx.threeDimensional,
|
|
367
|
+
swipeDuration: _ctx.swipeDuration,
|
|
368
|
+
showToolbar: _ctx.showToolbar,
|
|
369
|
+
visibleOptionNum: _ctx.visibleOptionNum,
|
|
370
|
+
optionHeight: _ctx.optionHeight
|
|
268
371
|
}, {
|
|
269
|
-
top:
|
|
270
|
-
|
|
372
|
+
top: withCtx(() => [
|
|
373
|
+
renderSlot(_ctx.$slots, "top")
|
|
271
374
|
]),
|
|
272
|
-
default:
|
|
273
|
-
|
|
375
|
+
default: withCtx(() => [
|
|
376
|
+
renderSlot(_ctx.$slots, "default")
|
|
274
377
|
]),
|
|
275
378
|
_: 3
|
|
276
379
|
}, 8, ["modelValue", "okText", "cancelText", "onCancel", "columns", "onChange", "title", "onConfirm", "threeDimensional", "swipeDuration", "showToolbar", "visibleOptionNum", "optionHeight"]);
|
|
277
380
|
}
|
|
278
|
-
const
|
|
381
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
279
382
|
export {
|
|
280
|
-
|
|
383
|
+
index as default
|
|
281
384
|
};
|