@hi-ui/time-picker 4.0.6 → 4.0.8
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/lib/cjs/TimePicker.js +10 -6
- package/lib/esm/TimePicker.js +10 -6
- package/package.json +2 -2
package/lib/cjs/TimePicker.js
CHANGED
@@ -63,14 +63,18 @@ var DefaultDisabledFunc = function DefaultDisabledFunc() {
|
|
63
63
|
|
64
64
|
var DefaultPlaceholder = ['', ''];
|
65
65
|
|
66
|
-
var getValueMatchString = function getValueMatchString(value) {
|
66
|
+
var getValueMatchString = function getValueMatchString(value, format) {
|
67
|
+
if (format === void 0) {
|
68
|
+
format = 'HH:mm:ss';
|
69
|
+
}
|
70
|
+
|
67
71
|
if (!value) {
|
68
72
|
return undefined;
|
69
73
|
}
|
70
74
|
|
71
75
|
var result = Array.isArray(value) ? value : [value];
|
72
76
|
return result.map(function (item) {
|
73
|
-
return typeof item === 'string' ? item : DayJs__default["default"](item).format(
|
77
|
+
return typeof item === 'string' ? item : DayJs__default["default"](item).format(format);
|
74
78
|
});
|
75
79
|
};
|
76
80
|
|
@@ -124,11 +128,11 @@ var TimePicker = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
124
128
|
setAttachEl = _useState[1];
|
125
129
|
|
126
130
|
var formatUncontrolledValue = React.useMemo(function () {
|
127
|
-
return getValueMatchString(uncontrolledValue);
|
128
|
-
}, [uncontrolledValue]);
|
131
|
+
return getValueMatchString(uncontrolledValue, format);
|
132
|
+
}, [format, uncontrolledValue]);
|
129
133
|
var formatControlledValue = React.useMemo(function () {
|
130
|
-
return getValueMatchString(controlledValue);
|
131
|
-
}, [controlledValue]);
|
134
|
+
return getValueMatchString(controlledValue, format);
|
135
|
+
}, [controlledValue, format]);
|
132
136
|
var formatNotifyOutside = React.useCallback(function (disposeValue) {
|
133
137
|
var result = disposeValue.filter(function (item) {
|
134
138
|
return item;
|
package/lib/esm/TimePicker.js
CHANGED
@@ -31,14 +31,18 @@ var DefaultDisabledFunc = function DefaultDisabledFunc() {
|
|
31
31
|
|
32
32
|
var DefaultPlaceholder = ['', ''];
|
33
33
|
|
34
|
-
var getValueMatchString = function getValueMatchString(value) {
|
34
|
+
var getValueMatchString = function getValueMatchString(value, format) {
|
35
|
+
if (format === void 0) {
|
36
|
+
format = 'HH:mm:ss';
|
37
|
+
}
|
38
|
+
|
35
39
|
if (!value) {
|
36
40
|
return undefined;
|
37
41
|
}
|
38
42
|
|
39
43
|
var result = Array.isArray(value) ? value : [value];
|
40
44
|
return result.map(function (item) {
|
41
|
-
return typeof item === 'string' ? item : DayJs(item).format(
|
45
|
+
return typeof item === 'string' ? item : DayJs(item).format(format);
|
42
46
|
});
|
43
47
|
};
|
44
48
|
|
@@ -92,11 +96,11 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
92
96
|
setAttachEl = _useState[1];
|
93
97
|
|
94
98
|
var formatUncontrolledValue = useMemo(function () {
|
95
|
-
return getValueMatchString(uncontrolledValue);
|
96
|
-
}, [uncontrolledValue]);
|
99
|
+
return getValueMatchString(uncontrolledValue, format);
|
100
|
+
}, [format, uncontrolledValue]);
|
97
101
|
var formatControlledValue = useMemo(function () {
|
98
|
-
return getValueMatchString(controlledValue);
|
99
|
-
}, [controlledValue]);
|
102
|
+
return getValueMatchString(controlledValue, format);
|
103
|
+
}, [controlledValue, format]);
|
100
104
|
var formatNotifyOutside = useCallback(function (disposeValue) {
|
101
105
|
var result = disposeValue.filter(function (item) {
|
102
106
|
return item;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hi-ui/time-picker",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.8",
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
5
5
|
"keywords": [],
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
@@ -64,5 +64,5 @@
|
|
64
64
|
"react": "^17.0.1",
|
65
65
|
"react-dom": "^17.0.1"
|
66
66
|
},
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "619fb2b1774e927c016d9e58117fd4bf0d0364f3"
|
68
68
|
}
|