@defra/forms-model 3.0.462 → 3.0.464
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/__stubs__/components.js +168 -0
- package/dist/module/__stubs__/components.js.map +1 -0
- package/dist/module/__stubs__/form-definition.js +58 -0
- package/dist/module/__stubs__/form-definition.js.map +1 -0
- package/dist/module/__stubs__/pages.js +107 -0
- package/dist/module/__stubs__/pages.js.map +1 -0
- package/dist/module/conditions/condition-abstract.js +3 -0
- package/dist/module/conditions/condition-abstract.js.map +1 -1
- package/dist/module/conditions/condition-group.js +3 -0
- package/dist/module/conditions/condition-group.js.map +1 -1
- package/dist/module/conditions/condition-model.js +4 -1
- package/dist/module/conditions/condition-model.js.map +1 -1
- package/dist/module/conditions/helpers.js +3 -0
- package/dist/module/conditions/helpers.js.map +1 -1
- package/dist/module/conditions/index.js +1 -1
- package/dist/module/conditions/index.js.map +1 -1
- package/dist/module/conditions/migration.js +13 -7
- package/dist/module/conditions/migration.js.map +1 -1
- package/dist/module/stubs.js +13 -0
- package/dist/module/stubs.js.map +1 -0
- package/dist/types/__stubs__/components.d.ts +43 -0
- package/dist/types/__stubs__/components.d.ts.map +1 -0
- package/dist/types/__stubs__/form-definition.d.ts +15 -0
- package/dist/types/__stubs__/form-definition.d.ts.map +1 -0
- package/dist/types/__stubs__/pages.d.ts +25 -0
- package/dist/types/__stubs__/pages.d.ts.map +1 -0
- package/dist/types/conditions/condition-abstract.d.ts +1 -0
- package/dist/types/conditions/condition-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-group.d.ts +1 -0
- package/dist/types/conditions/condition-group.d.ts.map +1 -1
- package/dist/types/conditions/condition-model.d.ts +1 -0
- package/dist/types/conditions/condition-model.d.ts.map +1 -1
- package/dist/types/conditions/helpers.d.ts +9 -5
- package/dist/types/conditions/helpers.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/conditions/migration.d.ts +3 -0
- package/dist/types/conditions/migration.d.ts.map +1 -1
- package/dist/types/stubs.d.ts +13 -0
- package/dist/types/stubs.d.ts.map +1 -0
- package/package.json +15 -3
- package/src/__stubs__/components.ts +209 -0
- package/src/__stubs__/form-definition.ts +64 -0
- package/src/__stubs__/pages.ts +118 -0
- package/src/conditions/condition-abstract.ts +6 -0
- package/src/conditions/condition-group.ts +4 -0
- package/src/conditions/condition-model.ts +7 -0
- package/src/conditions/helpers.ts +12 -9
- package/src/conditions/index.ts +6 -1
- package/src/conditions/migration.ts +20 -7
- package/src/stubs.ts +12 -0
@@ -28,7 +28,7 @@ function createConditionValueDataFromStringValueDataV2(value) {
|
|
28
28
|
return {
|
29
29
|
type: ConditionType.Value,
|
30
30
|
value: value.value,
|
31
|
-
display:
|
31
|
+
display: value.value
|
32
32
|
};
|
33
33
|
}
|
34
34
|
function isConditionDataV2(condition) {
|
@@ -59,16 +59,22 @@ function convertConditionDataV2(model, condition, coordinator) {
|
|
59
59
|
};
|
60
60
|
}
|
61
61
|
function convertConditionRefDataFromV2(model, condition, coordinator) {
|
62
|
-
const
|
63
|
-
if (!
|
62
|
+
const refCondition = model.getConditionById(condition.conditionId);
|
63
|
+
if (!refCondition) {
|
64
64
|
throw Error('Component not found');
|
65
65
|
}
|
66
66
|
return {
|
67
|
-
conditionName:
|
68
|
-
conditionDisplayName:
|
67
|
+
conditionName: refCondition.name,
|
68
|
+
conditionDisplayName: refCondition.displayName,
|
69
69
|
coordinator
|
70
70
|
};
|
71
71
|
}
|
72
|
+
export function isConditionWrapperV2(wrapper) {
|
73
|
+
return Array.isArray(wrapper.conditions);
|
74
|
+
}
|
75
|
+
export function isConditionWrapper(wrapper) {
|
76
|
+
return !isConditionWrapperV2(wrapper);
|
77
|
+
}
|
72
78
|
export function convertConditionWrapperFromV2(conditionWrapper, model) {
|
73
79
|
let coordinator;
|
74
80
|
if (conditionWrapper.conditions.length > 1 && !conditionWrapper.coordinator) {
|
@@ -81,12 +87,12 @@ export function convertConditionWrapperFromV2(conditionWrapper, model) {
|
|
81
87
|
displayName: conditionWrapper.displayName,
|
82
88
|
value: {
|
83
89
|
name: conditionWrapper.name,
|
84
|
-
conditions: conditionWrapper.conditions.map(condition => {
|
90
|
+
conditions: conditionWrapper.conditions.map((condition, index) => {
|
85
91
|
let newCondition;
|
86
92
|
if (isConditionDataV2(condition)) {
|
87
93
|
newCondition = convertConditionDataV2(model, condition, coordinator);
|
88
94
|
} else {
|
89
|
-
newCondition = convertConditionRefDataFromV2(model, condition, coordinator);
|
95
|
+
newCondition = convertConditionRefDataFromV2(model, condition, index > 0 ? coordinator : undefined);
|
90
96
|
}
|
91
97
|
return newCondition;
|
92
98
|
})
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"migration.js","names":["ConditionType","isConditionListItemRefValueDataV2","value","type","ListItemRef","isConditionStringValueDataV2","StringValue","getListItem","model","listId","itemId","foundList","getListById","Error","item","items","find","id","createConditionValueDataFromListItemRefV2","refValue","display","text","Value","toString","createConditionValueDataFromStringValueDataV2","isConditionDataV2","condition","convertConditionDataV2","coordinator","component","getComponentById","componentId","newValue","field","name","title","operator","convertConditionRefDataFromV2","conditionId","conditionName","conditionDisplayName","
|
1
|
+
{"version":3,"file":"migration.js","names":["ConditionType","isConditionListItemRefValueDataV2","value","type","ListItemRef","isConditionStringValueDataV2","StringValue","getListItem","model","listId","itemId","foundList","getListById","Error","item","items","find","id","createConditionValueDataFromListItemRefV2","refValue","display","text","Value","toString","createConditionValueDataFromStringValueDataV2","isConditionDataV2","condition","convertConditionDataV2","coordinator","component","getComponentById","componentId","newValue","field","name","title","operator","convertConditionRefDataFromV2","refCondition","getConditionById","conditionId","conditionName","conditionDisplayName","displayName","isConditionWrapperV2","wrapper","Array","isArray","conditions","isConditionWrapper","convertConditionWrapperFromV2","conditionWrapper","length","newConditionWrapper","map","index","newCondition","undefined"],"sources":["../../../src/conditions/migration.ts"],"sourcesContent":["import {\n type ComponentDef,\n type ConditionalComponentType\n} from '~/src/components/types.js'\nimport { ConditionType, type Coordinator } from '~/src/conditions/enums.js'\nimport {\n type ConditionData,\n type ConditionDataV2,\n type ConditionListItemRefValueDataV2,\n type ConditionRefData,\n type ConditionRefDataV2,\n type ConditionStringValueDataV2,\n type ConditionValueData,\n type RelativeDateValueData\n} from '~/src/conditions/types.js'\nimport {\n type ConditionWrapper,\n type ConditionWrapperV2,\n type List\n} from '~/src/form/form-definition/types.js'\n\nfunction isConditionListItemRefValueDataV2(\n value:\n | ConditionListItemRefValueDataV2\n | ConditionStringValueDataV2\n | RelativeDateValueData\n): value is ConditionListItemRefValueDataV2 {\n return value.type === ConditionType.ListItemRef\n}\n\nfunction isConditionStringValueDataV2(\n value:\n | ConditionListItemRefValueDataV2\n | ConditionStringValueDataV2\n | RelativeDateValueData\n): value is ConditionStringValueDataV2 {\n return value.type === ConditionType.StringValue\n}\n\nfunction getListItem(model: RuntimeFormModel, listId: string, itemId: string) {\n const foundList = model.getListById(listId)\n\n if (!foundList) {\n throw Error('List not found')\n }\n\n const item = foundList.items.find((item) => item.id === itemId)\n\n if (!item) {\n throw Error('List item not found')\n }\n\n return item\n}\n\nfunction createConditionValueDataFromListItemRefV2(\n value: ConditionListItemRefValueDataV2,\n model: RuntimeFormModel\n): ConditionValueData {\n const refValue = getListItem(model, value.listId, value.itemId)\n\n return {\n display: refValue.text,\n type: ConditionType.Value,\n value: refValue.value.toString()\n }\n}\n\nfunction createConditionValueDataFromStringValueDataV2(\n value: ConditionStringValueDataV2\n): ConditionValueData {\n return {\n type: ConditionType.Value,\n value: value.value,\n display: value.value\n }\n}\n\nfunction isConditionDataV2(\n condition: ConditionDataV2 | ConditionRefDataV2\n): condition is ConditionDataV2 {\n return 'componentId' in condition\n}\n\nfunction convertConditionDataV2(\n model: RuntimeFormModel,\n condition: ConditionDataV2,\n coordinator: Coordinator | undefined\n): ConditionData {\n const component = model.getComponentById(condition.componentId)\n\n if (!component) {\n throw Error('Component not found')\n }\n\n let newValue\n if (isConditionListItemRefValueDataV2(condition.value)) {\n newValue = createConditionValueDataFromListItemRefV2(condition.value, model)\n } else if (isConditionStringValueDataV2(condition.value)) {\n newValue = createConditionValueDataFromStringValueDataV2(condition.value)\n } else {\n newValue = condition.value\n }\n\n return {\n field: {\n name: component.name,\n type: component.type as ConditionalComponentType /** @todo fix this */,\n display: component.title\n },\n operator: condition.operator,\n value: newValue,\n coordinator\n }\n}\n\nfunction convertConditionRefDataFromV2(\n model: RuntimeFormModel,\n condition: ConditionRefDataV2,\n coordinator: Coordinator | undefined\n): ConditionRefData {\n const refCondition = model.getConditionById(condition.conditionId)\n\n if (!refCondition) {\n throw Error('Component not found')\n }\n\n return {\n conditionName: refCondition.name,\n conditionDisplayName: refCondition.displayName,\n coordinator\n }\n}\n\nexport function isConditionWrapperV2(\n wrapper: ConditionWrapper | ConditionWrapperV2\n): wrapper is ConditionWrapperV2 {\n return Array.isArray((wrapper as ConditionWrapperV2).conditions)\n}\n\nexport function isConditionWrapper(\n wrapper: ConditionWrapper | ConditionWrapperV2\n): wrapper is ConditionWrapper {\n return !isConditionWrapperV2(wrapper)\n}\n\nexport function convertConditionWrapperFromV2(\n conditionWrapper: ConditionWrapperV2,\n model: RuntimeFormModel\n): ConditionWrapper {\n let coordinator\n\n if (conditionWrapper.conditions.length > 1 && !conditionWrapper.coordinator) {\n throw new Error('Coordinator is required for multiple conditions')\n } else {\n coordinator = conditionWrapper.coordinator\n }\n\n const newConditionWrapper: ConditionWrapper = {\n name: conditionWrapper.name,\n displayName: conditionWrapper.displayName,\n value: {\n name: conditionWrapper.name,\n conditions: conditionWrapper.conditions.map((condition, index) => {\n let newCondition: ConditionData | ConditionRefData\n\n if (isConditionDataV2(condition)) {\n newCondition = convertConditionDataV2(model, condition, coordinator)\n } else {\n newCondition = convertConditionRefDataFromV2(\n model,\n condition,\n index > 0 ? coordinator : undefined\n )\n }\n\n return newCondition\n })\n }\n }\n\n return newConditionWrapper\n}\n\nexport interface RuntimeFormModel {\n getListById: (listId: string) => List | undefined\n getComponentById: (componentId: string) => ComponentDef | undefined\n getConditionById: (conditionId: string) => ConditionWrapperV2 | undefined\n}\n"],"mappings":"AAIA,SAASA,aAAa;AAiBtB,SAASC,iCAAiCA,CACxCC,KAGyB,EACiB;EAC1C,OAAOA,KAAK,CAACC,IAAI,KAAKH,aAAa,CAACI,WAAW;AACjD;AAEA,SAASC,4BAA4BA,CACnCH,KAGyB,EACY;EACrC,OAAOA,KAAK,CAACC,IAAI,KAAKH,aAAa,CAACM,WAAW;AACjD;AAEA,SAASC,WAAWA,CAACC,KAAuB,EAAEC,MAAc,EAAEC,MAAc,EAAE;EAC5E,MAAMC,SAAS,GAAGH,KAAK,CAACI,WAAW,CAACH,MAAM,CAAC;EAE3C,IAAI,CAACE,SAAS,EAAE;IACd,MAAME,KAAK,CAAC,gBAAgB,CAAC;EAC/B;EAEA,MAAMC,IAAI,GAAGH,SAAS,CAACI,KAAK,CAACC,IAAI,CAAEF,IAAI,IAAKA,IAAI,CAACG,EAAE,KAAKP,MAAM,CAAC;EAE/D,IAAI,CAACI,IAAI,EAAE;IACT,MAAMD,KAAK,CAAC,qBAAqB,CAAC;EACpC;EAEA,OAAOC,IAAI;AACb;AAEA,SAASI,yCAAyCA,CAChDhB,KAAsC,EACtCM,KAAuB,EACH;EACpB,MAAMW,QAAQ,GAAGZ,WAAW,CAACC,KAAK,EAAEN,KAAK,CAACO,MAAM,EAAEP,KAAK,CAACQ,MAAM,CAAC;EAE/D,OAAO;IACLU,OAAO,EAAED,QAAQ,CAACE,IAAI;IACtBlB,IAAI,EAAEH,aAAa,CAACsB,KAAK;IACzBpB,KAAK,EAAEiB,QAAQ,CAACjB,KAAK,CAACqB,QAAQ,CAAC;EACjC,CAAC;AACH;AAEA,SAASC,6CAA6CA,CACpDtB,KAAiC,EACb;EACpB,OAAO;IACLC,IAAI,EAAEH,aAAa,CAACsB,KAAK;IACzBpB,KAAK,EAAEA,KAAK,CAACA,KAAK;IACl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C;EAED,OAAOH,mBAAmB;AAC5B","ignoreList":[]}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export * from "./__stubs__/form-definition.js";
|
2
|
+
export { buildList } from "./__stubs__/components.js";
|
3
|
+
export { buildListItem } from "./__stubs__/components.js";
|
4
|
+
export { buildCheckboxComponent } from "./__stubs__/components.js";
|
5
|
+
export { buildRadioComponent } from "./__stubs__/components.js";
|
6
|
+
export { buildAutoCompleteComponent } from "./__stubs__/components.js";
|
7
|
+
export { buildFileUploadComponent } from "./__stubs__/components.js";
|
8
|
+
export { buildTextFieldComponent } from "./__stubs__/components.js";
|
9
|
+
export { buildRepeaterPage } from "./__stubs__/pages.js";
|
10
|
+
export { buildFileUploadPage } from "./__stubs__/pages.js";
|
11
|
+
export { buildSummaryPage } from "./__stubs__/pages.js";
|
12
|
+
export { buildQuestionPage } from "./__stubs__/pages.js";
|
13
|
+
//# sourceMappingURL=stubs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stubs.js","names":["buildList","buildListItem","buildCheckboxComponent","buildRadioComponent","buildAutoCompleteComponent","buildFileUploadComponent","buildTextFieldComponent","buildRepeaterPage","buildFileUploadPage","buildSummaryPage","buildQuestionPage"],"sources":["../../src/stubs.ts"],"sourcesContent":["export * from '~/src/__stubs__/form-definition.js'\nexport { buildList } from '~/src/__stubs__/components.js'\nexport { buildListItem } from '~/src/__stubs__/components.js'\nexport { buildCheckboxComponent } from '~/src/__stubs__/components.js'\nexport { buildRadioComponent } from '~/src/__stubs__/components.js'\nexport { buildAutoCompleteComponent } from '~/src/__stubs__/components.js'\nexport { buildFileUploadComponent } from '~/src/__stubs__/components.js'\nexport { buildTextFieldComponent } from '~/src/__stubs__/components.js'\nexport { buildRepeaterPage } from '~/src/__stubs__/pages.js'\nexport { buildFileUploadPage } from '~/src/__stubs__/pages.js'\nexport { buildSummaryPage } from '~/src/__stubs__/pages.js'\nexport { buildQuestionPage } from '~/src/__stubs__/pages.js'\n"],"mappings":"AAAA;AACA,SAASA,SAAS;AAClB,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,0BAA0B;AACnC,SAASC,wBAAwB;AACjC,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB","ignoreList":[]}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { type AutocompleteFieldComponent, type CheckboxesFieldComponent, type DatePartsFieldComponent, type FileUploadFieldComponent, type NumberFieldComponent, type RadiosFieldComponent, type TextFieldComponent } from '../components/types.js';
|
2
|
+
import { type Item, type List } from '../form/form-definition/types.js';
|
3
|
+
/**
|
4
|
+
* @param {Partial<TextFieldComponent>} partialTextField
|
5
|
+
* @returns {TextFieldComponent}
|
6
|
+
*/
|
7
|
+
export declare function buildTextFieldComponent(partialTextField?: Partial<TextFieldComponent>): TextFieldComponent;
|
8
|
+
/**
|
9
|
+
* @param {Partial<FileUploadFieldComponent>} partialFileUploadField
|
10
|
+
* @returns {FileUploadFieldComponent}
|
11
|
+
*/
|
12
|
+
export declare function buildFileUploadComponent(partialFileUploadField: Partial<FileUploadFieldComponent>): FileUploadFieldComponent;
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField
|
16
|
+
* @returns {AutocompleteFieldComponent}
|
17
|
+
*/
|
18
|
+
export declare function buildAutoCompleteComponent(partialAutoCompleteField: Partial<AutocompleteFieldComponent>): AutocompleteFieldComponent;
|
19
|
+
/**
|
20
|
+
* @param {Partial<RadiosFieldComponent>} partialListComponent
|
21
|
+
* @returns {RadiosFieldComponent}
|
22
|
+
*/
|
23
|
+
export declare function buildRadioComponent(partialListComponent?: Partial<RadiosFieldComponent>): RadiosFieldComponent;
|
24
|
+
/**
|
25
|
+
* @param {Partial<CheckboxesFieldComponent>} partialListComponent
|
26
|
+
* @returns {CheckboxesFieldComponent}
|
27
|
+
*/
|
28
|
+
export declare function buildCheckboxComponent(partialListComponent: Partial<CheckboxesFieldComponent>): CheckboxesFieldComponent;
|
29
|
+
/**
|
30
|
+
* Builder to create a stub List item
|
31
|
+
* @param {Partial<Item>} partialListItem
|
32
|
+
* @returns {Item}
|
33
|
+
*/
|
34
|
+
export declare function buildListItem(partialListItem?: Partial<Item>): Item;
|
35
|
+
/**
|
36
|
+
* @param {Partial<List>} partialList
|
37
|
+
* @returns {List}
|
38
|
+
*/
|
39
|
+
export declare function buildList(partialList?: Partial<List>): List;
|
40
|
+
export declare function buildNumberFieldComponent(partialComponent: Partial<NumberFieldComponent>): NumberFieldComponent;
|
41
|
+
export declare function buildDateComponent(partialComponent: Partial<DatePartsFieldComponent>): DatePartsFieldComponent;
|
42
|
+
export declare function buildRadiosComponent(partialComponent: Partial<RadiosFieldComponent>): RadiosFieldComponent;
|
43
|
+
//# sourceMappingURL=components.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/__stubs__/components.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAE1E;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACjD,kBAAkB,CAepB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,sBAAsB,EAAE,OAAO,CAAC,wBAAwB,CAAC,GACxD,wBAAwB,CAa1B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,wBAAwB,EAAE,OAAO,CAAC,0BAA0B,CAAC,GAC5D,0BAA0B,CAa5B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,oBAAoB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GACvD,oBAAoB,CAatB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,oBAAoB,EAAE,OAAO,CAAC,wBAAwB,CAAC,GACtD,wBAAwB,CAa1B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,eAAe,GAAE,OAAO,CAAC,IAAI,CAAM,GAAG,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,WAAW,GAAE,OAAO,CAAC,IAAI,CAAM,GAAG,IAAI,CAiC/D;AAED,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAC9C,oBAAoB,CAStB;AAED,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,OAAO,CAAC,uBAAuB,CAAC,GACjD,uBAAuB,CAQzB;AAED,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAC9C,oBAAoB,CAStB"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { type FormDefinition } from '../form/form-definition/types.js';
|
2
|
+
import { type FormMetadata } from '../form/form-metadata/types.js';
|
3
|
+
/**
|
4
|
+
* Builder to create a Form Definition
|
5
|
+
* @param {Partial<FormDefinition>} definitionPartial
|
6
|
+
* @returns {FormDefinition}
|
7
|
+
*/
|
8
|
+
export declare function buildDefinition(definitionPartial?: Partial<FormDefinition>): FormDefinition;
|
9
|
+
/**
|
10
|
+
*
|
11
|
+
* @param {Partial<FormMetadata>} partialMetaData
|
12
|
+
* @returns {FormMetadata}
|
13
|
+
*/
|
14
|
+
export declare function buildMetaData(partialMetaData?: Partial<FormMetadata>): FormMetadata;
|
15
|
+
//# sourceMappingURL=form-definition.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"form-definition.d.ts","sourceRoot":"","sources":["../../../src/__stubs__/form-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAErE;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,GAAE,OAAO,CAAC,cAAc,CAAM,GAC9C,cAAc,CAYhB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,eAAe,GAAE,OAAO,CAAC,YAAY,CAAM,GAC1C,YAAY,CAgCd"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { type PageFileUpload, type PageQuestion, type PageRepeat, type PageSummary } from '../form/form-definition/types.js';
|
2
|
+
/**
|
3
|
+
* Stub builder for a question page
|
4
|
+
* @param {Partial<PageQuestion>} [partialPage]
|
5
|
+
* @returns {PageQuestion}
|
6
|
+
*/
|
7
|
+
export declare function buildQuestionPage(partialPage: Partial<PageQuestion>): PageQuestion;
|
8
|
+
/**
|
9
|
+
* Stub builder for a Summary page
|
10
|
+
* @param {Partial<PageSummary>} [partialSummaryPage]
|
11
|
+
*/
|
12
|
+
export declare function buildSummaryPage(partialSummaryPage?: Partial<PageSummary>): PageSummary;
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* @param {Partial<PageFileUpload>} partialFileUploadPage
|
16
|
+
* @returns {PageFileUpload}
|
17
|
+
*/
|
18
|
+
export declare function buildFileUploadPage(partialFileUploadPage?: Partial<PageFileUpload>): PageFileUpload;
|
19
|
+
/**
|
20
|
+
*
|
21
|
+
* @param {Partial<PageRepeat>} partialRepeaterPage
|
22
|
+
* @returns {PageRepeat}
|
23
|
+
*/
|
24
|
+
export declare function buildRepeaterPage(partialRepeaterPage?: Partial<PageRepeat>): PageRepeat;
|
25
|
+
//# sourceMappingURL=pages.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../../src/__stubs__/pages.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,qCAAqC,CAAA;AAG5C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,GACjC,YAAY,CASd;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,kBAAkB,GAAE,OAAO,CAAC,WAAW,CAAM,GAC5C,WAAW,CAQb;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,qBAAqB,GAAE,OAAO,CAAC,cAAc,CAAM,GAClD,cAAc,CA4BhB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,mBAAmB,GAAE,OAAO,CAAC,UAAU,CAAM,GAC5C,UAAU,CA6BZ"}
|
@@ -3,6 +3,7 @@ export declare class ConditionAbstract {
|
|
3
3
|
coordinator?: Coordinator;
|
4
4
|
constructor(coordinator?: Coordinator);
|
5
5
|
coordinatorString(): string;
|
6
|
+
coordinatorHtml(): string;
|
6
7
|
getCoordinator(): Coordinator | undefined;
|
7
8
|
setCoordinator(coordinator?: Coordinator): void;
|
8
9
|
isGroup(): boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-abstract.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,qBAAa,iBAAiB;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAA;gBAEb,WAAW,CAAC,EAAE,WAAW;IAQrC,iBAAiB,IAAI,MAAM;IAI3B,cAAc,IAAI,WAAW,GAAG,SAAS;IAIzC,cAAc,CAAC,WAAW,CAAC,EAAE,WAAW;IAIxC,OAAO;IAIP,oBAAoB;IAIpB,iBAAiB;IAIjB,gBAAgB;IAMhB,KAAK;IAIL,eAAe;IAMf,mBAAmB;CAKpB"}
|
1
|
+
{"version":3,"file":"condition-abstract.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,qBAAa,iBAAiB;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAA;gBAEb,WAAW,CAAC,EAAE,WAAW;IAQrC,iBAAiB,IAAI,MAAM;IAI3B,eAAe,IAAI,MAAM;IAMzB,cAAc,IAAI,WAAW,GAAG,SAAS;IAIzC,cAAc,CAAC,WAAW,CAAC,EAAE,WAAW;IAIxC,OAAO;IAIP,oBAAoB;IAIpB,iBAAiB;IAIjB,gBAAgB;IAMhB,KAAK;IAIL,eAAe;IAMf,mBAAmB;CAKpB"}
|
@@ -6,6 +6,7 @@ export declare class ConditionGroup {
|
|
6
6
|
conditions: (Condition | ConditionRef | ConditionGroup)[];
|
7
7
|
constructor(conditions?: (Condition | ConditionRef | ConditionGroup)[]);
|
8
8
|
coordinatorString(): string;
|
9
|
+
coordinatorHtml(): string;
|
9
10
|
conditionString(): string;
|
10
11
|
conditionExpression(): string;
|
11
12
|
asFirstCondition(): this;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-group.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,qBAAa,cAAc;IACzB,UAAU,EAAE,CAAC,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,EAAE,CAAA;gBAE7C,UAAU,GAAE,CAAC,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,EAAO;IAQ1E,iBAAiB,IAAI,MA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,kBAAkB,GAAG,cAAc,GAAG,cAAc;CAStE"}
|
@@ -21,6 +21,7 @@ export declare class ConditionsModel {
|
|
21
21
|
get hasConditions(): boolean;
|
22
22
|
get lastIndex(): number;
|
23
23
|
toPresentationString(): string;
|
24
|
+
toPresentationHtml(): string;
|
24
25
|
toExpression(): string;
|
25
26
|
_applyGroups(userGroupedConditions: (Condition | ConditionRef | ConditionGroup)[]): (Condition | ConditionRef | ConditionGroup)[];
|
26
27
|
_group(conditions: (Condition | ConditionRef | ConditionGroup)[], groupDefs: ConditionGroupDef[]): (Condition | ConditionRef | ConditionGroup)[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-model.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;
|
1
|
+
{"version":3,"file":"condition-model.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AASzD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAA;AAElC,qBAAa,eAAe;;IAK1B,KAAK;IAYL,KAAK;IAOL,IAAI,IAAI,CAAC,IAAI,oBAAA,EAEZ;IAED,IAAI,IAAI,uBAEP;IAED,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,GAAG,cAAc;IAexD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,YAAY,GAAG,cAAc;IAmB3E,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;IAWxB,SAAS,CAAC,SAAS,EAAE,iBAAiB,EAAE;IASxC,UAAU,CAAC,KAAK,EAAE,MAAM;IASxB,WAAW,CAAC,KAAK,EAAE,MAAM;IAezB,SAAS,CAAC,KAAK,EAAE,MAAM;IAevB,kBAAkB;IAOlB,IAAI,kBAAkB,kDAErB;IAED,IAAI,aAAa,YAEhB;IAED,IAAI,SAAS,WAEZ;IAED,oBAAoB;IAMpB,kBAAkB;IAMlB,YAAY;IAMZ,YAAY,CACV,qBAAqB,EAAE,CAAC,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,EAAE;IAmBtE,MAAM,CACJ,UAAU,EAAE,CAAC,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,EAAE,EACzD,SAAS,EAAE,iBAAiB,EAAE;IAqBhC,QAAQ,CACN,UAAU,EAAE,CAAC,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,EAAE,EACzD,UAAU,EAAE,MAAM;IAcpB,cAAc,CAAC,UAAU,EAAE,CAAC,SAAS,GAAG,YAAY,GAAG,cAAc,CAAC,EAAE;IAkCxE,MAAM;;;;IAUN,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,GAAG,mBAAmB;CAYvD;AAED,wBAAgB,aAAa,CAC3B,EAAE,EAAE,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GACxD,SAAS,GAAG,YAAY,GAAG,cAAc,CAU3C"}
|
@@ -3,11 +3,15 @@ import { type ConditionRef } from '../conditions/condition-ref.js';
|
|
3
3
|
import { type Condition } from '../conditions/condition.js';
|
4
4
|
import { type ConditionData, type ConditionGroupData, type ConditionRefData } from '../conditions/types.js';
|
5
5
|
import { type ConditionWrapper } from '../form/form-definition/types.js';
|
6
|
-
|
7
|
-
|
8
|
-
export declare
|
9
|
-
export declare
|
10
|
-
export declare
|
6
|
+
type ConditionType = Condition | ConditionRef | ConditionGroup;
|
7
|
+
type ConditionDataType = ConditionGroupData | ConditionData | ConditionRefData;
|
8
|
+
export declare function toPresentationString(condition: ConditionType): string;
|
9
|
+
export declare function toPresentationHtml(condition: ConditionType): string;
|
10
|
+
export declare function toExpression(condition: ConditionType): string;
|
11
|
+
export declare const hasConditionField: (condition?: ConditionDataType) => condition is ConditionData;
|
12
|
+
export declare const hasConditionGroup: (condition?: ConditionDataType) => condition is ConditionGroupData;
|
13
|
+
export declare const hasConditionName: (condition?: ConditionDataType) => condition is ConditionRefData;
|
11
14
|
export declare const hasNestedCondition: (condition?: ConditionWrapper) => boolean;
|
12
15
|
export declare const isDuplicateCondition: (conditions: ConditionWrapper[], conditionName: string) => boolean;
|
16
|
+
export {};
|
13
17
|
//# sourceMappingURL=helpers.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/conditions/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAE3E,
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/conditions/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAE3E,KAAK,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,cAAc,CAAA;AAC9D,KAAK,iBAAiB,GAAG,kBAAkB,GAAG,aAAa,GAAG,gBAAgB,CAAA;AAE9E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,aAAa,UAE5D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,aAAa,UAE1D;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,UAEpD;AAED,eAAO,MAAM,iBAAiB,GAC5B,YAAY,iBAAiB,KAC5B,SAAS,IAAI,aAEf,CAAA;AAED,eAAO,MAAM,iBAAiB,GAC5B,YAAY,iBAAiB,KAC5B,SAAS,IAAI,kBAEf,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,YAAY,iBAAiB,KAC5B,SAAS,IAAI,gBAEf,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,YAAY,gBAAgB,YAE9D,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,YAAY,gBAAgB,EAAE,EAC9B,eAAe,MAAM,YAGtB,CAAA"}
|
@@ -7,6 +7,6 @@ export { ConditionGroup } from '../conditions/condition-group.js';
|
|
7
7
|
export { ConditionsModel } from '../conditions/condition-model.js';
|
8
8
|
export { ConditionGroupDef } from '../conditions/condition-group-def.js';
|
9
9
|
export { hasConditionField, hasConditionGroup, hasConditionName, hasNestedCondition, isDuplicateCondition, toExpression, toPresentationString } from '../conditions/helpers.js';
|
10
|
-
export { convertConditionWrapperFromV2 } from '../conditions/migration.js';
|
10
|
+
export { convertConditionWrapperFromV2, isConditionWrapper, isConditionWrapperV2, type RuntimeFormModel } from '../conditions/migration.js';
|
11
11
|
export { ConditionType, Coordinator, DateDirections, DateUnits, Operator, OperatorName } from '../conditions/enums.js';
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/conditions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,yCAAyC,CAAA;AAEhD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACrB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/conditions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,yCAAyC,CAAA;AAEhD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACrB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,SAAS,EACT,QAAQ,EACR,YAAY,EACb,MAAM,2BAA2B,CAAA"}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import { type ComponentDef } from '../components/types.js';
|
2
2
|
import { type ConditionWrapper, type ConditionWrapperV2, type List } from '../form/form-definition/types.js';
|
3
|
+
export declare function isConditionWrapperV2(wrapper: ConditionWrapper | ConditionWrapperV2): wrapper is ConditionWrapperV2;
|
4
|
+
export declare function isConditionWrapper(wrapper: ConditionWrapper | ConditionWrapperV2): wrapper is ConditionWrapper;
|
3
5
|
export declare function convertConditionWrapperFromV2(conditionWrapper: ConditionWrapperV2, model: RuntimeFormModel): ConditionWrapper;
|
4
6
|
export interface RuntimeFormModel {
|
5
7
|
getListById: (listId: string) => List | undefined;
|
6
8
|
getComponentById: (componentId: string) => ComponentDef | undefined;
|
9
|
+
getConditionById: (conditionId: string) => ConditionWrapperV2 | undefined;
|
7
10
|
}
|
8
11
|
//# sourceMappingURL=migration.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/conditions/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,2BAA2B,CAAA;AAYlC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,IAAI,EACV,MAAM,qCAAqC,CAAA;AAmH5C,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,kBAAkB,EACpC,KAAK,EAAE,gBAAgB,GACtB,gBAAgB,CAiClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,CAAA;IACjD,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/conditions/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,2BAA2B,CAAA;AAYlC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,IAAI,EACV,MAAM,qCAAqC,CAAA;AAmH5C,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,GAC7C,OAAO,IAAI,kBAAkB,CAE/B;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,GAC7C,OAAO,IAAI,gBAAgB,CAE7B;AAED,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,kBAAkB,EACpC,KAAK,EAAE,gBAAgB,GACtB,gBAAgB,CAiClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,CAAA;IACjD,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAA;IACnE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAA;CAC1E"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export * from './__stubs__/form-definition.js';
|
2
|
+
export { buildList } from './__stubs__/components.js';
|
3
|
+
export { buildListItem } from './__stubs__/components.js';
|
4
|
+
export { buildCheckboxComponent } from './__stubs__/components.js';
|
5
|
+
export { buildRadioComponent } from './__stubs__/components.js';
|
6
|
+
export { buildAutoCompleteComponent } from './__stubs__/components.js';
|
7
|
+
export { buildFileUploadComponent } from './__stubs__/components.js';
|
8
|
+
export { buildTextFieldComponent } from './__stubs__/components.js';
|
9
|
+
export { buildRepeaterPage } from './__stubs__/pages.js';
|
10
|
+
export { buildFileUploadPage } from './__stubs__/pages.js';
|
11
|
+
export { buildSummaryPage } from './__stubs__/pages.js';
|
12
|
+
export { buildQuestionPage } from './__stubs__/pages.js';
|
13
|
+
//# sourceMappingURL=stubs.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/stubs.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA"}
|
package/package.json
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@defra/forms-model",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.464",
|
4
4
|
"description": "A hapi plugin providing the model for Defra forms",
|
5
5
|
"homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
|
6
|
+
"types": "dist/types/index.d.ts",
|
7
|
+
"main": "dist/module/index.js",
|
8
|
+
"exports": {
|
9
|
+
".": {
|
10
|
+
"import": "./dist/module/index.js",
|
11
|
+
"default": "./dist/module/index.js",
|
12
|
+
"types": "./dist/types/index.d.ts"
|
13
|
+
},
|
14
|
+
"./stubs": {
|
15
|
+
"import": "./dist/module/stubs.js",
|
16
|
+
"default": "./dist/module/stubs.js",
|
17
|
+
"types": "./dist/types/stubs.d.ts"
|
18
|
+
}
|
19
|
+
},
|
6
20
|
"repository": {
|
7
21
|
"type": "git",
|
8
22
|
"url": "git+https://github.com/DEFRA/forms-designer.git",
|
@@ -11,8 +25,6 @@
|
|
11
25
|
"license": "OGL-UK-3.0",
|
12
26
|
"sideEffects": false,
|
13
27
|
"type": "module",
|
14
|
-
"main": "dist/module/index.js",
|
15
|
-
"types": "dist/types/index.d.ts",
|
16
28
|
"scripts": {
|
17
29
|
"build": "npm run build:types && npm run build:node && npm run build:schemas",
|
18
30
|
"build:node": "babel --delete-dir-on-start --extensions \".ts,.js\" --ignore \"**/*.test.*\" --copy-files --no-copy-ignored --source-maps --out-dir ./dist/module ./src",
|
@@ -0,0 +1,209 @@
|
|
1
|
+
import { ComponentType } from '~/src/components/enums.js'
|
2
|
+
import {
|
3
|
+
type AutocompleteFieldComponent,
|
4
|
+
type CheckboxesFieldComponent,
|
5
|
+
type DatePartsFieldComponent,
|
6
|
+
type FileUploadFieldComponent,
|
7
|
+
type NumberFieldComponent,
|
8
|
+
type RadiosFieldComponent,
|
9
|
+
type TextFieldComponent
|
10
|
+
} from '~/src/components/types.js'
|
11
|
+
import { type Item, type List } from '~/src/form/form-definition/types.js'
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @param {Partial<TextFieldComponent>} partialTextField
|
15
|
+
* @returns {TextFieldComponent}
|
16
|
+
*/
|
17
|
+
export function buildTextFieldComponent(
|
18
|
+
partialTextField: Partial<TextFieldComponent> = {}
|
19
|
+
): TextFieldComponent {
|
20
|
+
const textFieldComponent: TextFieldComponent = {
|
21
|
+
id: '407dd0d7-cce9-4f43-8e1f-7d89cb698875',
|
22
|
+
name: 'TextField',
|
23
|
+
title: 'Text field',
|
24
|
+
type: ComponentType.TextField,
|
25
|
+
hint: '',
|
26
|
+
options: {},
|
27
|
+
schema: {}
|
28
|
+
}
|
29
|
+
|
30
|
+
return {
|
31
|
+
...textFieldComponent,
|
32
|
+
...partialTextField
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @param {Partial<FileUploadFieldComponent>} partialFileUploadField
|
38
|
+
* @returns {FileUploadFieldComponent}
|
39
|
+
*/
|
40
|
+
export function buildFileUploadComponent(
|
41
|
+
partialFileUploadField: Partial<FileUploadFieldComponent>
|
42
|
+
): FileUploadFieldComponent {
|
43
|
+
const fileUploadFieldComponent: FileUploadFieldComponent = {
|
44
|
+
name: 'FileUploadField',
|
45
|
+
type: ComponentType.FileUploadField,
|
46
|
+
title: 'File Upload Field',
|
47
|
+
options: {},
|
48
|
+
schema: {}
|
49
|
+
}
|
50
|
+
|
51
|
+
return {
|
52
|
+
...fileUploadFieldComponent,
|
53
|
+
...partialFileUploadField
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
*
|
59
|
+
* @param {Partial<AutocompleteFieldComponent>} partialAutoCompleteField
|
60
|
+
* @returns {AutocompleteFieldComponent}
|
61
|
+
*/
|
62
|
+
export function buildAutoCompleteComponent(
|
63
|
+
partialAutoCompleteField: Partial<AutocompleteFieldComponent>
|
64
|
+
): AutocompleteFieldComponent {
|
65
|
+
const autocompleteComponent: AutocompleteFieldComponent = {
|
66
|
+
name: 'AutoCompleteField',
|
67
|
+
title: 'What languages do you speak?',
|
68
|
+
type: ComponentType.AutocompleteField,
|
69
|
+
list: 'AutoCompleteList',
|
70
|
+
options: {}
|
71
|
+
}
|
72
|
+
|
73
|
+
return {
|
74
|
+
...autocompleteComponent,
|
75
|
+
...partialAutoCompleteField
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* @param {Partial<RadiosFieldComponent>} partialListComponent
|
81
|
+
* @returns {RadiosFieldComponent}
|
82
|
+
*/
|
83
|
+
export function buildRadioComponent(
|
84
|
+
partialListComponent: Partial<RadiosFieldComponent> = {}
|
85
|
+
): RadiosFieldComponent {
|
86
|
+
const radioFieldComponent: RadiosFieldComponent = {
|
87
|
+
name: 'RadioField',
|
88
|
+
title: 'Which country do you live in?',
|
89
|
+
type: ComponentType.RadiosField,
|
90
|
+
list: 'RadioList',
|
91
|
+
options: {}
|
92
|
+
}
|
93
|
+
|
94
|
+
return {
|
95
|
+
...radioFieldComponent,
|
96
|
+
...partialListComponent
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* @param {Partial<CheckboxesFieldComponent>} partialListComponent
|
102
|
+
* @returns {CheckboxesFieldComponent}
|
103
|
+
*/
|
104
|
+
export function buildCheckboxComponent(
|
105
|
+
partialListComponent: Partial<CheckboxesFieldComponent>
|
106
|
+
): CheckboxesFieldComponent {
|
107
|
+
const checkboxesFieldComponent: CheckboxesFieldComponent = {
|
108
|
+
name: 'FellowshipOfTheRing',
|
109
|
+
title: 'Which are your favourite characters from the fellowship?',
|
110
|
+
type: ComponentType.CheckboxesField,
|
111
|
+
list: 'CheckboxList',
|
112
|
+
options: {}
|
113
|
+
}
|
114
|
+
|
115
|
+
return {
|
116
|
+
...checkboxesFieldComponent,
|
117
|
+
...partialListComponent
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Builder to create a stub List item
|
123
|
+
* @param {Partial<Item>} partialListItem
|
124
|
+
* @returns {Item}
|
125
|
+
*/
|
126
|
+
export function buildListItem(partialListItem: Partial<Item> = {}): Item {
|
127
|
+
return {
|
128
|
+
text: 'Javascript',
|
129
|
+
value: 'javascript',
|
130
|
+
...partialListItem
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* @param {Partial<List>} partialList
|
136
|
+
* @returns {List}
|
137
|
+
*/
|
138
|
+
export function buildList(partialList: Partial<List> = {}): List {
|
139
|
+
return {
|
140
|
+
title: 'Development language2',
|
141
|
+
name: 'YhmNDD',
|
142
|
+
type: 'string',
|
143
|
+
items: [
|
144
|
+
buildListItem({
|
145
|
+
text: 'Javascript',
|
146
|
+
value: 'javascript'
|
147
|
+
}),
|
148
|
+
buildListItem({
|
149
|
+
text: 'TypeScript',
|
150
|
+
value: 'typescript'
|
151
|
+
}),
|
152
|
+
buildListItem({
|
153
|
+
text: 'Python',
|
154
|
+
value: 'python'
|
155
|
+
}),
|
156
|
+
buildListItem({
|
157
|
+
text: 'Haskell',
|
158
|
+
value: 'haskell'
|
159
|
+
}),
|
160
|
+
buildListItem({
|
161
|
+
text: 'Erlang',
|
162
|
+
value: 'erlang'
|
163
|
+
}),
|
164
|
+
buildListItem({
|
165
|
+
text: 'Java',
|
166
|
+
value: 'java'
|
167
|
+
})
|
168
|
+
],
|
169
|
+
...partialList
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
export function buildNumberFieldComponent(
|
174
|
+
partialComponent: Partial<NumberFieldComponent>
|
175
|
+
): NumberFieldComponent {
|
176
|
+
return {
|
177
|
+
name: 'year',
|
178
|
+
title: 'Year',
|
179
|
+
options: {},
|
180
|
+
schema: {},
|
181
|
+
...partialComponent,
|
182
|
+
type: ComponentType.NumberField
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
export function buildDateComponent(
|
187
|
+
partialComponent: Partial<DatePartsFieldComponent>
|
188
|
+
): DatePartsFieldComponent {
|
189
|
+
return {
|
190
|
+
name: 'bcdefg',
|
191
|
+
title: 'Default title',
|
192
|
+
options: {},
|
193
|
+
...partialComponent,
|
194
|
+
type: ComponentType.DatePartsField
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
export function buildRadiosComponent(
|
199
|
+
partialComponent: Partial<RadiosFieldComponent>
|
200
|
+
): RadiosFieldComponent {
|
201
|
+
return {
|
202
|
+
name: 'cdefgh',
|
203
|
+
title: 'Default title',
|
204
|
+
options: {},
|
205
|
+
list: 'Default list Id ref',
|
206
|
+
...partialComponent,
|
207
|
+
type: ComponentType.RadiosField
|
208
|
+
}
|
209
|
+
}
|