Skip to content

Commit 014fa11

Browse files
committed
Refaktorering av typer
1 parent 1df2345 commit 014fa11

File tree

11 files changed

+367
-363
lines changed

11 files changed

+367
-363
lines changed

packages/fyllut-backend/src/routers/api/form.ts

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const mapLimitedForm = (form: NavFormType, translate: TranslateFunction) => {
5050
properties: {
5151
skjemanummer: form.properties.skjemanummer,
5252
tema: form.properties.tema,
53-
innsending: form.properties.innsending,
5453
submissionTypes: form.properties.submissionTypes,
5554
ettersending: form.properties.ettersending,
5655
subsequentSubmissionTypes: form.properties.subsequentSubmissionTypes,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
import { AccordionSettingValues } from '../accordion';
2+
import { AttachmentSettingValues } from '../attachment';
3+
import { TextSize } from '../text';
4+
import { PrefillKey } from './prefill';
5+
6+
export type AddressType = 'NORWEGIAN_ADDRESS' | 'POST_OFFICE_BOX' | 'FOREIGN_ADDRESS';
7+
export type InputMode = 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
8+
9+
type ComponentDataSrc = 'values' | 'url' | 'json' | 'custom' | 'resource';
10+
export interface ComponentData {
11+
values?: ComponentValue[];
12+
url?: string;
13+
custom?: any;
14+
}
15+
16+
export type AttachmentType = 'default' | 'other';
17+
export interface ComponentValue {
18+
value: string;
19+
label: string;
20+
description?: string;
21+
}
22+
23+
export interface CustomLabels {
24+
[key: string]: string;
25+
}
26+
27+
export interface Component {
28+
id?: string;
29+
navId?: string;
30+
key: string;
31+
label: string;
32+
customLabels?: CustomLabels;
33+
type: string;
34+
content?: string;
35+
calculateValue?: string;
36+
allowCalculateOverride?: boolean;
37+
data?: ComponentData;
38+
dataSrc?: ComponentDataSrc;
39+
validate?: ComponentValidate;
40+
conditional?: ComponentConditional;
41+
customConditional?: string;
42+
valueProperty?: string;
43+
labelProperty?: string;
44+
properties?: ComponentProperties;
45+
component?: Component;
46+
components?: Component[];
47+
otherDocumentation?: boolean;
48+
isAttachmentPanel?: boolean;
49+
prefillKey?: PrefillKey;
50+
values?: ComponentValue[];
51+
attachmentValues?: AttachmentSettingValues;
52+
accordionValues?: AccordionSettingValues;
53+
attachmentType?: AttachmentType;
54+
hideLabel?: boolean;
55+
description?: string;
56+
suffix?: string;
57+
prefix?: string;
58+
title?: string;
59+
html?: string;
60+
legend?: string;
61+
additionalDescriptionLabel?: string;
62+
additionalDescriptionText?: string;
63+
contentForPdf?: string;
64+
altText?: string;
65+
buttonText?: string;
66+
addAnother?: string;
67+
removeAnother?: string;
68+
input?: boolean;
69+
readOnly?: boolean;
70+
weight?: number;
71+
tag?: string;
72+
collapsible?: boolean;
73+
collapsed?: boolean;
74+
fieldSize?: string;
75+
titleSize?: TextSize;
76+
autocomplete?: string;
77+
spellCheck?: boolean;
78+
rows?: number;
79+
editor?: string;
80+
wysiwyg?: object | boolean;
81+
as?: string;
82+
style?: object;
83+
theme?: string;
84+
defaultValue?: string | number | boolean | any[] | object;
85+
tooltip?: string;
86+
reorder?: boolean;
87+
dataGridLabel?: boolean;
88+
alerttype?: string;
89+
fileMaxSize?: string;
90+
storage?: string;
91+
image?: any;
92+
filePattern?: string;
93+
webcam?: boolean;
94+
multiple?: boolean;
95+
customDefaultValue?: string;
96+
keyLabel?: string;
97+
valueComponent?: Component;
98+
isInline?: boolean;
99+
textDisplay?: 'form' | 'formPdf' | 'pdf';
100+
autoExpand?: boolean;
101+
customClass?: string;
102+
validateOn?: string;
103+
isNavDataGrid?: boolean;
104+
hidden?: boolean;
105+
clearOnHide?: boolean;
106+
specificEarliestAllowedDate?: string;
107+
specificLatestAllowedDate?: string;
108+
beforeDateInputKey?: string;
109+
mayBeEqual?: string;
110+
earliestAllowedDate?: string;
111+
latestAllowedDate?: string;
112+
getValue?: () => string;
113+
rerender?: () => void;
114+
onChange?: (props) => void;
115+
inputType?: InputMode;
116+
ignoreNorway?: boolean;
117+
tree?: boolean;
118+
path?: string;
119+
protected?: boolean;
120+
disableAddingRemovingRows?: boolean;
121+
addressPriority?: 'bostedsadresse' | 'oppholdsadresse' | 'kontaktadresse';
122+
addressType?: AddressType;
123+
prefillValue?: string | object;
124+
protectedApiKey?: boolean;
125+
yourInformation?: boolean;
126+
widthPercent?: number;
127+
}
128+
129+
export interface ComponentProperties {
130+
vedleggstittel?: string;
131+
vedleggskode?: string;
132+
vedleggskjema?: string;
133+
}
134+
135+
export interface Attachment {
136+
vedleggstittel?: string;
137+
vedleggskode?: string;
138+
label?: string;
139+
}
140+
141+
export interface Panel extends Component {
142+
title: string;
143+
}
144+
145+
export interface ComponentValidate {
146+
custom?: string;
147+
json?: string;
148+
required?: boolean;
149+
pattern?: string;
150+
patternMessage?: string;
151+
min?: number;
152+
max?: number;
153+
minLength?: number;
154+
maxLength?: number;
155+
minYear?: number;
156+
maxYear?: number;
157+
digitsOnly?: number;
158+
}
159+
160+
export interface ComponentConditional {
161+
when?: string;
162+
json?: object;
163+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { Enhetstype } from '../enhet';
2+
import { PrefillKey } from './prefill';
3+
import { FormSignaturesType, NewFormSignatureType } from './signature';
4+
import { DeclarationType, InnsendingType, SubmissionType } from './types';
5+
6+
/**
7+
* @property {SubmissionType[]} submissionTypes - Innsending.
8+
* @property {SubmissionType[]} subsequentSubmissionTypes - Ettersending.
9+
*/
10+
export interface FormPropertiesType {
11+
skjemanummer: string;
12+
tema: string;
13+
modified?: string;
14+
modifiedBy?: string;
15+
published?: string;
16+
publishedBy?: string;
17+
publishedLanguages?: string[];
18+
unpublished?: string;
19+
unpublishedBy?: string;
20+
downloadPdfButtonText?: string;
21+
submissionTypes: SubmissionType[];
22+
subsequentSubmissionTypes: SubmissionType[];
23+
innsending?: InnsendingType;
24+
ettersending?: InnsendingType;
25+
ettersendelsesfrist?: string;
26+
innsendingForklaring?: string;
27+
innsendingOverskrift?: string;
28+
isTestForm?: boolean;
29+
isLockedForm?: boolean;
30+
lockedFormReason?: string;
31+
declarationType?: DeclarationType;
32+
declarationText?: string;
33+
mottaksadresseId?: string;
34+
enhetMaVelgesVedPapirInnsending?: boolean;
35+
enhetstyper?: Enhetstype[];
36+
hasLabeledSignatures?: boolean;
37+
signatures?: NewFormSignatureType[] | FormSignaturesType;
38+
descriptionOfSignatures?: string;
39+
descriptionOfSignaturesPositionUnder?: boolean;
40+
prefill?: PrefillKey[];
41+
uxSignalsId?: string;
42+
uxSignalsInnsending?: InnsendingType;
43+
hideUserTypes?: boolean;
44+
mellomlagringDurationDays?: string;
45+
}
46+
47+
export type FormPropertiesPublishing = Pick<
48+
FormPropertiesType,
49+
'modified' | 'modifiedBy' | 'published' | 'publishedBy' | 'publishedLanguages' | 'unpublished' | 'unpublishedBy'
50+
>;

0 commit comments

Comments
 (0)