DateMetadataController

abstract external class DateMetadataController

A reactive controller that resolves the metadata (currently the disabled state) for the dates shown by the date-picker's dateMetadataProvider.

The provider is called for a range of months and may return an array synchronously or a Promise, so results from a server (Flow) or a remote availability service can be awaited. The range and each returned entry identify a date by an ISO 8601 string, e.g. { date: '2026-01-01', disabled: true }.

ARCHITECTURE.md in this package records the reasoning behind the request, caching, notification and failure behavior.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var host: HTMLElement

The controller host element.

Link copied to clipboard

The provider function, or null when none is set.

Functions

Link copied to clipboard

Clears the cache and invalidates any in-flight requests.

Link copied to clipboard
fun ensureRangeLoaded(startDate: Date?, endDate: Date?)

Ensures the provider has been consulted for the inclusive range between the given dates, rounded out to whole blocks of months. Months already loaded or in flight are skipped, and the ones left over are requested with a single call.

Link copied to clipboard
fun getMetadata(date: Date?): JsAny?

The metadata resolved for the given date, or undefined when the date has no metadata or its month has not been resolved yet. Returns the entry the provider supplied, which the caller must not modify.

Link copied to clipboard
Link copied to clipboard

Whether the given date is disabled by its metadata.

Link copied to clipboard

Whether any month range is currently being fetched.

Link copied to clipboard

Whether the provider has answered for the month containing the given date. A month whose request failed is not loaded and will be requested again.

Link copied to clipboard

Whether the month containing the given date is currently being fetched. A month that has not been asked about is not pending, so this reports the same state as isLoading() does for the whole cache.

Link copied to clipboard

Sets the provider function and clears the cache. Passing the same provider again is a no-op, so callers should keep a stable reference.

Link copied to clipboard
fun subscribe(element: HTMLElement)

Registers an element to be re-rendered whenever the resolved metadata or the loading state changes. The element must render from its bindings, and must not be the one whose own observer triggers a load. It stays registered for the controller's lifetime.