@nutui/nutui 3.1.18 → 3.1.19-beta.2

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 (232) hide show
  1. package/README.md +9 -8
  2. package/dist/nutui.es.js +12360 -12238
  3. package/dist/nutui.umd.js +12367 -12245
  4. package/dist/packages/_es/ActionSheet.js +1 -1
  5. package/dist/packages/_es/Address.js +1 -1
  6. package/dist/packages/_es/Audio.js +1 -1
  7. package/dist/packages/_es/AudioOperate.js +125 -0
  8. package/dist/packages/_es/Avatar.js +1 -1
  9. package/dist/packages/_es/BackTop.js +1 -1
  10. package/dist/packages/_es/Badge.js +1 -1
  11. package/dist/packages/_es/Barrage.js +1 -1
  12. package/dist/packages/_es/Button.js +1 -1
  13. package/dist/packages/_es/Calendar.js +8 -684
  14. package/dist/packages/_es/CalendarItem.js +10 -0
  15. package/dist/packages/_es/Card.js +1 -1
  16. package/dist/packages/_es/Cascader.js +1 -1
  17. package/dist/packages/_es/Cell.js +1 -1
  18. package/dist/packages/_es/CellGroup.js +1 -1
  19. package/dist/packages/_es/Checkbox.js +13 -3
  20. package/dist/packages/_es/CheckboxGroup.js +2 -2
  21. package/dist/packages/_es/CircleProgress.js +1 -1
  22. package/dist/packages/_es/Col.js +1 -1
  23. package/dist/packages/_es/Collapse.js +1 -1
  24. package/dist/packages/_es/CollapseItem.js +1 -1
  25. package/dist/packages/_es/CountDown.js +1 -1
  26. package/dist/packages/_es/CountUp.js +1 -1
  27. package/dist/packages/_es/DatePicker.js +1 -1
  28. package/dist/packages/_es/Dialog.js +10 -9
  29. package/dist/packages/_es/Divider.js +1 -1
  30. package/dist/packages/_es/Drag.js +1 -1
  31. package/dist/packages/_es/Elevator.js +2 -2
  32. package/dist/packages/_es/Empty.js +1 -1
  33. package/dist/packages/_es/FixedNav.js +6 -7
  34. package/dist/packages/_es/Form.js +2 -6
  35. package/dist/packages/_es/FormItem.js +1 -1
  36. package/dist/packages/_es/Grid.js +1 -1
  37. package/dist/packages/_es/GridItem.js +1 -1
  38. package/dist/packages/_es/Icon.js +1 -1
  39. package/dist/packages/_es/ImagePreview.js +2 -2
  40. package/dist/packages/_es/Indicator.js +1 -1
  41. package/dist/packages/_es/InfiniteLoading.js +1 -1
  42. package/dist/packages/_es/Input.js +1 -1
  43. package/dist/packages/_es/InputNumber.js +1 -1
  44. package/dist/packages/_es/Layout.js +1 -1
  45. package/dist/packages/_es/List.js +1 -1
  46. package/dist/packages/_es/Menu.js +2 -2
  47. package/dist/packages/_es/MenuItem.js +1 -1
  48. package/dist/packages/_es/Navbar.js +1 -1
  49. package/dist/packages/_es/NoticeBar.js +1 -1
  50. package/dist/packages/_es/Notify.js +1 -1
  51. package/dist/packages/_es/NumberKeyboard.js +9 -4
  52. package/dist/packages/_es/OldPicker.js +484 -0
  53. package/dist/packages/_es/OverLay.js +1 -1
  54. package/dist/packages/_es/Pagination.js +8 -7
  55. package/dist/packages/_es/Picker.js +1 -1
  56. package/dist/packages/_es/Popover.js +1 -1
  57. package/dist/packages/_es/Popup.js +1 -1
  58. package/dist/packages/_es/Price.js +1 -1
  59. package/dist/packages/_es/Progress.js +1 -1
  60. package/dist/packages/_es/PullRefresh.js +363 -0
  61. package/dist/packages/_es/Radio.js +13 -3
  62. package/dist/packages/_es/RadioGroup.js +1 -1
  63. package/dist/packages/_es/Range.js +2 -2
  64. package/dist/packages/_es/Rate.js +1 -1
  65. package/dist/packages/_es/Row.js +1 -1
  66. package/dist/packages/_es/SearchBar.js +6 -5
  67. package/dist/packages/_es/ShortPassword.js +1 -1
  68. package/dist/packages/_es/SideNavBar.js +1 -1
  69. package/dist/packages/_es/SideNavBarItem.js +1 -1
  70. package/dist/packages/_es/Signature.js +1 -1
  71. package/dist/packages/_es/Skeleton.js +1 -1
  72. package/dist/packages/_es/Sku.js +2 -3
  73. package/dist/packages/_es/Step.js +1 -1
  74. package/dist/packages/_es/Steps.js +1 -1
  75. package/dist/packages/_es/Sticky.js +2 -2
  76. package/dist/packages/_es/SubSideNavBar.js +1 -1
  77. package/dist/packages/_es/Swipe.js +1 -1
  78. package/dist/packages/_es/Swiper.js +2 -2
  79. package/dist/packages/_es/SwiperItem.js +2 -2
  80. package/dist/packages/_es/Switch.js +1 -1
  81. package/dist/packages/_es/TabPane.js +1 -1
  82. package/dist/packages/_es/Tabbar.js +1 -1
  83. package/dist/packages/_es/TabbarItem.js +7 -3
  84. package/dist/packages/_es/Table.js +1 -1
  85. package/dist/packages/_es/Tabs.js +1 -1
  86. package/dist/packages/_es/Tag.js +1 -1
  87. package/dist/packages/_es/TextArea.js +1 -1
  88. package/dist/packages/_es/TimeDetail.js +1 -1
  89. package/dist/packages/_es/TimePannel.js +1 -1
  90. package/dist/packages/_es/TimeSelect.js +1 -1
  91. package/dist/packages/_es/Toast.js +1 -1
  92. package/dist/packages/_es/Uploader.js +1 -1
  93. package/dist/packages/_es/Video.js +7 -6
  94. package/dist/packages/_es/common.js +1 -1
  95. package/dist/packages/_es/component.js +135 -3
  96. package/dist/packages/_es/index.js +1 -1
  97. package/dist/packages/_es/index2.js +31 -8
  98. package/dist/packages/_es/index3.js +8 -31
  99. package/dist/packages/_es/index4.js +1 -1
  100. package/dist/packages/_es/index5.js +692 -0
  101. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  102. package/dist/packages/_es/pxCheck.js +1 -1
  103. package/dist/packages/_es/raf.js +1 -1
  104. package/dist/packages/uploader/index.scss +2 -2
  105. package/dist/style.css +1 -1
  106. package/dist/styles/themes/default.scss +65 -65
  107. package/dist/styles/themes/jdt.scss +65 -65
  108. package/dist/styles/variables-jdt.scss +2 -1
  109. package/dist/styles/variables.scss +1 -1
  110. package/dist/types/__VUE/actionsheet/index.d.ts +269 -0
  111. package/dist/types/__VUE/address/index.d.ts +386 -0
  112. package/dist/types/__VUE/audio/index.d.ts +92 -0
  113. package/dist/types/__VUE/audiooperate/index.d.ts +68 -0
  114. package/dist/types/__VUE/avatar/index.d.ts +66 -0
  115. package/dist/types/__VUE/backtop/index.d.ts +105 -0
  116. package/dist/types/__VUE/badge/index.d.ts +94 -0
  117. package/dist/types/__VUE/barrage/index.d.ts +80 -0
  118. package/dist/types/__VUE/button/index.d.ts +116 -0
  119. package/dist/types/__VUE/calendar/index.d.ts +155 -0
  120. package/dist/types/__VUE/calendaritem/index.d.ts +195 -0
  121. package/dist/types/__VUE/card/index.d.ts +81 -0
  122. package/dist/types/__VUE/cascader/cascader-item.d.ts +76 -0
  123. package/dist/types/__VUE/cascader/helper.d.ts +8 -0
  124. package/dist/types/__VUE/cascader/index.d.ts +76 -0
  125. package/dist/types/__VUE/cascader/tree.d.ts +17 -0
  126. package/dist/types/__VUE/cascader/types.d.ts +30 -0
  127. package/dist/types/__VUE/cell/index.d.ts +109 -0
  128. package/dist/types/__VUE/cellgroup/index.d.ts +38 -0
  129. package/dist/types/__VUE/checkbox/index.d.ts +102 -0
  130. package/dist/types/__VUE/checkboxgroup/index.d.ts +39 -0
  131. package/dist/types/__VUE/circleprogress/index.d.ts +66 -0
  132. package/dist/types/__VUE/col/index.d.ts +42 -0
  133. package/dist/types/__VUE/collapse/index.d.ts +104 -0
  134. package/dist/types/__VUE/collapseitem/index.d.ts +83 -0
  135. package/dist/types/__VUE/countdown/index.d.ts +90 -0
  136. package/dist/types/__VUE/countup/index.d.ts +216 -0
  137. package/dist/types/__VUE/datepicker/index.d.ts +347 -0
  138. package/dist/types/__VUE/datepicker/utils.d.ts +5 -0
  139. package/dist/types/__VUE/dialog/index.d.ts +306 -0
  140. package/dist/types/__VUE/divider/index.d.ts +47 -0
  141. package/dist/types/__VUE/drag/index.d.ts +61 -0
  142. package/dist/types/__VUE/elevator/index.d.ts +71 -0
  143. package/dist/types/__VUE/empty/index.d.ts +46 -0
  144. package/dist/types/__VUE/fixednav/index.d.ts +96 -0
  145. package/dist/types/__VUE/form/common.d.ts +20 -0
  146. package/dist/types/__VUE/form/index.d.ts +32 -0
  147. package/dist/types/__VUE/form/types.d.ts +13 -0
  148. package/dist/types/__VUE/formitem/index.d.ts +120 -0
  149. package/dist/types/__VUE/formitem/types.d.ts +10 -0
  150. package/dist/types/__VUE/grid/common.d.ts +91 -0
  151. package/dist/types/__VUE/grid/index.d.ts +100 -0
  152. package/dist/types/__VUE/griditem/index.d.ts +80 -0
  153. package/dist/types/__VUE/icon/index.d.ts +74 -0
  154. package/dist/types/__VUE/imagepreview/index.d.ts +125 -0
  155. package/dist/types/__VUE/indicator/index.d.ts +70 -0
  156. package/dist/types/__VUE/infiniteloading/index.d.ts +140 -0
  157. package/dist/types/__VUE/input/index.d.ts +336 -0
  158. package/dist/types/__VUE/input/util.d.ts +5 -0
  159. package/dist/types/__VUE/inputnumber/index.d.ts +117 -0
  160. package/dist/types/__VUE/layout/index.d.ts +13 -0
  161. package/dist/types/__VUE/list/index.d.ts +48 -0
  162. package/dist/types/__VUE/menu/index.d.ts +51 -0
  163. package/dist/types/__VUE/menuitem/index.d.ts +77 -0
  164. package/dist/types/__VUE/navbar/index.d.ts +84 -0
  165. package/dist/types/__VUE/noticebar/index.d.ts +209 -0
  166. package/dist/types/__VUE/notify/index.d.ts +103 -0
  167. package/dist/types/__VUE/numberkeyboard/index.d.ts +123 -0
  168. package/dist/types/__VUE/oldpicker/Column.d.ts +96 -0
  169. package/dist/types/__VUE/oldpicker/commonProps.d.ts +22 -0
  170. package/dist/types/__VUE/oldpicker/index.d.ts +360 -0
  171. package/dist/types/__VUE/oldpicker/types.d.ts +24 -0
  172. package/dist/types/__VUE/overlay/index.d.ts +1614 -0
  173. package/dist/types/__VUE/pagination/index.d.ts +112 -0
  174. package/dist/types/__VUE/picker/Column.d.ts +90 -0
  175. package/dist/types/__VUE/picker/index.d.ts +342 -0
  176. package/dist/types/__VUE/picker/types.d.ts +26 -0
  177. package/dist/types/__VUE/popover/index.d.ts +233 -0
  178. package/dist/types/__VUE/popup/index.d.ts +1734 -0
  179. package/dist/types/__VUE/popup/use-lock-scroll.d.ts +5 -0
  180. package/dist/types/__VUE/price/index.d.ts +87 -0
  181. package/dist/types/__VUE/progress/index.d.ts +137 -0
  182. package/dist/types/__VUE/pullrefresh/index.d.ts +128 -0
  183. package/dist/types/__VUE/pullrefresh/use-touch.d.ts +20 -0
  184. package/dist/types/__VUE/pullrefresh/util.d.ts +6 -0
  185. package/dist/types/__VUE/radio/index.d.ts +90 -0
  186. package/dist/types/__VUE/radiogroup/index.d.ts +48 -0
  187. package/dist/types/__VUE/range/index.d.ts +156 -0
  188. package/dist/types/__VUE/rate/index.d.ts +142 -0
  189. package/dist/types/__VUE/row/index.d.ts +63 -0
  190. package/dist/types/__VUE/searchbar/index.d.ts +100 -0
  191. package/dist/types/__VUE/shortpassword/index.d.ts +136 -0
  192. package/dist/types/__VUE/sidenavbar/index.d.ts +36 -0
  193. package/dist/types/__VUE/sidenavbaritem/index.d.ts +41 -0
  194. package/dist/types/__VUE/signature/index.d.ts +73 -0
  195. package/dist/types/__VUE/skeleton/common.d.ts +63 -0
  196. package/dist/types/__VUE/skeleton/index.d.ts +117 -0
  197. package/dist/types/__VUE/sku/components/SkuHeader.d.ts +27 -0
  198. package/dist/types/__VUE/sku/components/SkuOperate.d.ts +70 -0
  199. package/dist/types/__VUE/sku/components/SkuSelect.d.ts +30 -0
  200. package/dist/types/__VUE/sku/components/SkuStepper.d.ts +67 -0
  201. package/dist/types/__VUE/sku/index.d.ts +300 -0
  202. package/dist/types/__VUE/step/index.d.ts +70 -0
  203. package/dist/types/__VUE/steps/index.d.ts +47 -0
  204. package/dist/types/__VUE/sticky/index.d.ts +63 -0
  205. package/dist/types/__VUE/subsidenavbar/index.d.ts +54 -0
  206. package/dist/types/__VUE/swipe/index.d.ts +69 -0
  207. package/dist/types/__VUE/swiper/index.d.ts +163 -0
  208. package/dist/types/__VUE/swiper/use-touch.d.ts +20 -0
  209. package/dist/types/__VUE/swiperitem/index.d.ts +24 -0
  210. package/dist/types/__VUE/switch/index.d.ts +136 -0
  211. package/dist/types/__VUE/tabbar/index.d.ts +84 -0
  212. package/dist/types/__VUE/tabbaritem/index.d.ts +108 -0
  213. package/dist/types/__VUE/table/common.d.ts +54 -0
  214. package/dist/types/__VUE/table/index.d.ts +75 -0
  215. package/dist/types/__VUE/table/renderColumn.d.ts +20 -0
  216. package/dist/types/__VUE/table/types.d.ts +19 -0
  217. package/dist/types/__VUE/tabpane/index.d.ts +47 -0
  218. package/dist/types/__VUE/tabs/index.d.ts +128 -0
  219. package/dist/types/__VUE/tag/index.d.ts +89 -0
  220. package/dist/types/__VUE/textarea/index.d.ts +120 -0
  221. package/dist/types/__VUE/timedetail/index.d.ts +48 -0
  222. package/dist/types/__VUE/timepannel/index.d.ts +43 -0
  223. package/dist/types/__VUE/timeselect/index.d.ts +82 -0
  224. package/dist/types/__VUE/toast/index.d.ts +149 -0
  225. package/dist/types/__VUE/uploader/index.d.ts +258 -0
  226. package/dist/types/__VUE/uploader/uploader.d.ts +25 -0
  227. package/dist/types/__VUE/video/index.d.ts +123 -0
  228. package/dist/{index.d.ts → types/index.d.ts} +0 -0
  229. package/dist/types/nutui.d.ts +92 -0
  230. package/package.json +14 -5
  231. package/dist/nutui.d.ts +0 -103
  232. package/dist/packages/_es/util.js +0 -47
@@ -1,689 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
1
  /*!
18
- * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.2 Thu Apr 07 2022 17:52:31 GMT+0800 (中国标准时间)
19
3
  * (c) 2022 @jdf2e.
20
4
  * Released under the MIT License.
21
5
  */
22
- import { ref, computed, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, normalizeStyle, createTextVNode, resolveComponent, createBlock, withCtx, createSlots } from "vue";
6
+ import { computed, ref, resolveComponent, openBlock, createBlock, withCtx, createSlots, renderSlot, createCommentVNode } from "vue";
23
7
  import { c as createComponent } from "./component.js";
24
- import { r as requestAniFrame } from "./raf.js";
8
+ import { C as CalendarItem, U as Utils } from "./index5.js";
25
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
26
- const Utils = {
27
- isLeapYear: function(y) {
28
- return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
29
- },
30
- getWhatDay: function(year, month, day) {
31
- const date = new Date(year + "/" + month + "/" + day);
32
- const index2 = date.getDay();
33
- const dayNames = [
34
- "\u661F\u671F\u65E5",
35
- "\u661F\u671F\u4E00",
36
- "\u661F\u671F\u4E8C",
37
- "\u661F\u671F\u4E09",
38
- "\u661F\u671F\u56DB",
39
- "\u661F\u671F\u4E94",
40
- "\u661F\u671F\u516D"
41
- ];
42
- return dayNames[index2];
43
- },
44
- getMonthPreDay: function(year, month) {
45
- const date = new Date(year + "/" + month + "/01");
46
- let day = date.getDay();
47
- if (day == 0) {
48
- day = 7;
49
- }
50
- return day;
51
- },
52
- getMonthDays: function(year, month) {
53
- if (/^0/.test(month)) {
54
- month = month.split("")[1];
55
- }
56
- return [
57
- 0,
58
- 31,
59
- this.isLeapYear(Number(year)) ? 29 : 28,
60
- 31,
61
- 30,
62
- 31,
63
- 30,
64
- 31,
65
- 31,
66
- 30,
67
- 31,
68
- 30,
69
- 31
70
- ][month];
71
- },
72
- getNumTwoBit: function(n) {
73
- n = Number(n);
74
- return (n > 9 ? "" : "0") + n;
75
- },
76
- date2Str: function(date, split) {
77
- split = split || "-";
78
- const y = date.getFullYear();
79
- const m = this.getNumTwoBit(date.getMonth() + 1);
80
- const d = this.getNumTwoBit(date.getDate());
81
- return [y, m, d].join(split);
82
- },
83
- getDay: function(i) {
84
- i = i || 0;
85
- let date = new Date();
86
- const diff = i * (1e3 * 60 * 60 * 24);
87
- date = new Date(date.getTime() + diff);
88
- return this.date2Str(date);
89
- },
90
- compareDate: function(date1, date2) {
91
- const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
92
- const endTime = new Date(date2.replace("-", "/").replace("-", "/"));
93
- if (startTime >= endTime) {
94
- return false;
95
- }
96
- return true;
97
- },
98
- isEqual: function(date1, date2) {
99
- const startTime = new Date(date1).getTime();
100
- const endTime = new Date(date2).getTime();
101
- if (startTime == endTime) {
102
- return true;
103
- }
104
- return false;
105
- }
106
- };
107
- const { create: create$1 } = createComponent("calendar-item");
108
- const _sfc_main$1 = create$1({
109
- props: {
110
- type: {
111
- type: String,
112
- default: "one"
113
- },
114
- isAutoBackFill: {
115
- type: Boolean,
116
- default: false
117
- },
118
- poppable: {
119
- type: Boolean,
120
- default: true
121
- },
122
- showTitle: {
123
- type: Boolean,
124
- default: true
125
- },
126
- showSubTitle: {
127
- type: Boolean,
128
- default: true
129
- },
130
- showToday: {
131
- type: Boolean,
132
- default: true
133
- },
134
- title: {
135
- type: String,
136
- default: "\u65E5\u5386\u9009\u62E9"
137
- },
138
- confirmText: {
139
- type: String,
140
- default: "\u786E\u8BA4"
141
- },
142
- startText: {
143
- type: String,
144
- default: "\u5F00\u59CB"
145
- },
146
- endText: {
147
- type: String,
148
- default: "\u7ED3\u675F"
149
- },
150
- defaultValue: {
151
- type: [String, Array],
152
- default: null
153
- },
154
- startDate: {
155
- type: String,
156
- default: Utils.getDay(0)
157
- },
158
- endDate: {
159
- type: String,
160
- default: Utils.getDay(365)
161
- }
162
- },
163
- emits: ["choose", "update", "close", "select"],
164
- setup(props, { emit, slots }) {
165
- const weeks = ref(["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]);
166
- const months = ref(null);
167
- const monthsPanel = ref(null);
168
- const weeksPanel = ref(null);
169
- const viewArea = ref(null);
170
- const viewHeight = ref(0);
171
- const compConthsData = computed(() => {
172
- return state.monthsData.slice(state.defaultRange[0], state.defaultRange[1]);
173
- });
174
- const showTopBtn = computed(() => {
175
- return slots.btn;
176
- });
177
- const topInfo = computed(() => {
178
- return slots.topInfo;
179
- });
180
- const bottomInfo = computed(() => {
181
- return slots.bottomInfo;
182
- });
183
- const state = reactive({
184
- yearMonthTitle: "",
185
- defaultRange: [],
186
- currDate: "",
187
- propStartDate: "",
188
- propEndDate: "",
189
- unLoadPrev: false,
190
- touchParams: {
191
- startY: 0,
192
- endY: 0,
193
- startTime: 0,
194
- endTime: 0,
195
- lastY: 0,
196
- lastTime: 0
197
- },
198
- transformY: 0,
199
- translateY: 0,
200
- scrollDistance: 0,
201
- defaultData: [],
202
- chooseData: [],
203
- monthsData: [],
204
- dayPrefix: "calendar-month-day",
205
- startData: "",
206
- endData: "",
207
- isRange: props.type === "range",
208
- timer: 0,
209
- currentIndex: 0,
210
- avgHeight: 0,
211
- monthsNum: 0
212
- });
213
- const splitDate = (date) => {
214
- return date.split("-");
215
- };
216
- const isStart = (currDate) => {
217
- return Utils.isEqual(state.currDate[0], currDate);
218
- };
219
- const isEnd = (currDate) => {
220
- return Utils.isEqual(state.currDate[1], currDate);
221
- };
222
- const getCurrDate = (day, month, isRange) => {
223
- return month.curData[0] + "-" + month.curData[1] + "-" + Utils.getNumTwoBit(+day.day);
224
- };
225
- const getClass = (day, month, isRange) => {
226
- const currDate = getCurrDate(day, month);
227
- if (day.type == "curr") {
228
- if (!state.isRange && Utils.isEqual(state.currDate, currDate) || state.isRange && (isStart(currDate) || isEnd(currDate))) {
229
- return `${state.dayPrefix}-active`;
230
- } else if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
231
- return `${state.dayPrefix}-disabled`;
232
- } else if (state.isRange && Array.isArray(state.currDate) && Object.values(state.currDate).length == 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
233
- return `${state.dayPrefix}-choose`;
234
- } else {
235
- return null;
236
- }
237
- } else {
238
- return `${state.dayPrefix}-disabled`;
239
- }
240
- };
241
- const confirm = () => {
242
- if (state.isRange && state.chooseData.length == 2 || !state.isRange) {
243
- emit("choose", state.chooseData);
244
- if (props.poppable) {
245
- emit("update");
246
- }
247
- }
248
- };
249
- const chooseDay = (day, month, isFirst, isRange) => {
250
- if (getClass(day, month) != `${state.dayPrefix}-disabled`) {
251
- let days = [...month.curData];
252
- days[2] = typeof day.day == "number" ? Utils.getNumTwoBit(day.day) : day.day;
253
- days[3] = `${days[0]}-${days[1]}-${days[2]}`;
254
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
255
- if (!state.isRange) {
256
- state.currDate = days[3];
257
- state.chooseData = [...days];
258
- } else {
259
- if (Object.values(state.currDate).length == 2) {
260
- state.currDate = [days[3]];
261
- } else {
262
- if (Utils.compareDate(state.currDate[0], days[3])) {
263
- Array.isArray(state.currDate) && state.currDate.push(days[3]);
264
- } else {
265
- Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
266
- }
267
- }
268
- if (state.chooseData.length == 2 || !state.chooseData.length) {
269
- state.chooseData = [...days];
270
- } else {
271
- if (Utils.compareDate(state.chooseData[3], days[3])) {
272
- state.chooseData = [[...state.chooseData], [...days]];
273
- } else {
274
- state.chooseData = [[...days], [...state.chooseData]];
275
- }
276
- }
277
- }
278
- if (!isFirst) {
279
- emit("select", state.chooseData);
280
- if (props.isAutoBackFill) {
281
- confirm();
282
- }
283
- }
284
- }
285
- };
286
- const getCurrData = (type) => {
287
- const monthData = type == "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
288
- let year = parseInt(monthData.curData[0]);
289
- let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
290
- switch (type) {
291
- case "prev":
292
- month == 1 && (year -= 1);
293
- month = month == 1 ? 12 : --month;
294
- break;
295
- case "next":
296
- month == 12 && (year += 1);
297
- month = month == 12 ? 1 : ++month;
298
- break;
299
- }
300
- return [year, Utils.getNumTwoBit(month), Utils.getMonthDays(String(year), String(month))];
301
- };
302
- const getDaysStatus = (days, type, dateInfo) => {
303
- let { year, month } = dateInfo;
304
- if (type == "prev" && days >= 7) {
305
- days -= 7;
306
- }
307
- return Array.from(Array(days), (v, k) => {
308
- return {
309
- day: k + 1,
310
- type,
311
- year,
312
- month
313
- };
314
- });
315
- };
316
- const getPreDaysStatus = (days, type, dateInfo, preCurrMonthDays) => {
317
- let { year, month } = dateInfo;
318
- if (type == "prev" && days >= 7) {
319
- days -= 7;
320
- }
321
- let months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
322
- return {
323
- day: k + 1,
324
- type,
325
- year,
326
- month
327
- };
328
- });
329
- return months2.slice(preCurrMonthDays - days);
330
- };
331
- const getMonth = (curData, type) => {
332
- const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
333
- let preMonth = curData[1] - 1;
334
- let preYear = curData[0];
335
- if (preMonth <= 0) {
336
- preMonth = 12;
337
- preYear += 1;
338
- }
339
- const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
340
- const preCurrMonthDays = Utils.getMonthDays(preYear + "", preMonth + "");
341
- const title = {
342
- year: curData[0],
343
- month: curData[1]
344
- };
345
- const monthInfo = {
346
- curData,
347
- title: `${title.year}\u5E74${title.month}\u6708`,
348
- monthData: [
349
- ...getPreDaysStatus(preMonthDays, "prev", { month: preMonth, year: preYear }, preCurrMonthDays),
350
- ...getDaysStatus(currMonthDays, "curr", title)
351
- ]
352
- };
353
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
354
- let cssScrollHeight = 0;
355
- if (state.monthsData.length > 0) {
356
- cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
357
- }
358
- monthInfo.cssScrollHeight = cssScrollHeight;
359
- if (type == "next") {
360
- if (!state.endData || !Utils.compareDate(`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(state.endData[0], state.endData[1])}`, `${curData[0]}-${curData[1]}-${curData[2]}`)) {
361
- state.monthsData.push(monthInfo);
362
- }
363
- } else {
364
- if (!state.startData || !Utils.compareDate(`${curData[0]}-${curData[1]}-${curData[2]}`, `${state.startData[0]}-${state.startData[1]}-01`)) {
365
- state.monthsData.unshift(monthInfo);
366
- } else {
367
- state.unLoadPrev = true;
368
- }
369
- }
370
- };
371
- const initData = () => {
372
- let propStartDate = props.startDate ? props.startDate : Utils.getDay(0);
373
- let propEndDate = props.endDate ? props.endDate : Utils.getDay(365);
374
- state.propStartDate = propStartDate;
375
- state.propEndDate = propEndDate;
376
- state.startData = splitDate(propStartDate);
377
- state.endData = splitDate(propEndDate);
378
- if (!props.defaultValue || Array.isArray(props.defaultValue) && props.defaultValue.length <= 0) {
379
- state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
380
- } else {
381
- state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;
382
- }
383
- const startDate = {
384
- year: Number(state.startData[0]),
385
- month: Number(state.startData[1])
386
- };
387
- const endDate = {
388
- year: Number(state.endData[0]),
389
- month: Number(state.endData[1])
390
- };
391
- let monthsNum = endDate.month - startDate.month;
392
- if (endDate.year - startDate.year > 0) {
393
- monthsNum = monthsNum + 12 * (endDate.year - startDate.year);
394
- }
395
- getMonth(state.startData, "next");
396
- let i = 1;
397
- do {
398
- getMonth(getCurrData("next"), "next");
399
- } while (i++ < monthsNum);
400
- state.monthsNum = monthsNum;
401
- if (state.isRange && Array.isArray(state.currDate)) {
402
- if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
403
- state.currDate.splice(0, 1, propStartDate);
404
- }
405
- if (propEndDate && Utils.compareDate(propEndDate, state.currDate[1])) {
406
- state.currDate.splice(1, 1, propEndDate);
407
- }
408
- state.defaultData = [...splitDate(state.currDate[0]), ...splitDate(state.currDate[1])];
409
- } else {
410
- if (propStartDate && Utils.compareDate(state.currDate, propStartDate)) {
411
- state.currDate = propStartDate;
412
- } else if (propEndDate && !Utils.compareDate(state.currDate, propEndDate)) {
413
- state.currDate = propEndDate;
414
- }
415
- state.defaultData = [...splitDate(state.currDate)];
416
- }
417
- let current = 0;
418
- let lastCurrent = 0;
419
- state.monthsData.forEach((item, index2) => {
420
- if (item.title == `${state.defaultData[0]}\u5E74${state.defaultData[1]}\u6708`) {
421
- current = index2;
422
- }
423
- if (state.isRange) {
424
- if (item.title == `${state.defaultData[3]}\u5E74${state.defaultData[4]}\u6708`) {
425
- lastCurrent = index2;
426
- }
427
- }
428
- });
429
- setDefaultRange(monthsNum, current);
430
- state.currentIndex = current;
431
- state.yearMonthTitle = state.monthsData[state.currentIndex].title;
432
- if (state.isRange) {
433
- chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
434
- chooseDay({ day: state.defaultData[5], type: "curr" }, state.monthsData[lastCurrent], true);
435
- } else {
436
- chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
437
- }
438
- let lastItem = state.monthsData[state.monthsData.length - 1];
439
- let containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
440
- requestAniFrame(() => {
441
- if ((months == null ? void 0 : months.value) && (monthsPanel == null ? void 0 : monthsPanel.value) && (viewArea == null ? void 0 : viewArea.value)) {
442
- viewHeight.value = months.value.clientHeight;
443
- monthsPanel.value.style.height = `${containerHeight}px`;
444
- months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
445
- }
446
- });
447
- state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
448
- };
449
- const setDefaultRange = (monthsNum, current) => {
450
- if (monthsNum >= 3) {
451
- if (current > 0 && current < monthsNum) {
452
- state.defaultRange = [current - 1, current + 3];
453
- } else if (current == 0) {
454
- state.defaultRange = [current, current + 4];
455
- } else if (current == monthsNum) {
456
- state.defaultRange = [current - 2, current + 2];
457
- }
458
- } else {
459
- state.defaultRange = [0, monthsNum + 2];
460
- }
461
- let defaultScrollTop = state.monthsData[state.defaultRange[0]].cssScrollHeight;
462
- state.translateY = defaultScrollTop;
463
- };
464
- const isActive = (day, month) => {
465
- return state.isRange && day.type == "curr" && getClass(day, month) == "calendar-month-day-active";
466
- };
467
- const isStartTip = (day, month) => {
468
- return isActive(day, month) && isStart(getCurrDate(day, month));
469
- };
470
- const isEndTip = (day, month) => {
471
- if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month))) {
472
- return isActive(day, month);
473
- }
474
- return false;
475
- };
476
- const rangeTip = (day, month) => {
477
- if (state.currDate.length >= 2) {
478
- return Utils.isEqual(state.currDate[0], state.currDate[1]);
479
- }
480
- };
481
- const isCurrDay = (dateInfo) => {
482
- const date = `${dateInfo.year}-${dateInfo.month}-${dateInfo.day < 10 ? "0" + dateInfo.day : dateInfo.day}`;
483
- return Utils.isEqual(date, Utils.date2Str(new Date()));
484
- };
485
- const mothsViewScroll = (e) => {
486
- const currentScrollTop = e.target.scrollTop;
487
- let current = Math.floor(currentScrollTop / state.avgHeight);
488
- if (current == 0) {
489
- if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
490
- current += 1;
491
- }
492
- } else if (current > 0 && current < state.monthsNum - 1) {
493
- if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
494
- current += 1;
495
- }
496
- if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
497
- current -= 1;
498
- }
499
- } else {
500
- const viewPosition = Math.round(currentScrollTop + viewHeight.value);
501
- if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
502
- current -= 1;
503
- }
504
- if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
505
- current += 1;
506
- }
507
- if (currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
508
- current -= 1;
509
- }
510
- }
511
- if (state.currentIndex !== current) {
512
- state.currentIndex = current;
513
- setDefaultRange(state.monthsNum, current);
514
- }
515
- state.yearMonthTitle = state.monthsData[current].title;
516
- };
517
- const resetRender = () => {
518
- state.chooseData.splice(0);
519
- state.monthsData.splice(0);
520
- initData();
521
- };
522
- initData();
523
- watch(() => props.defaultValue, (val) => {
524
- if (val) {
525
- if (props.poppable) {
526
- resetRender();
527
- }
528
- }
529
- });
530
- return __spreadValues(__spreadValues({
531
- weeks,
532
- compConthsData,
533
- showTopBtn,
534
- topInfo,
535
- bottomInfo,
536
- rangeTip,
537
- mothsViewScroll,
538
- getClass,
539
- isStartTip,
540
- isEndTip,
541
- chooseDay,
542
- isCurrDay,
543
- confirm,
544
- monthsPanel,
545
- months,
546
- weeksPanel,
547
- viewArea
548
- }, toRefs(state)), toRefs(props));
549
- }
550
- });
551
- const _hoisted_1 = {
552
- key: 0,
553
- class: "calendar-title"
554
- };
555
- const _hoisted_2 = {
556
- key: 1,
557
- class: "calendar-top-slot"
558
- };
559
- const _hoisted_3 = {
560
- key: 2,
561
- class: "calendar-curr-month"
562
- };
563
- const _hoisted_4 = {
564
- class: "calendar-weeks",
565
- ref: "weeksPanel"
566
- };
567
- const _hoisted_5 = {
568
- class: "calendar-months-panel",
569
- ref: "monthsPanel"
570
- };
571
- const _hoisted_6 = { class: "calendar-month-title" };
572
- const _hoisted_7 = { class: "calendar-month-con" };
573
- const _hoisted_8 = ["onClick"];
574
- const _hoisted_9 = { class: "calendar-day" };
575
- const _hoisted_10 = {
576
- key: 0,
577
- class: "calendar-curr-tips calendar-curr-tips-top"
578
- };
579
- const _hoisted_11 = {
580
- key: 1,
581
- class: "calendar-curr-tips calendar-curr-tips-bottom"
582
- };
583
- const _hoisted_12 = {
584
- key: 2,
585
- class: "calendar-curr-tip-curr"
586
- };
587
- const _hoisted_13 = {
588
- key: 4,
589
- class: "calendar-day-tip"
590
- };
591
- const _hoisted_14 = {
592
- key: 0,
593
- class: "nut-calendar-footer"
594
- };
595
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
596
- return openBlock(), createElementBlock("view", {
597
- class: normalizeClass(["nut-calendar nut-calendar-taro", {
598
- "nut-calendar-tile": !_ctx.poppable,
599
- "nut-calendar-nofooter": _ctx.isAutoBackFill
600
- }])
601
- }, [
602
- createElementVNode("view", {
603
- class: normalizeClass(["nut-calendar-header", { "nut-calendar-header-tile": !_ctx.poppable }])
604
- }, [
605
- _ctx.showTitle ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
606
- _ctx.showTopBtn ? (openBlock(), createElementBlock("view", _hoisted_2, [
607
- renderSlot(_ctx.$slots, "btn")
608
- ])) : createCommentVNode("", true),
609
- _ctx.showSubTitle ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.yearMonthTitle), 1)) : createCommentVNode("", true),
610
- createElementVNode("view", _hoisted_4, [
611
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.weeks, (item, index2) => {
612
- return openBlock(), createElementBlock("view", {
613
- class: "calendar-week-item",
614
- key: index2
615
- }, toDisplayString(item), 1);
616
- }), 128))
617
- ], 512)
618
- ], 2),
619
- createElementVNode("view", {
620
- class: "nut-calendar-content",
621
- ref: "months",
622
- onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.mothsViewScroll && _ctx.mothsViewScroll(...args))
623
- }, [
624
- createElementVNode("view", _hoisted_5, [
625
- createElementVNode("view", {
626
- class: "viewArea",
627
- ref: "viewArea",
628
- style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
629
- }, [
630
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsData, (month, index2) => {
631
- return openBlock(), createElementBlock("view", {
632
- class: "calendar-month",
633
- key: index2
634
- }, [
635
- createElementVNode("view", _hoisted_6, toDisplayString(month.title), 1),
636
- createElementVNode("view", _hoisted_7, [
637
- createElementVNode("view", {
638
- class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
639
- }, [
640
- (openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
641
- return openBlock(), createElementBlock("view", {
642
- key: i,
643
- class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
644
- onClick: ($event) => _ctx.chooseDay(day, month)
645
- }, [
646
- createElementVNode("view", _hoisted_9, [
647
- renderSlot(_ctx.$slots, "day", {
648
- date: day.type == "curr" ? day : ""
649
- }, () => [
650
- createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
651
- ])
652
- ]),
653
- _ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
654
- renderSlot(_ctx.$slots, "topInfo", {
655
- date: day.type == "curr" ? day : ""
656
- })
657
- ])) : createCommentVNode("", true),
658
- _ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_11, [
659
- renderSlot(_ctx.$slots, "bottomInfo", {
660
- date: day.type == "curr" ? day : ""
661
- })
662
- ])) : createCommentVNode("", true),
663
- !_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(day) ? (openBlock(), createElementBlock("view", _hoisted_12, " \u4ECA\u5929 ")) : createCommentVNode("", true),
664
- _ctx.isStartTip(day, month) ? (openBlock(), createElementBlock("view", {
665
- key: 3,
666
- class: normalizeClass(["calendar-day-tip", { "calendar-curr-tips-top": _ctx.rangeTip(day, month) }])
667
- }, toDisplayString(_ctx.startText), 3)) : createCommentVNode("", true),
668
- _ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_13, toDisplayString(_ctx.endText), 1)) : createCommentVNode("", true)
669
- ], 10, _hoisted_8);
670
- }), 128))
671
- ], 2)
672
- ])
673
- ]);
674
- }), 128))
675
- ], 4)
676
- ], 512)
677
- ], 544),
678
- _ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view", _hoisted_14, [
679
- createElementVNode("view", {
680
- class: "calendar-confirm-btn",
681
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.confirm && _ctx.confirm(...args))
682
- }, toDisplayString(_ctx.confirmText), 1)
683
- ])) : createCommentVNode("", true)
684
- ], 2);
685
- }
686
- var CalendarItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
10
+ import "./raf.js";
687
11
  const { create } = createComponent("calendar");
688
12
  const _sfc_main = create({
689
13
  components: {
@@ -720,19 +44,19 @@ const _sfc_main = create({
720
44
  },
721
45
  title: {
722
46
  type: String,
723
- default: "\u65E5\u5386\u9009\u62E9"
47
+ default: ""
724
48
  },
725
49
  confirmText: {
726
50
  type: String,
727
- default: "\u786E\u8BA4"
51
+ default: ""
728
52
  },
729
53
  startText: {
730
54
  type: String,
731
- default: "\u5F00\u59CB"
55
+ default: ""
732
56
  },
733
57
  endText: {
734
58
  type: String,
735
- default: "\u7ED3\u675F"
59
+ default: ""
736
60
  },
737
61
  defaultValue: {
738
62
  type: [String, Array]