-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(date-picker): Add needConfirm and onConfirm api (#2979)
- Loading branch information
Showing
11 changed files
with
184 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hi-ui/date-picker": minor | ||
--- | ||
|
||
feat: Add needConfirm and onConfirm api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hi-ui/hiui": patch | ||
--- | ||
|
||
feat(date-picker): Add needConfirm and onConfirm api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { FC, useContext, useMemo } from 'react' | ||
import { useLocaleContext } from '@hi-ui/core' | ||
import HiButton from '@hi-ui/button' | ||
import DPContext from '../context' | ||
|
||
interface FooterProps { | ||
disabled?: boolean | ||
onConfirmButtonClick: () => void | ||
} | ||
|
||
export const Footer: FC<FooterProps> = ({ disabled, onConfirmButtonClick }) => { | ||
const i18n = useLocaleContext() | ||
const { prefixCls, footerRender, size } = useContext(DPContext) | ||
|
||
const footer = useMemo(() => { | ||
const sureActionContent = ( | ||
<HiButton type="primary" disabled={disabled} onClick={onConfirmButtonClick} size={size}> | ||
{i18n.get('datePicker.ok')} | ||
</HiButton> | ||
) | ||
|
||
return typeof footerRender === 'function' ? footerRender(sureActionContent) : sureActionContent | ||
}, [disabled, footerRender, i18n, onConfirmButtonClick, size]) | ||
|
||
return <div className={`${prefixCls}__footer`}>{footer}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.