@beinformed/ui 1.65.3 → 1.65.4
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 +13 -0
- package/esm/models/concepts/ConceptIndexModel.js +3 -2
- package/esm/models/concepts/ConceptIndexModel.js.flow +5 -4
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +7 -1
- package/esm/models/content/ContentIndexModel.js.flow +8 -3
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +3 -2
- package/esm/models/content/ContentModel.js.flow +4 -3
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +6 -2
- package/esm/models/content/ContentTOCModel.js.flow +6 -2
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/filters/AssignmentFilterModel.js +54 -26
- package/esm/models/filters/AssignmentFilterModel.js.flow +68 -37
- package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js +0 -110
- package/esm/models/filters/BaseFilterModel.js.flow +2 -133
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/ConceptIndexFilterModel.js +2 -2
- package/esm/models/filters/ConceptIndexFilterModel.js.flow +2 -2
- package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/esm/models/filters/FilterModel.js +117 -2
- package/esm/models/filters/FilterModel.js.flow +146 -1
- package/esm/models/filters/FilterModel.js.map +1 -1
- package/esm/models/filters/RangeFilterModel.js +2 -2
- package/esm/models/filters/RangeFilterModel.js.flow +2 -2
- package/esm/models/filters/RangeFilterModel.js.map +1 -1
- package/esm/models/types.js.flow +1 -3
- package/esm/models/types.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +3 -2
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +6 -1
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +3 -2
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +6 -2
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/filters/AssignmentFilterModel.js +54 -26
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js +0 -109
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
- package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/lib/models/filters/FilterModel.js +117 -1
- package/lib/models/filters/FilterModel.js.map +1 -1
- package/lib/models/filters/RangeFilterModel.js +2 -2
- package/lib/models/filters/RangeFilterModel.js.map +1 -1
- package/lib/models/types.js.map +1 -1
- package/package.json +1 -1
- package/src/models/concepts/ConceptIndexModel.js +5 -4
- package/src/models/content/ContentIndexModel.js +8 -3
- package/src/models/content/ContentModel.js +4 -3
- package/src/models/content/ContentTOCModel.js +6 -2
- package/src/models/filters/AssignmentFilterModel.js +68 -37
- package/src/models/filters/BaseFilterModel.js +2 -133
- package/src/models/filters/ConceptIndexFilterModel.js +2 -2
- package/src/models/filters/FilterModel.js +146 -1
- package/src/models/filters/RangeFilterModel.js +2 -2
- package/src/models/types.js +1 -3
|
@@ -1,6 +1,121 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
1
2
|
import BaseFilterModel from "../filters/BaseFilterModel";
|
|
2
|
-
|
|
3
|
+
import createAttribute from "../attributes/_createAttribute";
|
|
4
|
+
import { IllegalStateException } from "../../exceptions";
|
|
3
5
|
/**
|
|
4
6
|
*/
|
|
5
|
-
export default class FilterModel extends BaseFilterModel {
|
|
7
|
+
export default class FilterModel extends BaseFilterModel {
|
|
8
|
+
/**
|
|
9
|
+
*/
|
|
10
|
+
constructor(data, contributions, modelOptions) {
|
|
11
|
+
super(data, contributions, modelOptions);
|
|
12
|
+
_defineProperty(this, "_attribute", null);
|
|
13
|
+
this._attribute = this.createAttribute(this.type, this.param, this.data, this.contributions);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create attribute through the attribute factory. Create type based on filter key without the filter suffix
|
|
18
|
+
*/
|
|
19
|
+
createAttribute(type, param, data, contributions) {
|
|
20
|
+
if (type === "assignment") {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return createAttribute(param, data, {
|
|
24
|
+
...contributions,
|
|
25
|
+
type: type
|
|
26
|
+
}, this.modelOptions);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get attribute of filter
|
|
31
|
+
*/
|
|
32
|
+
get attribute() {
|
|
33
|
+
if (!this._attribute) {
|
|
34
|
+
throw new IllegalStateException(`Missing filter attribute on filter model: ${this.label}`);
|
|
35
|
+
}
|
|
36
|
+
return this._attribute;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Retrieve the parameters with it's value for this filter
|
|
41
|
+
*/
|
|
42
|
+
get params() {
|
|
43
|
+
if (!this.param) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return [{
|
|
47
|
+
name: this.param,
|
|
48
|
+
value: this.attribute?.value
|
|
49
|
+
}];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Getting the value of the filter
|
|
54
|
+
*/
|
|
55
|
+
get value() {
|
|
56
|
+
return this.attribute?.value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Getting the inputvalue of the filter
|
|
61
|
+
*/
|
|
62
|
+
get inputvalue() {
|
|
63
|
+
return this.attribute?.inputvalue;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Indicates if the filter has a value.
|
|
68
|
+
*/
|
|
69
|
+
hasValue() {
|
|
70
|
+
return this.value !== null && this.value !== "";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Reset the value of this filter to undefined
|
|
75
|
+
*/
|
|
76
|
+
reset() {
|
|
77
|
+
if (this.attribute) {
|
|
78
|
+
this.attribute.reset();
|
|
79
|
+
}
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Update this filter with input name and value
|
|
85
|
+
*/
|
|
86
|
+
update(attribute, value) {
|
|
87
|
+
if (this.attribute) {
|
|
88
|
+
this.attribute.update(value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Inidiates if filter is active
|
|
94
|
+
*/
|
|
95
|
+
isActive() {
|
|
96
|
+
return this.attribute?.initvalue !== null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Inidiates if filter is valid
|
|
101
|
+
*/
|
|
102
|
+
get isValid() {
|
|
103
|
+
return this.attribute?.isValid || true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
*/
|
|
108
|
+
get readonlyvalue() {
|
|
109
|
+
if (this.attribute) {
|
|
110
|
+
return this.attribute.readonlyvalue;
|
|
111
|
+
}
|
|
112
|
+
return "";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
*/
|
|
117
|
+
get formdata() {
|
|
118
|
+
return this.attribute.formdata ?? null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
6
121
|
//# sourceMappingURL=FilterModel.js.map
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterModel.js","names":["BaseFilterModel","FilterModel"],"sources":["../../../src/models/filters/FilterModel.js"],"sourcesContent":["// @flow\nimport BaseFilterModel from \"../filters/BaseFilterModel\";\n\n/**\n */\nexport default class FilterModel extends BaseFilterModel {}\n"],"mappings":"AACA,OAAOA,eAAe,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"FilterModel.js","names":["BaseFilterModel","createAttribute","IllegalStateException","FilterModel","constructor","data","contributions","modelOptions","_defineProperty","_attribute","type","param","attribute","label","params","name","value","inputvalue","hasValue","reset","update","isActive","initvalue","isValid","readonlyvalue","formdata"],"sources":["../../../src/models/filters/FilterModel.js"],"sourcesContent":["// @flow\nimport BaseFilterModel from \"../filters/BaseFilterModel\";\nimport createAttribute from \"../attributes/_createAttribute\";\nimport { IllegalStateException } from \"../../exceptions\";\n\nimport type { AttributeType, FilterType, ModelOptions } from \"../types\";\n\n/**\n */\nexport default class FilterModel extends BaseFilterModel {\n _attribute: AttributeType | null = null;\n\n /**\n */\n constructor(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(data, contributions, modelOptions);\n\n this._attribute = this.createAttribute(\n this.type,\n this.param,\n this.data,\n this.contributions,\n );\n }\n\n /**\n * Create attribute through the attribute factory. Create type based on filter key without the filter suffix\n */\n createAttribute(\n type: string,\n param: string,\n data: Object,\n contributions: Object,\n ): AttributeType | null {\n if (type === \"assignment\") {\n return null;\n }\n\n return createAttribute(\n param,\n data,\n {\n ...contributions,\n type: type,\n },\n this.modelOptions,\n );\n }\n\n /**\n * Get attribute of filter\n */\n get attribute(): AttributeType {\n if (!this._attribute) {\n throw new IllegalStateException(\n `Missing filter attribute on filter model: ${this.label}`,\n );\n }\n return this._attribute;\n }\n\n /**\n * Retrieve the parameters with it's value for this filter\n */\n get params(): Array<{ name: string, value: ?string }> {\n if (!this.param) {\n return [];\n }\n\n return [\n {\n name: this.param,\n value: this.attribute?.value,\n },\n ];\n }\n\n /**\n * Getting the value of the filter\n */\n get value(): string | null {\n return this.attribute?.value;\n }\n\n /**\n * Getting the inputvalue of the filter\n */\n get inputvalue(): string {\n return this.attribute?.inputvalue;\n }\n\n /**\n * Indicates if the filter has a value.\n */\n hasValue(): boolean {\n return this.value !== null && this.value !== \"\";\n }\n\n /**\n * Reset the value of this filter to undefined\n */\n reset(): FilterType {\n if (this.attribute) {\n this.attribute.reset();\n }\n\n return this;\n }\n\n /**\n * Update this filter with input name and value\n */\n update(attribute: AttributeType, value: string) {\n if (this.attribute) {\n this.attribute.update(value);\n }\n }\n\n /**\n * Inidiates if filter is active\n */\n isActive(): boolean {\n return this.attribute?.initvalue !== null;\n }\n\n /**\n * Inidiates if filter is valid\n */\n get isValid(): boolean {\n return this.attribute?.isValid || true;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.attribute) {\n return this.attribute.readonlyvalue;\n }\n return \"\";\n }\n\n /**\n */\n get formdata(): { [string]: any } | null {\n return this.attribute.formdata ?? null;\n }\n}\n"],"mappings":";AACA,OAAOA,eAAe,MAAM,4BAA4B;AACxD,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,SAASC,qBAAqB,QAAQ,kBAAkB;AAIxD;AACA;AACA,eAAe,MAAMC,WAAW,SAASH,eAAe,CAAC;EAGvD;AACF;EACEI,WAAWA,CACTC,IAAY,EACZC,aAAqB,EACrBC,YAA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K,IAAI,IAAI,IAAI,CAACA,KAAK,KAAK,EAAE;EACjD;;EAEA;AACF;AACA;EACEG,KAAKA,CAAA,EAAe;IAClB,IAAI,IAAI,CAACP,SAAS,EAAE;MAClB,IAAI,CAACA,SAAS,CAACO,KAAK,CAAC,CAAC;IACxB;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACEC,MAAMA,CAACR,SAAwB,EAAEI,KAAa,EAAE;IAC9C,IAAI,IAAI,CAACJ,SAAS,EAAE;MAClB,IAAI,CAACA,SAAS,CAACQ,MAAM,CAACJ,KAAK,CAAC;IAC9B;EACF;;EAEA;AACF;AACA;EACEK,QAAQA,CAAA,EAAY;IAClB,OAAO,IAAI,CAACT,SAAS,EAAEU,SAAS,KAAK,IAAI;EAC3C;;EAEA;AACF;AACA;EACE,IAAIC,OAAOA,CAAA,EAAY;IACrB,OAAO,IAAI,CAACX,SAAS,EAAEW,OAAO,IAAI,IAAI;EACxC;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,IAAI,IAAI,CAACZ,SAAS,EAAE;MAClB,OAAO,IAAI,CAACA,SAAS,CAACY,aAAa;IACrC;IACA,OAAO,EAAE;EACX;;EAEA;AACF;EACE,IAAIC,QAAQA,CAAA,EAA6B;IACvC,OAAO,IAAI,CAACb,SAAS,CAACa,QAAQ,IAAI,IAAI;EACxC;AACF","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
2
|
-
import
|
|
2
|
+
import FilterModel from "../filters/FilterModel";
|
|
3
3
|
import CompositeAttributeModel from "../attributes/CompositeAttributeModel";
|
|
4
4
|
/**
|
|
5
5
|
* Range filter, for instance a date range filter or a number range filter
|
|
6
6
|
*/
|
|
7
|
-
export default class RangeFilterModel extends
|
|
7
|
+
export default class RangeFilterModel extends FilterModel {
|
|
8
8
|
/**
|
|
9
9
|
*/
|
|
10
10
|
update(attribute, value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import
|
|
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
|
|
10
|
+
export default class RangeFilterModel extends FilterModel {
|
|
11
11
|
/**
|
|
12
12
|
*/
|
|
13
13
|
update(attribute: AttributeType, value: string) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeFilterModel.js","names":["
|
|
1
|
+
{"version":3,"file":"RangeFilterModel.js","names":["FilterModel","CompositeAttributeModel","RangeFilterModel","update","attribute","value","params","_context","_mapInstanceProperty","children","call","child","param","data","name"],"sources":["../../../src/models/filters/RangeFilterModel.js"],"sourcesContent":["// @flow\nimport FilterModel from \"../filters/FilterModel\";\n\nimport CompositeAttributeModel from \"../attributes/CompositeAttributeModel\";\nimport type { AttributeType } from \"../types\";\n\n/**\n * Range filter, for instance a date range filter or a number range filter\n */\nexport default class RangeFilterModel extends FilterModel {\n /**\n */\n update(attribute: AttributeType, value: string) {\n if (this.attribute instanceof CompositeAttributeModel) {\n this.attribute.update(value, attribute);\n } else if (this.attribute !== null) {\n this.attribute.update(value);\n }\n }\n\n /**\n */\n get params(): Array<{ name: string, value: ?string }> {\n if (this.attribute instanceof CompositeAttributeModel) {\n return this.attribute.children.map((child) => {\n const { param } = this.data[child.name];\n return {\n name: param,\n value: child.value,\n };\n });\n }\n\n return [];\n }\n}\n"],"mappings":";AACA,OAAOA,WAAW,MAAM,wBAAwB;AAEhD,OAAOC,uBAAuB,MAAM,uCAAuC;AAG3E;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,WAAW,CAAC;EACxD;AACF;EACEG,MAAMA,CAACC,SAAwB,EAAEC,KAAa,EAAE;IAC9C,IAAI,IAAI,CAACD,SAAS,YAAYH,uBAAuB,EAAE;MACrD,IAAI,CAACG,SAAS,CAACD,MAAM,CAACE,KAAK,EAAED,SAAS,CAAC;IACzC,CAAC,MAAM,IAAI,IAAI,CAACA,SAAS,KAAK,IAAI,EAAE;MAClC,IAAI,CAACA,SAAS,CAACD,MAAM,CAACE,KAAK,CAAC;IAC9B;EACF;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAA4C;IACpD,IAAI,IAAI,CAACF,SAAS,YAAYH,uBAAuB,EAAE;MAAA,IAAAM,QAAA;MACrD,OAAOC,oBAAA,CAAAD,QAAA,OAAI,CAACH,SAAS,CAACK,QAAQ,EAAAC,IAAA,CAAAH,QAAA,EAAMI,KAAK,IAAK;QAC5C,MAAM;UAAEC;QAAM,CAAC,GAAG,IAAI,CAACC,IAAI,CAACF,KAAK,CAACG,IAAI,CAAC;QACvC,OAAO;UACLA,IAAI,EAAEF,KAAK;UACXP,KAAK,EAAEM,KAAK,CAACN;QACf,CAAC;MACH,CAAC,CAAC;IACJ;IAEA,OAAO,EAAE;EACX;AACF","ignoreList":[]}
|
package/esm/models/types.js.flow
CHANGED
|
@@ -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
|
|
package/esm/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
|
|
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 AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\nimport type ErrorResponse from \"./error/ErrorResponse\";\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 | AssignmentFilterModel\n | FilterModel\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(\n models: Array<ModularUIModel>,\n errors: Array<ErrorResponse>,\n ): 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 sections?: 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\nexport type SectionFragment = {\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -112,8 +112,9 @@ class ConceptIndexModel extends _ResourceModel.default {
|
|
|
112
112
|
*/
|
|
113
113
|
get entryDate() {
|
|
114
114
|
const timeversionFilter = this.filterCollection.getFilterByAttributeKey(_Constants.TIMEVERSION_FILTER_NAME);
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const date = timeversionFilter?.value;
|
|
116
|
+
if (typeof date === "string") {
|
|
117
|
+
return date;
|
|
117
118
|
}
|
|
118
119
|
return null;
|
|
119
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptIndexModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ResourceCollection","_FilterCollection","_ConceptLinkModel","_Constants","ConceptIndexModel","ResourceModel","constructor","modularuiResponse","_context","_defineProperty2","default","_filterCollection","FilterCollection","_filter","data","filter","contributions","dynamicschema","modelOptions","_concepts","ResourceCollection","collection","_embedded","_map","results","call","concept","ConceptLinkModel","entryDate","type","resourcetype","modelName","isApplicableModel","resourceType","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","hasItems","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","timeversionFilter","TIMEVERSION_FILTER_NAME","
|
|
1
|
+
{"version":3,"file":"ConceptIndexModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ResourceCollection","_FilterCollection","_ConceptLinkModel","_Constants","ConceptIndexModel","ResourceModel","constructor","modularuiResponse","_context","_defineProperty2","default","_filterCollection","FilterCollection","_filter","data","filter","contributions","dynamicschema","modelOptions","_concepts","ResourceCollection","collection","_embedded","_map","results","call","concept","ConceptLinkModel","entryDate","type","resourcetype","modelName","isApplicableModel","resourceType","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","hasItems","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","timeversionFilter","TIMEVERSION_FILTER_NAME","date","searchtermfilter","modelCategoryFilter","itemCollection","exports"],"sources":["../../../src/models/concepts/ConceptIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ConceptLinkModel from \"./ConceptLinkModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { FilterType, ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type Href from \"../href/Href\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Get Index of concepts, to filter model catalog\n */\nexport default class ConceptIndexModel extends ResourceModel {\n _filterCollection: FilterCollection;\n _concepts: ResourceCollection<ConceptLinkModel>;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter,\n dynamicschema: this.data.dynamicschema,\n },\n this.modelOptions,\n );\n\n this._concepts = new ResourceCollection();\n this._concepts.collection = this.data._embedded\n ? this.data._embedded.results.map(\n (concept) =>\n new ConceptLinkModel(\n concept.concept,\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get type(): string {\n if (this.resourcetype === \"RelatedConcepts\") {\n return \"RelatedConcepts\";\n }\n\n return \"ConceptIndex\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptIndexModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype;\n return (\n resourceType === \"ConceptSearch\" ||\n resourceType === \"relatedConcepts\" ||\n resourceType === \"RelatedConcepts\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.items.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this.items.setChildModels(models, errors);\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.filterCollection.hasItems) {\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n }\n\n return href;\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\");\n }\n\n /**\n * Retrieve filters of conceptindex model\n */\n get filterCollection(): FilterCollection {\n return this._filterCollection;\n }\n\n /**\n * Get index filter\n */\n get indexfilter(): FilterType | null {\n return this.filterCollection.getFilterByAttributeKey(\"index\");\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n const date = timeversionFilter?.value;\n if (typeof date === \"string\") {\n return date;\n }\n return null;\n }\n\n /**\n * get searchterm filter\n */\n get searchtermfilter(): FilterType | null {\n return this.filterCollection.getFilterByAttributeKey(\"label\");\n }\n\n /**\n * Get model category filter\n */\n get modelCategoryFilter(): FilterType | null {\n return this.filterCollection.getFilterByAttributeKey(\"modelCategory\");\n }\n\n /**\n * Get concept links found by index filter\n */\n get items(): ResourceCollection<ConceptLinkModel> {\n return this._concepts;\n }\n\n /**\n * Replace the items collection\n */\n set items(itemCollection: ResourceCollection<ConceptLinkModel>) {\n this._concepts = itemCollection;\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAQA;AACA;AACA;AACe,MAAMK,iBAAiB,SAASC,sBAAa,CAAC;EAI3D;AACF;EACE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F,iBAAiB,EAAER,KAAK;IACrC,IAAI,OAAOU,IAAI,KAAK,QAAQ,EAAE;MAC5B,OAAOA,IAAI;IACb;IACA,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIC,gBAAgBA,CAAA,EAAsB;IACxC,OAAO,IAAI,CAAChB,gBAAgB,CAACY,uBAAuB,CAAC,OAAO,CAAC;EAC/D;;EAEA;AACF;AACA;EACE,IAAIK,mBAAmBA,CAAA,EAAsB;IAC3C,OAAO,IAAI,CAACjB,gBAAgB,CAACY,uBAAuB,CAAC,eAAe,CAAC;EACvE;;EAEA;AACF;AACA;EACE,IAAInB,KAAKA,CAAA,EAAyC;IAChD,OAAO,IAAI,CAAChB,SAAS;EACvB;;EAEA;AACF;AACA;EACE,IAAIgB,KAAKA,CAACyB,cAAoD,EAAE;IAC9D,IAAI,CAACzC,SAAS,GAAGyC,cAAc;EACjC;AACF;AAACC,OAAA,CAAAnD,OAAA,GAAAN,iBAAA","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ var _FilterCollection = _interopRequireDefault(require("../filters/FilterCollect
|
|
|
14
14
|
var _ContentLinkModel = _interopRequireDefault(require("./ContentLinkModel"));
|
|
15
15
|
var _Href = _interopRequireDefault(require("../href/Href"));
|
|
16
16
|
var _ChoiceAttributeModel = _interopRequireDefault(require("../attributes/ChoiceAttributeModel"));
|
|
17
|
+
var _ConceptIndexFilterModel = _interopRequireDefault(require("../filters/ConceptIndexFilterModel"));
|
|
17
18
|
/**
|
|
18
19
|
* Get Index of concepts, to filter model catalog
|
|
19
20
|
*/
|
|
@@ -97,7 +98,11 @@ class ContentIndexModel extends _ResourceModel.default {
|
|
|
97
98
|
* Get index filter
|
|
98
99
|
*/
|
|
99
100
|
get indexfilter() {
|
|
100
|
-
|
|
101
|
+
const indexFilter = this._filterCollection.getFilterByAttributeKey("index");
|
|
102
|
+
if (indexFilter instanceof _ConceptIndexFilterModel.default) {
|
|
103
|
+
return indexFilter;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentIndexModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ResourceCollection","_FilterCollection","_ContentLinkModel","_Href","_ChoiceAttributeModel","ContentIndexModel","ResourceModel","constructor","modularuiResponse","_context","_defineProperty2","default","_filterCollection","FilterCollection","_filter","data","filter","contributions","dynamicschema","modelOptions","_content","ResourceCollection","collection","_embedded","_map","results","call","content","ContentLinkModel","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","getFilterByAttributeKey","hasIndexFilter","filterAttribute","attribute","ChoiceAttributeModel","options","length","hasFiltersSet","some","isActive","hasNoFiltersSet","getFirstCharHref","firstChar","_context2","option","code","Href","addParameter","exports"],"sources":["../../../src/models/content/ContentIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport ChoiceAttributeModel from \"../attributes/ChoiceAttributeModel\";\n\nimport type {
|
|
1
|
+
{"version":3,"file":"ContentIndexModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ResourceCollection","_FilterCollection","_ContentLinkModel","_Href","_ChoiceAttributeModel","_ConceptIndexFilterModel","ContentIndexModel","ResourceModel","constructor","modularuiResponse","_context","_defineProperty2","default","_filterCollection","FilterCollection","_filter","data","filter","contributions","dynamicschema","modelOptions","_content","ResourceCollection","collection","_embedded","_map","results","call","content","ContentLinkModel","type","modelName","isApplicableModel","resourcetype","getInitialChildModelLinks","items","setChildModels","models","errors","selfhref","href","selflink","filterCollection","forEach","params","param","value","setParameter","name","removeParameter","label","getContribution","indexfilter","indexFilter","getFilterByAttributeKey","ConceptIndexFilterModel","hasIndexFilter","filterAttribute","attribute","ChoiceAttributeModel","options","length","hasFiltersSet","some","isActive","hasNoFiltersSet","getFirstCharHref","firstChar","_context2","option","code","Href","addParameter","exports"],"sources":["../../../src/models/content/ContentIndexModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ResourceCollection from \"../base/ResourceCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport ChoiceAttributeModel from \"../attributes/ChoiceAttributeModel\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\nimport ConceptIndexFilterModel from \"../filters/ConceptIndexFilterModel\";\n\n/**\n * Get Index of concepts, to filter model catalog\n */\nexport default class ContentIndexModel extends ResourceModel {\n _filterCollection: FilterCollection;\n _content: ResourceCollection<ContentLinkModel>;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter,\n dynamicschema: this.data.dynamicschema,\n },\n this.modelOptions,\n );\n\n this._content = new ResourceCollection();\n this._content.collection = this.data._embedded\n ? this.data._embedded.results.map(\n (content) =>\n new ContentLinkModel(content.content, null, this.modelOptions),\n )\n : [];\n }\n\n /**\n */\n get type(): string {\n return \"ContentIndex\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentIndexModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentSearch\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.items.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this.items.setChildModels(models, errors);\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = this.selflink.href;\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\");\n }\n\n /**\n * Retrieve filters of conceptindex model\n */\n get filterCollection(): FilterCollection {\n return this._filterCollection;\n }\n\n /**\n * Get index filter\n */\n get indexfilter(): ConceptIndexFilterModel | null {\n const indexFilter = this._filterCollection.getFilterByAttributeKey(\"index\");\n if (indexFilter instanceof ConceptIndexFilterModel) {\n return indexFilter;\n }\n return null;\n }\n\n /**\n * Retrieve content collection\n */\n get items(): ResourceCollection<ContentLinkModel> {\n return this._content;\n }\n\n /**\n */\n hasIndexFilter(): boolean {\n const filterAttribute = this.indexfilter?.attribute;\n\n return (\n filterAttribute instanceof ChoiceAttributeModel &&\n filterAttribute.options.length > 0\n );\n }\n\n /**\n */\n hasFiltersSet(): boolean {\n return this.filterCollection.some((filter) => filter.isActive());\n }\n\n /**\n */\n hasNoFiltersSet(): boolean {\n return !this.hasFiltersSet();\n }\n\n /**\n */\n getFirstCharHref(): Href {\n const filterAttribute = this.indexfilter?.attribute;\n\n let firstChar = \"#\";\n if (filterAttribute instanceof ChoiceAttributeModel) {\n firstChar = filterAttribute.options.filter(\n (option) => option.code !== \"0\",\n )[0].code;\n }\n\n return new Href(this.selfhref).addParameter(\"index\", firstChar);\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,qBAAA,GA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,CAAA,EAAY;IACxB,MAAMC,eAAe,GAAG,IAAI,CAACL,WAAW,EAAEM,SAAS;IAEnD,OACED,eAAe,YAAYE,6BAAoB,IAC/CF,eAAe,CAACG,OAAO,CAACC,MAAM,GAAG,CAAC;EAEtC;;EAEA;AACF;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACpB,gBAAgB,CAACqB,IAAI,CAAE9C,MAAM,IAAKA,MAAM,CAAC+C,QAAQ,CAAC,CAAC,CAAC;EAClE;;EAEA;AACF;EACEC,eAAeA,CAAA,EAAY;IACzB,OAAO,CAAC,IAAI,CAACH,aAAa,CAAC,CAAC;EAC9B;;EAEA;AACF;EACEI,gBAAgBA,CAAA,EAAS;IACvB,MAAMT,eAAe,GAAG,IAAI,CAACL,WAAW,EAAEM,SAAS;IAEnD,IAAIS,SAAS,GAAG,GAAG;IACnB,IAAIV,eAAe,YAAYE,6BAAoB,EAAE;MAAA,IAAAS,SAAA;MACnDD,SAAS,GAAG,IAAApD,OAAA,CAAAH,OAAA,EAAAwD,SAAA,GAAAX,eAAe,CAACG,OAAO,EAAAjC,IAAA,CAAAyC,SAAA,EAChCC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAK,GAC9B,CAAC,CAAC,CAAC,CAAC,CAACA,IAAI;IACX;IAEA,OAAO,IAAIC,aAAI,CAAC,IAAI,CAAChC,QAAQ,CAAC,CAACiC,YAAY,CAAC,OAAO,EAAEL,SAAS,CAAC;EACjE;AACF;AAACM,OAAA,CAAA7D,OAAA,GAAAN,iBAAA","ignoreList":[]}
|
|
@@ -93,8 +93,9 @@ class ContentModel extends _ResourceModel.default {
|
|
|
93
93
|
*/
|
|
94
94
|
get entryDate() {
|
|
95
95
|
const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(_Constants.TIMEVERSION_FILTER_NAME);
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const date = entryDateFilter?.value;
|
|
97
|
+
if (typeof date === "string") {
|
|
98
|
+
return date;
|
|
98
99
|
}
|
|
99
100
|
return null;
|
|
100
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentModel.js","names":["_ModularUIResponse","_interopRequireDefault","require","_ResourceModel","_FilterCollection","_ContentLinkModel","_SubSectionModel","_ContentTypeModel","_Constants","_SectionModel","ContentModel","ResourceModel","constructor","response","_defineProperty2","default","_section","SectionModel","data","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","call","model","section","id","_id","filterCollection","_filterCollection","_filter","FilterCollection","filter","entryDateFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","
|
|
1
|
+
{"version":3,"file":"ContentModel.js","names":["_ModularUIResponse","_interopRequireDefault","require","_ResourceModel","_FilterCollection","_ContentLinkModel","_SubSectionModel","_ContentTypeModel","_Constants","_SectionModel","ContentModel","ResourceModel","constructor","response","_defineProperty2","default","_section","SectionModel","data","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","call","model","section","id","_id","filterCollection","_filterCollection","_filter","FilterCollection","filter","entryDateFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","date","value","_contentType","ContentTypeModel","label","number","body","childSectionLinks","selfContentLink","childSections","sections","subSections","relatedConceptsHrefs","hrefs","relatedConceptsHref","push","forEach","subSection","relatedConceptsLink","href","addParameter","setReferenceHash","referenceHash","exports"],"sources":["../../../src/models/content/ContentModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport ContentTypeModel from \"./ContentTypeModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type Href from \"../href/Href\";\nimport SectionModel from \"./SectionModel\";\n\n/**\n * Content detail model\n */\nexport default class ContentModel extends ResourceModel {\n _section: SectionModel;\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n constructor(response: ModularUIResponse) {\n super(response);\n\n this._section = new SectionModel(\n this.data,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"Content\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n */\n get section(): SectionModel {\n return this._section;\n }\n\n /**\n */\n get id(): string {\n return this.data._id;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection && this.data.filter?.entryDate) {\n this._filterCollection = new FilterCollection(\n {\n entryDate: this.data.filter.entryDate,\n },\n {\n filter: this.contributions.filter,\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n const date = entryDateFilter?.value;\n if (typeof date === \"string\") {\n return date;\n }\n return null;\n }\n\n /**\n * Get conceptType of concept\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.section.label;\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.section.number;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return this.section.body;\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.section.childSectionLinks;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return this.section.selfContentLink;\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n return this.section.childSections;\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this.section.childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.section.subSections;\n }\n\n /**\n */\n get relatedConceptsHrefs(): Array<Href> {\n const hrefs = [];\n if (this.relatedConceptsHref) {\n hrefs.push(this.relatedConceptsHref);\n }\n\n this.subSections.forEach((subSection) => {\n hrefs.push(...subSection.relatedConceptsHrefs);\n });\n\n return hrefs;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n href.addParameter(\"entryDate\", this.entryDate);\n href.setReferenceHash(this.referenceHash);\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get referenceHash(): number {\n return this.section.referenceHash;\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,iBAAA,GAAAN,sBAAA,CAAAC,O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C,WAAW,EAAE,IAAI,CAAChD,SAAS,CAAC;MAC9C+C,IAAI,CAACE,gBAAgB,CAAC,IAAI,CAACC,aAAa,CAAC;MACzC,OAAOH,IAAI;IACb;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIG,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAI,CAACjC,OAAO,CAACiC,aAAa;EACnC;AACF;AAACC,OAAA,CAAAvD,OAAA,GAAAL,YAAA","ignoreList":[]}
|
|
@@ -198,14 +198,18 @@ class ContentTOCModel extends _ResourceModel.default {
|
|
|
198
198
|
*/
|
|
199
199
|
get entryDate() {
|
|
200
200
|
const timeversionFilter = this.filterCollection.getFilterByAttributeKey(_Constants.TIMEVERSION_FILTER_NAME);
|
|
201
|
-
|
|
201
|
+
const date = timeversionFilter?.value;
|
|
202
|
+
if (typeof date === "string") {
|
|
203
|
+
return date;
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
/**
|
|
205
209
|
*/
|
|
206
210
|
get isCompleteSource() {
|
|
207
211
|
const completeFilter = this.filterCollection.getFilterByAttributeKey("complete");
|
|
208
|
-
return completeFilter?.
|
|
212
|
+
return completeFilter?.value === "true";
|
|
209
213
|
}
|
|
210
214
|
}
|
|
211
215
|
exports.default = ContentTOCModel;
|