singlestage/components/table/
head.rs

1use leptos::prelude::*;
2
3#[component]
4pub fn TableHead(
5    children: Children,
6
7    // GLOBAL ATTRIBUTES
8    //
9    /// A space separated list of keys to focus this element. The first key available on the user's
10    /// keyboard layout is used.
11    #[prop(optional, into)]
12    accesskey: MaybeProp<String>,
13    /// Sets whether the input value should be capitalized and how. If a parent `<form>` has
14    /// `autocapitalize` rules set, it will override any rules set here.
15    ///
16    /// Accepted values: "none" or "off" | "sentences" or "on" | "words" | "characters".
17    #[prop(optional, into)]
18    autocapitalize: MaybeProp<String>,
19    /// Grabs focus once the page has finished loading. Only one element on the page can be focused
20    /// at a time.
21    #[prop(optional, into)]
22    autofocus: MaybeProp<bool>,
23    /// Apply classes to the element.
24    #[prop(optional, into)]
25    class: MaybeProp<String>,
26    /// Allows client-side editing of the element by the user.
27    ///
28    /// Accepted values: "true" | "false" | "plaintext-only"
29    #[prop(optional, into)]
30    contenteditable: MaybeProp<String>,
31    /// Indicate directionality of the element's text.
32    ///
33    /// Accepted values: "ltr" | "rtl" | "auto"
34    #[prop(optional, into)]
35    dir: MaybeProp<String>,
36    /// Toggle whether the element can be dragged.
37    #[prop(optional, into)]
38    draggable: MaybeProp<bool>,
39    /// Modifies the appearance of the enter key on virtual keyboards.
40    #[prop(optional, into)]
41    enterkeyhint: MaybeProp<String>,
42    /// Expose elements in the shadow DOM to be manipulated by the DOM.
43    #[prop(optional, into)]
44    exportparts: MaybeProp<String>,
45    /// Controls hidden status of the element.
46    #[prop(optional, into)]
47    hidden: MaybeProp<String>,
48    /// Set the id of this element.
49    #[prop(optional, into)]
50    id: MaybeProp<String>,
51    /// Toggle if the browser reacts to input events from this element.
52    #[prop(optional, into)]
53    inert: MaybeProp<bool>,
54    /// Hints to the browser of what type of virtual keyboard to display when editing this element
55    /// or its children.
56    #[prop(optional, into)]
57    inputmode: MaybeProp<String>,
58    /// Used to render a standard element as a custom element.
59    #[prop(optional, into)]
60    is: MaybeProp<String>,
61    /// Unique global identifier of an item.
62    #[prop(optional, into)]
63    itemid: MaybeProp<String>,
64    /// Used to add properties to an item.
65    #[prop(optional, into)]
66    itemprop: MaybeProp<String>,
67    /// Used to associate an item with a related non-parent element that's using `itemscope`.
68    #[prop(optional, into)]
69    itemref: MaybeProp<String>,
70    /// Used to declare that children elements are related to a particular item.
71    #[prop(optional, into)]
72    itemscope: MaybeProp<String>,
73    /// URL of data used to define `itemprops`.
74    #[prop(optional, into)]
75    itemtype: MaybeProp<String>,
76    /// Defines the language of an element.
77    #[prop(optional, into)]
78    lang: MaybeProp<String>,
79    /// Cryptographic "number used once".
80    #[prop(optional, into)]
81    nonce: MaybeProp<String>,
82    /// List of the part names of the element.
83    #[prop(optional, into)]
84    part: MaybeProp<String>,
85    /// Designate an element as a popover element.
86    #[prop(optional, into)]
87    popover: MaybeProp<String>,
88    /// Define the semantic meaning of content.
89    #[prop(optional, into)]
90    role: MaybeProp<String>,
91    /// Assigns a slot to an element.
92    #[prop(optional, into)]
93    slot: MaybeProp<String>,
94    /// Toggle spellcheck for this input.
95    ///
96    /// Accepted values: "default" | "true" | "false".
97    #[prop(optional, into)]
98    spellcheck: MaybeProp<String>,
99    /// Define CSS to be applied to the element.
100    #[prop(optional, into)]
101    style: MaybeProp<String>,
102    /// Controls how an element behaves when a user navigates using the tab key.
103    #[prop(optional, into)]
104    tabindex: MaybeProp<usize>,
105    /// Describes the content of the element to screen readers.
106    #[prop(optional, into)]
107    title: MaybeProp<String>,
108    /// Defines localization behavior for the element.
109    #[prop(optional, into)]
110    translate: MaybeProp<String>,
111
112    // TH ATTRIBUTES
113    //
114    /// Short alternate label for screen readers, etc.
115    #[prop(optional, into)]
116    abbr: MaybeProp<String>,
117    /// The number of columns this cell spans.
118    #[prop(optional, into)]
119    colspan: MaybeProp<usize>,
120    /// Space-separated list of ids of `<th>` elements that provide headings for this cell.
121    #[prop(optional, into)]
122    headers: MaybeProp<String>,
123    /// The number of rows this cell spans.
124    #[prop(optional, into)]
125    rowspan: MaybeProp<usize>,
126    /// Defines the cells this header relates to.
127    ///
128    /// Accepted values: "row" | "col" | "rowgroup" | "colgroup"
129    #[prop(optional, into)]
130    scope: MaybeProp<String>,
131) -> impl IntoView {
132    let global_attrs_1 = view! {
133        <{..}
134            accesskey=move || accesskey.get()
135            autocapitalize=move || autocapitalize.get()
136            autofocus=move || autofocus.get()
137            class=move || class.get()
138            contenteditable=move || contenteditable.get()
139            dir=move || dir.get()
140            draggable=move || draggable.get()
141            enterkeyhint=move || enterkeyhint.get()
142            exportparts=move || exportparts.get()
143            hidden=move || hidden.get()
144            id=move || id.get()
145            inert=move || inert.get()
146            inputmode=move || inputmode.get()
147            is=move || is.get()
148            itemid=move || itemid.get()
149        />
150    };
151
152    let global_attrs_2 = view! {
153        <{..}
154            itemprop=move || itemprop.get()
155            itemref=move || itemref.get()
156            itemscope=move || itemscope.get()
157            itemtype=move || itemtype.get()
158            lang=move || lang.get()
159            nonce=move || nonce.get()
160            part=move || part.get()
161            popover=move || popover.get()
162            role=move || role.get()
163            slot=move || slot.get()
164            spellcheck=move || spellcheck.get()
165            style=move || style.get()
166            tabindex=move || tabindex.get()
167            title=move || title.get()
168            translate=move || translate.get()
169        />
170    };
171
172    view! {
173        <th
174            abbr=move || abbr.get()
175            colspan=move || colspan.get()
176            headers=move || headers.get()
177            rowspan=move || rowspan.get()
178            scope=move || scope.get()
179
180            {..global_attrs_1}
181            {..global_attrs_2}
182        >
183            {children()}
184        </th>
185    }
186}