生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

Timestamp ​

Data display component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="timestamp": root

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-timestamp>
Vue componentsXhTimestamp
State machinetimestampMachine
Skin@xihan-ui/styles/timestamp.css

Props ​

PropTypeRequired
formatstring
localestring
nowTimestampValue
refreshIntervalnumber
timeZonestring
translationsPartial<TimestampTranslations>
typeTimestampType
valueTimestampValue

State ​

Public state is written to data-state.

PartValues
root'empty'

The following names are internal to the state machine.

States: idle · live

Events: REFRESH.SYNC · TICK

Guards: shouldRefresh

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
dateDate | undefined
textstring
stampstring | undefined
stateTimestampState
relativeboolean
refreshingboolean
getRootProps() => T['element']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

No keyboard interaction: the component takes no focus, or focus behavior comes entirely from native elements.

Style reference ​

Skin ​

@xihan-ui/styles/timestamp.css is written against [data-scope="timestamp"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-timestamp in place of data-scope (same specificity) and sits in the xihan.components layer. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-formatprops.type
rootdata-relative'' (present only while the condition holds)
rootdata-state'empty'

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-timestamp-fgrootcolordefault--xh-fg-default
--xh-timestamp-placeholder-fgrootcolorstate=empty
state=invalid
--xh-fg-muted

Released under The MIT License