@hi-ui/time-picker 4.0.10 → 4.0.11
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.
- package/CHANGELOG.md +15 -0
- package/lib/cjs/@types/index.js +0 -4
- package/lib/cjs/Input.js +33 -63
- package/lib/cjs/Panel.js +21 -45
- package/lib/cjs/PopContent.js +46 -77
- package/lib/cjs/Selector.js +22 -44
- package/lib/cjs/TimePicker.js +80 -132
- package/lib/cjs/hooks/useFilter.js +0 -8
- package/lib/cjs/index.js +0 -5
- package/lib/cjs/styles/index.scss.js +1 -4
- package/lib/cjs/utils/analysisFormat.js +1 -8
- package/lib/cjs/utils/disposeInputValue.js +12 -19
- package/lib/cjs/utils/generateSelectorData.js +5 -16
- package/lib/cjs/utils/getFormatDefault.js +0 -5
- package/lib/cjs/utils/getNowString.js +0 -8
- package/lib/cjs/utils/getRange.js +0 -9
- package/lib/cjs/utils/valueChecker.js +8 -23
- package/lib/esm/@types/index.js +0 -2
- package/lib/esm/Input.js +28 -39
- package/lib/esm/Panel.js +16 -22
- package/lib/esm/PopContent.js +43 -53
- package/lib/esm/Selector.js +16 -22
- package/lib/esm/TimePicker.js +70 -92
- package/lib/esm/hooks/useFilter.js +0 -4
- package/lib/esm/styles/index.scss.js +1 -3
- package/lib/esm/utils/analysisFormat.js +1 -4
- package/lib/esm/utils/disposeInputValue.js +12 -15
- package/lib/esm/utils/generateSelectorData.js +5 -12
- package/lib/esm/utils/getFormatDefault.js +0 -1
- package/lib/esm/utils/getNowString.js +0 -3
- package/lib/esm/utils/getRange.js +0 -5
- package/lib/esm/utils/valueChecker.js +8 -18
- package/package.json +10 -10
package/lib/esm/PopContent.js
CHANGED
@@ -15,39 +15,36 @@ import { analysisFormat } from './utils/analysisFormat.js';
|
|
15
15
|
import { getFormatDefault } from './utils/getFormatDefault.js';
|
16
16
|
import { timePickerPrefix } from './TimePicker.js';
|
17
17
|
import { useFilter } from './hooks/useFilter.js';
|
18
|
-
|
19
18
|
var DefaultDisabledFunc = function DefaultDisabledFunc() {
|
20
19
|
return [];
|
21
20
|
};
|
22
|
-
|
23
21
|
var PopContent = function PopContent(props) {
|
24
22
|
var _props$prefix = props.prefix,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
23
|
+
prefix = _props$prefix === void 0 ? timePickerPrefix : _props$prefix,
|
24
|
+
dangerousValue = props.value,
|
25
|
+
_onChange = props.onChange,
|
26
|
+
format = props.format,
|
27
|
+
type = props.type,
|
28
|
+
hourStep = props.hourStep,
|
29
|
+
minuteStep = props.minuteStep,
|
30
|
+
secondStep = props.secondStep,
|
31
|
+
_props$disabledHours = props.disabledHours,
|
32
|
+
originalDisabledHours = _props$disabledHours === void 0 ? DefaultDisabledFunc : _props$disabledHours,
|
33
|
+
_props$disabledSecond = props.disabledSeconds,
|
34
|
+
originalDisabledSeconds = _props$disabledSecond === void 0 ? DefaultDisabledFunc : _props$disabledSecond,
|
35
|
+
_props$disabledMinute = props.disabledMinutes,
|
36
|
+
originalDisabledMinutes = _props$disabledMinute === void 0 ? DefaultDisabledFunc : _props$disabledMinute,
|
37
|
+
style = props.style;
|
38
|
+
// 将值统一转化为函数
|
40
39
|
// 由于 pop content 会被 date-picker 直接调用,故而在此多做一次兼容处理
|
41
|
-
|
42
40
|
var _useFilter = useFilter({
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
disabledHours: originalDisabledHours,
|
42
|
+
disabledMinutes: originalDisabledMinutes,
|
43
|
+
disabledSeconds: originalDisabledSeconds
|
44
|
+
}),
|
45
|
+
disabledHours = _useFilter.disabledHours,
|
46
|
+
disabledMinutes = _useFilter.disabledMinutes,
|
47
|
+
disabledSeconds = _useFilter.disabledSeconds;
|
51
48
|
var value = useMemo(function () {
|
52
49
|
return dangerousValue.map(function (item) {
|
53
50
|
return item || getFormatDefault(format);
|
@@ -76,75 +73,68 @@ var PopContent = function PopContent(props) {
|
|
76
73
|
}, [selectorTypes]);
|
77
74
|
var customDisabledHours = useCallback(function (panel) {
|
78
75
|
var result = disabledHours(panel);
|
79
|
-
|
80
76
|
if (panel === 'range-end') {
|
81
77
|
var startHour = getMatchTypeValue(0, TimePickerSelectorType.hour);
|
82
|
-
var isLastOne = judgeTypeIsLastOne(TimePickerSelectorType.hour);
|
78
|
+
var isLastOne = judgeTypeIsLastOne(TimePickerSelectorType.hour);
|
79
|
+
// 当当前类型为最后一个类型的时候
|
83
80
|
// 不能够选择与开始一致的值
|
84
|
-
|
85
81
|
result = [].concat(result, getRange(0, isLastOne ? startHour : startHour - 1));
|
86
82
|
}
|
87
|
-
|
88
83
|
return result;
|
89
84
|
}, [getMatchTypeValue, disabledHours, judgeTypeIsLastOne]);
|
90
85
|
var customDisabledMinute = useCallback(function (hour, panel) {
|
91
86
|
var result = disabledMinutes(hour, panel);
|
92
|
-
|
93
87
|
if (panel === 'range-end') {
|
94
88
|
var startHour = getMatchTypeValue(0, TimePickerSelectorType.hour);
|
95
|
-
var startMinute = getMatchTypeValue(0, TimePickerSelectorType.minute);
|
89
|
+
var startMinute = getMatchTypeValue(0, TimePickerSelectorType.minute);
|
90
|
+
// 当前类型中包含了小时
|
96
91
|
// minute 有值
|
97
|
-
|
98
92
|
if (hour >= 0) {
|
99
93
|
// 开始时间等于结束时间,则直接禁用开始时间之前的时间
|
100
94
|
if (startHour === hour) {
|
101
|
-
var isLastOne = judgeTypeIsLastOne(TimePickerSelectorType.minute);
|
95
|
+
var isLastOne = judgeTypeIsLastOne(TimePickerSelectorType.minute);
|
96
|
+
// 当当前类型为最后一个类型的时候
|
102
97
|
// 不能够选择与开始一致的值
|
103
|
-
|
104
98
|
result = [].concat(result, getRange(0, isLastOne ? startMinute : startMinute - 1));
|
105
|
-
}
|
99
|
+
}
|
100
|
+
// 开始时间大于结束时间,直接禁用所有
|
106
101
|
else if (startHour > hour) {
|
107
102
|
result = [].concat(result, getRange(0, 59));
|
108
103
|
}
|
109
104
|
}
|
110
105
|
}
|
111
|
-
|
112
106
|
return result;
|
113
107
|
}, [getMatchTypeValue, judgeTypeIsLastOne, disabledMinutes]);
|
114
108
|
var customDisabledSeconds = useCallback(function (hour, minute, panel) {
|
115
109
|
var result = disabledSeconds(hour, minute, panel);
|
116
|
-
|
117
110
|
if (panel === 'range-end') {
|
118
111
|
var startHour = getMatchTypeValue(0, TimePickerSelectorType.hour);
|
119
112
|
var startMinute = getMatchTypeValue(0, TimePickerSelectorType.minute);
|
120
113
|
var startSecond = getMatchTypeValue(0, TimePickerSelectorType.second);
|
121
|
-
var allDisabled = false;
|
122
|
-
|
114
|
+
var allDisabled = false;
|
115
|
+
// 如果小时存在,并且开始小时大于结束,禁用所有秒
|
123
116
|
if (hour >= 0 && startHour > hour) {
|
124
117
|
allDisabled = true;
|
125
|
-
}
|
126
|
-
|
127
|
-
|
118
|
+
}
|
119
|
+
// 如果小时存在,并且开始结束小时一样,并且开始分钟大于结束分钟,禁用所有秒
|
128
120
|
if (hour >= 0 && startHour === hour && minute >= 0 && startMinute > minute) {
|
129
121
|
allDisabled = true;
|
130
122
|
}
|
131
|
-
|
132
123
|
if (allDisabled) {
|
133
124
|
result = [].concat(result, getRange(0, 59));
|
134
125
|
} else {
|
135
126
|
// hour 不存在 或者存在并且开始与结束相同
|
136
127
|
// 则视作,小时相等
|
137
|
-
var isHourEqual = hour < 0 || startHour === hour;
|
128
|
+
var isHourEqual = hour < 0 || startHour === hour;
|
129
|
+
// minute 不存在 或者存在并且开始与结束相同
|
138
130
|
// 则视作,分钟相等
|
139
|
-
|
140
|
-
|
141
|
-
|
131
|
+
var isMinuteEqual = minute < 0 || startMinute === minute;
|
132
|
+
// 分钟小时相等,则需要根据 开始 秒 做禁用处理
|
142
133
|
if (isHourEqual && isMinuteEqual) {
|
143
134
|
result = [].concat(result, getRange(0, startSecond));
|
144
135
|
}
|
145
136
|
}
|
146
137
|
}
|
147
|
-
|
148
138
|
return result;
|
149
139
|
}, [getMatchTypeValue, disabledSeconds]);
|
150
140
|
var componentClass = useMemo(function () {
|
@@ -153,7 +143,8 @@ var PopContent = function PopContent(props) {
|
|
153
143
|
var renderPanel = useCallback(function (index) {
|
154
144
|
return /*#__PURE__*/React.createElement("div", {
|
155
145
|
className: componentClass + "__panel-container"
|
156
|
-
}, /*#__PURE__*/React.createElement(Panel
|
146
|
+
}, /*#__PURE__*/React.createElement(Panel
|
147
|
+
// itemHeight={itemHeight}
|
157
148
|
// fullDisplayItemNumber={fullDisplayItemNumber}
|
158
149
|
, {
|
159
150
|
// itemHeight={itemHeight}
|
@@ -171,11 +162,11 @@ var PopContent = function PopContent(props) {
|
|
171
162
|
onChange: function onChange(e) {
|
172
163
|
var result = [].concat(value);
|
173
164
|
result[index] = e;
|
174
|
-
|
175
165
|
_onChange(result);
|
176
166
|
}
|
177
167
|
}));
|
178
|
-
}, [hourStep, minuteStep, secondStep, customDisabledHours, customDisabledMinute, customDisabledSeconds, format, prefix, type, value, _onChange,
|
168
|
+
}, [hourStep, minuteStep, secondStep, customDisabledHours, customDisabledMinute, customDisabledSeconds, format, prefix, type, value, _onChange,
|
169
|
+
// fullDisplayItemNumber,
|
179
170
|
// itemHeight,
|
180
171
|
componentClass]);
|
181
172
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -185,5 +176,4 @@ var PopContent = function PopContent(props) {
|
|
185
176
|
className: componentClass + "__separator"
|
186
177
|
}), type === 'range' && renderPanel(1));
|
187
178
|
};
|
188
|
-
|
189
179
|
export { PopContent };
|
package/lib/esm/Selector.js
CHANGED
@@ -10,23 +10,21 @@
|
|
10
10
|
import React, { useRef, useCallback, useEffect } from 'react';
|
11
11
|
import { cx } from '@hi-ui/classname';
|
12
12
|
var SelectorPosition;
|
13
|
-
|
14
13
|
(function (SelectorPosition) {
|
15
14
|
SelectorPosition["left"] = "left";
|
16
15
|
SelectorPosition["right"] = "right";
|
17
16
|
SelectorPosition["middle"] = "middle";
|
18
17
|
SelectorPosition["single"] = "single";
|
19
18
|
})(SelectorPosition || (SelectorPosition = {}));
|
20
|
-
|
21
19
|
var Selector = function Selector(props) {
|
22
20
|
var prefix = props.prefix,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
value = props.value,
|
22
|
+
data = props.data,
|
23
|
+
onChange = props.onChange,
|
24
|
+
position = props.position;
|
27
25
|
var componentPrefix = prefix + "__selector";
|
28
|
-
var stopScrollTimeoutHandler = useRef(-1);
|
29
|
-
|
26
|
+
var stopScrollTimeoutHandler = useRef(-1);
|
27
|
+
// 滚动容器引用
|
30
28
|
var scrollContainerRef = useRef(null);
|
31
29
|
var topItemGagerRef = useRef(null);
|
32
30
|
var bottomItemGagerRef = useRef(null);
|
@@ -41,22 +39,20 @@ var Selector = function Selector(props) {
|
|
41
39
|
}, []);
|
42
40
|
var onScroll = useCallback(function (e) {
|
43
41
|
e.persist();
|
44
|
-
e.stopPropagation();
|
45
|
-
|
46
|
-
clearTimeout(stopScrollTimeoutHandler.current);
|
47
|
-
|
42
|
+
e.stopPropagation();
|
43
|
+
// 清除用做判断是否滚动停止的定时器
|
44
|
+
clearTimeout(stopScrollTimeoutHandler.current);
|
45
|
+
// 计算当前选中的 index 下标
|
48
46
|
var currentIndex = calcCurrentIndex(e.target.scrollTop);
|
49
|
-
|
50
47
|
if (currentIndex > data.length) {
|
51
48
|
currentIndex = data.length - 1;
|
52
|
-
}
|
49
|
+
}
|
50
|
+
// 200ms 后如果事件没有再次响应,则视作滚动停止
|
53
51
|
// 不论是否禁用,我们都需要自动滚动到对应 index
|
54
|
-
|
55
|
-
|
56
52
|
stopScrollTimeoutHandler.current = setTimeout(function () {
|
57
|
-
scrollToMatchIndex(currentIndex);
|
53
|
+
scrollToMatchIndex(currentIndex);
|
54
|
+
// 通知外部改变
|
58
55
|
// 如果当前 item 被禁用了,则无通知
|
59
|
-
|
60
56
|
if (!data[currentIndex].disabled) {
|
61
57
|
onChange(data[currentIndex]);
|
62
58
|
}
|
@@ -70,9 +66,9 @@ var Selector = function Selector(props) {
|
|
70
66
|
useEffect(function () {
|
71
67
|
var currentIndex = data.findIndex(function (item) {
|
72
68
|
return item.id === value;
|
73
|
-
});
|
69
|
+
});
|
70
|
+
// 避免非法值跳转
|
74
71
|
// 避免重复执行操作,只有当 value 对应的下标改变的时候才需要执行
|
75
|
-
|
76
72
|
if (currentIndex >= 0 && lastValueMatchIndexCache.current !== currentIndex) {
|
77
73
|
lastValueMatchIndexCache.current = currentIndex;
|
78
74
|
scrollToMatchIndex(currentIndex);
|
@@ -88,7 +84,6 @@ var Selector = function Selector(props) {
|
|
88
84
|
className: cx(componentPrefix + "__scroll-part", componentPrefix + "__demarcate")
|
89
85
|
}, data.map(function (item, index) {
|
90
86
|
var _cx;
|
91
|
-
|
92
87
|
return /*#__PURE__*/React.createElement("div", {
|
93
88
|
className: cx(componentPrefix + "__item", componentPrefix + "__demarcate", (_cx = {}, _cx[componentPrefix + "__item--disabled"] = item.disabled, _cx[componentPrefix + "__item--active"] = item.id === value, _cx)),
|
94
89
|
key: item.id,
|
@@ -113,5 +108,4 @@ var Selector = function Selector(props) {
|
|
113
108
|
ref: bottomItemGagerRef
|
114
109
|
}))));
|
115
110
|
};
|
116
|
-
|
117
111
|
export { Selector, SelectorPosition };
|
package/lib/esm/TimePicker.js
CHANGED
@@ -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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
-
|
96
|
-
|
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
|
-
|
117
|
-
|
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
|
-
|
126
|
-
|
127
|
-
|
113
|
+
isInputValid = _useState2[0],
|
114
|
+
setIsInputValid = _useState2[1];
|
128
115
|
var _useState3 = useState(value),
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
116
|
+
cacheValue = _useState3[0],
|
117
|
+
setCacheValue = _useState3[1];
|
118
|
+
var cacheValueRef = useRef(cacheValue);
|
119
|
+
// 将值统一转化为函数
|
134
120
|
var _useFilter = useFilter({
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
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
|
-
|
199
|
-
|
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,7 +196,6 @@ 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
|
}
|
@@ -278,17 +259,17 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
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));
|
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
|
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;
|
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
|
-
|
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 };
|