@beinformed/ui 1.62.1 → 1.62.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/esm/hooks/__tests__/useModelCatalog.spec.js.flow +19 -0
- package/esm/hooks/useModelCatalog.d.ts +1 -0
- package/esm/hooks/useModelCatalog.js +22 -2
- package/esm/hooks/useModelCatalog.js.flow +31 -3
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.d.ts +4 -7
- package/esm/models/concepts/ConceptLinkModel.js +7 -1
- package/esm/models/concepts/ConceptLinkModel.js.flow +8 -8
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.d.ts +3 -0
- package/esm/models/concepts/SourceReferenceModel.js +7 -1
- package/esm/models/concepts/SourceReferenceModel.js.flow +7 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/concepts/__tests__/RelatedConcepts.spec.js.flow +6 -8
- package/esm/models/concepts/__tests__/SourceReferenceModel.spec.js.flow +3 -3
- package/esm/models/content/ContentLinkModel.js +3 -1
- package/esm/models/content/ContentLinkModel.js.flow +1 -1
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/__tests__/Formalsource.spec.js.flow +30 -0
- package/esm/models/types.d.ts +0 -1
- package/esm/models/types.js.flow +0 -1
- package/esm/models/types.js.map +1 -1
- package/lib/hooks/useModelCatalog.d.ts +1 -0
- package/lib/hooks/useModelCatalog.js +24 -3
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.d.ts +4 -7
- package/lib/models/concepts/ConceptLinkModel.js +7 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.d.ts +3 -0
- package/lib/models/concepts/SourceReferenceModel.js +7 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +3 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/types.d.ts +0 -1
- package/lib/models/types.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/__tests__/useModelCatalog.spec.js +19 -0
- package/src/hooks/useModelCatalog.js +31 -3
- package/src/models/concepts/ConceptLinkModel.js +8 -8
- package/src/models/concepts/SourceReferenceModel.js +7 -1
- package/src/models/concepts/__mock__/related_concepts_data.json +871 -755
- package/src/models/concepts/__tests__/RelatedConcepts.spec.js +6 -8
- package/src/models/concepts/__tests__/SourceReferenceModel.spec.js +3 -3
- package/src/models/content/ContentLinkModel.js +1 -1
- package/src/models/content/__tests__/Formalsource.spec.js +30 -0
- package/src/models/types.js +0 -1
|
@@ -18,7 +18,7 @@ import { ContentTypeModel } from "../models";
|
|
|
18
18
|
import { getEntryDate } from "../redux/selectors/modelcatalog";
|
|
19
19
|
import { updateEntryDate } from "../redux/actions/ModelCatalog";
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import Href from "../models/href/Href";
|
|
22
22
|
import type { UseModularUIBasicOptions } from "./useModularUIBasic";
|
|
23
23
|
import type { UpdateEntryDateAction } from "../redux";
|
|
24
24
|
export type SearchFilter = {
|
|
@@ -108,7 +108,9 @@ export const useContentTOC = (
|
|
|
108
108
|
const { entryDate } = useEntryDate();
|
|
109
109
|
const location = useLocation();
|
|
110
110
|
|
|
111
|
-
const href = createHref("content", content, entryDate, location, [
|
|
111
|
+
const href = createHref("content", content, entryDate, location, [
|
|
112
|
+
"complete",
|
|
113
|
+
]);
|
|
112
114
|
|
|
113
115
|
return useModularUIBasic(key, href, {
|
|
114
116
|
expectedModels: ["ContentTOC"],
|
|
@@ -127,7 +129,33 @@ export const useContent = (
|
|
|
127
129
|
const { entryDate } = useEntryDate();
|
|
128
130
|
const location = useLocation();
|
|
129
131
|
|
|
130
|
-
const href = createHref("content", content, entryDate, location, [
|
|
132
|
+
const href = createHref("content", content, entryDate, location, [
|
|
133
|
+
"complete",
|
|
134
|
+
]);
|
|
135
|
+
|
|
136
|
+
return useModularUIBasic(key, href, {
|
|
137
|
+
expectedModels: ["Content", "ContentTOC"],
|
|
138
|
+
...options,
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
*/
|
|
144
|
+
export const useCompleteSource = (
|
|
145
|
+
content: string | Href,
|
|
146
|
+
key?: string = "content",
|
|
147
|
+
options?: UseModularUIBasicOptions<ContentModel>,
|
|
148
|
+
): ?ContentModel | ?ContentTOCModel => {
|
|
149
|
+
const { entryDate } = useEntryDate();
|
|
150
|
+
const location = useLocation();
|
|
151
|
+
|
|
152
|
+
let contentHref = new Href(content);
|
|
153
|
+
contentHref.removeParameter("complete");
|
|
154
|
+
contentHref.addParameter("complete", "true");
|
|
155
|
+
|
|
156
|
+
const href = createHref("content", contentHref, entryDate, location, [
|
|
157
|
+
"complete",
|
|
158
|
+
]);
|
|
131
159
|
|
|
132
160
|
return useModularUIBasic(key, href, {
|
|
133
161
|
expectedModels: ["Content", "ContentTOC"],
|
|
@@ -9,16 +9,10 @@ import type {
|
|
|
9
9
|
IModelWithChildModels,
|
|
10
10
|
ModelOptions,
|
|
11
11
|
ModularUIModel,
|
|
12
|
+
SectionFragment,
|
|
12
13
|
} from "../types";
|
|
13
14
|
import type Href from "../href/Href";
|
|
14
15
|
|
|
15
|
-
type SectionFragment = {
|
|
16
|
-
sectionId: string,
|
|
17
|
-
text: string,
|
|
18
|
-
startOffset: number,
|
|
19
|
-
endOffset: number,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
16
|
/**
|
|
23
17
|
* Link to a concept
|
|
24
18
|
*/
|
|
@@ -199,10 +193,16 @@ export default class ConceptLinkModel
|
|
|
199
193
|
return this.getData("modelCategory");
|
|
200
194
|
}
|
|
201
195
|
|
|
196
|
+
/**
|
|
197
|
+
*/
|
|
198
|
+
get sectionId(): string {
|
|
199
|
+
return this.data.section?._id;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
202
|
/**
|
|
203
203
|
*
|
|
204
204
|
*/
|
|
205
205
|
get fragment(): SectionFragment {
|
|
206
|
-
return this.
|
|
206
|
+
return this.data.section?.fragment;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -32,7 +32,7 @@ class SourceReferenceModel {
|
|
|
32
32
|
*/
|
|
33
33
|
get link(): ContentLinkModel {
|
|
34
34
|
const section =
|
|
35
|
-
this.
|
|
35
|
+
this.sectionId ||
|
|
36
36
|
this._sourceReference._links.self.href.replace(
|
|
37
37
|
`${this._sourceReference._links.content.href}/`,
|
|
38
38
|
"",
|
|
@@ -85,6 +85,12 @@ class SourceReferenceModel {
|
|
|
85
85
|
return createHashFromHref(this.selfhref);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
*/
|
|
90
|
+
get sectionId(): string {
|
|
91
|
+
return this._sourceReference.sectionId;
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
/**
|
|
89
95
|
*
|
|
90
96
|
*/
|