@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.
Files changed (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +1 -1
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +50 -50
  135. package/dist/styles/themes/jdb.scss +50 -50
  136. package/dist/styles/themes/jddkh.scss +50 -50
  137. package/dist/styles/themes/jdt.scss +50 -50
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,36 +1,45 @@
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";
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: ge, create: te, translate: s } = X("date-picker"), C = (/* @__PURE__ */ new Date()).getFullYear();
21
- function w(t) {
22
- return _(t) && !isNaN(t.getTime());
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 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({
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
- [$.name]: $
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: !1
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(C - 10, 0, 1),
64
- validator: w
72
+ default: () => new Date(currentYear - 10, 0, 1),
73
+ validator: isDate
65
74
  },
66
75
  maxDate: {
67
76
  type: Date,
68
- default: () => new Date(C + 10, 11, 31),
69
- validator: w
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: !0
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: !0
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(t, { emit: o }) {
101
- const a = q({
109
+ setup(props, { emit }) {
110
+ const state = reactive({
102
111
  currentDate: /* @__PURE__ */ new Date(),
103
- title: t.title,
112
+ title: props.title,
104
113
  selectedValue: []
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);
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 g(e, n) {
111
- return 32 - new Date(e, n - 1, 32).getDate();
123
+ function getMonthEndDay(year, month) {
124
+ return 32 - new Date(year, month - 1, 32).getDate();
112
125
  }
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
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
- }, 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([
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: [c, e]
167
+ range: [minYear, maxYear]
132
168
  },
133
169
  {
134
170
  type: "month",
135
- range: [d, u]
171
+ range: [minMonth, maxMonth]
136
172
  },
137
173
  {
138
174
  type: "day",
139
- range: [m, n]
175
+ range: [minDate, maxDate]
140
176
  },
141
177
  {
142
178
  type: "hour",
143
- range: [z, r]
179
+ range: [minHour, maxHour]
144
180
  },
145
181
  {
146
182
  type: "minute",
147
- range: [I, l]
183
+ range: [minMinute, maxMinute]
148
184
  },
149
185
  {
150
186
  type: "seconds",
151
- range: [L, i]
187
+ range: [minSeconds, maxSeconds]
152
188
  }
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
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(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);
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
- 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 };
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 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) {
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
- e = e.slice(0, 3);
283
+ list = list.slice(0, 3);
193
284
  break;
194
285
  case "datetime":
195
- e = e.slice(0, 5);
286
+ list = list.slice(0, 5);
196
287
  break;
197
288
  case "time":
198
- e = e.slice(3, 6);
289
+ list = list.slice(3, 6);
199
290
  break;
200
291
  case "year-month":
201
- e = e.slice(0, 2);
292
+ list = list.slice(0, 2);
202
293
  break;
203
294
  case "month-day":
204
- e = e.slice(1, 3);
295
+ list = list.slice(1, 3);
205
296
  break;
206
297
  case "datehour":
207
- e = e.slice(0, 4);
298
+ list = list.slice(0, 4);
208
299
  break;
209
300
  case "hour-minute":
210
- e = e.slice(3, 5);
301
+ list = list.slice(3, 5);
211
302
  break;
212
303
  }
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()
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 N(n.map((u) => String(u)));
315
+ return generateList(res.map((i) => String(i)));
224
316
  };
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));
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
- ), b(
234
- () => a.currentDate,
235
- (e) => {
236
- JSON.stringify(e) === JSON.stringify(t.modelValue) || o("update:modelValue", e);
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
- ), b(
239
- () => t.title,
240
- (e) => {
241
- a.title = e;
339
+ );
340
+ watch(
341
+ () => props.title,
342
+ (val) => {
343
+ state.title = val;
242
344
  }
243
- ), k(V({}, G(a)), {
244
- changeHandler: Y,
245
- closeHandler: v,
246
- confirm: J,
247
- columns: y
345
+ );
346
+ return __spreadProps(__spreadValues({}, toRefs(state)), {
347
+ changeHandler,
348
+ closeHandler,
349
+ confirm,
350
+ columns
248
351
  });
249
352
  }
250
353
  });
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
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: x(() => [
270
- H(t.$slots, "top")
372
+ top: withCtx(() => [
373
+ renderSlot(_ctx.$slots, "top")
271
374
  ]),
272
- default: x(() => [
273
- H(t.$slots, "default")
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 he = /* @__PURE__ */ ee(ae, [["render", re]]);
381
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
279
382
  export {
280
- he as default
383
+ index as default
281
384
  };