@beinformed/ui 1.65.2 → 1.65.4

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 (96) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/esm/hooks/useList.js +4 -4
  3. package/esm/hooks/useList.js.flow +5 -5
  4. package/esm/hooks/useList.js.map +1 -1
  5. package/esm/models/concepts/ConceptIndexModel.js +3 -2
  6. package/esm/models/concepts/ConceptIndexModel.js.flow +5 -4
  7. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  8. package/esm/models/content/ContentIndexModel.js +7 -1
  9. package/esm/models/content/ContentIndexModel.js.flow +8 -3
  10. package/esm/models/content/ContentIndexModel.js.map +1 -1
  11. package/esm/models/content/ContentModel.js +3 -2
  12. package/esm/models/content/ContentModel.js.flow +4 -3
  13. package/esm/models/content/ContentModel.js.map +1 -1
  14. package/esm/models/content/ContentTOCModel.js +6 -2
  15. package/esm/models/content/ContentTOCModel.js.flow +6 -2
  16. package/esm/models/content/ContentTOCModel.js.map +1 -1
  17. package/esm/models/filters/AssignmentFilterModel.js +54 -26
  18. package/esm/models/filters/AssignmentFilterModel.js.flow +68 -37
  19. package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
  20. package/esm/models/filters/BaseFilterModel.js +0 -110
  21. package/esm/models/filters/BaseFilterModel.js.flow +2 -133
  22. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  23. package/esm/models/filters/ConceptIndexFilterModel.js +2 -2
  24. package/esm/models/filters/ConceptIndexFilterModel.js.flow +2 -2
  25. package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
  26. package/esm/models/filters/FilterModel.js +117 -2
  27. package/esm/models/filters/FilterModel.js.flow +146 -1
  28. package/esm/models/filters/FilterModel.js.map +1 -1
  29. package/esm/models/filters/RangeFilterModel.js +2 -2
  30. package/esm/models/filters/RangeFilterModel.js.flow +2 -2
  31. package/esm/models/filters/RangeFilterModel.js.map +1 -1
  32. package/esm/models/href/Href.js +1 -1
  33. package/esm/models/href/Href.js.flow +1 -1
  34. package/esm/models/href/Href.js.map +1 -1
  35. package/esm/models/list/ListModel.js +5 -1
  36. package/esm/models/list/ListModel.js.flow +7 -3
  37. package/esm/models/list/ListModel.js.map +1 -1
  38. package/esm/models/sorting/SortOptionModel.js +7 -0
  39. package/esm/models/sorting/SortOptionModel.js.flow +7 -0
  40. package/esm/models/sorting/SortOptionModel.js.map +1 -1
  41. package/esm/models/sorting/SortingModel.js +14 -2
  42. package/esm/models/sorting/SortingModel.js.flow +14 -2
  43. package/esm/models/sorting/SortingModel.js.map +1 -1
  44. package/esm/models/types.js.flow +1 -3
  45. package/esm/models/types.js.map +1 -1
  46. package/esm/redux/_modularui/ModularUIConnector.js +7 -6
  47. package/esm/redux/_modularui/ModularUIConnector.js.flow +6 -4
  48. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  49. package/lib/hooks/useList.js +4 -4
  50. package/lib/hooks/useList.js.map +1 -1
  51. package/lib/models/concepts/ConceptIndexModel.js +3 -2
  52. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  53. package/lib/models/content/ContentIndexModel.js +6 -1
  54. package/lib/models/content/ContentIndexModel.js.map +1 -1
  55. package/lib/models/content/ContentModel.js +3 -2
  56. package/lib/models/content/ContentModel.js.map +1 -1
  57. package/lib/models/content/ContentTOCModel.js +6 -2
  58. package/lib/models/content/ContentTOCModel.js.map +1 -1
  59. package/lib/models/filters/AssignmentFilterModel.js +54 -26
  60. package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
  61. package/lib/models/filters/BaseFilterModel.js +0 -109
  62. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  63. package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
  64. package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
  65. package/lib/models/filters/FilterModel.js +117 -1
  66. package/lib/models/filters/FilterModel.js.map +1 -1
  67. package/lib/models/filters/RangeFilterModel.js +2 -2
  68. package/lib/models/filters/RangeFilterModel.js.map +1 -1
  69. package/lib/models/href/Href.js +1 -1
  70. package/lib/models/href/Href.js.map +1 -1
  71. package/lib/models/list/ListModel.js +5 -1
  72. package/lib/models/list/ListModel.js.map +1 -1
  73. package/lib/models/sorting/SortOptionModel.js +7 -0
  74. package/lib/models/sorting/SortOptionModel.js.map +1 -1
  75. package/lib/models/sorting/SortingModel.js +14 -2
  76. package/lib/models/sorting/SortingModel.js.map +1 -1
  77. package/lib/models/types.js.map +1 -1
  78. package/lib/redux/_modularui/ModularUIConnector.js +7 -6
  79. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  80. package/package.json +6 -6
  81. package/src/hooks/useList.js +5 -5
  82. package/src/models/concepts/ConceptIndexModel.js +5 -4
  83. package/src/models/content/ContentIndexModel.js +8 -3
  84. package/src/models/content/ContentModel.js +4 -3
  85. package/src/models/content/ContentTOCModel.js +6 -2
  86. package/src/models/filters/AssignmentFilterModel.js +68 -37
  87. package/src/models/filters/BaseFilterModel.js +2 -133
  88. package/src/models/filters/ConceptIndexFilterModel.js +2 -2
  89. package/src/models/filters/FilterModel.js +146 -1
  90. package/src/models/filters/RangeFilterModel.js +2 -2
  91. package/src/models/href/Href.js +1 -1
  92. package/src/models/list/ListModel.js +7 -3
  93. package/src/models/sorting/SortOptionModel.js +7 -0
  94. package/src/models/sorting/SortingModel.js +14 -2
  95. package/src/models/types.js +1 -3
  96. package/src/redux/_modularui/ModularUIConnector.js +6 -4
@@ -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 sections?: 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 text: string,\n startOffset: number,\n endOffset: number,\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 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 | AssignmentFilterModel\n | FilterModel\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 sections?: 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 text: string,\n startOffset: number,\n endOffset: number,\n};\n\nexport type ModelOptions = {\n origin?: ?string,\n contextPath?: ?string,\n};\n"],"mappings":"","ignoreList":[]}
@@ -88,12 +88,13 @@ const modularUIConnector = (name, resource, options = {
88
88
  }, [dispatch, doReload, url, modelKey]);
89
89
 
90
90
  // Remove model when hoc unloads
91
- (0, _react.useEffect)(() => {
92
- return () => {
93
- if (finalRemoveOnUnmount) {
94
- dispatch((0, _ModularUIActions.removeModelByKey)(modelKey));
95
- }
96
- };
91
+ (0, _react.useEffect)(
92
+ // prettier-ignore
93
+ () => () => {
94
+ //NOSONAR
95
+ if (finalRemoveOnUnmount) {
96
+ dispatch((0, _ModularUIActions.removeModelByKey)(modelKey));
97
+ }
97
98
  }, [dispatch, modelKey, finalRemoveOnUnmount]);
98
99
 
99
100
  // Create new properties object to inject modularui properties to own props
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n // explicit property for removeOnMount overwrite the setting\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (finalRemoveOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey, finalRemoveOnUnmount]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry?.model ?? null,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,UAAA,GAAAL,sBAAA,CAAAL,OAAA;AAAoD,IAAAW,WAAA,GAAAX,OAAA;AAcpD,MAAMY,sBAAsB,GAAIC,UAAkB,IAAK;EACrD,IACE,aAAa,IAAIA,UAAU,IAC3BA,UAAU,CAACC,WAAW,YAAYC,kBAAS,EAC3C;IACA,OAAO;MACL,GAAGF,UAAU;MACbG,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYF,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C,QAAQ,EAAEC,OAAO,CAACzB,UAAU,CAAC;QAC7BmB,MAAM;QACNO,cAAc,EAAElB,WAAW;QAC3BD,WAAW,EAAEF;MACf,CAAC;MAED,oBAAO,IAAAnC,WAAA,CAAAyD,GAAA,EAACxC,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMgC;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDjC,gBAAgB,CAACS,WAAW,GAAG,gBAAgB,IAAAC,qBAAc,EAC3DV,gBAAgB,EAChBP,IACF,CAAC,EAAE;IAEH,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalD,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n // explicit property for removeOnMount overwrite the setting\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(\n // prettier-ignore\n () => () => { //NOSONAR\n if (finalRemoveOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n },\n [dispatch, modelKey, finalRemoveOnUnmount],\n );\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry?.model ?? null,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,UAAA,GAAAL,sBAAA,CAAAL,OAAA;AAAoD,IAAAW,WAAA,GAAAX,OAAA;AAcpD,MAAM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,CAAClB,QAAQ,GAAGgB,UAAU,EAAEG,KAAK,IAAI,IAAI;QACrCV,QAAQ;QACR6B,MAAM,EAAEtB,UAAU,EAAEsB,MAAM,IAAI,IAAI;QAClCC,gBAAgB,EAAEvB,UAAU,EAAEuB,gBAAgB,IAAI,IAAI;QACtDC,QAAQ,EAAEC,OAAO,CAACzB,UAAU,CAAC;QAC7BmB,MAAM;QACNO,cAAc,EAAElB,WAAW;QAC3BD,WAAW,EAAEF;MACf,CAAC;MAED,oBAAO,IAAAnC,WAAA,CAAAyD,GAAA,EAACxC,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMgC;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDjC,gBAAgB,CAACS,WAAW,GAAG,gBAAgB,IAAAC,qBAAc,EAC3DV,gBAAgB,EAChBP,IACF,CAAC,EAAE;IAEH,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalD,kBAAkB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.65.2",
3
+ "version": "1.65.4",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "https://support.beinformed.com",
@@ -71,7 +71,7 @@
71
71
  "dependencies": {
72
72
  "@babel/runtime-corejs3": "^7.28.4",
73
73
  "@date-fns/tz": "^1.4.1",
74
- "baseline-browser-mapping": "^2.9.7",
74
+ "baseline-browser-mapping": "^2.9.11",
75
75
  "big.js": "^7.0.1",
76
76
  "date-fns": "^4.1.0",
77
77
  "deepmerge": "^4.3.1",
@@ -99,8 +99,8 @@
99
99
  "@babel/preset-env": "^7.28.5",
100
100
  "@babel/preset-flow": "^7.27.1",
101
101
  "@babel/preset-react": "^7.28.5",
102
- "@commitlint/cli": "^19.8.1",
103
- "@commitlint/config-conventional": "^19.8.1",
102
+ "@commitlint/cli": "^20.3.0",
103
+ "@commitlint/config-conventional": "^20.3.0",
104
104
  "@testing-library/dom": "^10.4.1",
105
105
  "@testing-library/react": "^16.3.1",
106
106
  "auditjs": "^4.0.47",
@@ -122,7 +122,7 @@
122
122
  "flow-bin": "^0.200.1",
123
123
  "flow-copy-source": "^2.0.9",
124
124
  "flow-typed": "^3.9.0",
125
- "hermes-eslint": "^0.33.0",
125
+ "hermes-eslint": "^0.33.2",
126
126
  "history": "^4.0.0",
127
127
  "husky": "^9.1.7",
128
128
  "jest": "^30.2.0",
@@ -130,7 +130,7 @@
130
130
  "jest-junit": "^16.0.0",
131
131
  "jest-sonar-reporter": "^2.0.0",
132
132
  "jscodeshift": "^17.3.0",
133
- "lint-staged": "^15.5.1",
133
+ "lint-staged": "^16.2.7",
134
134
  "polished": "^4.3.1",
135
135
  "prettier": "^3.7.4",
136
136
  "react": "^19.2.3",
@@ -12,7 +12,7 @@ import type { HookOptions } from "./useModularUIBasic";
12
12
  import { useHistory } from "react-router";
13
13
 
14
14
  type ListNavigationHook = {
15
- fetch: (list: ListModel, resetPage?: boolean) => void,
15
+ update: (list: ListModel, resetPage?: boolean) => void,
16
16
  };
17
17
 
18
18
  /**
@@ -58,7 +58,7 @@ export const useListNavigation = (): ListNavigationHook => {
58
58
  const history = useHistory();
59
59
  const dispatch = useDispatch();
60
60
 
61
- const fetch = (list: ListModel, resetPage: boolean = false) => {
61
+ const update = (list: ListModel, resetPage: boolean = false) => {
62
62
  const listHref = list.selfhref;
63
63
  if (resetPage) {
64
64
  listHref.page = null;
@@ -66,7 +66,7 @@ export const useListNavigation = (): ListNavigationHook => {
66
66
 
67
67
  if (list.requestMethod === HTTP_METHODS.POST) {
68
68
  history.push({ search: listHref.querystring, state: list.formdata });
69
- return dispatch(
69
+ dispatch(
70
70
  loadModularUI(list.connectKey, listHref, {
71
71
  method: HTTP_METHODS.POST,
72
72
  data: list.formdata,
@@ -75,7 +75,7 @@ export const useListNavigation = (): ListNavigationHook => {
75
75
  );
76
76
  } else {
77
77
  history.push({ search: listHref.querystring });
78
- return dispatch(
78
+ dispatch(
79
79
  loadModularUI(list.connectKey, listHref, {
80
80
  method: HTTP_METHODS.GET,
81
81
  targetModel: ListModel,
@@ -85,6 +85,6 @@ export const useListNavigation = (): ListNavigationHook => {
85
85
  };
86
86
 
87
87
  return {
88
- fetch,
88
+ update,
89
89
  };
90
90
  };
@@ -129,14 +129,15 @@ export default class ConceptIndexModel extends ResourceModel {
129
129
  /**
130
130
  * Retrieve modelcatalog.js of content toc
131
131
  */
132
- get entryDate(): string | null {
132
+ get entryDate(): ISO_DATE | null {
133
133
  const timeversionFilter = this.filterCollection.getFilterByAttributeKey(
134
134
  TIMEVERSION_FILTER_NAME,
135
135
  );
136
- if (timeversionFilter && timeversionFilter.attribute) {
137
- return timeversionFilter.attribute.value;
138
- }
139
136
 
137
+ const date = timeversionFilter?.value;
138
+ if (typeof date === "string") {
139
+ return date;
140
+ }
140
141
  return null;
141
142
  }
142
143
 
@@ -6,10 +6,11 @@ import ContentLinkModel from "./ContentLinkModel";
6
6
  import Href from "../href/Href";
7
7
  import ChoiceAttributeModel from "../attributes/ChoiceAttributeModel";
8
8
 
9
- import type { FilterType, ModularUIModel } from "../types";
9
+ import type { ModularUIModel } from "../types";
10
10
  import type { ModularUIResponse } from "../../modularui";
11
11
  import type LinkModel from "../links/LinkModel";
12
12
  import type ErrorResponse from "../error/ErrorResponse";
13
+ import ConceptIndexFilterModel from "../filters/ConceptIndexFilterModel";
13
14
 
14
15
  /**
15
16
  * Get Index of concepts, to filter model catalog
@@ -109,8 +110,12 @@ export default class ContentIndexModel extends ResourceModel {
109
110
  /**
110
111
  * Get index filter
111
112
  */
112
- get indexfilter(): FilterType | null {
113
- return this._filterCollection.getFilterByAttributeKey("index");
113
+ get indexfilter(): ConceptIndexFilterModel | null {
114
+ const indexFilter = this._filterCollection.getFilterByAttributeKey("index");
115
+ if (indexFilter instanceof ConceptIndexFilterModel) {
116
+ return indexFilter;
117
+ }
118
+ return null;
114
119
  }
115
120
 
116
121
  /**
@@ -110,10 +110,11 @@ export default class ContentModel extends ResourceModel {
110
110
  const entryDateFilter = this.filterCollection?.getFilterByAttributeKey(
111
111
  TIMEVERSION_FILTER_NAME,
112
112
  );
113
- if (entryDateFilter && entryDateFilter.attribute) {
114
- return entryDateFilter.attribute.value;
115
- }
116
113
 
114
+ const date = entryDateFilter?.value;
115
+ if (typeof date === "string") {
116
+ return date;
117
+ }
117
118
  return null;
118
119
  }
119
120
 
@@ -220,7 +220,11 @@ export default class ContentTOCModel extends ResourceModel {
220
220
  TIMEVERSION_FILTER_NAME,
221
221
  );
222
222
 
223
- return timeversionFilter?.attribute?.value ?? null;
223
+ const date = timeversionFilter?.value;
224
+ if (typeof date === "string") {
225
+ return date;
226
+ }
227
+ return null;
224
228
  }
225
229
 
226
230
  /**
@@ -228,6 +232,6 @@ export default class ContentTOCModel extends ResourceModel {
228
232
  get isCompleteSource(): boolean {
229
233
  const completeFilter =
230
234
  this.filterCollection.getFilterByAttributeKey("complete");
231
- return completeFilter?.attribute?.value === "true";
235
+ return completeFilter?.value === "true";
232
236
  }
233
237
  }
@@ -3,13 +3,14 @@ import BaseFilterModel from "../filters/BaseFilterModel";
3
3
 
4
4
  import type { AttributeType, ModelOptions } from "../types";
5
5
  import { IllegalStateException } from "../../exceptions";
6
+ import createAttribute from "../attributes/_createAttribute";
6
7
  /**
7
8
  * Assignment filter consists of two filters: assignment type and user filter
8
9
  */
9
10
  export default class AssignmentFilterModel extends BaseFilterModel {
10
11
  _listKey: string;
11
- _assignmenttype: ?AttributeType;
12
- _user: ?AttributeType;
12
+ _assignmenttype: AttributeType;
13
+ _user: AttributeType;
13
14
 
14
15
  /**
15
16
  * Construct an assignment filter
@@ -31,29 +32,16 @@ export default class AssignmentFilterModel extends BaseFilterModel {
31
32
  return this.data.name;
32
33
  }
33
34
 
34
- /**
35
- * Getting key of the list these filters apply to
36
- */
37
- get listkey(): string {
38
- return this._listKey;
39
- }
40
-
41
- /**
42
- * Set key of list this filter belongs to
43
- */
44
- set listkey(key: string) {
45
- this._listKey = key;
46
- }
47
-
48
35
  /**
49
36
  */
50
37
  get contextid(): string {
51
38
  return this.getContribution("contextid", "");
52
39
  }
40
+
53
41
  /**
54
42
  * Creates an assignmenttype model when assignmenttype json is present
55
43
  */
56
- createAssignmentTypeModel(): ?AttributeType {
44
+ createAssignmentTypeModel(): AttributeType {
57
45
  const key = `${this.contextid}ASSIGNMENTTYPE`;
58
46
  const assignmentTypeData = this.data[key];
59
47
 
@@ -71,22 +59,23 @@ export default class AssignmentFilterModel extends BaseFilterModel {
71
59
 
72
60
  const assignmentTypeContributions = {
73
61
  ...this.contributions[key],
62
+ type: "choice",
74
63
  enumerated: true,
75
64
  optionMode: assignmentTypeData._links ? "lookup" : "static",
76
65
  };
77
66
 
78
- return this.createAttribute(
79
- "choice",
67
+ return createAttribute(
80
68
  assignmentTypeData.name || assignmentTypeData.param,
81
69
  assignmentTypeData,
82
70
  assignmentTypeContributions,
71
+ this.modelOptions,
83
72
  );
84
73
  }
85
74
 
86
75
  /**
87
76
  * Creates an assignmenttype model when userkey json is present
88
77
  */
89
- createUserModel(): ?AttributeType {
78
+ createUserModel(): AttributeType {
90
79
  const key = `${this.contextid}USERKEY`;
91
80
  const userData = this.data[key];
92
81
 
@@ -98,28 +87,30 @@ export default class AssignmentFilterModel extends BaseFilterModel {
98
87
 
99
88
  const userContributions = {
100
89
  ...this.contributions[key],
90
+ type: "choice",
91
+ enumerated: true,
101
92
  optionMode: userData._links ? "lookup" : "static",
102
93
  };
103
94
 
104
- return this.createAttribute(
105
- "choice",
95
+ return createAttribute(
106
96
  userData.name || userData.param,
107
97
  userData,
108
98
  userContributions,
99
+ this.modelOptions,
109
100
  );
110
101
  }
111
102
 
112
103
  /**
113
104
  * The assignment filter consists of two part. This method return the assignment type attribute
114
105
  */
115
- get assignmenttype(): ?AttributeType {
106
+ get assignmenttype(): AttributeType {
116
107
  return this._assignmenttype;
117
108
  }
118
109
 
119
110
  /**
120
111
  * The assignment filter consists of two part. This method return the user identifier attribute
121
112
  */
122
- get user(): ?AttributeType {
113
+ get user(): AttributeType {
123
114
  return this._user;
124
115
  }
125
116
 
@@ -127,20 +118,45 @@ export default class AssignmentFilterModel extends BaseFilterModel {
127
118
  * Getting the parameters of this filter
128
119
  */
129
120
  get params(): Array<{ name: string, value: ?string }> {
130
- if (this.assignmenttype && this.user) {
131
- return [
132
- {
133
- name: this.assignmenttype.name,
134
- value: this.assignmenttype.value,
135
- },
136
- {
137
- name: this.user.name,
138
- value: this.user.value,
139
- },
140
- ];
141
- }
121
+ return [
122
+ {
123
+ name: this.assignmenttype.name,
124
+ value: this.assignmenttype.value,
125
+ },
126
+ {
127
+ name: this.user.name,
128
+ value: this.user.value,
129
+ },
130
+ ];
131
+ }
142
132
 
143
- return [];
133
+ /**
134
+ */
135
+ get value(): { [string]: any } {
136
+ return {
137
+ [this.assignmenttype.name]: this.assignmenttype.value,
138
+ [this.user.name]: this.user.value,
139
+ };
140
+ }
141
+
142
+ /**
143
+ */
144
+ get inputvalue(): { [string]: any } {
145
+ return {
146
+ [this.assignmenttype.name]: this.assignmenttype.inputvalue,
147
+ [this.user.name]: this.user.inputvalue,
148
+ };
149
+ }
150
+
151
+ /**
152
+ * Indicates if the filter has a value.
153
+ */
154
+ hasValue(): boolean {
155
+ return (
156
+ (this.assignmenttype.value !== null &&
157
+ this.assignmenttype.value !== "") ||
158
+ (this.user.value !== null && this.user.value !== "")
159
+ );
144
160
  }
145
161
 
146
162
  /**
@@ -192,4 +208,19 @@ export default class AssignmentFilterModel extends BaseFilterModel {
192
208
  this.user.isValid
193
209
  );
194
210
  }
211
+
212
+ /**
213
+ */
214
+ get readonlyvalue(): { [string]: string } {
215
+ return {
216
+ [this.assignmenttype.name]: this.assignmenttype.readonlyvalue,
217
+ [this.user.name]: this.user.readonlyvalue,
218
+ };
219
+ }
220
+
221
+ /**
222
+ */
223
+ get formdata(): { [string]: any } | null {
224
+ return this.value;
225
+ }
195
226
  }
@@ -1,19 +1,17 @@
1
1
  // @flow
2
2
  import BaseModel from "../base/BaseModel";
3
- import createAttribute from "../attributes/_createAttribute";
3
+
4
4
  import {
5
5
  PARAMETER_SEPARATOR,
6
6
  PARAMETER_TYPES,
7
7
  } from "../../constants/Constants";
8
8
 
9
- import type { AttributeType, FilterType, ModelOptions } from "../types";
10
- import { IllegalStateException } from "../../exceptions";
9
+ import type { ModelOptions } from "../types";
11
10
 
12
11
  /**
13
12
  * Base class for filters
14
13
  */
15
14
  export default class BaseFilterModel extends BaseModel {
16
- _attribute: AttributeType | null = null;
17
15
  _context: Object;
18
16
  _listKey: string;
19
17
 
@@ -26,13 +24,6 @@ export default class BaseFilterModel extends BaseModel {
26
24
  ) {
27
25
  super(data, contributions, modelOptions);
28
26
 
29
- this._attribute = this.createAttribute(
30
- this.type,
31
- this.param,
32
- this.data,
33
- this.contributions,
34
- );
35
-
36
27
  if (this.contributions.listKey) {
37
28
  this.listkey = this.contributions.listKey;
38
29
  }
@@ -60,30 +51,6 @@ export default class BaseFilterModel extends BaseModel {
60
51
  }
61
52
  }
62
53
 
63
- /**
64
- * Create attribute through the attribute factory. Create type based on filter key without the filter suffix
65
- */
66
- createAttribute(
67
- type: string,
68
- param: string,
69
- data: Object,
70
- contributions: Object,
71
- ): AttributeType | null {
72
- if (type === "assignment") {
73
- return null;
74
- }
75
-
76
- return createAttribute(
77
- param,
78
- data,
79
- {
80
- ...contributions,
81
- type: type,
82
- },
83
- this.modelOptions,
84
- );
85
- }
86
-
87
54
  /**
88
55
  * Inidiates if filter is multiplechoice
89
56
  */
@@ -151,75 +118,6 @@ export default class BaseFilterModel extends BaseModel {
151
118
  return this.data.param ?? this.data.name;
152
119
  }
153
120
 
154
- /**
155
- * Get attribute of filter
156
- */
157
- get attribute(): AttributeType {
158
- if (!this._attribute) {
159
- throw new IllegalStateException(
160
- `Missing filter attribute on filter model: ${this.label}`,
161
- );
162
- }
163
- return this._attribute;
164
- }
165
-
166
- /**
167
- * Retrieve the parameters with it's value for this filter
168
- */
169
- get params(): Array<{ name: string, value: ?string }> {
170
- if (!this.param) {
171
- return [];
172
- }
173
-
174
- return [
175
- {
176
- name: this.param,
177
- value: this.attribute?.value,
178
- },
179
- ];
180
- }
181
-
182
- /**
183
- * Getting the value of the filter
184
- */
185
- get value(): string | null {
186
- return this.attribute?.value;
187
- }
188
-
189
- /**
190
- * Getting the inputvalue of the filter
191
- */
192
- get inputvalue(): string {
193
- return this.attribute?.inputvalue;
194
- }
195
-
196
- /**
197
- * Indicates if the filter has a value.
198
- */
199
- hasValue(): boolean {
200
- return this.value !== null && this.value !== "";
201
- }
202
-
203
- /**
204
- * Reset the value of this filter to undefined
205
- */
206
- reset(): FilterType {
207
- if (this.attribute) {
208
- this.attribute.reset();
209
- }
210
-
211
- return this;
212
- }
213
-
214
- /**
215
- * Update this filter with input name and value
216
- */
217
- update(attribute: AttributeType, value: string) {
218
- if (this.attribute) {
219
- this.attribute.update(value);
220
- }
221
- }
222
-
223
121
  /**
224
122
  * Inidicates if filter is a quick search filter
225
123
  */
@@ -227,39 +125,10 @@ export default class BaseFilterModel extends BaseModel {
227
125
  return this.contributions.quicksearch === true;
228
126
  }
229
127
 
230
- /**
231
- * Inidiates if filter is active
232
- */
233
- isActive(): boolean {
234
- return this.attribute !== null && this.attribute.initvalue !== null;
235
- }
236
-
237
- /**
238
- * Inidiates if filter is valid
239
- */
240
- get isValid(): boolean {
241
- return this.attribute !== null && this.attribute.isValid;
242
- }
243
-
244
- /**
245
- */
246
- get readonlyvalue(): string {
247
- if (this.attribute) {
248
- return this.attribute.readonlyvalue;
249
- }
250
- return "";
251
- }
252
-
253
128
  /**
254
129
  * Get assistant message
255
130
  */
256
131
  get assistantMessage(): string | null {
257
132
  return this.getContribution("assistant");
258
133
  }
259
-
260
- /**
261
- */
262
- get formdata(): { [string]: any } | null {
263
- return this.attribute.formdata ?? null;
264
- }
265
134
  }
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import BaseFilterModel from "../filters/BaseFilterModel";
2
+ import FilterModel from "../filters/FilterModel";
3
3
  import ChoiceAttributeModel from "../attributes/ChoiceAttributeModel";
4
4
 
5
5
  import type { ModelOptions } from "../types";
@@ -7,7 +7,7 @@ import type { ModelOptions } from "../types";
7
7
  /**
8
8
  * The concept index model is a special filter used to index all first concept label letters in de modelcatalog.
9
9
  */
10
- export default class ConceptIndexFilterModel extends BaseFilterModel {
10
+ export default class ConceptIndexFilterModel extends FilterModel {
11
11
  /**
12
12
  * Construct a filter
13
13
  */