-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ability to Expand/Collapse All #260
base: master
Are you sure you want to change the base?
Conversation
This introduces a new property named `showExpandAll` (defaults to `false`) that display a button that allows to easily expand or collapse all rows. The button shows up in both the breadcrumbs toolbar as above the top schema row. Replace `jotai` related deprecated functions to the suggested new alternative functions to avoid the spamming of deprecation warnings in the developer console.
{showExpandAll ? ( | ||
<HStack w="full" fontFamily="mono" fontSize="sm" lineHeight="none" bg="canvas-pure" px="px" color="light"> | ||
<Box flex={1}> </Box> | ||
<Button pl={1} mr={1} size="sm" appearance="minimal" onClick={onCollapseExpandAll}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to only show this button when the schema as any properties with schema definition that can be expanded/collapsed.
How can I detect this?
@@ -150,7 +149,7 @@ function ScrollCheck() { | |||
const elementRef = React.useRef<HTMLDivElement>(null); | |||
|
|||
const isOnScreen = useIsOnScreen(elementRef); | |||
const setShowPathCrumbs = useUpdateAtom(showPathCrumbsAtom); | |||
const setShowPathCrumbs = useSetAtom(showPathCrumbsAtom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to get right of jotai
deprecation message in the console
@@ -39,7 +38,9 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo( | |||
viewMode, | |||
} = useJSVOptionsContext(); | |||
|
|||
const setHoveredNode = useUpdateAtom(hoveredNodeAtom); | |||
const setHoveredNode = useSetAtom(hoveredNodeAtom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to get right of jotai
deprecation message in the console
@@ -67,6 +68,14 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo( | |||
const validations = isRegularNode(schemaNode) ? schemaNode.validations : {}; | |||
const hasProperties = useHasProperties({ required, deprecated, validations }); | |||
|
|||
React.useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't think of a better way to ensure the internal state of the row is in sync
… component getting stuck
Any more changes needed? |
Any news on this PR? Love to have it merged so I don't need mess around with a internal fork :) |
What’s needed please to get this merged? We use this library as it’s brilliant but the deprecation warnings are killing our user monitoring and make the console unusable. We’d dearly like to not have to fork this internally - if there aren’t objections to this PR, please could we have this merged and released at the earliest opportunity? |
This library is awesome and has become an instrumental piece of a project at work. Unfortunately, we've had to fork simply to overcome these deprecation warnings, as they're quite noisy. Wondering what is needed to get this PR merged... or if it's OK to create a new PR reducing the scope of these changes to focus on updating the deprecated |
+1 for getting rid of the deprecation warnings. If ready please merge :) |
Motivation and Context
Our documentation consumers wished to have the ability to quickly expand or collapse all the collapsible rows of the schema.
Description
This introduces a new property named
showExpandAll
(defaults tofalse
) that display a button that allows to easily expand or collapse all rows.The button shows up in both the breadcrumbs toolbar as above the top schema row.
Replace
jotai
related deprecated functions to the suggested new alternative functions to avoid the spamming of deprecation warnings in the developer console.How Has This Been Tested?
This has been tested via fork of the component at work as part of our API reference documentation.
Screenshot(s)/recordings(s)
Types of changes
Checklist