@beinformed/ui 1.37.0 → 1.39.0
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/CHANGELOG.md +14 -0
- package/esm/models/attributes/AttributeSetModel.js +11 -10
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js +11 -10
- package/lib/models/attributes/AttributeSetModel.js.flow +13 -13
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/__tests__/AttributeModel.spec.js.flow +14 -0
- package/package.json +15 -15
- package/src/models/attributes/AttributeSetModel.js +13 -13
- package/src/models/attributes/__tests__/AttributeModel.spec.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.39.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.38.0...v1.39.0) (2023-12-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **nullable:** revert nullable property handling ([902850e](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/902850eec199c61350d5f46f112abe3122b4c6cb))
|
|
11
|
+
|
|
12
|
+
## [1.38.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.37.0...v1.38.0) (2023-11-23)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **nullabel:** consider nullable property on attribute to indicate a mandatory attribute ([f0ec2eb](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/f0ec2eb497e622d1adf9fb94b8fb7f87ae02d2db))
|
|
18
|
+
|
|
5
19
|
## [1.37.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.36.1...v1.37.0) (2023-11-08)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -72,18 +72,19 @@ export default class AttributeSetModel extends BaseModel {
|
|
|
72
72
|
* Retrieve child {@code AttributeSetModel}s
|
|
73
73
|
*/
|
|
74
74
|
getChildAttributeSets() {
|
|
75
|
+
if (!this.contributions.objects) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
75
78
|
const childAttributeSets = [];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
childAttributeSets.push(this.createChildAttributeSetModel(key, dataObject, i));
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
childAttributeSets.push(this.createChildAttributeSetModel(key, this.data[key]));
|
|
79
|
+
for (const key of _Object$keys(this.contributions.objects)) {
|
|
80
|
+
if (key in this.data) {
|
|
81
|
+
if (Array.isArray(this.data[key])) {
|
|
82
|
+
for (const [i, dataObject] of _entriesInstanceProperty(_context2 = this.data[key]).call(_context2)) {
|
|
83
|
+
var _context2;
|
|
84
|
+
childAttributeSets.push(this.createChildAttributeSetModel(key, dataObject, i));
|
|
86
85
|
}
|
|
86
|
+
} else {
|
|
87
|
+
childAttributeSets.push(this.createChildAttributeSetModel(key, this.data[key]));
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeSetModel.js","names":["has","BaseModel","AttributeCollection","AttributeSetModel","constructor","_context","key","arguments","length","undefined","data","contributions","_defineProperty","attributeContributions","attributes","_filterInstanceProperty","call","contribution","contributionKey","_Object$keys","_attributeCollection","_key","label","attributeCollection","collection","createChildAttributeSetModel","dataObject","index","dynamicschema","objects","getChildAttributeSets","childAttributeSets","Array","isArray","i","_entriesInstanceProperty","_context2","push"],"sources":["../../../src/models/attributes/AttributeSetModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"./AttributeCollection\";\n\n/**\n */\nexport default class AttributeSetModel extends BaseModel {\n _key: string;\n _attributeCollection: AttributeCollection;\n\n /**\n */\n constructor(key: string = \"\", data: Object = {}, contributions: Object = {}) {\n super(data, contributions);\n\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [contributionKey] = Object.keys(contribution);\n return has(this.data, contributionKey);\n })\n : [];\n\n this._attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get label(): ?string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n * Set the attributes with a new AttributeCollection\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n */\n createChildAttributeSetModel(\n key: string,\n dataObject: Object,\n index?: number,\n ): AttributeSetModel {\n return new AttributeSetModel(\n index ? `${key}-${index + 1}` : key,\n {\n ...dataObject,\n dynamicschema: this.data.dynamicschema,\n },\n this.contributions.objects[key],\n );\n }\n\n /**\n * Retrieve child {@code AttributeSetModel}s\n */\n getChildAttributeSets(): Array<AttributeSetModel> {\n
|
|
1
|
+
{"version":3,"file":"AttributeSetModel.js","names":["has","BaseModel","AttributeCollection","AttributeSetModel","constructor","_context","key","arguments","length","undefined","data","contributions","_defineProperty","attributeContributions","attributes","_filterInstanceProperty","call","contribution","contributionKey","_Object$keys","_attributeCollection","_key","label","attributeCollection","collection","createChildAttributeSetModel","dataObject","index","dynamicschema","objects","getChildAttributeSets","childAttributeSets","Array","isArray","i","_entriesInstanceProperty","_context2","push"],"sources":["../../../src/models/attributes/AttributeSetModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"./AttributeCollection\";\n\n/**\n */\nexport default class AttributeSetModel extends BaseModel {\n _key: string;\n _attributeCollection: AttributeCollection;\n\n /**\n */\n constructor(key: string = \"\", data: Object = {}, contributions: Object = {}) {\n super(data, contributions);\n\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [contributionKey] = Object.keys(contribution);\n return has(this.data, contributionKey);\n })\n : [];\n\n this._attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get label(): ?string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n * Set the attributes with a new AttributeCollection\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n */\n createChildAttributeSetModel(\n key: string,\n dataObject: Object,\n index?: number,\n ): AttributeSetModel {\n return new AttributeSetModel(\n index ? `${key}-${index + 1}` : key,\n {\n ...dataObject,\n dynamicschema: this.data.dynamicschema,\n },\n this.contributions.objects[key],\n );\n }\n\n /**\n * Retrieve child {@code AttributeSetModel}s\n */\n getChildAttributeSets(): Array<AttributeSetModel> {\n if (!this.contributions.objects) {\n return [];\n }\n\n const childAttributeSets = [];\n for (const key of Object.keys(this.contributions.objects)) {\n if (key in this.data) {\n if (Array.isArray(this.data[key])) {\n for (const [i, dataObject] of this.data[key].entries()) {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, dataObject, i),\n );\n }\n } else {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, this.data[key]),\n );\n }\n }\n }\n return childAttributeSets;\n }\n}\n"],"mappings":";;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,mBAAmB,MAAM,uBAAuB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AAkB,CAACM,IAAI,CACrB,IAAI,CAACZ,4BAA4B,CAACnB,GAAG,EAAE,IAAI,CAACI,IAAI,CAACJ,GAAG,CAAC,CACvD,CAAC;QACH;MACF;IACF;IACA,OAAOyB,kBAAkB;EAC3B;AACF"}
|
|
@@ -78,18 +78,19 @@ class AttributeSetModel extends _BaseModel.default {
|
|
|
78
78
|
* Retrieve child {@code AttributeSetModel}s
|
|
79
79
|
*/
|
|
80
80
|
getChildAttributeSets() {
|
|
81
|
+
if (!this.contributions.objects) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
81
84
|
const childAttributeSets = [];
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
childAttributeSets.push(this.createChildAttributeSetModel(key, dataObject, i));
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
childAttributeSets.push(this.createChildAttributeSetModel(key, this.data[key]));
|
|
85
|
+
for (const key of (0, _keys.default)(this.contributions.objects)) {
|
|
86
|
+
if (key in this.data) {
|
|
87
|
+
if (Array.isArray(this.data[key])) {
|
|
88
|
+
for (const [i, dataObject] of (0, _entries.default)(_context2 = this.data[key]).call(_context2)) {
|
|
89
|
+
var _context2;
|
|
90
|
+
childAttributeSets.push(this.createChildAttributeSetModel(key, dataObject, i));
|
|
92
91
|
}
|
|
92
|
+
} else {
|
|
93
|
+
childAttributeSets.push(this.createChildAttributeSetModel(key, this.data[key]));
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -84,26 +84,26 @@ export default class AttributeSetModel extends BaseModel {
|
|
|
84
84
|
* Retrieve child {@code AttributeSetModel}s
|
|
85
85
|
*/
|
|
86
86
|
getChildAttributeSets(): Array<AttributeSetModel> {
|
|
87
|
-
|
|
87
|
+
if (!this.contributions.objects) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
childAttributeSets.push(
|
|
95
|
-
this.createChildAttributeSetModel(key, dataObject, i),
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
91
|
+
const childAttributeSets = [];
|
|
92
|
+
for (const key of Object.keys(this.contributions.objects)) {
|
|
93
|
+
if (key in this.data) {
|
|
94
|
+
if (Array.isArray(this.data[key])) {
|
|
95
|
+
for (const [i, dataObject] of this.data[key].entries()) {
|
|
99
96
|
childAttributeSets.push(
|
|
100
|
-
this.createChildAttributeSetModel(key,
|
|
97
|
+
this.createChildAttributeSetModel(key, dataObject, i),
|
|
101
98
|
);
|
|
102
99
|
}
|
|
100
|
+
} else {
|
|
101
|
+
childAttributeSets.push(
|
|
102
|
+
this.createChildAttributeSetModel(key, this.data[key]),
|
|
103
|
+
);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
|
|
107
107
|
return childAttributeSets;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeSetModel.js","names":["_objects","require","_BaseModel","_interopRequireDefault","_AttributeCollection","AttributeSetModel","BaseModel","constructor","_context","key","arguments","length","undefined","data","contributions","_defineProperty2","default","attributeContributions","attributes","_filter","call","contribution","contributionKey","_keys","has","_attributeCollection","AttributeCollection","_key","label","attributeCollection","collection","createChildAttributeSetModel","dataObject","index","dynamicschema","objects","getChildAttributeSets","childAttributeSets","Array","isArray","i","_entries","_context2","push","exports"],"sources":["../../../src/models/attributes/AttributeSetModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"./AttributeCollection\";\n\n/**\n */\nexport default class AttributeSetModel extends BaseModel {\n _key: string;\n _attributeCollection: AttributeCollection;\n\n /**\n */\n constructor(key: string = \"\", data: Object = {}, contributions: Object = {}) {\n super(data, contributions);\n\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [contributionKey] = Object.keys(contribution);\n return has(this.data, contributionKey);\n })\n : [];\n\n this._attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get label(): ?string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n * Set the attributes with a new AttributeCollection\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n */\n createChildAttributeSetModel(\n key: string,\n dataObject: Object,\n index?: number,\n ): AttributeSetModel {\n return new AttributeSetModel(\n index ? `${key}-${index + 1}` : key,\n {\n ...dataObject,\n dynamicschema: this.data.dynamicschema,\n },\n this.contributions.objects[key],\n );\n }\n\n /**\n * Retrieve child {@code AttributeSetModel}s\n */\n getChildAttributeSets(): Array<AttributeSetModel> {\n
|
|
1
|
+
{"version":3,"file":"AttributeSetModel.js","names":["_objects","require","_BaseModel","_interopRequireDefault","_AttributeCollection","AttributeSetModel","BaseModel","constructor","_context","key","arguments","length","undefined","data","contributions","_defineProperty2","default","attributeContributions","attributes","_filter","call","contribution","contributionKey","_keys","has","_attributeCollection","AttributeCollection","_key","label","attributeCollection","collection","createChildAttributeSetModel","dataObject","index","dynamicschema","objects","getChildAttributeSets","childAttributeSets","Array","isArray","i","_entries","_context2","push","exports"],"sources":["../../../src/models/attributes/AttributeSetModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport BaseModel from \"../base/BaseModel\";\nimport AttributeCollection from \"./AttributeCollection\";\n\n/**\n */\nexport default class AttributeSetModel extends BaseModel {\n _key: string;\n _attributeCollection: AttributeCollection;\n\n /**\n */\n constructor(key: string = \"\", data: Object = {}, contributions: Object = {}) {\n super(data, contributions);\n\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [contributionKey] = Object.keys(contribution);\n return has(this.data, contributionKey);\n })\n : [];\n\n this._attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get label(): ?string {\n return this.contributions.label;\n }\n\n /**\n * Retrieve attribute collection\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n * Set the attributes with a new AttributeCollection\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n */\n createChildAttributeSetModel(\n key: string,\n dataObject: Object,\n index?: number,\n ): AttributeSetModel {\n return new AttributeSetModel(\n index ? `${key}-${index + 1}` : key,\n {\n ...dataObject,\n dynamicschema: this.data.dynamicschema,\n },\n this.contributions.objects[key],\n );\n }\n\n /**\n * Retrieve child {@code AttributeSetModel}s\n */\n getChildAttributeSets(): Array<AttributeSetModel> {\n if (!this.contributions.objects) {\n return [];\n }\n\n const childAttributeSets = [];\n for (const key of Object.keys(this.contributions.objects)) {\n if (key in this.data) {\n if (Array.isArray(this.data[key])) {\n for (const [i, dataObject] of this.data[key].entries()) {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, dataObject, i),\n );\n }\n } else {\n childAttributeSets.push(\n this.createChildAttributeSetModel(key, this.data[key]),\n );\n }\n }\n }\n return childAttributeSets;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA;AACA;AACe,MAAMI,iBAAiB,SAASC,kBAAS,CAAC;EAIvD;AACF;EACEC,WAAWA,CAAA,EAAkE;IAAA,IAAAC,QAAA;IAAA,IAAjEC,GAAW,GAAA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,CACrB,IAAI,CAACZ,4BAA4B,CAACtB,GAAG,EAAE,IAAI,CAACI,IAAI,CAACJ,GAAG,CAAC,CACvD,CAAC;QACH;MACF;IACF;IACA,OAAO4B,kBAAkB;EAC3B;AACF;AAACO,OAAA,CAAA5B,OAAA,GAAAX,iBAAA"}
|
|
@@ -257,4 +257,18 @@ describe("attributeModel", () => {
|
|
|
257
257
|
expect(attribute.concept).toBeInstanceOf(ConceptDetailModel);
|
|
258
258
|
expect(attribute.concept.type).toBe("ConceptDetail");
|
|
259
259
|
});
|
|
260
|
+
|
|
261
|
+
it("indicates correct mandatory", () => {
|
|
262
|
+
let attribute = new AttributeModel({}, { mandatory: true });
|
|
263
|
+
expect(attribute.mandatory).toBe(true);
|
|
264
|
+
|
|
265
|
+
attribute = new AttributeModel({}, { mandatory: false });
|
|
266
|
+
expect(attribute.mandatory).toBe(false);
|
|
267
|
+
|
|
268
|
+
attribute = new AttributeModel(
|
|
269
|
+
{},
|
|
270
|
+
{ mandatory: false, layouthint: ["mandatory"] },
|
|
271
|
+
);
|
|
272
|
+
expect(attribute.mandatory).toBe(true);
|
|
273
|
+
});
|
|
260
274
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.0",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"styled-components": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@babel/runtime-corejs3": "^7.23.
|
|
85
|
+
"@babel/runtime-corejs3": "^7.23.4",
|
|
86
86
|
"big.js": "^6.2.1",
|
|
87
87
|
"date-fns": "^2.30.0",
|
|
88
88
|
"deepmerge": "^4.3.1",
|
|
@@ -98,19 +98,19 @@
|
|
|
98
98
|
"setimmediate": "^1.0.5"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@babel/cli": "^7.23.
|
|
102
|
-
"@babel/core": "^7.23.
|
|
103
|
-
"@babel/eslint-parser": "^7.
|
|
101
|
+
"@babel/cli": "^7.23.4",
|
|
102
|
+
"@babel/core": "^7.23.3",
|
|
103
|
+
"@babel/eslint-parser": "^7.23.3",
|
|
104
104
|
"@babel/eslint-plugin": "^7.22.10",
|
|
105
105
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
106
106
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
107
|
-
"@babel/plugin-transform-runtime": "^7.23.
|
|
108
|
-
"@babel/preset-env": "^7.23.
|
|
109
|
-
"@babel/preset-flow": "^7.
|
|
110
|
-
"@babel/preset-react": "^7.
|
|
111
|
-
"@commitlint/cli": "^18.
|
|
112
|
-
"@commitlint/config-conventional": "^18.
|
|
113
|
-
"@testing-library/react": "^14.1.
|
|
107
|
+
"@babel/plugin-transform-runtime": "^7.23.4",
|
|
108
|
+
"@babel/preset-env": "^7.23.3",
|
|
109
|
+
"@babel/preset-flow": "^7.23.3",
|
|
110
|
+
"@babel/preset-react": "^7.23.3",
|
|
111
|
+
"@commitlint/cli": "^18.4.3",
|
|
112
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
113
|
+
"@testing-library/react": "^14.1.2",
|
|
114
114
|
"auditjs": "^4.0.41",
|
|
115
115
|
"babel-jest": "^29.7.0",
|
|
116
116
|
"babel-plugin-styled-components": "^2.1.4",
|
|
@@ -118,13 +118,13 @@
|
|
|
118
118
|
"commit-and-tag-version": "^12.0.0",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
120
|
"documentation": "^14.0.2",
|
|
121
|
-
"eslint": "^8.
|
|
121
|
+
"eslint": "^8.54.0",
|
|
122
122
|
"eslint-config-prettier": "^9.0.0",
|
|
123
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
124
|
"eslint-plugin-ft-flow": "^3.0.1",
|
|
125
125
|
"eslint-plugin-import": "^2.29.0",
|
|
126
126
|
"eslint-plugin-jest": "^27.6.0",
|
|
127
|
-
"eslint-plugin-jsdoc": "^46.
|
|
127
|
+
"eslint-plugin-jsdoc": "^46.9.0",
|
|
128
128
|
"eslint-plugin-react": "^7.33.2",
|
|
129
129
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
130
130
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"jscodeshift": "^0.15.1",
|
|
142
142
|
"lint-staged": "^13.2.3",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^3.0
|
|
144
|
+
"prettier": "^3.1.0",
|
|
145
145
|
"react": "^18.0.0",
|
|
146
146
|
"react-dom": "^18.0.0",
|
|
147
147
|
"react-helmet-async": "^1.0.0",
|
|
@@ -84,26 +84,26 @@ export default class AttributeSetModel extends BaseModel {
|
|
|
84
84
|
* Retrieve child {@code AttributeSetModel}s
|
|
85
85
|
*/
|
|
86
86
|
getChildAttributeSets(): Array<AttributeSetModel> {
|
|
87
|
-
|
|
87
|
+
if (!this.contributions.objects) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
childAttributeSets.push(
|
|
95
|
-
this.createChildAttributeSetModel(key, dataObject, i),
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
91
|
+
const childAttributeSets = [];
|
|
92
|
+
for (const key of Object.keys(this.contributions.objects)) {
|
|
93
|
+
if (key in this.data) {
|
|
94
|
+
if (Array.isArray(this.data[key])) {
|
|
95
|
+
for (const [i, dataObject] of this.data[key].entries()) {
|
|
99
96
|
childAttributeSets.push(
|
|
100
|
-
this.createChildAttributeSetModel(key,
|
|
97
|
+
this.createChildAttributeSetModel(key, dataObject, i),
|
|
101
98
|
);
|
|
102
99
|
}
|
|
100
|
+
} else {
|
|
101
|
+
childAttributeSets.push(
|
|
102
|
+
this.createChildAttributeSetModel(key, this.data[key]),
|
|
103
|
+
);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
|
|
107
107
|
return childAttributeSets;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -257,4 +257,18 @@ describe("attributeModel", () => {
|
|
|
257
257
|
expect(attribute.concept).toBeInstanceOf(ConceptDetailModel);
|
|
258
258
|
expect(attribute.concept.type).toBe("ConceptDetail");
|
|
259
259
|
});
|
|
260
|
+
|
|
261
|
+
it("indicates correct mandatory", () => {
|
|
262
|
+
let attribute = new AttributeModel({}, { mandatory: true });
|
|
263
|
+
expect(attribute.mandatory).toBe(true);
|
|
264
|
+
|
|
265
|
+
attribute = new AttributeModel({}, { mandatory: false });
|
|
266
|
+
expect(attribute.mandatory).toBe(false);
|
|
267
|
+
|
|
268
|
+
attribute = new AttributeModel(
|
|
269
|
+
{},
|
|
270
|
+
{ mandatory: false, layouthint: ["mandatory"] },
|
|
271
|
+
);
|
|
272
|
+
expect(attribute.mandatory).toBe(true);
|
|
273
|
+
});
|
|
260
274
|
});
|