Skip to content

Commit 53783ba

Browse files
authored
Merge branch 'main' into make-usebpmneditor-return-callback-ref
2 parents c31432e + 15bd10a commit 53783ba

File tree

18 files changed

+353
-119
lines changed

18 files changed

+353
-119
lines changed

frontend/language/src/nb.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@
751751
"process_editor.configuration_panel_set_unique_from_signatures_in_data_types": "Samme person kan ikke signere både denne oppgaven og:",
752752
"process_editor.configuration_panel_set_unique_from_signatures_in_data_types_link": "Bruk unik signatur på denne oppgaven",
753753
"process_editor.configuration_panel_signing_task": "Oppgave: Signering",
754-
"process_editor.configuration_view_panel_id_label": "ID: {{id}}",
754+
"process_editor.configuration_view_panel_id_label": "ID:",
755755
"process_editor.configuration_view_panel_name_label": "Navn: ",
756756
"process_editor.configuration_view_panel_no_task": "Du har ikke valgt noen oppgave",
757757
"process_editor.configuration_view_panel_please_choose_task": "Velg en oppgave for å se detaljer om valgt oppgave.",
@@ -1836,7 +1836,11 @@
18361836
"ux_editor.properties_panel.subform_table_columns.cell_content_query_label": "Query",
18371837
"ux_editor.properties_panel.subform_table_columns.choose_component": "Velg komponenten fra underskjemaet som skal vises her",
18381838
"ux_editor.properties_panel.subform_table_columns.choose_component_description": "Listen viser bare de komponentene som har minst én datamodellbinding og en ledetekst",
1839+
"ux_editor.properties_panel.subform_table_columns.column_cell_content": "Celleinnhold (query):",
18391840
"ux_editor.properties_panel.subform_table_columns.column_header": "Kolonne {{columnNumber}}",
1841+
"ux_editor.properties_panel.subform_table_columns.column_title_edit": "Kolonnetittel",
1842+
"ux_editor.properties_panel.subform_table_columns.column_title_error": "Kolonnetittel er påkrevd",
1843+
"ux_editor.properties_panel.subform_table_columns.column_title_unedit": "Kolonnetittel:",
18401844
"ux_editor.properties_panel.subform_table_columns.delete_column": "Slett kolonne {{columnNumber}}",
18411845
"ux_editor.properties_panel.subform_table_columns.header_content_label": "Header Content",
18421846
"ux_editor.properties_panel.subform_table_columns.heading": "Valg for tabell",
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
.container {
2-
display: flex;
2+
display: grid;
3+
grid-template-columns: 1fr auto;
34
align-items: center;
4-
justify-content: space-between;
5-
flex: 1;
65
gap: var(--fds-spacing-2);
7-
padding: var(--fds-spacing-2) var(--fds-spacing-3);
86
}
97

10-
.innerContainer {
11-
display: flex;
12-
gap: var(--fds-spacing-1);
8+
.prefixIcon {
9+
grid-template-columns: auto 1fr;
10+
}
11+
12+
.container:has(:nth-child(3)) {
13+
grid-template-columns: auto 1fr auto;
1314
}
1415

1516
.label {
1617
font-weight: 500;
1718
}
1819

19-
.iconLabelContainer {
20-
display: flex;
21-
align-items: center;
20+
.label,
21+
.ellipsis {
22+
text-overflow: ellipsis;
23+
overflow: hidden;
24+
white-space: nowrap;
2225
}

frontend/libs/studio-components/src/components/StudioDisplayTile/StudioDisplayTile.test.tsx

+26-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,41 @@ import { StudioDisplayTile, type StudioDisplayTileProps } from './StudioDisplayT
44

55
const padlockIconTestId: string = 'padlockIconTestId';
66

7+
const label = 'label';
8+
const value = 'value';
79
const defaultProps: StudioDisplayTileProps = {
8-
label: 'Label',
9-
value: 'value',
10+
label,
11+
value,
1012
};
1113

1214
describe('StudioDisplayTile', () => {
13-
it('should show the padlock icon when showPadlock is true', () => {
14-
render(<StudioDisplayTile {...defaultProps} showPadlock />);
15+
it('should render displayTile', () => {
16+
render(<StudioDisplayTile {...defaultProps} />);
17+
expect(screen.getByLabelText(label)).toBeInTheDocument();
18+
});
19+
20+
it('should render displayTile with value', () => {
21+
render(<StudioDisplayTile {...defaultProps} />);
22+
expect(screen.getByText(value)).toBeInTheDocument();
23+
});
24+
25+
it('should show the padlock icon by default', () => {
26+
render(<StudioDisplayTile {...defaultProps} />);
1527
expect(screen.getByTestId(padlockIconTestId)).toBeInTheDocument();
1628
});
1729

1830
it('should hide the padlock icon when showPadlock is false', () => {
1931
render(<StudioDisplayTile {...defaultProps} showPadlock={false} />);
2032
expect(screen.queryByTestId(padlockIconTestId)).not.toBeInTheDocument();
2133
});
34+
35+
it('should not assign prefix icon className by default', () => {
36+
render(<StudioDisplayTile {...defaultProps} />);
37+
expect(screen.getByLabelText(label)).not.toHaveClass('prefixIcon');
38+
});
39+
40+
it('should assign prefix icon className when prefix icon is set', () => {
41+
render(<StudioDisplayTile {...defaultProps} icon={<svg />} />);
42+
expect(screen.getByLabelText(label)).toHaveClass('prefixIcon');
43+
});
2244
});

frontend/libs/studio-components/src/components/StudioDisplayTile/StudioDisplayTile.tsx

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { forwardRef, type HTMLAttributes } from 'react';
22
import { PadlockLockedFillIcon } from '@studio/icons';
33
import cn from 'classnames';
4-
import { Paragraph } from '@digdir/designsystemet-react';
4+
import { Label, Paragraph } from '@digdir/designsystemet-react';
55
import classes from './StudioDisplayTile.module.css';
66

77
export type StudioDisplayTileProps = {
@@ -23,18 +23,19 @@ const StudioDisplayTile = forwardRef<HTMLDivElement, StudioDisplayTileProps>(
2323
}: StudioDisplayTileProps,
2424
ref,
2525
): React.ReactElement => {
26-
const className = cn(givenClassName, classes.container);
26+
const hasPrefixIcon = !!icon;
27+
const className = cn(givenClassName, classes.container, hasPrefixIcon && classes.prefixIcon);
2728

2829
return (
29-
<div {...rest} className={className} ref={ref}>
30-
<div className={classes.innerContainer}>
31-
<div className={classes.iconLabelContainer}>
32-
{icon ?? null}
33-
<Paragraph size='small' className={classes.label}>
34-
{label}
35-
</Paragraph>
36-
</div>
37-
<Paragraph size='small'>{value}</Paragraph>
30+
<div {...rest} aria-label={label} className={className} ref={ref}>
31+
{icon}
32+
<div className={classes.ellipsis}>
33+
<Label size='small' className={classes.label}>
34+
{label}
35+
</Label>
36+
<Paragraph size='small' className={classes.ellipsis}>
37+
{value}
38+
</Paragraph>
3839
</div>
3940
{showPadlock && <PadlockLockedFillIcon data-testid='padlockIconTestId' />}
4041
</div>

frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.module.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
}
2020

2121
.displayTile {
22-
padding-inline: var(--fds-spacing-5);
22+
padding-inline: var(--fds-spacing-4);
2323
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.container {
2+
display: flex;
3+
flex-direction: column;
4+
padding: var(--fds-spacing-4);
5+
gap: var(--fds-spacing-2);
6+
}

frontend/packages/process-editor/src/components/ConfigViewerPanel/ConfigViewerPanel.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getConfigTitleHelpTextKey, getConfigTitleKey } from '../../utils/config
66
import { useTranslation } from 'react-i18next';
77
import { Alert, Heading, Paragraph } from '@digdir/designsystemet-react';
88
import { ConfigSurface } from '../ConfigSurface/ConfigSurface';
9+
import classes from './ConfigViewerPanel.module.css';
910

1011
export const ConfigViewerPanel = (): React.ReactElement => {
1112
return (
@@ -52,7 +53,7 @@ export const ConfigViewerPanelContent = (): React.ReactElement => {
5253
title: t('process_editor.configuration_panel_header_help_text_title'),
5354
}}
5455
/>
55-
<div>
56+
<div className={classes.container}>
5657
{propertiesToDisplay.map(({ label, value }) => (
5758
<StudioDisplayTile key={label} label={label} value={value} />
5859
))}

frontend/packages/ux-editor/src/components/Properties/EditSubformTableColumns/ColumnElement/ColumnElement.test.tsx

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { screen, waitFor } from '@testing-library/react';
2+
import { screen } from '@testing-library/react';
33
import { ColumnElement, type ColumnElementProps } from './ColumnElement';
44
import { textMock } from '@studio/testing/mocks/i18nMock';
55
import { renderWithProviders } from 'dashboard/testing/mocks';
@@ -31,15 +31,15 @@ const defaultProps: ColumnElementProps = {
3131
isInitialOpenForEdit: false,
3232
onDeleteColumn: jest.fn(),
3333
onEdit: jest.fn(),
34-
layoutSetName: layoutSet3SubformNameMock,
34+
subformLayout: layoutSet3SubformNameMock,
3535
};
3636

3737
describe('ColumnElement', () => {
3838
afterEach(() => {
3939
jest.clearAllMocks();
4040
});
4141

42-
it('should call onEdit with updated header content when header text field is blurred', async () => {
42+
it('should call onEdit with updated header content when click on save button', async () => {
4343
const onEditMock = jest.fn();
4444

4545
const user = userEvent.setup();
@@ -61,18 +61,25 @@ describe('ColumnElement', () => {
6161
screen.getByRole('option', { name: new RegExp(`${subformLayoutMock.component1Id}`) }),
6262
);
6363

64-
await waitFor(async () => {
65-
await user.click(
66-
screen.getByRole('button', {
67-
name: textMock('general.save'),
68-
}),
69-
);
70-
});
64+
await user.click(
65+
await screen.findByText(
66+
textMock('ux_editor.properties_panel.subform_table_columns.column_title_unedit'),
67+
),
68+
);
69+
await user.type(
70+
screen.getByText(
71+
textMock('ux_editor.properties_panel.subform_table_columns.column_title_edit'),
72+
),
73+
'New Title',
74+
);
75+
76+
const saveButton = await screen.findByRole('button', { name: textMock('general.save') });
77+
await user.click(saveButton);
7178

7279
expect(onEditMock).toHaveBeenCalledTimes(1);
7380
expect(onEditMock).toHaveBeenCalledWith({
7481
...mockTableColumn,
75-
headerContent: subformLayoutMock.component1.textResourceBindings.title,
82+
headerContent: expect.stringContaining('subform_table_column_title_'),
7683
cellContent: { query: subformLayoutMock.component1.dataModelBindings.simpleBinding },
7784
});
7885
});

frontend/packages/ux-editor/src/components/Properties/EditSubformTableColumns/ColumnElement/ColumnElement.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useStudioEnvironmentParams } from 'app-shared/hooks/useStudioEnvironmen
99
import { textResourceByLanguageAndIdSelector } from '../../../../selectors/textResourceSelectors';
1010

1111
export type ColumnElementProps = {
12-
layoutSetName: string;
12+
subformLayout: string;
1313
tableColumn: TableColumn;
1414
columnNumber: number;
1515
isInitialOpenForEdit: boolean;
@@ -23,7 +23,7 @@ export const ColumnElement = ({
2323
isInitialOpenForEdit,
2424
onDeleteColumn,
2525
onEdit,
26-
layoutSetName,
26+
subformLayout,
2727
}: ColumnElementProps): ReactElement => {
2828
const { t } = useTranslation();
2929
const [editing, setEditing] = useState(isInitialOpenForEdit);
@@ -38,7 +38,7 @@ export const ColumnElement = ({
3838
if (editing) {
3939
return (
4040
<EditColumnElement
41-
layoutSetName={layoutSetName}
41+
subformLayout={subformLayout}
4242
sourceColumn={tableColumn}
4343
columnNumber={columnNumber}
4444
onDeleteColumn={onDeleteColumn}

0 commit comments

Comments
 (0)