diff --git a/.changeset/cyan-rules-sparkle.md b/.changeset/cyan-rules-sparkle.md new file mode 100644 index 000000000..8cfb313ca --- /dev/null +++ b/.changeset/cyan-rules-sparkle.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/date-picker": minor +--- + +feat: 新增前缀后缀内容扩展 diff --git a/.changeset/funny-zebras-pretend.md b/.changeset/funny-zebras-pretend.md new file mode 100644 index 000000000..c02b91d3a --- /dev/null +++ b/.changeset/funny-zebras-pretend.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +feat(date-picker): 新增前缀后缀内容扩展 diff --git a/packages/ui/date-picker/src/DatePicker.tsx b/packages/ui/date-picker/src/DatePicker.tsx index 6524fb284..cdda14389 100644 --- a/packages/ui/date-picker/src/DatePicker.tsx +++ b/packages/ui/date-picker/src/DatePicker.tsx @@ -78,6 +78,7 @@ export const DatePicker = forwardRef( cellRender, footerRender, strideSelectMode = 'auto', + prefix, ...otherProps }, ref @@ -441,6 +442,7 @@ export const DatePicker = forwardRef( setAttachEl={setAttachEl} dateRangeTimePanelNow={dateRangeTimePanelNow} invalid={invalid} + prefix={prefix} /> void onClear: () => void @@ -23,6 +24,7 @@ const Root = ({ inputChangeEvent: InputChangeEvent dateRangeTimePanelNow: number invalid: boolean + prefix: React.ReactNode }) => { const { i18n, @@ -136,6 +138,7 @@ const Root = ({ return (
+ {prefix ? {prefix} : null}
, 'placehold * @default 'auto' */ strideSelectMode?: 'auto' | 'fixed' + /** + * 选择框前置内容 + */ + prefix?: React.ReactNode } diff --git a/packages/ui/date-picker/stories/addon.stories.tsx b/packages/ui/date-picker/stories/addon.stories.tsx new file mode 100644 index 000000000..eaf00b8b3 --- /dev/null +++ b/packages/ui/date-picker/stories/addon.stories.tsx @@ -0,0 +1,22 @@ +import React from 'react' +import DatePicker from '../src' +import { AppStoreOutlined } from '@hi-ui/icons' + +/** + * @title 前置后置内容扩展 + */ +export const Addon = () => { + return ( +
+

Addon

+ { + console.log('onChange', date, dateStr) + }} + onSelect={console.log} + prefix={} + /> +
+ ) +} diff --git a/packages/ui/date-picker/stories/index.stories.tsx b/packages/ui/date-picker/stories/index.stories.tsx index 3ec21ef85..f8695174b 100644 --- a/packages/ui/date-picker/stories/index.stories.tsx +++ b/packages/ui/date-picker/stories/index.stories.tsx @@ -11,6 +11,7 @@ export * from './shortcut.stories' export * from './lunar.stories' export * from './size.stories' export * from './footer-render.stories' +export * from './addon.stories' export default { title: 'Data Input/DatePicker',