From 6c656c85f7a64cc1e4e70e511a9e8efed973cdce Mon Sep 17 00:00:00 2001 From: Tantatorn Suksangwarn Date: Sun, 30 Jun 2024 22:17:14 +0700 Subject: [PATCH] feat: Add `okButtonProps` to time picker (#49657) * feat: add `okButtonProps` to pickers' props * doc: add okButtonProps to date, time picker documentation * test: add new test case for TimePicker --- components/date-picker/PickerButton.tsx | 8 - .../generatePicker/generateRangePicker.tsx | 5 +- .../generatePicker/generateSinglePicker.tsx | 5 +- .../date-picker/generatePicker/interface.ts | 4 +- .../generatePicker/useComponents.ts | 14 - .../generatePicker/useComponents.tsx | 21 + components/date-picker/index.en-US.md | 1 + .../__snapshots__/index.test.tsx.snap | 1562 +++++++++++++++++ .../time-picker/__tests__/index.test.tsx | 7 + components/time-picker/index.en-US.md | 1 + 10 files changed, 1601 insertions(+), 27 deletions(-) delete mode 100644 components/date-picker/PickerButton.tsx delete mode 100644 components/date-picker/generatePicker/useComponents.ts create mode 100644 components/date-picker/generatePicker/useComponents.tsx diff --git a/components/date-picker/PickerButton.tsx b/components/date-picker/PickerButton.tsx deleted file mode 100644 index 97af6420ef..0000000000 --- a/components/date-picker/PickerButton.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import * as React from 'react'; - -import Button from '../button'; -import type { ButtonProps } from '../button'; - -export default function PickerButton(props: ButtonProps) { - return + + + + + + + , +] +`; + exports[`TimePicker should support bordered 1`] = `
{ ); expect(container.firstChild).toMatchSnapshot(); }); + + it('should modify the ok button', () => { + const { container } = render( + , + ); + expect(Array.from(container.children)).toMatchSnapshot(); + }); }); diff --git a/components/time-picker/index.en-US.md b/components/time-picker/index.en-US.md index b799c9d67a..8f3ce4a195 100644 --- a/components/time-picker/index.en-US.md +++ b/components/time-picker/index.en-US.md @@ -82,6 +82,7 @@ dayjs.extend(customParseFormat) | onCalendarChange | Callback function, can be executed when the start time or the end time of the range is changing. `info` argument is added in 4.4.0 | function(dates: \[dayjs, dayjs], dateStrings: \[string, string], info: { range:`start`\|`end` }) | - | | | onChange | A callback function, can be executed when the selected time is changing | function(time: dayjs, timeString: string): void | - | | | onOpenChange | A callback function which will be called while panel opening/closing | (open: boolean) => void | - | | +| okButtonProps | The ok button props | [ButtonProps](/components/button/#api) | - | | #### DisabledTime