@beinformed/ui 1.21.2 → 1.21.5
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 +17 -6
- package/esm/models/attributes/AttributeModel.js +2 -2
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +3 -2
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +3 -2
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/error/ErrorCollection.js +7 -6
- package/esm/models/error/ErrorCollection.js.map +1 -1
- package/esm/models/error/ErrorModel.js +2 -1
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +11 -5
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/form/FormModel.js +5 -4
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +1 -1
- 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/esm/models/types.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +2 -2
- package/lib/models/attributes/AttributeModel.js.flow +4 -2
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +3 -2
- 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 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +2 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/error/ErrorCollection.js +7 -5
- package/lib/models/error/ErrorCollection.js.flow +8 -5
- package/lib/models/error/ErrorCollection.js.map +1 -1
- package/lib/models/error/ErrorModel.js +2 -1
- package/lib/models/error/ErrorModel.js.flow +5 -2
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +11 -5
- package/lib/models/error/ErrorResponse.js.flow +4 -4
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/form/FormModel.js +5 -3
- package/lib/models/form/FormModel.js.flow +11 -3
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +1 -1
- package/lib/models/form/FormObjectModel.js.flow +2 -1
- 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/lib/models/types.js.flow +1 -1
- package/lib/models/types.js.map +1 -1
- package/package.json +1 -1
- package/src/models/attributes/AttributeModel.js +4 -2
- package/src/models/attributes/ChoiceAttributeModel.js +2 -2
- package/src/models/attributes/DatetimeAttributeModel.js +2 -2
- package/src/models/error/ErrorCollection.js +8 -5
- package/src/models/error/ErrorModel.js +5 -2
- package/src/models/error/ErrorResponse.js +4 -4
- package/src/models/form/FormModel.js +11 -3
- package/src/models/form/FormObjectModel.js +2 -1
- package/src/models/grouping/GroupingModel.js +38 -10
- package/src/models/types.js +1 -1
package/lib/models/types.js.flow
CHANGED
package/lib/models/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -711,7 +711,8 @@ export default class AttributeModel
|
|
|
711
711
|
this._errorCollection.addServerError(
|
|
712
712
|
error.id,
|
|
713
713
|
error.message,
|
|
714
|
-
error.properties
|
|
714
|
+
error.properties,
|
|
715
|
+
error.layouthint
|
|
715
716
|
);
|
|
716
717
|
}
|
|
717
718
|
|
|
@@ -813,7 +814,8 @@ export default class AttributeModel
|
|
|
813
814
|
this._errorCollection.addServerError(
|
|
814
815
|
error.id,
|
|
815
816
|
error.message,
|
|
816
|
-
this.formatParameters(error.properties)
|
|
817
|
+
this.formatParameters(error.properties),
|
|
818
|
+
error.layouthint
|
|
817
819
|
);
|
|
818
820
|
} else {
|
|
819
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, message, properties } = error;
|
|
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, message, properties);
|
|
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, message, properties } = error;
|
|
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, message, properties);
|
|
433
|
+
this._errorCollection.addServerError(id, message, properties, layouthint);
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/**
|
|
@@ -4,6 +4,7 @@ import ErrorModel from "./ErrorModel";
|
|
|
4
4
|
|
|
5
5
|
import type { MessageParameters } from "../../i18n/types";
|
|
6
6
|
import type { IConstraintModel } from "../types";
|
|
7
|
+
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Form Objects
|
|
@@ -43,7 +44,8 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
43
44
|
addError(
|
|
44
45
|
id: string,
|
|
45
46
|
defaultMessage?: string,
|
|
46
|
-
parameters?: MessageParameters
|
|
47
|
+
parameters?: MessageParameters,
|
|
48
|
+
layouthint?: LayoutHintCollection
|
|
47
49
|
) {
|
|
48
50
|
const itemIdx = this.findById(id);
|
|
49
51
|
|
|
@@ -51,7 +53,7 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
51
53
|
this.removeByIndex(itemIdx);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
this.add(new ErrorModel(id, defaultMessage, parameters));
|
|
56
|
+
this.add(new ErrorModel(id, defaultMessage, parameters, false, layouthint));
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/**
|
|
@@ -67,12 +69,13 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
67
69
|
addServerError(
|
|
68
70
|
id: string,
|
|
69
71
|
defaultMessage?: string,
|
|
70
|
-
parameters?: MessageParameters
|
|
72
|
+
parameters?: MessageParameters,
|
|
73
|
+
layouthint?: LayoutHintCollection
|
|
71
74
|
) {
|
|
72
75
|
if (parameters) {
|
|
73
|
-
this.addError(id, defaultMessage, parameters);
|
|
76
|
+
this.addError(id, defaultMessage, parameters, layouthint);
|
|
74
77
|
} else {
|
|
75
|
-
this.addError(id, defaultMessage);
|
|
78
|
+
this.addError(id, defaultMessage, undefined, layouthint);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
@@ -19,13 +19,16 @@ class ErrorModel {
|
|
|
19
19
|
id: string,
|
|
20
20
|
defaultMessage: ?string,
|
|
21
21
|
parameters: ?MessageParameters,
|
|
22
|
-
isClientConstraint: boolean = false
|
|
22
|
+
isClientConstraint: boolean = false,
|
|
23
|
+
layouthint: LayoutHintCollection = new LayoutHintCollection()
|
|
23
24
|
) {
|
|
24
25
|
this._id = id;
|
|
25
26
|
this._parameters = parameters;
|
|
26
27
|
this._defaultMessage = defaultMessage;
|
|
27
28
|
this._isClientConstraint = isClientConstraint;
|
|
28
|
-
this._layouthint =
|
|
29
|
+
this._layouthint = Array.isArray(layouthint)
|
|
30
|
+
? new LayoutHintCollection(layouthint)
|
|
31
|
+
: layouthint;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
/**
|
|
@@ -133,7 +133,7 @@ export default class ErrorResponse {
|
|
|
133
133
|
* Return response error redirect text
|
|
134
134
|
*/
|
|
135
135
|
get redirectText(): RedirectTextObject {
|
|
136
|
-
return this.response
|
|
136
|
+
return this.response?.redirect?.text || null;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/**
|
|
@@ -162,7 +162,7 @@ export default class ErrorResponse {
|
|
|
162
162
|
*/
|
|
163
163
|
get redirectHref(): Href {
|
|
164
164
|
if (this.response.redirect?.href) {
|
|
165
|
-
return new Href(this.response.redirect
|
|
165
|
+
return new Href(this.response.redirect?.href);
|
|
166
166
|
}
|
|
167
167
|
return new Href();
|
|
168
168
|
}
|
|
@@ -171,13 +171,13 @@ export default class ErrorResponse {
|
|
|
171
171
|
* Return error response layouthint
|
|
172
172
|
*/
|
|
173
173
|
get layouthint(): LayoutHintCollection {
|
|
174
|
-
return new LayoutHintCollection(this.response
|
|
174
|
+
return new LayoutHintCollection(this.response?.layouthint);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
178
|
*/
|
|
179
179
|
get response(): Object {
|
|
180
|
-
return this.error
|
|
180
|
+
return this.error?.response?.error || {};
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/**
|
|
@@ -26,6 +26,7 @@ import type { AttributeType, ModularUIModel } from "../types";
|
|
|
26
26
|
import type { ModularUIResponse } from "../../modularui";
|
|
27
27
|
import type ErrorResponse from "../error/ErrorResponse";
|
|
28
28
|
import type LinkModel from "../links/LinkModel";
|
|
29
|
+
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
*/
|
|
@@ -513,10 +514,16 @@ class FormModel extends ResourceModel {
|
|
|
513
514
|
this.errorCollection.addServerError(
|
|
514
515
|
error.id,
|
|
515
516
|
error.message,
|
|
516
|
-
error.parameters
|
|
517
|
+
error.parameters,
|
|
518
|
+
error.layouthint
|
|
517
519
|
);
|
|
518
520
|
} else {
|
|
519
|
-
this.errorCollection.addServerError(
|
|
521
|
+
this.errorCollection.addServerError(
|
|
522
|
+
error.id,
|
|
523
|
+
error.message,
|
|
524
|
+
undefined,
|
|
525
|
+
error.layouthint
|
|
526
|
+
);
|
|
520
527
|
}
|
|
521
528
|
}
|
|
522
529
|
|
|
@@ -1019,7 +1026,8 @@ class FormModel extends ResourceModel {
|
|
|
1019
1026
|
this.errorCollection.addServerError(
|
|
1020
1027
|
error.id,
|
|
1021
1028
|
error.message,
|
|
1022
|
-
error.properties
|
|
1029
|
+
error.properties,
|
|
1030
|
+
new LayoutHintCollection(error.layouthint)
|
|
1023
1031
|
);
|
|
1024
1032
|
}
|
|
1025
1033
|
});
|
|
@@ -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
|
/**
|
package/src/models/types.js
CHANGED