@nutui/nutui 3.1.22-beta.5 → 3.1.23-beta.1
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/CHANGELOG.md +48 -0
- package/README.md +3 -4
- package/dist/nutui.es.js +20412 -4214
- package/dist/nutui.umd.js +20518 -4216
- package/dist/packages/_es/ActionSheet.js +149 -17
- package/dist/packages/_es/Address.js +535 -110
- package/dist/packages/_es/AddressList.js +615 -113
- package/dist/packages/_es/Animate.js +59 -17
- package/dist/packages/_es/Audio.js +257 -53
- package/dist/packages/_es/AudioOperate.js +100 -13
- package/dist/packages/_es/Avatar.js +162 -38
- package/dist/packages/_es/AvatarGroup.js +73 -14
- package/dist/packages/_es/BackTop.js +156 -43
- package/dist/packages/_es/Badge.js +86 -14
- package/dist/packages/_es/Barrage.js +120 -41
- package/dist/packages/_es/Button.js +128 -23
- package/dist/packages/_es/Calendar.js +246 -30
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +107 -10
- package/dist/packages/_es/Cascader.js +496 -147
- package/dist/packages/_es/Category.js +58 -15
- package/dist/packages/_es/CategoryPane.js +111 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +134 -29
- package/dist/packages/_es/CheckboxGroup.js +79 -29
- package/dist/packages/_es/CircleProgress.js +150 -28
- package/dist/packages/_es/Col.js +56 -14
- package/dist/packages/_es/Collapse.js +109 -32
- package/dist/packages/_es/CollapseItem.js +253 -59
- package/dist/packages/_es/Comment.js +434 -64
- package/dist/packages/_es/ConfigProvider.js +20 -8
- package/dist/packages/_es/CountDown.js +238 -56
- package/dist/packages/_es/CountUp.js +539 -140
- package/dist/packages/_es/DatePicker.js +315 -98
- package/dist/packages/_es/Dialog.js +289 -60
- package/dist/packages/_es/Divider.js +65 -13
- package/dist/packages/_es/Drag.js +197 -56
- package/dist/packages/_es/Ecard.js +159 -24
- package/dist/packages/_es/Elevator.js +255 -58
- package/dist/packages/_es/Ellipsis.js +200 -58
- package/dist/packages/_es/Empty.js +71 -12
- package/dist/packages/_es/FixedNav.js +122 -15
- package/dist/packages/_es/Form.js +151 -64
- package/dist/packages/_es/FormItem.js +114 -15
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +144 -33
- package/dist/packages/_es/Icon.js +40 -15
- package/dist/packages/_es/Image.js +137 -26
- package/dist/packages/_es/ImagePreview.js +547 -76
- package/dist/packages/_es/Indicator.js +62 -15
- package/dist/packages/_es/InfiniteLoading.js +249 -57
- package/dist/packages/_es/Input.js +433 -51
- package/dist/packages/_es/InputNumber.js +160 -41
- package/dist/packages/_es/Layout.js +5 -4
- package/dist/packages/_es/List.js +106 -18
- package/dist/packages/_es/Menu.js +168 -44
- package/dist/packages/_es/MenuItem.js +173 -37
- package/dist/packages/_es/Navbar.js +192 -30
- package/dist/packages/_es/NoticeBar.js +380 -74
- package/dist/packages/_es/Notify.js +227 -72
- package/dist/packages/_es/NumberKeyboard.js +272 -41
- package/dist/packages/_es/OldPicker.js +457 -130
- package/dist/packages/_es/OverLay.js +98 -24
- package/dist/packages/_es/Pagination.js +157 -39
- package/dist/packages/_es/Picker.js +454 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +299 -55
- package/dist/packages/_es/Price.js +118 -16
- package/dist/packages/_es/Progress.js +146 -14
- package/dist/packages/_es/PullRefresh.js +339 -84
- package/dist/packages/_es/Radio.js +90 -22
- package/dist/packages/_es/RadioGroup.js +37 -8
- package/dist/packages/_es/Range.js +408 -83
- package/dist/packages/_es/Rate.js +192 -36
- package/dist/packages/_es/Row.js +64 -22
- package/dist/packages/_es/SearchBar.js +238 -37
- package/dist/packages/_es/ShortPassword.js +225 -35
- package/dist/packages/_es/SideNavBar.js +81 -24
- package/dist/packages/_es/SideNavBarItem.js +46 -11
- package/dist/packages/_es/Signature.js +160 -41
- package/dist/packages/_es/Skeleton.js +136 -20
- package/dist/packages/_es/Sku.js +491 -84
- package/dist/packages/_es/Step.js +115 -20
- package/dist/packages/_es/Steps.js +53 -18
- package/dist/packages/_es/Sticky.js +138 -53
- package/dist/packages/_es/SubSideNavBar.js +82 -17
- package/dist/packages/_es/Swipe.js +178 -41
- package/dist/packages/_es/Swiper.js +433 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +116 -21
- package/dist/packages/_es/TabPane.js +39 -12
- package/dist/packages/_es/Tabbar.js +72 -17
- package/dist/packages/_es/TabbarItem.js +151 -29
- package/dist/packages/_es/Table.js +178 -18
- package/dist/packages/_es/Tabs.js +202 -43
- package/dist/packages/_es/Tag.js +97 -20
- package/dist/packages/_es/TextArea.js +160 -42
- package/dist/packages/_es/TimeDetail.js +79 -18
- package/dist/packages/_es/TimePannel.js +48 -14
- package/dist/packages/_es/TimeSelect.js +112 -15
- package/dist/packages/_es/Toast.js +310 -71
- package/dist/packages/_es/Uploader.js +455 -104
- package/dist/packages/_es/Video.js +332 -74
- package/dist/packages/_es/common.js +128 -38
- package/dist/packages/_es/component.js +76 -35
- package/dist/packages/_es/index.js +6 -5
- package/dist/packages/_es/index2.js +30 -9
- package/dist/packages/_es/index3.js +8 -6
- package/dist/packages/_es/index4.js +64 -13
- package/dist/packages/_es/index5.js +780 -164
- package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
- package/dist/packages/_es/pxCheck.js +5 -3
- package/dist/packages/_es/raf.js +15 -8
- package/dist/packages/imagepreview/index.scss +6 -1
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.js +105 -5
- package/dist/packages/locale/lang/id-ID.js +105 -5
- package/dist/packages/locale/lang/index.js +38 -16
- package/dist/packages/locale/lang/zh-CN.js +105 -5
- package/dist/packages/locale/lang/zh-TW.js +105 -5
- package/dist/packages/picker/index.scss +13 -0
- package/dist/smartips/attributes.json +8 -0
- package/dist/smartips/tags.json +3 -1
- package/dist/smartips/web-types.json +19 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/styles/variables-jdb.scss +4 -1
- package/dist/styles/variables-jdt.scss +4 -1
- package/dist/styles/variables.scss +1 -1
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
- package/dist/types/__VUE/address/index.vue.d.ts +4 -4
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
- package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
- package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
- package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
- package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
- package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,109 +1,326 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive
|
|
7
|
-
import
|
|
8
|
-
import { popupProps
|
|
9
|
-
import { c as
|
|
10
|
-
import { _ as
|
|
6
|
+
import { reactive, computed, onBeforeMount, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, renderSlot } from "vue";
|
|
7
|
+
import Picker from "./Picker.js";
|
|
8
|
+
import { popupProps } from "./Popup.js";
|
|
9
|
+
import { c as createComponent } from "./component.js";
|
|
10
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
11
11
|
import "./OverLay.js";
|
|
12
12
|
import "../locale/lang";
|
|
13
13
|
import "./Icon.js";
|
|
14
14
|
import "./pxCheck.js";
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
function padZero(num, targetLength = 2) {
|
|
16
|
+
let str = num + "";
|
|
17
|
+
while (str.length < targetLength) {
|
|
18
|
+
str = "0" + str;
|
|
19
|
+
}
|
|
20
|
+
return str;
|
|
20
21
|
}
|
|
21
|
-
const { componentName
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const { componentName, create, translate } = createComponent("datepicker");
|
|
23
|
+
const currentYear = new Date().getFullYear();
|
|
24
|
+
function isDate(val) {
|
|
25
|
+
return Object.prototype.toString.call(val) === "[object Date]" && !isNaN(val.getTime());
|
|
24
26
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
27
|
+
const zhCNType = {
|
|
28
|
+
day: translate("day"),
|
|
29
|
+
year: translate("year"),
|
|
30
|
+
month: translate("month"),
|
|
31
|
+
hour: translate("hour"),
|
|
32
|
+
minute: translate("minute"),
|
|
33
|
+
seconds: translate("seconds")
|
|
34
|
+
};
|
|
35
|
+
const _sfc_main = create({
|
|
36
|
+
components: {
|
|
37
|
+
[Picker.name]: Picker
|
|
38
|
+
},
|
|
39
|
+
props: {
|
|
40
|
+
...popupProps,
|
|
41
|
+
modelValue: null,
|
|
42
|
+
title: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
},
|
|
46
|
+
okText: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ""
|
|
49
|
+
},
|
|
50
|
+
cancelText: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ""
|
|
53
|
+
},
|
|
54
|
+
type: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "date"
|
|
57
|
+
},
|
|
58
|
+
isShowChinese: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
minuteStep: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 1
|
|
65
|
+
},
|
|
66
|
+
minDate: {
|
|
67
|
+
type: Date,
|
|
68
|
+
default: () => new Date(currentYear - 10, 0, 1),
|
|
69
|
+
validator: isDate
|
|
70
|
+
},
|
|
71
|
+
maxDate: {
|
|
72
|
+
type: Date,
|
|
73
|
+
default: () => new Date(currentYear + 10, 11, 31),
|
|
74
|
+
validator: isDate
|
|
75
|
+
},
|
|
76
|
+
formatter: {
|
|
77
|
+
type: Function,
|
|
78
|
+
default: null
|
|
79
|
+
},
|
|
80
|
+
filter: Function
|
|
81
|
+
},
|
|
82
|
+
emits: ["click", "update:visible", "change", "confirm", "update:moduleValue"],
|
|
83
|
+
setup(props, { emit }) {
|
|
84
|
+
const state = reactive({
|
|
85
|
+
show: props.visible,
|
|
86
|
+
currentDate: new Date(),
|
|
87
|
+
title: props.title,
|
|
88
|
+
selectedValue: []
|
|
89
|
+
});
|
|
90
|
+
const formatValue = (value) => {
|
|
91
|
+
if (!isDate(value)) {
|
|
92
|
+
value = props.minDate;
|
|
93
|
+
}
|
|
94
|
+
let timestmp = Math.max(value.getTime(), props.minDate.getTime());
|
|
95
|
+
timestmp = Math.min(timestmp, props.maxDate.getTime());
|
|
96
|
+
return new Date(timestmp);
|
|
97
|
+
};
|
|
98
|
+
function getMonthEndDay(year, month) {
|
|
99
|
+
return 32 - new Date(year, month - 1, 32).getDate();
|
|
71
100
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}]
|
|
109
|
-
|
|
101
|
+
const getBoundary = (type, value) => {
|
|
102
|
+
const boundary = props[`${type}Date`];
|
|
103
|
+
const year = boundary.getFullYear();
|
|
104
|
+
let month = 1;
|
|
105
|
+
let day = 1;
|
|
106
|
+
let hour = 0;
|
|
107
|
+
let minute = 0;
|
|
108
|
+
if (type === "max") {
|
|
109
|
+
month = 12;
|
|
110
|
+
day = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
111
|
+
hour = 23;
|
|
112
|
+
minute = 59;
|
|
113
|
+
}
|
|
114
|
+
const seconds = minute;
|
|
115
|
+
if (value.getFullYear() === year) {
|
|
116
|
+
month = boundary.getMonth() + 1;
|
|
117
|
+
if (value.getMonth() + 1 === month) {
|
|
118
|
+
day = boundary.getDate();
|
|
119
|
+
if (value.getDate() === day) {
|
|
120
|
+
hour = boundary.getHours();
|
|
121
|
+
if (value.getHours() === hour) {
|
|
122
|
+
minute = boundary.getMinutes();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
return {
|
|
128
|
+
[`${type}Year`]: year,
|
|
129
|
+
[`${type}Month`]: month,
|
|
130
|
+
[`${type}Day`]: day,
|
|
131
|
+
[`${type}Hour`]: hour,
|
|
132
|
+
[`${type}Minute`]: minute,
|
|
133
|
+
[`${type}Seconds`]: seconds
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
[`${type}Year`]: year,
|
|
138
|
+
[`${type}Month`]: month,
|
|
139
|
+
[`${type}Day`]: day,
|
|
140
|
+
[`${type}Hour`]: hour,
|
|
141
|
+
[`${type}Minute`]: minute,
|
|
142
|
+
[`${type}Seconds`]: seconds
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const ranges = computed(() => {
|
|
146
|
+
const { maxYear, maxDay, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", state.currentDate);
|
|
147
|
+
const { minYear, minDay, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", state.currentDate);
|
|
148
|
+
let result = [
|
|
149
|
+
{
|
|
150
|
+
type: "year",
|
|
151
|
+
range: [minYear, maxYear]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: "month",
|
|
155
|
+
range: [minMonth, maxMonth]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: "day",
|
|
159
|
+
range: [minDay, maxDay]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: "hour",
|
|
163
|
+
range: [minHour, maxHour]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "minute",
|
|
167
|
+
range: [minMinute, maxMinute]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: "seconds",
|
|
171
|
+
range: [minSeconds, maxSeconds]
|
|
172
|
+
}
|
|
173
|
+
];
|
|
174
|
+
switch (props.type) {
|
|
175
|
+
case "date":
|
|
176
|
+
result = result.slice(0, 3);
|
|
177
|
+
break;
|
|
178
|
+
case "datetime":
|
|
179
|
+
result = result.slice(0, 5);
|
|
180
|
+
break;
|
|
181
|
+
case "time":
|
|
182
|
+
result = result.slice(3, 6);
|
|
183
|
+
break;
|
|
184
|
+
case "year-month":
|
|
185
|
+
result = result.slice(0, 2);
|
|
186
|
+
break;
|
|
187
|
+
case "month-day":
|
|
188
|
+
result = result.slice(1, 3);
|
|
189
|
+
break;
|
|
190
|
+
case "datehour":
|
|
191
|
+
result = result.slice(0, 4);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
});
|
|
196
|
+
const columns = computed(() => {
|
|
197
|
+
const val = ranges.value.map((res, columnIndex) => {
|
|
198
|
+
return generateValue(res.range[0], res.range[1], getDateIndex(res.type), res.type, columnIndex);
|
|
199
|
+
});
|
|
200
|
+
return val;
|
|
201
|
+
});
|
|
202
|
+
const changeHandler = ({
|
|
203
|
+
columnIndex,
|
|
204
|
+
selectedValue,
|
|
205
|
+
selectedOptions
|
|
206
|
+
}) => {
|
|
207
|
+
if (["date", "datetime", "datehour", "month-day"].includes(props.type)) {
|
|
208
|
+
let formatDate = [];
|
|
209
|
+
selectedValue.forEach((item) => {
|
|
210
|
+
formatDate.push(item);
|
|
211
|
+
});
|
|
212
|
+
if (props.type == "month-day" && formatDate.length < 3) {
|
|
213
|
+
formatDate.unshift(new Date(props.modelValue || props.minDate || props.maxDate).getFullYear());
|
|
214
|
+
}
|
|
215
|
+
const year = Number(formatDate[0]);
|
|
216
|
+
const month = Number(formatDate[1]) - 1;
|
|
217
|
+
const day = Math.min(Number(formatDate[2]), getMonthEndDay(Number(formatDate[0]), Number(formatDate[1])));
|
|
218
|
+
let date = null;
|
|
219
|
+
if (props.type === "date" || props.type === "month-day") {
|
|
220
|
+
date = new Date(year, month, day);
|
|
221
|
+
} else if (props.type === "datetime") {
|
|
222
|
+
date = new Date(year, month, day, Number(formatDate[3]), Number(formatDate[4]));
|
|
223
|
+
} else if (props.type === "datehour") {
|
|
224
|
+
date = new Date(year, month, day, Number(formatDate[3]));
|
|
225
|
+
}
|
|
226
|
+
state.currentDate = formatValue(date);
|
|
227
|
+
}
|
|
228
|
+
emit("change", { columnIndex, selectedValue, selectedOptions });
|
|
229
|
+
};
|
|
230
|
+
const formatterOption = (type, value) => {
|
|
231
|
+
const { formatter, isShowChinese } = props;
|
|
232
|
+
let fOption = null;
|
|
233
|
+
if (formatter) {
|
|
234
|
+
fOption = formatter(type, { text: padZero(value, 2), value: padZero(value, 2) });
|
|
235
|
+
} else {
|
|
236
|
+
const padMin = padZero(value, 2);
|
|
237
|
+
const fatter = isShowChinese ? zhCNType[type] : "";
|
|
238
|
+
fOption = { text: padMin + fatter, value: padMin };
|
|
239
|
+
}
|
|
240
|
+
return fOption;
|
|
241
|
+
};
|
|
242
|
+
const generateValue = (min, max, val, type, columnIndex) => {
|
|
243
|
+
const arr = [];
|
|
244
|
+
let index2 = 0;
|
|
245
|
+
while (min <= max) {
|
|
246
|
+
arr.push(formatterOption(type, min));
|
|
247
|
+
if (type === "minute") {
|
|
248
|
+
min += props.minuteStep;
|
|
249
|
+
} else {
|
|
250
|
+
min++;
|
|
251
|
+
}
|
|
252
|
+
if (min <= val) {
|
|
253
|
+
index2++;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
state.selectedValue[columnIndex] = arr[index2].value;
|
|
257
|
+
return props.filter ? props.filter(type, arr) : arr;
|
|
258
|
+
};
|
|
259
|
+
const getDateIndex = (type) => {
|
|
260
|
+
if (type === "year") {
|
|
261
|
+
return state.currentDate.getFullYear();
|
|
262
|
+
} else if (type === "month") {
|
|
263
|
+
return state.currentDate.getMonth() + 1;
|
|
264
|
+
} else if (type === "day") {
|
|
265
|
+
return state.currentDate.getDate();
|
|
266
|
+
} else if (type === "hour") {
|
|
267
|
+
return state.currentDate.getHours();
|
|
268
|
+
} else if (type === "minute") {
|
|
269
|
+
return state.currentDate.getMinutes();
|
|
270
|
+
} else if (type === "seconds") {
|
|
271
|
+
return state.currentDate.getSeconds();
|
|
272
|
+
}
|
|
273
|
+
return 0;
|
|
274
|
+
};
|
|
275
|
+
const closeHandler = () => {
|
|
276
|
+
emit("update:visible", false);
|
|
277
|
+
};
|
|
278
|
+
const confirm = (val) => {
|
|
279
|
+
emit("update:visible", false);
|
|
280
|
+
emit("confirm", val);
|
|
281
|
+
};
|
|
282
|
+
onBeforeMount(() => {
|
|
283
|
+
state.currentDate = formatValue(props.modelValue);
|
|
284
|
+
});
|
|
285
|
+
watch(() => props.modelValue, (value) => {
|
|
286
|
+
state.currentDate = formatValue(value);
|
|
287
|
+
});
|
|
288
|
+
watch(() => props.title, (val) => {
|
|
289
|
+
state.title = val;
|
|
290
|
+
});
|
|
291
|
+
watch(() => props.visible, (val) => {
|
|
292
|
+
state.show = val;
|
|
293
|
+
});
|
|
294
|
+
return {
|
|
295
|
+
...toRefs(state),
|
|
296
|
+
changeHandler,
|
|
297
|
+
closeHandler,
|
|
298
|
+
confirm,
|
|
299
|
+
columns
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
304
|
+
const _component_nut_picker = resolveComponent("nut-picker");
|
|
305
|
+
return openBlock(), createBlock(_component_nut_picker, {
|
|
306
|
+
modelValue: _ctx.selectedValue,
|
|
307
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.selectedValue = $event),
|
|
308
|
+
visible: _ctx.show,
|
|
309
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.show = $event),
|
|
310
|
+
okText: _ctx.okText,
|
|
311
|
+
cancelText: _ctx.cancelText,
|
|
312
|
+
onClose: _ctx.closeHandler,
|
|
313
|
+
columns: _ctx.columns,
|
|
314
|
+
onChange: _ctx.changeHandler,
|
|
315
|
+
title: _ctx.title,
|
|
316
|
+
onConfirm: _ctx.confirm,
|
|
317
|
+
isWrapTeleport: _ctx.isWrapTeleport
|
|
318
|
+
}, {
|
|
319
|
+
default: withCtx(() => [
|
|
320
|
+
renderSlot(_ctx.$slots, "default")
|
|
321
|
+
]),
|
|
322
|
+
_: 3
|
|
323
|
+
}, 8, ["modelValue", "visible", "okText", "cancelText", "onClose", "columns", "onChange", "title", "onConfirm", "isWrapTeleport"]);
|
|
324
|
+
}
|
|
325
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
326
|
+
export { index as default };
|