@beinformed/ui 1.21.0 → 1.21.3
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 +21 -0
- package/esm/models/attributes/AttributeModel.js +2 -2
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +2 -1
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +2 -1
- 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 +46 -32
- 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/types.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +2 -2
- package/lib/models/attributes/AttributeModel.js.flow +2 -0
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +2 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +2 -2
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +2 -1
- 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 +6 -3
- package/lib/models/error/ErrorCollection.js.map +1 -1
- package/lib/models/error/ErrorModel.js +2 -1
- package/lib/models/error/ErrorModel.js.flow +6 -3
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +46 -32
- package/lib/models/error/ErrorResponse.js.flow +31 -24
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/form/FormModel.js +5 -3
- package/lib/models/form/FormModel.js.flow +8 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +1 -1
- package/lib/models/form/FormObjectModel.js.flow +1 -0
- package/lib/models/form/FormObjectModel.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 +2 -0
- package/src/models/attributes/ChoiceAttributeModel.js +2 -2
- package/src/models/attributes/DatetimeAttributeModel.js +2 -2
- package/src/models/error/ErrorCollection.js +6 -3
- package/src/models/error/ErrorModel.js +6 -3
- package/src/models/error/ErrorResponse.js +31 -24
- package/src/models/form/FormModel.js +8 -1
- package/src/models/form/FormObjectModel.js +1 -0
- package/src/models/types.js +1 -1
|
@@ -710,6 +710,7 @@ export default class AttributeModel
|
|
|
710
710
|
addServerError(error: FormErrorAnchor) {
|
|
711
711
|
this._errorCollection.addServerError(
|
|
712
712
|
error.id,
|
|
713
|
+
error.layouthint,
|
|
713
714
|
error.message,
|
|
714
715
|
error.properties
|
|
715
716
|
);
|
|
@@ -812,6 +813,7 @@ export default class AttributeModel
|
|
|
812
813
|
if (this.hasValue()) {
|
|
813
814
|
this._errorCollection.addServerError(
|
|
814
815
|
error.id,
|
|
816
|
+
error.layouthint,
|
|
815
817
|
error.message,
|
|
816
818
|
this.formatParameters(error.properties)
|
|
817
819
|
);
|
|
@@ -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, layouthint, message, properties } = 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, layouthint, message, properties);
|
|
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, layouthint, message, properties } = 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, layouthint, message, properties);
|
|
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
|
|
@@ -42,6 +43,7 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
42
43
|
*/
|
|
43
44
|
addError(
|
|
44
45
|
id: string,
|
|
46
|
+
layouthint?: LayoutHintCollection,
|
|
45
47
|
defaultMessage?: string,
|
|
46
48
|
parameters?: MessageParameters
|
|
47
49
|
) {
|
|
@@ -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
|
/**
|
|
@@ -66,13 +68,14 @@ export default class ErrorCollection extends BaseCollection<ErrorModel> {
|
|
|
66
68
|
*/
|
|
67
69
|
addServerError(
|
|
68
70
|
id: string,
|
|
71
|
+
layouthint?: LayoutHintCollection,
|
|
69
72
|
defaultMessage?: string,
|
|
70
73
|
parameters?: MessageParameters
|
|
71
74
|
) {
|
|
72
75
|
if (parameters) {
|
|
73
|
-
this.addError(id, defaultMessage, parameters);
|
|
76
|
+
this.addError(id, layouthint, defaultMessage, parameters);
|
|
74
77
|
} else {
|
|
75
|
-
this.addError(id, defaultMessage);
|
|
78
|
+
this.addError(id, layouthint, defaultMessage);
|
|
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
|
/**
|
|
@@ -55,7 +58,7 @@ class ErrorModel {
|
|
|
55
58
|
|
|
56
59
|
/**
|
|
57
60
|
*/
|
|
58
|
-
get layouthint():
|
|
61
|
+
get layouthint(): LayoutHintCollection {
|
|
59
62
|
return this._layouthint;
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -89,88 +89,95 @@ export default class ErrorResponse {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* Return response error message
|
|
93
|
+
*/
|
|
94
|
+
get responseMessage(): string {
|
|
95
|
+
return this.response.message || this.id;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Return response error title
|
|
93
100
|
*/
|
|
94
101
|
get title(): TitleObject {
|
|
95
|
-
return this.
|
|
102
|
+
return this.response.title || null;
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
/**
|
|
99
|
-
* Return error title message
|
|
106
|
+
* Return response error title message
|
|
100
107
|
*/
|
|
101
108
|
get titleMessage(): string {
|
|
102
|
-
return this.
|
|
109
|
+
return this.response.title?.message || undefined;
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
/**
|
|
106
|
-
* Return error title Id
|
|
113
|
+
* Return response error title Id
|
|
107
114
|
*/
|
|
108
115
|
get titleId(): string {
|
|
109
|
-
return this.
|
|
116
|
+
return this.response.title?.id || undefined;
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
/**
|
|
113
|
-
* Return error title properties
|
|
120
|
+
* Return response error title properties
|
|
114
121
|
*/
|
|
115
122
|
get titleProperties(): Object {
|
|
116
|
-
return this.
|
|
123
|
+
return this.response.title?.properties || null;
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
/**
|
|
120
|
-
* Return error redirect
|
|
127
|
+
* Return response error redirect
|
|
121
128
|
*/
|
|
122
129
|
get redirect(): RedirectObject {
|
|
123
|
-
return this.
|
|
130
|
+
return this.response.redirect || null;
|
|
124
131
|
}
|
|
125
132
|
/**
|
|
126
|
-
* Return error redirect text
|
|
133
|
+
* Return response error redirect text
|
|
127
134
|
*/
|
|
128
135
|
get redirectText(): RedirectTextObject {
|
|
129
|
-
return this.
|
|
136
|
+
return this.response?.redirect?.text || null;
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
/**
|
|
133
|
-
* Return error redirect text id
|
|
140
|
+
* Return response error redirect text id
|
|
134
141
|
*/
|
|
135
142
|
get redirectTextID(): string {
|
|
136
|
-
return this.
|
|
143
|
+
return this.response.redirect?.text?.id || undefined;
|
|
137
144
|
}
|
|
138
145
|
|
|
139
146
|
/**
|
|
140
|
-
* Return error redirect text properties
|
|
147
|
+
* Return response error redirect text properties
|
|
141
148
|
*/
|
|
142
149
|
get redirectTextProperties(): Object {
|
|
143
|
-
return this.
|
|
150
|
+
return this.response.redirect?.text?.properties || null;
|
|
144
151
|
}
|
|
145
152
|
|
|
146
153
|
/**
|
|
147
|
-
* Return error redirect text message
|
|
154
|
+
* Return response error redirect text message
|
|
148
155
|
*/
|
|
149
156
|
get redirectMessage(): string {
|
|
150
|
-
return this.
|
|
157
|
+
return this.response.redirect?.text?.message || undefined;
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
/**
|
|
154
|
-
* Return error redirect href
|
|
161
|
+
* Return response error redirect href
|
|
155
162
|
*/
|
|
156
163
|
get redirectHref(): Href {
|
|
157
|
-
if (this.
|
|
158
|
-
return new Href(this.
|
|
164
|
+
if (this.response.redirect?.href) {
|
|
165
|
+
return new Href(this.response.redirect?.href);
|
|
159
166
|
}
|
|
160
167
|
return new Href();
|
|
161
168
|
}
|
|
162
169
|
|
|
163
170
|
/**
|
|
164
|
-
* Return error layouthint
|
|
171
|
+
* Return error response layouthint
|
|
165
172
|
*/
|
|
166
173
|
get layouthint(): LayoutHintCollection {
|
|
167
|
-
return new LayoutHintCollection(this.
|
|
174
|
+
return new LayoutHintCollection(this.response?.layouthint);
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
/**
|
|
171
178
|
*/
|
|
172
179
|
get response(): Object {
|
|
173
|
-
return this.error
|
|
180
|
+
return this.error?.response?.error || {};
|
|
174
181
|
}
|
|
175
182
|
|
|
176
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
|
*/
|
|
@@ -512,11 +513,16 @@ class FormModel extends ResourceModel {
|
|
|
512
513
|
if (error.parameters) {
|
|
513
514
|
this.errorCollection.addServerError(
|
|
514
515
|
error.id,
|
|
516
|
+
error.layouthint,
|
|
515
517
|
error.message,
|
|
516
518
|
error.parameters
|
|
517
519
|
);
|
|
518
520
|
} else {
|
|
519
|
-
this.errorCollection.addServerError(
|
|
521
|
+
this.errorCollection.addServerError(
|
|
522
|
+
error.id,
|
|
523
|
+
error.layouthint,
|
|
524
|
+
error.message
|
|
525
|
+
);
|
|
520
526
|
}
|
|
521
527
|
}
|
|
522
528
|
|
|
@@ -1018,6 +1024,7 @@ class FormModel extends ResourceModel {
|
|
|
1018
1024
|
} else {
|
|
1019
1025
|
this.errorCollection.addServerError(
|
|
1020
1026
|
error.id,
|
|
1027
|
+
new LayoutHintCollection(error.layouthint),
|
|
1021
1028
|
error.message,
|
|
1022
1029
|
error.properties
|
|
1023
1030
|
);
|
package/src/models/types.js
CHANGED