@hw-component/form 1.10.0 → 1.10.1

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.
@@ -42,15 +42,36 @@ var Index = function Index(_ref) {
42
42
  showTime: showTime,
43
43
  showSecond: showSecond
44
44
  });
45
- var pickerFormat = useMemo(function () {
46
- if (!showTime) {
47
- return "YYYY-MM-DD";
48
- }
49
- if (showSecond) {
50
- return "YYYY-MM-DD HH:mm:ss";
51
- }
52
- return "YYYY-MM-DD HH:mm";
53
- }, [showSecond, showTime]);
45
+ var _useMemo = useMemo(function () {
46
+ if (!showTime) {
47
+ return {
48
+ format: "YYYY-MM-DD",
49
+ showTime: showTime
50
+ };
51
+ }
52
+ if (showSecond) {
53
+ var _propsShowTime = typeof showTime === "boolean" ? {
54
+ format: 'HH:mm:ss'
55
+ } : _objectSpread({
56
+ format: 'HH:mm:ss'
57
+ }, showTime);
58
+ return {
59
+ format: "YYYY-MM-DD HH:mm:ss",
60
+ showTime: _propsShowTime
61
+ };
62
+ }
63
+ var propsShowTime = typeof showTime === "boolean" ? {
64
+ format: 'HH:mm'
65
+ } : _objectSpread({
66
+ format: 'HH:mm'
67
+ }, showTime);
68
+ return {
69
+ format: "YYYY-MM-DD HH:mm",
70
+ showTime: propsShowTime
71
+ };
72
+ }, [showSecond, showTime]),
73
+ pickerFormat = _useMemo.format,
74
+ propsShowTime = _useMemo.showTime;
54
75
  return jsxs(Input.Group, {
55
76
  compact: true,
56
77
  style: _objectSpread({
@@ -62,7 +83,7 @@ var Index = function Index(_ref) {
62
83
  }) : null, jsx(Picker, _objectSpread({
63
84
  value: timeVal,
64
85
  onChange: change,
65
- showTime: showTime,
86
+ showTime: propsShowTime,
66
87
  format: pickerFormat,
67
88
  style: {
68
89
  flex: 1
@@ -45,15 +45,36 @@ var Index = function Index(_ref) {
45
45
  showTime: showTime,
46
46
  showSecond: showSecond
47
47
  });
48
- var pickerFormat = React.useMemo(function () {
49
- if (!showTime) {
50
- return "YYYY-MM-DD";
51
- }
52
- if (showSecond) {
53
- return "YYYY-MM-DD HH:mm:ss";
54
- }
55
- return "YYYY-MM-DD HH:mm";
56
- }, [showSecond, showTime]);
48
+ var _useMemo = React.useMemo(function () {
49
+ if (!showTime) {
50
+ return {
51
+ format: "YYYY-MM-DD",
52
+ showTime: showTime
53
+ };
54
+ }
55
+ if (showSecond) {
56
+ var _propsShowTime = typeof showTime === "boolean" ? {
57
+ format: 'HH:mm:ss'
58
+ } : _objectSpread({
59
+ format: 'HH:mm:ss'
60
+ }, showTime);
61
+ return {
62
+ format: "YYYY-MM-DD HH:mm:ss",
63
+ showTime: _propsShowTime
64
+ };
65
+ }
66
+ var propsShowTime = typeof showTime === "boolean" ? {
67
+ format: 'HH:mm'
68
+ } : _objectSpread({
69
+ format: 'HH:mm'
70
+ }, showTime);
71
+ return {
72
+ format: "YYYY-MM-DD HH:mm",
73
+ showTime: propsShowTime
74
+ };
75
+ }, [showSecond, showTime]),
76
+ pickerFormat = _useMemo.format,
77
+ propsShowTime = _useMemo.showTime;
57
78
  return jsxRuntime.jsxs(antd.Input.Group, {
58
79
  compact: true,
59
80
  style: _objectSpread({
@@ -65,7 +86,7 @@ var Index = function Index(_ref) {
65
86
  }) : null, jsxRuntime.jsx(Picker, _objectSpread({
66
87
  value: timeVal,
67
88
  onChange: change,
68
- showTime: showTime,
89
+ showTime: propsShowTime,
69
90
  format: pickerFormat,
70
91
  style: {
71
92
  flex: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,14 +22,26 @@ const Index: React.FC<HDatePickerProps> = ({
22
22
  const timeVal = useTimeVal({ value, format });
23
23
  const addonClassName=useClassName("hw-addon")
24
24
  const change = useTimeChange({ format, onChange, showTime, showSecond });
25
- const pickerFormat = useMemo(() => {
25
+ const {format:pickerFormat,showTime:propsShowTime} = useMemo(() => {
26
26
  if (!showTime) {
27
- return "YYYY-MM-DD";
27
+ return {
28
+ format:"YYYY-MM-DD",
29
+ showTime
30
+ }
28
31
  }
29
32
  if (showSecond) {
30
- return "YYYY-MM-DD HH:mm:ss";
33
+ const propsShowTime=typeof showTime==="boolean"?{ format: 'HH:mm:ss' }:{format: 'HH:mm:ss' ,...showTime };
34
+
35
+ return {
36
+ format: "YYYY-MM-DD HH:mm:ss",
37
+ showTime:propsShowTime
38
+ }
39
+ }
40
+ const propsShowTime=typeof showTime==="boolean"?{ format: 'HH:mm' }:{format: 'HH:mm' ,...showTime };
41
+ return {
42
+ format: "YYYY-MM-DD HH:mm",
43
+ showTime:propsShowTime
31
44
  }
32
- return "YYYY-MM-DD HH:mm";
33
45
  }, [showSecond, showTime]);
34
46
  return (
35
47
  <Input.Group compact style={{display:"flex",...style}}>
@@ -37,7 +49,7 @@ const Index: React.FC<HDatePickerProps> = ({
37
49
  <Picker
38
50
  value={timeVal}
39
51
  onChange={change}
40
- showTime={showTime}
52
+ showTime={propsShowTime}
41
53
  format={pickerFormat}
42
54
  style={{flex:1}}
43
55
  showSecond={showSecond}
@@ -12,7 +12,7 @@ export default () => {
12
12
  <Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
13
13
  <HDatePicker
14
14
  value={timeVal1}
15
- showTime={false}
15
+ showTime
16
16
  addonBefore="你好"
17
17
  addonAfter="我很好"
18
18
  onChange={(val) => {