@beinformed/ui 1.65.3 → 1.65.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/esm/hooks/__tests__/UseModularUIModel.spec.js.flow +3 -5
  3. package/esm/hooks/useList.js +7 -6
  4. package/esm/hooks/useList.js.flow +7 -6
  5. package/esm/hooks/useList.js.map +1 -1
  6. package/esm/models/concepts/ConceptIndexModel.js +3 -2
  7. package/esm/models/concepts/ConceptIndexModel.js.flow +5 -4
  8. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  9. package/esm/models/content/ContentIndexModel.js +7 -1
  10. package/esm/models/content/ContentIndexModel.js.flow +8 -3
  11. package/esm/models/content/ContentIndexModel.js.map +1 -1
  12. package/esm/models/content/ContentModel.js +3 -2
  13. package/esm/models/content/ContentModel.js.flow +4 -3
  14. package/esm/models/content/ContentModel.js.map +1 -1
  15. package/esm/models/content/ContentTOCModel.js +6 -2
  16. package/esm/models/content/ContentTOCModel.js.flow +6 -2
  17. package/esm/models/content/ContentTOCModel.js.map +1 -1
  18. package/esm/models/filters/AssignmentFilterModel.js +54 -26
  19. package/esm/models/filters/AssignmentFilterModel.js.flow +68 -37
  20. package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
  21. package/esm/models/filters/BaseFilterModel.js +0 -110
  22. package/esm/models/filters/BaseFilterModel.js.flow +2 -133
  23. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  24. package/esm/models/filters/ConceptIndexFilterModel.js +2 -2
  25. package/esm/models/filters/ConceptIndexFilterModel.js.flow +2 -2
  26. package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
  27. package/esm/models/filters/FilterModel.js +117 -2
  28. package/esm/models/filters/FilterModel.js.flow +146 -1
  29. package/esm/models/filters/FilterModel.js.map +1 -1
  30. package/esm/models/filters/RangeFilterModel.js +2 -2
  31. package/esm/models/filters/RangeFilterModel.js.flow +2 -2
  32. package/esm/models/filters/RangeFilterModel.js.map +1 -1
  33. package/esm/models/types.js.flow +1 -3
  34. package/esm/models/types.js.map +1 -1
  35. package/lib/hooks/useList.js +7 -6
  36. package/lib/hooks/useList.js.map +1 -1
  37. package/lib/models/concepts/ConceptIndexModel.js +3 -2
  38. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  39. package/lib/models/content/ContentIndexModel.js +6 -1
  40. package/lib/models/content/ContentIndexModel.js.map +1 -1
  41. package/lib/models/content/ContentModel.js +3 -2
  42. package/lib/models/content/ContentModel.js.map +1 -1
  43. package/lib/models/content/ContentTOCModel.js +6 -2
  44. package/lib/models/content/ContentTOCModel.js.map +1 -1
  45. package/lib/models/filters/AssignmentFilterModel.js +54 -26
  46. package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
  47. package/lib/models/filters/BaseFilterModel.js +0 -109
  48. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  49. package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
  50. package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
  51. package/lib/models/filters/FilterModel.js +117 -1
  52. package/lib/models/filters/FilterModel.js.map +1 -1
  53. package/lib/models/filters/RangeFilterModel.js +2 -2
  54. package/lib/models/filters/RangeFilterModel.js.map +1 -1
  55. package/lib/models/types.js.map +1 -1
  56. package/package.json +1 -1
  57. package/src/hooks/__tests__/UseModularUIModel.spec.js +3 -5
  58. package/src/hooks/useList.js +7 -6
  59. package/src/models/concepts/ConceptIndexModel.js +5 -4
  60. package/src/models/content/ContentIndexModel.js +8 -3
  61. package/src/models/content/ContentModel.js +4 -3
  62. package/src/models/content/ContentTOCModel.js +6 -2
  63. package/src/models/filters/AssignmentFilterModel.js +68 -37
  64. package/src/models/filters/BaseFilterModel.js +2 -133
  65. package/src/models/filters/ConceptIndexFilterModel.js +2 -2
  66. package/src/models/filters/FilterModel.js +146 -1
  67. package/src/models/filters/RangeFilterModel.js +2 -2
  68. package/src/models/types.js +1 -3
@@ -1,19 +1,17 @@
1
1
  // @flow
2
2
  import BaseModel from "../base/BaseModel";
3
- import createAttribute from "../attributes/_createAttribute";
3
+
4
4
  import {
5
5
  PARAMETER_SEPARATOR,
6
6
  PARAMETER_TYPES,
7
7
  } from "../../constants/Constants";
8
8
 
9
- import type { AttributeType, FilterType, ModelOptions } from "../types";
10
- import { IllegalStateException } from "../../exceptions";
9
+ import type { ModelOptions } from "../types";
11
10
 
12
11
  /**
13
12
  * Base class for filters
14
13
  */
15
14
  export default class BaseFilterModel extends BaseModel {
16
- _attribute: AttributeType | null = null;
17
15
  _context: Object;
18
16
  _listKey: string;
19
17
 
@@ -26,13 +24,6 @@ export default class BaseFilterModel extends BaseModel {
26
24
  ) {
27
25
  super(data, contributions, modelOptions);
28
26
 
29
- this._attribute = this.createAttribute(
30
- this.type,
31
- this.param,
32
- this.data,
33
- this.contributions,
34
- );
35
-
36
27
  if (this.contributions.listKey) {
37
28
  this.listkey = this.contributions.listKey;
38
29
  }
@@ -60,30 +51,6 @@ export default class BaseFilterModel extends BaseModel {
60
51
  }
61
52
  }
62
53
 
63
- /**
64
- * Create attribute through the attribute factory. Create type based on filter key without the filter suffix
65
- */
66
- createAttribute(
67
- type: string,
68
- param: string,
69
- data: Object,
70
- contributions: Object,
71
- ): AttributeType | null {
72
- if (type === "assignment") {
73
- return null;
74
- }
75
-
76
- return createAttribute(
77
- param,
78
- data,
79
- {
80
- ...contributions,
81
- type: type,
82
- },
83
- this.modelOptions,
84
- );
85
- }
86
-
87
54
  /**
88
55
  * Inidiates if filter is multiplechoice
89
56
  */
@@ -151,75 +118,6 @@ export default class BaseFilterModel extends BaseModel {
151
118
  return this.data.param ?? this.data.name;
152
119
  }
153
120
 
154
- /**
155
- * Get attribute of filter
156
- */
157
- get attribute(): AttributeType {
158
- if (!this._attribute) {
159
- throw new IllegalStateException(
160
- `Missing filter attribute on filter model: ${this.label}`,
161
- );
162
- }
163
- return this._attribute;
164
- }
165
-
166
- /**
167
- * Retrieve the parameters with it's value for this filter
168
- */
169
- get params(): Array<{ name: string, value: ?string }> {
170
- if (!this.param) {
171
- return [];
172
- }
173
-
174
- return [
175
- {
176
- name: this.param,
177
- value: this.attribute?.value,
178
- },
179
- ];
180
- }
181
-
182
- /**
183
- * Getting the value of the filter
184
- */
185
- get value(): string | null {
186
- return this.attribute?.value;
187
- }
188
-
189
- /**
190
- * Getting the inputvalue of the filter
191
- */
192
- get inputvalue(): string {
193
- return this.attribute?.inputvalue;
194
- }
195
-
196
- /**
197
- * Indicates if the filter has a value.
198
- */
199
- hasValue(): boolean {
200
- return this.value !== null && this.value !== "";
201
- }
202
-
203
- /**
204
- * Reset the value of this filter to undefined
205
- */
206
- reset(): FilterType {
207
- if (this.attribute) {
208
- this.attribute.reset();
209
- }
210
-
211
- return this;
212
- }
213
-
214
- /**
215
- * Update this filter with input name and value
216
- */
217
- update(attribute: AttributeType, value: string) {
218
- if (this.attribute) {
219
- this.attribute.update(value);
220
- }
221
- }
222
-
223
121
  /**
224
122
  * Inidicates if filter is a quick search filter
225
123
  */
@@ -227,39 +125,10 @@ export default class BaseFilterModel extends BaseModel {
227
125
  return this.contributions.quicksearch === true;
228
126
  }
229
127
 
230
- /**
231
- * Inidiates if filter is active
232
- */
233
- isActive(): boolean {
234
- return this.attribute !== null && this.attribute.initvalue !== null;
235
- }
236
-
237
- /**
238
- * Inidiates if filter is valid
239
- */
240
- get isValid(): boolean {
241
- return this.attribute !== null && this.attribute.isValid;
242
- }
243
-
244
- /**
245
- */
246
- get readonlyvalue(): string {
247
- if (this.attribute) {
248
- return this.attribute.readonlyvalue;
249
- }
250
- return "";
251
- }
252
-
253
128
  /**
254
129
  * Get assistant message
255
130
  */
256
131
  get assistantMessage(): string | null {
257
132
  return this.getContribution("assistant");
258
133
  }
259
-
260
- /**
261
- */
262
- get formdata(): { [string]: any } | null {
263
- return this.attribute.formdata ?? null;
264
- }
265
134
  }
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import BaseFilterModel from "../filters/BaseFilterModel";
2
+ import FilterModel from "../filters/FilterModel";
3
3
  import ChoiceAttributeModel from "../attributes/ChoiceAttributeModel";
4
4
 
5
5
  import type { ModelOptions } from "../types";
@@ -7,7 +7,7 @@ import type { ModelOptions } from "../types";
7
7
  /**
8
8
  * The concept index model is a special filter used to index all first concept label letters in de modelcatalog.
9
9
  */
10
- export default class ConceptIndexFilterModel extends BaseFilterModel {
10
+ export default class ConceptIndexFilterModel extends FilterModel {
11
11
  /**
12
12
  * Construct a filter
13
13
  */
@@ -1,6 +1,151 @@
1
1
  // @flow
2
2
  import BaseFilterModel from "../filters/BaseFilterModel";
3
+ import createAttribute from "../attributes/_createAttribute";
4
+ import { IllegalStateException } from "../../exceptions";
5
+
6
+ import type { AttributeType, FilterType, ModelOptions } from "../types";
3
7
 
4
8
  /**
5
9
  */
6
- export default class FilterModel extends BaseFilterModel {}
10
+ export default class FilterModel extends BaseFilterModel {
11
+ _attribute: AttributeType | null = null;
12
+
13
+ /**
14
+ */
15
+ constructor(
16
+ data: Object,
17
+ contributions: Object,
18
+ modelOptions?: ModelOptions,
19
+ ) {
20
+ super(data, contributions, modelOptions);
21
+
22
+ this._attribute = this.createAttribute(
23
+ this.type,
24
+ this.param,
25
+ this.data,
26
+ this.contributions,
27
+ );
28
+ }
29
+
30
+ /**
31
+ * Create attribute through the attribute factory. Create type based on filter key without the filter suffix
32
+ */
33
+ createAttribute(
34
+ type: string,
35
+ param: string,
36
+ data: Object,
37
+ contributions: Object,
38
+ ): AttributeType | null {
39
+ if (type === "assignment") {
40
+ return null;
41
+ }
42
+
43
+ return createAttribute(
44
+ param,
45
+ data,
46
+ {
47
+ ...contributions,
48
+ type: type,
49
+ },
50
+ this.modelOptions,
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Get attribute of filter
56
+ */
57
+ get attribute(): AttributeType {
58
+ if (!this._attribute) {
59
+ throw new IllegalStateException(
60
+ `Missing filter attribute on filter model: ${this.label}`,
61
+ );
62
+ }
63
+ return this._attribute;
64
+ }
65
+
66
+ /**
67
+ * Retrieve the parameters with it's value for this filter
68
+ */
69
+ get params(): Array<{ name: string, value: ?string }> {
70
+ if (!this.param) {
71
+ return [];
72
+ }
73
+
74
+ return [
75
+ {
76
+ name: this.param,
77
+ value: this.attribute?.value,
78
+ },
79
+ ];
80
+ }
81
+
82
+ /**
83
+ * Getting the value of the filter
84
+ */
85
+ get value(): string | null {
86
+ return this.attribute?.value;
87
+ }
88
+
89
+ /**
90
+ * Getting the inputvalue of the filter
91
+ */
92
+ get inputvalue(): string {
93
+ return this.attribute?.inputvalue;
94
+ }
95
+
96
+ /**
97
+ * Indicates if the filter has a value.
98
+ */
99
+ hasValue(): boolean {
100
+ return this.value !== null && this.value !== "";
101
+ }
102
+
103
+ /**
104
+ * Reset the value of this filter to undefined
105
+ */
106
+ reset(): FilterType {
107
+ if (this.attribute) {
108
+ this.attribute.reset();
109
+ }
110
+
111
+ return this;
112
+ }
113
+
114
+ /**
115
+ * Update this filter with input name and value
116
+ */
117
+ update(attribute: AttributeType, value: string) {
118
+ if (this.attribute) {
119
+ this.attribute.update(value);
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Inidiates if filter is active
125
+ */
126
+ isActive(): boolean {
127
+ return this.attribute?.initvalue !== null;
128
+ }
129
+
130
+ /**
131
+ * Inidiates if filter is valid
132
+ */
133
+ get isValid(): boolean {
134
+ return this.attribute?.isValid || true;
135
+ }
136
+
137
+ /**
138
+ */
139
+ get readonlyvalue(): string {
140
+ if (this.attribute) {
141
+ return this.attribute.readonlyvalue;
142
+ }
143
+ return "";
144
+ }
145
+
146
+ /**
147
+ */
148
+ get formdata(): { [string]: any } | null {
149
+ return this.attribute.formdata ?? null;
150
+ }
151
+ }
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import BaseFilterModel from "../filters/BaseFilterModel";
2
+ import FilterModel from "../filters/FilterModel";
3
3
 
4
4
  import CompositeAttributeModel from "../attributes/CompositeAttributeModel";
5
5
  import type { AttributeType } from "../types";
@@ -7,7 +7,7 @@ import type { AttributeType } from "../types";
7
7
  /**
8
8
  * Range filter, for instance a date range filter or a number range filter
9
9
  */
10
- export default class RangeFilterModel extends BaseFilterModel {
10
+ export default class RangeFilterModel extends FilterModel {
11
11
  /**
12
12
  */
13
13
  update(attribute: AttributeType, value: string) {
@@ -41,7 +41,6 @@ import type UserModel from "./user/UserModel";
41
41
  import type UserServicesModel from "./user/UserServicesModel";
42
42
  import type LinkModel from "./links/LinkModel";
43
43
  import type LookupOptionsModel from "./lookup/LookupOptionsModel";
44
- import type BaseFilterModel from "./filters/BaseFilterModel";
45
44
  import type AttributeCollection from "./attributes/AttributeCollection";
46
45
  import type AttributeModel from "./attributes/AttributeModel";
47
46
  import type LayoutHintCollection from "./layouthint/LayoutHintCollection";
@@ -92,9 +91,8 @@ export type RangeChildAttributeType =
92
91
  | DatetimeAttributeModel;
93
92
 
94
93
  export type FilterType =
95
- | BaseFilterModel
96
- | FilterModel
97
94
  | AssignmentFilterModel
95
+ | FilterModel
98
96
  | RangeFilterModel
99
97
  | ConceptIndexFilterModel;
100
98