UNPKG

@gez/date-time-kit

Version:

86 lines (85 loc) 3.1 kB
import { type BaseAttrs, type BaseEmits, type Emit2EventMap, UiBase } from '../web-component-base'; import { type Weeks } from './weeks'; export { type Weeks, weekKey, getWeekInOrder } from './weeks'; export interface Attrs extends BaseAttrs { /** * The showing time, used to determine the month to show on calendar. * @type {`string | number`} A value that can be passed to the Date constructor. * @default Date.now() */ 'showing-time'?: string | number; /** * The start time of the calendar display range. * @type {`string | number`} A value that can be passed to the Date constructor. * @default 'showing-time' */ 'time-start'?: string | number; /** * The end time of the calendar display range. * @type {`string | number`} A value that can be passed to the Date constructor. * @default 'time-start' */ 'time-end'?: string | number; /** * The minimum time of the calendar display range. * @type {`string | number`} A value that can be passed to the Date constructor. */ 'min-time'?: string | number; /** * The maximum time of the calendar display range. * @type {`string | number`} A value that can be passed to the Date constructor. */ 'max-time'?: string | number; /** * Set which day of the week is the first day. * @type `'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'` * @default 'sun' */ 'week-start-at'?: Weeks; /** * Whether to show the days of the previous and next months in the current month's calendar. * @type {boolean} * @default false */ 'show-other-month'?: boolean; } export interface Emits extends BaseEmits { 'select-time': Date; 'hover-item': Date; } export type EventMap = Emit2EventMap<Emits>; /** * 基础的日历显示组件。仅显示星期和数字。 */ export declare class Ele extends UiBase<Attrs, Emits> { static tagName: "dt-calendar-base"; protected static _style: string; protected static _template: string; static get observedAttributes(): string[]; get _staticEls(): { readonly weeks: any[]; readonly items: any[]; }; get showingTime(): number | string | Date; get timeStart(): number | string | Date; get timeEnd(): number | string | Date; get minTime(): number | string | Date; get maxTime(): number | string | Date; private _setTimeAttr; set showingTime(val: number | string | Date); set timeStart(val: number | string | Date); set timeEnd(val: number | string | Date); set minTime(val: number | string | Date); set maxTime(val: number | string | Date); get weekStartAt(): Weeks; set weekStartAt(val: Weeks); get showOtherMonth(): boolean; set showOtherMonth(val: boolean); connectedCallback(): void; protected _onAttrChanged(name: string, oldValue: string | null, newValue: string | null): void; private _onWeekStartAtChange; private _onTimeChange; private _onClick; private _onPointerOver; formatter: (i: number) => string; }