Skip to content

Commit 3d22ae7

Browse files
committed
Refaktorering av typer
1 parent 27af1d4 commit 3d22ae7

File tree

9 files changed

+370
-361
lines changed

9 files changed

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

0 commit comments

Comments
 (0)