1#[doc(alias = "textarea")]
5#[non_exhaustive]
6#[derive(Debug, Clone, PartialEq, Default)]
7pub struct TextArea {
8 pub data_map: crate::DataMap,
9 global_attrs: crate::GlobalAttributes,
10 pub autocomplete: std::option::Option<std::borrow::Cow<'static, str>>,
12 pub cols: std::option::Option<i64>,
14 pub dir_name: std::option::Option<std::borrow::Cow<'static, str>>,
16 pub disabled: bool,
18 pub form: std::option::Option<std::borrow::Cow<'static, str>>,
20 pub max_length: std::option::Option<i64>,
22 pub min_length: std::option::Option<i64>,
24 pub name: std::option::Option<std::borrow::Cow<'static, str>>,
26 pub placeholder: std::option::Option<std::borrow::Cow<'static, str>>,
28 pub read_only: bool,
30 pub required: bool,
32 pub rows: std::option::Option<i64>,
34 pub wrap: std::option::Option<std::borrow::Cow<'static, str>>,
36 pub role: std::option::Option<std::borrow::Cow<'static, str>>,
38 pub aria_active_descendant_element: std::option::Option<
40 std::borrow::Cow<'static, str>,
41 >,
42 pub aria_atomic: bool,
44 pub aria_auto_complete: std::option::Option<std::borrow::Cow<'static, str>>,
46 pub aria_braille_label: std::option::Option<std::borrow::Cow<'static, str>>,
48 pub aria_braille_role_description: std::option::Option<
50 std::borrow::Cow<'static, str>,
51 >,
52 pub aria_busy: bool,
54 pub aria_controls_elements: std::option::Option<std::borrow::Cow<'static, str>>,
56 pub aria_current: std::option::Option<std::borrow::Cow<'static, str>>,
58 pub aria_described_by_elements: std::option::Option<std::borrow::Cow<'static, str>>,
60 pub aria_description: std::option::Option<std::borrow::Cow<'static, str>>,
62 pub aria_details_elements: std::option::Option<std::borrow::Cow<'static, str>>,
64 pub aria_disabled: bool,
66 pub aria_drop_effect: std::option::Option<std::borrow::Cow<'static, str>>,
68 pub aria_error_message_elements: std::option::Option<std::borrow::Cow<'static, str>>,
70 pub aria_flow_to_elements: std::option::Option<std::borrow::Cow<'static, str>>,
72 pub aria_grabbed: bool,
74 pub aria_has_popup: std::option::Option<std::borrow::Cow<'static, str>>,
76 pub aria_hidden: bool,
78 pub aria_invalid: std::option::Option<std::borrow::Cow<'static, str>>,
80 pub aria_key_shortcuts: std::option::Option<std::borrow::Cow<'static, str>>,
82 pub aria_label: std::option::Option<std::borrow::Cow<'static, str>>,
84 pub aria_labelled_by_elements: std::option::Option<std::borrow::Cow<'static, str>>,
86 pub aria_live: std::option::Option<std::borrow::Cow<'static, str>>,
88 pub aria_multi_line: bool,
90 pub aria_owns_elements: std::option::Option<std::borrow::Cow<'static, str>>,
92 pub aria_placeholder: std::option::Option<std::borrow::Cow<'static, str>>,
94 pub aria_read_only: bool,
96 pub aria_relevant: std::option::Option<std::borrow::Cow<'static, str>>,
98 pub aria_required: bool,
100 pub aria_role_description: std::option::Option<std::borrow::Cow<'static, str>>,
102}
103impl crate::RenderElement for TextArea {
104 fn write_opening_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result {
105 write!(writer, "<textarea")?;
106 if let Some(field) = self.autocomplete.as_ref() {
107 write!(writer, r#" autocomplete="{field}""#)?;
108 }
109 if let Some(field) = self.cols.as_ref() {
110 write!(writer, r#" cols="{field}""#)?;
111 }
112 if let Some(field) = self.dir_name.as_ref() {
113 write!(writer, r#" dirname="{field}""#)?;
114 }
115 if self.disabled {
116 write!(writer, r#" disabled"#)?;
117 }
118 if let Some(field) = self.form.as_ref() {
119 write!(writer, r#" form="{field}""#)?;
120 }
121 if let Some(field) = self.max_length.as_ref() {
122 write!(writer, r#" maxlength="{field}""#)?;
123 }
124 if let Some(field) = self.min_length.as_ref() {
125 write!(writer, r#" minlength="{field}""#)?;
126 }
127 if let Some(field) = self.name.as_ref() {
128 write!(writer, r#" name="{field}""#)?;
129 }
130 if let Some(field) = self.placeholder.as_ref() {
131 write!(writer, r#" placeholder="{field}""#)?;
132 }
133 if self.read_only {
134 write!(writer, r#" readonly"#)?;
135 }
136 if self.required {
137 write!(writer, r#" required"#)?;
138 }
139 if let Some(field) = self.rows.as_ref() {
140 write!(writer, r#" rows="{field}""#)?;
141 }
142 if let Some(field) = self.wrap.as_ref() {
143 write!(writer, r#" wrap="{field}""#)?;
144 }
145 if let Some(field) = self.role.as_ref() {
146 write!(writer, r#" role="{field}""#)?;
147 }
148 if let Some(field) = self.aria_active_descendant_element.as_ref() {
149 write!(writer, r#" aria-activedescendant="{field}""#)?;
150 }
151 if self.aria_atomic {
152 write!(writer, r#" aria-atomic"#)?;
153 }
154 if let Some(field) = self.aria_auto_complete.as_ref() {
155 write!(writer, r#" aria-autocomplete="{field}""#)?;
156 }
157 if let Some(field) = self.aria_braille_label.as_ref() {
158 write!(writer, r#" aria-braillelabel="{field}""#)?;
159 }
160 if let Some(field) = self.aria_braille_role_description.as_ref() {
161 write!(writer, r#" aria-brailleroledescription="{field}""#)?;
162 }
163 if self.aria_busy {
164 write!(writer, r#" aria-busy"#)?;
165 }
166 if let Some(field) = self.aria_controls_elements.as_ref() {
167 write!(writer, r#" aria-controls="{field}""#)?;
168 }
169 if let Some(field) = self.aria_current.as_ref() {
170 write!(writer, r#" aria-current="{field}""#)?;
171 }
172 if let Some(field) = self.aria_described_by_elements.as_ref() {
173 write!(writer, r#" aria-describedby="{field}""#)?;
174 }
175 if let Some(field) = self.aria_description.as_ref() {
176 write!(writer, r#" aria-description="{field}""#)?;
177 }
178 if let Some(field) = self.aria_details_elements.as_ref() {
179 write!(writer, r#" aria-details="{field}""#)?;
180 }
181 if self.aria_disabled {
182 write!(writer, r#" aria-disabled"#)?;
183 }
184 if let Some(field) = self.aria_drop_effect.as_ref() {
185 write!(writer, r#" aria-dropeffect="{field}""#)?;
186 }
187 if let Some(field) = self.aria_error_message_elements.as_ref() {
188 write!(writer, r#" aria-errormessage="{field}""#)?;
189 }
190 if let Some(field) = self.aria_flow_to_elements.as_ref() {
191 write!(writer, r#" aria-flowto="{field}""#)?;
192 }
193 if self.aria_grabbed {
194 write!(writer, r#" aria-grabbed"#)?;
195 }
196 if let Some(field) = self.aria_has_popup.as_ref() {
197 write!(writer, r#" aria-haspopup="{field}""#)?;
198 }
199 if self.aria_hidden {
200 write!(writer, r#" aria-hidden"#)?;
201 }
202 if let Some(field) = self.aria_invalid.as_ref() {
203 write!(writer, r#" aria-invalid="{field}""#)?;
204 }
205 if let Some(field) = self.aria_key_shortcuts.as_ref() {
206 write!(writer, r#" aria-keyshortcuts="{field}""#)?;
207 }
208 if let Some(field) = self.aria_label.as_ref() {
209 write!(writer, r#" aria-label="{field}""#)?;
210 }
211 if let Some(field) = self.aria_labelled_by_elements.as_ref() {
212 write!(writer, r#" aria-labelledby="{field}""#)?;
213 }
214 if let Some(field) = self.aria_live.as_ref() {
215 write!(writer, r#" aria-live="{field}""#)?;
216 }
217 if self.aria_multi_line {
218 write!(writer, r#" aria-multiline"#)?;
219 }
220 if let Some(field) = self.aria_owns_elements.as_ref() {
221 write!(writer, r#" aria-owns="{field}""#)?;
222 }
223 if let Some(field) = self.aria_placeholder.as_ref() {
224 write!(writer, r#" aria-placeholder="{field}""#)?;
225 }
226 if self.aria_read_only {
227 write!(writer, r#" aria-readonly"#)?;
228 }
229 if let Some(field) = self.aria_relevant.as_ref() {
230 write!(writer, r#" aria-relevant="{field}""#)?;
231 }
232 if self.aria_required {
233 write!(writer, r#" aria-required"#)?;
234 }
235 if let Some(field) = self.aria_role_description.as_ref() {
236 write!(writer, r#" aria-roledescription="{field}""#)?;
237 }
238 write!(writer, "{}", self.global_attrs)?;
239 write!(writer, "{}", self.data_map)?;
240 write!(writer, ">")?;
241 Ok(())
242 }
243 #[allow(unused_variables)]
244 fn write_closing_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result {
245 write!(writer, "</textarea>")?;
246 Ok(())
247 }
248}
249impl std::fmt::Display for TextArea {
250 fn fmt(&self, writer: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
251 use crate::RenderElement;
252 self.write_opening_tag(writer)?;
253 self.write_closing_tag(writer)?;
254 Ok(())
255 }
256}
257impl std::ops::Deref for TextArea {
258 type Target = crate::GlobalAttributes;
259 fn deref(&self) -> &Self::Target {
260 &self.global_attrs
261 }
262}
263impl std::ops::DerefMut for TextArea {
264 fn deref_mut(&mut self) -> &mut Self::Target {
265 &mut self.global_attrs
266 }
267}