@defra/forms-model 3.0.221 → 3.0.223
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/index.js +0 -1
- package/dist/module/index.js.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/index.ts +0 -1
- package/dist/module/data-model/conditions-wrapper.js +0 -28
- package/dist/module/data-model/conditions-wrapper.js.map +0 -1
- package/dist/module/data-model/index.js +0 -3
- package/dist/module/data-model/index.js.map +0 -1
- package/dist/module/data-model/input-wrapper.js +0 -22
- package/dist/module/data-model/input-wrapper.js.map +0 -1
- package/dist/types/data-model/conditions-wrapper.d.ts +0 -10
- package/dist/types/data-model/conditions-wrapper.d.ts.map +0 -1
- package/dist/types/data-model/index.d.ts +0 -3
- package/dist/types/data-model/index.d.ts.map +0 -1
- package/dist/types/data-model/input-wrapper.d.ts +0 -16
- package/dist/types/data-model/input-wrapper.d.ts.map +0 -1
- package/src/data-model/conditions-wrapper.ts +0 -32
- package/src/data-model/index.ts +0 -2
- package/src/data-model/input-wrapper.ts +0 -40
package/dist/module/index.js
CHANGED
package/dist/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/utils/helpers.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/dist/types/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -1,28 +0,0 @@
|
|
1
|
-
import { ConditionsModel } from "../conditions/condition-model.js";
|
2
|
-
export class ConditionsWrapper {
|
3
|
-
name;
|
4
|
-
displayName;
|
5
|
-
value;
|
6
|
-
constructor(rawData) {
|
7
|
-
const {
|
8
|
-
name,
|
9
|
-
displayName,
|
10
|
-
value
|
11
|
-
} = rawData;
|
12
|
-
this.displayName = displayName || name;
|
13
|
-
this.value = value;
|
14
|
-
this.name = name;
|
15
|
-
}
|
16
|
-
get expression() {
|
17
|
-
if (typeof this.value === 'string') {
|
18
|
-
// Previously conditions were defined as strings, e.g: "section.age < 18"
|
19
|
-
// keep this so application can support legacy forms exports.
|
20
|
-
return this.value;
|
21
|
-
}
|
22
|
-
return ConditionsModel.from(this.value).toExpression();
|
23
|
-
}
|
24
|
-
clone() {
|
25
|
-
return new ConditionsWrapper(this);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
//# sourceMappingURL=conditions-wrapper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"conditions-wrapper.js","names":["ConditionsModel","ConditionsWrapper","name","displayName","value","constructor","rawData","expression","from","toExpression","clone"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { ConditionsModel } from '~/src/conditions/condition-model.js'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue\n} from '~/src/form/form-definition/types.js'\n\nexport class ConditionsWrapper {\n name: string\n displayName: string\n value: ConditionWrapperValue\n\n constructor(rawData: ConditionRawData) {\n const { name, displayName, value } = rawData\n this.displayName = displayName || name\n this.value = value\n this.name = name\n }\n\n get expression() {\n if (typeof this.value === 'string') {\n // Previously conditions were defined as strings, e.g: \"section.age < 18\"\n // keep this so application can support legacy forms exports.\n return this.value\n }\n\n return ConditionsModel.from(this.value).toExpression()\n }\n\n clone(): ConditionsWrapper {\n return new ConditionsWrapper(this)\n }\n}\n"],"mappings":"AAAA,SAASA,eAAe;AAMxB,OAAO,MAAMC,iBAAiB,CAAC;EAC7BC,IAAI;EACJC,WAAW;EACXC,KAAK;EAELC,WAAWA,CAACC,OAAyB,EAAE;IACrC,MAAM;MAAEJ,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GAAGE,OAAO;IAC5C,IAAI,CAACH,WAAW,GAAGA,WAAW,IAAID,IAAI;IACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;EAEA,IAAIK,UAAUA,CAAA,EAAG;IACf,IAAI,OAAO,IAAI,CAACH,KAAK,KAAK,QAAQ,EAAE;MAClC;MACA;MACA,OAAO,IAAI,CAACA,KAAK;IACnB;IAEA,OAAOJ,eAAe,CAACQ,IAAI,CAAC,IAAI,CAACJ,KAAK,CAAC,CAACK,YAAY,CAAC,CAAC;EACxD;EAEAC,KAAKA,CAAA,EAAsB;IACzB,OAAO,IAAIT,iBAAiB,CAAC,IAAI,CAAC;EACpC;AACF","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["InputWrapper","ConditionsWrapper"],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from '~/src/data-model/input-wrapper.js'\nexport { ConditionsWrapper } from '~/src/data-model/conditions-wrapper.js'\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SAASC,iBAAiB","ignoreList":[]}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { clone } from "../utils/helpers.js";
|
2
|
-
export class InputWrapper {
|
3
|
-
name = undefined;
|
4
|
-
title = undefined;
|
5
|
-
type = undefined;
|
6
|
-
propertyPath;
|
7
|
-
#parentItemName;
|
8
|
-
page;
|
9
|
-
constructor(rawData, page, options) {
|
10
|
-
Object.assign(this, rawData);
|
11
|
-
const myPage = clone(page);
|
12
|
-
delete myPage.components;
|
13
|
-
this.page = myPage;
|
14
|
-
this.propertyPath = !options.ignoreSection && page.section ? `${page.section}.${this.name}` : this.name;
|
15
|
-
this.#parentItemName = options.parentItemName;
|
16
|
-
}
|
17
|
-
get displayName() {
|
18
|
-
const titleWithContext = this.#parentItemName ? `${this.title} under ${this.#parentItemName}` : this.title;
|
19
|
-
return this.page.section ? `${titleWithContext} in ${this.page.section}` : titleWithContext;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
//# sourceMappingURL=input-wrapper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"input-wrapper.js","names":["clone","InputWrapper","name","undefined","title","type","propertyPath","parentItemName","page","constructor","rawData","options","Object","assign","myPage","components","ignoreSection","section","displayName","titleWithContext"],"sources":["../../../src/data-model/input-wrapper.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type Page } from '~/src/form/form-definition/types.js'\nimport { clone } from '~/src/utils/helpers.js'\n\nexport class InputWrapper {\n name: string | undefined = undefined\n title: string | undefined = undefined\n type: string | undefined = undefined\n propertyPath: string | undefined\n #parentItemName: string | undefined\n page: Page\n\n constructor(\n rawData: ComponentDef,\n page: Page,\n options: { ignoreSection?: boolean; parentItemName?: string }\n ) {\n Object.assign(this, rawData)\n const myPage = clone(page)\n\n delete myPage.components\n\n this.page = myPage\n this.propertyPath =\n !options.ignoreSection && page.section\n ? `${page.section}.${this.name}`\n : this.name\n this.#parentItemName = options.parentItemName\n }\n\n get displayName(): string | undefined {\n const titleWithContext = this.#parentItemName\n ? `${this.title} under ${this.#parentItemName}`\n : this.title\n\n return this.page.section\n ? `${titleWithContext} in ${this.page.section}`\n : titleWithContext\n }\n}\n"],"mappings":"AAEA,SAASA,KAAK;AAEd,OAAO,MAAMC,YAAY,CAAC;EACxBC,IAAI,GAAuBC,SAAS;EACpCC,KAAK,GAAuBD,SAAS;EACrCE,IAAI,GAAuBF,SAAS;EACpCG,YAAY;EACZ,CAACC,cAAc;EACfC,IAAI;EAEJC,WAAWA,CACTC,OAAqB,EACrBF,IAAU,EACVG,OAA6D,EAC7D;IACAC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEH,OAAO,CAAC;IAC5B,MAAMI,MAAM,GAAGd,KAAK,CAACQ,IAAI,CAAC;IAE1B,OAAOM,MAAM,CAACC,UAAU;IAExB,IAAI,CAACP,IAAI,GAAGM,MAAM;IAClB,IAAI,CAACR,YAAY,GACf,CAACK,OAAO,CAACK,aAAa,IAAIR,IAAI,CAACS,OAAO,GAClC,GAAGT,IAAI,CAACS,OAAO,IAAI,IAAI,CAACf,IAAI,EAAE,GAC9B,IAAI,CAACA,IAAI;IACf,IAAI,CAAC,CAACK,cAAc,GAAGI,OAAO,CAACJ,cAAc;EAC/C;EAEA,IAAIW,WAAWA,CAAA,EAAuB;IACpC,MAAMC,gBAAgB,GAAG,IAAI,CAAC,CAACZ,cAAc,GACzC,GAAG,IAAI,CAACH,KAAK,UAAU,IAAI,CAAC,CAACG,cAAc,EAAE,GAC7C,IAAI,CAACH,KAAK;IAEd,OAAO,IAAI,CAACI,IAAI,CAACS,OAAO,GACpB,GAAGE,gBAAgB,OAAO,IAAI,CAACX,IAAI,CAACS,OAAO,EAAE,GAC7CE,gBAAgB;EACtB;AACF","ignoreList":[]}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { type ConditionRawData, type ConditionWrapperValue } from '../form/form-definition/types.js';
|
2
|
-
export declare class ConditionsWrapper {
|
3
|
-
name: string;
|
4
|
-
displayName: string;
|
5
|
-
value: ConditionWrapperValue;
|
6
|
-
constructor(rawData: ConditionRawData);
|
7
|
-
get expression(): string;
|
8
|
-
clone(): ConditionsWrapper;
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=conditions-wrapper.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"conditions-wrapper.d.ts","sourceRoot":"","sources":["../../../src/data-model/conditions-wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,qCAAqC,CAAA;AAE5C,qBAAa,iBAAiB;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,qBAAqB,CAAA;gBAEhB,OAAO,EAAE,gBAAgB;IAOrC,IAAI,UAAU,WAQb;IAED,KAAK,IAAI,iBAAiB;CAG3B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { type ComponentDef } from '../components/types.js';
|
2
|
-
import { type Page } from '../form/form-definition/types.js';
|
3
|
-
export declare class InputWrapper {
|
4
|
-
#private;
|
5
|
-
name: string | undefined;
|
6
|
-
title: string | undefined;
|
7
|
-
type: string | undefined;
|
8
|
-
propertyPath: string | undefined;
|
9
|
-
page: Page;
|
10
|
-
constructor(rawData: ComponentDef, page: Page, options: {
|
11
|
-
ignoreSection?: boolean;
|
12
|
-
parentItemName?: string;
|
13
|
-
});
|
14
|
-
get displayName(): string | undefined;
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=input-wrapper.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"input-wrapper.d.ts","sourceRoot":"","sources":["../../../src/data-model/input-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,qCAAqC,CAAA;AAG/D,qBAAa,YAAY;;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAY;IACpC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAY;IACrC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAY;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhC,IAAI,EAAE,IAAI,CAAA;gBAGR,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE;IAe/D,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAQpC;CACF"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { ConditionsModel } from '~/src/conditions/condition-model.js'
|
2
|
-
import {
|
3
|
-
type ConditionRawData,
|
4
|
-
type ConditionWrapperValue
|
5
|
-
} from '~/src/form/form-definition/types.js'
|
6
|
-
|
7
|
-
export class ConditionsWrapper {
|
8
|
-
name: string
|
9
|
-
displayName: string
|
10
|
-
value: ConditionWrapperValue
|
11
|
-
|
12
|
-
constructor(rawData: ConditionRawData) {
|
13
|
-
const { name, displayName, value } = rawData
|
14
|
-
this.displayName = displayName || name
|
15
|
-
this.value = value
|
16
|
-
this.name = name
|
17
|
-
}
|
18
|
-
|
19
|
-
get expression() {
|
20
|
-
if (typeof this.value === 'string') {
|
21
|
-
// Previously conditions were defined as strings, e.g: "section.age < 18"
|
22
|
-
// keep this so application can support legacy forms exports.
|
23
|
-
return this.value
|
24
|
-
}
|
25
|
-
|
26
|
-
return ConditionsModel.from(this.value).toExpression()
|
27
|
-
}
|
28
|
-
|
29
|
-
clone(): ConditionsWrapper {
|
30
|
-
return new ConditionsWrapper(this)
|
31
|
-
}
|
32
|
-
}
|
package/src/data-model/index.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { type ComponentDef } from '~/src/components/types.js'
|
2
|
-
import { type Page } from '~/src/form/form-definition/types.js'
|
3
|
-
import { clone } from '~/src/utils/helpers.js'
|
4
|
-
|
5
|
-
export class InputWrapper {
|
6
|
-
name: string | undefined = undefined
|
7
|
-
title: string | undefined = undefined
|
8
|
-
type: string | undefined = undefined
|
9
|
-
propertyPath: string | undefined
|
10
|
-
#parentItemName: string | undefined
|
11
|
-
page: Page
|
12
|
-
|
13
|
-
constructor(
|
14
|
-
rawData: ComponentDef,
|
15
|
-
page: Page,
|
16
|
-
options: { ignoreSection?: boolean; parentItemName?: string }
|
17
|
-
) {
|
18
|
-
Object.assign(this, rawData)
|
19
|
-
const myPage = clone(page)
|
20
|
-
|
21
|
-
delete myPage.components
|
22
|
-
|
23
|
-
this.page = myPage
|
24
|
-
this.propertyPath =
|
25
|
-
!options.ignoreSection && page.section
|
26
|
-
? `${page.section}.${this.name}`
|
27
|
-
: this.name
|
28
|
-
this.#parentItemName = options.parentItemName
|
29
|
-
}
|
30
|
-
|
31
|
-
get displayName(): string | undefined {
|
32
|
-
const titleWithContext = this.#parentItemName
|
33
|
-
? `${this.title} under ${this.#parentItemName}`
|
34
|
-
: this.title
|
35
|
-
|
36
|
-
return this.page.section
|
37
|
-
? `${titleWithContext} in ${this.page.section}`
|
38
|
-
: titleWithContext
|
39
|
-
}
|
40
|
-
}
|