@beinformed/ui 1.43.3 → 1.43.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/esm/models/attributes/AttributeModel.js +7 -0
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +0 -7
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +18 -5
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +7 -0
- package/lib/models/attributes/AttributeModel.js.flow +7 -0
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +0 -7
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +0 -7
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +7 -7
- package/lib/models/content/ContentLinkModel.js +18 -5
- package/lib/models/content/ContentLinkModel.js.flow +24 -12
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/package.json +1 -1
- package/src/models/attributes/AttributeModel.js +7 -0
- package/src/models/attributes/ChoiceAttributeModel.js +0 -7
- package/src/models/attributes/__tests__/AttributeContent.spec.js +7 -7
- package/src/models/content/ContentLinkModel.js +24 -12
|
@@ -45,14 +45,14 @@ const json = {
|
|
|
45
45
|
label: "Description Content",
|
|
46
46
|
sections: [
|
|
47
47
|
{
|
|
48
|
-
id: "Alert",
|
|
48
|
+
id: "Alert.:-",
|
|
49
49
|
type: "Reference",
|
|
50
50
|
label: "Alert",
|
|
51
51
|
number: "1",
|
|
52
52
|
body: "<p>The limit of 0.5 per mille has been exceeded.</p>",
|
|
53
53
|
_links: {
|
|
54
54
|
self: {
|
|
55
|
-
href: "/content/_Context/Police
|
|
55
|
+
href: "/content/_Context/Police%20incident%20decisions/Content/Breath%20analysis/Breathalyzer%20test.formalsource/Alert.%3A-",
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
childSections: [
|
|
@@ -183,10 +183,10 @@ describe("AttributeContent", () => {
|
|
|
183
183
|
expect(firstSection instanceof SectionModel).toBe(true);
|
|
184
184
|
|
|
185
185
|
expect(firstSection.selflink.href.toString()).toBe(
|
|
186
|
-
"/content/_Context/Police
|
|
186
|
+
"/content/_Context/Police%20incident%20decisions/Content/Breath%20analysis/Breathalyzer%20test.formalsource/Alert.%3A-",
|
|
187
187
|
);
|
|
188
188
|
expect(firstSection.selfhref.toString()).toBe(
|
|
189
|
-
"/content/_Context/Police
|
|
189
|
+
"/content/_Context/Police%20incident%20decisions/Content/Breath%20analysis/Breathalyzer%20test.formalsource/Alert.%3A-",
|
|
190
190
|
);
|
|
191
191
|
|
|
192
192
|
expect(firstSection.type).toBe("Reference");
|
|
@@ -197,15 +197,15 @@ describe("AttributeContent", () => {
|
|
|
197
197
|
);
|
|
198
198
|
expect(firstSection.childSectionLinks).toHaveLength(2);
|
|
199
199
|
expect(firstSection.selfContentLink.selfhref.toString()).toBe(
|
|
200
|
-
"/content/_Context/Police
|
|
200
|
+
"/content/_Context/Police%20incident%20decisions/Content/Breath%20analysis/Breathalyzer%20test.formalsource/Alert.%3A-",
|
|
201
201
|
);
|
|
202
202
|
expect(firstSection.selfContentLink.encodedHref.toString()).toBe(
|
|
203
|
-
"/content/_Context%2FPolice%
|
|
203
|
+
"/content/_Context%2FPolice%2520incident%2520decisions%2FContent%2FBreath%2520analysis%2FBreathalyzer%2520test.formalsource/Alert.%3A-",
|
|
204
204
|
);
|
|
205
205
|
|
|
206
206
|
expect(firstSection.childSections).toHaveLength(2);
|
|
207
207
|
expect(firstSection.subSections).toHaveLength(2);
|
|
208
|
-
expect(firstSection.referenceHash).toBe(-
|
|
208
|
+
expect(firstSection.referenceHash).toBe(-1954774597);
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
it("can handle referredSections", () => {
|
|
@@ -100,24 +100,36 @@ export default class ContentLinkModel
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Encode the content-identifier of the path to the content resource.
|
|
104
|
-
* This makes it a single uri part, which can be used on routes to make nested routes
|
|
105
103
|
*/
|
|
106
|
-
|
|
104
|
+
createEncodedHref(): Href {
|
|
107
105
|
const startURI = "/content/";
|
|
108
106
|
const selfhref = this.data._links.self.href;
|
|
107
|
+
|
|
109
108
|
const section = this.data.section;
|
|
109
|
+
const sourceId = section
|
|
110
|
+
? selfhref.substring(startURI.length, selfhref.lastIndexOf("/"))
|
|
111
|
+
: selfhref.substring(startURI.length, selfhref.lastIndexOf("#"));
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
let hash = "";
|
|
114
|
+
if (selfhref.hash) {
|
|
115
|
+
hash = `#${selfhref.hash}`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (section) {
|
|
119
|
+
return new Href(
|
|
120
|
+
`${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}${hash}`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
119
123
|
|
|
120
|
-
|
|
124
|
+
return new Href(`${startURI}${encodeURIComponent(sourceId)}${hash}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Encode the content-identifier of the path to the content resource.
|
|
129
|
+
* This makes it a single uri part, which can be used on routes to make nested routes
|
|
130
|
+
*/
|
|
131
|
+
get encodedHref(): Href {
|
|
132
|
+
const href = this.createEncodedHref();
|
|
121
133
|
|
|
122
134
|
if (this._entryDate !== null) {
|
|
123
135
|
return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);
|