-
Notifications
You must be signed in to change notification settings - Fork 31
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
New component: Grid #583
Comments
org/ssb |
org/krt (finanstilsynet) |
We discussed this a bit during the sprint planning earlier today. Some questions came up. It seems like this task is ready for someone to start working on it, but some specifics are not entirely decided on yet. So, regarding how to define this in the layout JSON files: Should we support multiple components inside a single cell? Maybe not now, but it might be needed later. In that case, we'll need designs for how that should look (and how two input fields should be differentiated). I suggest that we only support one field per cell for now (and only simple components in them, so no support for the The other question was regarding how to reference the components that should live inside the cells. The way I see it, we have two alternatives; we either keep on doing the same thing as it's been done in (repeating) groups, by referencing children externally: [
{
"id": "myGroup",
"type": "Group",
"children": ["myComponent1", "myComponent2"]
},
{
"id": "myComponent1",
"type": "Input"
},
{
"id": "myComponent2",
"type": "Input"
},
] But for a {
"id": "myGrid",
"type": "Grid",
"rows": [
["myFirstRowComponent1", "myFirstRowComponent2"],
["mySecondRowComponent1", "mySecondRowComponent2"]
]
} When thinking more about it:
All in all, we should take care to find a configuration format that everyone can live with (and still supports our other functionality, like dynamics/expressions, calculation, validation, etc) without too much hassle. We should probably also talk to Team Studio when deciding on a format for this configuration, so we find something they're happy with implementing in Studio. |
{
"id": "myGrid",
"type": "Grid",
"numColumns": 2
"rows": [
"myFirstRowComponent1",
"myFirstRowComponent2",
"mySecondRowComponent1",
"mySecondRowComponent2"
]
} |
{
"id": "myGrid",
"type": "Grid",
"rows": [
{
"header": true,
"cells": [
{"text": "My header text"},
{"component": "myFirstRowComponent1"}
]
},
{ "cells": [
{"text": "my.text.key"},
{"component": "mySecondRowComponent1"}
]},
{
"readOnly": true,
"cells": [
{"text": "texts.sum"},
{"text": ["sum",
["component", "myFirstRowComponent1"],
["component", "mySecondRowComponent1"]
]}
]
}
]
} |
We probably need some way to support colspan and rowspan also. That might talk in favor of a more verbose grid layout than a simple list and numCols |
From a studio perspective, the formats discussed here seem like ok alternatives to implement. If there is a need for a lot of configuration on the Restricting the components that can be used inside a table cell to basic form components seems like a good idea, we want to avoid things like nested tables 😅 Do we need settings on a row level, or should these be part of the |
@nkylstad Thanks for feedback! 🥳 I'm currently working on the assumption that we'll allow some row-level configuration AND cell-level configuration. That means, you could set For now, we have defined the following typescript types: export interface GridCellOptions {
header?: boolean;
readOnly?: boolean;
}
export interface GridComponentRef extends GridCellOptions {
component: string;
}
export interface GridText extends GridCellOptions {
text: ExprVal.String;
}
export type GridCell<C = GridComponentRef> = C | GridText | null;
export interface GridRow<C = GridComponentRef> extends GridCellOptions {
cells: GridCell<C>[];
}
export interface ILayoutCompGrid<C = GridComponentRef> extends ILayoutCompBase<'Grid'> {
rows: GridRow<C>[];
} So, every option in |
I am fine with most of the suggestions here. If the components are not going to be referenced outside of the table, I am in favor of inlining the cell configuration directly. Has there been any discussion on how to support summing of cells? Should we support other aggregate functions (average etc.) as well? I don't find the array syntax in the example quite intuitive. Could we do something like this instead?
|
@TomasEng We're not aiming for inlining of components in the first implementation. We might go there later (then also for groups), but right now most legacy code in app-frontend would not support it, so we'd have to do some major cleanup first. Also, sum/average is not really functionality we're supporting in this component, as it's already implemented in single fields by use of calculation (either backend or frontend). We have no explicit support for neither sum or average there, as the exact logic is something the application developers need to decide upon, and implement. The syntax you describe above looks a lot like what we discussed when developing dynamic expressions, although we arrived at a bit simpler where the expression is an array where the function name comes first and is followed by arguments, so |
@olemartinorg, okay, so functions are out of scope of this task, I see. Then I have no more objections 🙂 |
Description
After a refinement meeting for #107, we found that some specific of the needs can be isolated into a separate (new) studio/app-frontend layout component: Grid (see my comment in #543).
Example:
Functional requirements
Additional Information
The text was updated successfully, but these errors were encountered: