httk.serve.web.widgets.optimade_table¶
The HTML/configuration boundary for the browser-driven OPTIMADE table.
Attributes¶
Exceptions¶
A declared OPTIMADE table shell cannot meet the browser protocol. |
Functions¶
|
Render an inert, accessible OPTIMADE table shell and trusted assets. |
Module Contents¶
- exception httk.serve.web.widgets.optimade_table.OptimadeTableProtocolError[source]¶
Bases:
ValueErrorA declared OPTIMADE table shell cannot meet the browser protocol.
- httk.serve.web.widgets.optimade_table.render(context, *, base_url, entry_type='structures', columns, page_size=50, page_size_options=None, page_size_query=None, caption='OPTIMADE results', filter=None, filter_query=None, sort=None, sort_query=None, sort_aliases=None, allowed_origins=(), detail_route=None, detail_column=None, detail_query='id', summary=None, advanced_filter=None)[source]¶
Render an inert, accessible OPTIMADE table shell and trusted assets.
The browser negotiates continuation URLs from inert configuration; those URLs are not placed in DOM attributes, events, storage, or history.
allowed_originsis a client continuation allow-list, not an access control boundary.filter_queryandsort_queryreplace the whole browser filter and sort values.- Parameters:
context (httk.serve.web.widgets.core.WidgetContext) – Immutable widget invocation context.
base_url (str) – Origin- or path-relative OPTIMADE endpoint base URL.
entry_type (str) – OPTIMADE entry resource type.
columns (object) – Column names or column mappings to display.
page_size (int) – Number of entries requested per browser page.
page_size_options (object) – Optional sequence of 1-8 distinct page-size integers (each 1..500) offered by the page-size dropdown.
Noneuses(50, 100, 500). The currentpage_sizeis always included as an option; the list is sorted ascending.page_size_query (str | None) – Query parameter name whose value selects a page size from the options. The dropdown renders only when this is set.
caption (str) – Accessible table caption.
filter (str | None) – Initial OPTIMADE filter expression.
filter_query (str | None) – Whole-filter query parameter name used by the browser.
sort (str | None) – Optional OPTIMADE sort expression.
sort_query (str | None) – Query parameter name whose complete value replaces
sort.sort_aliases (collections.abc.Mapping[str, str] | None) – Optional mapping of display sort values (e.g. a human-facing
"rank") to complete OPTIMADE sort expressions. The browser resolves an authored or URL-supplied sort through this mapping before querying, so a display alias is never sent to OPTIMADE; unmapped values pass through unchanged.allowed_origins (tuple[str, ...]) – Client-side allow-list for continuation origins.
detail_route (str | None) – Optional site route for entry details.
detail_column (str | None) – Column supplying the detail value.
detail_query (str) – Query parameter receiving the detail value.
summary (object) – Optional results-summary configuration.
Nonedisables it,Trueenables it with defaults (noun"entries"), and a mapping may setnounand afieldsmapping of property name tolabel,format,values, andclearsoverlays used to describe the active filter and sort in human terms. Field presentation defaults to the matching column’s label and format. Every rendered filter/sort pill gets a removable “x”;clearsnames 1-8 additional source URL parameter(s) that a filter pill’s “x” also deletes, so a host page whose own form re-derivesfilterfrom those parameters does not resurrect the removed predicate. Removing the sort pill (including an authored default sort, which now renders as a pill like any other) writes an explicit emptysort=that suppresses the default rather than re-applying it.advanced_filter (object) – Optional advanced-filter disclosure configuration.
Nonedisables it,Trueenables it with defaults, and a mapping may setlabel(the disclosure heading) andhelp_url(an absolute HTTP(S) URL or site-relative path to an “available fields” reference). The disclosure is a plain GET form that submits a raw OPTIMADE filter under thefilter_queryparameter, so it requiresfilter_queryto be set.
- Returns:
Accessible table shell and its trusted assets.
- Raises:
OptimadeTableProtocolError – If configuration violates the browser protocol.
- Return type: