Skip to content
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

Chore/12320 update address component v4 #12405

Merged
merged 8 commits into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/language/src/nb.json
Original file line number Diff line number Diff line change
@@ -1377,6 +1377,7 @@
"ux_editor.component_help_text.Accordion": "Med Accordion kan du presentere mye innhold på liten plass i en eller flere rader. Hele raden er klikkbar og lar brukere åpne eller lukke visningen av innholdet under.",
"ux_editor.component_help_text.AccordionGroup": "En samling med Accordions som vises vertikalt. Brukes for å gruppere Accordions som hører sammen.",
"ux_editor.component_help_text.ActionButton": "Knapp for å trigge en spesifisert aksjon knyttet til prosess-steget sluttbruker befinner seg i. Eksempler inkluderer 'sign', 'confirm', 'reject'.",
"ux_editor.component_help_text.Address": "Komponent for å fylle ut adresse. Automatisk oppslag av poststed basert på postnumer.",
"ux_editor.component_help_text.AddressComponent": "Komponent for å fylle ut adresse. Automatisk oppslag av poststed basert på postnumer.",
"ux_editor.component_help_text.Alert": "Komponenten kan brukes til å vise en melding med ulike alvorlighetsgrader.",
"ux_editor.component_help_text.AttachmentList": "Viser en liste over vedlegg som er lastet opp på instansen for det prosess-steget sluttbruker befinner seg i.",
@@ -1518,6 +1519,7 @@
"ux_editor.component_title.Accordion": "Accordion",
"ux_editor.component_title.AccordionGroup": "Accordiongruppe",
"ux_editor.component_title.ActionButton": "Aksjonsknapp",
"ux_editor.component_title.Address": "Adresse",
"ux_editor.component_title.AddressComponent": "Adresse",
"ux_editor.component_title.Alert": "Varsel",
"ux_editor.component_title.AttachmentList": "Liste over vedlegg",
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ export type ComponentSpecificConfig<T extends ComponentType = ComponentType> = {
buttonStyle: ButtonStyle;
action: ActionButtonAction;
};
[ComponentType.AddressComponent]: FormComponentProps &
[ComponentType.Address]: FormComponentProps &
SummarizableComponentProps &
LabeledComponentProps & {
simplified?: boolean;
2 changes: 1 addition & 1 deletion frontend/packages/shared/src/types/ComponentType.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ export enum ComponentType {
Accordion = 'Accordion',
AccordionGroup = 'AccordionGroup',
ActionButton = 'ActionButton',
AddressComponent = 'AddressComponent',
Address = 'Address',
Alert = 'Alert',
AttachmentList = 'AttachmentList',
Button = 'Button',
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import userEvent from '@testing-library/user-event';

// Test data:
const component: FormAddressComponent = {
type: ComponentType.AddressComponent,
type: ComponentType.Address,
dataModelBindings: {
test: 'test',
},
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export function ComponentSpecificContent({
layoutName,
}: IGenericEditComponent) {
switch (component.type) {
case ComponentType.AddressComponent:
case ComponentType.Address:
return (
<AddressComponent
component={component}
6 changes: 3 additions & 3 deletions frontend/packages/ux-editor/src/data/formItemConfig.ts
Original file line number Diff line number Diff line change
@@ -81,8 +81,8 @@ export const formItemConfigs: FormItemConfigs = {
},
icon: FingerButtonIcon,
},
[ComponentType.AddressComponent]: {
name: ComponentType.AddressComponent,
[ComponentType.Address]: {
name: ComponentType.Address,
itemType: LayoutItemType.Component,
defaultProperties: {
simplified: true,
@@ -382,7 +382,7 @@ export const formItemConfigs: FormItemConfigs = {
};

export const advancedItems: FormItemConfigs[ComponentType][] = [
formItemConfigs[ComponentType.AddressComponent],
formItemConfigs[ComponentType.Address],
formItemConfigs[ComponentType.AttachmentList],
formItemConfigs[ComponentType.Group],
formItemConfigs[ComponentType.Grid],
6 changes: 3 additions & 3 deletions frontend/packages/ux-editor/src/testing/componentMocks.ts
Original file line number Diff line number Diff line change
@@ -85,9 +85,9 @@ const buttonComponent: FormComponent<ComponentType.Button> = {
type: ComponentType.Button,
onClickAction: jest.fn(),
};
const addressComponent: FormComponent<ComponentType.AddressComponent> = {
const addressComponent: FormComponent<ComponentType.Address> = {
...commonProps,
type: ComponentType.AddressComponent,
type: ComponentType.Address,
simplified: true,
};
const navigationBarComponent: FormComponent<ComponentType.NavigationBar> = {
@@ -148,7 +148,7 @@ const repeatingGroupContainer: FormContainer<ComponentType.RepeatingGroup> = {
export const componentMocks = {
[ComponentType.AccordionGroup]: accordionGroupContainer,
[ComponentType.Accordion]: accordionContainer,
[ComponentType.AddressComponent]: addressComponent,
[ComponentType.Address]: addressComponent,
[ComponentType.AttachmentList]: attachmentListComponent,
[ComponentType.ButtonGroup]: buttonGroupContainer,
[ComponentType.Button]: buttonComponent,
82 changes: 43 additions & 39 deletions frontend/packages/ux-editor/src/testing/componentSchemaMocks.ts
Original file line number Diff line number Diff line change
@@ -2,12 +2,13 @@ import AlertSchema from './schemas/json/component/Alert.schema.v1.json';
import AccordionSchema from './schemas/json/component/Accordion.schema.v1.json';
import AccordionGroupSchema from './schemas/json/component/AccordionGroup.schema.v1.json';
import ActionButtonSchema from './schemas/json/component/ActionButton.schema.v1.json';
import AddressComponentSchema from './schemas/json/component/AddressComponent.schema.v1.json';
import AddressSchema from './schemas/json/component/Address.schema.v1.json';
import AttachmentListSchema from './schemas/json/component/AttachmentList.schema.v1.json';
import ButtonSchema from './schemas/json/component/Button.schema.v1.json';
import ButtonGroupSchema from './schemas/json/component/ButtonGroup.schema.v1.json';
import CheckboxesSchema from './schemas/json/component/Checkboxes.schema.v1.json';
import CustomSchema from './schemas/json/component/Custom.schema.v1.json';
import CustomButtonSchema from './schemas/json/component/CustomButton.schema.v1.json';
import DatepickerSchema from './schemas/json/component/Datepicker.schema.v1.json';
import DropdownSchema from './schemas/json/component/Dropdown.schema.v1.json';
import FileUploadSchema from './schemas/json/component/FileUpload.schema.v1.json';
@@ -35,43 +36,46 @@ import RadioButtonsSchema from './schemas/json/component/RadioButtons.schema.v1.
import RepeatingGroupSchema from './schemas/json/component/RepeatingGroup.schema.v1.json';
import SummarySchema from './schemas/json/component/Summary.schema.v1.json';
import TextAreaSchema from './schemas/json/component/TextArea.schema.v1.json';
import { ComponentType } from 'app-shared/types/ComponentType';
import type { JsonSchema } from 'app-shared/types/JsonSchema';

export const componentSchemaMocks = {
AccordionGroup: AccordionGroupSchema,
Accordion: AccordionSchema,
ActionButton: ActionButtonSchema,
AddressComponent: AddressComponentSchema,
Alert: AlertSchema,
AttachmentList: AttachmentListSchema,
Button: ButtonSchema,
ButtonGroup: ButtonGroupSchema,
Checkboxes: CheckboxesSchema,
Custom: CustomSchema,
Datepicker: DatepickerSchema,
Dropdown: DropdownSchema,
FileUpload: FileUploadSchema,
FileUploadWithTag: FileUploadWithTagSchema,
Grid: GridSchema,
Group: GroupSchema,
Header: HeaderSchema,
IFrame: IFrameSchema,
Image: ImageSchema,
Input: InputSchema,
InstanceInformation: InstanceInformationSchema,
InstantiationButton: InstantiationButtonSchema,
Likert: LikertSchema,
LikertItem: LikertItemSchema,
Link: LinkSchema,
List: ListSchema,
Map: MapSchema,
MultipleSelect: MultipleSelectSchema,
NavigationBar: NavigationBarSchema,
NavigationButtons: NavigationButtonsSchema,
Panel: PanelSchema,
Paragraph: ParagraphSchema,
PrintButton: PrintButtonSchema,
RadioButtons: RadioButtonsSchema,
RepeatingGroup: RepeatingGroupSchema,
Summary: SummarySchema,
TextArea: TextAreaSchema,
export const componentSchemaMocks: Record<ComponentType, JsonSchema> = {
[ComponentType.AccordionGroup]: AccordionGroupSchema,
[ComponentType.Accordion]: AccordionSchema,
[ComponentType.ActionButton]: ActionButtonSchema,
[ComponentType.Address]: AddressSchema,
[ComponentType.Alert]: AlertSchema,
[ComponentType.AttachmentList]: AttachmentListSchema,
[ComponentType.Button]: ButtonSchema,
[ComponentType.ButtonGroup]: ButtonGroupSchema,
[ComponentType.Checkboxes]: CheckboxesSchema,
[ComponentType.Custom]: CustomSchema,
[ComponentType.CustomButton]: CustomButtonSchema,
[ComponentType.Datepicker]: DatepickerSchema,
[ComponentType.Dropdown]: DropdownSchema,
[ComponentType.FileUpload]: FileUploadSchema,
[ComponentType.FileUploadWithTag]: FileUploadWithTagSchema,
[ComponentType.Grid]: GridSchema,
[ComponentType.Group]: GroupSchema,
[ComponentType.Header]: HeaderSchema,
[ComponentType.IFrame]: IFrameSchema,
[ComponentType.Image]: ImageSchema,
[ComponentType.Input]: InputSchema,
[ComponentType.InstanceInformation]: InstanceInformationSchema,
[ComponentType.InstantiationButton]: InstantiationButtonSchema,
[ComponentType.Likert]: LikertSchema,
[ComponentType.LikertItem]: LikertItemSchema,
[ComponentType.Link]: LinkSchema,
[ComponentType.List]: ListSchema,
[ComponentType.Map]: MapSchema,
[ComponentType.MultipleSelect]: MultipleSelectSchema,
[ComponentType.NavigationBar]: NavigationBarSchema,
[ComponentType.NavigationButtons]: NavigationButtonsSchema,
[ComponentType.Panel]: PanelSchema,
[ComponentType.Paragraph]: ParagraphSchema,
[ComponentType.PrintButton]: PrintButtonSchema,
[ComponentType.RadioButtons]: RadioButtonsSchema,
[ComponentType.RepeatingGroup]: RepeatingGroupSchema,
[ComponentType.Summary]: SummarySchema,
[ComponentType.TextArea]: TextAreaSchema,
};

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/packages/ux-editor/src/types/FormComponent.ts
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ export type FormFileUploaderWithTagComponent = FormComponent<ComponentType.FileU
export type FormButtonComponent = FormComponent<
ComponentType.Button | ComponentType.NavigationButtons
>;
export type FormAddressComponent = FormComponent<ComponentType.AddressComponent>;
export type FormAddressComponent = FormComponent<ComponentType.Address>;

export type FormComponent<T extends SimpleComponentType = SimpleComponentType> = {
[componentType in ComponentType]: FormComponentBase<componentType> &
Loading