useRangeActive.d.ts 929 B

12345678910111213141516171819
  1. import type { RangeValueType } from '../RangePicker';
  2. export type OperationType = 'input' | 'panel';
  3. export type NextActive<DateType> = (nextValue: RangeValueType<DateType>) => number | null;
  4. /**
  5. * When user first focus one input, any submit will trigger focus another one.
  6. * When second time focus one input, submit will not trigger focus again.
  7. * When click outside to close the panel, trigger event if it can trigger onChange.
  8. */
  9. export default function useRangeActive<DateType>(disabled: boolean[], empty?: boolean[], mergedOpen?: boolean): [
  10. focused: boolean,
  11. triggerFocus: (focused: boolean) => void,
  12. lastOperation: (type?: OperationType) => OperationType,
  13. activeIndex: number,
  14. setActiveIndex: (index: number) => void,
  15. nextActiveIndex: NextActive<DateType>,
  16. activeList: number[],
  17. updateSubmitIndex: (index: number | null) => void,
  18. hasActiveSubmitValue: (index: number) => boolean
  19. ];