@@ -12,6 +12,9 @@ import dayjs from "dayjs";
12
12
import { useEffect , useRef , useState } from "react" ;
13
13
import styled from "styled-components" ;
14
14
import { TIME_FORMAT } from "util/dateTimeUtils" ;
15
+ import { hasIcon } from "comps/utils" ;
16
+ import { IconControl } from "comps/controls/iconControl" ;
17
+
15
18
16
19
const TimePickerStyled = styled ( TimePicker ) < { $open : boolean } > `
17
20
width: 100%;
@@ -52,6 +55,8 @@ export function formatTime(time: string, format: string) {
52
55
53
56
const childrenMap = {
54
57
text : StringControl ,
58
+ prefixIcon : IconControl ,
59
+ suffixIcon : IconControl ,
55
60
format : withDefault ( StringControl , TIME_FORMAT ) ,
56
61
inputFormat : withDefault ( StringControl , TIME_FORMAT ) ,
57
62
} ;
@@ -118,7 +123,18 @@ export const TimeComp = (function () {
118
123
( props , dispatch ) => {
119
124
inputFormat = props . inputFormat ;
120
125
const value = props . changeValue ?? getBaseValue ( props , dispatch ) ;
121
- return formatTime ( value , props . format ) ;
126
+ return (
127
+ < >
128
+ { hasIcon ( props . prefixIcon ) && (
129
+ < span > { props . prefixIcon } </ span >
130
+ ) }
131
+ < span > { value } </ span >
132
+ { hasIcon ( props . suffixIcon ) && (
133
+ < span > { props . suffixIcon } </ span >
134
+ ) }
135
+ </ >
136
+ ) ;
137
+
122
138
} ,
123
139
( nodeValue ) => formatTime ( nodeValue . text . value , nodeValue . format . value ) ,
124
140
getBaseValue
@@ -137,6 +153,12 @@ export const TimeComp = (function () {
137
153
label : trans ( "table.columnValue" ) ,
138
154
tooltip : ColumnValueTooltip ,
139
155
} ) }
156
+ { children . prefixIcon . propertyView ( {
157
+ label : trans ( "button.prefixIcon" ) ,
158
+ } ) }
159
+ { children . suffixIcon . propertyView ( {
160
+ label : trans ( "button.suffixIcon" ) ,
161
+ } ) }
140
162
{ formatPropertyView ( { children, placeholder : TIME_FORMAT } ) }
141
163
</ >
142
164
) )
0 commit comments