@nutui/nutui 3.1.22-beta.0 → 3.1.22-beta.3

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