@gez/date-time-kit
Version:
51 lines (50 loc) • 2.31 kB
TypeScript
import { type DateTimeGranularity } from '../../utils';
import { type BaseAttrs, type BaseEmits, type Emit2EventMap, UiBase } from '../web-component-base';
import { type DateFormatterFn, type DatetimeFormatterFn, type TimeFormatterFn } from './utils';
export declare const iconTypeList: readonly ["date", "time", "datetime"];
export type IconType = (typeof iconTypeList)[number];
export interface Attrs extends BaseAttrs {
active?: boolean;
'current-time'?: number | string | Date;
'min-granularity'?: DateTimeGranularity;
'max-granularity'?: DateTimeGranularity;
}
export interface Emits extends BaseEmits {
}
export type EventMap = Emit2EventMap<Emits>;
export declare class Ele extends UiBase<Attrs, Emits> {
static readonly tagName: "dt-echo";
protected static _style: string;
protected static _template: string;
static get observedAttributes(): string[];
get active(): boolean;
set active(v: boolean);
get currentTime(): Date;
set currentTime(val: number | string | Date);
get minGranularity(): DateTimeGranularity;
set minGranularity(v: DateTimeGranularity);
get maxGranularity(): DateTimeGranularity;
set maxGranularity(v: DateTimeGranularity);
protected get _minmaxGran(): {
min: "month" | "year" | "day" | "hour" | "minute" | "second" | "millisecond";
max: "month" | "year" | "day" | "hour" | "minute" | "second" | "millisecond";
};
get iconType(): IconType;
get _staticEls(): {
readonly icon: HTMLElement;
readonly text: HTMLSpanElement;
};
connectedCallback(): boolean | void;
protected _onAttrChanged(name: string, oldValue: string | null, newValue: string | null): void;
private _render;
private _currentFormatter;
/** 时分秒毫秒回显格式化函数。设置为 `null` 则重置为默认值 */
get timeFormatter(): TimeFormatterFn;
set timeFormatter(fn: TimeFormatterFn | null);
/** 年月日回显格式化函数。设置为 `null` 则重置为默认值 */
get dateFormatter(): DateFormatterFn;
set dateFormatter(fn: DateFormatterFn | null);
/** 日期时间回显格式化函数。设置为 `null` 则重置为默认值 */
get dateTimeFormatter(): DatetimeFormatterFn;
set dateTimeFormatter(fn: DatetimeFormatterFn | null);
}