@defra/forms-model 3.0.168 → 3.0.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/components/component-types.js +47 -46
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/enums.js +31 -24
- package/dist/module/components/enums.js.map +1 -1
- package/dist/module/components/index.js +1 -2
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/conditions/condition-field.js.map +1 -1
- package/dist/module/conditions/condition-operators.js +12 -11
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/module/conditions/enums.js +5 -0
- package/dist/module/conditions/enums.js.map +1 -1
- package/dist/module/conditions/index.js +1 -1
- package/dist/module/conditions/index.js.map +1 -1
- package/dist/module/form/form-definition/index.js +4 -3
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/index.js +0 -1
- package/dist/module/index.js.map +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/enums.d.ts +8 -2
- package/dist/types/components/enums.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -2
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +46 -47
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/conditions/condition-field.d.ts +1 -1
- package/dist/types/conditions/condition-operators.d.ts +2 -1
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/dist/types/conditions/enums.d.ts +4 -0
- package/dist/types/conditions/enums.d.ts.map +1 -1
- package/dist/types/conditions/index.d.ts +1 -1
- package/dist/types/conditions/index.d.ts.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/component-types.ts +47 -46
- package/src/components/enums.ts +9 -2
- package/src/components/index.ts +1 -2
- package/src/components/types.ts +68 -71
- package/src/conditions/condition-field.ts +1 -1
- package/src/conditions/condition-operators.ts +19 -15
- package/src/conditions/enums.ts +5 -0
- package/src/conditions/index.ts +1 -1
- package/src/form/form-definition/index.ts +20 -11
- package/src/index.ts +0 -1
- package/dist/module/components/conditional-component-types.js +0 -10
- package/dist/module/components/conditional-component-types.js.map +0 -1
- package/dist/module/form/form-configuration/index.js +0 -16
- package/dist/module/form/form-configuration/index.js.map +0 -1
- package/dist/types/components/conditional-component-types.d.ts +0 -3
- package/dist/types/components/conditional-component-types.d.ts.map +0 -1
- package/dist/types/form/form-configuration/index.d.ts +0 -8
- package/dist/types/form/form-configuration/index.d.ts.map +0 -1
- package/src/components/conditional-component-types.ts +0 -14
- package/src/form/form-configuration/index.ts +0 -21
@@ -1,8 +1,13 @@
|
|
1
1
|
import Joi from 'joi'
|
2
2
|
|
3
|
+
import {
|
4
|
+
type ComponentSubType,
|
5
|
+
type ComponentType
|
6
|
+
} from '~/src/components/enums.js'
|
3
7
|
import { type ComponentDef } from '~/src/components/types.js'
|
4
8
|
import {
|
5
9
|
type ConditionRawData,
|
10
|
+
type ConditionWrapperValue,
|
6
11
|
type ConfirmationPage,
|
7
12
|
type EmailOutputConfiguration,
|
8
13
|
type FormDefinition,
|
@@ -75,21 +80,24 @@ const conditionGroupSchema = Joi.object().keys({
|
|
75
80
|
)
|
76
81
|
})
|
77
82
|
|
78
|
-
const conditionsModelSchema = Joi.
|
79
|
-
|
80
|
-
|
81
|
-
Joi.
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
const conditionsModelSchema = Joi.alternatives<ConditionWrapperValue>().try(
|
84
|
+
Joi.string(),
|
85
|
+
Joi.object().keys({
|
86
|
+
name: Joi.string().required(),
|
87
|
+
conditions: Joi.array().items(
|
88
|
+
Joi.alternatives().try(
|
89
|
+
conditionSchema,
|
90
|
+
conditionRefSchema,
|
91
|
+
conditionGroupSchema
|
92
|
+
)
|
85
93
|
)
|
86
|
-
)
|
87
|
-
|
94
|
+
})
|
95
|
+
)
|
88
96
|
|
89
97
|
const conditionsSchema = Joi.object<ConditionRawData>().keys({
|
90
98
|
name: Joi.string().required(),
|
91
99
|
displayName: Joi.string(),
|
92
|
-
value:
|
100
|
+
value: conditionsModelSchema.required()
|
93
101
|
})
|
94
102
|
|
95
103
|
const localisedString = Joi.alternatives().try(
|
@@ -99,7 +107,8 @@ const localisedString = Joi.alternatives().try(
|
|
99
107
|
|
100
108
|
export const componentSchema = Joi.object<ComponentDef>()
|
101
109
|
.keys({
|
102
|
-
|
110
|
+
subType: Joi.string<ComponentSubType>().optional(),
|
111
|
+
type: Joi.string<ComponentType>().required(),
|
103
112
|
name: Joi.string(),
|
104
113
|
title: localisedString,
|
105
114
|
hint: localisedString.optional(),
|
package/src/index.ts
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"conditional-component-types.js","names":["ConditionalComponentTypes","name","title","subType"],"sources":["../../../src/components/conditional-component-types.ts"],"sourcesContent":["import { type ConditionalComponent } from '~/src/components/types.js'\n\nexport const ConditionalComponentTypes: ConditionalComponent[] = [\n {\n name: 'TextField',\n title: 'Text field',\n subType: 'field'\n },\n {\n name: 'NumberField',\n title: 'Number field',\n subType: 'field'\n }\n]\n"],"mappings":"AAEA,OAAO,MAAMA,yBAAiD,GAAG,CAC/D;EACEC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EACnBC,OAAO,EAAE;AACX,CAAC,EACD;EACEF,IAAI,EAAE,aAAa;EACnBC,KAAK,EAAE,cAAc;EACrBC,OAAO,EAAE;AACX,CAAC,CACF","ignoreList":[]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
export class FormConfiguration {
|
2
|
-
Key;
|
3
|
-
DisplayName;
|
4
|
-
LastModified;
|
5
|
-
feedbackForm;
|
6
|
-
constructor(Key, DisplayName, LastModified, feedbackForm) {
|
7
|
-
if (!Key) {
|
8
|
-
throw Error('Form configuration must have a key');
|
9
|
-
}
|
10
|
-
this.Key = Key;
|
11
|
-
this.DisplayName = DisplayName || Key;
|
12
|
-
this.LastModified = LastModified;
|
13
|
-
this.feedbackForm = feedbackForm || false;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["FormConfiguration","Key","DisplayName","LastModified","feedbackForm","constructor","Error"],"sources":["../../../../src/form/form-configuration/index.ts"],"sourcesContent":["export class FormConfiguration {\n Key: string\n DisplayName: string\n LastModified: string | undefined\n feedbackForm: boolean | undefined\n\n constructor(\n Key: string,\n DisplayName?: string,\n LastModified?: string,\n feedbackForm?: boolean\n ) {\n if (!Key) {\n throw Error('Form configuration must have a key')\n }\n this.Key = Key\n this.DisplayName = DisplayName || Key\n this.LastModified = LastModified\n this.feedbackForm = feedbackForm || false\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB,CAAC;EAC7BC,GAAG;EACHC,WAAW;EACXC,YAAY;EACZC,YAAY;EAEZC,WAAWA,CACTJ,GAAW,EACXC,WAAoB,EACpBC,YAAqB,EACrBC,YAAsB,EACtB;IACA,IAAI,CAACH,GAAG,EAAE;MACR,MAAMK,KAAK,CAAC,oCAAoC,CAAC;IACnD;IACA,IAAI,CAACL,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,WAAW,GAAGA,WAAW,IAAID,GAAG;IACrC,IAAI,CAACE,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,YAAY,GAAGA,YAAY,IAAI,KAAK;EAC3C;AACF","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"conditional-component-types.d.ts","sourceRoot":"","sources":["../../../src/components/conditional-component-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAErE,eAAO,MAAM,yBAAyB,EAAE,oBAAoB,EAW3D,CAAA"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare class FormConfiguration {
|
2
|
-
Key: string;
|
3
|
-
DisplayName: string;
|
4
|
-
LastModified: string | undefined;
|
5
|
-
feedbackForm: boolean | undefined;
|
6
|
-
constructor(Key: string, DisplayName?: string, LastModified?: string, feedbackForm?: boolean);
|
7
|
-
}
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-configuration/index.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAA;gBAG/B,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,OAAO;CAUzB"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { type ConditionalComponent } from '~/src/components/types.js'
|
2
|
-
|
3
|
-
export const ConditionalComponentTypes: ConditionalComponent[] = [
|
4
|
-
{
|
5
|
-
name: 'TextField',
|
6
|
-
title: 'Text field',
|
7
|
-
subType: 'field'
|
8
|
-
},
|
9
|
-
{
|
10
|
-
name: 'NumberField',
|
11
|
-
title: 'Number field',
|
12
|
-
subType: 'field'
|
13
|
-
}
|
14
|
-
]
|
@@ -1,21 +0,0 @@
|
|
1
|
-
export class FormConfiguration {
|
2
|
-
Key: string
|
3
|
-
DisplayName: string
|
4
|
-
LastModified: string | undefined
|
5
|
-
feedbackForm: boolean | undefined
|
6
|
-
|
7
|
-
constructor(
|
8
|
-
Key: string,
|
9
|
-
DisplayName?: string,
|
10
|
-
LastModified?: string,
|
11
|
-
feedbackForm?: boolean
|
12
|
-
) {
|
13
|
-
if (!Key) {
|
14
|
-
throw Error('Form configuration must have a key')
|
15
|
-
}
|
16
|
-
this.Key = Key
|
17
|
-
this.DisplayName = DisplayName || Key
|
18
|
-
this.LastModified = LastModified
|
19
|
-
this.feedbackForm = feedbackForm || false
|
20
|
-
}
|
21
|
-
}
|