@beinformed/ui 1.21.3 → 1.21.6
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 -8
- package/esm/models/attributes/AttributeModel.js +2 -2
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +3 -3
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +3 -3
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/error/ErrorCollection.js +4 -4
- package/esm/models/error/ErrorCollection.js.map +1 -1
- package/esm/models/form/FormModel.js +4 -4
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +2 -2
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/grouping/GroupingModel.js +36 -8
- package/esm/models/grouping/GroupingModel.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +2 -2
- package/lib/models/attributes/AttributeModel.js.flow +4 -4
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +3 -3
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +2 -2
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +3 -3
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +2 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/error/ErrorCollection.js +4 -4
- package/lib/models/error/ErrorCollection.js.flow +6 -6
- package/lib/models/error/ErrorCollection.js.map +1 -1
- package/lib/models/form/FormModel.js +4 -4
- package/lib/models/form/FormModel.js.flow +9 -7
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +2 -2
- package/lib/models/form/FormObjectModel.js.flow +4 -3
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/grouping/GroupingModel.js +36 -8
- package/lib/models/grouping/GroupingModel.js.flow +38 -10
- package/lib/models/grouping/GroupingModel.js.map +1 -1
- package/package.json +1 -1
- package/src/models/attributes/AttributeModel.js +4 -4
- package/src/models/attributes/ChoiceAttributeModel.js +2 -2
- package/src/models/attributes/DatetimeAttributeModel.js +2 -2
- package/src/models/error/ErrorCollection.js +6 -6
- package/src/models/form/FormModel.js +9 -7
- package/src/models/form/FormObjectModel.js +4 -3
- package/src/models/grouping/GroupingModel.js +38 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingModel.js","names":["GroupModel","constructor","group","context","contributions","_group","_context","_attributeCollection","AttributeCollection","attributes","grouping","_grouping","GroupingModel","dynamicschema","type","id","_id","label","attributeCollection","reference","hasAttributeByKey","key","getAttributeByKey","data","contexts","_prefix","prefix","getContextFromContributionsByPrefix","
|
|
1
|
+
{"version":3,"file":"GroupingModel.js","names":["GroupModel","constructor","group","context","contributions","_group","_context","_attributeCollection","AttributeCollection","attributes","grouping","_grouping","GroupingModel","dynamicschema","type","id","_id","label","attributeCollection","reference","hasAttributeByKey","key","getAttributeByKey","data","contexts","_prefix","prefix","_groups","createGroup","getContextFromContributionsByPrefix","getDynamicSchema","groups","hasGroups","length","some","groupByKey","getGroupByAttributeKey"],"sources":["../../../src/models/grouping/GroupingModel.js"],"sourcesContent":["// @flow\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport type { AttributeType } from \"../types\";\n\n/**\n * Group information model\n * Put GroupModel here because of possible circular dependency with GroupingModel below\n */\nexport class GroupModel {\n _group: Object;\n _context: Object;\n _attributeCollection: AttributeCollection;\n _grouping: ?GroupingModel;\n\n /**\n */\n constructor(group: Object, context: Object, contributions: Array<Object>) {\n this._group = group;\n this._context = context;\n\n this._attributeCollection = new AttributeCollection(\n group,\n context.attributes\n );\n\n if (group.grouping) {\n this._grouping = new GroupingModel(\n { ...group.grouping, dynamicschema: group.dynamicschema },\n contributions\n );\n }\n }\n\n /**\n */\n get type(): string {\n return this._group.type;\n }\n\n /**\n */\n get id(): string {\n return this._group._id || \"unknown\";\n }\n\n /**\n */\n get label(): string {\n return this._context.label;\n }\n\n /**\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n get grouping(): ?GroupingModel {\n return this._grouping;\n }\n\n /**\n * Retrieve array of reference id's\n */\n get reference(): Array<number> {\n return this._group.reference || [];\n }\n\n /**\n */\n hasAttributeByKey(key: string): boolean {\n if (this.attributeCollection.hasAttributeByKey(key)) {\n return true;\n }\n\n if (this.grouping) {\n return this.grouping.hasAttributeByKey(key);\n }\n\n return false;\n }\n\n /**\n */\n getAttributeByKey(key: string): AttributeType | null {\n if (this.attributeCollection.hasAttributeByKey(key)) {\n return this.attributeCollection.getAttributeByKey(key);\n }\n\n if (this.grouping) {\n return this.grouping.getAttributeByKey(key);\n }\n\n return null;\n }\n}\n\ntype Context = {\n prefix: string,\n label: string,\n metadata: Object,\n attributes: Array<Object>,\n};\n\n/**\n * Grouping model to group lists\n */\nexport default class GroupingModel {\n _prefix: string | null;\n _groups: Array<GroupModel> = [];\n\n /**\n */\n constructor(data: Object, contexts: Array<Context>) {\n this._prefix = data && data.prefix ? data.prefix : null;\n\n if (data?.group) {\n this._groups = this.createGroup(data, contexts);\n }\n }\n\n /**\n */\n createGroup(data: Object, contributions: Array<Context>): Array<Object> {\n const context = this.getContextFromContributionsByPrefix(\n contributions,\n this._prefix\n );\n\n return data.group.map((group) => {\n const dynamicschema = this.getDynamicSchema(group, data.dynamicschema);\n return new GroupModel(\n {\n ...group,\n dynamicschema,\n },\n context,\n contributions\n );\n });\n }\n\n /**\n * add grouped prefix to the dynamicschema\n */\n getDynamicSchema(group: Object, dynamicschema: Object): Object {\n if (dynamicschema) {\n if (\n this._prefix &&\n dynamicschema[group.type] &&\n !dynamicschema[this._prefix + group.type]\n ) {\n dynamicschema[this._prefix + group.type] = dynamicschema[group.type];\n }\n return dynamicschema;\n }\n return null;\n }\n\n /**\n * Retrieve groups of grouping\n */\n get groups(): Array<GroupModel> {\n return this._groups;\n }\n\n /**\n * Inidicates if Grouping has one or more groups\n */\n hasGroups(): boolean {\n return this._groups.length > 0;\n }\n\n /**\n * Get context of grouping\n */\n getContextFromContributionsByPrefix(\n contexts: Array<Object>,\n prefix: string | null\n ): Object {\n if (contexts && prefix !== null) {\n return contexts.find((context) => context.prefix === prefix) || {};\n }\n\n return {};\n }\n\n /**\n */\n hasAttributeByKey(key: string): boolean {\n return this.groups.some((group: GroupModel) =>\n group.hasAttributeByKey(key)\n );\n }\n\n /**\n */\n getAttributeByKey(key: string): AttributeType | null {\n const groupByKey = this.groups.find((group: GroupModel) =>\n group.hasAttributeByKey(key)\n );\n\n if (groupByKey) {\n return groupByKey.getAttributeByKey(key);\n }\n return null;\n }\n\n /**\n */\n getGroupByAttributeKey(key: string): ?GroupModel {\n return this.groups.find((group) => group.hasAttributeByKey(key));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,UAAN,CAAiB;EAMtB;AACF;EACEC,WAAW,CAACC,KAAD,EAAgBC,OAAhB,EAAiCC,aAAjC,EAA+D;IAAA;IAAA;IAAA;IAAA;IACxE,KAAKC,MAAL,GAAcH,KAAd;IACA,KAAKI,QAAL,GAAgBH,OAAhB;IAEA,KAAKI,oBAAL,GAA4B,IAAIC,4BAAJ,CAC1BN,KAD0B,EAE1BC,OAAO,CAACM,UAFkB,CAA5B;;IAKA,IAAIP,KAAK,CAACQ,QAAV,EAAoB;MAClB,KAAKC,SAAL,GAAiB,IAAIC,aAAJ,CACf,EAAE,GAAGV,KAAK,CAACQ,QAAX;QAAqBG,aAAa,EAAEX,KAAK,CAACW;MAA1C,CADe,EAEfT,aAFe,CAAjB;IAID;EACF;EAED;AACF;;;EACU,IAAJU,IAAI,GAAW;IACjB,OAAO,KAAKT,MAAL,CAAYS,IAAnB;EACD;EAED;AACF;;;EACQ,IAAFC,EAAE,GAAW;IACf,O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C/B,OAAO,mBAAAF,QAAQ,MAAR,CAAAA,QAAQ,EAAOrB,OAAD,IAAaA,OAAO,CAACuB,MAAR,KAAmBA,MAAtC,CAAR,IAAyD,EAAhE;IACD;;IAED,OAAO,EAAP;EACD;EAED;AACF;;;EACEN,iBAAiB,CAACC,GAAD,EAAuB;IACtC,OAAO,KAAKU,MAAL,CAAYG,IAAZ,CAAkBhC,KAAD,IACtBA,KAAK,CAACkB,iBAAN,CAAwBC,GAAxB,CADK,CAAP;EAGD;EAED;AACF;;;EACEC,iBAAiB,CAACD,GAAD,EAAoC;IAAA;;IACnD,MAAMc,UAAU,GAAG,oCAAKJ,MAAL,kBAAkB7B,KAAD,IAClCA,KAAK,CAACkB,iBAAN,CAAwBC,GAAxB,CADiB,CAAnB;;IAIA,IAAIc,UAAJ,EAAgB;MACd,OAAOA,UAAU,CAACb,iBAAX,CAA6BD,GAA7B,CAAP;IACD;;IACD,OAAO,IAAP;EACD;EAED;AACF;;;EACEe,sBAAsB,CAACf,GAAD,EAA2B;IAAA;;IAC/C,OAAO,oCAAKU,MAAL,kBAAkB7B,KAAD,IAAWA,KAAK,CAACkB,iBAAN,CAAwBC,GAAxB,CAA5B,CAAP;EACD;;AAzGgC"}
|
package/package.json
CHANGED
|
@@ -710,9 +710,9 @@ export default class AttributeModel
|
|
|
710
710
|
addServerError(error: FormErrorAnchor) {
|
|
711
711
|
this._errorCollection.addServerError(
|
|
712
712
|
error.id,
|
|
713
|
-
error.layouthint,
|
|
714
713
|
error.message,
|
|
715
|
-
error.properties
|
|
714
|
+
error.properties,
|
|
715
|
+
error.layouthint
|
|
716
716
|
);
|
|
717
717
|
}
|
|
718
718
|
|
|
@@ -813,9 +813,9 @@ export default class AttributeModel
|
|
|
813
813
|
if (this.hasValue()) {
|
|
814
814
|
this._errorCollection.addServerError(
|
|
815
815
|
error.id,
|
|
816
|
-
error.layouthint,
|
|
817
816
|
error.message,
|
|
818
|
-
this.formatParameters(error.properties)
|
|
817
|
+
this.formatParameters(error.properties),
|
|
818
|
+
error.layouthint
|
|
819
819
|
);
|
|
820
820
|
} else {
|
|
821
821
|
this.addServerConstraint(
|
|
@@ -396,7 +396,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
396
396
|
* Registers an error that was received from a server response
|
|
397
397
|
*/
|
|
398
398
|
addServerError(error: FormErrorAnchor) {
|
|
399
|
-
const { id,
|
|
399
|
+
const { id, message, properties, layouthint } = error;
|
|
400
400
|
|
|
401
401
|
const ANSWER_OPTION_KEY = "answer-option-key";
|
|
402
402
|
|
|
@@ -412,7 +412,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
this._errorCollection.addServerError(id,
|
|
415
|
+
this._errorCollection.addServerError(id, message, properties, layouthint);
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
/**
|
|
@@ -425,12 +425,12 @@ class DatetimeAttributeModel extends StringAttributeModel {
|
|
|
425
425
|
* Registers an error that was received from a server response
|
|
426
426
|
*/
|
|
427
427
|
addServerError(error: FormErrorAnchor) {
|
|
428
|
-
const { id,
|
|
428
|
+
const { id, message, properties, layouthint } = error;
|
|
429
429
|
if (properties && has(properties, "format") && this.formatLabel) {
|
|
430
430
|
properties.format = this.formatLabel;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
this._errorCollection.addServerError(id,
|
|
433
|
+
this._errorCollection.addServerError(id, message, properties, layouthint);
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/**
|
|
@@ -43,9 +43,9 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
43
43
|
*/
|
|
44
44
|
addError(
|
|
45
45
|
id: string,
|
|
46
|
-
layouthint?: LayoutHintCollection,
|
|
47
46
|
defaultMessage?: string,
|
|
48
|
-
parameters?: MessageParameters
|
|
47
|
+
parameters?: MessageParameters,
|
|
48
|
+
layouthint?: LayoutHintCollection
|
|
49
49
|
) {
|
|
50
50
|
const itemIdx = this.findById(id);
|
|
51
51
|
|
|
@@ -68,14 +68,14 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
68
68
|
*/
|
|
69
69
|
addServerError(
|
|
70
70
|
id: string,
|
|
71
|
-
layouthint?: LayoutHintCollection,
|
|
72
71
|
defaultMessage?: string,
|
|
73
|
-
parameters?: MessageParameters
|
|
72
|
+
parameters?: MessageParameters,
|
|
73
|
+
layouthint?: LayoutHintCollection
|
|
74
74
|
) {
|
|
75
75
|
if (parameters) {
|
|
76
|
-
this.addError(id,
|
|
76
|
+
this.addError(id, defaultMessage, parameters, layouthint);
|
|
77
77
|
} else {
|
|
78
|
-
this.addError(id,
|
|
78
|
+
this.addError(id, defaultMessage, undefined, layouthint);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -513,15 +513,16 @@ class FormModel extends ResourceModel {
|
|
|
513
513
|
if (error.parameters) {
|
|
514
514
|
this.errorCollection.addServerError(
|
|
515
515
|
error.id,
|
|
516
|
-
error.layouthint,
|
|
517
516
|
error.message,
|
|
518
|
-
error.parameters
|
|
517
|
+
error.parameters,
|
|
518
|
+
error.layouthint
|
|
519
519
|
);
|
|
520
520
|
} else {
|
|
521
521
|
this.errorCollection.addServerError(
|
|
522
522
|
error.id,
|
|
523
|
-
error.
|
|
524
|
-
|
|
523
|
+
error.message,
|
|
524
|
+
undefined,
|
|
525
|
+
error.layouthint
|
|
525
526
|
);
|
|
526
527
|
}
|
|
527
528
|
}
|
|
@@ -1003,7 +1004,8 @@ class FormModel extends ResourceModel {
|
|
|
1003
1004
|
this.errorCollection.addServerError(
|
|
1004
1005
|
error.id,
|
|
1005
1006
|
error.message,
|
|
1006
|
-
error.properties
|
|
1007
|
+
error.properties,
|
|
1008
|
+
error.layouthint
|
|
1007
1009
|
);
|
|
1008
1010
|
});
|
|
1009
1011
|
}
|
|
@@ -1024,9 +1026,9 @@ class FormModel extends ResourceModel {
|
|
|
1024
1026
|
} else {
|
|
1025
1027
|
this.errorCollection.addServerError(
|
|
1026
1028
|
error.id,
|
|
1027
|
-
new LayoutHintCollection(error.layouthint),
|
|
1028
1029
|
error.message,
|
|
1029
|
-
error.properties
|
|
1030
|
+
error.properties,
|
|
1031
|
+
new LayoutHintCollection(error.layouthint)
|
|
1030
1032
|
);
|
|
1031
1033
|
}
|
|
1032
1034
|
});
|
|
@@ -401,9 +401,9 @@ export default class FormObjectModel extends BaseModel {
|
|
|
401
401
|
} else {
|
|
402
402
|
this._errorCollection.addServerError(
|
|
403
403
|
error.id,
|
|
404
|
-
error.layouthint,
|
|
405
404
|
error.message,
|
|
406
|
-
error.properties
|
|
405
|
+
error.properties,
|
|
406
|
+
error.layouthint
|
|
407
407
|
);
|
|
408
408
|
}
|
|
409
409
|
}
|
|
@@ -463,7 +463,8 @@ export default class FormObjectModel extends BaseModel {
|
|
|
463
463
|
this.errorCollection.addServerError(
|
|
464
464
|
error.id,
|
|
465
465
|
error.message,
|
|
466
|
-
error.properties
|
|
466
|
+
error.properties,
|
|
467
|
+
error.layouthint
|
|
467
468
|
);
|
|
468
469
|
}
|
|
469
470
|
}
|
|
@@ -109,26 +109,54 @@ type Context = {
|
|
|
109
109
|
*/
|
|
110
110
|
export default class GroupingModel {
|
|
111
111
|
_prefix: string | null;
|
|
112
|
-
_groups: Array<GroupModel
|
|
112
|
+
_groups: Array<GroupModel> = [];
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
*/
|
|
116
116
|
constructor(data: Object, contexts: Array<Context>) {
|
|
117
117
|
this._prefix = data && data.prefix ? data.prefix : null;
|
|
118
118
|
|
|
119
|
+
if (data?.group) {
|
|
120
|
+
this._groups = this.createGroup(data, contexts);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
*/
|
|
126
|
+
createGroup(data: Object, contributions: Array<Context>): Array<Object> {
|
|
119
127
|
const context = this.getContextFromContributionsByPrefix(
|
|
120
|
-
|
|
128
|
+
contributions,
|
|
121
129
|
this._prefix
|
|
122
130
|
);
|
|
123
131
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
return data.group.map((group) => {
|
|
133
|
+
const dynamicschema = this.getDynamicSchema(group, data.dynamicschema);
|
|
134
|
+
return new GroupModel(
|
|
135
|
+
{
|
|
136
|
+
...group,
|
|
137
|
+
dynamicschema,
|
|
138
|
+
},
|
|
139
|
+
context,
|
|
140
|
+
contributions
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* add grouped prefix to the dynamicschema
|
|
147
|
+
*/
|
|
148
|
+
getDynamicSchema(group: Object, dynamicschema: Object): Object {
|
|
149
|
+
if (dynamicschema) {
|
|
150
|
+
if (
|
|
151
|
+
this._prefix &&
|
|
152
|
+
dynamicschema[group.type] &&
|
|
153
|
+
!dynamicschema[this._prefix + group.type]
|
|
154
|
+
) {
|
|
155
|
+
dynamicschema[this._prefix + group.type] = dynamicschema[group.type];
|
|
156
|
+
}
|
|
157
|
+
return dynamicschema;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
132
160
|
}
|
|
133
161
|
|
|
134
162
|
/**
|