@opentiny/vue-renderless 3.9.3 → 3.10.0

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 (197) hide show
  1. package/action-sheet/vue.js +25 -2
  2. package/anchor/index.js +3 -3
  3. package/anchor/vue.js +7 -1
  4. package/area/index.js +4 -4
  5. package/button/vue.js +4 -2
  6. package/button-group/index.js +8 -1
  7. package/button-group/vue.js +5 -10
  8. package/calendar/index.js +14 -14
  9. package/calendar-bar/index.js +3 -3
  10. package/carousel-item/index.js +1 -1
  11. package/cascader/vue.js +1 -1
  12. package/cascader-mobile/index.js +299 -0
  13. package/cascader-mobile/vue.js +102 -0
  14. package/cascader-panel/store.js +3 -1
  15. package/chart-boxplot/index.js +0 -1
  16. package/chart-core/deps/constants.js +20 -2
  17. package/chart-core/index.js +9 -1
  18. package/chart-core/modules/extend.js +14 -1
  19. package/chart-gauge/index.js +3 -1
  20. package/chart-graph/index.js +3 -1
  21. package/chart-map/index.js +11 -1
  22. package/chart-scatter/index.js +10 -2
  23. package/chart-waterfall/index.js +4 -1
  24. package/checkbox/index.js +8 -16
  25. package/checkbox/vue.js +7 -9
  26. package/column-list-item/vue.js +10 -1
  27. package/common/bigInt.js +4 -11
  28. package/common/date.js +2 -2
  29. package/common/deps/ResizeObserver.js +3 -1
  30. package/common/deps/date-util.js +9 -1
  31. package/common/deps/date.js +18 -5
  32. package/common/deps/fastdom/async.js +41 -0
  33. package/common/deps/fastdom/index.js +9 -0
  34. package/common/deps/fastdom/sandbox.js +53 -0
  35. package/common/deps/fastdom/singleton.js +80 -0
  36. package/common/deps/fullscreen/screenfull.js +16 -2
  37. package/common/deps/memorize.js +3 -3
  38. package/common/deps/popup-manager.js +0 -1
  39. package/common/deps/requestAnimationFrame.js +1 -1
  40. package/common/deps/throttle.js +2 -2
  41. package/common/deps/tree-model/node.js +23 -11
  42. package/common/deps/tree-model/tree-store.js +28 -7
  43. package/common/deps/vue-popper.js +14 -2
  44. package/common/deps/vue-popup.js +16 -23
  45. package/common/index.js +7 -35
  46. package/common/runtime.js +1 -1
  47. package/common/validate/rules/type.js +3 -1
  48. package/credit-card-form/vue.js +2 -2
  49. package/date-panel/index.js +35 -31
  50. package/date-panel/vue.js +12 -12
  51. package/date-picker/index.js +9 -5
  52. package/date-picker/vue.js +20 -8
  53. package/date-picker-mobile/index.js +3 -3
  54. package/date-range/index.js +91 -19
  55. package/date-range/vue.js +19 -11
  56. package/date-table/index.js +39 -6
  57. package/date-table/vue.js +2 -2
  58. package/dept/index.js +1 -1
  59. package/detail-page/vue.js +9 -1
  60. package/dialog-box/index.js +11 -2
  61. package/dialog-box/vue.js +30 -6
  62. package/dialog-select/index.js +27 -5
  63. package/dialog-select/vue.js +11 -4
  64. package/drop-roles/index.js +3 -1
  65. package/dropdown/index.js +28 -7
  66. package/dropdown/vue.js +12 -7
  67. package/dropdown-item/index.js +9 -1
  68. package/dropdown-item/mf.js +3 -3
  69. package/dropdown-item/vue.js +12 -10
  70. package/dropdown-menu/index.js +13 -14
  71. package/dropdown-menu/vue.js +8 -7
  72. package/espace/vue.js +9 -1
  73. package/fall-menu/vue.js +12 -1
  74. package/file-upload/index.js +137 -89
  75. package/file-upload/vue.js +24 -14
  76. package/filter/index.js +1 -1
  77. package/filter/vue.js +1 -3
  78. package/floating-button/index.js +73 -0
  79. package/floating-button/vue.js +35 -0
  80. package/form/index.js +13 -4
  81. package/form/vue.js +7 -2
  82. package/form-item/index.js +4 -1
  83. package/form-item/vue.js +6 -3
  84. package/fullscreen/vue.js +24 -3
  85. package/grid/plugins/exportExcel.js +54 -8
  86. package/grid/static/base/helperGetHGSKeys.js +1 -4
  87. package/grid/utils/common.js +15 -11
  88. package/grid/utils/dom.js +5 -1
  89. package/guide/index.js +2 -3
  90. package/hrapprover/index.js +3 -1
  91. package/index-bar/vue.js +8 -1
  92. package/input/index.js +1 -11
  93. package/input/vue.js +6 -12
  94. package/ip-address/index.js +4 -11
  95. package/ip-address/vue.js +8 -1
  96. package/link-menu/vue.js +22 -2
  97. package/locales/index.js +4 -2
  98. package/logon-user/index.js +3 -1
  99. package/logout/index.js +6 -2
  100. package/milestone/vue.js +1 -1
  101. package/mini-picker/index.js +12 -10
  102. package/mini-picker/vue.js +10 -10
  103. package/modal/index.js +5 -3
  104. package/modal/vue.js +4 -2
  105. package/month-range/index.js +18 -18
  106. package/month-range/vue.js +16 -4
  107. package/month-table/index.js +7 -3
  108. package/multi-select/vue.js +1 -9
  109. package/nav-menu/index.js +33 -4
  110. package/nav-menu/vue.js +9 -1
  111. package/notify/vue.js +12 -1
  112. package/numeric/vue.js +6 -2
  113. package/option/index.js +10 -2
  114. package/option/vue.js +20 -9
  115. package/option-group/index.js +3 -1
  116. package/package.json +2 -1
  117. package/picker/index.js +88 -17
  118. package/picker/vue.js +42 -17
  119. package/picker-column/index.js +6 -6
  120. package/picker-column/vue.js +5 -5
  121. package/popconfirm/vue.js +3 -1
  122. package/popeditor/index.js +55 -13
  123. package/popeditor/vue.js +23 -7
  124. package/popover/vue.js +1 -2
  125. package/popup/vue.js +15 -2
  126. package/progress/index.js +9 -7
  127. package/progress/vue.js +12 -4
  128. package/pull-refresh/vue.js +10 -1
  129. package/query-builder/index.js +9 -0
  130. package/query-builder/vue.js +18 -0
  131. package/radio/vue.js +3 -1
  132. package/radio-button/vue.js +1 -1
  133. package/rate/index.js +8 -2
  134. package/rate/vue.js +27 -4
  135. package/recycle-scroller/index.js +0 -1
  136. package/scrollbar/vue-bar.js +18 -2
  137. package/search/index.js +12 -5
  138. package/search/vue.js +7 -5
  139. package/select/index.js +567 -283
  140. package/select/vue.js +141 -85
  141. package/select-dropdown/vue.js +8 -6
  142. package/select-mobile/index.js +26 -13
  143. package/select-mobile/vue.js +14 -5
  144. package/select-view/index.js +5 -21
  145. package/select-view/vue.js +0 -3
  146. package/selected-box/index.js +3 -1
  147. package/slider/index.js +5 -5
  148. package/slider/vue.js +16 -0
  149. package/slider-button/index.js +41 -0
  150. package/slider-button/vue.js +36 -0
  151. package/slider-button-group/slide-button.js +142 -0
  152. package/slider-button-group/vue.js +52 -0
  153. package/steps/slide-bar.js +0 -1
  154. package/switch/index.js +1 -1
  155. package/switch/vue.js +1 -1
  156. package/tab-bar/index.js +8 -6
  157. package/tab-nav/index.js +19 -13
  158. package/tab-nav/vue.js +10 -9
  159. package/tabs/index.js +21 -17
  160. package/tabs/vue.js +1 -4
  161. package/tag/vue.js +2 -1
  162. package/tag-group/index.js +23 -10
  163. package/tag-group/vue.js +5 -4
  164. package/time/index.js +8 -8
  165. package/time/vue.js +9 -9
  166. package/time-line/index.js +24 -2
  167. package/time-line/vue.js +30 -4
  168. package/time-panel/index.js +2 -2
  169. package/time-panel/vue.js +2 -2
  170. package/time-range/index.js +24 -21
  171. package/time-range/vue.js +26 -16
  172. package/time-spinner/index.js +32 -21
  173. package/time-spinner/vue.js +37 -12
  174. package/timeline-item/index.js +77 -0
  175. package/timeline-item/vue.js +44 -0
  176. package/toggle-menu/vue.js +0 -1
  177. package/tooltip/index.js +11 -12
  178. package/tooltip/vue.js +11 -1
  179. package/top-box/vue.js +13 -1
  180. package/tree/index.js +228 -15
  181. package/tree/vue.js +119 -15
  182. package/tree-menu/index.js +35 -0
  183. package/tree-menu/vue.js +27 -5
  184. package/tree-node/index.js +75 -10
  185. package/tree-node/vue.js +45 -23
  186. package/upload/index.js +90 -49
  187. package/upload/vue.js +22 -10
  188. package/upload-dragger/index.js +4 -3
  189. package/upload-list/index.js +67 -16
  190. package/upload-list/vue.js +26 -9
  191. package/user/index.js +7 -4
  192. package/user-link/index.js +2 -1
  193. package/wizard/index.js +4 -1
  194. package/wizard/vue.js +19 -2
  195. package/year-range/index.js +1 -1
  196. package/year-range/vue.js +3 -3
  197. package/year-table/index.js +2 -2
@@ -26,18 +26,19 @@ import { on, off } from "../common/deps/dom";
26
26
  import { getDateWithNewTimezone, getLocalTimezone } from "../common/date";
27
27
  import { fillChar } from "../common/string";
28
28
  const getYearLabel = ({ state, t }) => () => {
29
- const yearTranslation = t(DATEPICKER.YearI18n);
30
- if (state.currentView === DATEPICKER.Year) {
31
- const startYear = Math.floor(state.year / 10) * 10;
29
+ const { YearI18n, Year, PanelYearNum } = DATEPICKER;
30
+ const yearTranslation = t(YearI18n);
31
+ if (state.currentView === Year) {
32
+ const startYear = state.startYear;
32
33
  if (yearTranslation) {
33
- return startYear + " " + yearTranslation + " - " + (startYear + 9) + " " + yearTranslation;
34
+ return startYear + " " + yearTranslation + " - " + (startYear + PanelYearNum - 1) + " " + yearTranslation;
34
35
  }
35
- return startYear + " - " + (startYear + 9);
36
+ return startYear + " - " + (startYear + PanelYearNum - 1);
36
37
  }
37
38
  return state.year + " " + yearTranslation;
38
39
  };
39
40
  const watchValue = ({ api, state }) => (value) => {
40
- if (state.selectionMode === DATEPICKER.Dates && state.value) {
41
+ if ([DATEPICKER.Dates, DATEPICKER.Years].includes(state.selectionMode) && state.value) {
41
42
  return;
42
43
  }
43
44
  if (isDate(value)) {
@@ -48,7 +49,7 @@ const watchValue = ({ api, state }) => (value) => {
48
49
  };
49
50
  const watchDefaultValue = ({ state }) => (value) => {
50
51
  if (!isDate(state.value)) {
51
- state.date = value ? new Date(value) : /* @__PURE__ */ new Date();
52
+ state.date = value ? new Date(value) : new Date();
52
53
  }
53
54
  };
54
55
  const watchTimePickerVisible = ({ nextTick, vm }) => (value) => {
@@ -65,32 +66,32 @@ const watchSelectionMode = ({ state }) => (value) => {
65
66
  }
66
67
  } else if (value === DATEPICKER.Dates) {
67
68
  state.currentView = DATEPICKER.Date;
68
- } else if (value === DATEPICKER.Year) {
69
+ } else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(value)) {
69
70
  state.currentView = DATEPICKER.Year;
70
71
  }
71
72
  };
72
- const proxyTimePickerDataProperties = ({ refs, state, watch }) => () => {
73
+ const proxyTimePickerDataProperties = ({ vm, state, watch }) => () => {
73
74
  const format = (timeFormat) => {
74
- if (refs.timepicker) {
75
- refs.timepicker.state.format = timeFormat;
75
+ if (vm.$refs.timepicker) {
76
+ vm.$refs.timepicker.state.format = timeFormat;
76
77
  }
77
78
  };
78
79
  const value = (value2) => {
79
- if (refs.timepicker) {
80
- refs.timepicker.state.value = null;
80
+ if (vm.$refs.timepicker) {
81
+ vm.$refs.timepicker.state.value = null;
81
82
  if (value2) {
82
- refs.timepicker.state.value = value2;
83
+ vm.$refs.timepicker.state.value = value2;
83
84
  }
84
85
  }
85
86
  };
86
87
  const date = (date2) => {
87
- if (refs.timepicker) {
88
- refs.timepicker.state.date = date2;
88
+ if (vm.$refs.timepicker) {
89
+ vm.$refs.timepicker.state.date = date2;
89
90
  }
90
91
  };
91
92
  const selectableRange = (selectableRange2) => {
92
- if (refs.timepicker) {
93
- refs.timepicker.state.selectableRange = selectableRange2;
93
+ if (vm.$refs.timepicker) {
94
+ vm.$refs.timepicker.state.selectableRange = selectableRange2;
94
95
  }
95
96
  };
96
97
  watch(() => state.value, value);
@@ -123,14 +124,14 @@ const cusPrevMonth = ({ state }) => () => state.date = prevMonth(state.date);
123
124
  const cusNextMonth = ({ state }) => () => state.date = nextMonth(state.date);
124
125
  const cusPrevYear = ({ state }) => () => {
125
126
  if (state.currentView === DATEPICKER.Year) {
126
- state.date = prevYear(state.date, 10);
127
+ state.startYear = state.startYear - DATEPICKER.PanelYearNum;
127
128
  } else {
128
129
  state.date = prevYear(state.date);
129
130
  }
130
131
  };
131
132
  const cusNextYear = ({ state }) => () => {
132
133
  if (state.currentView === DATEPICKER.Year) {
133
- state.date = nextYear(state.date, 10);
134
+ state.startYear = state.startYear + DATEPICKER.PanelYearNum;
134
135
  } else {
135
136
  state.date = nextYear(state.date);
136
137
  }
@@ -186,12 +187,15 @@ const handleDatePick = ({ api, state, t }) => (value) => {
186
187
  api.cusEmit(value, true);
187
188
  }
188
189
  };
189
- const handleYearPick = ({ api, state }) => (year) => {
190
+ const handleYearPick = ({ api, state }) => (value) => {
190
191
  if (state.selectionMode === DATEPICKER.Year) {
191
- state.date = modifyDate(state.date, year, 0, 1);
192
+ state.date = modifyDate(state.date, value, 0, 2);
192
193
  api.cusEmit(state.date);
194
+ } else if ([DATEPICKER.Years].includes(state.selectionMode)) {
195
+ state.date = value.map((year) => new Date(year, 0, 2));
196
+ api.cusEmit(state.date, state.selectionMode === DATEPICKER.YearRange ? value.length < 2 : true);
193
197
  } else {
194
- state.date = changeYearMonthAndClampDate(state.date, year, state.month);
198
+ state.date = changeYearMonthAndClampDate(state.date, value, state.month);
195
199
  state.currentView = DATEPICKER.Month;
196
200
  }
197
201
  };
@@ -202,7 +206,7 @@ const dateToLocaleStringForIE = (timezone, value) => {
202
206
  return new Date(offsetTime);
203
207
  };
204
208
  const changeToNow = ({ api, state }) => () => {
205
- const now = /* @__PURE__ */ new Date();
209
+ const now = new Date();
206
210
  const timezone = state.timezone;
207
211
  const isServiceTimezone = timezone.isServiceTimezone;
208
212
  let disabledDate = !state.disabledDate;
@@ -216,7 +220,7 @@ const changeToNow = ({ api, state }) => () => {
216
220
  if (disabledDate && api.checkDateWithinRange(now)) {
217
221
  if (!isServiceTimezone) {
218
222
  if (state.showTimezone && state.selectedTz) {
219
- state.date = dateToLocaleStringForIE(state.selectedTz.offset, state.date);
223
+ state.date = dateToLocaleStringForIE(state.selectedTz.offset, now);
220
224
  } else {
221
225
  state.date = now;
222
226
  }
@@ -226,7 +230,7 @@ const changeToNow = ({ api, state }) => () => {
226
230
  }
227
231
  };
228
232
  const confirm = ({ api, state, t }) => () => {
229
- if (state.selectionMode === DATEPICKER.Dates) {
233
+ if ([DATEPICKER.Dates, DATEPICKER.Years].includes(state.selectionMode)) {
230
234
  api.cusEmit(state.value);
231
235
  } else {
232
236
  let value = state.value ? state.value : modifyWithTimeString(api.getDefaultValue(), state.defaultTime, t);
@@ -242,7 +246,7 @@ const confirm = ({ api, state, t }) => () => {
242
246
  const resetView = ({ state }) => () => {
243
247
  if (state.selectionMode === DATEPICKER.Month) {
244
248
  state.currentView = DATEPICKER.Month;
245
- } else if (state.selectionMode === DATEPICKER.Year) {
249
+ } else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(state.selectionMode)) {
246
250
  state.currentView = DATEPICKER.Year;
247
251
  } else {
248
252
  state.currentView = DATEPICKER.Date;
@@ -297,13 +301,13 @@ const handleKeyControl = ({ state, emit }) => (keyCode) => {
297
301
  }
298
302
  }
299
303
  };
300
- const handleVisibleTimeChange = ({ api, refs, state, t }) => (value) => {
304
+ const handleVisibleTimeChange = ({ api, vm, state, t }) => (value) => {
301
305
  const time = parseDate(value, state.timeFormat, t);
302
306
  if (time && api.checkDateWithinRange(time)) {
303
307
  state.date = modifyDate(time, state.year, state.month, state.monthDate);
304
308
  state.userInputTime = null;
305
- if (refs.timepicker) {
306
- refs.timepicker.state.value = state.date;
309
+ if (vm.$refs.timepicker) {
310
+ vm.$refs.timepicker.state.value = state.date;
307
311
  }
308
312
  state.timePickerVisible = false;
309
313
  api.cusEmit(state.date, true);
@@ -322,7 +326,7 @@ const handleVisibleDateChange = ({ api, state, t }) => (value) => {
322
326
  }
323
327
  };
324
328
  const isValidValue = ({ api, state }) => (value) => value && !isNaN(value) && (typeof state.disabledDate === "function" ? !state.disabledDate(value) : true) && api.checkDateWithinRange(value);
325
- const getDefaultValue = (state) => () => state.defaultValue ? new Date(state.defaultValue) : /* @__PURE__ */ new Date();
329
+ const getDefaultValue = (state) => () => state.defaultValue ? new Date(state.defaultValue) : new Date();
326
330
  const checkDateWithinRange = ({ state }) => (date) => state.selectableRange.length > 0 ? timeWithinRange(date, state.selectableRange, state.format || "HH:mm:ss") : true;
327
331
  const selectTz = ({ emit, state }) => (tz) => {
328
332
  if (state.timezone.isServiceTimezone) {
package/date-panel/vue.js CHANGED
@@ -75,7 +75,7 @@ const api = [
75
75
  const initState = ({ reactive, computed, api: api2, i18n }) => {
76
76
  const state = reactive({
77
77
  popperClass: "",
78
- date: /* @__PURE__ */ new Date(),
78
+ date: new Date(),
79
79
  value: "",
80
80
  defaultValue: null,
81
81
  defaultTime: null,
@@ -101,12 +101,12 @@ const initState = ({ reactive, computed, api: api2, i18n }) => {
101
101
  tz: "",
102
102
  selectedTz: null,
103
103
  animationName: "",
104
- startYear: Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 10) * 10,
105
- year: computed(() => state.date.getFullYear()),
106
- month: computed(() => state.date.getMonth()),
104
+ startYear: Math.floor(new Date().getFullYear() / 10) * 10,
105
+ year: computed(() => !Array.isArray(state.date) && state.date.getFullYear()),
106
+ month: computed(() => !Array.isArray(state.date) && state.date.getMonth()),
107
107
  week: computed(() => getWeekNumber(state.date)),
108
108
  monthDate: computed(() => state.date.getDate()),
109
- footerVisible: computed(() => state.showTime || state.selectionMode === DATEPICKER.Dates),
109
+ footerVisible: computed(() => state.showTime || [DATEPICKER.Dates, DATEPICKER.Years].includes(state.selectionMode)),
110
110
  visibleTime: computed(() => api2.computerVisibleTime()),
111
111
  visibleDate: computed(() => api2.computerVisibleDate()),
112
112
  yearLabel: computed(() => api2.getYearLabel()),
@@ -114,7 +114,7 @@ const initState = ({ reactive, computed, api: api2, i18n }) => {
114
114
  dateFormat: computed(() => state.format ? extractDateFormat(state.format.replace(state.timefmt, "")) : DATE.Date),
115
115
  lang: computed(() => i18n ? i18n.locale.replace(/_/g, "-") : "zh-CN"),
116
116
  isShowTz: computed(() => state.showTimezone && state.showTime),
117
- isShowFooter: computed(() => state.footerVisible && state.currentView === "date")
117
+ isShowFooter: computed(() => state.footerVisible && [DATEPICKER.Date, DATEPICKER.Year].includes(state.currentView))
118
118
  });
119
119
  state.needChangeTimezoneData = true;
120
120
  return state;
@@ -146,7 +146,7 @@ const initWatch = ({ watch, state, api: api2, nextTick }) => {
146
146
  );
147
147
  watch(() => state.visible, api2.watchVisible);
148
148
  };
149
- const initApi = ({ api: api2, state, t, emit, nextTick, vm, refs, watch }) => {
149
+ const initApi = ({ api: api2, state, t, emit, nextTick, vm, watch }) => {
150
150
  Object.assign(api2, {
151
151
  t,
152
152
  state,
@@ -171,7 +171,7 @@ const initApi = ({ api: api2, state, t, emit, nextTick, vm, refs, watch }) => {
171
171
  watchTimePickerVisible: watchTimePickerVisible({ nextTick, vm }),
172
172
  checkDateWithinRange: checkDateWithinRange({ state }),
173
173
  watchSelectionMode: watchSelectionMode({ state }),
174
- proxyTimePickerDataProperties: proxyTimePickerDataProperties({ refs, state, watch }),
174
+ proxyTimePickerDataProperties: proxyTimePickerDataProperties({ vm, state, watch }),
175
175
  handleKeyControl: handleKeyControl({ state, emit }),
176
176
  doPick: doPick(emit),
177
177
  searchTz: searchTz({ api: api2, state }),
@@ -186,20 +186,20 @@ const initApi = ({ api: api2, state, t, emit, nextTick, vm, refs, watch }) => {
186
186
  handleMonthPick: handleMonthPick({ api: api2, state }),
187
187
  handleVisibleDateChange: handleVisibleDateChange({ api: api2, state, t }),
188
188
  handleTimePick: handleTimePick({ api: api2, state, t }),
189
- handleVisibleTimeChange: handleVisibleTimeChange({ api: api2, refs, state, t }),
190
189
  handleYearPick: handleYearPick({ api: api2, state }),
191
190
  handleDatePick: handleDatePick({ api: api2, state, t }),
192
- handleShortcutClick: handleShortcutClick(api2),
193
191
  computerVisibleTime: computerVisibleTime({ state, t }),
192
+ handleShortcutClick: handleShortcutClick(api2),
194
193
  computerVisibleDate: computerVisibleDate({ state, t }),
194
+ handleVisibleTimeChange: handleVisibleTimeChange({ api: api2, vm, state, t }),
195
195
  computerTimeFormat: computerTimeFormat({ state })
196
196
  });
197
197
  };
198
- const renderless = (props, { computed, reactive, watch, nextTick }, { t, refs, emit: $emit, vm, i18n }) => {
198
+ const renderless = (props, { computed, reactive, watch, nextTick }, { t, emit: $emit, vm, i18n }) => {
199
199
  const api2 = {};
200
200
  const emit = props.emitter ? props.emitter.emit : $emit;
201
201
  const state = initState({ reactive, computed, api: api2, i18n });
202
- initApi({ api: api2, state, t, emit, nextTick, vm, refs, watch });
202
+ initApi({ api: api2, state, t, emit, nextTick, vm, watch });
203
203
  initWatch({ watch, state, api: api2, nextTick });
204
204
  return api2;
205
205
  };
@@ -98,7 +98,11 @@ const padZero = (num, targetLength = 2) => {
98
98
  const updateColumnValue = ({ constants, nextTick, props, refs, state }) => () => {
99
99
  const value = state.innerValue;
100
100
  const { formatter } = props;
101
- let values = [formatter("year", `${value.getFullYear()}`), formatter("month", padZero(value.getMonth() + 1)), formatter("day", padZero(value.getDate()))];
101
+ let values = [
102
+ formatter("year", `${value.getFullYear()}`),
103
+ formatter("month", padZero(value.getMonth() + 1)),
104
+ formatter("day", padZero(value.getDate()))
105
+ ];
102
106
  if (props.type === constants.DateTime) {
103
107
  values.push(formatter("hour", padZero(value.getHours())), formatter("minute", padZero(value.getMinutes())));
104
108
  }
@@ -156,7 +160,7 @@ function times(n, iteratee) {
156
160
  }
157
161
  return result;
158
162
  }
159
- const getOrigiCol = (state) => () => state.ranges.map(({ type, range: rangeArr }) => {
163
+ const getOriginColumns = (state) => () => state.ranges.map(({ type, range: rangeArr }) => {
160
164
  let values = times(rangeArr[1] - rangeArr[0] + 1, (index) => {
161
165
  const value = padZero(rangeArr[0] + index);
162
166
  return value;
@@ -212,7 +216,7 @@ const hookMounted = ({ constants, parent, refs, nextTick }) => () => {
212
216
  parent.$emit(constants.HookMounted, refs.refrence.$el);
213
217
  });
214
218
  };
215
- const showPickerAndlockSrcoll = ({ constants, state }) => () => {
219
+ const showPickerAndLockScroll = ({ constants, state }) => () => {
216
220
  state.visible = true;
217
221
  document.body.style.overflow = constants.Hidden;
218
222
  state.isReadonly = true;
@@ -228,7 +232,7 @@ export {
228
232
  getColumns,
229
233
  getDisplayValue,
230
234
  getMonthEndDay,
231
- getOrigiCol,
235
+ getOriginColumns,
232
236
  getRanges,
233
237
  getTrueValue,
234
238
  hookMounted,
@@ -236,7 +240,7 @@ export {
236
240
  onChange,
237
241
  onConfirm,
238
242
  padZero,
239
- showPickerAndlockSrcoll,
243
+ showPickerAndLockScroll,
240
244
  times,
241
245
  updateColumnValue,
242
246
  updateInnerValue
@@ -2,14 +2,14 @@ import "../chunk-PKUHTIDK.js";
2
2
  import {
3
3
  getBoundary,
4
4
  clearDisplayValue,
5
- showPickerAndlockSrcoll,
5
+ showPickerAndLockScroll,
6
6
  hookMounted,
7
7
  getMonthEndDay,
8
8
  getDisplayValue,
9
9
  getRanges,
10
10
  onConfirm,
11
11
  onCancel,
12
- getOrigiCol,
12
+ getOriginColumns,
13
13
  getColumns,
14
14
  updateInnerValue,
15
15
  formatValue,
@@ -17,7 +17,15 @@ import {
17
17
  updateColumnValue
18
18
  } from "./index";
19
19
  import { DATE } from "../common";
20
- const api = ["state", "clearDisplayValue", "showPickerAndlockSrcoll", "hookMounted", "onConfirm", "onCancel", "onChange"];
20
+ const api = [
21
+ "state",
22
+ "clearDisplayValue",
23
+ "showPickerAndLockScroll",
24
+ "hookMounted",
25
+ "onConfirm",
26
+ "onCancel",
27
+ "onChange"
28
+ ];
21
29
  const setWatchFn = ({ api: api2, watch, props, state, emit }) => {
22
30
  watch(
23
31
  () => props.minDate,
@@ -68,13 +76,17 @@ const setWatchFn = ({ api: api2, watch, props, state, emit }) => {
68
76
  }
69
77
  );
70
78
  };
71
- const renderless = (props, context, { computed, onMounted, reactive, watch }, { constants, emit, nextTick, refs, parent }) => {
72
- const api2 = { formatValue: formatValue(props), getMonthEndDay: getMonthEndDay(constants), hookMounted: hookMounted({ constants, parent, refs, nextTick }) };
79
+ const renderless = (props, { computed, onMounted, reactive, watch }, { constants, emit, nextTick, refs, parent }) => {
80
+ const api2 = {
81
+ formatValue: formatValue(props),
82
+ getMonthEndDay: getMonthEndDay(constants),
83
+ hookMounted: hookMounted({ constants, parent, refs, nextTick })
84
+ };
73
85
  const state = reactive({
74
86
  visible: false,
75
87
  innerValue: formatValue(props)(props.modelValue),
76
88
  ranges: computed(() => api2.getRanges()),
77
- originColumns: computed(() => api2.getOrigiCol()),
89
+ originColumns: computed(() => api2.getOriginColumns()),
78
90
  columns: computed(() => api2.getColumns()),
79
91
  displayValue: "",
80
92
  isReadonly: false,
@@ -82,12 +94,12 @@ const renderless = (props, context, { computed, onMounted, reactive, watch }, {
82
94
  });
83
95
  Object.assign(api2, {
84
96
  state,
85
- getOrigiCol: getOrigiCol(state),
97
+ getOriginColumns: getOriginColumns(state),
86
98
  onCancel: onCancel({ emit, state }),
87
99
  getColumns: getColumns({ props, state }),
88
100
  clearDisplayValue: clearDisplayValue(state),
89
101
  getDisplayValue: getDisplayValue({ constants, DATE, props, state }),
90
- showPickerAndlockSrcoll: showPickerAndlockSrcoll({ constants, state }),
102
+ showPickerAndLockScroll: showPickerAndLockScroll({ constants, state }),
91
103
  updateColumnValue: updateColumnValue({ constants, nextTick, props, refs, state })
92
104
  });
93
105
  api2.getBoundary = getBoundary({ api: api2, constants, props });
@@ -11,7 +11,7 @@ const isSameDay = (day1, day2) => {
11
11
  return theDay1.getFullYear() === theDay2.getFullYear() && theDay1.getMonth() === theDay2.getMonth() && theDay1.getDate() === theDay2.getDate();
12
12
  };
13
13
  const getCurrentDate = () => (dateValue) => {
14
- const today = /* @__PURE__ */ new Date();
14
+ const today = new Date();
15
15
  const theDate = new Date(dateValue);
16
16
  const year = theDate.getFullYear();
17
17
  const month = theDate.getMonth() + 1;
@@ -53,7 +53,7 @@ const loadingDate = ({ state, api }) => (direction) => {
53
53
  }, 300);
54
54
  };
55
55
  const initPanel = ({ state, api }) => (dateValue, direction, yearNum = 1) => {
56
- const currentDate = dateValue || (Array.isArray(state.date) ? state.date[1] : state.date) || /* @__PURE__ */ new Date();
56
+ const currentDate = dateValue || (Array.isArray(state.date) ? state.date[1] : state.date) || new Date();
57
57
  let month = currentDate.getMonth() + 1;
58
58
  let year = direction === "top" ? currentDate.getFullYear() - 1 : currentDate.getFullYear();
59
59
  if (yearNum === 1 && !direction) {
@@ -130,7 +130,7 @@ const watchModelValue = ({ props, state }) => () => {
130
130
  state.date = modelValue && modelValue.length ? modelValue.map((date) => new Date(date)) : [];
131
131
  }
132
132
  if (["datetime", "date"].includes(type)) {
133
- state.date = modelValue ? new Date(modelValue) : /* @__PURE__ */ new Date();
133
+ state.date = modelValue ? new Date(modelValue) : new Date();
134
134
  }
135
135
  if (["datetimerange", "datetime"].includes(type)) {
136
136
  const length = type === "datetime" ? 1 : 2;
@@ -12,13 +12,13 @@ import {
12
12
  prevMonth,
13
13
  modifyWithTimeString
14
14
  } from "../common/deps/date-util";
15
- const calcDefaultValue = (defaultValue) => {
16
- if (Array.isArray(defaultValue)) {
17
- return [new Date(defaultValue[0]), new Date(defaultValue[1])];
18
- } else if (defaultValue) {
19
- return [new Date(defaultValue), nextDate(new Date(defaultValue), 1)];
15
+ const calcDefaultValue = (defaultVal) => {
16
+ if (Array.isArray(defaultVal)) {
17
+ return [new Date(defaultVal[0]), new Date(defaultVal[1])];
18
+ } else if (defaultVal) {
19
+ return [new Date(defaultVal), nextDate(new Date(defaultVal), 1)];
20
20
  }
21
- return [/* @__PURE__ */ new Date(), nextDate(/* @__PURE__ */ new Date(), 1)];
21
+ return [new Date(), nextDate(new Date(), 1)];
22
22
  };
23
23
  const getMinVisibleDate = ({ state, t }) => () => {
24
24
  if (state.dateUserInput.min !== null) {
@@ -70,7 +70,9 @@ const watchMinDate = ({ state, t, vm }) => (value) => {
70
70
  }
71
71
  if (state.maxDate && state.maxDate < state.minDate) {
72
72
  const format = "HH:mm:ss";
73
- minTimePicker.state.selectableRange = [[parseDate(formatDate(state.minDate, format, t), format, t), parseDate("23:59:59", format, t)]];
73
+ minTimePicker.state.selectableRange = [
74
+ [parseDate(formatDate(state.minDate, format, t), format, t), parseDate("23:59:59", format, t)]
75
+ ];
74
76
  }
75
77
  if (value) {
76
78
  minTimePicker.state.value = value;
@@ -154,13 +156,23 @@ const handleDateInput = ({ state, t }) => (value, type) => {
154
156
  return;
155
157
  }
156
158
  if (type === "min") {
157
- state.minDate = modifyDate(state.minDate || /* @__PURE__ */ new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
159
+ state.minDate = modifyDate(
160
+ state.minDate || new Date(),
161
+ parsedValue.getFullYear(),
162
+ parsedValue.getMonth(),
163
+ parsedValue.getDate()
164
+ );
158
165
  state.leftDate = new Date(parsedValue);
159
166
  if (!state.unlinkPanels) {
160
167
  state.rightDate = nextMonth(state.leftDate);
161
168
  }
162
169
  } else {
163
- state.maxDate = modifyDate(state.maxDate || /* @__PURE__ */ new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
170
+ state.maxDate = modifyDate(
171
+ state.maxDate || new Date(),
172
+ parsedValue.getFullYear(),
173
+ parsedValue.getMonth(),
174
+ parsedValue.getDate()
175
+ );
164
176
  state.rightDate = new Date(parsedValue);
165
177
  if (!state.unlinkPanels) {
166
178
  state.leftDate = prevMonth(parsedValue);
@@ -172,12 +184,22 @@ const handleDateChange = ({ state, t }) => (value, type) => {
172
184
  const parsedValue = parseDate(value, state.dateFormat, t);
173
185
  if (parsedValue) {
174
186
  if (type === "min") {
175
- state.minDate = modifyDate(state.minDate || /* @__PURE__ */ new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
187
+ state.minDate = modifyDate(
188
+ state.minDate || new Date(),
189
+ parsedValue.getFullYear(),
190
+ parsedValue.getMonth(),
191
+ parsedValue.getDate()
192
+ );
176
193
  if (state.minDate > state.maxDate) {
177
194
  state.maxDate = state.minDate;
178
195
  }
179
196
  } else {
180
- state.maxDate = modifyDate(state.maxDate || /* @__PURE__ */ new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
197
+ state.maxDate = modifyDate(
198
+ state.maxDate || new Date(),
199
+ parsedValue.getFullYear(),
200
+ parsedValue.getMonth(),
201
+ parsedValue.getDate()
202
+ );
181
203
  if (state.maxDate < state.minDate) {
182
204
  state.minDate = state.maxDate;
183
205
  }
@@ -192,9 +214,19 @@ const handleTimeInput = ({ state, t }) => (value, type) => {
192
214
  const parsedValue = parseDate(value, state.timeFormat, t);
193
215
  if (parsedValue) {
194
216
  if (type === "min") {
195
- state.minDate = modifyTime(state.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
217
+ state.minDate = modifyTime(
218
+ state.minDate,
219
+ parsedValue.getHours(),
220
+ parsedValue.getMinutes(),
221
+ parsedValue.getSeconds()
222
+ );
196
223
  } else {
197
- state.maxDate = modifyTime(state.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
224
+ state.maxDate = modifyTime(
225
+ state.maxDate,
226
+ parsedValue.getHours(),
227
+ parsedValue.getMinutes(),
228
+ parsedValue.getSeconds()
229
+ );
198
230
  }
199
231
  }
200
232
  };
@@ -202,14 +234,24 @@ const handleTimeChange = ({ state, t, vm }) => (value, type) => {
202
234
  const parsedValue = parseDate(value, state.timeFormat, t);
203
235
  if (parsedValue) {
204
236
  if (type === "min") {
205
- state.minDate = modifyTime(state.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
237
+ state.minDate = modifyTime(
238
+ state.minDate,
239
+ parsedValue.getHours(),
240
+ parsedValue.getMinutes(),
241
+ parsedValue.getSeconds()
242
+ );
206
243
  if (state.minDate > state.maxDate) {
207
244
  state.maxDate = state.minDate;
208
245
  }
209
246
  vm.$refs.minTimePicker.state.value = state.minDate;
210
247
  state.minTimePickerVisible = false;
211
248
  } else {
212
- state.maxDate = modifyTime(state.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
249
+ state.maxDate = modifyTime(
250
+ state.maxDate,
251
+ parsedValue.getHours(),
252
+ parsedValue.getMinutes(),
253
+ parsedValue.getSeconds()
254
+ );
213
255
  if (state.maxDate < state.minDate) {
214
256
  state.minDate = state.maxDate;
215
257
  }
@@ -220,8 +262,17 @@ const handleTimeChange = ({ state, t, vm }) => (value, type) => {
220
262
  };
221
263
  const handleRangePick = ({ api, state, t }) => (val, close = true) => {
222
264
  const defaultTime = state.defaultTime || [];
223
- const minDate = modifyWithTimeString(val.minDate, defaultTime[0], t);
224
- const maxDate = modifyWithTimeString(val.maxDate, defaultTime[1], t);
265
+ let minDateVal = val.minDate;
266
+ let maxDateVal = val.maxDate;
267
+ if (state.singleSelect) {
268
+ Object.assign(state.rangeState, { selecting: false });
269
+ const effectDate = val.minDate || val.maxDate;
270
+ const rangeDate = state.shortcutType === "startFrom" ? state.maxRangeDate : state.minRangeDate;
271
+ minDateVal = rangeDate > effectDate ? effectDate : rangeDate;
272
+ maxDateVal = rangeDate > effectDate ? rangeDate : effectDate;
273
+ }
274
+ const minDate = modifyWithTimeString(minDateVal, defaultTime[0], t);
275
+ const maxDate = modifyWithTimeString(maxDateVal, defaultTime[1], t);
225
276
  if (state.maxDate === maxDate && state.minDate === minDate) {
226
277
  return;
227
278
  }
@@ -237,7 +288,20 @@ const handleRangePick = ({ api, state, t }) => (val, close = true) => {
237
288
  }
238
289
  api.handleConfirm();
239
290
  };
240
- const handleShortcutClick = (api) => (shortcut) => {
291
+ const handleShortcutClick = (state, api) => (shortcut) => {
292
+ if (shortcut.type) {
293
+ state.singleSelect = true;
294
+ state.shortcutType = shortcut.type;
295
+ state.shortcutText = shortcut.text;
296
+ if (shortcut.type === "startFrom" && shortcut.endDate && isDate(shortcut.endDate)) {
297
+ state.maxRangeDate = shortcut.endDate;
298
+ }
299
+ if (shortcut.type === "endAt" && shortcut.startDate && isDate(shortcut.startDate)) {
300
+ state.minRangeDate = shortcut.startDate;
301
+ }
302
+ state.value = [];
303
+ return;
304
+ }
241
305
  if (shortcut.onClick) {
242
306
  const picker = {
243
307
  $emit: (type, [start, end]) => {
@@ -251,7 +315,7 @@ const doPick = (emit) => (start, end) => {
251
315
  emit("pick", [start, end], false);
252
316
  };
253
317
  const handleMinTimePick = ({ state }) => (value, visible, first) => {
254
- state.minDate = state.minDate || /* @__PURE__ */ new Date();
318
+ state.minDate = state.minDate || new Date();
255
319
  if (value) {
256
320
  state.minDate = modifyTime(state.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
257
321
  }
@@ -327,6 +391,13 @@ const setTimeFormat = ({ nextTick, vm, state }) => () => {
327
391
  const computerBtnDisabled = ({ state, api }) => () => !(state.minDate && state.maxDate && !state.selecting && api.isValidValue([state.minDate, state.maxDate]));
328
392
  const computerLabel = ({ state, t }) => (type) => `${state[type].getFullYear()} ${t("ui.datepicker.year")} ${t(`ui.datepicker.month${state[type].getMonth() + 1}`)}`;
329
393
  const computerEnableYearArrow = (state) => () => state.unlinkPanels && state.rightYear * 12 + state.rightMonth - (state.leftYear * 12 + state.leftMonth + 1) >= 12;
394
+ const watchPickerVisible = ({ state, constants }) => (val) => {
395
+ if (!val) {
396
+ state.singleSelect = false;
397
+ state.minRangeDate = constants.startDate;
398
+ state.maxRangeDate = constants.endDate;
399
+ }
400
+ };
330
401
  export {
331
402
  calcDefaultValue,
332
403
  computerBtnDisabled,
@@ -367,5 +438,6 @@ export {
367
438
  watchMaxTimePickerVisible,
368
439
  watchMinDate,
369
440
  watchMinTimePickerVisible,
441
+ watchPickerVisible,
370
442
  watchValue
371
443
  };