({
properties,
links,
propGroups = GROUPS,
defaultExpanded = DEFAULT_EXPANDED
}: GroupedPropTableProps)
| 203 | } |
| 204 | |
| 205 | export function GroupedPropTable({ |
| 206 | properties, |
| 207 | links, |
| 208 | propGroups = GROUPS, |
| 209 | defaultExpanded = DEFAULT_EXPANDED |
| 210 | }: GroupedPropTableProps) { |
| 211 | setLinks(links); |
| 212 | |
| 213 | let [props, groups] = groupProps(properties, propGroups); |
| 214 | // let properties = Object.values(props).filter(prop => prop.type === 'property' && prop.access !== 'private' && prop.access !== 'protected').reverse(); |
| 215 | |
| 216 | // properties.sort((a, b) => a.name.localeCompare(b.name)); |
| 217 | |
| 218 | let allProps = [...Object.values(props), ...Object.values(groups).flatMap(g => Object.values(g))]; |
| 219 | // Default to showing required indicators if some properties are optional but not all. |
| 220 | let showRequired = !allProps.every(p => p.optional) && !allProps.every(p => !p.optional); |
| 221 | |
| 222 | // Show default values by default if any of the properties have one defined. |
| 223 | let showDefault = Object.values(props).some(p => !!p.default); |
| 224 | |
| 225 | return ( |
| 226 | <Table> |
| 227 | <TableHeader> |
| 228 | <tr> |
| 229 | <TableColumn>Name</TableColumn> |
| 230 | <TableColumn>Type</TableColumn> |
| 231 | {showDefault && <TableColumn>Default</TableColumn>} |
| 232 | {/* <TableColumn>Description</TableColumn> */} |
| 233 | </tr> |
| 234 | </TableHeader> |
| 235 | <TableBody> |
| 236 | <Rows props={props} showDefault={showDefault} showRequired={showRequired} /> |
| 237 | </TableBody> |
| 238 | {Object.keys(groups).map(group => ( |
| 239 | <DisclosureRow key={group} title={group} defaultExpanded={defaultExpanded?.has(group)}> |
| 240 | <Rows props={groups[group]} showDefault={showDefault} showRequired={showRequired} /> |
| 241 | </DisclosureRow> |
| 242 | ))} |
| 243 | </Table> |
| 244 | ); |
| 245 | } |
| 246 | |
| 247 | function Rows({ |
| 248 | props, |
nothing calls this directly
no test coverage detected