@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.
- package/CHANGELOG.md +26 -0
- package/esm/hooks/useList.js +4 -4
- package/esm/hooks/useList.js.flow +5 -5
- package/esm/hooks/useList.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +3 -2
- package/esm/models/concepts/ConceptIndexModel.js.flow +5 -4
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +7 -1
- package/esm/models/content/ContentIndexModel.js.flow +8 -3
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +3 -2
- package/esm/models/content/ContentModel.js.flow +4 -3
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +6 -2
- package/esm/models/content/ContentTOCModel.js.flow +6 -2
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/filters/AssignmentFilterModel.js +54 -26
- package/esm/models/filters/AssignmentFilterModel.js.flow +68 -37
- package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js +0 -110
- package/esm/models/filters/BaseFilterModel.js.flow +2 -133
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/ConceptIndexFilterModel.js +2 -2
- package/esm/models/filters/ConceptIndexFilterModel.js.flow +2 -2
- package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/esm/models/filters/FilterModel.js +117 -2
- package/esm/models/filters/FilterModel.js.flow +146 -1
- package/esm/models/filters/FilterModel.js.map +1 -1
- package/esm/models/filters/RangeFilterModel.js +2 -2
- package/esm/models/filters/RangeFilterModel.js.flow +2 -2
- package/esm/models/filters/RangeFilterModel.js.map +1 -1
- package/esm/models/href/Href.js +1 -1
- package/esm/models/href/Href.js.flow +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/list/ListModel.js +5 -1
- package/esm/models/list/ListModel.js.flow +7 -3
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/sorting/SortOptionModel.js +7 -0
- package/esm/models/sorting/SortOptionModel.js.flow +7 -0
- package/esm/models/sorting/SortOptionModel.js.map +1 -1
- package/esm/models/sorting/SortingModel.js +14 -2
- package/esm/models/sorting/SortingModel.js.flow +14 -2
- package/esm/models/sorting/SortingModel.js.map +1 -1
- package/esm/models/types.js.flow +1 -3
- package/esm/models/types.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +7 -6
- package/esm/redux/_modularui/ModularUIConnector.js.flow +6 -4
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/hooks/useList.js +4 -4
- package/lib/hooks/useList.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +3 -2
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +6 -1
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +3 -2
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +6 -2
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/filters/AssignmentFilterModel.js +54 -26
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js +0 -109
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
- package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/lib/models/filters/FilterModel.js +117 -1
- package/lib/models/filters/FilterModel.js.map +1 -1
- package/lib/models/filters/RangeFilterModel.js +2 -2
- package/lib/models/filters/RangeFilterModel.js.map +1 -1
- package/lib/models/href/Href.js +1 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/list/ListModel.js +5 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/sorting/SortOptionModel.js +7 -0
- package/lib/models/sorting/SortOptionModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js +14 -2
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/types.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +7 -6
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/package.json +6 -6
- package/src/hooks/useList.js +5 -5
- package/src/models/concepts/ConceptIndexModel.js +5 -4
- package/src/models/content/ContentIndexModel.js +8 -3
- package/src/models/content/ContentModel.js +4 -3
- package/src/models/content/ContentTOCModel.js +6 -2
- package/src/models/filters/AssignmentFilterModel.js +68 -37
- package/src/models/filters/BaseFilterModel.js +2 -133
- package/src/models/filters/ConceptIndexFilterModel.js +2 -2
- package/src/models/filters/FilterModel.js +146 -1
- package/src/models/filters/RangeFilterModel.js +2 -2
- package/src/models/href/Href.js +1 -1
- package/src/models/list/ListModel.js +7 -3
- package/src/models/sorting/SortOptionModel.js +7 -0
- package/src/models/sorting/SortingModel.js +14 -2
- package/src/models/types.js +1 -3
- package/src/redux/_modularui/ModularUIConnector.js +6 -4
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
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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(() =>
|
|
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":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.65.
|
|
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.
|
|
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": "^
|
|
103
|
-
"@commitlint/config-conventional": "^
|
|
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.
|
|
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": "^
|
|
133
|
+
"lint-staged": "^16.2.7",
|
|
134
134
|
"polished": "^4.3.1",
|
|
135
135
|
"prettier": "^3.7.4",
|
|
136
136
|
"react": "^19.2.3",
|
package/src/hooks/useList.js
CHANGED
|
@@ -12,7 +12,7 @@ import type { HookOptions } from "./useModularUIBasic";
|
|
|
12
12
|
import { useHistory } from "react-router";
|
|
13
13
|
|
|
14
14
|
type ListNavigationHook = {
|
|
15
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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():
|
|
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 {
|
|
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():
|
|
113
|
-
|
|
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
|
-
|
|
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?.
|
|
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:
|
|
12
|
-
_user:
|
|
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():
|
|
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
|
|
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():
|
|
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
|
|
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():
|
|
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():
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
+
|
|
4
4
|
import {
|
|
5
5
|
PARAMETER_SEPARATOR,
|
|
6
6
|
PARAMETER_TYPES,
|
|
7
7
|
} from "../../constants/Constants";
|
|
8
8
|
|
|
9
|
-
import type {
|
|
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
|
|
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
|
|
10
|
+
export default class ConceptIndexFilterModel extends FilterModel {
|
|
11
11
|
/**
|
|
12
12
|
* Construct a filter
|
|
13
13
|
*/
|