@gez/date-time-kit
Version:
58 lines (57 loc) • 2.36 kB
TypeScript
import type { Ele as EchoEle } from '../echo';
import type { TimeFormatterFn } 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 {
'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-hhmmss-ms-selector";
protected static _style: string;
protected static _template: string;
static get observedAttributes(): string[];
get _staticEls(): {
popover: PopoverEle;
timeEcho: EchoEle;
cols: HTMLElement;
hCol: HTMLElement;
mCol: HTMLElement;
sCol: HTMLElement;
lists: any[];
hList: import("../num-list").Ele;
mList: import("../num-list").Ele;
sList: import("../num-list").Ele;
msWrapper: HTMLElement;
msInput: HTMLInputElement;
};
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 timeFormatter(): TimeFormatterFn;
set timeFormatter(fn: TimeFormatterFn | null);
}