@beinformed/ui 1.61.1 → 1.62.1
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 +16 -0
- package/esm/constants/Settings.js +2 -1
- package/esm/constants/Settings.js.flow +2 -0
- package/esm/constants/Settings.js.map +1 -1
- package/esm/models/attributes/__tests__/AttributeContent.spec.js.flow +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +1 -1
- package/esm/models/concepts/ConceptIndexModel.js.flow +3 -1
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.d.ts +15 -0
- package/esm/models/concepts/ConceptLinkModel.js +14 -0
- package/esm/models/concepts/ConceptLinkModel.js.flow +21 -0
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.d.ts +9 -0
- package/esm/models/concepts/SourceReferenceModel.js +16 -2
- package/esm/models/concepts/SourceReferenceModel.js.flow +22 -10
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/concepts/__mock__/related_concepts.js.flow +12 -0
- package/esm/models/concepts/__tests__/RelatedConcepts.spec.js.flow +60 -0
- package/esm/models/concepts/__tests__/SourceReferenceModel.spec.js.flow +99 -0
- package/esm/models/content/ContentLinkModel.d.ts +8 -0
- package/esm/models/content/ContentLinkModel.js +31 -1
- package/esm/models/content/ContentLinkModel.js.flow +35 -1
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.d.ts +3 -0
- package/esm/models/content/ContentTOCModel.js +6 -0
- package/esm/models/content/ContentTOCModel.js.flow +6 -0
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/__tests__/ContentIndexModel.spec.js.flow +3 -0
- package/esm/models/content/__tests__/ContentModel.spec.js.flow +5 -5
- package/esm/models/content/__tests__/Formalsource.spec.js.flow +4 -0
- package/esm/models/types.d.ts +6 -0
- package/esm/models/types.js.flow +7 -0
- package/esm/models/types.js.map +1 -1
- package/esm/utils/helpers/__tests__/createHash.spec.js.flow +5 -5
- package/esm/utils/helpers/createHash.d.ts +2 -1
- package/esm/utils/helpers/createHash.js +10 -9
- package/esm/utils/helpers/createHash.js.flow +10 -10
- package/esm/utils/helpers/createHash.js.map +1 -1
- package/lib/constants/Settings.js +2 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.d.ts +15 -0
- package/lib/models/concepts/ConceptLinkModel.js +14 -0
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.d.ts +9 -0
- package/lib/models/concepts/SourceReferenceModel.js +16 -2
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.d.ts +8 -0
- package/lib/models/content/ContentLinkModel.js +31 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.d.ts +3 -0
- package/lib/models/content/ContentTOCModel.js +6 -0
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/types.d.ts +6 -0
- package/lib/models/types.js.map +1 -1
- package/lib/utils/helpers/createHash.d.ts +2 -1
- package/lib/utils/helpers/createHash.js +11 -9
- package/lib/utils/helpers/createHash.js.map +1 -1
- package/package.json +3 -1
- package/src/constants/Settings.js +2 -0
- package/src/models/attributes/__tests__/AttributeContent.spec.js +1 -1
- package/src/models/concepts/ConceptIndexModel.js +3 -1
- package/src/models/concepts/ConceptLinkModel.js +21 -0
- package/src/models/concepts/SourceReferenceModel.js +22 -10
- package/src/models/concepts/__mock__/related_concepts.js +12 -0
- package/src/models/concepts/__mock__/related_concepts_contributions.json +41 -0
- package/src/models/concepts/__mock__/related_concepts_data.json +2292 -0
- package/src/models/concepts/__tests__/RelatedConcepts.spec.js +60 -0
- package/src/models/concepts/__tests__/SourceReferenceModel.spec.js +99 -0
- package/src/models/content/ContentLinkModel.js +35 -1
- package/src/models/content/ContentTOCModel.js +6 -0
- package/src/models/content/__tests__/ContentIndexModel.spec.js +3 -0
- package/src/models/content/__tests__/ContentModel.spec.js +5 -5
- package/src/models/content/__tests__/Formalsource.spec.js +4 -0
- package/src/models/content/__tests__/content-index.json +1 -0
- package/src/models/content/__tests__/formalsource-complete.json +1 -0
- package/src/models/types.js +7 -0
- package/src/utils/helpers/__tests__/createHash.spec.js +5 -5
- package/src/utils/helpers/createHash.js +10 -10
package/lib/models/types.d.ts
CHANGED
|
@@ -155,6 +155,12 @@ type ContentData = {
|
|
|
155
155
|
label?: string | undefined;
|
|
156
156
|
elements: (PropertyElement | TextFragmentElement | ContentElement)[];
|
|
157
157
|
};
|
|
158
|
+
type SectionFragment = {
|
|
159
|
+
sectionId?: string | undefined;
|
|
160
|
+
text: string;
|
|
161
|
+
startOffset: number;
|
|
162
|
+
endOffset: number;
|
|
163
|
+
};
|
|
158
164
|
type ModelOptions = {
|
|
159
165
|
origin?: string | null | undefined;
|
|
160
166
|
contextPath?: string | null | undefined;
|
package/lib/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 BaseFilterModel from \"./filters/BaseFilterModel\";\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 | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\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 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 ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
|
|
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 BaseFilterModel from \"./filters/BaseFilterModel\";\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 | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\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 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 sectionId?: string,\n text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
export function createHash(str: string): number;
|
|
5
5
|
/**
|
|
6
6
|
*/
|
|
7
|
-
export function createHashFromHref(href: Href): number;
|
|
7
|
+
export function createHashFromHref(href: Href, fragment?: SectionFragment): number;
|
|
8
8
|
import Href from "../../models/href/Href";
|
|
9
|
+
import { SectionFragment } from "../../models";
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.createHashFromHref = exports.createHash = void 0;
|
|
8
|
+
var _hashIt = _interopRequireDefault(require("hash-it"));
|
|
7
9
|
/**
|
|
8
10
|
* https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
9
11
|
*/
|
|
10
12
|
const createHash = str => {
|
|
11
|
-
|
|
12
|
-
let hash = 0;
|
|
13
|
-
for (let i = 0; i < str.length; i++) {
|
|
14
|
-
hash = (hash << 5) - hash + str.charCodeAt(i);
|
|
15
|
-
hash = hash & hash;
|
|
16
|
-
}
|
|
17
|
-
return hash;
|
|
13
|
+
return (0, _hashIt.default)(str);
|
|
18
14
|
};
|
|
19
15
|
|
|
20
16
|
/**
|
|
21
17
|
*/
|
|
22
18
|
exports.createHash = createHash;
|
|
23
|
-
const createHashFromHref = href => {
|
|
19
|
+
const createHashFromHref = (href, fragment) => {
|
|
24
20
|
const hrefString = href.hash ? [href.toString(), href.hash].join("#") : href.toString();
|
|
25
|
-
|
|
21
|
+
if (fragment) {
|
|
22
|
+
return (0, _hashIt.default)({
|
|
23
|
+
hrefString,
|
|
24
|
+
fragment
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return (0, _hashIt.default)(hrefString);
|
|
26
28
|
};
|
|
27
29
|
exports.createHashFromHref = createHashFromHref;
|
|
28
30
|
//# sourceMappingURL=createHash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHash.js","names":["
|
|
1
|
+
{"version":3,"file":"createHash.js","names":["_hashIt","_interopRequireDefault","require","createHash","str","hash","exports","createHashFromHref","href","fragment","hrefString","toString","join"],"sources":["../../../src/utils/helpers/createHash.js"],"sourcesContent":["// @flow\nimport hash from \"hash-it\";\n\nimport type Href from \"../../models/href/Href\";\nimport type { SectionFragment } from \"../../models\";\n\n/**\n * https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n */\nconst createHash = (str: string): number => {\n return hash(str);\n};\n\n/**\n */\nconst createHashFromHref = (href: Href, fragment?: SectionFragment): number => {\n const hrefString = href.hash\n ? [href.toString(), href.hash].join(\"#\")\n : href.toString();\n\n if (fragment) {\n return hash({ hrefString, fragment });\n }\n\n return hash(hrefString);\n};\n\nexport { createHash, createHashFromHref };\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA;AACA;AACA;AACA,MAAMC,UAAU,GAAIC,GAAW,IAAa;EAC1C,OAAO,IAAAC,eAAI,EAACD,GAAG,CAAC;AAClB,CAAC;;AAED;AACA;AADAE,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEA,MAAMI,kBAAkB,GAAGA,CAACC,IAAU,EAAEC,QAA0B,KAAa;EAC7E,MAAMC,UAAU,GAAGF,IAAI,CAACH,IAAI,GACxB,CAACG,IAAI,CAACG,QAAQ,CAAC,CAAC,EAAEH,IAAI,CAACH,IAAI,CAAC,CAACO,IAAI,CAAC,GAAG,CAAC,GACtCJ,IAAI,CAACG,QAAQ,CAAC,CAAC;EAEnB,IAAIF,QAAQ,EAAE;IACZ,OAAO,IAAAJ,eAAI,EAAC;MAAEK,UAAU;MAAED;IAAS,CAAC,CAAC;EACvC;EAEA,OAAO,IAAAJ,eAAI,EAACK,UAAU,CAAC;AACzB,CAAC;AAACJ,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.1",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "https://support.beinformed.com",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"clean": "rimraf lib dist esm coverage && npm run clean:proxies",
|
|
28
28
|
"clean:proxies": "node .build/proxies.js --clean",
|
|
29
29
|
"lint": "eslint --cache .",
|
|
30
|
+
"lint:fix": "eslint --cache . --fix",
|
|
30
31
|
"prettier": "prettier --write \"./src/**/*.js\"",
|
|
31
32
|
"flow": "flow",
|
|
32
33
|
"flow:ci": "flow check",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"dequal": "^2.0.3",
|
|
77
78
|
"file-size": "^1.0.0",
|
|
78
79
|
"format-message": "^6.2.4",
|
|
80
|
+
"hash-it": "^6.0.0",
|
|
79
81
|
"html-entities": "^2.6.0",
|
|
80
82
|
"iban": "^0.0.14",
|
|
81
83
|
"js-cookie": "^3.0.5",
|
|
@@ -205,7 +205,7 @@ describe("AttributeContent", () => {
|
|
|
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(4345174491453);
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
it("can handle referredSections", () => {
|
|
@@ -67,7 +67,9 @@ export default class ConceptIndexModel extends ResourceModel {
|
|
|
67
67
|
static isApplicableModel(data: ModularUIResponse): boolean {
|
|
68
68
|
const resourceType = data.contributions?.resourcetype;
|
|
69
69
|
return (
|
|
70
|
-
resourceType === "ConceptSearch" ||
|
|
70
|
+
resourceType === "ConceptSearch" ||
|
|
71
|
+
resourceType === "relatedConcepts" ||
|
|
72
|
+
resourceType === "RelatedConcepts"
|
|
71
73
|
);
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -12,6 +12,13 @@ import type {
|
|
|
12
12
|
} from "../types";
|
|
13
13
|
import type Href from "../href/Href";
|
|
14
14
|
|
|
15
|
+
type SectionFragment = {
|
|
16
|
+
sectionId: string,
|
|
17
|
+
text: string,
|
|
18
|
+
startOffset: number,
|
|
19
|
+
endOffset: number,
|
|
20
|
+
};
|
|
21
|
+
|
|
15
22
|
/**
|
|
16
23
|
* Link to a concept
|
|
17
24
|
*/
|
|
@@ -184,4 +191,18 @@ export default class ConceptLinkModel
|
|
|
184
191
|
isOfConceptType(conceptTypeId: string): boolean {
|
|
185
192
|
return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;
|
|
186
193
|
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
*
|
|
197
|
+
*/
|
|
198
|
+
get modelCategory(): string {
|
|
199
|
+
return this.getData("modelCategory");
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
*
|
|
204
|
+
*/
|
|
205
|
+
get fragment(): SectionFragment {
|
|
206
|
+
return this.getData("sectionFragment");
|
|
207
|
+
}
|
|
187
208
|
}
|
|
@@ -4,7 +4,7 @@ import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
|
4
4
|
import ContentLinkModel from "../content/ContentLinkModel";
|
|
5
5
|
import Href from "../href/Href";
|
|
6
6
|
import { getBasePathModularUI } from "../../constants";
|
|
7
|
-
import type { ModelOptions } from "../types";
|
|
7
|
+
import type { ModelOptions, SectionFragment } from "../types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*/
|
|
@@ -31,10 +31,12 @@ class SourceReferenceModel {
|
|
|
31
31
|
/**
|
|
32
32
|
*/
|
|
33
33
|
get link(): ContentLinkModel {
|
|
34
|
-
const section =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const section =
|
|
35
|
+
this.fragment?.sectionId ||
|
|
36
|
+
this._sourceReference._links.self.href.replace(
|
|
37
|
+
`${this._sourceReference._links.content.href}/`,
|
|
38
|
+
"",
|
|
39
|
+
);
|
|
38
40
|
|
|
39
41
|
return new ContentLinkModel(
|
|
40
42
|
{
|
|
@@ -49,11 +51,7 @@ class SourceReferenceModel {
|
|
|
49
51
|
/**
|
|
50
52
|
*/
|
|
51
53
|
get selfhref(): Href {
|
|
52
|
-
return
|
|
53
|
-
this._sourceReference._links.self.href,
|
|
54
|
-
"SourceReference",
|
|
55
|
-
this._modelOptions,
|
|
56
|
-
);
|
|
54
|
+
return this.link.selfhref;
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
/**
|
|
@@ -74,11 +72,25 @@ class SourceReferenceModel {
|
|
|
74
72
|
return this._sourceReference.sourceLabel;
|
|
75
73
|
}
|
|
76
74
|
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
get sourceAbbreviation(): string {
|
|
79
|
+
return this._sourceReference.sourceAbbreviation;
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
83
|
*/
|
|
79
84
|
get referenceHash(): number {
|
|
80
85
|
return createHashFromHref(this.selfhref);
|
|
81
86
|
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
get fragment(): SectionFragment | void {
|
|
92
|
+
return this._sourceReference.sectionFragment;
|
|
93
|
+
}
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
export default SourceReferenceModel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ModularUIResponse from "../../../modularui/ModularUIResponse";
|
|
2
|
+
import data from "./related_concepts_data.json";
|
|
3
|
+
import contributions from "./related_concepts_contributions.json";
|
|
4
|
+
import ConceptIndexModel from "../ConceptIndexModel";
|
|
5
|
+
|
|
6
|
+
const response = ModularUIResponse.create({
|
|
7
|
+
key: "concept",
|
|
8
|
+
data,
|
|
9
|
+
contributions,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const relatedConcepts = new ConceptIndexModel(response);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"RelatedConceptsOfContentSection": {
|
|
3
|
+
"label": "Related concepts of content",
|
|
4
|
+
"resourcetype": "RelatedConcepts",
|
|
5
|
+
"filter": [
|
|
6
|
+
{
|
|
7
|
+
"entryDate": {
|
|
8
|
+
"type": "datefilter",
|
|
9
|
+
"label": "Entry date",
|
|
10
|
+
"format": "dd-MM-yyyy",
|
|
11
|
+
"formatlabel": "dd-mm-yyyy",
|
|
12
|
+
"operator": "greater-than-or-equal"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"modelCategory": {
|
|
17
|
+
"type": "stringfilter",
|
|
18
|
+
"label": "Model category",
|
|
19
|
+
"multiplechoice": false
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"results": {
|
|
24
|
+
"concept": {
|
|
25
|
+
"metadata": {
|
|
26
|
+
"_id": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"attributes": [
|
|
31
|
+
{
|
|
32
|
+
"label": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"label": "concept label"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|