@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.
Files changed (80) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/constants/Settings.js +2 -1
  3. package/esm/constants/Settings.js.flow +2 -0
  4. package/esm/constants/Settings.js.map +1 -1
  5. package/esm/models/attributes/__tests__/AttributeContent.spec.js.flow +1 -1
  6. package/esm/models/concepts/ConceptIndexModel.js +1 -1
  7. package/esm/models/concepts/ConceptIndexModel.js.flow +3 -1
  8. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  9. package/esm/models/concepts/ConceptLinkModel.d.ts +15 -0
  10. package/esm/models/concepts/ConceptLinkModel.js +14 -0
  11. package/esm/models/concepts/ConceptLinkModel.js.flow +21 -0
  12. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  13. package/esm/models/concepts/SourceReferenceModel.d.ts +9 -0
  14. package/esm/models/concepts/SourceReferenceModel.js +16 -2
  15. package/esm/models/concepts/SourceReferenceModel.js.flow +22 -10
  16. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  17. package/esm/models/concepts/__mock__/related_concepts.js.flow +12 -0
  18. package/esm/models/concepts/__tests__/RelatedConcepts.spec.js.flow +60 -0
  19. package/esm/models/concepts/__tests__/SourceReferenceModel.spec.js.flow +99 -0
  20. package/esm/models/content/ContentLinkModel.d.ts +8 -0
  21. package/esm/models/content/ContentLinkModel.js +31 -1
  22. package/esm/models/content/ContentLinkModel.js.flow +35 -1
  23. package/esm/models/content/ContentLinkModel.js.map +1 -1
  24. package/esm/models/content/ContentTOCModel.d.ts +3 -0
  25. package/esm/models/content/ContentTOCModel.js +6 -0
  26. package/esm/models/content/ContentTOCModel.js.flow +6 -0
  27. package/esm/models/content/ContentTOCModel.js.map +1 -1
  28. package/esm/models/content/__tests__/ContentIndexModel.spec.js.flow +3 -0
  29. package/esm/models/content/__tests__/ContentModel.spec.js.flow +5 -5
  30. package/esm/models/content/__tests__/Formalsource.spec.js.flow +4 -0
  31. package/esm/models/types.d.ts +6 -0
  32. package/esm/models/types.js.flow +7 -0
  33. package/esm/models/types.js.map +1 -1
  34. package/esm/utils/helpers/__tests__/createHash.spec.js.flow +5 -5
  35. package/esm/utils/helpers/createHash.d.ts +2 -1
  36. package/esm/utils/helpers/createHash.js +10 -9
  37. package/esm/utils/helpers/createHash.js.flow +10 -10
  38. package/esm/utils/helpers/createHash.js.map +1 -1
  39. package/lib/constants/Settings.js +2 -1
  40. package/lib/constants/Settings.js.map +1 -1
  41. package/lib/models/concepts/ConceptIndexModel.js +1 -1
  42. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  43. package/lib/models/concepts/ConceptLinkModel.d.ts +15 -0
  44. package/lib/models/concepts/ConceptLinkModel.js +14 -0
  45. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  46. package/lib/models/concepts/SourceReferenceModel.d.ts +9 -0
  47. package/lib/models/concepts/SourceReferenceModel.js +16 -2
  48. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  49. package/lib/models/content/ContentLinkModel.d.ts +8 -0
  50. package/lib/models/content/ContentLinkModel.js +31 -1
  51. package/lib/models/content/ContentLinkModel.js.map +1 -1
  52. package/lib/models/content/ContentTOCModel.d.ts +3 -0
  53. package/lib/models/content/ContentTOCModel.js +6 -0
  54. package/lib/models/content/ContentTOCModel.js.map +1 -1
  55. package/lib/models/types.d.ts +6 -0
  56. package/lib/models/types.js.map +1 -1
  57. package/lib/utils/helpers/createHash.d.ts +2 -1
  58. package/lib/utils/helpers/createHash.js +11 -9
  59. package/lib/utils/helpers/createHash.js.map +1 -1
  60. package/package.json +3 -1
  61. package/src/constants/Settings.js +2 -0
  62. package/src/models/attributes/__tests__/AttributeContent.spec.js +1 -1
  63. package/src/models/concepts/ConceptIndexModel.js +3 -1
  64. package/src/models/concepts/ConceptLinkModel.js +21 -0
  65. package/src/models/concepts/SourceReferenceModel.js +22 -10
  66. package/src/models/concepts/__mock__/related_concepts.js +12 -0
  67. package/src/models/concepts/__mock__/related_concepts_contributions.json +41 -0
  68. package/src/models/concepts/__mock__/related_concepts_data.json +2292 -0
  69. package/src/models/concepts/__tests__/RelatedConcepts.spec.js +60 -0
  70. package/src/models/concepts/__tests__/SourceReferenceModel.spec.js +99 -0
  71. package/src/models/content/ContentLinkModel.js +35 -1
  72. package/src/models/content/ContentTOCModel.js +6 -0
  73. package/src/models/content/__tests__/ContentIndexModel.spec.js +3 -0
  74. package/src/models/content/__tests__/ContentModel.spec.js +5 -5
  75. package/src/models/content/__tests__/Formalsource.spec.js +4 -0
  76. package/src/models/content/__tests__/content-index.json +1 -0
  77. package/src/models/content/__tests__/formalsource-complete.json +1 -0
  78. package/src/models/types.js +7 -0
  79. package/src/utils/helpers/__tests__/createHash.spec.js +5 -5
  80. package/src/utils/helpers/createHash.js +10 -10
@@ -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;
@@ -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
- if (!str) return 0;
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
- return createHash(hrefString);
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":["createHash","str","hash","i","length","charCodeAt","exports","createHashFromHref","href","hrefString","toString","join"],"sources":["../../../src/utils/helpers/createHash.js"],"sourcesContent":["// @flow\nimport type Href from \"../../models/href/Href\";\n\n/**\n * https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n */\nconst createHash = (str: string): number => {\n if (!str) return 0;\n\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i);\n hash = hash & hash;\n }\n return hash;\n};\n\n/**\n */\nconst createHashFromHref = (href: Href): number => {\n const hrefString = href.hash\n ? [href.toString(), href.hash].join(\"#\")\n : href.toString();\n\n return createHash(hrefString);\n};\n\nexport { createHash, createHashFromHref };\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA,MAAMA,UAAU,GAAIC,GAAW,IAAa;EAC1C,IAAI,CAACA,GAAG,EAAE,OAAO,CAAC;EAElB,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnCD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGD,GAAG,CAACI,UAAU,CAACF,CAAC,CAAC;IAC7CD,IAAI,GAAGA,IAAI,GAAGA,IAAI;EACpB;EACA,OAAOA,IAAI;AACb,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,UAAA,GAAAA,UAAA;AAEA,MAAMO,kBAAkB,GAAIC,IAAU,IAAa;EACjD,MAAMC,UAAU,GAAGD,IAAI,CAACN,IAAI,GACxB,CAACM,IAAI,CAACE,QAAQ,CAAC,CAAC,EAAEF,IAAI,CAACN,IAAI,CAAC,CAACS,IAAI,CAAC,GAAG,CAAC,GACtCH,IAAI,CAACE,QAAQ,CAAC,CAAC;EAEnB,OAAOV,UAAU,CAACS,UAAU,CAAC;AAC/B,CAAC;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
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.61.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",
@@ -123,6 +123,8 @@ const defaultSettings: { [name: string]: Setting } = {
123
123
  HIDE_WHEN_EMPTY_IGNORE_TASKS: false,
124
124
 
125
125
  SHOW_AVATARS: true,
126
+
127
+ COMPLETE_SOURCE: false,
126
128
  };
127
129
 
128
130
  let settings = defaultSettings;
@@ -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(-1954774597);
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" || resourceType === "relatedConcepts"
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 = this._sourceReference._links.self.href.replace(
35
- `${this._sourceReference._links.content.href}/`,
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 new Href(
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
+ }