@gez/date-time-kit
Version:
61 lines (60 loc) • 2.04 kB
TypeScript
import { type BaseAttrs, type BaseEmits, type Emit2EventMap, UiBase } from '../web-component-base';
export interface Attrs extends BaseAttrs {
millisecond: number;
/**
* 选择器的粒度,表示最大可选的时间单位。默认为 year。
*/
'max-granularity'?: 'year' | 'month';
/**
* 选择器的粒度,表示最小可选的时间单位。默认为 month。
*/
'min-granularity'?: 'year' | 'month';
/**
* 是否显示年份控制按钮(快速增减年份)
* @default false
*/
'show-ctrl-btn-year-add'?: boolean;
'show-ctrl-btn-year-sub'?: boolean;
/**
* 是否显示月份控制按钮(快速增减月份)
* @default false
*/
'show-ctrl-btn-month-add'?: boolean;
'show-ctrl-btn-month-sub'?: boolean;
}
export interface Emits extends BaseEmits {
change: {
oldTime: Date;
newTime: Date;
};
'popover-open-change': boolean;
}
export type EventMap = Emit2EventMap<Emits>;
/**
* 日期导航组件
*
* 存在一个 titleFormatter 方法,可以重写该方法以自定义年月标题的回显格式。
*/
export declare class Ele extends UiBase<Attrs, Emits> {
static readonly tagName: "dt-yyyymm-nav";
protected static _style: string;
protected static _template: string;
static get observedAttributes(): string[];
get millisecond(): number;
set millisecond(v: number);
get showCtrlBtnYearAdd(): boolean;
set showCtrlBtnYearAdd(val: boolean);
get showCtrlBtnYearSub(): boolean;
set showCtrlBtnYearSub(val: boolean);
get showCtrlBtnMonthAdd(): boolean;
set showCtrlBtnMonthAdd(val: boolean);
get showCtrlBtnMonthSub(): boolean;
set showCtrlBtnMonthSub(val: boolean);
connectedCallback(): void;
protected _onAttrChanged(name: string, oldValue: string | null, newValue: string | null): void;
private _render;
private _onTitleToggle;
private _onItemSelect;
private _onBtnClick;
titleFormatter: (ms: number) => string;
}