@@ -34,6 +34,7 @@ export interface DDateInputRenderProps {
3434
3535export interface DDateInputProps extends Omit < React . HTMLAttributes < HTMLDivElement > , 'children' > {
3636 children : ( props : DDateInputRenderProps ) => JSX . Element | null ;
37+ dClassNamePrefix : string ;
3738 dFormControl ?: DFormControl ;
3839 dVisible ?: boolean ;
3940 dPlacement ?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' ;
@@ -53,6 +54,7 @@ export interface DDateInputProps extends Omit<React.HTMLAttributes<HTMLDivElemen
5354function DateInput ( props : DDateInputProps , ref : React . ForwardedRef < DDateInputRef > ) : JSX . Element | null {
5455 const {
5556 children,
57+ dClassNamePrefix,
5658 dFormControl,
5759 dVisible,
5860 dPlacement = 'bottom-left' ,
@@ -87,6 +89,8 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
8789 clearTid ?: ( ) => void ;
8890 } > ( { } ) ;
8991
92+ const prefix = `${ dPrefix } ${ dClassNamePrefix } ` ;
93+
9094 const [ dInputRefLeft , dInputRefRight ] = dInputRef ?? [ ] ;
9195 const combineInputRefLeft = useForkRef ( inputRefLeft , dInputRefLeft ) ;
9296 const combineInputRefRight = useForkRef ( inputRefRight , dInputRefRight ) ;
@@ -112,10 +116,10 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
112116 const clearable = dClearable && ! dVisible && ! dDisabled ;
113117
114118 const containerEl = useElement ( ( ) => {
115- let el = document . getElementById ( `${ dPrefix } date-input -root` ) ;
119+ let el = document . getElementById ( `${ prefix } -root` ) ;
116120 if ( ! el ) {
117121 el = document . createElement ( 'div' ) ;
118- el . id = `${ dPrefix } date-input -root` ;
122+ el . id = `${ prefix } -root` ;
119123 document . body . appendChild ( el ) ;
120124 }
121125 return el ;
@@ -199,7 +203,7 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
199203 < DBaseInput
200204 { ...inputProps }
201205 ref = { isLeft ? combineInputRefLeft : combineInputRefRight }
202- className = { getClassName ( inputProps ?. className , `${ dPrefix } date-input__input ` ) }
206+ className = { getClassName ( inputProps ?. className , `${ prefix } __input ` ) }
203207 type = "text"
204208 autoComplete = "off"
205209 disabled = { dDisabled }
@@ -253,8 +257,8 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
253257 < div
254258 { ...restProps }
255259 ref = { boxRef }
256- className = { getClassName ( restProps . className , ` ${ dPrefix } date-input` , {
257- [ `${ dPrefix } date-input --${ dSize } ` ] : dSize ,
260+ className = { getClassName ( restProps . className , prefix , {
261+ [ `${ prefix } --${ dSize } ` ] : dSize ,
258262 'is-disabled' : dDisabled ,
259263 'is-focus' : isFocus ,
260264 } ) }
@@ -280,14 +284,14 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
280284 { getInputNode ( true ) }
281285 { dRange && (
282286 < >
283- < div ref = { indicatorRef } className = { `${ dPrefix } date-input__indicator ` } > </ div >
284- < SwapRightOutlined className = { `${ dPrefix } date-input__separator ` } />
287+ < div ref = { indicatorRef } className = { `${ prefix } __indicator ` } > </ div >
288+ < SwapRightOutlined className = { `${ prefix } __separator ` } />
285289 { getInputNode ( false ) }
286290 </ >
287291 ) }
288292 { clearable && (
289293 < button
290- className = { getClassName ( `${ dPrefix } icon-button` , ` ${ dPrefix } date-input__clear` ) }
294+ className = { `${ prefix } __clear` }
291295 aria-label = { t ( 'Clear' ) }
292296 onClick = { ( e ) => {
293297 e . stopPropagation ( ) ;
@@ -299,7 +303,7 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
299303 </ button >
300304 ) }
301305 { dSuffix && (
302- < div className = { `${ dPrefix } date-input__icon ` } style = { { opacity : clearable ? 0 : 1 } } >
306+ < div className = { `${ prefix } __icon ` } style = { { opacity : clearable ? 0 : 1 } } >
303307 { dSuffix }
304308 </ div >
305309 ) }
0 commit comments