@nutui/nutui 4.0.10-beta.1 → 4.0.11

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 (160) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +6316 -7237
  4. package/dist/nutui.umd.js +1 -1
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +95 -150
  59. package/dist/packages/_es/MenuItem.js +109 -154
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -437
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +123 -174
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/smartips/web-types.json +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/styles/themes/default.scss +148 -45
  128. package/dist/styles/themes/jdb.scss +148 -45
  129. package/dist/styles/themes/jddkh.scss +148 -45
  130. package/dist/styles/themes/jdt.scss +148 -45
  131. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  133. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  135. package/dist/types/__VUE/searchbar/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  138. package/dist/types/__VUE/table/common.d.ts +55 -2
  139. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  141. package/dist/types/index.d.ts +1 -1
  142. package/package.json +2 -2
  143. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  144. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  145. package/dist/packages/_es/common-b9a5e726.js +0 -145
  146. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  147. package/dist/packages/_es/index-29892cda.js +0 -33
  148. package/dist/packages/_es/index-43c34ac6.js +0 -30
  149. package/dist/packages/_es/index-54d03fc1.js +0 -8
  150. package/dist/packages/_es/index-79c5dc33.js +0 -10
  151. package/dist/packages/_es/index-7a7385e4.js +0 -67
  152. package/dist/packages/_es/index-87422be8.js +0 -942
  153. package/dist/packages/_es/index-da0a7662.js +0 -259
  154. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  155. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  156. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  157. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  158. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  159. package/dist/packages/_es/raf-729dad54.js +0 -25
  160. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,45 +1,36 @@
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";
1
+ var P = Object.defineProperty, R = Object.defineProperties;
2
+ var U = Object.getOwnPropertyDescriptors;
3
+ var p = Object.getOwnPropertySymbols;
4
+ var Z = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
5
+ var M = (t, o, a) => o in t ? P(t, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[o] = a, V = (t, o) => {
6
+ for (var a in o || (o = {}))
7
+ Z.call(o, a) && M(t, a, o[a]);
8
+ if (p)
9
+ for (var a of p(o))
10
+ j.call(o, a) && M(t, a, o[a]);
11
+ return t;
12
+ }, k = (t, o) => R(t, U(o));
13
+ import { reactive as q, computed as T, onBeforeMount as A, watch as b, toRefs as G, resolveComponent as K, openBlock as Q, createBlock as W, withCtx as x, renderSlot as H } from "vue";
14
+ import $ from "./Picker.js";
15
+ import { c as X, a as _, p as S } from "./component-234624bc.js";
16
+ import { _ as ee } from "./_plugin-vue_export-helper-dad06003.js";
17
+ import "./pxCheck-38173291.js";
18
+ import "./index-53ec2d4d.js";
26
19
  import "../locale/lang";
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());
20
+ const { componentName: ge, create: te, translate: s } = X("date-picker"), C = (/* @__PURE__ */ new Date()).getFullYear();
21
+ function w(t) {
22
+ return _(t) && !isNaN(t.getTime());
31
23
  }
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({
24
+ const ne = {
25
+ day: s("day"),
26
+ year: s("year"),
27
+ month: s("month"),
28
+ hour: s("hour"),
29
+ minute: s("minute"),
30
+ seconds: s("seconds")
31
+ }, ae = te({
41
32
  components: {
42
- [Picker.name]: Picker
33
+ [$.name]: $
43
34
  },
44
35
  props: {
45
36
  modelValue: null,
@@ -61,7 +52,7 @@ const _sfc_main = create({
61
52
  },
62
53
  isShowChinese: {
63
54
  type: Boolean,
64
- default: false
55
+ default: !1
65
56
  },
66
57
  minuteStep: {
67
58
  type: Number,
@@ -69,13 +60,13 @@ const _sfc_main = create({
69
60
  },
70
61
  minDate: {
71
62
  type: Date,
72
- default: () => new Date(currentYear - 10, 0, 1),
73
- validator: isDate
63
+ default: () => new Date(C - 10, 0, 1),
64
+ validator: w
74
65
  },
75
66
  maxDate: {
76
67
  type: Date,
77
- default: () => new Date(currentYear + 10, 11, 31),
78
- validator: isDate
68
+ default: () => new Date(C + 10, 11, 31),
69
+ validator: w
79
70
  },
80
71
  formatter: {
81
72
  type: Function,
@@ -84,7 +75,7 @@ const _sfc_main = create({
84
75
  // 是否开启3D效果
85
76
  threeDimensional: {
86
77
  type: Boolean,
87
- default: true
78
+ default: !0
88
79
  },
89
80
  // 惯性滚动 时长
90
81
  swipeDuration: {
@@ -94,7 +85,7 @@ const _sfc_main = create({
94
85
  filter: Function,
95
86
  showToolbar: {
96
87
  type: Boolean,
97
- default: true
88
+ default: !0
98
89
  },
99
90
  visibleOptionNum: {
100
91
  type: [Number, String],
@@ -106,279 +97,185 @@ const _sfc_main = create({
106
97
  }
107
98
  },
108
99
  emits: ["click", "cancel", "change", "confirm", "update:modelValue"],
109
- setup(props, { emit }) {
110
- const state = reactive({
100
+ setup(t, { emit: o }) {
101
+ const a = q({
111
102
  currentDate: /* @__PURE__ */ new Date(),
112
- title: props.title,
103
+ title: t.title,
113
104
  selectedValue: []
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);
105
+ }), f = (e) => {
106
+ w(e) || (e = t.minDate);
107
+ let n = Math.max(e.getTime(), t.minDate.getTime());
108
+ return n = Math.min(n, t.maxDate.getTime()), new Date(n);
122
109
  };
123
- function getMonthEndDay(year, month) {
124
- return 32 - new Date(year, month - 1, 32).getDate();
110
+ function g(e, n) {
111
+ return 32 - new Date(e, n - 1, 32).getDate();
125
112
  }
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
113
+ const h = (e, n) => {
114
+ const u = e == "min" ? t.minDate : t.maxDate, r = u.getFullYear();
115
+ let l = 1, i = 1, c = 0, m = 0;
116
+ e === "max" && (l = 12, i = g(n.getFullYear(), n.getMonth() + 1), c = 23, m = 59);
117
+ const d = m;
118
+ return n.getFullYear() === r && (l = u.getMonth() + 1, n.getMonth() + 1 === l && (i = u.getDate(), n.getDate() === i && (c = u.getHours(), n.getHours() === c && (m = u.getMinutes())))), {
119
+ [`${e}Year`]: r,
120
+ [`${e}Month`]: l,
121
+ [`${e}Date`]: i,
122
+ [`${e}Hour`]: c,
123
+ [`${e}Minute`]: m,
124
+ [`${e}Seconds`]: d
159
125
  };
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 = [
126
+ }, D = T(() => {
127
+ const { maxYear: e, maxDate: n, maxMonth: u, maxHour: r, maxMinute: l, maxSeconds: i } = h("max", a.currentDate), { minYear: c, minDate: m, minMonth: d, minHour: z, minMinute: I, minSeconds: L } = h("min", a.currentDate);
128
+ return N([
165
129
  {
166
130
  type: "year",
167
- range: [minYear, maxYear]
131
+ range: [c, e]
168
132
  },
169
133
  {
170
134
  type: "month",
171
- range: [minMonth, maxMonth]
135
+ range: [d, u]
172
136
  },
173
137
  {
174
138
  type: "day",
175
- range: [minDate, maxDate]
139
+ range: [m, n]
176
140
  },
177
141
  {
178
142
  type: "hour",
179
- range: [minHour, maxHour]
143
+ range: [z, r]
180
144
  },
181
145
  {
182
146
  type: "minute",
183
- range: [minMinute, maxMinute]
147
+ range: [I, l]
184
148
  },
185
149
  {
186
150
  type: "seconds",
187
- range: [minSeconds, maxSeconds]
151
+ range: [L, i]
188
152
  }
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
153
+ ]);
154
+ }), y = T(() => D.value.map((n, u) => F(n.range[0], n.range[1], B(n.type), n.type, u))), Y = ({
155
+ columnIndex: e,
156
+ selectedValue: n,
157
+ selectedOptions: u
202
158
  }) => {
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);
159
+ if (["date", "datetime", "datehour", "month-day", "year-month"].includes(t.type)) {
160
+ let r = [];
161
+ n.forEach((d) => {
162
+ r.push(d);
163
+ }), t.type == "month-day" && r.length < 3 && r.unshift(new Date(a.currentDate || t.minDate || t.maxDate).getFullYear()), t.type == "year-month" && r.length < 3 && r.push(new Date(a.currentDate || t.minDate || t.maxDate).getDate());
164
+ const l = Number(r[0]), i = Number(r[1]) - 1, c = Math.min(Number(r[2]), g(Number(r[0]), Number(r[1])));
165
+ let m = null;
166
+ t.type === "date" || t.type === "month-day" || t.type === "year-month" ? m = new Date(l, i, c) : t.type === "datetime" ? m = new Date(l, i, c, Number(r[3]), Number(r[4])) : t.type === "datehour" && (m = new Date(l, i, c, Number(r[3]))), a.currentDate = f(m);
226
167
  }
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();
168
+ o("change", { columnIndex: e, selectedValue: n, selectedOptions: u });
169
+ }, O = (e, n) => {
170
+ const { formatter: u, isShowChinese: r } = t;
171
+ let l = null;
172
+ if (u)
173
+ l = u(e, { text: S(n, 2), value: S(n, 2) });
174
+ else {
175
+ const i = S(n, 2), c = r ? ne[e] : "";
176
+ l = { text: i + c, value: i };
271
177
  }
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) {
178
+ return l;
179
+ }, F = (e, n, u, r, l) => {
180
+ const i = [];
181
+ let c = 0;
182
+ for (; e <= n; )
183
+ i.push(O(r, e)), r === "minute" ? e += t.minuteStep : e++, e <= u && c++;
184
+ return a.selectedValue[l] = i[c].value, t.filter ? t.filter(r, i) : i;
185
+ }, B = (e) => e === "year" ? a.currentDate.getFullYear() : e === "month" ? a.currentDate.getMonth() + 1 : e === "day" ? a.currentDate.getDate() : e === "hour" ? a.currentDate.getHours() : e === "minute" ? a.currentDate.getMinutes() : e === "seconds" ? a.currentDate.getSeconds() : 0, v = (e) => {
186
+ o("cancel", e);
187
+ }, J = (e) => {
188
+ o("confirm", e);
189
+ }, N = (e) => {
190
+ switch (t.type) {
282
191
  case "date":
283
- list = list.slice(0, 3);
192
+ e = e.slice(0, 3);
284
193
  break;
285
194
  case "datetime":
286
- list = list.slice(0, 5);
195
+ e = e.slice(0, 5);
287
196
  break;
288
197
  case "time":
289
- list = list.slice(3, 6);
198
+ e = e.slice(3, 6);
290
199
  break;
291
200
  case "year-month":
292
- list = list.slice(0, 2);
201
+ e = e.slice(0, 2);
293
202
  break;
294
203
  case "month-day":
295
- list = list.slice(1, 3);
204
+ e = e.slice(1, 3);
296
205
  break;
297
206
  case "datehour":
298
- list = list.slice(0, 4);
207
+ e = e.slice(0, 4);
299
208
  break;
300
209
  case "hour-minute":
301
- list = list.slice(3, 5);
210
+ e = e.slice(3, 5);
302
211
  break;
303
212
  }
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()
213
+ return e;
214
+ }, E = (e) => {
215
+ const n = [
216
+ e.getFullYear(),
217
+ e.getMonth() + 1,
218
+ e.getDate(),
219
+ e.getHours(),
220
+ e.getMinutes(),
221
+ e.getSeconds()
314
222
  ];
315
- return generateList(res.map((i) => String(i)));
223
+ return N(n.map((u) => String(u)));
316
224
  };
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
- }
225
+ return A(() => {
226
+ a.currentDate = f(t.modelValue);
227
+ }), b(
228
+ () => t.modelValue,
229
+ (e) => {
230
+ const n = f(e);
231
+ JSON.stringify(n) === JSON.stringify(a.currentDate) || (a.currentDate = n, a.selectedValue = E(n));
329
232
  }
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
- }
233
+ ), b(
234
+ () => a.currentDate,
235
+ (e) => {
236
+ JSON.stringify(e) === JSON.stringify(t.modelValue) || o("update:modelValue", e);
338
237
  }
339
- );
340
- watch(
341
- () => props.title,
342
- (val) => {
343
- state.title = val;
238
+ ), b(
239
+ () => t.title,
240
+ (e) => {
241
+ a.title = e;
344
242
  }
345
- );
346
- return __spreadProps(__spreadValues({}, toRefs(state)), {
347
- changeHandler,
348
- closeHandler,
349
- confirm,
350
- columns
243
+ ), k(V({}, G(a)), {
244
+ changeHandler: Y,
245
+ closeHandler: v,
246
+ confirm: J,
247
+ columns: y
351
248
  });
352
249
  }
353
250
  });
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
251
+ function re(t, o, a, f, g, h) {
252
+ const D = K("nut-picker");
253
+ return Q(), W(D, {
254
+ modelValue: t.selectedValue,
255
+ "onUpdate:modelValue": o[0] || (o[0] = (y) => t.selectedValue = y),
256
+ okText: t.okText,
257
+ cancelText: t.cancelText,
258
+ onCancel: t.closeHandler,
259
+ columns: t.columns,
260
+ onChange: t.changeHandler,
261
+ title: t.title,
262
+ onConfirm: t.confirm,
263
+ threeDimensional: t.threeDimensional,
264
+ swipeDuration: t.swipeDuration,
265
+ showToolbar: t.showToolbar,
266
+ visibleOptionNum: t.visibleOptionNum,
267
+ optionHeight: t.optionHeight
371
268
  }, {
372
- top: withCtx(() => [
373
- renderSlot(_ctx.$slots, "top")
269
+ top: x(() => [
270
+ H(t.$slots, "top")
374
271
  ]),
375
- default: withCtx(() => [
376
- renderSlot(_ctx.$slots, "default")
272
+ default: x(() => [
273
+ H(t.$slots, "default")
377
274
  ]),
378
275
  _: 3
379
276
  }, 8, ["modelValue", "okText", "cancelText", "onCancel", "columns", "onChange", "title", "onConfirm", "threeDimensional", "swipeDuration", "showToolbar", "visibleOptionNum", "optionHeight"]);
380
277
  }
381
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
278
+ const he = /* @__PURE__ */ ee(ae, [["render", re]]);
382
279
  export {
383
- index as default
280
+ he as default
384
281
  };