@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
89 lines (88 loc) • 2.89 kB
TypeScript
import { Dateable } from '@vexip-ui/utils';
import { CalendarPanelSlots } from '../calendar';
import { WheelSlots } from '../wheel';
export type DateType = 'year' | 'month' | 'date';
export type TimeType = 'hour' | 'minute' | 'second';
export type DateTimeType = DateType | TimeType;
export type DatePickerType = 'date' | 'datetime' | 'year' | 'month';
export type DateShortcutsPlacement = 'top' | 'right' | 'bottom' | 'left';
export type TimeShortcutsPlacement = DateShortcutsPlacement;
export type DatePickerFormatFn = (timestamp: number, type: 'start' | 'end') => unknown;
export interface DateShortcut {
name: string;
value: Dateable | Dateable[] | (() => Dateable | Dateable[]);
}
export interface TimeShortcut {
name: string;
value: string | string[] | (() => string | string[]);
}
export interface DatePickerState {
type: DatePickerType;
currentColumn: DateTimeType;
enabled: Record<DateTimeType, boolean>;
activated: Record<DateTimeType, boolean>;
dateValue: Record<DateTimeType, number>;
enterColumn(type: 'prev' | 'next'): void;
}
export interface DisabledTime {
hour?(hour: number): boolean;
minute?(hour: number, minute: number): boolean;
second?(hour: number, minute: number, second: number): boolean;
}
export declare const enum DisabledType {
UPSTREAM = 0,
TRUE = 1,
AT_MIN_TRUE = 2,
AT_MAX_TRUE = 3,
FALSE = 4
}
export type DatePickerChangeEvent = (value: number | number[] | null) => void;
export type TimePickerChangeEvent = (value: string | string[]) => void;
export declare const datePickerTypes: readonly DatePickerType[];
export declare const invalidDate: Date;
export declare const TIME_REG: RegExp;
export interface TimeWheelSlots {
hour?: WheelSlots['default'];
minute?: WheelSlots['default'];
second?: WheelSlots['default'];
}
export interface DatePanelSlots {
title?: (params: {
panel: DateType;
yearStart: number;
year: number;
month: number;
togglePanel: (panel: DateType) => void;
}) => any;
year?: (params: {
year: number;
selected: boolean;
isNext: boolean;
disabled: boolean;
inRange: boolean;
}) => any;
month?: (params: {
year: number;
month: number;
selected: boolean;
disabled: boolean;
inRange: boolean;
}) => any;
week?: CalendarPanelSlots['week'];
date?: CalendarPanelSlots['item'];
}
export interface DatePickerSlots {
prefix?: () => any;
suffix?: () => any;
exchange?: () => any;
panelTitle?: DatePanelSlots['title'];
panelYear?: DatePanelSlots['year'];
panelMonth?: DatePanelSlots['month'];
panelWeek?: DatePanelSlots['week'];
panelDate?: DatePanelSlots['date'];
}
export interface TimePickerSlots {
prefix?: () => any;
exchange?: () => any;
suffix?: () => any;
}