@titaui/pc 1.11.4-12 → 1.11.4-15
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.
|
@@ -21,7 +21,7 @@ var _utils = require("./utils");
|
|
|
21
21
|
|
|
22
22
|
require("./index.css");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["disabled", "timeFormat", "hourStep", "minuteStep", "onChange", "value"];
|
|
24
|
+
var _excluded = ["disabled", "enableKeyBoard", "timeFormat", "hourStep", "minuteStep", "onChange", "value"];
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
27
|
|
|
@@ -51,6 +51,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
51
51
|
|
|
52
52
|
var TimePicker = function TimePicker(props) {
|
|
53
53
|
var disabled = props.disabled,
|
|
54
|
+
_props$enableKeyBoard = props.enableKeyBoard,
|
|
55
|
+
enableKeyBoard = _props$enableKeyBoard === void 0 ? true : _props$enableKeyBoard,
|
|
54
56
|
_props$timeFormat = props.timeFormat,
|
|
55
57
|
timeFormat = _props$timeFormat === void 0 ? 'hh:mm' : _props$timeFormat,
|
|
56
58
|
_props$hourStep = props.hourStep,
|
|
@@ -83,26 +85,18 @@ var TimePicker = function TimePicker(props) {
|
|
|
83
85
|
|
|
84
86
|
var onTimeChange = function onTimeChange() {
|
|
85
87
|
onChange === null || onChange === void 0 ? void 0 : onChange("".concat(hourRef.current, ":").concat(minuteRef.current));
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
(_mInputRef$current = mInputRef.current) === null || _mInputRef$current === void 0 ? void 0 : _mInputRef$current.focus();
|
|
99
|
-
}
|
|
88
|
+
}; // const onInputClick = (type) => {
|
|
89
|
+
// clearTimeout(timerRef.current)
|
|
90
|
+
// timerRef.current = setTimeout(() => {
|
|
91
|
+
// if (type === 'hour') {
|
|
92
|
+
// hInputRef.current?.focus()
|
|
93
|
+
// } else {
|
|
94
|
+
// mInputRef.current?.focus()
|
|
95
|
+
// }
|
|
96
|
+
// setTimeSettingType(() => type)
|
|
97
|
+
// }, 0)
|
|
98
|
+
// }
|
|
100
99
|
|
|
101
|
-
setTimeSettingType(function () {
|
|
102
|
-
return type;
|
|
103
|
-
});
|
|
104
|
-
}, 0);
|
|
105
|
-
};
|
|
106
100
|
|
|
107
101
|
var onFocusHandler = function onFocusHandler(type) {
|
|
108
102
|
setTimeSettingType(function () {
|
|
@@ -254,8 +248,9 @@ var TimePicker = function TimePicker(props) {
|
|
|
254
248
|
|
|
255
249
|
(0, _react.useEffect)(function () {
|
|
256
250
|
document.removeEventListener('keydown', handleKeyDown);
|
|
257
|
-
timeSetingtType && document.addEventListener('keydown', handleKeyDown);
|
|
251
|
+
enableKeyBoard && timeSetingtType && document.addEventListener('keydown', handleKeyDown);
|
|
258
252
|
return function () {
|
|
253
|
+
clearTimeout(timerRef.current);
|
|
259
254
|
document.removeEventListener('keydown', handleKeyDown);
|
|
260
255
|
};
|
|
261
256
|
}, [timeSetingtType]);
|
|
@@ -273,10 +268,8 @@ var TimePicker = function TimePicker(props) {
|
|
|
273
268
|
disabled: disabled,
|
|
274
269
|
maxLength: 2,
|
|
275
270
|
onBlur: onHourInputBlur,
|
|
276
|
-
onChange: onHourInputChange
|
|
277
|
-
|
|
278
|
-
return onInputClick('hour');
|
|
279
|
-
},
|
|
271
|
+
onChange: onHourInputChange // onClick={() => onInputClick('hour')}
|
|
272
|
+
,
|
|
280
273
|
onFocus: function onFocus() {
|
|
281
274
|
return onFocusHandler('hour');
|
|
282
275
|
},
|
|
@@ -289,10 +282,8 @@ var TimePicker = function TimePicker(props) {
|
|
|
289
282
|
disabled: disabled,
|
|
290
283
|
maxLength: 2,
|
|
291
284
|
onBlur: onMinuteInputBlur,
|
|
292
|
-
onChange: onMinuteInputChange
|
|
293
|
-
|
|
294
|
-
return onInputClick('minute');
|
|
295
|
-
},
|
|
285
|
+
onChange: onMinuteInputChange // onClick={() => onInputClick('minute')}
|
|
286
|
+
,
|
|
296
287
|
onFocus: function onFocus() {
|
|
297
288
|
return onFocusHandler('minute');
|
|
298
289
|
},
|
|
@@ -32,7 +32,7 @@ var TimePickerInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
32
32
|
_props$stopPropagatio = props.stopPropagation,
|
|
33
33
|
stopPropagation = _props$stopPropagatio === void 0 ? true : _props$stopPropagatio,
|
|
34
34
|
_props$type = props.type,
|
|
35
|
-
type = _props$type === void 0 ?
|
|
35
|
+
type = _props$type === void 0 ? 'text' : _props$type,
|
|
36
36
|
value = props.value,
|
|
37
37
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
38
38
|
|
|
@@ -80,6 +80,8 @@ var TimePickerInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
80
80
|
setSelectionRange(changeTimeout);
|
|
81
81
|
}, [value]);
|
|
82
82
|
return /*#__PURE__*/_react["default"].createElement("input", _extends({
|
|
83
|
+
autoFocus: false,
|
|
84
|
+
autoComplete: "off",
|
|
83
85
|
className: className,
|
|
84
86
|
maxLength: maxLength,
|
|
85
87
|
onClick: onClickHandler,
|