@hi-ui/time-picker 4.0.10 → 4.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,77 +24,68 @@ import DayJs from 'dayjs';
24
24
  var _role = 'time-picker';
25
25
  var timePickerPrefix = getPrefixCls(_role);
26
26
  var DefaultValue = ['', ''];
27
-
28
27
  var DefaultDisabledFunc = function DefaultDisabledFunc() {
29
28
  return [];
30
29
  };
31
-
32
30
  var DefaultPlaceholder = ['', ''];
33
-
34
31
  var getValueMatchString = function getValueMatchString(value, format) {
35
32
  if (format === void 0) {
36
33
  format = 'HH:mm:ss';
37
34
  }
38
-
39
35
  if (!value) {
40
36
  return undefined;
41
37
  }
42
-
43
38
  var result = Array.isArray(value) ? value : [value];
44
39
  return result.map(function (item) {
45
40
  return typeof item === 'string' ? item : DayJs(item).format(format);
46
41
  });
47
42
  };
48
-
49
43
  var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
50
44
  var _cx;
51
-
52
45
  var _ref$prefixCls = _ref.prefixCls,
53
- prefixCls = _ref$prefixCls === void 0 ? timePickerPrefix : _ref$prefixCls,
54
- _ref$role = _ref.role,
55
- role = _ref$role === void 0 ? _role : _ref$role,
56
- className = _ref.className,
57
- controlledValue = _ref.value,
58
- _ref$hourStep = _ref.hourStep,
59
- hourStep = _ref$hourStep === void 0 ? 1 : _ref$hourStep,
60
- _ref$minuteStep = _ref.minuteStep,
61
- minuteStep = _ref$minuteStep === void 0 ? 1 : _ref$minuteStep,
62
- _ref$secondStep = _ref.secondStep,
63
- secondStep = _ref$secondStep === void 0 ? 1 : _ref$secondStep,
64
- _ref$format = _ref.format,
65
- format = _ref$format === void 0 ? 'HH:mm:ss' : _ref$format,
66
- _ref$type = _ref.type,
67
- type = _ref$type === void 0 ? 'single' : _ref$type,
68
- _ref$appearance = _ref.appearance,
69
- appearance = _ref$appearance === void 0 ? 'line' : _ref$appearance,
70
- _ref$defaultValue = _ref.defaultValue,
71
- uncontrolledValue = _ref$defaultValue === void 0 ? DefaultValue : _ref$defaultValue,
72
- _ref$disabled = _ref.disabled,
73
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
74
- _ref$disabledHours = _ref.disabledHours,
75
- originalDisabledHours = _ref$disabledHours === void 0 ? DefaultDisabledFunc : _ref$disabledHours,
76
- _ref$disabledSeconds = _ref.disabledSeconds,
77
- originalDisabledSeconds = _ref$disabledSeconds === void 0 ? DefaultDisabledFunc : _ref$disabledSeconds,
78
- _ref$disabledMinutes = _ref.disabledMinutes,
79
- originalDisabledMinutes = _ref$disabledMinutes === void 0 ? DefaultDisabledFunc : _ref$disabledMinutes,
80
- notifyOutside = _ref.onChange,
81
- _ref$placeholder = _ref.placeholder,
82
- originalPlaceholder = _ref$placeholder === void 0 ? DefaultPlaceholder : _ref$placeholder,
83
- _ref$inputReadonly = _ref.inputReadonly,
84
- inputReadonly = _ref$inputReadonly === void 0 ? false : _ref$inputReadonly,
85
- overlay = _ref.overlay,
86
- _ref$size = _ref.size,
87
- size = _ref$size === void 0 ? 'md' : _ref$size,
88
- _ref$invalid = _ref.invalid,
89
- invalid = _ref$invalid === void 0 ? false : _ref$invalid;
46
+ prefixCls = _ref$prefixCls === void 0 ? timePickerPrefix : _ref$prefixCls,
47
+ _ref$role = _ref.role,
48
+ role = _ref$role === void 0 ? _role : _ref$role,
49
+ className = _ref.className,
50
+ controlledValue = _ref.value,
51
+ _ref$hourStep = _ref.hourStep,
52
+ hourStep = _ref$hourStep === void 0 ? 1 : _ref$hourStep,
53
+ _ref$minuteStep = _ref.minuteStep,
54
+ minuteStep = _ref$minuteStep === void 0 ? 1 : _ref$minuteStep,
55
+ _ref$secondStep = _ref.secondStep,
56
+ secondStep = _ref$secondStep === void 0 ? 1 : _ref$secondStep,
57
+ _ref$format = _ref.format,
58
+ format = _ref$format === void 0 ? 'HH:mm:ss' : _ref$format,
59
+ _ref$type = _ref.type,
60
+ type = _ref$type === void 0 ? 'single' : _ref$type,
61
+ _ref$appearance = _ref.appearance,
62
+ appearance = _ref$appearance === void 0 ? 'line' : _ref$appearance,
63
+ _ref$defaultValue = _ref.defaultValue,
64
+ uncontrolledValue = _ref$defaultValue === void 0 ? DefaultValue : _ref$defaultValue,
65
+ _ref$disabled = _ref.disabled,
66
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
67
+ _ref$disabledHours = _ref.disabledHours,
68
+ originalDisabledHours = _ref$disabledHours === void 0 ? DefaultDisabledFunc : _ref$disabledHours,
69
+ _ref$disabledSeconds = _ref.disabledSeconds,
70
+ originalDisabledSeconds = _ref$disabledSeconds === void 0 ? DefaultDisabledFunc : _ref$disabledSeconds,
71
+ _ref$disabledMinutes = _ref.disabledMinutes,
72
+ originalDisabledMinutes = _ref$disabledMinutes === void 0 ? DefaultDisabledFunc : _ref$disabledMinutes,
73
+ notifyOutside = _ref.onChange,
74
+ _ref$placeholder = _ref.placeholder,
75
+ originalPlaceholder = _ref$placeholder === void 0 ? DefaultPlaceholder : _ref$placeholder,
76
+ _ref$inputReadonly = _ref.inputReadonly,
77
+ inputReadonly = _ref$inputReadonly === void 0 ? false : _ref$inputReadonly,
78
+ overlay = _ref.overlay,
79
+ _ref$size = _ref.size,
80
+ size = _ref$size === void 0 ? 'md' : _ref$size,
81
+ _ref$invalid = _ref.invalid,
82
+ invalid = _ref$invalid === void 0 ? false : _ref$invalid;
90
83
  var i18n = useLocaleContext();
91
84
  var confirmText = i18n.get('timePicker.ok');
92
85
  var nowText = i18n.get('timePicker.now');
93
-
94
86
  var _useState = useState(null),
95
- attachEl = _useState[0],
96
- setAttachEl = _useState[1];
97
-
87
+ attachEl = _useState[0],
88
+ setAttachEl = _useState[1];
98
89
  var formatUncontrolledValue = useMemo(function () {
99
90
  return getValueMatchString(uncontrolledValue, format);
100
91
  }, [format, uncontrolledValue]);
@@ -111,42 +102,35 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
111
102
  var singleFormat = ['HH', 'mm', 'ss'];
112
103
  return singleFormat.includes(format);
113
104
  }, [format]);
114
-
115
105
  var _useUncontrolledState = useUncontrolledState(formatUncontrolledValue, formatControlledValue, formatNotifyOutside),
116
- value = _useUncontrolledState[0],
117
- onChange = _useUncontrolledState[1];
118
-
106
+ value = _useUncontrolledState[0],
107
+ onChange = _useUncontrolledState[1];
119
108
  var placeholder = useMemo(function () {
120
109
  return Array.isArray(originalPlaceholder) ? originalPlaceholder : [originalPlaceholder];
121
110
  }, [originalPlaceholder]);
122
111
  var inputRef = useRef(null);
123
-
124
112
  var _useState2 = useState(true),
125
- isInputValid = _useState2[0],
126
- setIsInputValid = _useState2[1];
127
-
113
+ isInputValid = _useState2[0],
114
+ setIsInputValid = _useState2[1];
128
115
  var _useState3 = useState(value),
129
- cacheValue = _useState3[0],
130
- setCacheValue = _useState3[1];
131
-
132
- var cacheValueRef = useRef(cacheValue); // 将值统一转化为函数
133
-
116
+ cacheValue = _useState3[0],
117
+ setCacheValue = _useState3[1];
118
+ var cacheValueRef = useRef(cacheValue);
119
+ // 将值统一转化为函数
134
120
  var _useFilter = useFilter({
135
- disabledHours: originalDisabledHours,
136
- disabledMinutes: originalDisabledMinutes,
137
- disabledSeconds: originalDisabledSeconds
138
- }),
139
- disabledHours = _useFilter.disabledHours,
140
- disabledMinutes = _useFilter.disabledMinutes,
141
- disabledSeconds = _useFilter.disabledSeconds;
142
-
121
+ disabledHours: originalDisabledHours,
122
+ disabledMinutes: originalDisabledMinutes,
123
+ disabledSeconds: originalDisabledSeconds
124
+ }),
125
+ disabledHours = _useFilter.disabledHours,
126
+ disabledMinutes = _useFilter.disabledMinutes,
127
+ disabledSeconds = _useFilter.disabledSeconds;
143
128
  useEffect(function () {
144
129
  cacheValueRef.current = [].concat(value);
145
130
  setCacheValue(function (pre) {
146
131
  if (pre.join('') !== value.join('')) {
147
132
  return [].concat(value);
148
133
  }
149
-
150
134
  return pre;
151
135
  });
152
136
  }, [value]);
@@ -156,8 +140,8 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
156
140
  } else {
157
141
  return index === 0 ? 'range-start' : 'range-end';
158
142
  }
159
- }, [type]); // 检查值是否合规
160
-
143
+ }, [type]);
144
+ // 检查值是否合规
161
145
  var validChecker = useCallback(function (checkValue) {
162
146
  // 检查 range 情况下值是否正确
163
147
  // 视开始结束都为空值为正确值
@@ -178,26 +162,24 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
178
162
  },
179
163
  panelType: getPanelType(index)
180
164
  });
181
- }) && ( // 单选不检查前后关系
165
+ }) && (
166
+ // 单选不检查前后关系
182
167
  type === 'single' || rangeValid);
183
168
  }, [hourStep, getPanelType, minuteStep, secondStep, disabledHours, disabledMinutes, disabledSeconds, format, type]);
184
169
  var onCacheChange = useCallback(function (newValue) {
185
170
  var result = newValue.slice(0, type === 'single' ? 1 : 2);
186
- cacheValueRef.current = [].concat(result); // 避免重复渲染
187
-
171
+ cacheValueRef.current = [].concat(result);
172
+ // 避免重复渲染
188
173
  setCacheValue(function (pre) {
189
174
  if (pre.join('') !== result.join('')) {
190
175
  return [].concat(result);
191
176
  }
192
-
193
177
  return pre;
194
178
  });
195
179
  }, [type]);
196
-
197
180
  var _useState4 = useState(false),
198
- showPopper = _useState4[0],
199
- setShowPopper = _useState4[1];
200
-
181
+ showPopper = _useState4[0],
182
+ setShowPopper = _useState4[1];
201
183
  var showPopperRef = useRef(false);
202
184
  var cls = cx(prefixCls, className, prefixCls + "--appearance-" + appearance, (_cx = {}, _cx[prefixCls + "--active"] = showPopper && !disabled, _cx[prefixCls + "--disabled"] = disabled, _cx[prefixCls + "--input-not-valid"] = !isInputValid || invalid, _cx));
203
185
  var functionButtons = useMemo(function () {
@@ -214,11 +196,10 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
214
196
  onChange([].concat(cacheValue));
215
197
  }
216
198
  }
217
-
218
199
  showPopperRef.current = false;
219
200
  setShowPopper(false);
220
201
  }
221
- }, confirmText), type === 'single' && !isInSingleValueFormat && /*#__PURE__*/React.createElement(Button, {
202
+ }, confirmText), type === 'single' && !isInSingleValueFormat && ( /*#__PURE__*/React.createElement(Button, {
222
203
  className: prefixCls + "__pop-now-btn",
223
204
  appearance: "link",
224
205
  type: "primary",
@@ -228,7 +209,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
228
209
  showPopperRef.current = false;
229
210
  setShowPopper(false);
230
211
  }
231
- }, nowText));
212
+ }, nowText)));
232
213
  }, [prefixCls, isInputValid, confirmText, type, isInSingleValueFormat, nowText, validChecker, cacheValue, value, onChange, onCacheChange, format]);
233
214
  return /*#__PURE__*/React.createElement("div", {
234
215
  ref: ref,
@@ -267,28 +248,28 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
267
248
  return !pre;
268
249
  });
269
250
  }
270
- }, showPopper ? /*#__PURE__*/React.createElement(CloseCircleFilled, {
251
+ }, showPopper ? ( /*#__PURE__*/React.createElement(CloseCircleFilled, {
271
252
  className: prefixCls + "__close-button",
272
253
  onClick: function onClick() {
273
254
  onCacheChange(type === 'single' ? [''] : ['', '']);
274
255
  }
275
- }) : /*#__PURE__*/React.createElement(TimeOutlined, null))), /*#__PURE__*/React.createElement(Popper, Object.assign({}, overlay || {}, {
256
+ })) : ( /*#__PURE__*/React.createElement(TimeOutlined, null)))), /*#__PURE__*/React.createElement(Popper, Object.assign({}, overlay || {}, {
276
257
  unmountOnClose: false,
277
258
  visible: showPopper && !disabled,
278
259
  attachEl: attachEl,
279
260
  autoFocus: false,
280
261
  onClose: function onClose() {
281
- var _a; // 关闭弹窗,视作,抛弃之前的选择行为,复位
282
-
283
-
262
+ var _a;
263
+ // 关闭弹窗,视作,抛弃之前的选择行为,复位
284
264
  showPopperRef.current = false;
285
265
  setShowPopper(false);
286
- onCacheChange([].concat(value)); // 强制刷新 input 内容,复位
287
-
266
+ onCacheChange([].concat(value));
267
+ // 强制刷新 input 内容,复位
288
268
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.refresh();
289
269
  },
290
270
  preload: true
291
- }), /*#__PURE__*/React.createElement(PopContent // itemHeight={itemHeight}
271
+ }), /*#__PURE__*/React.createElement(PopContent
272
+ // itemHeight={itemHeight}
292
273
  // fullDisplayItemNumber={fullDisplayItemNumber}
293
274
  , {
294
275
  // itemHeight={itemHeight}
@@ -304,10 +285,9 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
304
285
  disabledSeconds: disabledSeconds,
305
286
  value: cacheValue,
306
287
  onChange: function onChange(e) {
307
- var _a; // 只有弹窗展开的时候才接受 pop content 的值改变
288
+ var _a;
289
+ // 只有弹窗展开的时候才接受 pop content 的值改变
308
290
  // WARNING: 当值错误,弹窗收起,默认会滚动到 00:00:00,并且通知外部(非期望),所以我们需要这个FLAG来避免错误值获取
309
-
310
-
311
291
  if (showPopperRef.current) {
312
292
  // 强制刷新 input 内容,复位
313
293
  // 解决此情况:
@@ -319,9 +299,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
319
299
  }
320
300
  }), functionButtons));
321
301
  });
322
-
323
302
  if (__DEV__) {
324
303
  TimePicker.displayName = 'TimePicker';
325
304
  }
326
-
327
305
  export { TimePicker, timePickerPrefix };
@@ -8,7 +8,6 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import { useMemo } from 'react';
11
-
12
11
  var useFilter = function useFilter(original) {
13
12
  return useMemo(function () {
14
13
  function disabledCompatibility(disposeValue) {
@@ -17,10 +16,8 @@ var useFilter = function useFilter(original) {
17
16
  return disposeValue;
18
17
  };
19
18
  }
20
-
21
19
  return disposeValue;
22
20
  }
23
-
24
21
  return {
25
22
  disabledHours: disabledCompatibility(original.disabledHours),
26
23
  disabledMinutes: disabledCompatibility(original.disabledMinutes),
@@ -28,5 +25,4 @@ var useFilter = function useFilter(original) {
28
25
  };
29
26
  }, [original.disabledHours, original.disabledSeconds, original.disabledMinutes]);
30
27
  };
31
-
32
28
  export { useFilter };
@@ -8,8 +8,6 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import __styleInject__ from 'style-inject';
11
- var css_248z = ".hi-v4-time-picker {width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;border-radius: 4px;-webkit-box-shadow: 0 0 0 2px transparent;box-shadow: 0 0 0 2px transparent;}.hi-v4-time-picker__input-wrapper {border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);border-radius: var(--hi-v4-border-radius-md, 4px);width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;}.hi-v4-time-picker--appearance-line {position: relative;z-index: 0;}.hi-v4-time-picker--appearance-line .hi-v4-time-picker__input-wrapper {background: var(--hi-v4-color-static-white, #fff);border-color: var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-time-picker--appearance-line:hover .hi-v4-time-picker__input-wrapper {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-time-picker--appearance-filled {background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-time-picker--appearance-filled:hover {background: var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-time-picker--appearance-unset:hover {background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-time-picker--active {-webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));background: transparent;}.hi-v4-time-picker--active .hi-v4-time-picker__input-wrapper {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-time-picker--active:hover {background: transparent;}.hi-v4-time-picker--input-not-valid {-webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));}.hi-v4-time-picker--input-not-valid .hi-v4-time-picker__input-wrapper, .hi-v4-time-picker--input-not-valid .hi-v4-time-picker__input-wrapper:hover {border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959));}.hi-v4-time-picker__pop-function-buttons {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;padding: 6px 8px;border-top: 1px solid var(--hi-v4-color-gray-100, #f2f4f7);-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-wrap: wrap;flex-wrap: wrap;-webkit-box-orient: horizontal;-webkit-box-direction: reverse;-ms-flex-direction: row-reverse;flex-direction: row-reverse;}.hi-v4-time-picker__pop-function-buttons .hi-v4-time-picker__pop-now-btn {-webkit-margin-start: 0;margin-inline-start: 0;-webkit-margin-end: var(--hi-v4-spacing-6, 12px);margin-inline-end: var(--hi-v4-spacing-6, 12px);}.hi-v4-time-picker__function-button {margin-right: 8px;font-size: 14px;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--disabled {cursor: not-allowed;background: #dfe2e8;}.hi-v4-time-picker--disabled .hi-v4-time-picker__input-wrapper {pointer-events: none;opacity: 0.3;}.hi-v4-time-picker__close-button:hover {color: #5f6a7a;}.hi-v4-time-picker__selector {cursor: pointer;position: relative;z-index: 0;width: 54px;color: #5f6a7a;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-time-picker__selector:hover .hi-v4-time-picker__selector__shortcut {opacity: 1;}.hi-v4-time-picker__selector--position-left {margin-right: 1px;}.hi-v4-time-picker__selector--position-left .hi-v4-time-picker__selector__item {border-radius: 4px 0 0 4px;}.hi-v4-time-picker__selector--position-right {margin-left: 1px;}.hi-v4-time-picker__selector--position-right .hi-v4-time-picker__selector__item {border-radius: 0 4px 4px 0;}.hi-v4-time-picker__selector--position-single .hi-v4-time-picker__selector__item {border-radius: 4px;}.hi-v4-time-picker__selector__item {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;font-size: 14px;}.hi-v4-time-picker__selector__item:hover {background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-time-picker__selector__item.hi-v4-time-picker__selector__item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-time-picker__selector__item.hi-v4-time-picker__selector__item--disabled {opacity: 0.2;cursor: not-allowed;background: transparent;}.hi-v4-time-picker__selector__demarcate {margin: 2px 0;height: 32px;}.hi-v4-time-picker__selector__demarcate:first-of-type {margin-top: 0;}.hi-v4-time-picker__selector__demarcate:last-of-type {margin-bottom: 0;}.hi-v4-time-picker__selector__scroll-part {overflow-y: auto;-webkit-box-sizing: content-box;box-sizing: content-box;scroll-behavior: smooth;scrollbar-width: none; /* firefox */-ms-overflow-style: none; /* IE 10+ */padding: 100px 0;width: 100%;position: relative;z-index: 0;}.hi-v4-time-picker__selector__scroll-part::-webkit-scrollbar {display: none; /* Chrome Safari */}.hi-v4-time-picker__selector__shortcut {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;height: 12px;opacity: 0;}.hi-v4-time-picker__panel {padding: 4px 8px;-webkit-box-sizing: border-box;box-sizing: border-box;height: 100%;}.hi-v4-time-picker__panel__selector-container {display: -webkit-box;display: -ms-flexbox;display: flex;position: relative;z-index: 0;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-time-picker__panel__selector-content {position: relative;}.hi-v4-time-picker__panel__indicator {position: absolute;top: 50%;-webkit-transform: translateY(-50%);transform: translateY(-50%);pointer-events: none;background: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));z-index: -1;width: 54px;height: 32px;}.hi-v4-time-picker__panel__indicator--left {border-top-left-radius: 4px;border-bottom-left-radius: 4px;left: 0;}.hi-v4-time-picker__panel__indicator--right {border-top-right-radius: 4px;border-bottom-right-radius: 4px;right: 0;}.hi-v4-time-picker__panel__indicator--middle {left: 0;}.hi-v4-time-picker__input {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;color: var(--hi-v4-color-gray-700, #1f2733);}.hi-v4-time-picker__input--disabled {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input--not-valid {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959));}.hi-v4-time-picker__input--range .hi-v4-time-picker__input__interact-area {text-align: left;}.hi-v4-time-picker__input--fit-content .hi-v4-time-picker__input__wrapper {width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;}.hi-v4-time-picker__input--size-sm {line-height: var(--hi-v4-height-6, 24px);font-size: var(--hi-v4-text-size-sm, 0.75rem);}.hi-v4-time-picker__input--size-sm .hi-v4-time-picker__input__wrapper {height: var(--hi-v4-height-6, 24px);}.hi-v4-time-picker__input--size-md {line-height: var(--hi-v4-height-8, 32px);font-size: var(--hi-v4-text-size-md, 0.875rem);}.hi-v4-time-picker__input--size-md .hi-v4-time-picker__input__wrapper {height: var(--hi-v4-height-8, 32px);}.hi-v4-time-picker__input--size-lg {line-height: var(--hi-v4-height-10, 40px);font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-time-picker__input--size-lg .hi-v4-time-picker__input__wrapper {height: var(--hi-v4-height-10, 40px);}.hi-v4-time-picker__input__wrapper {width: 208px;-webkit-box-sizing: border-box;box-sizing: border-box;position: relative;z-index: 0;height: 30px;line-height: 30px;padding: 0 12px;}.hi-v4-time-picker__input__shadow-text {display: inline-block;font-size: inherit;font-weight: inherit;font-family: inherit;color: transparent;}.hi-v4-time-picker__input__interact-area {-webkit-box-sizing: border-box;box-sizing: border-box;width: 100%;padding: 0 12px;color: inherit;border: none;outline: none;height: 100%;font-size: inherit;background: transparent;font-weight: inherit;font-family: inherit;position: absolute;left: 0;top: 0;}.hi-v4-time-picker__input__interact-area:disabled {background: transparent;}.hi-v4-time-picker__input__interact-area::-webkit-input-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area::-moz-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area::-ms-input-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area:-ms-input-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area::placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::-webkit-input-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::-moz-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::-ms-input-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area:-ms-input-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker__pop-content {display: -webkit-box;display: -ms-flexbox;display: flex;width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;position: relative;-webkit-box-align: stretch;-ms-flex-align: stretch;align-items: stretch;min-width: 100%;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-time-picker__pop-content__separator {width: 1px;background-color: var(--hi-v4-color-gray-100, #f2f4f7);border-left: none;border-right: none;}";
12
-
11
+ var css_248z = ".hi-v4-time-picker {width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;border-radius: 4px;-webkit-box-shadow: 0 0 0 2px transparent;box-shadow: 0 0 0 2px transparent;}.hi-v4-time-picker__input-wrapper {border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);border-radius: var(--hi-v4-border-radius-md, 4px);width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;}.hi-v4-time-picker--appearance-line {position: relative;z-index: 0;}.hi-v4-time-picker--appearance-line .hi-v4-time-picker__input-wrapper {background: var(--hi-v4-color-static-white, #fff);border-color: var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-time-picker--appearance-line:hover .hi-v4-time-picker__input-wrapper {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-time-picker--appearance-filled {background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-time-picker--appearance-filled:hover {background: var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-time-picker--appearance-unset:hover {background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-time-picker--active {-webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));background: transparent;}.hi-v4-time-picker--active .hi-v4-time-picker__input-wrapper {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-time-picker--active:hover {background: transparent;}.hi-v4-time-picker--input-not-valid {-webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));}.hi-v4-time-picker--input-not-valid .hi-v4-time-picker__input-wrapper, .hi-v4-time-picker--input-not-valid .hi-v4-time-picker__input-wrapper:hover {border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959));}.hi-v4-time-picker__pop-function-buttons {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;padding: 6px 8px;border-top: 1px solid var(--hi-v4-color-gray-100, #f2f4f7);-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-wrap: wrap;flex-wrap: wrap;-webkit-box-orient: horizontal;-webkit-box-direction: reverse;-ms-flex-direction: row-reverse;flex-direction: row-reverse;}.hi-v4-time-picker__pop-function-buttons .hi-v4-time-picker__pop-now-btn {-webkit-margin-start: 0;margin-inline-start: 0;-webkit-margin-end: var(--hi-v4-spacing-6, 12px);margin-inline-end: var(--hi-v4-spacing-6, 12px);}.hi-v4-time-picker__function-button {margin-right: 8px;font-size: 14px;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--disabled {cursor: not-allowed;background: #dfe2e8;}.hi-v4-time-picker--disabled .hi-v4-time-picker__input-wrapper {pointer-events: none;opacity: 0.3;}.hi-v4-time-picker__close-button:hover {color: #5f6a7a;}.hi-v4-time-picker__selector {cursor: pointer;position: relative;z-index: 0;width: 54px;color: #5f6a7a;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-time-picker__selector:hover .hi-v4-time-picker__selector__shortcut {opacity: 1;}.hi-v4-time-picker__selector--position-left {margin-right: 1px;}.hi-v4-time-picker__selector--position-left .hi-v4-time-picker__selector__item {border-radius: 4px 0 0 4px;}.hi-v4-time-picker__selector--position-right {margin-left: 1px;}.hi-v4-time-picker__selector--position-right .hi-v4-time-picker__selector__item {border-radius: 0 4px 4px 0;}.hi-v4-time-picker__selector--position-single .hi-v4-time-picker__selector__item {border-radius: 4px;}.hi-v4-time-picker__selector__item {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;font-size: 14px;}.hi-v4-time-picker__selector__item:hover {background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-time-picker__selector__item.hi-v4-time-picker__selector__item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-time-picker__selector__item.hi-v4-time-picker__selector__item--disabled {opacity: 0.2;cursor: not-allowed;background: transparent;}.hi-v4-time-picker__selector__demarcate {margin: 2px 0;height: 32px;}.hi-v4-time-picker__selector__demarcate:first-of-type {margin-top: 0;}.hi-v4-time-picker__selector__demarcate:last-of-type {margin-bottom: 0;}.hi-v4-time-picker__selector__scroll-part {overflow-y: auto;-webkit-box-sizing: content-box;box-sizing: content-box;scroll-behavior: smooth;scrollbar-width: none; /* firefox */-ms-overflow-style: none; /* IE 10+ */padding: 100px 0;width: 100%;position: relative;z-index: 0;}.hi-v4-time-picker__selector__scroll-part::-webkit-scrollbar {display: none; /* Chrome Safari */}.hi-v4-time-picker__selector__shortcut {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;height: 12px;opacity: 0;}.hi-v4-time-picker__panel {padding: 4px 8px;-webkit-box-sizing: border-box;box-sizing: border-box;height: 100%;}.hi-v4-time-picker__panel__selector-container {display: -webkit-box;display: -ms-flexbox;display: flex;position: relative;z-index: 0;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-time-picker__panel__selector-content {position: relative;}.hi-v4-time-picker__panel__indicator {position: absolute;top: 50%;-webkit-transform: translateY(-50%);transform: translateY(-50%);pointer-events: none;background: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));z-index: -1;width: 54px;height: 32px;}.hi-v4-time-picker__panel__indicator--left {border-top-left-radius: 4px;border-bottom-left-radius: 4px;left: 0;}.hi-v4-time-picker__panel__indicator--right {border-top-right-radius: 4px;border-bottom-right-radius: 4px;right: 0;}.hi-v4-time-picker__panel__indicator--middle {left: 0;}.hi-v4-time-picker__input {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;color: var(--hi-v4-color-gray-700, #1f2733);}.hi-v4-time-picker__input--disabled {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input--not-valid {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959));}.hi-v4-time-picker__input--range .hi-v4-time-picker__input__interact-area {text-align: left;}.hi-v4-time-picker__input--fit-content .hi-v4-time-picker__input__wrapper {width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;}.hi-v4-time-picker__input--size-sm {line-height: var(--hi-v4-height-6, 24px);font-size: var(--hi-v4-text-size-sm, 0.75rem);}.hi-v4-time-picker__input--size-sm .hi-v4-time-picker__input__wrapper {height: var(--hi-v4-height-6, 24px);}.hi-v4-time-picker__input--size-md {line-height: var(--hi-v4-height-8, 32px);font-size: var(--hi-v4-text-size-md, 0.875rem);}.hi-v4-time-picker__input--size-md .hi-v4-time-picker__input__wrapper {height: var(--hi-v4-height-8, 32px);}.hi-v4-time-picker__input--size-lg {line-height: var(--hi-v4-height-10, 40px);font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-time-picker__input--size-lg .hi-v4-time-picker__input__wrapper {height: var(--hi-v4-height-10, 40px);}.hi-v4-time-picker__input__wrapper {width: 208px;-webkit-box-sizing: border-box;box-sizing: border-box;position: relative;z-index: 0;height: 30px;line-height: 30px;padding: 0 12px;}.hi-v4-time-picker__input__shadow-text {display: inline-block;font-size: inherit;font-weight: inherit;font-family: inherit;color: transparent;}.hi-v4-time-picker__input__interact-area {-webkit-box-sizing: border-box;box-sizing: border-box;width: 100%;padding: 0 12px;color: inherit;border: none;outline: none;height: 100%;font-size: inherit;background: transparent;font-weight: inherit;font-family: inherit;position: absolute;left: 0;top: 0;}.hi-v4-time-picker__input__interact-area:disabled {background: transparent;}.hi-v4-time-picker__input__interact-area::-webkit-input-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area::-moz-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area::-ms-input-placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker__input__interact-area::placeholder {color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::-webkit-input-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::-moz-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::-ms-input-placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker--appearance-unset .hi-v4-time-picker__input__interact-area::placeholder {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-time-picker__pop-content {display: -webkit-box;display: -ms-flexbox;display: flex;width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;position: relative;-webkit-box-align: stretch;-ms-flex-align: stretch;align-items: stretch;min-width: 100%;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-time-picker__pop-content__separator {width: 1px;background-color: var(--hi-v4-color-gray-100, #f2f4f7);border-left: none;border-right: none;}";
13
12
  __styleInject__(css_248z);
14
-
15
13
  export { css_248z as default };
@@ -8,7 +8,6 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import { TimePickerSelectorType } from '../@types/index.js';
11
-
12
11
  var analysisFormat = function analysisFormat(format) {
13
12
  var searchList = [{
14
13
  identifier: 'HH',
@@ -23,13 +22,11 @@ var analysisFormat = function analysisFormat(format) {
23
22
  var result = [];
24
23
  searchList.forEach(function (_ref) {
25
24
  var identifier = _ref.identifier,
26
- type = _ref.type;
27
-
25
+ type = _ref.type;
28
26
  if (format.includes(identifier)) {
29
27
  result.push(type);
30
28
  }
31
29
  });
32
30
  return result;
33
31
  };
34
-
35
32
  export { analysisFormat };
@@ -8,43 +8,40 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  var disposeInputValue = function disposeInputValue(format, original) {
11
- var inputMaxLength = format.length; // 初步处理(去除前后空格,兼容中文:,去除无效字符,不允许超过长度)
12
-
13
- var rough = original.trim().replace(/[\uff1a]/g, ':').replace(/[^0-9:]/g, '').slice(0, inputMaxLength); // 兼容直接在为空情况下输入 : 的情况
14
-
11
+ var inputMaxLength = format.length;
12
+ // 初步处理(去除前后空格,兼容中文:,去除无效字符,不允许超过长度)
13
+ var rough = original.trim().replace(/[\uff1a]/g, ':').replace(/[^0-9:]/g, '').slice(0, inputMaxLength);
14
+ // 兼容直接在为空情况下输入 : 的情况
15
15
  if (rough === ':') {
16
16
  return '';
17
17
  }
18
-
19
18
  if (/:{2}$/.test(rough)) {
20
19
  return rough.slice(0, rough.length - 1);
21
- } // 已经输入两个数字了,现在新输入的一个字符不是 : 号
22
-
23
-
20
+ }
21
+ // 已经输入两个数字了,现在新输入的一个字符不是 : 号
24
22
  if (/[0-9]{2}[^:]$/.test(rough)) {
25
23
  // 字符串已经到达最长长度,代表,此时,字符串是一个错乱的,直接忽略新输入的字符
26
24
  if (rough.length === inputMaxLength) {
27
25
  return rough.slice(0, rough.length - 1);
28
- } // 字符串还有添加空间,则自动添加:在新字符前方
26
+ }
27
+ // 字符串还有添加空间,则自动添加:在新字符前方
29
28
  else {
30
29
  return rough.slice(0, rough.length - 1) + ':' + rough.slice(rough.length - 1);
31
30
  }
32
- } // 在某个部分只输入了一个数字,然后输入 : 想要结束这个部分
33
-
34
-
31
+ }
32
+ // 在某个部分只输入了一个数字,然后输入 : 想要结束这个部分
35
33
  if (/:[0-9]:$/.test(rough) || /^[0-9]:$/.test(rough)) {
36
34
  // 已经达到最大输入了,则此时输入的 : 是无效的
37
35
  // 自动转换,去除:,添加 0 在数字前
38
36
  if (rough.length === inputMaxLength) {
39
37
  return rough.slice(0, rough.length - 2) + '0' + rough.slice(rough.length - 2, rough.length - 1);
40
- } // 输入没有达到最大,则,此时输入 : 是有效的
38
+ }
39
+ // 输入没有达到最大,则,此时输入 : 是有效的
41
40
  // 自动补充此章节,添加 0
42
41
  else {
43
42
  return rough.slice(0, rough.length - 2) + '0' + rough.slice(rough.length - 2, rough.length);
44
43
  }
45
44
  }
46
-
47
45
  return rough;
48
46
  };
49
-
50
47
  export { disposeInputValue };
@@ -8,23 +8,19 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import { TimePickerSelectorType } from '../@types/index.js';
11
-
12
11
  var generateSelectorData = function generateSelectorData(info) {
13
12
  var _disabledMap, _rangeMap, _stepMap;
14
-
15
13
  var type = info.type,
16
- filter = info.filter,
17
- step = info.step,
18
- separateValue = info.separateValue,
19
- panelType = info.panelType,
20
- selectorTypes = info.selectorTypes;
14
+ filter = info.filter,
15
+ step = info.step,
16
+ separateValue = info.separateValue,
17
+ panelType = info.panelType,
18
+ selectorTypes = info.selectorTypes;
21
19
  var result = [];
22
-
23
20
  var getMatchTypeValue = function getMatchTypeValue(selectorType) {
24
21
  var matchIndex = selectorTypes.indexOf(selectorType);
25
22
  return matchIndex >= 0 ? separateValue[matchIndex] : -1;
26
23
  };
27
-
28
24
  var disabledMap = (_disabledMap = {}, _disabledMap[TimePickerSelectorType.hour] = function () {
29
25
  return filter.disabledHours(panelType);
30
26
  }, _disabledMap[TimePickerSelectorType.minute] = function () {
@@ -36,7 +32,6 @@ var generateSelectorData = function generateSelectorData(info) {
36
32
  var rangeMap = (_rangeMap = {}, _rangeMap[TimePickerSelectorType.hour] = [0, 23], _rangeMap[TimePickerSelectorType.minute] = [0, 59], _rangeMap[TimePickerSelectorType.second] = [0, 59], _rangeMap);
37
33
  var range = rangeMap[type];
38
34
  var stepMap = (_stepMap = {}, _stepMap[TimePickerSelectorType.hour] = step.hourStep, _stepMap[TimePickerSelectorType.minute] = step.minuteStep, _stepMap[TimePickerSelectorType.second] = step.secondStep, _stepMap);
39
-
40
35
  for (var index = range[0]; index <= range[1]; index += stepMap[type]) {
41
36
  result.push({
42
37
  title: String(index).padStart(2, '0'),
@@ -44,8 +39,6 @@ var generateSelectorData = function generateSelectorData(info) {
44
39
  id: String(index)
45
40
  });
46
41
  }
47
-
48
42
  return result;
49
43
  };
50
-
51
44
  export { generateSelectorData };
@@ -10,5 +10,4 @@
10
10
  var getFormatDefault = function getFormatDefault(format) {
11
11
  return format.replace(/[Hms]/g, '0');
12
12
  };
13
-
14
13
  export { getFormatDefault };
@@ -9,10 +9,8 @@
9
9
  */
10
10
  import { TimePickerSelectorType } from '../@types/index.js';
11
11
  import { analysisFormat } from './analysisFormat.js';
12
-
13
12
  var getNowString = function getNowString(formatString) {
14
13
  var _timeMap;
15
-
16
14
  var format = analysisFormat(formatString);
17
15
  var now = new Date();
18
16
  var timeMap = (_timeMap = {}, _timeMap[TimePickerSelectorType.hour] = String(now.getHours()).padStart(2, '0'), _timeMap[TimePickerSelectorType.minute] = String(now.getMinutes()).padStart(2, '0'), _timeMap[TimePickerSelectorType.second] = String(now.getSeconds()).padStart(2, '0'), _timeMap);
@@ -20,5 +18,4 @@ var getNowString = function getNowString(formatString) {
20
18
  return timeMap[item];
21
19
  }).join(':');
22
20
  };
23
-
24
21
  export { getNowString };
@@ -9,20 +9,15 @@
9
9
  */
10
10
  var getRange = function getRange(min, max) {
11
11
  var result = [];
12
-
13
12
  if (min > max) {
14
13
  return [];
15
14
  }
16
-
17
15
  if (min < 0 || max < 0) {
18
16
  return [];
19
17
  }
20
-
21
18
  for (var counter = min; counter <= max; counter++) {
22
19
  result.push(counter);
23
20
  }
24
-
25
21
  return result;
26
22
  };
27
-
28
23
  export { getRange };
@@ -9,15 +9,13 @@
9
9
  */
10
10
  import { TimePickerSelectorType } from '../@types/index.js';
11
11
  import { analysisFormat } from './analysisFormat.js';
12
-
13
12
  var valueChecker = function valueChecker(info) {
14
13
  var _checkerMap, _disabledMap, _stepMap;
15
-
16
14
  var value = info.value,
17
- format = info.format,
18
- filter = info.filter,
19
- panelType = info.panelType,
20
- step = info.step;
15
+ format = info.format,
16
+ filter = info.filter,
17
+ panelType = info.panelType,
18
+ step = info.step;
21
19
  var selectorTypes = analysisFormat(format);
22
20
  var checkerMap = (_checkerMap = {}, _checkerMap[TimePickerSelectorType.hour] = function (e) {
23
21
  return e >= 0 && e <= 23;
@@ -25,31 +23,26 @@ var valueChecker = function valueChecker(info) {
25
23
  return e >= 0 && e <= 59;
26
24
  }, _checkerMap[TimePickerSelectorType.second] = function (e) {
27
25
  return e >= 0 && e <= 59;
28
- }, _checkerMap); // 允许为空的情况
29
-
26
+ }, _checkerMap);
27
+ // 允许为空的情况
30
28
  if (value === '') {
31
29
  return true;
32
30
  }
33
-
34
31
  if (!value) {
35
32
  return false;
36
33
  }
37
-
38
34
  var separateParts = value.split(':').filter(function (item) {
39
35
  return !!item && item.length === 2;
40
36
  }).map(function (item) {
41
37
  return Number(item);
42
38
  });
43
-
44
39
  if (separateParts.length !== selectorTypes.length) {
45
40
  return false;
46
41
  }
47
-
48
42
  var getMatchTypeValue = function getMatchTypeValue(selectorType) {
49
43
  var matchIndex = selectorTypes.indexOf(selectorType);
50
44
  return matchIndex >= 0 ? separateParts[matchIndex] : -1;
51
45
  };
52
-
53
46
  var disabledMap = (_disabledMap = {}, _disabledMap[TimePickerSelectorType.hour] = function () {
54
47
  return filter.disabledHours(panelType);
55
48
  }, _disabledMap[TimePickerSelectorType.minute] = function () {
@@ -58,22 +51,19 @@ var valueChecker = function valueChecker(info) {
58
51
  return filter.disabledSeconds(getMatchTypeValue(TimePickerSelectorType.hour), getMatchTypeValue(TimePickerSelectorType.minute), panelType);
59
52
  }, _disabledMap);
60
53
  var stepMap = (_stepMap = {}, _stepMap[TimePickerSelectorType.hour] = step.hourStep, _stepMap[TimePickerSelectorType.minute] = step.minuteStep, _stepMap[TimePickerSelectorType.second] = step.secondStep, _stepMap);
61
-
62
54
  for (var counter = 0; counter < separateParts.length; counter++) {
63
55
  var type = selectorTypes[counter];
64
56
  var stepNumber = stepMap[type];
65
57
  var disabledNumbers = disabledMap[type]();
66
58
  var checker = checkerMap[type];
67
- var checkNumber = separateParts[counter]; // 不符合要求的数字
59
+ var checkNumber = separateParts[counter];
60
+ // 不符合要求的数字
68
61
  // 被禁用的数字
69
62
  // 不符合 step 的数字
70
-
71
63
  if (!checker(checkNumber) || disabledNumbers.includes(checkNumber) || checkNumber % stepNumber !== 0) {
72
64
  return false;
73
65
  }
74
66
  }
75
-
76
67
  return true;
77
68
  };
78
-
79
69
  export { valueChecker };