-
-
Notifications
You must be signed in to change notification settings - Fork 112
Test section visibility #47
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
33a18c1
to
6deb3b3
Compare
We need both traceIndex and fullTraceIndex within each field so that unpackPlotProps can properly compute the derived plots from fullData. Before this commit only TraceAccordion new how to generate fullTraceIndex which meant it was difficult to test or use a data field widget outside of the TraceAccordion. This commit adds functionality to unpackPlotProps such that it checks if the traceIndex is input either by context OR props and if fullDataIndex is also passed in. If it is not it computes it using the factored out function. This behaviour still happens in traceAccordion as it can do the computation once for all of its children (all fields point to the single trace)
Factor out dereferencing from Hub so it can be used elsewhere. Use Workspace WalkObject (code copy) and accompanying tests.
73c8554
to
8bfe69c
Compare
wait I just thought of something. Maybe the Data Attr Fields (via connectToPlot/Section and unpackPlotProps) should expect that This matches the proposed <PlotlyEditor>
<Panel name="create">
<Trace traceIndex={0}>
<Section name="data">
<DataSelector attr="x" />
</Section>
</Trace>
</Panel>
<Panel name="axis">
<Layout>
<Axis axis="xaxis">
<Section name="range">
<Toggle attr="log" />
</Section>
</Axis>
</Layout>
</Panel>
</PlotlyEditor> (Axis stuff just pseudo API...) So Widgets will need to be nested inside either a Layout or a Trace or they will throw an error. I think I will implement this stuff in this PR so let's hold off on the review. |
New <Trace> component will inject traceIndex and fullTraceIndex into context for child components to access. It will also eventually configure something that will be able to discern between targeting gd.data vs gd.layout. Probably something like "container" or "attrRoot"
Okay all that took was factoring out TracePanel from |
ready for review |
naive direct lookups do not account for various exceptions and edge cases
we present users with "area" as "scatter + fill"
This component API uses information about which gd container it targets to further specify handlers and data passed down to lower level components
We may need to use an array but it will involve complexity when working with generic updates from Layout. Remove for now until we know we need it.
<Trace> mixed logic with structure. We aim to present a structural component API for declaring the structure of the UI. This should be independent of the logical connections to Plotly.js. Now we can pair connectTraceToPlot with <Fold> or <Section> or even <Panel>
This more closely approximates the way different layers must be linked together.
The Layout component is now whatever connectToLayout(<Container>) is necessary
|
||
it('accepts array index notation', () => { | ||
test(['foo', 'bar', [3], 'value'], 'foo.bar[3].value'); | ||
}); |
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.
why?
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.
not sure, I lifted this thing from the workspace. The walker is useful, the array notation probably not. In future incarnations I imagine we will not actually use this thing. Also the whole makeAttrsetterPath
function is used in the workspace but you told me about nestedProperty({}, attrPath).path
or whatever it is which makes this whole function redundant. I'll probably delete it.
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.
Looks great, really nice tests. One question about makeAttrSetterPath
behavior, unless it has some purpose I'm not seeing I'd reduce to one way of providing an array index. But I won't hold it up for that.
I really like putting traceIndex
etc into context
- seems like it will extend well to other item selections (maybe you already have this in other PRs even) like annotations, axes, updatemenus[ buttons]...
💃
Yup plenty more |
Sub menus and Colorpicker
Centering of fields with no labels
…cess Default fonts and correct plot schema access
<Field> component and Reorganize folder structure
Introduce layout
Robust plot schema lookups
@alexcjohnson this PR tests
<Section>
. During testing I realized that we presumed our UI Fields like<Numeric>
always had access totraceIndex
andfullTraceIndex
which was only the case when they were nested within aTraceAccordion
.I factored out
findFullTraceIndex
from<TraceAccordion>
and now each widget (via unpackPlotProps) checks itscontext
andprops
fortraceIndex
andfullTraceIndex
and will also computefullTraceIndex
if it has to. This means users should not have to worry aboutfullTraceIndex
at all.I built up the test fixture libs a little more. Factoring out the derefencing logic into its own function (and porting over the more robust Workspace object walkers) from
Hub.js
allows us to toggle between referenced and dereferenced fixtures with a config flag.Next PR will add more robust handling of PlotSchema.