-
Notifications
You must be signed in to change notification settings - Fork 45
feat: mask editor [STU-313] #33
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
Conversation
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.
src/components/SchemaTree.tsx
Outdated
| (node, rowOptions) => { | ||
| return ( | ||
| <SchemaRow | ||
| maskControls={() => ( |
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.
This should be done differently, we cannot have it hardcoded like this.
JSV is open-source and therefore likely to be used by more entities and users than just Stoplight.
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.
@P0lip can you add some suggestions on how do you think this should be done. Will be easier to process.
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.
Custom renderRow function. There is a similar case in tree-list and other components.
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.
What I mean is that we should make JSV more flexible & provide the support for allOf.
By support for allOf, I mean exposing mapped paths, as right now there is no way to determine the path of the original property.
Masking components could be placed in Studio.
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.
@P0lip, so do you mean, that MaskControls component should be placed in Studio (together with its state - [selectedProps, setSelectedProps] and passed to JSV through JSE ? Or do you mean that the whole rowRenderer should be composed in Studio? I'm not sure if the second is an option since it would mean moving SchemaRow component to Studio too?
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.
Or do you mean that the whole rowRenderer should be composed in Studio?
Yeah, rowRenderer prop should be exposed in JSV and the rest should be composed in Studio.
You can export SchemaRow from JSV, similarly to tree-list and its default row.
chris-miaskowski
left a comment
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.
Similarly to JSE: I will skip the review on that for now since I'll be working on extending this with SRN anyway. Plus this will most likely change once Matt is done with the array/allOf support
| (node, rowOptions) => <SchemaRow node={node} rowOptions={rowOptions} {...itemData} />, | ||
| [itemData.count], | ||
| (node, rowOptions) => { | ||
| const possibleProps = props.maskControlsHandler |
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.
Suggest passing custom rowRenderer rather than having this weird logic here.
You can refer to https://github.com/stoplightio/tree-list/blob/master/src/components/TreeListItem.tsx#L39 to have a better understanding.
|
Agree with @P0lip re keeping mask specific terminology (like We have a couple of options:
Related to number 2, UX wise I suggest that we render the required toggle and the checkbox on the right side of the rows (required, then checkbox). Putting them on the right side will keep them all aligned, which makes it easier to just move your mouse down the list and click checkboxes as you go. In addition, the required button will end up right next to the required text which better associates the button to the thing it's changing. |
|
@marbemac |
74281d2 to
02d6a9b
Compare
|
closing in favour of #37 |

Dependency graph:
#33 -> https://github.com/stoplightio/json-schema-editor/pull/32 -> https://github.com/stoplightio/studio-internal/pull/336