zartui 2.0.79 → 2.0.80-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/es/action-sheet/index.js +15 -26
  2. package/es/area/index.js +5 -41
  3. package/es/avatar/index.js +3 -16
  4. package/es/back-top/index.js +4 -19
  5. package/es/badge/index.js +4 -12
  6. package/es/button/index.js +20 -40
  7. package/es/calendar/components/Header.js +3 -12
  8. package/es/calendar/components/Month.js +12 -65
  9. package/es/calendar/index.js +23 -94
  10. package/es/calendar/types.js +0 -6
  11. package/es/calendar/utils.js +5 -16
  12. package/es/cascader/index.js +4 -37
  13. package/es/cell/index.js +19 -37
  14. package/es/cell-group/index.js +5 -8
  15. package/es/checkbox/index.js +4 -11
  16. package/es/checkbox-group/index.js +4 -9
  17. package/es/col/index.js +6 -11
  18. package/es/collapse/index.js +2 -5
  19. package/es/collapse-item/index.js +19 -35
  20. package/es/count-down/index.js +2 -15
  21. package/es/count-down/utils.js +3 -10
  22. package/es/datetime-picker/DatePicker.js +12 -70
  23. package/es/datetime-picker/TimePicker.js +10 -23
  24. package/es/datetime-picker/index.js +2 -4
  25. package/es/datetime-picker/shared.js +5 -19
  26. package/es/datetime-picker/utils.js +0 -5
  27. package/es/dialog/Dialog.js +6 -21
  28. package/es/dialog/index.js +0 -16
  29. package/es/divider/index.js +5 -6
  30. package/es/dropdown-item/index.js +22 -35
  31. package/es/dropdown-menu/index.js +4 -9
  32. package/es/empty/index.js +3 -11
  33. package/es/field/index.js +20 -83
  34. package/es/fold-dialog/index.js +5 -20
  35. package/es/form/index.js +2 -18
  36. package/es/grid/index.js +2 -6
  37. package/es/grid-item/index.js +17 -30
  38. package/es/hierarchy-select/breadcrumb.js +2 -6
  39. package/es/hierarchy-select/index.js +3 -12
  40. package/es/hierarchy-select/markList.js +2 -25
  41. package/es/hierarchy-select/svg/SubIcon.js +0 -1
  42. package/es/icon/index.js +9 -13
  43. package/es/image/index.js +2 -17
  44. package/es/image-preview/ImagePreview.js +4 -8
  45. package/es/image-preview/ImagePreviewItem.js +14 -30
  46. package/es/image-preview/index.js +0 -12
  47. package/es/image-preview/shared.js +2 -4
  48. package/es/index-anchor/index.js +2 -6
  49. package/es/index-bar/IndexIndicate.js +0 -1
  50. package/es/index-bar/index.js +7 -28
  51. package/es/index.js +1 -4
  52. package/es/info/index.js +6 -8
  53. package/es/list/index.js +11 -27
  54. package/es/loading/index.js +7 -15
  55. package/es/locale/index.js +0 -2
  56. package/es/media-picker/index.js +33 -117
  57. package/es/media-picker/media-util.js +2 -5
  58. package/es/media-picker/type.js +0 -5
  59. package/es/media-player/index.js +7 -17
  60. package/es/mixins/bind-event.js +0 -3
  61. package/es/mixins/checkbox.js +5 -11
  62. package/es/mixins/click-outside.js +0 -2
  63. package/es/mixins/close-on-popstate.js +0 -1
  64. package/es/mixins/field.js +0 -2
  65. package/es/mixins/popup/index.js +12 -28
  66. package/es/mixins/popup/overlay.js +1 -11
  67. package/es/mixins/portal.js +2 -8
  68. package/es/mixins/relation.js +0 -8
  69. package/es/mixins/slots.js +1 -4
  70. package/es/mixins/touch.js +4 -9
  71. package/es/multiple-picker/MultiplePickerOptions.js +2 -18
  72. package/es/multiple-picker/index.js +5 -17
  73. package/es/nav-bar/index.js +4 -12
  74. package/es/notice-bar/index.js +10 -28
  75. package/es/number-keyboard/Key.js +2 -10
  76. package/es/number-keyboard/index.js +4 -19
  77. package/es/overlay/index.js +5 -8
  78. package/es/password-input/index.js +10 -16
  79. package/es/picker/PickerColumn.js +20 -54
  80. package/es/picker/index.js +13 -42
  81. package/es/popover/index.js +11 -20
  82. package/es/popup/index.js +5 -21
  83. package/es/pull-refresh/index.js +15 -32
  84. package/es/radio/index.js +2 -4
  85. package/es/radio-group/index.js +2 -4
  86. package/es/rate/index.js +12 -26
  87. package/es/row/index.js +3 -9
  88. package/es/search/index.js +8 -13
  89. package/es/signature/bezier.js +5 -12
  90. package/es/signature/force-landscape.js +0 -5
  91. package/es/signature/index.js +5 -24
  92. package/es/signature/point.js +1 -6
  93. package/es/signature/throttle.js +1 -10
  94. package/es/skeleton/index.js +5 -15
  95. package/es/slider/index.js +19 -55
  96. package/es/step/index.js +5 -12
  97. package/es/stepper/index.js +10 -37
  98. package/es/steps/index.js +2 -4
  99. package/es/sticky/index.js +8 -50
  100. package/es/swipe/index.js +19 -62
  101. package/es/swipe-cell/index.js +7 -23
  102. package/es/swipe-item/index.js +9 -19
  103. package/es/switch/index.js +8 -10
  104. package/es/switch/shared.js +1 -0
  105. package/es/switch-cell/index.js +7 -7
  106. package/es/tab/index.js +4 -15
  107. package/es/tabbar/index.js +4 -14
  108. package/es/tabbar-item/index.js +7 -15
  109. package/es/table/index.js +10 -35
  110. package/es/tabs/Content.js +5 -9
  111. package/es/tabs/Title.js +11 -19
  112. package/es/tabs/index.js +16 -51
  113. package/es/tabs/utils.js +0 -8
  114. package/es/tag/index.js +13 -17
  115. package/es/timeline/index.js +2 -25
  116. package/es/toast/Toast.js +11 -23
  117. package/es/toast/index.js +6 -33
  118. package/es/toast/lock-click.js +0 -2
  119. package/es/uploader/index.js +11 -62
  120. package/es/uploader/utils.js +0 -10
  121. package/es/utils/constant.js +2 -1
  122. package/es/utils/create/bem.js +1 -5
  123. package/es/utils/create/component.js +4 -7
  124. package/es/utils/create/i18n.js +0 -2
  125. package/es/utils/deep-assign.js +0 -4
  126. package/es/utils/deep-clone.js +0 -3
  127. package/es/utils/dom/event.js +2 -5
  128. package/es/utils/dom/node.js +0 -1
  129. package/es/utils/dom/raf.js +7 -6
  130. package/es/utils/dom/reset-scroll.js +2 -1
  131. package/es/utils/dom/scroll.js +8 -17
  132. package/es/utils/dom/style.js +3 -2
  133. package/es/utils/easings.js +2 -4
  134. package/es/utils/format/date-util.js +54 -122
  135. package/es/utils/format/number.js +2 -11
  136. package/es/utils/format/string.js +0 -3
  137. package/es/utils/format/unit.js +2 -12
  138. package/es/utils/functional.js +6 -9
  139. package/es/utils/getScroll.js +0 -5
  140. package/es/utils/index.js +3 -5
  141. package/es/utils/interceptor.js +2 -4
  142. package/es/utils/media/image-util.js +7 -19
  143. package/es/utils/raf.js +4 -12
  144. package/es/utils/router.js +7 -6
  145. package/es/utils/scrollTo.js +7 -12
  146. package/es/utils/validate/number.js +2 -2
  147. package/es/utils/vnodes.js +2 -8
  148. package/lib/action-sheet/index.js +11 -35
  149. package/lib/area/index.js +5 -45
  150. package/lib/avatar/index.js +3 -18
  151. package/lib/back-top/index.js +4 -25
  152. package/lib/badge/index.js +4 -15
  153. package/lib/button/index.js +19 -50
  154. package/lib/calendar/components/Header.js +3 -18
  155. package/lib/calendar/components/Month.js +12 -71
  156. package/lib/calendar/index.js +21 -106
  157. package/lib/calendar/types.js +0 -7
  158. package/lib/calendar/utils.js +5 -32
  159. package/lib/cascader/index.js +4 -46
  160. package/lib/cell/index.js +18 -48
  161. package/lib/cell-group/index.js +5 -15
  162. package/lib/checkbox/index.js +4 -14
  163. package/lib/checkbox-group/index.js +4 -13
  164. package/lib/col/index.js +6 -14
  165. package/lib/collapse/index.js +2 -8
  166. package/lib/collapse-item/index.js +18 -43
  167. package/lib/count-down/index.js +2 -19
  168. package/lib/count-down/utils.js +3 -15
  169. package/lib/datetime-picker/DatePicker.js +12 -81
  170. package/lib/datetime-picker/TimePicker.js +10 -30
  171. package/lib/datetime-picker/index.js +2 -10
  172. package/lib/datetime-picker/shared.js +5 -27
  173. package/lib/datetime-picker/utils.js +0 -9
  174. package/lib/dialog/Dialog.js +6 -28
  175. package/lib/dialog/index.js +0 -22
  176. package/lib/divider/index.js +5 -12
  177. package/lib/dropdown-item/index.js +21 -44
  178. package/lib/dropdown-menu/index.js +4 -15
  179. package/lib/empty/index.js +3 -23
  180. package/lib/field/index.js +20 -96
  181. package/lib/fold-dialog/index.js +5 -22
  182. package/lib/form/index.js +2 -21
  183. package/lib/grid/index.js +2 -10
  184. package/lib/grid-item/index.js +16 -37
  185. package/lib/hierarchy-select/breadcrumb.js +3 -10
  186. package/lib/hierarchy-select/index.js +4 -20
  187. package/lib/hierarchy-select/markList.js +3 -31
  188. package/lib/hierarchy-select/svg/SubIcon.js +0 -1
  189. package/lib/icon/index.js +8 -19
  190. package/lib/image/index.js +2 -22
  191. package/lib/image-preview/ImagePreview.js +0 -16
  192. package/lib/image-preview/ImagePreviewItem.js +13 -36
  193. package/lib/image-preview/index.js +0 -16
  194. package/lib/image-preview/shared.js +2 -5
  195. package/lib/index-anchor/index.js +2 -11
  196. package/lib/index-bar/IndexIndicate.js +0 -1
  197. package/lib/index-bar/index.js +7 -37
  198. package/lib/index.js +1 -157
  199. package/lib/info/index.js +6 -14
  200. package/lib/lazyload/index.js +0 -3
  201. package/lib/list/index.js +10 -33
  202. package/lib/loading/index.js +7 -21
  203. package/lib/locale/index.js +0 -7
  204. package/lib/media-picker/index.js +27 -153
  205. package/lib/media-picker/media-util.js +2 -15
  206. package/lib/media-picker/type.js +0 -5
  207. package/lib/media-player/index.js +6 -22
  208. package/lib/mixins/bind-event.js +1 -6
  209. package/lib/mixins/checkbox.js +6 -18
  210. package/lib/mixins/click-outside.js +1 -5
  211. package/lib/mixins/close-on-popstate.js +0 -4
  212. package/lib/mixins/field.js +0 -2
  213. package/lib/mixins/popup/index.js +11 -36
  214. package/lib/mixins/popup/overlay.js +1 -23
  215. package/lib/mixins/portal.js +2 -9
  216. package/lib/mixins/relation.js +0 -11
  217. package/lib/mixins/slots.js +1 -5
  218. package/lib/mixins/touch.js +4 -11
  219. package/lib/multiple-picker/MultiplePickerOptions.js +2 -23
  220. package/lib/multiple-picker/index.js +5 -26
  221. package/lib/nav-bar/index.js +4 -16
  222. package/lib/notice-bar/index.js +10 -40
  223. package/lib/number-keyboard/Key.js +2 -17
  224. package/lib/number-keyboard/index.js +4 -26
  225. package/lib/overlay/index.js +5 -16
  226. package/lib/password-input/index.js +10 -23
  227. package/lib/picker/PickerColumn.js +19 -63
  228. package/lib/picker/index.js +13 -53
  229. package/lib/popover/index.js +9 -27
  230. package/lib/popup/index.js +5 -27
  231. package/lib/pull-refresh/index.js +14 -38
  232. package/lib/radio/index.js +2 -7
  233. package/lib/radio-group/index.js +2 -8
  234. package/lib/rate/index.js +11 -31
  235. package/lib/row/index.js +3 -12
  236. package/lib/search/index.js +7 -21
  237. package/lib/signature/bezier.js +5 -15
  238. package/lib/signature/force-landscape.js +0 -11
  239. package/lib/signature/index.js +6 -31
  240. package/lib/signature/point.js +0 -8
  241. package/lib/signature/throttle.js +1 -11
  242. package/lib/skeleton/index.js +5 -21
  243. package/lib/slider/index.js +19 -63
  244. package/lib/step/index.js +5 -18
  245. package/lib/stepper/index.js +10 -46
  246. package/lib/steps/index.js +2 -7
  247. package/lib/sticky/index.js +8 -59
  248. package/lib/swipe/index.js +19 -70
  249. package/lib/swipe-cell/index.js +7 -29
  250. package/lib/swipe-item/index.js +9 -24
  251. package/lib/switch/index.js +7 -14
  252. package/lib/switch/shared.js +1 -1
  253. package/lib/switch-cell/index.js +6 -16
  254. package/lib/tab/index.js +4 -21
  255. package/lib/tabbar/index.js +4 -19
  256. package/lib/tabbar-item/index.js +5 -21
  257. package/lib/table/index.js +10 -38
  258. package/lib/tabs/Content.js +5 -15
  259. package/lib/tabs/Title.js +11 -23
  260. package/lib/tabs/index.js +15 -65
  261. package/lib/tabs/utils.js +0 -13
  262. package/lib/tag/index.js +12 -23
  263. package/lib/timeline/index.js +2 -32
  264. package/lib/toast/Toast.js +10 -30
  265. package/lib/toast/index.js +6 -38
  266. package/lib/toast/lock-click.js +0 -3
  267. package/lib/uploader/index.js +10 -72
  268. package/lib/uploader/utils.js +0 -17
  269. package/lib/utils/constant.js +2 -1
  270. package/lib/utils/create/bem.js +1 -6
  271. package/lib/utils/create/component.js +5 -14
  272. package/lib/utils/create/i18n.js +0 -8
  273. package/lib/utils/create/index.js +0 -4
  274. package/lib/utils/deep-assign.js +0 -6
  275. package/lib/utils/deep-clone.js +0 -5
  276. package/lib/utils/device.js +0 -2
  277. package/lib/utils/dom/event.js +2 -10
  278. package/lib/utils/dom/node.js +0 -2
  279. package/lib/utils/dom/raf.js +7 -11
  280. package/lib/utils/dom/reset-scroll.js +2 -4
  281. package/lib/utils/dom/scroll.js +8 -28
  282. package/lib/utils/dom/style.js +3 -3
  283. package/lib/utils/easings.js +2 -5
  284. package/lib/utils/format/date-util.js +54 -168
  285. package/lib/utils/format/number.js +2 -13
  286. package/lib/utils/format/string.js +0 -5
  287. package/lib/utils/format/unit.js +2 -16
  288. package/lib/utils/functional.js +6 -14
  289. package/lib/utils/getScroll.js +0 -7
  290. package/lib/utils/index.js +3 -19
  291. package/lib/utils/interceptor.js +2 -6
  292. package/lib/utils/media/image-util.js +7 -25
  293. package/lib/utils/raf.js +4 -13
  294. package/lib/utils/router.js +7 -9
  295. package/lib/utils/scrollTo.js +9 -21
  296. package/lib/utils/validate/date.js +0 -2
  297. package/lib/utils/validate/email.js +0 -1
  298. package/lib/utils/validate/mobile.js +0 -1
  299. package/lib/utils/validate/number.js +2 -4
  300. package/lib/utils/validate/system.js +0 -3
  301. package/lib/utils/vnodes.js +2 -9
  302. package/lib/zart.js +57 -18
  303. package/lib/zart.min.js +1 -1
  304. package/package.json +17 -18
@@ -1,31 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.default = void 0;
7
-
8
6
  var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
9
-
10
7
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
8
  var _utils = require("../utils");
13
-
14
9
  var _date = require("../utils/validate/date");
15
-
16
10
  var _string = require("../utils/format/string");
17
-
18
11
  var _utils2 = require("./utils");
19
-
20
12
  var _shared = require("./shared");
21
-
22
13
  var _dateUtil = require("../utils/format/date-util");
23
-
24
14
  var currentYear = new Date().getFullYear();
25
-
26
15
  var _createNamespace = (0, _utils.createNamespace)('date-picker'),
27
- createComponent = _createNamespace[0];
28
-
16
+ createComponent = _createNamespace[0];
29
17
  var _default2 = createComponent({
30
18
  mixins: [_shared.TimePickerMixin],
31
19
  props: (0, _extends2.default)({}, _shared.sharedProps, {
@@ -52,7 +40,6 @@ var _default2 = createComponent({
52
40
  filter: 'updateInnerValue',
53
41
  minDate: function minDate() {
54
42
  var _this = this;
55
-
56
43
  this.$nextTick(function () {
57
44
  _this.updateInnerValue();
58
45
  });
@@ -60,14 +47,12 @@ var _default2 = createComponent({
60
47
  maxDate: function maxDate(value) {
61
48
  var value1 = "";
62
49
  var value2 = "";
63
-
64
50
  try {
65
51
  value1 = this.innerValue.valueOf();
66
52
  value2 = value.valueOf();
67
53
  } catch (error) {
68
54
  console.warn("zartui datetime-picker maxDate valueOf error", error);
69
55
  }
70
-
71
56
  if (value1 && value2 && value1 >= value2) {
72
57
  this.innerValue = value;
73
58
  } else {
@@ -76,14 +61,12 @@ var _default2 = createComponent({
76
61
  },
77
62
  value: function value(val) {
78
63
  val = this.formatValue(val);
79
-
80
64
  try {
81
65
  if (val && val.valueOf() !== this.innerValue.valueOf()) {
82
66
  this.innerValue = val;
83
67
  }
84
68
  } catch (error) {
85
69
  console.warn("zartui datetime-picker value valueOf error", error);
86
-
87
70
  if (val && this.innerValue === null) {
88
71
  this.innerValue = val;
89
72
  }
@@ -93,19 +76,17 @@ var _default2 = createComponent({
93
76
  computed: {
94
77
  ranges: function ranges() {
95
78
  var _this$getBoundary = this.getBoundary('max', this.innerValue ? this.innerValue : this.minDate),
96
- maxYear = _this$getBoundary.maxYear,
97
- maxDate = _this$getBoundary.maxDate,
98
- maxMonth = _this$getBoundary.maxMonth,
99
- maxHour = _this$getBoundary.maxHour,
100
- maxMinute = _this$getBoundary.maxMinute;
101
-
79
+ maxYear = _this$getBoundary.maxYear,
80
+ maxDate = _this$getBoundary.maxDate,
81
+ maxMonth = _this$getBoundary.maxMonth,
82
+ maxHour = _this$getBoundary.maxHour,
83
+ maxMinute = _this$getBoundary.maxMinute;
102
84
  var _this$getBoundary2 = this.getBoundary('min', this.innerValue ? this.innerValue : this.minDate),
103
- minYear = _this$getBoundary2.minYear,
104
- minDate = _this$getBoundary2.minDate,
105
- minMonth = _this$getBoundary2.minMonth,
106
- minHour = _this$getBoundary2.minHour,
107
- minMinute = _this$getBoundary2.minMinute;
108
-
85
+ minYear = _this$getBoundary2.minYear,
86
+ minDate = _this$getBoundary2.minDate,
87
+ minMonth = _this$getBoundary2.minMonth,
88
+ minHour = _this$getBoundary2.minHour,
89
+ minMinute = _this$getBoundary2.minMinute;
109
90
  var result = [{
110
91
  type: 'year',
111
92
  range: [minYear, maxYear]
@@ -122,25 +103,20 @@ var _default2 = createComponent({
122
103
  type: 'minute',
123
104
  range: [minMinute, maxMinute]
124
105
  }];
125
-
126
106
  switch (this.type) {
127
107
  case 'date':
128
108
  result = result.slice(0, 3);
129
109
  break;
130
-
131
110
  case 'year-month':
132
111
  result = result.slice(0, 2);
133
112
  break;
134
-
135
113
  case 'month-day':
136
114
  result = result.slice(1, 3);
137
115
  break;
138
-
139
116
  case 'datehour':
140
117
  result = result.slice(0, 4);
141
118
  break;
142
119
  }
143
-
144
120
  if (this.columnsOrder) {
145
121
  var columnsOrder = this.columnsOrder.concat(result.map(function (column) {
146
122
  return column.type;
@@ -149,14 +125,12 @@ var _default2 = createComponent({
149
125
  return columnsOrder.indexOf(a.type) - columnsOrder.indexOf(b.type);
150
126
  });
151
127
  }
152
-
153
128
  return result;
154
129
  }
155
130
  },
156
131
  methods: {
157
132
  formatValue: function formatValue(value) {
158
133
  var _this2 = this;
159
-
160
134
  if (typeof value === "string") {
161
135
  try {
162
136
  value = value.replace(/-/g, "/");
@@ -165,11 +139,9 @@ var _default2 = createComponent({
165
139
  console.error("datetime-picker strToDate error", error);
166
140
  }
167
141
  }
168
-
169
142
  if (!(0, _date.isDate)(value)) {
170
143
  return null;
171
144
  }
172
-
173
145
  var minDate = new Date(this.minDate);
174
146
  var maxDate = new Date(this.maxDate);
175
147
  var dateMethods = {
@@ -179,11 +151,10 @@ var _default2 = createComponent({
179
151
  hour: 'getHours',
180
152
  minute: 'getMinutes'
181
153
  };
182
-
183
154
  if (this.originColumns) {
184
155
  var dateColumns = this.originColumns.map(function (_ref, index) {
185
156
  var type = _ref.type,
186
- values = _ref.values;
157
+ values = _ref.values;
187
158
  var range = _this2.ranges[index].range;
188
159
  var minDateVal = minDate[dateMethods[type]]();
189
160
  var maxDateVal = maxDate[dateMethods[type]]();
@@ -194,7 +165,6 @@ var _default2 = createComponent({
194
165
  values: [minDateVal < range[0] ? Math.max(minDateVal, min) : min || minDateVal, maxDateVal > range[1] ? Math.min(maxDateVal, max) : max || maxDateVal]
195
166
  };
196
167
  });
197
-
198
168
  if (this.type === 'month-day') {
199
169
  var year = (this.innerValue || this.minDate).getFullYear();
200
170
  dateColumns.unshift({
@@ -202,10 +172,8 @@ var _default2 = createComponent({
202
172
  values: [year, year]
203
173
  });
204
174
  }
205
-
206
175
  var dates = Object.keys(dateMethods).map(function (type) {
207
176
  var _dateColumns$filter$;
208
-
209
177
  return (_dateColumns$filter$ = dateColumns.filter(function (item) {
210
178
  return item.type === type;
211
179
  })[0]) == null ? void 0 : _dateColumns$filter$.values;
@@ -219,73 +187,58 @@ var _default2 = createComponent({
219
187
  return (0, _utils2.getTrueValue)(val[1]);
220
188
  }));
221
189
  }
222
-
223
190
  value = Math.max(value, minDate.getTime());
224
191
  value = Math.min(value, maxDate.getTime());
225
192
  return new Date(value);
226
193
  },
227
194
  getBoundary: function getBoundary(type, value) {
228
195
  var _ref2;
229
-
230
196
  var boundary = this[type + "Date"];
231
197
  var year = boundary.getFullYear();
232
198
  var month = 1;
233
199
  var date = 1;
234
200
  var hour = 0;
235
201
  var minute = 0;
236
-
237
202
  if (type === 'max') {
238
203
  month = 12;
239
204
  date = (0, _utils2.getMonthEndDay)(value.getFullYear(), value.getMonth() + 1);
240
205
  hour = 23;
241
206
  minute = 59;
242
207
  }
243
-
244
208
  if (value.getFullYear() === year) {
245
209
  month = boundary.getMonth() + 1;
246
-
247
210
  if (value.getMonth() + 1 === month) {
248
211
  date = boundary.getDate();
249
-
250
212
  if (value.getDate() === date) {
251
213
  hour = boundary.getHours();
252
-
253
214
  if (value.getHours() === hour) {
254
215
  minute = boundary.getMinutes();
255
216
  }
256
217
  }
257
218
  }
258
219
  }
259
-
260
220
  return _ref2 = {}, _ref2[type + "Year"] = year, _ref2[type + "Month"] = month, _ref2[type + "Date"] = date, _ref2[type + "Hour"] = hour, _ref2[type + "Minute"] = minute, _ref2;
261
221
  },
262
222
  updateInnerValue: function updateInnerValue() {
263
223
  var _this3 = this;
264
-
265
224
  var type = this.type;
266
225
  var indexes = this.getPicker().getIndexes();
267
-
268
226
  if (!indexes || indexes.length === 0) {
269
227
  return;
270
228
  }
271
-
272
229
  var getValue = function getValue(type) {
273
230
  var index = 0;
274
-
275
231
  _this3.originColumns.forEach(function (column, columnIndex) {
276
232
  if (type === column.type) {
277
233
  index = columnIndex;
278
234
  }
279
235
  });
280
-
281
236
  var values = _this3.originColumns[index].values;
282
237
  return (0, _utils2.getTrueValue)(values[indexes[index]]);
283
238
  };
284
-
285
239
  var year;
286
240
  var month;
287
241
  var day;
288
-
289
242
  if (type === 'month-day') {
290
243
  year = (this.innerValue || this.minDate).getFullYear();
291
244
  month = getValue('month');
@@ -295,110 +248,89 @@ var _default2 = createComponent({
295
248
  month = getValue('month');
296
249
  day = type === 'year-month' ? 1 : getValue('day');
297
250
  }
298
-
299
251
  var maxDay = (0, _utils2.getMonthEndDay)(year, month);
300
252
  day = day > maxDay ? maxDay : day;
301
253
  var hour = 0;
302
254
  var minute = 0;
303
-
304
255
  if (type === 'datehour') {
305
256
  hour = getValue('hour');
306
257
  }
307
-
308
258
  if (type === 'datetime') {
309
259
  hour = getValue('hour');
310
260
  minute = getValue('minute');
311
261
  }
312
-
313
262
  var value = new Date(year, month - 1, day, hour, minute);
314
263
  this.innerValue = this.formatValue(value);
315
264
  },
316
265
  onChange: function onChange(picker) {
317
266
  var _this4 = this;
318
-
319
267
  this.updateInnerValue();
320
268
  this.$nextTick(function () {
321
269
  _this4.$nextTick(function () {
322
270
  // https://github.com/vant-ui/vant/issues/9775
323
271
  _this4.updateInnerValue();
324
-
325
272
  _this4.$emit('change', picker);
326
273
  });
327
274
  });
328
275
  },
329
276
  updateColumnValue: function updateColumnValue() {
330
277
  var _this5 = this;
331
-
332
278
  // 根据type将默认时间和最大最小时间转换后再比较
333
279
  // 如果调用者传入new Date(),与此处new Date()会有时间差,目前只支持到分钟,可以忽略时间差
334
280
  var now = new Date();
335
281
  var dStr = "";
336
282
  var minStr = "";
337
283
  var maxStr = "";
338
-
339
284
  switch (this.type) {
340
285
  case "date":
341
286
  dStr = (0, _dateUtil.formatDateByDate)(now, _dateUtil.FORMAT.FORMAT_YMD);
342
287
  minStr = (0, _dateUtil.formatDateByDate)(this.minDate, _dateUtil.FORMAT.FORMAT_YMD);
343
288
  maxStr = (0, _dateUtil.formatDateByDate)(this.maxDate, _dateUtil.FORMAT.FORMAT_YMD);
344
289
  break;
345
-
346
290
  case "year-month":
347
291
  dStr = (0, _dateUtil.formatDateByDate)(now, _dateUtil.FORMAT.FORMAT_YM);
348
292
  minStr = (0, _dateUtil.formatDateByDate)(this.minDate, _dateUtil.FORMAT.FORMAT_YM);
349
293
  maxStr = (0, _dateUtil.formatDateByDate)(this.maxDate, _dateUtil.FORMAT.FORMAT_YM);
350
294
  break;
351
-
352
295
  case "month-day":
353
296
  dStr = (0, _dateUtil.formatDateByDate)(now, _dateUtil.FORMAT.FORMAT_MD);
354
297
  minStr = (0, _dateUtil.formatDateByDate)(this.minDate, _dateUtil.FORMAT.FORMAT_MD);
355
298
  maxStr = (0, _dateUtil.formatDateByDate)(this.maxDate, _dateUtil.FORMAT.FORMAT_MD);
356
299
  break;
357
-
358
300
  case "datetime":
359
301
  dStr = (0, _dateUtil.formatDateByDate)(now, _dateUtil.FORMAT.FORMAT_YMDHM);
360
302
  minStr = (0, _dateUtil.formatDateByDate)(this.minDate, _dateUtil.FORMAT.FORMAT_YMDHM);
361
303
  maxStr = (0, _dateUtil.formatDateByDate)(this.maxDate, _dateUtil.FORMAT.FORMAT_YMDHM);
362
304
  break;
363
-
364
305
  case "datehour":
365
306
  // "2022/11/11 14"这种格式无法使用new Date
366
307
  dStr = (0, _dateUtil.formatDateByDate)(now, _dateUtil.FORMAT.FORMAT_YMDH) + ":00:00";
367
308
  minStr = (0, _dateUtil.formatDateByDate)(this.minDate, _dateUtil.FORMAT.FORMAT_YMDH) + ":00:00";
368
309
  maxStr = (0, _dateUtil.formatDateByDate)(this.maxDate, _dateUtil.FORMAT.FORMAT_YMDH) + ":00:00";
369
310
  break;
370
-
371
311
  default:
372
312
  break;
373
313
  }
374
-
375
314
  var defaultValue = new Date(dStr.replace(/-/g, "/"));
376
315
  var minDate = new Date(minStr.replace(/-/g, "/"));
377
316
  var maxDate = new Date(maxStr.replace(/-/g, "/"));
378
-
379
317
  if (defaultValue < minDate || defaultValue > maxDate) {
380
318
  defaultValue = this.minDate;
381
319
  }
382
-
383
320
  var value = this.innerValue ? this.innerValue : defaultValue;
384
321
  var formatter = this.formatter;
385
322
  var values = this.originColumns.map(function (column) {
386
323
  switch (column.type) {
387
324
  case 'year':
388
325
  return formatter('year', "" + value.getFullYear());
389
-
390
326
  case 'month':
391
327
  return formatter('month', (0, _string.padZero)(value.getMonth() + 1));
392
-
393
328
  case 'day':
394
329
  return formatter('day', (0, _string.padZero)(value.getDate()));
395
-
396
330
  case 'hour':
397
331
  return formatter('hour', (0, _string.padZero)(value.getHours()));
398
-
399
332
  case 'minute':
400
333
  return formatter('minute', (0, _string.padZero)(value.getMinutes()));
401
-
402
334
  default:
403
335
  // no default
404
336
  return null;
@@ -410,5 +342,4 @@ var _default2 = createComponent({
410
342
  }
411
343
  }
412
344
  });
413
-
414
345
  exports.default = _default2;
@@ -1,23 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.default = void 0;
7
-
8
6
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
-
10
7
  var _utils = require("../utils");
11
-
12
8
  var _string = require("../utils/format/string");
13
-
14
9
  var _number = require("../utils/format/number");
15
-
16
10
  var _shared = require("./shared");
17
-
18
11
  var _createNamespace = (0, _utils.createNamespace)('time-picker'),
19
- createComponent = _createNamespace[0];
20
-
12
+ createComponent = _createNamespace[0];
21
13
  var _default = createComponent({
22
14
  mixins: [_shared.TimePickerMixin],
23
15
  props: (0, _extends2.default)({}, _shared.sharedProps, {
@@ -57,16 +49,14 @@ var _default = createComponent({
57
49
  filter: 'updateInnerValue',
58
50
  minHour: function minHour() {
59
51
  var _this = this;
60
-
61
52
  this.$nextTick(function () {
62
53
  _this.updateInnerValue();
63
54
  });
64
55
  },
65
56
  maxHour: function maxHour(value) {
66
57
  var _this$innerValue$spli = this.innerValue.split(':'),
67
- hour = _this$innerValue$spli[0],
68
- minute = _this$innerValue$spli[1];
69
-
58
+ hour = _this$innerValue$spli[0],
59
+ minute = _this$innerValue$spli[1];
70
60
  if (hour >= value) {
71
61
  this.innerValue = this.formatValue(value + ":" + minute);
72
62
  this.updateColumnValue();
@@ -77,9 +67,8 @@ var _default = createComponent({
77
67
  minMinute: 'updateInnerValue',
78
68
  maxMinute: function maxMinute(value) {
79
69
  var _this$innerValue$spli2 = this.innerValue.split(':'),
80
- hour = _this$innerValue$spli2[0],
81
- minute = _this$innerValue$spli2[1];
82
-
70
+ hour = _this$innerValue$spli2[0],
71
+ minute = _this$innerValue$spli2[1];
83
72
  if (minute >= value) {
84
73
  this.innerValue = this.formatValue(hour + ":" + value);
85
74
  this.updateColumnValue();
@@ -89,7 +78,6 @@ var _default = createComponent({
89
78
  },
90
79
  value: function value(val) {
91
80
  val = this.formatValue(val);
92
-
93
81
  if (val !== this.innerValue) {
94
82
  this.innerValue = val;
95
83
  this.updateColumnValue();
@@ -101,27 +89,23 @@ var _default = createComponent({
101
89
  if (!value) {
102
90
  value = (0, _string.padZero)(this.minHour) + ":" + (0, _string.padZero)(this.minMinute);
103
91
  }
104
-
105
92
  var _value$split = value.split(':'),
106
- hour = _value$split[0],
107
- minute = _value$split[1];
108
-
93
+ hour = _value$split[0],
94
+ minute = _value$split[1];
109
95
  hour = (0, _string.padZero)((0, _number.range)(hour, this.minHour, this.maxHour));
110
96
  minute = (0, _string.padZero)((0, _number.range)(minute, this.minMinute, this.maxMinute));
111
97
  return hour + ":" + minute;
112
98
  },
113
99
  updateInnerValue: function updateInnerValue() {
114
100
  var indexes = this.getPicker().getIndexes();
115
-
116
101
  if (!indexes || indexes.length === 0) {
117
102
  return;
118
103
  }
119
-
120
104
  var hourIndex = indexes[0],
121
- minuteIndex = indexes[1];
105
+ minuteIndex = indexes[1];
122
106
  var _this$originColumns = this.originColumns,
123
- hourColumn = _this$originColumns[0],
124
- minuteColumn = _this$originColumns[1];
107
+ hourColumn = _this$originColumns[0],
108
+ minuteColumn = _this$originColumns[1];
125
109
  var hour = hourColumn.values[hourIndex] || hourColumn.values[0];
126
110
  var minute = minuteColumn.values[minuteIndex] || minuteColumn.values[0];
127
111
  this.innerValue = this.formatValue(hour + ":" + minute);
@@ -129,20 +113,17 @@ var _default = createComponent({
129
113
  },
130
114
  onChange: function onChange(picker) {
131
115
  var _this2 = this;
132
-
133
116
  this.updateInnerValue();
134
117
  this.$nextTick(function () {
135
118
  _this2.$nextTick(function () {
136
119
  // https://github.com/vant-ui/vant/issues/9775
137
120
  _this2.updateInnerValue();
138
-
139
121
  _this2.$emit('change', picker);
140
122
  });
141
123
  });
142
124
  },
143
125
  updateColumnValue: function updateColumnValue() {
144
126
  var _this3 = this;
145
-
146
127
  var formatter = this.formatter;
147
128
  var pair = this.innerValue.split(':');
148
129
  var values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
@@ -152,5 +133,4 @@ var _default = createComponent({
152
133
  }
153
134
  }
154
135
  });
155
-
156
136
  exports.default = _default;
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.default = void 0;
7
-
8
6
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
-
10
7
  var _utils = require("../utils");
11
-
12
8
  var _TimePicker = _interopRequireDefault(require("./TimePicker"));
13
-
14
9
  var _DatePicker = _interopRequireDefault(require("./DatePicker"));
15
-
16
10
  var _createNamespace = (0, _utils.createNamespace)('datetime-picker'),
17
- createComponent = _createNamespace[0],
18
- bem = _createNamespace[1];
19
-
11
+ createComponent = _createNamespace[0],
12
+ bem = _createNamespace[1];
20
13
  var _default = createComponent({
21
14
  props: (0, _extends2.default)({}, _TimePicker.default.props, _DatePicker.default.props),
22
15
  methods: {
@@ -37,5 +30,4 @@ var _default = createComponent({
37
30
  });
38
31
  }
39
32
  });
40
-
41
33
  exports.default = _default;
@@ -1,22 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.TimePickerMixin = exports.sharedProps = void 0;
7
-
8
6
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
-
10
7
  var _utils = require("./utils");
11
-
12
8
  var _string = require("../utils/format/string");
13
-
14
9
  var _shared = require("../picker/shared");
15
-
16
10
  var _picker = _interopRequireDefault(require("../picker"));
17
-
18
11
  var _utils2 = require("../utils");
19
-
20
12
  var componentFunctions = (0, _utils2.createNamespace)('dateTimePicker');
21
13
  var t = componentFunctions[2];
22
14
  var sharedProps = (0, _extends2.default)({}, _shared.pickerProps, {
@@ -45,19 +37,16 @@ var TimePickerMixin = {
45
37
  computed: {
46
38
  originColumns: function originColumns() {
47
39
  var _this = this;
48
-
49
40
  return this.ranges.map(function (_ref) {
50
41
  var type = _ref.type,
51
- rangeArr = _ref.range;
42
+ rangeArr = _ref.range;
52
43
  var values = (0, _utils.times)(rangeArr[1] - rangeArr[0] + 1, function (index) {
53
44
  var value = (0, _string.padZero)(rangeArr[0] + index);
54
45
  return value;
55
46
  });
56
-
57
47
  if (_this.filter) {
58
48
  values = _this.filter(type, values);
59
49
  }
60
-
61
50
  return {
62
51
  type: type,
63
52
  values: values
@@ -66,7 +55,6 @@ var TimePickerMixin = {
66
55
  },
67
56
  columns: function columns() {
68
57
  var _this2 = this;
69
-
70
58
  return this.originColumns.map(function (column) {
71
59
  return {
72
60
  values: column.values.map(function (value) {
@@ -80,7 +68,6 @@ var TimePickerMixin = {
80
68
  if (this.columnsOrder) {
81
69
  return [];
82
70
  }
83
-
84
71
  var year = t('year');
85
72
  var month = t('month');
86
73
  var day = t('day');
@@ -93,8 +80,8 @@ var TimePickerMixin = {
93
80
  'time': [hour, minute],
94
81
  'datetime': [year, month, day, hour, minute],
95
82
  'datehour': [year, month, day, hour]
96
- }; // console.log('type ' + this.type + ' ' + JSON.stringify(presetHeaders[this.type]))
97
-
83
+ };
84
+ // console.log('type ' + this.type + ' ' + JSON.stringify(presetHeaders[this.type]))
98
85
  return presetHeaders[this.type] || [];
99
86
  }
100
87
  },
@@ -109,12 +96,10 @@ var TimePickerMixin = {
109
96
  },
110
97
  showPicker: function showPicker() {
111
98
  var _this3 = this;
112
-
113
99
  if (this.columnValueNotInited) {
114
100
  this.updateColumnValue();
115
101
  this.$nextTick(function () {
116
102
  _this3.updateInnerValue();
117
-
118
103
  _this3.columnValueNotInited = false;
119
104
  });
120
105
  }
@@ -122,16 +107,14 @@ var TimePickerMixin = {
122
107
  },
123
108
  mounted: function mounted() {
124
109
  var _this4 = this;
125
-
126
- var picker = this.getPicker(); // picker UI元素没有准备好,没有columns
127
-
110
+ var picker = this.getPicker();
111
+ // picker UI元素没有准备好,没有columns
128
112
  if (!picker || !picker.getColumnCount()) {
129
113
  this.columnValueNotInited = true;
130
114
  } else {
131
115
  this.updateColumnValue();
132
116
  this.$nextTick(function () {
133
117
  _this4.updateInnerValue();
134
-
135
118
  _this4.columnValueNotInited = false;
136
119
  });
137
120
  }
@@ -143,18 +126,14 @@ var TimePickerMixin = {
143
126
  // https://github.com/vant-ui/vant/issues/10013
144
127
  getProxiedPicker: function getProxiedPicker() {
145
128
  var _this5 = this;
146
-
147
129
  var picker = this.$refs.picker;
148
-
149
130
  if (picker) {
150
131
  var proxy = function proxy(fn) {
151
132
  return function () {
152
133
  picker[fn].apply(picker, arguments);
153
-
154
134
  _this5.updateInnerValue();
155
135
  };
156
136
  };
157
-
158
137
  return (0, _extends2.default)({}, picker, {
159
138
  setValues: proxy('setValues'),
160
139
  setIndexes: proxy('setIndexes'),
@@ -174,7 +153,6 @@ var TimePickerMixin = {
174
153
  },
175
154
  render: function render() {
176
155
  var _this6 = this;
177
-
178
156
  var h = arguments[0];
179
157
  var props = {};
180
158
  Object.keys(_shared.pickerProps).forEach(function (key) {
@@ -4,29 +4,22 @@ exports.__esModule = true;
4
4
  exports.times = times;
5
5
  exports.getTrueValue = getTrueValue;
6
6
  exports.getMonthEndDay = getMonthEndDay;
7
-
8
7
  var _number = require("../utils/validate/number");
9
-
10
8
  function times(n, iteratee) {
11
9
  if (n < 0) {
12
10
  return [];
13
11
  }
14
-
15
12
  var index = -1;
16
13
  var result = Array(n);
17
-
18
14
  while (++index < n) {
19
15
  result[index] = iteratee(index);
20
16
  }
21
-
22
17
  return result;
23
18
  }
24
-
25
19
  function getTrueValue(value) {
26
20
  if (!value) {
27
21
  return 0;
28
22
  }
29
-
30
23
  while ((0, _number.isNaN)(parseInt(value, 10))) {
31
24
  if (value.length > 1) {
32
25
  value = value.slice(1);
@@ -34,10 +27,8 @@ function getTrueValue(value) {
34
27
  return 0;
35
28
  }
36
29
  }
37
-
38
30
  return parseInt(value, 10);
39
31
  }
40
-
41
32
  function getMonthEndDay(year, month) {
42
33
  return 32 - new Date(year, month - 1, 32).getDate();
43
34
  }