@gez/date-time-kit
Version:
57 lines (56 loc) • 2.44 kB
TypeScript
import type { Ele as EchoEle } from '../echo';
import type { DateFormatterFn } from '../echo/utils';
import { Ele as PopoverEle } from '../popover';
import { type reExportPopoverAttrs } from '../popover/attr-sync-helper';
import type { Emit2EventMap } from '../web-component-base';
import { type Attrs as BaseAttrs, BaseEle, type BaseEmits } from './base';
export type { Granularity, ColOrder } from './base';
export { granularityList, colOrderList } from './base';
export type Attrs = BaseAttrs & reExportPopoverAttrs & {
/** 当前的时间戳 */
'current-time'?: number | string;
};
export interface Emits extends BaseEmits {
/** 点击 Done 按钮后抛出,值为 `current-time` */
'select-time': Date;
'open-change': boolean;
}
export type EventMap = Emit2EventMap<Emits>;
/**
* 年月日下拉选择器。
*
* 这个选择器以 `current-time` 属性作为当前时间的依据(特别是时分秒)。
* 而 `millisecond` 属性则表示现在选中的毫秒数(随着用户操作时实时更新),理论上外部不应直接使用。
*/
export declare class Ele extends BaseEle<Attrs, Emits> {
static readonly tagName: "dt-yyyymmdd-selector";
protected static _style: string;
protected static _template: string;
static get observedAttributes(): string[];
get _staticEls(): {
readonly popover: PopoverEle;
readonly dateEcho: EchoEle;
readonly cols: HTMLElement;
readonly yCol: HTMLElement;
readonly mCol: HTMLElement;
readonly dCol: HTMLElement;
readonly lists: any[];
readonly yList: import("../num-list").Ele;
readonly mList: import("../num-list").Ele;
readonly dList: import("../num-list").Ele;
};
set open(v: boolean);
get open(): boolean;
connectedCallback(): void;
disconnectedCallback(): boolean | void;
protected _onAttrChanged(name: string, oldValue: string | null, newValue: string | null): void;
/** 当前日期,带时分秒,`select-time` 事件抛出时,时分秒来自这里,年月日来自 `millisecond`。 */
get currentTime(): Date;
set currentTime(val: number | string | Date);
private _render;
private _onPopoverChange;
private _onDoneBtnClick;
/** 日期回显格式化函数。设置为 `null` 则重置为默认值 */
get dateFormatter(): DateFormatterFn;
set dateFormatter(fn: DateFormatterFn | null);
}