Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5257563
refactor(RangePicker): add interaction hooks
zombieJ Jul 20, 2026
d33c1c6
refactor(RangePicker): centralize interaction flow
zombieJ Jul 20, 2026
555604e
refactor(RangePicker): track focus containers by ref
zombieJ Jul 20, 2026
1715d99
refactor(RangePicker): clarify focus target helpers
zombieJ Jul 21, 2026
446ef71
refactor(RangePicker): inline focus container check
zombieJ Jul 21, 2026
27091ef
refactor(RangePicker): separate focus events and lock
zombieJ Jul 21, 2026
a915950
refactor(RangePicker): suspend effect submit flow
zombieJ Jul 21, 2026
3398678
refactor(RangePicker): use synchronized index state
zombieJ Jul 21, 2026
10dbcd9
refactor(RangePicker): simplify triggered field tracking
zombieJ Jul 21, 2026
ee1f555
docs(RangePicker): clarify value change helpers
zombieJ Jul 21, 2026
2a86a4f
fix(RangePicker): guard value changes by field index
zombieJ Jul 21, 2026
419e49f
refactor(RangePicker): initialize field flow centrally
zombieJ Jul 21, 2026
2400a33
refactor(RangePicker): unify field index routing
zombieJ Jul 21, 2026
43a0bb5
feat(RangePicker): reset interaction on Escape
zombieJ Jul 21, 2026
ad4135b
refactor(RangePicker): resolve value change actions
zombieJ Jul 21, 2026
f42d2de
style(RangePicker): organize value change hook
zombieJ Jul 21, 2026
5a77c97
refactor(RangePicker): expose inputs from selector ref
zombieJ Jul 21, 2026
71b4039
refactor(Picker): suspend last operation tracking
zombieJ Jul 21, 2026
2177fcd
refactor(RangePicker): centralize active field state
zombieJ Jul 21, 2026
b53b7d1
refactor(Picker): restore range active hook
zombieJ Jul 21, 2026
8216378
fix(RangePicker): preserve active field on submit
zombieJ Jul 21, 2026
4d22081
refactor(RangePicker): retain active field with ref
zombieJ Jul 21, 2026
b029ae3
refactor(RangePicker): simplify active field tracking
zombieJ Jul 21, 2026
a03ed7e
refactor(Picker): unify single field submission
zombieJ Jul 21, 2026
898dfd2
refactor(RangePicker): refine field transitions
zombieJ Jul 21, 2026
4faf62d
fix(RangePicker): refine value and focus transitions
zombieJ Jul 22, 2026
87c4c07
fix(RangePicker): reset unconfirmed allow-empty field
zombieJ Jul 22, 2026
6b4fb6f
fix(RangePicker): submit confirmed partial value on blur
zombieJ Jul 22, 2026
b7e6488
refactor(Picker): remove obsolete interaction code
zombieJ Jul 22, 2026
c6e0639
docs(RangePicker): update interaction flow
zombieJ Jul 22, 2026
37c4e01
fix(RangePicker): avoid ref mutation during render
zombieJ Jul 22, 2026
064e683
Revert "fix(RangePicker): avoid ref mutation during render"
zombieJ Jul 22, 2026
61495f4
ci: pin React Doctor CLI version
zombieJ Jul 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/react-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
fetch-depth: 0
persist-credentials: false
- uses: millionco/react-doctor@ced746f518f11e8283d488c4ff31c44e478bb0e5
with:
version: 0.7.4
103 changes: 16 additions & 87 deletions docs/examples/debug.tsx
Original file line number Diff line number Diff line change
@@ -1,110 +1,39 @@
import * as React from 'react';
import '../../assets/index.less';
import type { Locale } from '../../src/interface';
import RangePicker from '../../src/PickerInput/RangePicker';
import SinglePicker from '../../src/PickerInput/SinglePicker';
import PickerPanel from '../../src/PickerPanel';

import dayjs, { type Dayjs } from 'dayjs';
import 'dayjs/locale/ar';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import buddhistEra from 'dayjs/plugin/buddhistEra';
import LocalizedFormat from 'dayjs/plugin/localizedFormat';
import dayjsGenerateConfig from '../../src/generate/dayjs';
import dateFnsGenerateConfig from '../../src/generate/dateFns';
import zhCN from '../../src/locale/zh_CN';

dayjs.locale('zh-cn');
// dayjs.locale('ar');
dayjs.extend(buddhistEra);
dayjs.extend(LocalizedFormat);

console.clear();

(window as any).dayjs = dayjs;

const myLocale: Locale = {
...zhCN,
// cellQuarterFormat: '第Q季度',
// fieldYearFormat: 'BBBB',
// cellYearFormat: 'BBBB',
// yearFormat: 'BBBB',
// cellDateFormat: '!d!',
};

const sharedLocale = {
locale: myLocale,
generateConfig: dayjsGenerateConfig,
};

const dateFnsSharedLocale = {
locale: myLocale,
generateConfig: dateFnsGenerateConfig,
};

export default () => {
const [changeCount, setChangeCount] = React.useState(0);

return (
<div>
<input defaultValue="2000-01-01" />
{/* <RangePicker
{...sharedLocale}
style={{ width: 400 }}
onChange={(val) => console.error('>>>>>>>', val)}
/> */}
<RangePicker
{...sharedLocale}
style={{ width: 400 }}
showTime
// allowEmpty
// disabledDate={(_, info) => {
// console.log('Date:', info);
// return false;
// }}
// disabledTime={(date, range, info) => {
// // console.log(`Time-${range}`, range, info);
// const { from } = info;

// if (from) {
// console.log(
// `Time-${range}`,
// from.format('YYYY-MM-DD HH:mm:ss'),
// date.format('YYYY-MM-DD HH:mm:ss'),
// );
// }

// if (from && from.isSame(date, 'day')) {
// return {
// disabledHours: () => [from.hour()],
// disabledMinutes: () => [0, 1, 2, 3],
// disabledSeconds: () => [0, 1, 2, 3],
// };
// }
// return {};
// }}
/>
<h3>Issue #57728: showTime with allowEmpty</h3>
<p>
Select a start date without confirming, switch to the end field, switch back to the start
field, then click the input above. Both fields should reset and the change count should stay
at 0.
</p>
<div>Change count: {changeCount}</div>

<RangePicker
{...sharedLocale}
style={{ width: 400 }}
minDate={dayjs('2024')}
open
mode={['year', 'year']}
/>
{/* <SinglePicker
{...dateFnsSharedLocale}
locale={zhCN}
generateConfig={dayjsGenerateConfig}
style={{ width: 400 }}
showTime
disabledTime={(...args) => {
console.log('Time Single:', ...args);
return {};
allowEmpty
onChange={() => {
setChangeCount((count) => count + 1);
}}
/> */}
{/* <SinglePicker
{...sharedLocale}
style={{ width: 400 }}
minDate={dayjs()}
onChange={(val) => console.error('>>>>>>>', val)}
/> */}
/>
</div>
);
};
6 changes: 5 additions & 1 deletion src/PickerInput/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export type PopupShowTimeConfig<DateType extends object = any> = Omit<
Pick<SharedTimeProps<DateType>, 'disabledTime'>;

export interface PopupProps<DateType extends object = any, PresetValue = DateType>
extends Pick<React.InputHTMLAttributes<HTMLDivElement>, 'onFocus' | 'onBlur'>,
extends
Pick<React.InputHTMLAttributes<HTMLDivElement>, 'onFocus' | 'onBlur'>,
FooterProps<DateType>,
PopupPanelProps<DateType> {
containerRef?: React.Ref<HTMLDivElement>;
panelRender?: SharedPickerProps['panelRender'];

// Presets
Expand Down Expand Up @@ -52,6 +54,7 @@ export interface PopupProps<DateType extends object = any, PresetValue = DateTyp

export default function Popup<DateType extends object = any>(props: PopupProps<DateType>) {
const {
containerRef,
panelRender,
internalMode,
picker,
Expand Down Expand Up @@ -216,6 +219,7 @@ export default function Popup<DateType extends object = any>(props: PopupProps<D
// Container
let renderNode = (
<div
ref={containerRef}
onMouseDown={onPanelMouseDown}
tabIndex={-1}
className={clsx(
Expand Down
Loading
Loading