@beinformed/ui 1.57.1 → 1.57.3
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 +20 -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/useModularUI.js +9 -8
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +2 -4
- 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 +9 -8
- 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 +8 -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/useModularUI.js +9 -8
- package/lib/hooks/useModularUI.js.flow +12 -9
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +2 -4
- package/lib/hooks/useModularUIBasic.js.flow +3 -4
- 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 +8 -7
- package/lib/models/href/Href.js.flow +17 -10
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +5 -8
- 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 +8 -11
- package/lib/redux/_modularui/ModularUIUtils.js.flow +13 -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/useModularUI.js +12 -9
- package/src/hooks/useModularUIBasic.js +3 -4
- 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 +17 -10
- package/src/models/href/__tests__/Href.spec.js +5 -8
- 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 +13 -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
|
@@ -20,13 +20,13 @@ var _Constants = require("../../constants/Constants");
|
|
|
20
20
|
/**
|
|
21
21
|
* Get content items recursively
|
|
22
22
|
*/
|
|
23
|
-
const getItems = (items, entryDate) => (0, _map.default)(items).call(items, item => {
|
|
23
|
+
const getItems = (items, entryDate, modelOptions) => (0, _map.default)(items).call(items, item => {
|
|
24
24
|
const link = new _ContentLinkModel.default({
|
|
25
25
|
...item,
|
|
26
26
|
section: item._id
|
|
27
|
-
}, entryDate);
|
|
27
|
+
}, entryDate, modelOptions);
|
|
28
28
|
if (item.items) {
|
|
29
|
-
link.items = getItems(item.items, entryDate);
|
|
29
|
+
link.items = getItems(item.items, entryDate, modelOptions);
|
|
30
30
|
}
|
|
31
31
|
return link;
|
|
32
32
|
});
|
|
@@ -101,14 +101,14 @@ class ContentTOCModel extends _ResourceModel.default {
|
|
|
101
101
|
/**
|
|
102
102
|
*/
|
|
103
103
|
get selfContentLink() {
|
|
104
|
-
return new _ContentLinkModel.default(this.data, this.entryDate);
|
|
104
|
+
return new _ContentLinkModel.default(this.data, this.entryDate, this.modelOptions);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Get sub items of toc
|
|
109
109
|
*/
|
|
110
110
|
get items() {
|
|
111
|
-
return this.data.items ? getItems(this.data.items, this.entryDate) : [];
|
|
111
|
+
return this.data.items ? getItems(this.data.items, this.entryDate, this.modelOptions) : [];
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ class ContentTOCModel extends _ResourceModel.default {
|
|
|
117
117
|
get categories() {
|
|
118
118
|
if (this.data.categories) {
|
|
119
119
|
var _context;
|
|
120
|
-
return (0, _map.default)(_context = this.data.categories).call(_context, category => new _ContentLinkModel.default(category));
|
|
120
|
+
return (0, _map.default)(_context = this.data.categories).call(_context, category => new _ContentLinkModel.default(category, null, this.modelOptions));
|
|
121
121
|
}
|
|
122
122
|
return [];
|
|
123
123
|
}
|
|
@@ -146,7 +146,7 @@ class ContentTOCModel extends _ResourceModel.default {
|
|
|
146
146
|
const [key] = (0, _keys.default)(filter);
|
|
147
147
|
return (0, _objects.has)(this.data?.filter, key);
|
|
148
148
|
})
|
|
149
|
-
});
|
|
149
|
+
}, this.modelOptions);
|
|
150
150
|
}
|
|
151
151
|
return this._filterCollection;
|
|
152
152
|
}
|
|
@@ -9,7 +9,7 @@ import Href from "../href/Href";
|
|
|
9
9
|
|
|
10
10
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
11
11
|
|
|
12
|
-
import type { ModularUIModel } from "../types";
|
|
12
|
+
import type { ModelOptions, ModularUIModel } from "../types";
|
|
13
13
|
import type { ModularUIResponse } from "../../modularui";
|
|
14
14
|
import type LinkModel from "../links/LinkModel";
|
|
15
15
|
|
|
@@ -19,6 +19,7 @@ import type LinkModel from "../links/LinkModel";
|
|
|
19
19
|
const getItems = (
|
|
20
20
|
items: Array<Object>,
|
|
21
21
|
entryDate: ISO_DATE | null,
|
|
22
|
+
modelOptions?: ModelOptions,
|
|
22
23
|
): Array<ContentLinkModel> =>
|
|
23
24
|
items.map((item) => {
|
|
24
25
|
const link = new ContentLinkModel(
|
|
@@ -27,10 +28,11 @@ const getItems = (
|
|
|
27
28
|
section: item._id,
|
|
28
29
|
},
|
|
29
30
|
entryDate,
|
|
31
|
+
modelOptions,
|
|
30
32
|
);
|
|
31
33
|
|
|
32
34
|
if (item.items) {
|
|
33
|
-
link.items = getItems(item.items, entryDate);
|
|
35
|
+
link.items = getItems(item.items, entryDate, modelOptions);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
return link;
|
|
@@ -111,14 +113,16 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
111
113
|
/**
|
|
112
114
|
*/
|
|
113
115
|
get selfContentLink(): ContentLinkModel {
|
|
114
|
-
return new ContentLinkModel(this.data, this.entryDate);
|
|
116
|
+
return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
/**
|
|
118
120
|
* Get sub items of toc
|
|
119
121
|
*/
|
|
120
122
|
get items(): Array<ContentLinkModel> {
|
|
121
|
-
return this.data.items
|
|
123
|
+
return this.data.items
|
|
124
|
+
? getItems(this.data.items, this.entryDate, this.modelOptions)
|
|
125
|
+
: [];
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
/**
|
|
@@ -127,7 +131,7 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
127
131
|
get categories(): Array<ContentLinkModel> {
|
|
128
132
|
if (this.data.categories) {
|
|
129
133
|
return this.data.categories.map(
|
|
130
|
-
(category) => new ContentLinkModel(category),
|
|
134
|
+
(category) => new ContentLinkModel(category, null, this.modelOptions),
|
|
131
135
|
);
|
|
132
136
|
}
|
|
133
137
|
|
|
@@ -153,12 +157,16 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
153
157
|
*/
|
|
154
158
|
get filterCollection(): FilterCollection {
|
|
155
159
|
if (!this._filterCollection) {
|
|
156
|
-
this._filterCollection = new FilterCollection(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
this._filterCollection = new FilterCollection(
|
|
161
|
+
this.data.filter,
|
|
162
|
+
{
|
|
163
|
+
filter: this.contributions.filter.filter((filter) => {
|
|
164
|
+
const [key] = Object.keys(filter);
|
|
165
|
+
return has(this.data?.filter, key);
|
|
166
|
+
}),
|
|
167
|
+
},
|
|
168
|
+
this.modelOptions,
|
|
169
|
+
);
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
return this._filterCollection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTOCModel.js","names":["_objects","require","_ResourceModel","_interopRequireDefault","_FilterCollection","_ContentLinkModel","_ContentTypeModel","_Href","_Constants","getItems","items","entryDate","_map","default","call","item","link","ContentLinkModel","section","_id","ContentTOCModel","ResourceModel","constructor","arguments","_defineProperty2","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","model","label","getData","selfhref","href","Href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","categories","_context","category","_contentType","ContentTypeModel","_filterCollection","_context2","FilterCollection","_filter","key","_keys","has","timeversionFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","attribute","exports"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentTOC\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n return this.data.items
|
|
1
|
+
{"version":3,"file":"ContentTOCModel.js","names":["_objects","require","_ResourceModel","_interopRequireDefault","_FilterCollection","_ContentLinkModel","_ContentTypeModel","_Href","_Constants","getItems","items","entryDate","modelOptions","_map","default","call","item","link","ContentLinkModel","section","_id","ContentTOCModel","ResourceModel","constructor","arguments","_defineProperty2","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","model","label","getData","selfhref","href","Href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","categories","_context","category","_contentType","ContentTypeModel","_filterCollection","_context2","FilterCollection","_filter","key","_keys","has","timeversionFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","attribute","exports"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ContentTOC\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n return this.data.items\n ? getItems(this.data.items, this.entryDate, this.modelOptions)\n : [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve entrydate of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAEA,IAAAO,UAAA,GAAAP,OAAA;AAMA;AACA;AACA;AACA,MAAMQ,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3B,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAMM,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIC,yBAAgB,CAC/B;IACE,GAAGF,IAAI;IACPG,OAAO,EAAEH,IAAI,CAACI;EAChB,CAAC,EACDT,SAAS,EACTC,YACF,CAAC;EAED,IAAII,IAAI,CAACN,KAAK,EAAE;IACdO,IAAI,CAACP,KAAK,GAAGD,QAAQ,CAACO,IAAI,CAACN,KAAK,EAAEC,SAAS,EAAEC,YAAY,CAAC;EAC5D;EAEA,OAAOK,IAAI;AACb,CAAC,CAAC;;AAEJ;AACA;AACA;AACe,MAAMI,eAAe,SAASC,sBAAa,CAAC;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAX,OAAA,wBACjB,IAAI;IAAA,IAAAW,gB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AG,IAAIE,yBAAgB,KAAAC,OAAA,CAAAnD,OAAA,EAC3C,IAAI,CAACe,IAAI,GACT;QACEoB,MAAM,EAAE,IAAAgB,OAAA,CAAAnD,OAAA,EAAAiD,SAAA,OAAAE,OAAA,CAAAnD,OAAA,MAAI,CAACgB,aAAa,GAAAf,IAAA,CAAAgD,SAAA,EAAgBd,MAAM,IAAK;UACnD,MAAM,CAACiB,GAAG,CAAC,GAAG,IAAAC,KAAA,CAAArD,OAAA,EAAYmC,MAAM,CAAC;UACjC,OAAO,IAAAmB,YAAG,EAAC,IAAI,CAACvC,IAAI,EAAEoB,MAAM,EAAEiB,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAACtD,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACkD,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAInD,SAASA,CAAA,EAAoB;IAC/B,MAAM0D,iBAAiB,GAAG,IAAI,CAACtB,gBAAgB,CAACuB,uBAAuB,CACrEC,kCACF,CAAC;IAED,OAAOF,iBAAiB,EAAEG,SAAS,EAAEpB,KAAK,IAAI,IAAI;EACpD;AACF;AAACqB,OAAA,CAAA3D,OAAA,GAAAO,eAAA","ignoreList":[]}
|
|
@@ -14,20 +14,15 @@ var _SubSectionModel = _interopRequireDefault(require("./SubSectionModel"));
|
|
|
14
14
|
var _createHash = require("../../utils/helpers/createHash");
|
|
15
15
|
var _LinkModel = _interopRequireDefault(require("../links/LinkModel"));
|
|
16
16
|
var _utils = require("../../utils");
|
|
17
|
-
var _constants = require("../../constants");
|
|
18
17
|
/**
|
|
19
18
|
*/
|
|
20
19
|
class SectionModel extends _BaseModel.default {
|
|
21
|
-
constructor(data, entryDate,
|
|
22
|
-
super(data, {});
|
|
20
|
+
constructor(data, entryDate, modelOptions) {
|
|
21
|
+
super(data, {}, modelOptions);
|
|
23
22
|
(0, _defineProperty2.default)(this, "_entryDate", void 0);
|
|
24
23
|
(0, _defineProperty2.default)(this, "_selflink", void 0);
|
|
25
24
|
(0, _defineProperty2.default)(this, "_childSections", void 0);
|
|
26
|
-
(0, _defineProperty2.default)(this, "_origin", "");
|
|
27
|
-
(0, _defineProperty2.default)(this, "_contextPath", (0, _constants.getBasePath)());
|
|
28
25
|
this._entryDate = entryDate;
|
|
29
|
-
this._origin = origin || "";
|
|
30
|
-
this._contextPath = contextPath || (0, _constants.getBasePath)();
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
/**
|
|
@@ -40,7 +35,7 @@ class SectionModel extends _BaseModel.default {
|
|
|
40
35
|
*/
|
|
41
36
|
get selflink() {
|
|
42
37
|
if (!this._selflink) {
|
|
43
|
-
this._selflink = new _LinkModel.default(this.data._links?.self, null, this.
|
|
38
|
+
this._selflink = new _LinkModel.default(this.data._links?.self, null, this.modelOptions);
|
|
44
39
|
}
|
|
45
40
|
return this._selflink;
|
|
46
41
|
}
|
|
@@ -113,7 +108,7 @@ class SectionModel extends _BaseModel.default {
|
|
|
113
108
|
label: childSection.label,
|
|
114
109
|
sourceLabel: childSection.sourceLabel,
|
|
115
110
|
_links: childSection._links
|
|
116
|
-
}, this.entryDate, this.
|
|
111
|
+
}, this.entryDate, this.modelOptions)) : [];
|
|
117
112
|
}
|
|
118
113
|
|
|
119
114
|
/**
|
|
@@ -125,7 +120,7 @@ class SectionModel extends _BaseModel.default {
|
|
|
125
120
|
label: this.data.label,
|
|
126
121
|
sourceLabel: this.data.sourceLabel,
|
|
127
122
|
_links: this.data._links
|
|
128
|
-
}, this.entryDate, this.
|
|
123
|
+
}, this.entryDate, this.modelOptions);
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
/**
|
|
@@ -134,7 +129,7 @@ class SectionModel extends _BaseModel.default {
|
|
|
134
129
|
get childSections() {
|
|
135
130
|
if (!this._childSections && this.data.childSections) {
|
|
136
131
|
var _context2, _context3;
|
|
137
|
-
this._childSections = (0, _map.default)(_context2 = (0, _filter.default)(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this.
|
|
132
|
+
this._childSections = (0, _map.default)(_context2 = (0, _filter.default)(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this.modelOptions));
|
|
138
133
|
}
|
|
139
134
|
return this._childSections || [];
|
|
140
135
|
}
|
|
@@ -6,9 +6,10 @@ import SubSectionModel from "./SubSectionModel";
|
|
|
6
6
|
import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
7
7
|
import LinkModel from "../links/LinkModel";
|
|
8
8
|
|
|
9
|
-
import type Href from "../href/Href";
|
|
10
9
|
import { retrieveText } from "../../utils";
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
import type Href from "../href/Href";
|
|
12
|
+
import type { ModelOptions } from "../types";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
*/
|
|
@@ -16,20 +17,15 @@ class SectionModel extends BaseModel {
|
|
|
16
17
|
_entryDate: ISO_DATE | null;
|
|
17
18
|
_selflink: ?LinkModel;
|
|
18
19
|
_childSections: Array<SectionModel>;
|
|
19
|
-
_origin: string = "";
|
|
20
|
-
_contextPath: string = getBasePath();
|
|
21
20
|
|
|
22
21
|
constructor(
|
|
23
22
|
data: Object,
|
|
24
23
|
entryDate: ISO_DATE | null,
|
|
25
|
-
|
|
26
|
-
contextPath?: string,
|
|
24
|
+
modelOptions?: ModelOptions,
|
|
27
25
|
) {
|
|
28
|
-
super(data, {});
|
|
26
|
+
super(data, {}, modelOptions);
|
|
29
27
|
|
|
30
28
|
this._entryDate = entryDate;
|
|
31
|
-
this._origin = origin || "";
|
|
32
|
-
this._contextPath = contextPath || getBasePath();
|
|
33
29
|
}
|
|
34
30
|
|
|
35
31
|
/**
|
|
@@ -45,8 +41,7 @@ class SectionModel extends BaseModel {
|
|
|
45
41
|
this._selflink = new LinkModel(
|
|
46
42
|
this.data._links?.self,
|
|
47
43
|
null,
|
|
48
|
-
this.
|
|
49
|
-
this._contextPath,
|
|
44
|
+
this.modelOptions,
|
|
50
45
|
);
|
|
51
46
|
}
|
|
52
47
|
return this._selflink;
|
|
@@ -125,8 +120,7 @@ class SectionModel extends BaseModel {
|
|
|
125
120
|
_links: childSection._links,
|
|
126
121
|
},
|
|
127
122
|
this.entryDate,
|
|
128
|
-
this.
|
|
129
|
-
this._contextPath,
|
|
123
|
+
this.modelOptions,
|
|
130
124
|
),
|
|
131
125
|
)
|
|
132
126
|
: [];
|
|
@@ -144,8 +138,7 @@ class SectionModel extends BaseModel {
|
|
|
144
138
|
_links: this.data._links,
|
|
145
139
|
},
|
|
146
140
|
this.entryDate,
|
|
147
|
-
this.
|
|
148
|
-
this._contextPath,
|
|
141
|
+
this.modelOptions,
|
|
149
142
|
);
|
|
150
143
|
}
|
|
151
144
|
|
|
@@ -158,12 +151,7 @@ class SectionModel extends BaseModel {
|
|
|
158
151
|
.filter((childSection) => "body" in childSection)
|
|
159
152
|
.map(
|
|
160
153
|
(childSection) =>
|
|
161
|
-
new SectionModel(
|
|
162
|
-
childSection,
|
|
163
|
-
this.entryDate,
|
|
164
|
-
this._origin,
|
|
165
|
-
this._contextPath,
|
|
166
|
-
),
|
|
154
|
+
new SectionModel(childSection, this.entryDate, this.modelOptions),
|
|
167
155
|
);
|
|
168
156
|
}
|
|
169
157
|
return this._childSections || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ContentLinkModel","_SubSectionModel","_createHash","_LinkModel","_utils","_constants","SectionModel","BaseModel","constructor","data","entryDate","origin","contextPath","_defineProperty2","default","getBasePath","_entryDate","_origin","_contextPath","referred","selflink","_selflink","LinkModel","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","retrieveText","childSectionLinks","_context","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context2","_context3","_filter","sections","subSections","_context4","subSection","SubSectionModel","referenceHash","createHashFromHref","getReferredSections","push","referredChilds","_default","exports"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport type Href from \"../href/Href\";\nimport { retrieveText } from \"../../utils\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, {});\n\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this._origin,\n this._contextPath,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this._origin,\n this._contextPath,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(\n childSection,\n this.entryDate,\n this._origin,\n this._contextPath,\n ),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,U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AAIC,WAAWA,CAAA,EAA2B;IAAA,IAAAC,SAAA;IACxC,OAAO,IAAI,CAAC3C,IAAI,CAAC0C,WAAW,GACxB,IAAAX,IAAA,CAAA1B,OAAA,EAAAsC,SAAA,OAAI,CAAC3C,IAAI,CAAC0C,WAAW,EAAAV,IAAA,CAAAW,SAAA,EAClBC,UAAU,IAAK,IAAIC,wBAAe,CAACD,UAAU,CAChD,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIE,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAAC,8BAAkB,EAAC,IAAI,CAAC/B,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACEgC,mBAAmBA,CAAA,EAA0C;IAC3D,MAAMP,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAClC,QAAQ,EAAE;QACvB+B,QAAQ,CAACQ,IAAI,CAACL,UAAU,CAAC;MAC3B;MAEA,MAAMM,cAAc,GAAGN,UAAU,CAACI,mBAAmB,CAAC,CAAC;MACvDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMjB,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACvB,QAAQ,EAAE;QACzB+B,QAAQ,CAACQ,IAAI,CAAChB,YAAY,CAAC;MAC7B;MAEA,MAAMiB,cAAc,GAAGjB,YAAY,CAACe,mBAAmB,CAAC,CAAC;MACzDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOT,QAAQ;EACjB;AACF;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAA/C,OAAA,GAEcR,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SectionModel.js","names":["_BaseModel","_interopRequireDefault","require","_ContentLinkModel","_SubSectionModel","_createHash","_LinkModel","_utils","SectionModel","BaseModel","constructor","data","entryDate","modelOptions","_defineProperty2","default","_entryDate","referred","selflink","_selflink","LinkModel","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","retrieveText","childSectionLinks","_context","childSections","_map","call","childSection","ContentLinkModel","section","selfContentLink","_childSections","_context2","_context3","_filter","sections","subSections","_context4","subSection","SubSectionModel","referenceHash","createHashFromHref","getReferredSections","push","referredChilds","_default","exports"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport { retrieveText } from \"../../utils\";\n\nimport type Href from \"../href/Href\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n ) {\n super(data, {}, modelOptions);\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this.modelOptions,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this.modelOptions,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(childSection, this.entryDate, this.modelOptions),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,i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UAAU,CAChD,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACE,IAAIE,aAAaA,CAAA,EAAW;IAC1B,OAAO,IAAAC,8BAAkB,EAAC,IAAI,CAAC/B,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACEgC,mBAAmBA,CAAA,EAA0C;IAC3D,MAAMP,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAClC,QAAQ,EAAE;QACvB+B,QAAQ,CAACQ,IAAI,CAACL,UAAU,CAAC;MAC3B;MAEA,MAAMM,cAAc,GAAGN,UAAU,CAACI,mBAAmB,CAAC,CAAC;MACvDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMjB,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACvB,QAAQ,EAAE;QACzB+B,QAAQ,CAACQ,IAAI,CAAChB,YAAY,CAAC;MAC7B;MAEA,MAAMiB,cAAc,GAAGjB,YAAY,CAACe,mBAAmB,CAAC,CAAC;MACzDP,QAAQ,CAACQ,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOT,QAAQ;EACjB;AACF;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEcP,YAAY","ignoreList":[]}
|
|
@@ -89,7 +89,10 @@ class DetailModel extends _ResourceModel.default {
|
|
|
89
89
|
const [key] = (0, _keys.default)(contribution);
|
|
90
90
|
return (0, _objects.has)(this.data, key);
|
|
91
91
|
}) : [];
|
|
92
|
-
this.attributeCollection = new _AttributeCollection.default(this.data, attributeContributions,
|
|
92
|
+
this.attributeCollection = new _AttributeCollection.default(this.data, attributeContributions, {
|
|
93
|
+
...this.modelOptions,
|
|
94
|
+
isReadonly: true
|
|
95
|
+
});
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
/**
|
|
@@ -132,7 +135,10 @@ class DetailModel extends _ResourceModel.default {
|
|
|
132
135
|
const metadataContributions = this.contributions.metadata ? (0, _map.default)(_context4 = (0, _keys.default)(this.contributions.metadata)).call(_context4, metadataKey => ({
|
|
133
136
|
[metadataKey]: this.contributions.metadata[metadataKey]
|
|
134
137
|
})) : [];
|
|
135
|
-
this.metadataCollection = new _AttributeCollection.default(this.data, metadataContributions,
|
|
138
|
+
this.metadataCollection = new _AttributeCollection.default(this.data, metadataContributions, {
|
|
139
|
+
...this.modelOptions,
|
|
140
|
+
isReadonly: true
|
|
141
|
+
});
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
/**
|
|
@@ -151,7 +157,7 @@ class DetailModel extends _ResourceModel.default {
|
|
|
151
157
|
* Action collection
|
|
152
158
|
*/
|
|
153
159
|
createActionCollection() {
|
|
154
|
-
this._actionCollection = new _ActionCollection.default(this.data.actions, this.contributions.actions, this.
|
|
160
|
+
this._actionCollection = new _ActionCollection.default(this.data.actions, this.contributions.actions, this.modelOptions);
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
/**
|
|
@@ -96,7 +96,7 @@ export default class DetailModel extends ResourceModel {
|
|
|
96
96
|
this.attributeCollection = new AttributeCollection(
|
|
97
97
|
this.data,
|
|
98
98
|
attributeContributions,
|
|
99
|
-
true,
|
|
99
|
+
{ ...this.modelOptions, isReadonly: true },
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -148,7 +148,7 @@ export default class DetailModel extends ResourceModel {
|
|
|
148
148
|
this.metadataCollection = new AttributeCollection(
|
|
149
149
|
this.data,
|
|
150
150
|
metadataContributions,
|
|
151
|
-
true,
|
|
151
|
+
{ ...this.modelOptions, isReadonly: true },
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -171,8 +171,7 @@ export default class DetailModel extends ResourceModel {
|
|
|
171
171
|
this._actionCollection = new ActionCollection(
|
|
172
172
|
this.data.actions,
|
|
173
173
|
this.contributions.actions,
|
|
174
|
-
this.
|
|
175
|
-
this.contextPath,
|
|
174
|
+
this.modelOptions,
|
|
176
175
|
);
|
|
177
176
|
}
|
|
178
177
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailModel.js","names":["_objects","require","_ActionCollection","_interopRequireDefault","_AttributeCollection","_ResourceModel","_LayoutHints","DetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","createAttributeCollection","createMetadataCollection","createActionCollection","type","modelName","isApplicableModel","data","_context","resourceType","contributions","resourcetype","_endsWith","call","_includes","getInitialChildModelLinks","_attributeCollection","setChildModels","models","errors","id","getData","key","label","getContribution","_context2","attributeContributions","attributes","_filter","contribution","_keys","has","attributeCollection","AttributeCollection","collection","_context3","all","attribute","hasTitle","layouthint","hasExact","TITLE","hasAvatar","AVATAR","hasAvatarForTitle","AVATAR_IN_TITLE","isHidden","getAttributeByKey","_context4","metadataContributions","metadata","_map","metadataKey","metadataCollection","_metadataCollection","_actionCollection","ActionCollection","actions","origin","contextPath","actionCollection","isCase","avatarForTitleAttribute","_context5","_find","titleAttribute","_context6","update","model","clonedModel","clone","equals","toString","exports"],"sources":["../../../src/models/detail/DetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport { AVATAR, AVATAR_IN_TITLE, TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Base class for details<br/>\n * For instance the details of case 1<br/>\n * For instance the details of record 12<br/>\n */\nexport default class DetailModel extends ResourceModel {\n _attributeCollection: AttributeCollection;\n _metadataCollection: AttributeCollection;\n _actionCollection: ActionCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createAttributeCollection();\n this.createMetadataCollection();\n this.createActionCollection();\n }\n\n /**\n */\n get type(): string {\n return \"Detail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"DetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype;\n return (\n resourceType &&\n (resourceType.endsWith(\"DetailPanel\") ||\n [\"Detail\", \"CasePropertiesPanel\", \"CasePropertiesPanelDetail\"].includes(\n resourceType,\n ))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\n }\n\n /**\n * Getting the unique identifier of the details\n */\n get id(): string {\n return this.getData(\"_id\", this.key);\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Attribute collection\n */\n createAttributeCollection() {\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [key] = Object.keys(contribution);\n return has(this.data, key);\n })\n : [];\n\n this.attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n true,\n );\n }\n\n /**\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n * Retrieve list of visible attributes\n */\n get attributes(): Array<AttributeType> {\n return this.attributeCollection.all.filter((attribute) => {\n const hasTitle = attribute.layouthint.hasExact(TITLE);\n const hasAvatar = attribute.layouthint.hasExact(AVATAR);\n const hasAvatarForTitle = attribute.layouthint.hasExact(AVATAR_IN_TITLE);\n return (\n !attribute.isHidden &&\n (!hasTitle || (hasTitle && hasAvatar)) &&\n (!hasAvatarForTitle || (hasAvatarForTitle && !hasAvatar))\n );\n });\n }\n\n /**\n * Retrieve an attribute by it's key\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this._attributeCollection.getAttributeByKey(key);\n }\n\n /**\n * Metadata collection\n */\n createMetadataCollection() {\n const metadataContributions = this.contributions.metadata\n ? Object.keys(this.contributions.metadata).map((metadataKey) => ({\n [metadataKey]: this.contributions.metadata[metadataKey],\n }))\n : [];\n\n this.metadataCollection = new AttributeCollection(\n this.data,\n metadataContributions,\n true,\n );\n }\n\n /**\n */\n get metadataCollection(): AttributeCollection {\n return this._metadataCollection;\n }\n\n /**\n */\n set metadataCollection(collection: AttributeCollection) {\n this._metadataCollection = collection;\n }\n\n /**\n * Action collection\n */\n createActionCollection() {\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n this.origin,\n this.contextPath,\n );\n }\n\n /**\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n */\n set actionCollection(actionCollection: ActionCollection) {\n this._actionCollection = actionCollection;\n }\n\n /**\n * Determines if this is a case\n */\n get isCase(): boolean {\n return this.contributions.resourcetype === \"CaseView\";\n }\n\n /**\n * Getting the attribute that has as layout hint 'avatar-for-title'\n */\n get avatarForTitleAttribute(): ?AttributeType {\n return this._attributeCollection.find(\n (attribute) =>\n attribute.layouthint.hasExact(AVATAR_IN_TITLE) &&\n attribute.layouthint.hasExact(AVATAR),\n );\n }\n\n /**\n * Getting the attribute that has as layout hint 'title'\n */\n get titleAttribute(): ?AttributeType {\n return this._attributeCollection.find(\n (attribute) =>\n attribute.layouthint.has(TITLE) &&\n !attribute.layouthint.hasExact(AVATAR),\n );\n }\n\n /**\n * Update current detail with a new detail model and return a cloned version of the model\n */\n update(model: ModularUIModel): DetailModel {\n if (model instanceof DetailModel) {\n const clonedModel = this.clone();\n\n clonedModel.attributeCollection = model._attributeCollection;\n clonedModel.metadataCollection = model._metadataCollection;\n clonedModel.actionCollection = model._actionCollection;\n\n return clonedModel;\n }\n\n return this;\n }\n\n /**\n */\n equals(model: DetailModel): boolean {\n return this.id.toString()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UAAU,CAACC,QAAQ,CAACG,mBAAM,CACzC,CAAC;EACH;;EAEA;AACF;AACA;EACEwB,MAAMA,CAACC,KAAqB,EAAe;IACzC,IAAIA,KAAK,YAAYzE,WAAW,EAAE;MAChC,MAAM0E,WAAW,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;MAEhCD,WAAW,CAACrC,mBAAmB,GAAGoC,KAAK,CAACpD,oBAAoB;MAC5DqD,WAAW,CAAChB,kBAAkB,GAAGe,KAAK,CAACd,mBAAmB;MAC1De,WAAW,CAACT,gBAAgB,GAAGQ,KAAK,CAACb,iBAAiB;MAEtD,OAAOc,WAAW;IACpB;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACEE,MAAMA,CAACH,KAAkB,EAAW;IAClC,OAAO,IAAI,CAAChD,EAAE,CAACoD,QAAQ,CAAC,CAAC,KAAKJ,KAAK,CAAChD,EAAE,CAACoD,QAAQ,CAAC,CAAC;EACnD;AACF;AAACC,OAAA,CAAAzE,OAAA,GAAAL,WAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"DetailModel.js","names":["_objects","require","_ActionCollection","_interopRequireDefault","_AttributeCollection","_ResourceModel","_LayoutHints","DetailModel","ResourceModel","constructor","modularuiResponse","_defineProperty2","default","createAttributeCollection","createMetadataCollection","createActionCollection","type","modelName","isApplicableModel","data","_context","resourceType","contributions","resourcetype","_endsWith","call","_includes","getInitialChildModelLinks","_attributeCollection","setChildModels","models","errors","id","getData","key","label","getContribution","_context2","attributeContributions","attributes","_filter","contribution","_keys","has","attributeCollection","AttributeCollection","modelOptions","isReadonly","collection","_context3","all","attribute","hasTitle","layouthint","hasExact","TITLE","hasAvatar","AVATAR","hasAvatarForTitle","AVATAR_IN_TITLE","isHidden","getAttributeByKey","_context4","metadataContributions","metadata","_map","metadataKey","metadataCollection","_metadataCollection","_actionCollection","ActionCollection","actions","actionCollection","isCase","avatarForTitleAttribute","_context5","_find","titleAttribute","_context6","update","model","clonedModel","clone","equals","toString","exports"],"sources":["../../../src/models/detail/DetailModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ActionCollection from \"../actions/ActionCollection\";\nimport AttributeCollection from \"../attributes/AttributeCollection\";\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport { AVATAR, AVATAR_IN_TITLE, TITLE } from \"../../constants/LayoutHints\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Base class for details<br/>\n * For instance the details of case 1<br/>\n * For instance the details of record 12<br/>\n */\nexport default class DetailModel extends ResourceModel {\n _attributeCollection: AttributeCollection;\n _metadataCollection: AttributeCollection;\n _actionCollection: ActionCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this.createAttributeCollection();\n this.createMetadataCollection();\n this.createActionCollection();\n }\n\n /**\n */\n get type(): string {\n return \"Detail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"DetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype;\n return (\n resourceType &&\n (resourceType.endsWith(\"DetailPanel\") ||\n [\"Detail\", \"CasePropertiesPanel\", \"CasePropertiesPanelDetail\"].includes(\n resourceType,\n ))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this._attributeCollection.getInitialChildModelLinks();\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n this._attributeCollection.setChildModels(models, errors);\n }\n\n /**\n * Getting the unique identifier of the details\n */\n get id(): string {\n return this.getData(\"_id\", this.key);\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Attribute collection\n */\n createAttributeCollection() {\n const attributeContributions = this.contributions.attributes\n ? this.contributions.attributes.filter((contribution) => {\n const [key] = Object.keys(contribution);\n return has(this.data, key);\n })\n : [];\n\n this.attributeCollection = new AttributeCollection(\n this.data,\n attributeContributions,\n { ...this.modelOptions, isReadonly: true },\n );\n }\n\n /**\n */\n get attributeCollection(): AttributeCollection {\n return this._attributeCollection;\n }\n\n /**\n */\n set attributeCollection(collection: AttributeCollection) {\n this._attributeCollection = collection;\n }\n\n /**\n * Retrieve list of visible attributes\n */\n get attributes(): Array<AttributeType> {\n return this.attributeCollection.all.filter((attribute) => {\n const hasTitle = attribute.layouthint.hasExact(TITLE);\n const hasAvatar = attribute.layouthint.hasExact(AVATAR);\n const hasAvatarForTitle = attribute.layouthint.hasExact(AVATAR_IN_TITLE);\n return (\n !attribute.isHidden &&\n (!hasTitle || (hasTitle && hasAvatar)) &&\n (!hasAvatarForTitle || (hasAvatarForTitle && !hasAvatar))\n );\n });\n }\n\n /**\n * Retrieve an attribute by it's key\n */\n getAttributeByKey(key: string): AttributeType | null {\n return this._attributeCollection.getAttributeByKey(key);\n }\n\n /**\n * Metadata collection\n */\n createMetadataCollection() {\n const metadataContributions = this.contributions.metadata\n ? Object.keys(this.contributions.metadata).map((metadataKey) => ({\n [metadataKey]: this.contributions.metadata[metadataKey],\n }))\n : [];\n\n this.metadataCollection = new AttributeCollection(\n this.data,\n metadataContributions,\n { ...this.modelOptions, isReadonly: true },\n );\n }\n\n /**\n */\n get metadataCollection(): AttributeCollection {\n return this._metadataCollection;\n }\n\n /**\n */\n set metadataCollection(collection: AttributeCollection) {\n this._metadataCollection = collection;\n }\n\n /**\n * Action collection\n */\n createActionCollection() {\n this._actionCollection = new ActionCollection(\n this.data.actions,\n this.contributions.actions,\n this.modelOptions,\n );\n }\n\n /**\n */\n get actionCollection(): ActionCollection {\n return this._actionCollection;\n }\n\n /**\n */\n set actionCollection(actionCollection: ActionCollection) {\n this._actionCollection = actionCollection;\n }\n\n /**\n * Determines if this is a case\n */\n get isCase(): boolean {\n return this.contributions.resourcetype === \"CaseView\";\n }\n\n /**\n * Getting the attribute that has as layout hint 'avatar-for-title'\n */\n get avatarForTitleAttribute(): ?AttributeType {\n return this._attributeCollection.find(\n (attribute) =>\n attribute.layouthint.hasExact(AVATAR_IN_TITLE) &&\n attribute.layouthint.hasExact(AVATAR),\n );\n }\n\n /**\n * Getting the attribute that has as layout hint 'title'\n */\n get titleAttribute(): ?AttributeType {\n return this._attributeCollection.find(\n (attribute) =>\n attribute.layouthint.has(TITLE) &&\n !attribute.layouthint.hasExact(AVATAR),\n );\n }\n\n /**\n * Update current detail with a new detail model and return a cloned version of the model\n */\n update(model: ModularUIModel): DetailModel {\n if (model instanceof DetailModel) {\n const clonedModel = this.clone();\n\n clonedModel.attributeCollection = model._attributeCollection;\n clonedModel.metadataCollection = model._metadataCollection;\n clonedModel.actionCollection = model._actionCollection;\n\n return clonedModel;\n }\n\n return this;\n }\n\n /**\n */\n equals(model: DetailModel): boolean {\n return this.id.toString() === model.id.toString();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,cAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,YAAA,GAAAL,OAAA;AAOA;AACA;AACA;AACA;AACA;AACe,MAAMM,WAAW,SAASC,sBAAa,CAAC;EAKrD;AACF;EACEC,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEzB,IAAI,CAACC,yBAAyB,CAAC,CAAC;IAChC,IAAI,CAACC,wBAAwB,CAAC,CAAC;IAC/B,IAAI,CAACC,sBAAsB,CAAC,CAAC;EAC/B;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAA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C,CAAC;EACnD;AACF;AAACC,OAAA,CAAAzE,OAAA,GAAAL,WAAA","ignoreList":[]}
|
|
@@ -22,15 +22,13 @@ class ErrorResponse {
|
|
|
22
22
|
/**
|
|
23
23
|
* Construct ErrorResponse
|
|
24
24
|
*/
|
|
25
|
-
constructor(data, connectKey,
|
|
25
|
+
constructor(data, connectKey, modelOptions) {
|
|
26
26
|
(0, _defineProperty2.default)(this, "_error", void 0);
|
|
27
27
|
(0, _defineProperty2.default)(this, "_connectKey", void 0);
|
|
28
|
-
(0, _defineProperty2.default)(this, "
|
|
29
|
-
(0, _defineProperty2.default)(this, "_contextPath", (0, _constants.getBasePath)());
|
|
28
|
+
(0, _defineProperty2.default)(this, "_modelOptions", void 0);
|
|
30
29
|
this._error = data;
|
|
31
30
|
this._connectKey = connectKey;
|
|
32
|
-
this.
|
|
33
|
-
this._contextPath = contextPath || (0, _constants.getBasePath)();
|
|
31
|
+
this._modelOptions = modelOptions;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
/**
|
|
@@ -48,13 +46,13 @@ class ErrorResponse {
|
|
|
48
46
|
/**
|
|
49
47
|
*/
|
|
50
48
|
get origin() {
|
|
51
|
-
return this.
|
|
49
|
+
return this._modelOptions?.origin || "";
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
/**
|
|
55
53
|
*/
|
|
56
54
|
get contextPath() {
|
|
57
|
-
return this.
|
|
55
|
+
return this._modelOptions?.contextPath || (0, _constants.getBasePathModularUI)();
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
/**
|
|
@@ -163,7 +161,7 @@ class ErrorResponse {
|
|
|
163
161
|
*/
|
|
164
162
|
get redirectHref() {
|
|
165
163
|
if (this.response.redirect?.href) {
|
|
166
|
-
return new _Href.default(this.response.redirect?.href, "", this.
|
|
164
|
+
return new _Href.default(this.response.redirect?.href, "", this._modelOptions);
|
|
167
165
|
}
|
|
168
166
|
return new _Href.default();
|
|
169
167
|
}
|
|
@@ -278,7 +276,7 @@ class ErrorResponse {
|
|
|
278
276
|
* Get response url
|
|
279
277
|
*/
|
|
280
278
|
get changePasswordHref() {
|
|
281
|
-
return this.properties.redirect ? new _Href.default(this.properties.redirect, "", this.
|
|
279
|
+
return this.properties.redirect ? new _Href.default(this.properties.redirect, "", this._modelOptions) : null;
|
|
282
280
|
}
|
|
283
281
|
|
|
284
282
|
/**
|
|
@@ -3,7 +3,8 @@ import Href from "../href/Href";
|
|
|
3
3
|
|
|
4
4
|
import type { MessageParameters } from "../../i18n/types";
|
|
5
5
|
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
6
|
-
import {
|
|
6
|
+
import { getBasePathModularUI } from "../../constants";
|
|
7
|
+
import type { ModelOptions } from "../types";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
*/
|
|
@@ -34,23 +35,16 @@ export default class ErrorResponse {
|
|
|
34
35
|
_error: Object;
|
|
35
36
|
_connectKey: ?string;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
_contextPath: string = getBasePath();
|
|
38
|
+
_modelOptions: ?ModelOptions;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Construct ErrorResponse
|
|
42
42
|
*/
|
|
43
|
-
constructor(
|
|
44
|
-
data: Object,
|
|
45
|
-
connectKey?: string,
|
|
46
|
-
origin?: string,
|
|
47
|
-
contextPath?: string,
|
|
48
|
-
) {
|
|
43
|
+
constructor(data: Object, connectKey?: string, modelOptions?: ModelOptions) {
|
|
49
44
|
this._error = data;
|
|
50
45
|
this._connectKey = connectKey;
|
|
51
46
|
|
|
52
|
-
this.
|
|
53
|
-
this._contextPath = contextPath || getBasePath();
|
|
47
|
+
this._modelOptions = modelOptions;
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
/**
|
|
@@ -68,13 +62,13 @@ export default class ErrorResponse {
|
|
|
68
62
|
/**
|
|
69
63
|
*/
|
|
70
64
|
get origin(): string {
|
|
71
|
-
return this.
|
|
65
|
+
return this._modelOptions?.origin || "";
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
/**
|
|
75
69
|
*/
|
|
76
70
|
get contextPath(): string {
|
|
77
|
-
return this.
|
|
71
|
+
return this._modelOptions?.contextPath || getBasePathModularUI();
|
|
78
72
|
}
|
|
79
73
|
|
|
80
74
|
/**
|
|
@@ -186,12 +180,7 @@ export default class ErrorResponse {
|
|
|
186
180
|
*/
|
|
187
181
|
get redirectHref(): Href {
|
|
188
182
|
if (this.response.redirect?.href) {
|
|
189
|
-
return new Href(
|
|
190
|
-
this.response.redirect?.href,
|
|
191
|
-
"",
|
|
192
|
-
this.origin,
|
|
193
|
-
this.contextPath,
|
|
194
|
-
);
|
|
183
|
+
return new Href(this.response.redirect?.href, "", this._modelOptions);
|
|
195
184
|
}
|
|
196
185
|
return new Href();
|
|
197
186
|
}
|
|
@@ -320,7 +309,7 @@ export default class ErrorResponse {
|
|
|
320
309
|
*/
|
|
321
310
|
get changePasswordHref(): ?Href {
|
|
322
311
|
return this.properties.redirect
|
|
323
|
-
? new Href(this.properties.redirect, "", this.
|
|
312
|
+
? new Href(this.properties.redirect, "", this._modelOptions)
|
|
324
313
|
: null;
|
|
325
314
|
}
|
|
326
315
|
|