@beinformed/ui 1.57.2 → 1.57.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 +19 -0
- package/esm/constants/Settings.js +14 -6
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +3 -3
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +1 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +2 -3
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js +13 -23
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js +6 -3
- package/esm/models/attributes/AttributeCollection.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js +3 -3
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/AttributeSetModel.js +7 -4
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js +6 -3
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +6 -3
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js +18 -14
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +17 -10
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js +7 -7
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +3 -3
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +2 -2
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/attributes/StringAttributeModel.js +2 -2
- package/esm/models/attributes/StringAttributeModel.js.map +1 -1
- package/esm/models/attributes/_createAttribute.js +2 -2
- package/esm/models/attributes/_createAttribute.js.map +1 -1
- package/esm/models/base/BaseModel.js +27 -1
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +3 -23
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +1 -1
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -2
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +2 -2
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +4 -10
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationCollection.js +11 -4
- package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js +8 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +2 -4
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +9 -10
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +2 -2
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +4 -11
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +2 -2
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +7 -7
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +6 -12
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +9 -3
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +8 -10
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/filters/AssignmentFilterModel.js +2 -2
- package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js +3 -3
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/ConceptIndexFilterModel.js +2 -3
- package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js +8 -7
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/filters/StringFilterModel.js +2 -2
- package/esm/models/filters/StringFilterModel.js.map +1 -1
- package/esm/models/form/FormModel.js +4 -4
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +7 -4
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/grouping/GroupingModel.js +10 -7
- package/esm/models/grouping/GroupingModel.js.map +1 -1
- package/esm/models/href/Href.js +22 -21
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/links/LinkCollection.js +2 -3
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/links/LinkModel.js +7 -7
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +1 -1
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListItemCollection.js +1 -1
- package/esm/models/list/ListItemCollection.js.map +1 -1
- package/esm/models/list/ListItemModel.js +3 -3
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js +3 -3
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionCollection.js +5 -2
- package/esm/models/lookup/LookupOptionCollection.js.map +1 -1
- package/esm/models/lookup/LookupOptionsModel.js +2 -2
- package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +1 -1
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +2 -2
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +4 -5
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/esm/models/user/UserProfileModel.js +4 -1
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js +3 -3
- package/esm/modularui/CaptchaRequest.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +8 -5
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/ModularUIResponse.js +12 -3
- package/esm/modularui/ModularUIResponse.js.map +1 -1
- package/esm/modularui/UploadRequest.js +3 -3
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/react-client/client.js +3 -3
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +2 -2
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/renderSSRMinimal.js +2 -2
- package/esm/react-server/renderSSRMinimal.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +8 -2
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIUtils.js +11 -11
- package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/esm/utils/browser/Cookies.js +3 -3
- package/esm/utils/browser/Cookies.js.map +1 -1
- package/esm/utils/helpers/createHref.js +23 -3
- package/esm/utils/helpers/createHref.js.map +1 -1
- package/esm/utils/helpers/repositoryResource.js +2 -2
- package/esm/utils/helpers/repositoryResource.js.map +1 -1
- package/lib/constants/Settings.js +18 -8
- package/lib/constants/Settings.js.flow +16 -6
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useAuthentication.js +2 -2
- package/lib/hooks/useAuthentication.js.flow +3 -3
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.flow +7 -6
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +1 -1
- package/lib/hooks/useModularUIBasic.js.flow +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js.flow +16 -11
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +2 -2
- package/lib/models/actions/ActionCollection.js.flow +3 -8
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js +12 -22
- package/lib/models/actions/ActionModel.js.flow +7 -24
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +1 -1
- package/lib/models/application/ApplicationModel.js.flow +1 -2
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js +6 -3
- package/lib/models/attributes/AttributeCollection.js.flow +12 -4
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +3 -3
- package/lib/models/attributes/AttributeModel.js.flow +8 -2
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js +7 -3
- package/lib/models/attributes/AttributeSetModel.js.flow +11 -3
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js +6 -3
- package/lib/models/attributes/BooleanAttributeModel.js.flow +8 -4
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +6 -3
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +13 -4
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js +18 -13
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +30 -28
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +17 -10
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +30 -11
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +7 -7
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +8 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +3 -3
- package/lib/models/attributes/CompositeAttributeModel.js.flow +8 -3
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +2 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js +2 -2
- package/lib/models/attributes/StringAttributeModel.js.flow +7 -3
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js.flow +1 -1
- package/lib/models/attributes/_createAttribute.js +2 -2
- package/lib/models/attributes/_createAttribute.js.flow +3 -2
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/base/BaseModel.js +27 -1
- package/lib/models/base/BaseModel.js.flow +31 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +3 -22
- package/lib/models/base/ResourceModel.js.flow +6 -23
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/base/__tests__/BaseModel.spec.js.flow +4 -0
- package/lib/models/caseview/CaseViewModel.js +1 -1
- package/lib/models/caseview/CaseViewModel.js.flow +1 -2
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +2 -2
- package/lib/models/concepts/ConceptIndexModel.js.flow +9 -6
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +4 -10
- package/lib/models/concepts/ConceptLinkModel.js.flow +15 -12
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationCollection.js +11 -4
- package/lib/models/concepts/ConceptRelationCollection.js.flow +17 -3
- package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js +8 -1
- package/lib/models/concepts/ConceptRelationModel.js.flow +18 -2
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +2 -3
- package/lib/models/concepts/SourceReferenceCollection.js.flow +3 -8
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +8 -8
- package/lib/models/concepts/SourceReferenceModel.js.flow +10 -11
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +2 -2
- package/lib/models/content/ContentIndexModel.js.flow +10 -5
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +4 -10
- package/lib/models/content/ContentLinkModel.js.flow +10 -13
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +2 -2
- package/lib/models/content/ContentModel.js.flow +6 -1
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +7 -7
- package/lib/models/content/ContentTOCModel.js.flow +19 -11
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +6 -11
- package/lib/models/content/SectionModel.js.flow +9 -21
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +9 -3
- package/lib/models/detail/DetailModel.js.flow +3 -4
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +7 -9
- package/lib/models/error/ErrorResponse.js.flow +9 -20
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/filters/AssignmentFilterModel.js +2 -2
- package/lib/models/filters/AssignmentFilterModel.js.flow +7 -3
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js +3 -3
- package/lib/models/filters/BaseFilterModel.js.flow +16 -7
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
- package/lib/models/filters/ConceptIndexFilterModel.js.flow +8 -2
- package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js +8 -7
- package/lib/models/filters/FilterCollection.js.flow +13 -7
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/filters/StringFilterModel.js +2 -2
- package/lib/models/filters/StringFilterModel.js.flow +7 -3
- package/lib/models/filters/StringFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js +4 -4
- package/lib/models/form/FormModel.js.flow +8 -2
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +7 -4
- package/lib/models/form/FormObjectModel.js.flow +17 -4
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/grouping/GroupingModel.js +10 -7
- package/lib/models/grouping/GroupingModel.js.flow +21 -5
- package/lib/models/grouping/GroupingModel.js.map +1 -1
- package/lib/models/href/Href.js +21 -20
- package/lib/models/href/Href.js.flow +33 -25
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +16 -14
- package/lib/models/links/LinkCollection.js +2 -3
- package/lib/models/links/LinkCollection.js.flow +3 -3
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js +7 -7
- package/lib/models/links/LinkModel.js.flow +8 -15
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +1 -1
- package/lib/models/list/ListDetailModel.js.flow +6 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js +1 -1
- package/lib/models/list/ListItemCollection.js.flow +1 -2
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListItemModel.js +3 -3
- package/lib/models/list/ListItemModel.js.flow +4 -4
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js +3 -3
- package/lib/models/list/ListModel.js.flow +12 -8
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionCollection.js +5 -1
- package/lib/models/lookup/LookupOptionCollection.js.flow +17 -6
- package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js +2 -2
- package/lib/models/lookup/LookupOptionsModel.js.flow +2 -0
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +1 -1
- package/lib/models/panels/GroupingPanelModel.js.flow +1 -2
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +2 -2
- package/lib/models/tab/TabModel.js.flow +2 -4
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +4 -4
- package/lib/models/taskgroup/TaskGroupModel.js.flow +5 -6
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/types.js.flow +5 -0
- package/lib/models/types.js.map +1 -1
- package/lib/models/user/UserProfileModel.js +4 -1
- package/lib/models/user/UserProfileModel.js.flow +1 -0
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js +2 -2
- package/lib/modularui/CaptchaRequest.js.flow +7 -3
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +7 -4
- package/lib/modularui/ModularUIRequest.js.flow +8 -5
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js +11 -2
- package/lib/modularui/ModularUIResponse.js.flow +13 -3
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/UploadRequest.js +2 -2
- package/lib/modularui/UploadRequest.js.flow +7 -3
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/react-client/client.js +2 -2
- package/lib/react-client/client.js.flow +7 -3
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js +1 -1
- package/lib/react-server/renderSSRComplete.js.flow +2 -2
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js +1 -1
- package/lib/react-server/renderSSRMinimal.js.flow +2 -2
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +8 -2
- package/lib/redux/_modularui/ModularUIActions.js.flow +8 -7
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIUtils.js +11 -11
- package/lib/redux/_modularui/ModularUIUtils.js.flow +17 -14
- package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/lib/utils/browser/Cookies.js +2 -2
- package/lib/utils/browser/Cookies.js.flow +3 -3
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/helpers/__tests__/createHref.spec.js.flow +13 -8
- package/lib/utils/helpers/createHref.js +23 -3
- package/lib/utils/helpers/createHref.js.flow +37 -8
- package/lib/utils/helpers/createHref.js.map +1 -1
- package/lib/utils/helpers/repositoryResource.js +1 -1
- package/lib/utils/helpers/repositoryResource.js.flow +2 -2
- package/lib/utils/helpers/repositoryResource.js.map +1 -1
- package/package.json +4 -4
- package/src/constants/Settings.js +16 -6
- package/src/hooks/useAuthentication.js +3 -3
- package/src/hooks/useModelCatalog.js +7 -6
- package/src/hooks/useModularUIBasic.js +1 -1
- package/src/hooks/useModularUIModel.js +16 -11
- package/src/models/actions/ActionCollection.js +3 -8
- package/src/models/actions/ActionModel.js +7 -24
- package/src/models/application/ApplicationModel.js +1 -2
- package/src/models/attributes/AttributeCollection.js +12 -4
- package/src/models/attributes/AttributeModel.js +8 -2
- package/src/models/attributes/AttributeSetModel.js +11 -3
- package/src/models/attributes/BooleanAttributeModel.js +8 -4
- package/src/models/attributes/ChoiceAttributeModel.js +13 -4
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +30 -28
- package/src/models/attributes/ChoiceAttributeOptionModel.js +30 -11
- package/src/models/attributes/CompositeAttributeChildCollection.js +8 -1
- package/src/models/attributes/CompositeAttributeModel.js +8 -3
- package/src/models/attributes/DatetimeAttributeModel.js +7 -2
- package/src/models/attributes/StringAttributeModel.js +7 -3
- package/src/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js +1 -1
- package/src/models/attributes/_createAttribute.js +3 -2
- package/src/models/base/BaseModel.js +31 -1
- package/src/models/base/ResourceModel.js +6 -23
- package/src/models/base/__tests__/BaseModel.spec.js +4 -0
- package/src/models/caseview/CaseViewModel.js +1 -2
- package/src/models/concepts/ConceptDetailModel.js +2 -2
- package/src/models/concepts/ConceptIndexModel.js +9 -6
- package/src/models/concepts/ConceptLinkModel.js +15 -12
- package/src/models/concepts/ConceptRelationCollection.js +17 -3
- package/src/models/concepts/ConceptRelationModel.js +18 -2
- package/src/models/concepts/SourceReferenceCollection.js +3 -8
- package/src/models/concepts/SourceReferenceModel.js +10 -11
- package/src/models/content/ContentIndexModel.js +10 -5
- package/src/models/content/ContentLinkModel.js +10 -13
- package/src/models/content/ContentModel.js +6 -1
- package/src/models/content/ContentTOCModel.js +19 -11
- package/src/models/content/SectionModel.js +9 -21
- package/src/models/detail/DetailModel.js +3 -4
- package/src/models/error/ErrorResponse.js +9 -20
- package/src/models/filters/AssignmentFilterModel.js +7 -3
- package/src/models/filters/BaseFilterModel.js +16 -7
- package/src/models/filters/ConceptIndexFilterModel.js +8 -2
- package/src/models/filters/FilterCollection.js +13 -7
- package/src/models/filters/StringFilterModel.js +7 -3
- package/src/models/form/FormModel.js +8 -2
- package/src/models/form/FormObjectModel.js +17 -4
- package/src/models/grouping/GroupingModel.js +21 -5
- package/src/models/href/Href.js +33 -25
- package/src/models/href/__tests__/Href.spec.js +16 -14
- package/src/models/links/LinkCollection.js +3 -3
- package/src/models/links/LinkModel.js +8 -15
- package/src/models/list/ListDetailModel.js +6 -1
- package/src/models/list/ListItemCollection.js +1 -2
- package/src/models/list/ListItemModel.js +4 -4
- package/src/models/list/ListModel.js +12 -8
- package/src/models/lookup/LookupOptionCollection.js +17 -6
- package/src/models/lookup/LookupOptionsModel.js +2 -0
- package/src/models/panels/GroupingPanelModel.js +1 -2
- package/src/models/tab/TabModel.js +2 -4
- package/src/models/taskgroup/TaskGroupModel.js +5 -6
- package/src/models/types.js +5 -0
- package/src/models/user/UserProfileModel.js +1 -0
- package/src/modularui/CaptchaRequest.js +7 -3
- package/src/modularui/ModularUIRequest.js +8 -5
- package/src/modularui/ModularUIResponse.js +13 -3
- package/src/modularui/UploadRequest.js +7 -3
- package/src/react-client/client.js +7 -3
- package/src/react-server/renderSSRComplete.js +2 -2
- package/src/react-server/renderSSRMinimal.js +2 -2
- package/src/redux/_modularui/ModularUIActions.js +8 -7
- package/src/redux/_modularui/ModularUIUtils.js +17 -14
- package/src/utils/browser/Cookies.js +3 -3
- package/src/utils/helpers/__tests__/createHref.spec.js +13 -8
- package/src/utils/helpers/createHref.js +37 -8
- package/src/utils/helpers/repositoryResource.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.57.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.3...v1.57.4) (2024-10-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **modularui:** keep models with same url but different querystring ([2fb0be3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2fb0be3e90c340445f22b32639bd1f12d63443f3))
|
|
11
|
+
|
|
12
|
+
## [1.57.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.2...v1.57.3) (2024-10-30)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **basepath:** separate basepath in modular ui and server variant ([e594011](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e594011b8ffafc439b4f988b3f01eff140e07a05))
|
|
18
|
+
* **connector:** return href to handle origin and contextpath ([98bf76a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/98bf76a704bafe5d0c42cfefd554bdb5b9cd1901))
|
|
19
|
+
* **context:** put origin and context on basemodel ([d364e96](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/d364e961f8a0e1952279fce004208a47f9b5193a))
|
|
20
|
+
* **hooks:** allow Href as input url for modularui hooks ([3e6ad6f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/3e6ad6f5884f8e460e5150ad87d8729ca350aaae))
|
|
21
|
+
* **href:** allow null in equals method ([5aba392](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/5aba39293be47c38ea9fe2cdc75233509a1af723))
|
|
22
|
+
* **usemodularui:** send href to usemodularui hook i.s.o. string ([cb5ba9f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/cb5ba9fd214cefc91d672f7c008421220398c089))
|
|
23
|
+
|
|
5
24
|
## [1.57.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.57.1...v1.57.2) (2024-10-25)
|
|
6
25
|
|
|
7
26
|
|
|
@@ -101,18 +101,26 @@ export const allSettings = () => settings;
|
|
|
101
101
|
export const cacheContributions = () => getSetting("CACHE_CONTRIBUTIONS", true);
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
105
|
-
* This
|
|
106
|
-
* When requesting a remote server with CORS enabled, add the origin, for example:
|
|
107
|
-
* export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';
|
|
104
|
+
* The context path is retrieved on the server using the context path property as set in the runtime properties
|
|
105
|
+
* This can be manually override by setting the UI setting 'CONTEXT_PATH'
|
|
108
106
|
*/
|
|
109
107
|
export const getBasePath = () => getSetting("CONTEXT_PATH", "/BeInformed");
|
|
110
108
|
|
|
109
|
+
/**
|
|
110
|
+
* The context path to modular ui rest services
|
|
111
|
+
*/
|
|
112
|
+
export const getBasePathModularUI = () => getSetting("CONTEXT_PATH_SERVER", getBasePath());
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Used to link the css and js files in the server templates
|
|
116
|
+
*/
|
|
117
|
+
export const getBasePathServer = () => getSetting("CONTEXT_PATH_SERVER", getBasePath());
|
|
118
|
+
|
|
111
119
|
/**
|
|
112
120
|
* Path to upload service
|
|
113
121
|
*/
|
|
114
122
|
export const getUploadPath = function () {
|
|
115
|
-
let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
123
|
+
let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBasePathModularUI();
|
|
116
124
|
let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
117
125
|
return `${origin}${contextPath}${UPLOAD_PATH}`;
|
|
118
126
|
};
|
|
@@ -121,7 +129,7 @@ export const getUploadPath = function () {
|
|
|
121
129
|
* Path to captcha service
|
|
122
130
|
*/
|
|
123
131
|
export const getCaptchaPath = function () {
|
|
124
|
-
let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
132
|
+
let contextPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBasePathModularUI();
|
|
125
133
|
let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
126
134
|
return `${origin}${contextPath}${CAPTCHA_PATH}`;
|
|
127
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","arguments","length","origin","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePath(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePath(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CA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AMG,cAAc,GAAIhE,WAAmB,IAAK;EACrD0C,UAAU,CAAC,cAAc,EAAE1C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMiE,IAAY,GAAGnB,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","arguments","length","origin","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,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AAY,CAAC;AAClD;AACA;AACA,OAAO,MAAMsE,kBAAkB,GAAGA,CAAA,KAChCvB,UAAU,CAAC9C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAMsE,UAAU,GAAGA,CAAA,KACxBxB,UAAU,CAAC7C,mBAAmB,EAAE,SAAS,CAAC;AAE5C,OAAO,MAAMuB,UAAkB,GAAG0C,SAAS,CAAC,CAAC;AAC7C,OAAO,MAAMxC,WAAmB,GAAG4C,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG1B,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC2B,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO9E,wBAAwB,CAAC8E,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIlE,WAAmB,IAAK;EACrD0C,UAAU,CAAC,cAAc,EAAE1C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMmE,IAAY,GAAGrB,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { useSelector, useDispatch } from "react-redux";
|
|
|
2
2
|
import { getApplication } from "../redux/_modularui/ModularUISelectors";
|
|
3
3
|
import { login, logout, resetAuthErrors } from "../redux/actions";
|
|
4
4
|
import Cache from "../utils/browser/Cache";
|
|
5
|
-
import { DEFAULT_AUTHENTICATION_TYPE,
|
|
5
|
+
import { DEFAULT_AUTHENTICATION_TYPE, getBasePathServer, logoutPath } from "../constants";
|
|
6
6
|
import { IllegalStateException } from "../exceptions";
|
|
7
7
|
/**
|
|
8
8
|
*/
|
|
@@ -25,7 +25,7 @@ export const useLogin = () => {
|
|
|
25
25
|
}
|
|
26
26
|
if (!isAuthenticated) {
|
|
27
27
|
Cache.setItem("isRedirectLogin", true);
|
|
28
|
-
window.location.assign(`${
|
|
28
|
+
window.location.assign(`${getBasePathServer()}${authenticationType.redirectUri ?? ""}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -37,7 +37,7 @@ export const useLogout = () => {
|
|
|
37
37
|
const dispatch = useDispatch();
|
|
38
38
|
const application = useSelector(getApplication);
|
|
39
39
|
const LOGOUT_PATH = logoutPath();
|
|
40
|
-
const BASE_PATH =
|
|
40
|
+
const BASE_PATH = getBasePathServer();
|
|
41
41
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
42
42
|
return {
|
|
43
43
|
isAuthenticated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePathServer","logoutPath","IllegalStateException","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","getItem","authentication","redirectUri","window","location","assign","useLogout","LOGOUT_PATH","BASE_PATH","origin","url"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/ModularUISelectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport {\n DEFAULT_AUTHENTICATION_TYPE,\n getBasePathServer,\n logoutPath,\n} from \"../constants\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\nimport { IllegalStateException } from \"../exceptions\";\ntype LoginHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getBasePathServer();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.ass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AACZ,eAAe,EAAE;QACpBX,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;QACtCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CACpB,GAAGxB,iBAAiB,CAAC,CAAC,GAAGkB,kBAAkB,CAACG,WAAW,IAAI,EAAE,EAC/D,CAAC;MACH;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMI,SAAS,GAAGA,CAAA,KAAkB;EACzC,MAAMpB,QAAQ,GAAGZ,WAAW,CAAC,CAAC;EAC9B,MAAMa,WAAW,GAAGd,WAAW,CAACE,cAAc,CAAC;EAE/C,MAAMgC,WAAW,GAAGzB,UAAU,CAAC,CAAC;EAChC,MAAM0B,SAAS,GAAG3B,iBAAiB,CAAC,CAAC;EAErC,MAAMS,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EACxD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDZ,2BAA2B,CAC5B;IACDH,MAAM,EAAEA,CAAA,KAAM;MACZ,IAAIE,KAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC,MAAMS,MAAM,GAAGN,MAAM,CAACC,QAAQ,CAACK,MAAM;QACrC,MAAMC,GAAG,GAAG,GAAGD,MAAM,GAAGD,SAAS,eAAeC,MAAM,GAAGD,SAAS,GAAGD,WAAW,EAAE;QAClF5B,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACK,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOxB,QAAQ,CAACT,MAAM,CAAC,CAAC,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","url","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const url = filterParameters(href, [\n \"entryDate\",\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAW5C;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDH,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDI,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEb,iBAAiB;EAC9B,GAAGW;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAA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F;EAEA,OAAOH,YAAY,CAAChB,MAAM,GAAG,GAAGc,GAAG,IAAIE,YAAY,CAACM,IAAI,CAAC,GAAG,CAAC,EAAE,GAAGR,GAAG;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMW,gBAAgB,GAAG,SAAAA,CAC9BV,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAOnB,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAMiC,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOT,eAAe,CAACT,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","arguments","length","undefined","url","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","useConceptSearch","useContentSearch"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport type Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const url = filterParameters(href, [\n \"entryDate\",\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const location = useLocation();\n const href = createHref(\"content\", content, location, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n contentSection: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel => {\n const href = createHref(\"content\", contentSection, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, [\"entryDate\"]);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAY5C;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDH,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDI,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEb,iBAAiB;EAC9B,GAAGW;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAG,SAAAA,CAC7BC,IAAmB,EAGI;EAAA,IAFvBC,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,cAAc;EAAA,IAC7BN,OAAqD,GAAAM,SAAA,CAAAC,MA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G,SAAAA,CAC9BV,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,WAAW,EAAEE,OAAO,CAAC;EAChD,OAAOnB,eAAe,CAACC,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA,OAAO,MAAMiC,gBAAgB,GAAG,SAAAA,CAC9BX,OAAqB,EAGE;EAAA,IAFvBjB,GAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BN,OAAqD,GAAAM,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAErD,MAAMJ,IAAI,GAAGgB,aAAa,CAAC,UAAU,EAAEE,OAAO,CAAC;EAC/C,OAAOT,eAAe,CAACT,IAAI,EAAEC,GAAG,EAAEL,OAAO,CAAC;AAC5C,CAAC","ignoreList":[]}
|
|
@@ -60,7 +60,7 @@ export const useModularUIBasic = function (key, href) {
|
|
|
60
60
|
const location = useLocation();
|
|
61
61
|
const memoizedHref = useMemo(() => href.toString(), [href]);
|
|
62
62
|
const useModularUIOptions = useMemo(() => createUseModularUIOptions(options, memoizedHref, location), [options, memoizedHref, location]);
|
|
63
|
-
const modularUI = useModularUI(key,
|
|
63
|
+
const modularUI = useModularUI(key, href, useModularUIOptions);
|
|
64
64
|
const expectedModels = useMemo(() => options.expectedModels ?? [], [options.expectedModels]);
|
|
65
65
|
return useMemo(() => {
|
|
66
66
|
if (modularUI?.model) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIBasic.js","names":["useMemo","useModularUI","useLocation","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWithInstanceProperty","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","warn","useModularUIBasic","key","arguments","memoizedHref","toString","useModularUIOptions","modularUI"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: any,\n): Object => {\n const baseOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (location.state?.reload && location.pathname.startsWith(href)) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some(\n (expectedModel) => model.type === expectedModel,\n );\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key,
|
|
1
|
+
{"version":3,"file":"useModularUIBasic.js","names":["useMemo","useModularUI","useLocation","createUseModularUIOptions","options","href","location","_context","baseOptions","targetModel","undefined","forceTargetModel","isReload","origin","contextPath","cache","state","reload","_startsWithInstanceProperty","pathname","call","validateModel","model","expectedModels","length","isCorrectModel","some","expectedModel","type","console","warn","useModularUIBasic","key","arguments","memoizedHref","toString","useModularUIOptions","modularUI"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useMemo } from \"react\";\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\nexport type UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels?: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n origin?: string,\n contextPath?: string,\n cache?: boolean,\n};\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T: ModularUIModel>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: any,\n): Object => {\n const baseOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (location.state?.reload && location.pathname.startsWith(href)) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: any, expectedModels: Array<string>) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some(\n (expectedModel) => model.type === expectedModel,\n );\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | null => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, href, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | null => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model;\n }\n return null;\n }, [expectedModels, modularUI]);\n};\n"],"mappings":";AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,aAAa;AAazC;AACA,MAAMC,yBAAyB,GAAGA,CAChCC,OAAoC,EACpCC,IAAY,EACZC,QAAa,KACF;EAAA,IAAAC,QAAA;EACX,MAAMC,WAAW,GAAG;IAClBC,WAAW,EAAEC,SAAS;IACtBC,gBAAgB,EAAED,SAAS;IAC3BE,QAAQ,EAAE,KAAK;IACfC,MAAM,EAAEH,SAAS;IACjBI,WAAW,EAAEJ,SAAS;IACtBK,KAAK,EAAE;EACT,CAAC;;EAED;EACA,IAAIX,OAAO,CAACK,WAAW,EAAE;IACvBD,WAAW,CAACC,WAAW,GAAGL,OAAO,CAACK,WAAW;IAC7CD,WAAW,C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,WAAW,CAAC,CAAC;EAC9B,MAAMgC,YAAY,GAAGlC,OAAO,CAAC,MAAMK,IAAI,CAAC8B,QAAQ,CAAC,CAAC,EAAE,CAAC9B,IAAI,CAAC,CAAC;EAC3D,MAAM+B,mBAAmB,GAAGpC,OAAO,CACjC,MAAMG,yBAAyB,CAACC,OAAO,EAAE8B,YAAY,EAAE5B,QAAQ,CAAC,EAChE,CAACF,OAAO,EAAE8B,YAAY,EAAE5B,QAAQ,CAClC,CAAC;EAED,MAAM+B,SAAS,GAAGpC,YAAY,CAAC+B,GAAG,EAAE3B,IAAI,EAAE+B,mBAAmB,CAAC;EAC9D,MAAMb,cAAc,GAAGvB,OAAO,CAC5B,MAAMI,OAAO,CAACmB,cAAc,IAAI,EAAE,EAClC,CAACnB,OAAO,CAACmB,cAAc,CACzB,CAAC;EAED,OAAOvB,OAAO,CAAC,MAAgB;IAC7B,IAAIqC,SAAS,EAAEf,KAAK,EAAE;MACpBD,aAAa,CAACgB,SAAS,CAACf,KAAK,EAAEC,cAAc,CAAC;MAC9C,OAAOc,SAAS,CAACf,KAAK;IACxB;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CAACC,cAAc,EAAEc,SAAS,CAAC,CAAC;AACjC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListOrDetail","useListDetail","forceTargetModel","useGroupingPanel","useDetailPanel","useQuicksearch","useSearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\ntype HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string
|
|
1
|
+
{"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","options","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListOrDetail","useListDetail","forceTargetModel","useGroupingPanel","useDetailPanel","useQuicksearch","useSearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type Href from \"../models/href/Href\";\n\ntype HookOptions = {\n origin?: string,\n contextPath?: string,\n};\n\n/**\n * Load application\n */\nexport const useApplication = (\n options?: HookOptions,\n): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (\n href: string | Href,\n options?: HookOptions,\n): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (\n href: string | Href,\n options?: HookOptions,\n): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\n/**\n */\nexport const usePanel = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n });\n\n/**\n */\nexport const useList = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\n/**\n */\nexport const useListOrDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\n/**\n */\nexport const useListDetail = (\n href: string | Href,\n options?: HookOptions,\n): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\n/**\n */\nexport const useGroupingPanel = (\n href: string | Href,\n options?: HookOptions,\n): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\n/**\n */\nexport const useDetailPanel = (\n href: string | Href,\n options?: HookOptions,\n): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\n/**\n */\nexport const useQuicksearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useSearch = (\n href: string | Href,\n options?: HookOptions,\n): CaseSearchModel | null =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\n/**\n */\nexport const useUserProfile = (\n href: string | Href,\n options?: HookOptions,\n): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n"],"mappings":"AACA,OAAOA,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,kBAAkB,MAAM,qCAAqC;AACpE,OAAOC,WAAW,MAAM,8BAA8B;AACtD,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,gBAAgB,MAAM,iCAAiC;AAE9D,SAASC,iBAAiB,QAAQ,qBAAqB;AASvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GACzBC,OAAqB,IAErBF,iBAAiB,CAAC,aAAa,EAAE,GAAG,EAAE;EACpCG,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEb,gBAAgB;EAC7B,GAAGW;AACL,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,OAAO,MAAMG,MAAM,GAAGA,CACpBC,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,KAAK,EAAEM,IAAI,EAAE;EAC7BH,cAAc,EAAE,CAAC,KAAK,CAAC;EACvBC,WAAW,EAAEX,QAAQ;EACrB,GAAGS;AACL,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,OAAO,MAAMK,WAA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AEM,IAAI,EAAE;EACvCH,cAAc,EAAE,CAAC,eAAe,CAAC;EACjCC,WAAW,EAAET,kBAAkB;EAC/B,GAAGO;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMY,cAAc,GAAGA,CAC5BR,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,QAAQ,CAAC;EAC1BC,WAAW,EAAER,WAAW;EACxB,GAAGM;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMa,cAAc,GAAGA,CAC5BT,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMc,SAAS,GAAGA,CACvBV,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,QAAQ,EAAEM,IAAI,EAAE;EAChCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEP,eAAe;EAC5B,GAAGK;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMe,cAAc,GAAGA,CAC5BX,IAAmB,EACnBJ,OAAqB,KAErBF,iBAAiB,CAAC,aAAa,EAAEM,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEL,gBAAgB;EAC7B,GAAGG;AACL,CAAC,CAAC","ignoreList":[]}
|
|
@@ -4,12 +4,11 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/ins
|
|
|
4
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
5
5
|
import BaseCollection from "../base/BaseCollection";
|
|
6
6
|
import ActionModel from "./ActionModel";
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Collection of actions
|
|
10
9
|
*/
|
|
11
10
|
export default class ActionCollection extends BaseCollection {
|
|
12
|
-
constructor(actions, actionsContributions,
|
|
11
|
+
constructor(actions, actionsContributions, modelOptions) {
|
|
13
12
|
super();
|
|
14
13
|
|
|
15
14
|
// no actions gives an empty collection
|
|
@@ -20,7 +19,7 @@ export default class ActionCollection extends BaseCollection {
|
|
|
20
19
|
for (const actionData of actions) {
|
|
21
20
|
const actionContribution = _findInstanceProperty(actionsContributions).call(actionsContributions, actionContribution => actionContribution.name === actionData.name && actionContribution.type !== "service-operation");
|
|
22
21
|
if (actionContribution) {
|
|
23
|
-
actionModels.push(new ActionModel(actionData, actionContribution,
|
|
22
|
+
actionModels.push(new ActionModel(actionData, actionContribution, modelOptions));
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
this.collection = actionModels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionCollection.js","names":["BaseCollection","ActionModel","ActionCollection","constructor","actions","actionsContributions","
|
|
1
|
+
{"version":3,"file":"ActionCollection.js","names":["BaseCollection","ActionModel","ActionCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_findInstanceProperty","call","name","type","push","getActionByKey","key","_context","newCollection","_filterInstanceProperty","action","first","getActionsByType","_context2","_includesInstanceProperty","getActionsByLayoutHint","_context3","_len","arguments","length","hints","_key","layouthint","has","hasActionsByLayoutHint","routePath","_context4","enabledRoutes","isDisabled","path","_mapInstanceProperty","selfhref","join"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (actionContribution) =>\n actionContribution.name === actionData.name &&\n actionContribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(actionData, actionContribution, modelOptions),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,WAAW,MAAM,eAAe;AAGvC;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,cAAc,CAAc;EACxEG,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KA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AAO,IAAI,CAACb,MAAM,GAAG,CAAC,GAAG,IAAIU,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF","ignoreList":[]}
|
|
@@ -6,21 +6,20 @@ import ProcessStatusSettingsModel from "../process/ProcessStatusSettingsModel";
|
|
|
6
6
|
import AttributeCollection from "../attributes/AttributeCollection";
|
|
7
7
|
import BaseModel from "../base/BaseModel";
|
|
8
8
|
import Href from "../href/Href";
|
|
9
|
-
import {
|
|
9
|
+
import { HTTP_METHODS, CREATE_ACTION, UPDATE_ACTION, DELETE_ACTION } from "../../constants";
|
|
10
10
|
/**
|
|
11
11
|
* Defines an Action. For instance an action on the tab 'books', which leads to a form
|
|
12
12
|
*/
|
|
13
13
|
export default class ActionModel extends BaseModel {
|
|
14
|
-
constructor(data, contributions,
|
|
15
|
-
super(data, contributions);
|
|
14
|
+
constructor(data, contributions, modelOptions) {
|
|
15
|
+
super(data, contributions, modelOptions);
|
|
16
16
|
_defineProperty(this, "_fieldCollection", void 0);
|
|
17
17
|
_defineProperty(this, "_href", void 0);
|
|
18
18
|
_defineProperty(this, "_icon", void 0);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this._contextPath = contextPath;
|
|
19
|
+
this._fieldCollection = new AttributeCollection(this.data.fields, this.contributions.fields, {
|
|
20
|
+
...modelOptions,
|
|
21
|
+
isReadonly: false
|
|
22
|
+
});
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/**
|
|
@@ -38,7 +37,10 @@ export default class ActionModel extends BaseModel {
|
|
|
38
37
|
label: label ?? name,
|
|
39
38
|
type
|
|
40
39
|
};
|
|
41
|
-
return new ActionModel(data, contributions,
|
|
40
|
+
return new ActionModel(data, contributions, {
|
|
41
|
+
origin,
|
|
42
|
+
contextPath
|
|
43
|
+
});
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
/**
|
|
@@ -47,23 +49,11 @@ export default class ActionModel extends BaseModel {
|
|
|
47
49
|
return this.data.href == null;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
/**
|
|
51
|
-
*/
|
|
52
|
-
get origin() {
|
|
53
|
-
return this._origin ?? "";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
*/
|
|
58
|
-
get contextPath() {
|
|
59
|
-
return this._contextPath ?? getBasePath();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
52
|
/**
|
|
63
53
|
* retrieve href of action
|
|
64
54
|
*/
|
|
65
55
|
get selfhref() {
|
|
66
|
-
return this._href ?? new Href(`${this.data.href}?${this.querystring}`, "Form", this.
|
|
56
|
+
return this._href ?? new Href(`${this.data.href}?${this.querystring}`, "Form", this.modelOptions);
|
|
67
57
|
}
|
|
68
58
|
|
|
69
59
|
/**
|
|
@@ -176,7 +166,7 @@ export default class ActionModel extends BaseModel {
|
|
|
176
166
|
*/
|
|
177
167
|
get processStatus() {
|
|
178
168
|
if (this.isProcessTask) {
|
|
179
|
-
return new ProcessStatusSettingsModel(this.getData("processStatus", {}), this.getContribution("processTask", {}));
|
|
169
|
+
return new ProcessStatusSettingsModel(this.getData("processStatus", {}), this.getContribution("processTask", {}), this.modelOptions);
|
|
180
170
|
}
|
|
181
171
|
return null;
|
|
182
172
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionModel.js","names":["has","ProcessStatusSettingsModel","AttributeCollection","BaseModel","Href","
|
|
1
|
+
{"version":3,"file":"ActionModel.js","names":["has","ProcessStatusSettingsModel","AttributeCollection","BaseModel","Href","HTTP_METHODS","CREATE_ACTION","UPDATE_ACTION","DELETE_ACTION","ActionModel","constructor","data","contributions","modelOptions","_defineProperty","_fieldCollection","fields","isReadonly","createFromHref","name","href","label","type","arguments","length","undefined","origin","contextPath","isDisabled","selfhref","_href","querystring","method","getData","POST","layouthint","getContribution","all","fieldCollection","_context","_context2","_mapInstanceProperty","_filterInstanceProperty","call","attribute","value","join","getFieldByKey","key","getAttributeByKey","hasFieldByKey","isProcessTask","processStatus","icon","_icon"],"sources":["../../../src/models/actions/ActionModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ProcessStatusSettingsModel from \"../process/ProcessStatusSettingsModel\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\n\nimport {\n HTTP_METHODS,\n CREATE_ACTION,\n UPDATE_ACTION,\n DELETE_ACTION,\n} from \"../../constants\";\n\nimport type { AttributeType, ModelOptions } from \"../types\";\n\n/**\n * Defines an Action. For instance an action on the tab 'books', which leads to a form\n */\nexport default class ActionModel extends BaseModel {\n _fieldCollection: AttributeCollection;\n _href: Href;\n _icon: string;\n\n constructor(\n data: Object,\n contributions: Object,\n modelOptions?: ModelOptions,\n ) {\n super(data, contributions, modelOptions);\n\n this._fieldCollection = new AttributeCollection(\n this.data.fields,\n this.contributions.fields,\n { ...modelOptions, isReadonly: false },\n );\n }\n\n /**\n */\n static createFromHref(\n name: string,\n href: string,\n label: string,\n type: string = \"form\",\n origin?: string,\n contextPath?: string,\n ): ActionModel {\n const data = { name, href };\n const contributions = { name, label: label ?? name, type };\n return new ActionModel(data, contributions, { origin, contextPath });\n }\n\n /**\n */\n get isDisabled(): boolean {\n return this.data.href == null;\n }\n\n /**\n * retrieve href of action\n */\n get selfhref(): Href {\n return (\n this._href ??\n new Href(\n `${this.data.href}?${this.querystring}`,\n \"Form\",\n this.modelOptions,\n )\n );\n }\n\n /**\n */\n set selfhref(href: Href) {\n this._href = href;\n }\n\n /**\n * retrieve request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this.getData(\"method\", HTTP_METHODS.POST);\n }\n\n /**\n * Retrieve type of method\n */\n get type(): string {\n if (this.layouthint.has(CREATE_ACTION)) {\n return \"create\";\n }\n if (this.layouthint.has(UPDATE_ACTION)) {\n return \"update\";\n }\n if (this.layouthint.has(DELETE_ACTION)) {\n return \"delete\";\n }\n\n return this.getContribution(\"type\", \"general\");\n }\n\n /**\n * Retrieve name of action\n */\n get name(): string {\n return this.getData(\"name\", \"unknown\");\n }\n\n /**\n * retrieve the collection of field attributes as an array\n */\n get fields(): Array<AttributeType> {\n return this._fieldCollection.all;\n }\n\n /**\n * Retrieve the field collection\n */\n get fieldCollection(): AttributeCollection {\n return this._fieldCollection;\n }\n\n /**\n */\n set fieldCollection(fieldCollection: AttributeCollection) {\n this._fieldCollection = fieldCollection;\n }\n\n /**\n * Retrieve querystring of action\n */\n get querystring(): string {\n return this.fields\n .filter((attribute) => attribute.value != null && attribute.value !== \"\")\n .map((attribute) => {\n const { value } = attribute;\n if (value !== null) {\n return `${attribute.name}=${value}`;\n }\n return attribute.name;\n })\n .join(\"&\");\n }\n\n /**\n * Retrieve a field by it's key\n */\n getFieldByKey(key: string): AttributeType | null {\n return this._fieldCollection.getAttributeByKey(key);\n }\n\n /**\n * Indicates if field exists by the given key\n */\n hasFieldByKey(key: string): boolean {\n return this.getFieldByKey(key) !== null;\n }\n\n /**\n * Getting the key/name of this action\n */\n get key(): string {\n return this.data.name;\n }\n\n /**\n * Getting the label of the action\n */\n get label(): string {\n return this.getContribution(\"label\", this.key);\n }\n\n /**\n */\n get isProcessTask(): boolean {\n return has(this.contributions, \"processTask\");\n }\n\n /**\n */\n get processStatus(): ProcessStatusSettingsModel | null {\n if (this.isProcessTask) {\n return new ProcessStatusSettingsModel(\n this.getData(\"processStatus\", {}),\n this.getContribution(\"processTask\", {}),\n this.modelOptions,\n );\n }\n\n return null;\n }\n\n /**\n */\n get icon(): string {\n return this._icon;\n }\n\n /**\n */\n set icon(icon: string) {\n this._icon = icon;\n }\n}\n"],"mappings":";;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,0BAA0B,MAAM,uCAAuC;AAC9E,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAE/B,SACEC,YAAY,EACZ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,EACjC,IAAI,CAACG,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EACvC,IAAI,CAACvB,YACP,CAAC;IACH;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIwC,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACC,KAAK;EACnB;;EAEA;AACF;EACE,IAAID,IAAIA,CAACA,IAAY,EAAE;IACrB,IAAI,CAACC,KAAK,GAAGD,IAAI;EACnB;AACF","ignoreList":[]}
|
|
@@ -81,7 +81,7 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
81
81
|
* Get modelcatalog link
|
|
82
82
|
*/
|
|
83
83
|
get modelcatalog() {
|
|
84
|
-
return LinkModel.create("modelcatalog", "/modelcatalog", "Model catalog", this.
|
|
84
|
+
return LinkModel.create("modelcatalog", "/modelcatalog", "Model catalog", this.modelOptions);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","DEFAULT_AUTHENTICATION_TYPE","ApplicationModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","setChildModels","models","userServiceModel","_findInstanceProperty","call","model","userServices","label","getContribution","authenticationTypes","sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","create","
|
|
1
|
+
{"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","DEFAULT_AUTHENTICATION_TYPE","ApplicationModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","setChildModels","models","userServiceModel","_findInstanceProperty","call","model","userServices","label","getContribution","authenticationTypes","sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","create","modelOptions","_userServices","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) =>\n a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1,\n );\n }\n\n return [DEFAULT_AUTHENTICATION_TYPE];\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\n \"modelcatalog\",\n \"/modelcatalog\",\n \"Model catalog\",\n this.modelOptions,\n );\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices?.userLink) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get userMustChangePassword(): boolean {\n return this.userServices?.mustChangePassword ?? false;\n }\n}\n"],"mappings":";;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,iBAAiB,MAAM,2BAA2B;AAEzD,SAASC,sBAAsB,QAAQ,kBAAkB;AAEzD,SAASC,2BAA2B,QAAQ,iBAAiB;AAO7D;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASL,aAAa,CAAC;EAAAM,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA;EAAA;EAG1D;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,aAAa;EACtB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,aAAa;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