@beinformed/ui 1.65.28 → 1.65.29
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 +2 -0
- package/README.md +59 -18
- package/esm/models/concepts/ConceptDetailModel.js +47 -49
- package/esm/models/concepts/ConceptDetailModel.js.flow +37 -52
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +27 -7
- package/lib/models/concepts/ConceptDetailModel.js +47 -49
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.65.29](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.28...v1.65.29) (2026-02-06)
|
|
6
|
+
|
|
5
7
|
## [1.65.28](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.27...v1.65.28) (2026-02-02)
|
|
6
8
|
|
|
7
9
|
|
package/README.md
CHANGED
|
@@ -1,32 +1,73 @@
|
|
|
1
1
|
# @beinformed/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@beinformed/ui` provides the core infrastructure and high-level React building blocks for applications powered by [Be Informed](https://www.beinformed.com) Modular UI services.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It handles the complexities of state management, server-side rendering, and model rehydration, allowing you to focus on building rich user experiences.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Redux modules for working with modular UI services, and other features required for a complete Be Informed user interface
|
|
9
|
-
- React modules containing:
|
|
10
|
-
- Client setup
|
|
11
|
-
- Server setup
|
|
12
|
-
- Styled-components theming
|
|
13
|
-
- I18n
|
|
14
|
-
- Settings
|
|
15
|
-
- Hooks and redux connectors
|
|
16
|
-
- Generic utils for creating a user interface
|
|
7
|
+
## ✨ Features
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
- **Model-Driven UI**: Automatically transforms Modular UI service responses into rich JavaScript Class instances (Models) that combine data with metadata and logic.
|
|
10
|
+
- **React-First**: Comprehensive library of hooks and providers for data fetching and state interaction.
|
|
11
|
+
- **SSR Support**: Native pipeline for Java-backed Server-Side Rendering (SSR) with state dehydration and rehydration.
|
|
12
|
+
- **Unified Theming**: A robust design token system built on `styled-components` with automatic accessibility/contrast calculation.
|
|
13
|
+
- **Redux Integration**: Built-in modules for navigation, preferences, i18n, and resource caching.
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
Install the library via npm, yarn, pnpm:
|
|
21
18
|
|
|
22
19
|
```bash
|
|
23
20
|
npm install @beinformed/ui
|
|
24
21
|
```
|
|
25
22
|
|
|
26
|
-
##
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
To use the library, wrap your application in the initialization client. This sets up the Redux store, handles routing, and enables rehydration.
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
import { client } from "@beinformed/ui/react";
|
|
29
|
+
|
|
30
|
+
client({
|
|
31
|
+
theme: { PRIMARY_COLOR: "#0055aa" },
|
|
32
|
+
render: () => <MyApplication />,
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
And a server that is loaded in the Be Informed environment:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import { serverNoSSR } from "@beinformed/ui/react";
|
|
40
|
+
|
|
41
|
+
export const server = (request: HttpServletRequestJava) => {
|
|
42
|
+
setSettings(DEFAULT_SETTINGS);
|
|
43
|
+
return serverNoSSR({
|
|
44
|
+
request,
|
|
45
|
+
render: () => <MyServer />,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 📖 Documentation
|
|
27
51
|
|
|
28
|
-
|
|
52
|
+
Detailed usage guides and API references are available to help you build your application:
|
|
29
53
|
|
|
30
|
-
|
|
54
|
+
- **[Initialization & SSR](./docs/usage/react-client.md)** – Setting up the client and server environments.
|
|
55
|
+
- **[Theming System](./docs/usage/react-theme.md)** – Using design tokens and styling utilities.
|
|
56
|
+
- **[React Hooks Cheat Sheet](./docs/usage/index.md)** – A quick reference for fetching data and models.
|
|
57
|
+
- **[Form & Attribute Handling](./docs/usage/forms.md)** – Managing complex state and submissions.
|
|
31
58
|
|
|
32
|
-
|
|
59
|
+
For comprehensive platform documentation, visit the [Be Informed Plaza](https://plaza.beinformed.com/).
|
|
60
|
+
|
|
61
|
+
## 💬 Questions & Feedback
|
|
62
|
+
|
|
63
|
+
We value your input!
|
|
64
|
+
|
|
65
|
+
- **Bugs & Features**: Please file an issue on our [Support Environment](https://support.beinformed.com).
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
© 2026 Be Informed. All rights reserved.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
3
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
4
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
6
6
|
import _endsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/ends-with";
|
|
7
7
|
import ResourceModel from "../base/ResourceModel";
|
|
8
8
|
import ConceptRelationCollection from "./ConceptRelationCollection";
|
|
@@ -141,80 +141,78 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
141
141
|
return this.data.formula;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
getElements(propName, typePropName) {
|
|
148
|
+
// $FlowIssue
|
|
149
|
+
const elementTypes = this.conceptType?.[typePropName] ?? [];
|
|
150
|
+
const allElements = this.data[propName] ?? [];
|
|
151
|
+
const elements = [];
|
|
152
|
+
const usedElementTypes = [];
|
|
153
|
+
for (const element of allElements) {
|
|
154
|
+
const elementType = _findInstanceProperty(elementTypes).call(elementTypes, elType => elType._id === element.type);
|
|
155
|
+
if (elementType) {
|
|
156
|
+
elements.push({
|
|
157
|
+
...elementType,
|
|
158
|
+
...element
|
|
159
|
+
});
|
|
160
|
+
usedElementTypes.push(elementType._id);
|
|
161
|
+
} else {
|
|
162
|
+
elements.push(element);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
for (const elementType of elementTypes) {
|
|
166
|
+
if (!_includesInstanceProperty(usedElementTypes).call(usedElementTypes, elementType._id)) {
|
|
167
|
+
elements.push(elementType);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return elements;
|
|
171
|
+
}
|
|
172
|
+
|
|
144
173
|
/**
|
|
145
174
|
* Get additional labels of concept
|
|
146
175
|
*/
|
|
147
176
|
get labels() {
|
|
148
|
-
|
|
149
|
-
return this.conceptType?.labelTypes ? _mapInstanceProperty(_context = this.conceptType.labelTypes).call(_context, labelType => {
|
|
150
|
-
var _context2;
|
|
151
|
-
const setting = this.data.labels ? _findInstanceProperty(_context2 = this.data.labels).call(_context2, label => label.type === labelType._id) : {};
|
|
152
|
-
return {
|
|
153
|
-
...labelType,
|
|
154
|
-
...setting
|
|
155
|
-
};
|
|
156
|
-
}) : [];
|
|
177
|
+
return this.getElements("labels", "labelTypes");
|
|
157
178
|
}
|
|
158
179
|
|
|
159
180
|
/**
|
|
160
181
|
* Get label elements by id
|
|
161
182
|
*/
|
|
162
183
|
getLabelElementByIds(ids) {
|
|
163
|
-
var
|
|
164
|
-
return _filterInstanceProperty(
|
|
184
|
+
var _context;
|
|
185
|
+
return _filterInstanceProperty(_context = this.labels).call(_context, label => _includesInstanceProperty(ids).call(ids, label._id));
|
|
165
186
|
}
|
|
166
187
|
|
|
167
188
|
/**
|
|
168
189
|
* Get concept properties
|
|
169
190
|
*/
|
|
170
191
|
get conceptProperties() {
|
|
171
|
-
|
|
172
|
-
return this.conceptType?.propertyTypes ? _mapInstanceProperty(_context4 = this.conceptType.propertyTypes).call(_context4, propertyType => {
|
|
173
|
-
var _context5;
|
|
174
|
-
const setting = this.data.properties ? _findInstanceProperty(_context5 = this.data.properties).call(_context5, property => property.type === propertyType._id) : {};
|
|
175
|
-
return {
|
|
176
|
-
...propertyType,
|
|
177
|
-
...setting
|
|
178
|
-
};
|
|
179
|
-
}) : [];
|
|
192
|
+
return this.getElements("properties", "propertyTypes");
|
|
180
193
|
}
|
|
181
194
|
|
|
182
195
|
/**
|
|
183
196
|
* Get concept properties by id
|
|
184
197
|
*/
|
|
185
198
|
getConceptPropertiesByIds(ids) {
|
|
186
|
-
var
|
|
187
|
-
return _filterInstanceProperty(
|
|
199
|
+
var _context2;
|
|
200
|
+
return _filterInstanceProperty(_context2 = this.conceptProperties).call(_context2, property => _includesInstanceProperty(ids).call(ids, property._id));
|
|
188
201
|
}
|
|
189
202
|
|
|
190
203
|
/**
|
|
191
204
|
* Get Text fragments
|
|
192
205
|
*/
|
|
193
206
|
get textfragments() {
|
|
194
|
-
|
|
195
|
-
const textFragments = this.data.textFragments ? _mapInstanceProperty(_context7 = this.data.textFragments).call(_context7, textFragment => {
|
|
196
|
-
var _context8, _context9;
|
|
197
|
-
const textFragmentConfig = ((_context8 = this.conceptType) == null ? void 0 : Function.call.bind(_findInstanceProperty(_context9 = _context8.textFragmentTypes), _context9))?.(textFragmentType => textFragment.type === textFragmentType._id);
|
|
198
|
-
return {
|
|
199
|
-
...textFragmentConfig,
|
|
200
|
-
...textFragment
|
|
201
|
-
};
|
|
202
|
-
}) : [];
|
|
203
|
-
const notConfiguredTextFragments = this.conceptType?.textFragmentTypes ? _filterInstanceProperty(_context0 = this.conceptType.textFragmentTypes).call(_context0, textFragmentType => {
|
|
204
|
-
if (!this.data.textFragments) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
return !this.data.textFragments.some(textfragment => textfragment.type === textFragmentType._id);
|
|
208
|
-
}) : [];
|
|
209
|
-
return [...textFragments, ...notConfiguredTextFragments];
|
|
207
|
+
return this.getElements("textFragments", "textFragmentTypes");
|
|
210
208
|
}
|
|
211
209
|
|
|
212
210
|
/**
|
|
213
211
|
* Get text fragments by id
|
|
214
212
|
*/
|
|
215
213
|
getTextFragmentByKeys(keys) {
|
|
216
|
-
var
|
|
217
|
-
return _filterInstanceProperty(
|
|
214
|
+
var _context3;
|
|
215
|
+
return _filterInstanceProperty(_context3 = this.textfragments).call(_context3, textfragment => _includesInstanceProperty(keys).call(keys, textfragment.type));
|
|
218
216
|
}
|
|
219
217
|
|
|
220
218
|
/**
|
|
@@ -240,21 +238,21 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
240
238
|
getSourceReferencesForCurrentLanguage(availableLocales) {
|
|
241
239
|
const LANGUAGE_POSTFIX_LENGTH = 3;
|
|
242
240
|
if (this.data.sourceReferences) {
|
|
243
|
-
var
|
|
244
|
-
const availableLanguagesInSourceReferences = _mapInstanceProperty(
|
|
241
|
+
var _context4, _context7;
|
|
242
|
+
const availableLanguagesInSourceReferences = _mapInstanceProperty(_context4 = this.data.sourceReferences).call(_context4, sourceReference => sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH));
|
|
245
243
|
const currentLanguagePostfix = `_${this.locale}`;
|
|
246
244
|
if (_includesInstanceProperty(availableLanguagesInSourceReferences).call(availableLanguagesInSourceReferences, currentLanguagePostfix)) {
|
|
247
|
-
var
|
|
245
|
+
var _context5;
|
|
248
246
|
// return all sourceReferences that end with language that is selected
|
|
249
|
-
return _filterInstanceProperty(
|
|
250
|
-
var
|
|
251
|
-
return _endsWithInstanceProperty(
|
|
247
|
+
return _filterInstanceProperty(_context5 = this.data.sourceReferences).call(_context5, sourceReference => {
|
|
248
|
+
var _context6;
|
|
249
|
+
return _endsWithInstanceProperty(_context6 = sourceReference.type).call(_context6, currentLanguagePostfix);
|
|
252
250
|
});
|
|
253
251
|
}
|
|
254
252
|
const availableLanguages = _mapInstanceProperty(availableLocales).call(availableLocales, locale => `_${locale.split("-")[0]}`);
|
|
255
253
|
|
|
256
254
|
// return all sourceReferences that do not end with language postfix
|
|
257
|
-
return _filterInstanceProperty(
|
|
255
|
+
return _filterInstanceProperty(_context7 = this.data.sourceReferences).call(_context7, sourceReference => !_includesInstanceProperty(availableLanguages).call(availableLanguages, sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH)));
|
|
258
256
|
}
|
|
259
257
|
return [];
|
|
260
258
|
}
|
|
@@ -166,22 +166,42 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
166
166
|
return this.data.formula;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
getElements<T>(propName: string, typePropName: string): Array<T> {
|
|
173
|
+
// $FlowIssue
|
|
174
|
+
const elementTypes = this.conceptType?.[typePropName] ?? [];
|
|
175
|
+
const allElements = this.data[propName] ?? [];
|
|
176
|
+
|
|
177
|
+
const elements = [];
|
|
178
|
+
const usedElementTypes = [];
|
|
179
|
+
for (const element of allElements) {
|
|
180
|
+
const elementType = elementTypes.find(
|
|
181
|
+
(elType) => elType._id === element.type,
|
|
182
|
+
);
|
|
183
|
+
if (elementType) {
|
|
184
|
+
elements.push({ ...elementType, ...element });
|
|
185
|
+
usedElementTypes.push(elementType._id);
|
|
186
|
+
} else {
|
|
187
|
+
elements.push(element);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (const elementType of elementTypes) {
|
|
192
|
+
if (!usedElementTypes.includes(elementType._id)) {
|
|
193
|
+
elements.push(elementType);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return elements;
|
|
198
|
+
}
|
|
199
|
+
|
|
169
200
|
/**
|
|
170
201
|
* Get additional labels of concept
|
|
171
202
|
*/
|
|
172
203
|
get labels(): Array<labelsJSON> {
|
|
173
|
-
return this.
|
|
174
|
-
? this.conceptType.labelTypes.map((labelType) => {
|
|
175
|
-
const setting = this.data.labels
|
|
176
|
-
? this.data.labels.find((label) => label.type === labelType._id)
|
|
177
|
-
: {};
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
...labelType,
|
|
181
|
-
...setting,
|
|
182
|
-
};
|
|
183
|
-
})
|
|
184
|
-
: [];
|
|
204
|
+
return this.getElements<labelsJSON>("labels", "labelTypes");
|
|
185
205
|
}
|
|
186
206
|
|
|
187
207
|
/**
|
|
@@ -195,20 +215,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
195
215
|
* Get concept properties
|
|
196
216
|
*/
|
|
197
217
|
get conceptProperties(): Array<propertyJSON> {
|
|
198
|
-
return this.
|
|
199
|
-
? this.conceptType.propertyTypes.map((propertyType) => {
|
|
200
|
-
const setting = this.data.properties
|
|
201
|
-
? this.data.properties.find(
|
|
202
|
-
(property) => property.type === propertyType._id,
|
|
203
|
-
)
|
|
204
|
-
: {};
|
|
205
|
-
|
|
206
|
-
return {
|
|
207
|
-
...propertyType,
|
|
208
|
-
...setting,
|
|
209
|
-
};
|
|
210
|
-
})
|
|
211
|
-
: [];
|
|
218
|
+
return this.getElements<propertyJSON>("properties", "propertyTypes");
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
/**
|
|
@@ -224,32 +231,10 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
224
231
|
* Get Text fragments
|
|
225
232
|
*/
|
|
226
233
|
get textfragments(): Array<textfragmentJSON> {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
return {
|
|
234
|
-
...textFragmentConfig,
|
|
235
|
-
...textFragment,
|
|
236
|
-
};
|
|
237
|
-
})
|
|
238
|
-
: [];
|
|
239
|
-
|
|
240
|
-
const notConfiguredTextFragments = this.conceptType?.textFragmentTypes
|
|
241
|
-
? this.conceptType.textFragmentTypes.filter((textFragmentType) => {
|
|
242
|
-
if (!this.data.textFragments) {
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return !this.data.textFragments.some(
|
|
247
|
-
(textfragment) => textfragment.type === textFragmentType._id,
|
|
248
|
-
);
|
|
249
|
-
})
|
|
250
|
-
: [];
|
|
251
|
-
|
|
252
|
-
return [...textFragments, ...notConfiguredTextFragments];
|
|
234
|
+
return this.getElements<textfragmentJSON>(
|
|
235
|
+
"textFragments",
|
|
236
|
+
"textFragmentTypes",
|
|
237
|
+
);
|
|
253
238
|
}
|
|
254
239
|
|
|
255
240
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_mapInstanceProperty","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filterInstanceProperty","_includesInstanceProperty","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context0","textFragments","textFragment","_context8","_context9","textFragmentConfig","Function","bind","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context1","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context10","_context13","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context11","_context12","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType?.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType?.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig = this.conceptType?.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments = this.conceptType?.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAO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AA,CAAAkE,UAAA,EAC9BE,eAAe,IACd,CAACtC,yBAAA,CAAA8C,kBAAkB,EAAA5E,IAAA,CAAlB4E,kBAAkB,EACjBR,eAAe,CAACrF,IAAI,CAACsF,SAAS,CAC5BD,eAAe,CAACrF,IAAI,CAACuF,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIlF,SAASA,CAAA,EAAkB;IAC7B,OAAOgD,uBAAA,KAAI,CAAClD,IAAI,IAAUN,uBAAuB,CAAC,EAAEyG,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC9E,WAAW,EAAE6E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","getElements","propName","typePropName","elementTypes","allElements","elements","usedElementTypes","element","elementType","elType","_id","push","_includesInstanceProperty","labels","getLabelElementByIds","ids","_context","_filterInstanceProperty","conceptProperties","getConceptPropertiesByIds","_context2","property","textfragments","getTextFragmentByKeys","keys","_context3","textfragment","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context4","_context7","availableLanguagesInSourceReferences","_mapInstanceProperty","sourceReference","substring","length","currentLanguagePostfix","locale","_context5","_context6","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * @private\n */\n getElements<T>(propName: string, typePropName: string): Array<T> {\n // $FlowIssue\n const elementTypes = this.conceptType?.[typePropName] ?? [];\n const allElements = this.data[propName] ?? [];\n\n const elements = [];\n const usedElementTypes = [];\n for (const element of allElements) {\n const elementType = elementTypes.find(\n (elType) => elType._id === element.type,\n );\n if (elementType) {\n elements.push({ ...elementType, ...element });\n usedElementTypes.push(elementType._id);\n } else {\n elements.push(element);\n }\n }\n\n for (const elementType of elementTypes) {\n if (!usedElementTypes.includes(elementType._id)) {\n elements.push(elementType);\n }\n }\n\n return elements;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.getElements<labelsJSON>(\"labels\", \"labelTypes\");\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.getElements<propertyJSON>(\"properties\", \"propertyTypes\");\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n return this.getElements<textfragmentJSON>(\n \"textFragments\",\n \"textFragmentTypes\",\n );\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAcnE;AACA;AACA;AACA,eAAe,MAAMC,kBAAkB,SAASL,aAAa,CAAC;EAK5D;AACF;EACEM,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIR,yBAAyB,CAC7C,IAAI,CAACS,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;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MAAM,GAAGR,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIrE,SAASA,CAAA,EAAkB;IAC7B,OAAOsD,uBAAA,KAAI,CAACxD,IAAI,IAAUN,uBAAuB,CAAC,EAAE6F,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAClE,WAAW,EAAEiE,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
|
|
@@ -18,29 +18,42 @@ describe("conceptDetailModel", () => {
|
|
|
18
18
|
);
|
|
19
19
|
expect(conceptDetail.labels).toStrictEqual([
|
|
20
20
|
{
|
|
21
|
-
_id: "
|
|
22
|
-
label: "
|
|
21
|
+
_id: "ResultLabel",
|
|
22
|
+
label: "Result label",
|
|
23
|
+
type: "ResultLabel",
|
|
24
|
+
value: "Duration of driving ban (in months)",
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
27
|
_id: "ResultLabel",
|
|
26
28
|
label: "Result label",
|
|
27
29
|
type: "ResultLabel",
|
|
28
|
-
value: "
|
|
30
|
+
value: "Second ResultLabel",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
_id: "QuestionLabel",
|
|
34
|
+
label: "Question label",
|
|
29
35
|
},
|
|
30
36
|
]);
|
|
31
37
|
expect(conceptDetail.conceptProperties).toStrictEqual([
|
|
32
38
|
{
|
|
33
|
-
_id: "
|
|
34
|
-
label: "
|
|
39
|
+
_id: "Abbreviation",
|
|
40
|
+
label: "Abbreviation",
|
|
35
41
|
mandatory: "false",
|
|
36
|
-
type: "
|
|
42
|
+
type: "Abbreviation",
|
|
43
|
+
value: "DDB",
|
|
37
44
|
},
|
|
38
45
|
{
|
|
39
46
|
_id: "Abbreviation",
|
|
40
47
|
label: "Abbreviation",
|
|
41
48
|
mandatory: "false",
|
|
42
49
|
type: "Abbreviation",
|
|
43
|
-
value: "DDB",
|
|
50
|
+
value: "Second DDB",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
_id: "PartnerService",
|
|
54
|
+
label: "Partner Service",
|
|
55
|
+
mandatory: "false",
|
|
56
|
+
type: "string",
|
|
44
57
|
},
|
|
45
58
|
]);
|
|
46
59
|
expect(conceptDetail.textfragments).toStrictEqual([
|
|
@@ -51,6 +64,13 @@ describe("conceptDetailModel", () => {
|
|
|
51
64
|
text: "Text fragment for duration driving ban",
|
|
52
65
|
type: "Description",
|
|
53
66
|
},
|
|
67
|
+
{
|
|
68
|
+
_id: "Description",
|
|
69
|
+
label: "Description",
|
|
70
|
+
id: "DurationDrivingBan.tv853.Description",
|
|
71
|
+
text: "Second text frament for duration driving ban",
|
|
72
|
+
type: "Description",
|
|
73
|
+
},
|
|
54
74
|
{ _id: "Definition", label: "Definition" },
|
|
55
75
|
{ _id: "IconSmall", label: "Icon-small" },
|
|
56
76
|
{ _id: "IconMedium", label: "Icon-medium" },
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
9
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
10
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
11
9
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
10
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
11
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
12
12
|
var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/ends-with"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
14
|
var _ResourceModel = _interopRequireDefault(require("../base/ResourceModel"));
|
|
@@ -148,80 +148,78 @@ class ConceptDetailModel extends _ResourceModel.default {
|
|
|
148
148
|
return this.data.formula;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
getElements(propName, typePropName) {
|
|
155
|
+
// $FlowIssue
|
|
156
|
+
const elementTypes = this.conceptType?.[typePropName] ?? [];
|
|
157
|
+
const allElements = this.data[propName] ?? [];
|
|
158
|
+
const elements = [];
|
|
159
|
+
const usedElementTypes = [];
|
|
160
|
+
for (const element of allElements) {
|
|
161
|
+
const elementType = (0, _find.default)(elementTypes).call(elementTypes, elType => elType._id === element.type);
|
|
162
|
+
if (elementType) {
|
|
163
|
+
elements.push({
|
|
164
|
+
...elementType,
|
|
165
|
+
...element
|
|
166
|
+
});
|
|
167
|
+
usedElementTypes.push(elementType._id);
|
|
168
|
+
} else {
|
|
169
|
+
elements.push(element);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
for (const elementType of elementTypes) {
|
|
173
|
+
if (!(0, _includes.default)(usedElementTypes).call(usedElementTypes, elementType._id)) {
|
|
174
|
+
elements.push(elementType);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return elements;
|
|
178
|
+
}
|
|
179
|
+
|
|
151
180
|
/**
|
|
152
181
|
* Get additional labels of concept
|
|
153
182
|
*/
|
|
154
183
|
get labels() {
|
|
155
|
-
|
|
156
|
-
return this.conceptType?.labelTypes ? (0, _map.default)(_context = this.conceptType.labelTypes).call(_context, labelType => {
|
|
157
|
-
var _context2;
|
|
158
|
-
const setting = this.data.labels ? (0, _find.default)(_context2 = this.data.labels).call(_context2, label => label.type === labelType._id) : {};
|
|
159
|
-
return {
|
|
160
|
-
...labelType,
|
|
161
|
-
...setting
|
|
162
|
-
};
|
|
163
|
-
}) : [];
|
|
184
|
+
return this.getElements("labels", "labelTypes");
|
|
164
185
|
}
|
|
165
186
|
|
|
166
187
|
/**
|
|
167
188
|
* Get label elements by id
|
|
168
189
|
*/
|
|
169
190
|
getLabelElementByIds(ids) {
|
|
170
|
-
var
|
|
171
|
-
return (0, _filter.default)(
|
|
191
|
+
var _context;
|
|
192
|
+
return (0, _filter.default)(_context = this.labels).call(_context, label => (0, _includes.default)(ids).call(ids, label._id));
|
|
172
193
|
}
|
|
173
194
|
|
|
174
195
|
/**
|
|
175
196
|
* Get concept properties
|
|
176
197
|
*/
|
|
177
198
|
get conceptProperties() {
|
|
178
|
-
|
|
179
|
-
return this.conceptType?.propertyTypes ? (0, _map.default)(_context4 = this.conceptType.propertyTypes).call(_context4, propertyType => {
|
|
180
|
-
var _context5;
|
|
181
|
-
const setting = this.data.properties ? (0, _find.default)(_context5 = this.data.properties).call(_context5, property => property.type === propertyType._id) : {};
|
|
182
|
-
return {
|
|
183
|
-
...propertyType,
|
|
184
|
-
...setting
|
|
185
|
-
};
|
|
186
|
-
}) : [];
|
|
199
|
+
return this.getElements("properties", "propertyTypes");
|
|
187
200
|
}
|
|
188
201
|
|
|
189
202
|
/**
|
|
190
203
|
* Get concept properties by id
|
|
191
204
|
*/
|
|
192
205
|
getConceptPropertiesByIds(ids) {
|
|
193
|
-
var
|
|
194
|
-
return (0, _filter.default)(
|
|
206
|
+
var _context2;
|
|
207
|
+
return (0, _filter.default)(_context2 = this.conceptProperties).call(_context2, property => (0, _includes.default)(ids).call(ids, property._id));
|
|
195
208
|
}
|
|
196
209
|
|
|
197
210
|
/**
|
|
198
211
|
* Get Text fragments
|
|
199
212
|
*/
|
|
200
213
|
get textfragments() {
|
|
201
|
-
|
|
202
|
-
const textFragments = this.data.textFragments ? (0, _map.default)(_context7 = this.data.textFragments).call(_context7, textFragment => {
|
|
203
|
-
var _context8, _context9;
|
|
204
|
-
const textFragmentConfig = ((_context8 = this.conceptType) == null ? void 0 : Function.call.bind((0, _find.default)(_context9 = _context8.textFragmentTypes), _context9))?.(textFragmentType => textFragment.type === textFragmentType._id);
|
|
205
|
-
return {
|
|
206
|
-
...textFragmentConfig,
|
|
207
|
-
...textFragment
|
|
208
|
-
};
|
|
209
|
-
}) : [];
|
|
210
|
-
const notConfiguredTextFragments = this.conceptType?.textFragmentTypes ? (0, _filter.default)(_context0 = this.conceptType.textFragmentTypes).call(_context0, textFragmentType => {
|
|
211
|
-
if (!this.data.textFragments) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
return !this.data.textFragments.some(textfragment => textfragment.type === textFragmentType._id);
|
|
215
|
-
}) : [];
|
|
216
|
-
return [...textFragments, ...notConfiguredTextFragments];
|
|
214
|
+
return this.getElements("textFragments", "textFragmentTypes");
|
|
217
215
|
}
|
|
218
216
|
|
|
219
217
|
/**
|
|
220
218
|
* Get text fragments by id
|
|
221
219
|
*/
|
|
222
220
|
getTextFragmentByKeys(keys) {
|
|
223
|
-
var
|
|
224
|
-
return (0, _filter.default)(
|
|
221
|
+
var _context3;
|
|
222
|
+
return (0, _filter.default)(_context3 = this.textfragments).call(_context3, textfragment => (0, _includes.default)(keys).call(keys, textfragment.type));
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
/**
|
|
@@ -247,21 +245,21 @@ class ConceptDetailModel extends _ResourceModel.default {
|
|
|
247
245
|
getSourceReferencesForCurrentLanguage(availableLocales) {
|
|
248
246
|
const LANGUAGE_POSTFIX_LENGTH = 3;
|
|
249
247
|
if (this.data.sourceReferences) {
|
|
250
|
-
var
|
|
251
|
-
const availableLanguagesInSourceReferences = (0, _map.default)(
|
|
248
|
+
var _context4, _context7;
|
|
249
|
+
const availableLanguagesInSourceReferences = (0, _map.default)(_context4 = this.data.sourceReferences).call(_context4, sourceReference => sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH));
|
|
252
250
|
const currentLanguagePostfix = `_${this.locale}`;
|
|
253
251
|
if ((0, _includes.default)(availableLanguagesInSourceReferences).call(availableLanguagesInSourceReferences, currentLanguagePostfix)) {
|
|
254
|
-
var
|
|
252
|
+
var _context5;
|
|
255
253
|
// return all sourceReferences that end with language that is selected
|
|
256
|
-
return (0, _filter.default)(
|
|
257
|
-
var
|
|
258
|
-
return (0, _endsWith.default)(
|
|
254
|
+
return (0, _filter.default)(_context5 = this.data.sourceReferences).call(_context5, sourceReference => {
|
|
255
|
+
var _context6;
|
|
256
|
+
return (0, _endsWith.default)(_context6 = sourceReference.type).call(_context6, currentLanguagePostfix);
|
|
259
257
|
});
|
|
260
258
|
}
|
|
261
259
|
const availableLanguages = (0, _map.default)(availableLocales).call(availableLocales, locale => `_${locale.split("-")[0]}`);
|
|
262
260
|
|
|
263
261
|
// return all sourceReferences that do not end with language postfix
|
|
264
|
-
return (0, _filter.default)(
|
|
262
|
+
return (0, _filter.default)(_context7 = this.data.sourceReferences).call(_context7, sourceReference => !(0, _includes.default)(availableLanguages).call(availableLanguages, sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH)));
|
|
265
263
|
}
|
|
266
264
|
return [];
|
|
267
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptDetailModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ConceptRelationCollection","_SourceReferenceCollection","_ConceptTypeDetailModel","_Constants","ConceptDetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_relations","ConceptRelationCollection","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_find","call","model","ConceptTypeDetailModel","conceptType","key","getData","selfhref","href","selflink","setParameter","TIMEVERSION_FILTER_NAME","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_map","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filter","_includes","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context0","textFragments","textFragment","_context8","_context9","textFragmentConfig","Function","bind","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context1","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","SourceReferenceCollection","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context10","_context13","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context11","_context12","_endsWith","availableLanguages","split","value","isOfConceptType","conceptTypeId","exports"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType?.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType?.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig = this.conceptType?.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments = this.conceptType?.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0B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AAM,UAAA;UAAA,OACvD,IAAAC,SAAA,CAAAtG,OAAA,EAAAqG,UAAA,GAAAN,eAAe,CAACxF,IAAI,EAAAiB,IAAA,CAAA6E,UAAA,EAAUH,sBAAsB,CAAC;QAAA,CACvD,CAAC;MACH;MAEA,MAAMK,kBAAkB,GAAG,IAAAxD,IAAA,CAAA/C,OAAA,EAAAqF,gBAAgB,EAAA7D,IAAA,CAAhB6D,gBAAgB,EACxCc,MAAM,IAAK,IAAIA,MAAM,CAACK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACtC,CAAC;;MAED;MACA,OAAO,IAAAjD,OAAA,CAAAvD,OAAA,EAAA6F,UAAA,OAAI,CAAC1F,IAAI,CAACwF,gBAAgB,EAAAnE,IAAA,CAAAqE,UAAA,EAC9BE,eAAe,IACd,CAAC,IAAAvC,SAAA,CAAAxD,OAAA,EAAAuG,kBAAkB,EAAA/E,IAAA,CAAlB+E,kBAAkB,EACjBR,eAAe,CAACxF,IAAI,CAACyF,SAAS,CAC5BD,eAAe,CAACxF,IAAI,CAAC0F,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIrF,SAASA,CAAA,EAAkB;IAC7B,OAAO,IAAAkD,OAAA,CAAAvD,OAAA,MAAI,CAACG,IAAI,IAAU+B,kCAAuB,CAAC,EAAEuE,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAChF,WAAW,EAAE+E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF;AAACC,OAAA,CAAA5G,OAAA,GAAAL,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ConceptDetailModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ConceptRelationCollection","_SourceReferenceCollection","_ConceptTypeDetailModel","_Constants","ConceptDetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","_relations","ConceptRelationCollection","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_find","call","model","ConceptTypeDetailModel","conceptType","key","getData","selfhref","href","selflink","setParameter","TIMEVERSION_FILTER_NAME","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","getElements","propName","typePropName","elementTypes","allElements","elements","usedElementTypes","element","elementType","elType","_id","push","_includes","labels","getLabelElementByIds","ids","_context","_filter","conceptProperties","getConceptPropertiesByIds","_context2","property","textfragments","getTextFragmentByKeys","keys","_context3","textfragment","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","SourceReferenceCollection","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context4","_context7","availableLanguagesInSourceReferences","_map","sourceReference","substring","length","currentLanguagePostfix","locale","_context5","_context6","_endsWith","availableLanguages","split","value","isOfConceptType","conceptTypeId","exports"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * @private\n */\n getElements<T>(propName: string, typePropName: string): Array<T> {\n // $FlowIssue\n const elementTypes = this.conceptType?.[typePropName] ?? [];\n const allElements = this.data[propName] ?? [];\n\n const elements = [];\n const usedElementTypes = [];\n for (const element of allElements) {\n const elementType = elementTypes.find(\n (elType) => elType._id === element.type,\n );\n if (elementType) {\n elements.push({ ...elementType, ...element });\n usedElementTypes.push(elementType._id);\n } else {\n elements.push(element);\n }\n }\n\n for (const elementType of elementTypes) {\n if (!usedElementTypes.includes(elementType._id)) {\n elements.push(elementType);\n }\n }\n\n return elements;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.getElements<labelsJSON>(\"labels\", \"labelTypes\");\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.getElements<propertyJSON>(\"properties\", \"propertyTypes\");\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n return this.getElements<textfragmentJSON>(\n \"textFragments\",\n \"textFragmentTypes\",\n );\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType?.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAcA;AACA;AACA;AACe,MAAMK,kBAAkB,SAASC,sBAAa,CAAC;EAK5D;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,UAAU,GAAG,IAAIC,kCAAyB,CAC7C,IAAI,CAACC,IAAI,CAACC,SAAS,EACnB,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,eAAe;EACxB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,oBAAoB;EAC7B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACN,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACO,aAAa,CAACC,YAAY,IAC/BR,IAAI,CAACO,aAAa,CAACC,YAAY,KAAK,eAAe;EAEvD;;EAEA;AACF;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,MAAMC,eAAe,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,aAAa,CAAC;IAC9D,MAAMC,wBAAwB,GAC5B,IAAI,CAACC,mBAAmB,CAACL,yBAAyB,CAAC,CAAC;IAEtD,IAAIC,eAAe,EAAE;MACnBA,eAAe,CAACK,WAA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AAE2D,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAACpE,WAAW,EAAEmE,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF;AAACC,OAAA,CAAAhG,OAAA,GAAAL,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.65.
|
|
3
|
+
"version": "1.65.29",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "https://support.beinformed.com",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"release": "npm run quality && npm run docs&& npm run build:ts && commit-and-tag-version",
|
|
40
40
|
"beta-release": "commit-and-tag-version --prerelease beta",
|
|
41
41
|
"prepublishOnly": "npm run build",
|
|
42
|
-
"docs": "rimraf docs && node ./.build/docs.mjs",
|
|
42
|
+
"docs": "rimraf docs/API && node ./.build/docs.mjs",
|
|
43
43
|
"prepare": "husky",
|
|
44
44
|
"security-audit": "auditjs ossi --xml > npm-audit.xml"
|
|
45
45
|
},
|