@beinformed/ui 1.30.1 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/exceptions/NetworkException.js.map +1 -1
- package/esm/hooks/useAllFormsOnModel.js.map +1 -1
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useContent.js.map +1 -1
- package/esm/hooks/useForm.js +3 -2
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useI18n.js.map +1 -1
- package/esm/hooks/useModal.js.map +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/hooks/useModels.js.map +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useNotification.js.map +1 -1
- package/esm/hooks/useProgressIndicator.js.map +1 -1
- package/esm/hooks/useRouter.js.map +1 -1
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/i18n/Message.js.map +1 -1
- package/esm/i18n/withMessage.js.map +1 -1
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/CaptchaAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
- package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/esm/models/attributes/StringAttributeModel.js.map +1 -1
- package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
- package/esm/models/attributes/XMLAttributeModel.js.map +1 -1
- package/esm/models/attributes/_createAttribute.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/MandatoryRangeConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/RangeConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/StringLengthConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/XMLConstraint.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.js +0 -1
- package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/content/SubSectionModel.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfiguration.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/error/ErrorCollection.js.map +1 -1
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/grouping/GroupingModel.js.map +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/href/ListHref.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js +4 -4
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/links/LinkModel.js.map +1 -1
- package/esm/models/links/normalizeLinkJSON.js.map +1 -1
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListItemCollection.js.map +1 -1
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionCollection.js.map +1 -1
- package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/esm/models/paging/PagingModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/esm/models/resolveModel.js.map +1 -1
- package/esm/models/search/CaseSearchModel.js.map +1 -1
- package/esm/models/sorting/SortingModel.js +1 -1
- package/esm/models/sorting/SortingModel.js.map +1 -1
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/ModularUIResponse.js.map +1 -1
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/react/ErrorBoundary.js.map +1 -1
- package/esm/react/ErrorBoundaryFallback.js.map +1 -1
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-client/contextPath.js.map +1 -1
- package/esm/react-client/rehydrate.js.map +1 -1
- package/esm/react-server/contextPath.js.map +1 -1
- package/esm/react-server/createSSRComplete.js.map +1 -1
- package/esm/react-server/htmlpage.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/renderSSRMinimal.js.map +1 -1
- package/esm/react-server/requestInformation.js.map +1 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/react-server/serverSSR.js.map +1 -1
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/react-theme/ThemeProvider.js.map +1 -1
- package/esm/react-theme/createTheme.js.map +1 -1
- package/esm/react-theme/utils/contrast.js.map +1 -1
- package/esm/react-theme/utils/corners.js.map +1 -1
- package/esm/react-theme/utils/spacers.js.map +1 -1
- package/esm/react-theme/utils/themeProps.js.map +1 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/_router/RouterConnectors.js.map +1 -1
- package/esm/redux/_router/RouterMiddleware.js.map +1 -1
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/Error.js.map +1 -1
- package/esm/redux/actions/Form.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormAutosubmit.js.map +1 -1
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/actions/Notification.js.map +1 -1
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/connectors/Application.js.map +1 -1
- package/esm/redux/connectors/CaseView.js.map +1 -1
- package/esm/redux/connectors/ConceptDetail.js.map +1 -1
- package/esm/redux/connectors/ContentBrowser.js.map +1 -1
- package/esm/redux/connectors/ContentDetail.js.map +1 -1
- package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/connectors/ListDetail.js.map +1 -1
- package/esm/redux/connectors/ModelCatalog.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/redux/connectors/Preferences.js.map +1 -1
- package/esm/redux/connectors/QuickSearch.js.map +1 -1
- package/esm/redux/connectors/Tab.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/redux/reducers/ModalsReducer.js.map +1 -1
- package/esm/redux/reducers/NotificationReducer.js.map +1 -1
- package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/utils/browser/Cache.js.map +1 -1
- package/esm/utils/browser/Cookies.js.map +1 -1
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/esm/utils/fetch/serverFetch.js.map +1 -1
- package/esm/utils/fetch/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/esm/utils/helpers/createHash.js.map +1 -1
- package/esm/utils/helpers/createUUID.js.map +1 -1
- package/esm/utils/helpers/repositoryResource.js.map +1 -1
- package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
- package/esm/utils/number/DecimalFormat.js.map +1 -1
- package/esm/utils/number/formatValue.js.map +1 -1
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/NetworkException.js.map +1 -1
- package/lib/hooks/useAllFormsOnModel.js.map +1 -1
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useForm.js +3 -2
- package/lib/hooks/useForm.js.flow +2 -1
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModels.js.map +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/useProgressIndicator.js.map +1 -1
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/CaptchaAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +8 -0
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
- package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/RangeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/StringLengthConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/XMLConstraint.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js +0 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.flow +0 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfiguration.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorCollection.js.map +1 -1
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/grouping/GroupingModel.js.map +1 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/ListHref.js.map +1 -1
- package/lib/models/layouthint/LayoutHintCollection.js +4 -4
- package/lib/models/layouthint/LayoutHintCollection.js.flow +4 -4
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/paging/PagingModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/search/CaseSearchModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js +1 -1
- package/lib/models/sorting/SortingModel.js.flow +1 -1
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/react/ErrorBoundary.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/contextPath.js.map +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/contextPath.js.map +1 -1
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/htmlpage.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/requestInformation.js.map +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/RouterConnectors.js.map +1 -1
- package/lib/redux/_router/RouterMiddleware.js.map +1 -1
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/ModalsReducer.js.map +1 -1
- package/lib/redux/reducers/NotificationReducer.js.map +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/browser/Cache.js.map +1 -1
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/serverFetch.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/createHash.js.map +1 -1
- package/lib/utils/helpers/createUUID.js.map +1 -1
- package/lib/utils/helpers/repositoryResource.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/number/DecimalFormat.js.map +1 -1
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +31 -31
- package/src/hooks/useForm.js +2 -1
- package/src/models/attributes/ChoiceAttributeModel.js +1 -1
- package/src/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/src/models/attributes/layouthint-rules/BaseLayoutHintRule.js +0 -1
- package/src/models/layouthint/LayoutHintCollection.js +4 -4
- package/src/models/sorting/SortingModel.js +1 -1
- package/types/constants/Constants.d.ts +145 -145
- package/types/constants/LayoutHintConfig.d.ts +226 -226
- package/types/constants/LayoutHints.d.ts +74 -74
- package/types/constants/Settings.d.ts +29 -29
- package/types/constants/index.d.ts +3 -3
- package/types/exceptions/ConfigurationException.d.ts +6 -6
- package/types/exceptions/FetchException.d.ts +31 -31
- package/types/exceptions/IllegalArgumentException.d.ts +6 -6
- package/types/exceptions/IllegalReturnException.d.ts +5 -5
- package/types/exceptions/IllegalStateException.d.ts +6 -6
- package/types/exceptions/JsonParseException.d.ts +6 -6
- package/types/exceptions/MissingPropertyException.d.ts +6 -6
- package/types/exceptions/NetworkException.d.ts +9 -9
- package/types/exceptions/NotAllowedUriException.d.ts +6 -6
- package/types/exceptions/NotFoundException.d.ts +10 -10
- package/types/exceptions/ServerRequestException.d.ts +6 -6
- package/types/exceptions/ThemePropertyException.d.ts +6 -6
- package/types/exceptions/TimeoutException.d.ts +7 -7
- package/types/exceptions/UnauthorizedException.d.ts +11 -11
- package/types/exceptions/UnsupportedOperationException.d.ts +6 -6
- package/types/exceptions/index.d.ts +15 -15
- package/types/hooks/useI18n.d.ts +9 -9
- package/types/i18n/Locale.d.ts +53 -53
- package/types/i18n/Locales.d.ts +55 -55
- package/types/i18n/Message.d.ts +6 -6
- package/types/i18n/index.d.ts +5 -5
- package/types/i18n/languages.d.ts +215 -215
- package/types/i18n/translations/beinformed_error_messages_en.nl.d.ts +97 -97
- package/types/i18n/translations/beinformed_error_messages_nl.nl.d.ts +97 -97
- package/types/i18n/types.d.ts +11 -11
- package/types/i18n/withMessage.d.ts +3 -3
- package/types/index.d.ts +6 -6
- package/types/models/actions/ActionCollection.d.ts +29 -29
- package/types/models/actions/ActionModel.d.ts +84 -84
- package/types/models/application/ApplicationModel.d.ts +41 -41
- package/types/models/attributes/AttributeCollection.d.ts +96 -96
- package/types/models/attributes/AttributeContent.d.ts +64 -64
- package/types/models/attributes/AttributeDataHelper.d.ts +67 -67
- package/types/models/attributes/AttributeModel.d.ts +395 -395
- package/types/models/attributes/AttributeSetModel.d.ts +28 -28
- package/types/models/attributes/BooleanAttributeModel.d.ts +65 -65
- package/types/models/attributes/CaptchaAttributeModel.d.ts +19 -19
- package/types/models/attributes/ChoiceAttributeModel.d.ts +76 -76
- package/types/models/attributes/ChoiceAttributeOptionCollection.d.ts +79 -79
- package/types/models/attributes/ChoiceAttributeOptionModel.d.ts +133 -133
- package/types/models/attributes/CompositeAttributeChildCollection.d.ts +56 -56
- package/types/models/attributes/CompositeAttributeModel.d.ts +44 -44
- package/types/models/attributes/DatetimeAttributeModel.d.ts +117 -117
- package/types/models/attributes/HelptextAttributeModel.d.ts +16 -16
- package/types/models/attributes/LabelAttributeModel.d.ts +12 -12
- package/types/models/attributes/MemoAttributeModel.d.ts +14 -14
- package/types/models/attributes/MoneyAttributeModel.d.ts +14 -14
- package/types/models/attributes/NumberAttributeModel.d.ts +49 -49
- package/types/models/attributes/PasswordAttributeModel.d.ts +62 -62
- package/types/models/attributes/StringAttributeModel.d.ts +62 -62
- package/types/models/attributes/UploadAttributeModel.d.ts +60 -60
- package/types/models/attributes/XMLAttributeModel.d.ts +10 -10
- package/types/models/attributes/_createAttribute.d.ts +6 -6
- package/types/models/attributes/input-constraints/BSNConstraint.d.ts +26 -26
- package/types/models/attributes/input-constraints/ConstraintCollection.d.ts +24 -24
- package/types/models/attributes/input-constraints/ConstraintModel.d.ts +34 -34
- package/types/models/attributes/input-constraints/DateBoundaryConstraint.d.ts +109 -109
- package/types/models/attributes/input-constraints/DateTimeDateFormatConstraint.d.ts +36 -36
- package/types/models/attributes/input-constraints/DateTimeTimeFormatConstraint.d.ts +36 -36
- package/types/models/attributes/input-constraints/DatetimeFormatConstraint.d.ts +92 -92
- package/types/models/attributes/input-constraints/FileExtensionConstraint.d.ts +33 -33
- package/types/models/attributes/input-constraints/FileSizeConstraint.d.ts +42 -42
- package/types/models/attributes/input-constraints/IBANConstraint.d.ts +23 -23
- package/types/models/attributes/input-constraints/MandatoryConstraint.d.ts +23 -23
- package/types/models/attributes/input-constraints/MandatoryRangeConstraint.d.ts +36 -36
- package/types/models/attributes/input-constraints/NumberBoundaryConstraint.d.ts +61 -61
- package/types/models/attributes/input-constraints/NumberFormatConstraint.d.ts +52 -52
- package/types/models/attributes/input-constraints/NumberGroupingConstraint.d.ts +46 -46
- package/types/models/attributes/input-constraints/PasswordConfirmConstraint.d.ts +36 -36
- package/types/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.d.ts +23 -23
- package/types/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.d.ts +32 -32
- package/types/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.d.ts +32 -32
- package/types/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.d.ts +35 -35
- package/types/models/attributes/input-constraints/RangeConstraint.d.ts +97 -97
- package/types/models/attributes/input-constraints/RegexConstraint.d.ts +37 -37
- package/types/models/attributes/input-constraints/StringLengthConstraint.d.ts +46 -46
- package/types/models/attributes/input-constraints/XMLConstraint.d.ts +26 -26
- package/types/models/attributes/layouthint-rules/BaseLayoutHintRule.d.ts +46 -46
- package/types/models/attributes/layouthint-rules/DependentAttribute.d.ts +57 -57
- package/types/models/attributes/layouthint-rules/LayoutHintRuleCollection.d.ts +27 -27
- package/types/models/attributes/layouthint-rules/RemainingTotalUploadSize.d.ts +17 -17
- package/types/models/base/BaseCollection.d.ts +89 -89
- package/types/models/base/BaseModel.d.ts +67 -67
- package/types/models/base/ResourceCollection.d.ts +19 -19
- package/types/models/base/ResourceModel.d.ts +97 -97
- package/types/models/caseview/CaseViewModel.d.ts +45 -45
- package/types/models/concepts/BusinessScenarioModel.d.ts +20 -20
- package/types/models/concepts/ConceptDetailModel.d.ts +69 -69
- package/types/models/concepts/ConceptIndexModel.d.ts +36 -36
- package/types/models/concepts/ConceptLinkModel.d.ts +65 -65
- package/types/models/concepts/ConceptRelationCollection.d.ts +34 -34
- package/types/models/concepts/ConceptRelationModel.d.ts +44 -44
- package/types/models/concepts/ConceptTypeDetailModel.d.ts +39 -39
- package/types/models/concepts/SourceReferenceCollection.d.ts +13 -13
- package/types/models/concepts/SourceReferenceModel.d.ts +30 -30
- package/types/models/content/ContentIndexModel.d.ts +34 -34
- package/types/models/content/ContentLinkModel.d.ts +81 -81
- package/types/models/content/ContentModel.d.ts +74 -74
- package/types/models/content/ContentTOCModel.d.ts +37 -37
- package/types/models/content/ContentTypeModel.d.ts +26 -26
- package/types/models/content/SectionModel.d.ts +75 -75
- package/types/models/content/SubSectionModel.d.ts +64 -64
- package/types/models/contentconfiguration/ContentConfiguration.d.ts +28 -28
- package/types/models/contentconfiguration/ContentConfigurationElements.d.ts +47 -47
- package/types/models/contentconfiguration/ContentConfigurationEndResults.d.ts +16 -16
- package/types/models/contentconfiguration/ContentConfigurationQuestions.d.ts +22 -22
- package/types/models/contentconfiguration/ContentConfigurationResults.d.ts +39 -39
- package/types/models/detail/DetailModel.d.ts +72 -72
- package/types/models/error/ErrorCollection.d.ts +51 -51
- package/types/models/error/ErrorModel.d.ts +41 -41
- package/types/models/error/ErrorResponse.d.ts +148 -148
- package/types/models/filters/AssignmentFilterModel.d.ts +35 -35
- package/types/models/filters/BaseFilterModel.d.ts +85 -85
- package/types/models/filters/ConceptIndexFilterModel.d.ts +6 -6
- package/types/models/filters/FilterCollection.d.ts +48 -48
- package/types/models/filters/FilterModel.d.ts +5 -5
- package/types/models/filters/RangeFilterModel.d.ts +6 -6
- package/types/models/form/FormModel.d.ts +343 -343
- package/types/models/form/FormObjectModel.d.ts +196 -196
- package/types/models/grouping/GroupingModel.d.ts +85 -85
- package/types/models/href/Href.d.ts +196 -196
- package/types/models/href/ListHref.d.ts +64 -64
- package/types/models/index.d.ts +95 -95
- package/types/models/layouthint/LayoutHintCollection.d.ts +43 -43
- package/types/models/links/LinkCollection.d.ts +62 -62
- package/types/models/links/LinkModel.d.ts +92 -92
- package/types/models/links/normalizeLinkJSON.d.ts +9 -9
- package/types/models/list/ListDetailModel.d.ts +69 -69
- package/types/models/list/ListHeaderModel.d.ts +64 -64
- package/types/models/list/ListItemCollection.d.ts +21 -21
- package/types/models/list/ListItemModel.d.ts +34 -34
- package/types/models/list/ListModel.d.ts +135 -135
- package/types/models/lookup/LookupOptionCollection.d.ts +11 -11
- package/types/models/lookup/LookupOptionsModel.d.ts +19 -19
- package/types/models/modelcatalog/ModelCatalogModel.d.ts +18 -18
- package/types/models/paging/PagesizeModel.d.ts +25 -25
- package/types/models/paging/PagingModel.d.ts +49 -49
- package/types/models/panels/GroupingPanelModel.d.ts +39 -39
- package/types/models/parameter/Parameter.d.ts +40 -40
- package/types/models/process/ProcessStatusSettingsModel.d.ts +38 -38
- package/types/models/resolveModel.d.ts +7 -7
- package/types/models/search/CaseSearchModel.d.ts +14 -14
- package/types/models/sorting/SortOptionModel.d.ts +48 -48
- package/types/models/sorting/SortingModel.d.ts +42 -42
- package/types/models/tab/TabModel.d.ts +44 -44
- package/types/models/taskgroup/TaskGroupCollection.d.ts +12 -12
- package/types/models/taskgroup/TaskGroupModel.d.ts +15 -15
- package/types/models/types.d.ts +161 -161
- package/types/models/user/UserModel.d.ts +14 -14
- package/types/models/user/UserProfileModel.d.ts +12 -12
- package/types/models/user/UserServicesModel.d.ts +28 -28
- package/types/modularui/Authenticate.d.ts +49 -49
- package/types/modularui/CaptchaRequest.d.ts +45 -45
- package/types/modularui/ModularUIError.d.ts +10 -10
- package/types/modularui/ModularUIRequest.d.ts +198 -198
- package/types/modularui/ModularUIResponse.d.ts +56 -56
- package/types/modularui/UploadRequest.d.ts +35 -35
- package/types/modularui/index.d.ts +5 -5
- package/types/modularui/types.d.ts +2 -2
- package/types/redux/_i18n/types.d.ts +13 -13
- package/types/redux/_modularui/types.d.ts +61 -61
- package/types/redux/_router/types.d.ts +35 -35
- package/types/redux/selectors/i18n.d.ts +4 -4
- package/types/redux/types.d.ts +105 -105
- package/types/utils/browser/Cache.d.ts +45 -45
- package/types/utils/browser/Cookies.d.ts +9 -9
- package/types/utils/datetime/DateTimeUtil.d.ts +164 -164
- package/types/utils/fetch/serverFetch.d.ts +5 -5
- package/types/utils/fetch/types.d.ts +40 -40
- package/types/utils/fetch/universalFetch.d.ts +7 -7
- package/types/utils/fetch/xhr.d.ts +5 -5
- package/types/utils/helpers/checkResource.d.ts +3 -3
- package/types/utils/helpers/createHash.d.ts +8 -8
- package/types/utils/helpers/createUUID.d.ts +4 -4
- package/types/utils/helpers/index.d.ts +7 -7
- package/types/utils/helpers/objects.d.ts +11 -11
- package/types/utils/helpers/repositoryResource.d.ts +1 -1
- package/types/utils/helpers/sanitizeHtml.d.ts +9 -9
- package/types/utils/helpers/text.d.ts +7 -7
- package/types/utils/index.d.ts +11 -11
- package/types/utils/number/DecimalFormat.d.ts +90 -90
- package/types/utils/number/formatValue.d.ts +4 -4
- package/types/utils/number/parseNumbers.d.ts +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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.31.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.31.0...v1.31.1) (2023-06-30)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **lookup:** improve check on choice option when adding options to choice attribute ([e880980](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/e880980504364d2f0f35a2f1e59c01229f2a215c))
|
|
10
|
+
|
|
11
|
+
## [1.31.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.30.1...v1.31.0) (2023-06-30)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- **useForm:** make it possible to send formdata with the request ([aa42c95](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/aa42c95d69b0047c76c78cec1829fed56829ea07))
|
|
16
|
+
|
|
5
17
|
## [1.30.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.30.0...v1.30.1) (2023-03-31)
|
|
6
18
|
|
|
7
19
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["glob","require","fs","path","LayoutHintConfiguration","readFiles","files","filePromises","_mapInstanceProperty","call","file","_Promise","resolve","reject","readFile","err","data","JSON","parse","all","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","then","jsons","newConfig","_Object$assign","writeFile","join","_JSON$stringify","writeErr"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst glob = require(\"glob\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst readFiles = (files: Array<string>) => {\n const filePromises = files.map(\n (file) =>\n new Promise((resolve, reject) => {\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n return reject(err);\n } else {\n return resolve(JSON.parse(data));\n }\n });\n })\n );\n\n return Promise.all(filePromises);\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n return new Promise((resolve, reject) => {\n glob(escapedSrcFolder + \"/**/LayoutHintConfig.json\", {}, (err, files) => {\n if (err) {\n return reject(err);\n }\n\n readFiles(files).then((jsons) => {\n const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);\n fs.writeFile(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n\n (writeErr) => {\n if (writeErr) {\n return reject(writeErr);\n }\n\n return resolve();\n }\n );\n });\n });\n });\n};\n"],"mappings":";;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;AACxB,MAAME,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAM;EAAEG;AAAwB,CAAC,GAAGH,OAAO,CAAC,+BAA+B,CAAC;AAE5E,MAAMI,SAAS,GAAIC,KAAoB,IAAK;EAC1C,MAAMC,YAAY,GAAGC,oBAAA,CAAAF,KAAK,EAAAG,IAAA,CAALH,KAAK,EACvBI,IAAI,IACH,IAAAC,QAAA,CAAY,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC/BX,EAAE,CAACY,QAAQ,CAACJ,IAAI,EAAE,OAAO,EAAE,CAACK,GAAG,EAAEC,IAAI,KAAK;MACxC,IAAID,GAAG,EAAE;QACP,OAAOF,MAAM,CAACE,GAAG,CAAC;MACpB,CAAC,MAAM;QACL,OAAOH,OAAO,CAACK,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC,CAAC;MAClC;IACF,CAAC,CAAC;EACJ,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["glob","require","fs","path","LayoutHintConfiguration","readFiles","files","filePromises","_mapInstanceProperty","call","file","_Promise","resolve","reject","readFile","err","data","JSON","parse","all","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","then","jsons","newConfig","_Object$assign","writeFile","join","_JSON$stringify","writeErr"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst glob = require(\"glob\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst readFiles = (files: Array<string>) => {\n const filePromises = files.map(\n (file) =>\n new Promise((resolve, reject) => {\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n return reject(err);\n } else {\n return resolve(JSON.parse(data));\n }\n });\n })\n );\n\n return Promise.all(filePromises);\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n return new Promise((resolve, reject) => {\n glob(escapedSrcFolder + \"/**/LayoutHintConfig.json\", {}, (err, files) => {\n if (err) {\n return reject(err);\n }\n\n readFiles(files).then((jsons) => {\n const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);\n fs.writeFile(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n\n (writeErr) => {\n if (writeErr) {\n return reject(writeErr);\n }\n\n return resolve();\n }\n );\n });\n });\n });\n};\n"],"mappings":";;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;AACxB,MAAME,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAM;EAAEG;AAAwB,CAAC,GAAGH,OAAO,CAAC,+BAA+B,CAAC;AAE5E,MAAMI,SAAS,GAAIC,KAAoB,IAAK;EAC1C,MAAMC,YAAY,GAAGC,oBAAA,CAAAF,KAAK,EAAAG,IAAA,CAALH,KAAK,EACvBI,IAAI,IACH,IAAAC,QAAA,CAAY,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC/BX,EAAE,CAACY,QAAQ,CAACJ,IAAI,EAAE,OAAO,EAAE,CAACK,GAAG,EAAEC,IAAI,KAAK;MACxC,IAAID,GAAG,EAAE;QACP,OAAOF,MAAM,CAACE,GAAG,CAAC;MACpB,CAAC,MAAM;QACL,OAAOH,OAAO,CAACK,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC,CAAC;MAClC;IACF,CAAC,CAAC;EACJ,CAAC,CACL,CAAC;EAED,OAAOL,QAAA,CAAQQ,GAAG,CAACZ,YAAY,CAAC;AAClC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACAa,OAAO,CAACC,6BAA6B,GAAG,OACtCC,SAAiB,EACjBC,YAAoB,KACF;EAClB,MAAMC,gBAAgB,GAAGF,SAAS,CAACG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EACtD,OAAO,IAAAd,QAAA,CAAY,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCb,IAAI,CAACwB,gBAAgB,GAAG,2BAA2B,EAAE,CAAC,CAAC,EAAE,CAACT,GAAG,EAAET,KAAK,KAAK;MACvE,IAAIS,GAAG,EAAE;QACP,OAAOF,MAAM,CAACE,GAAG,CAAC;MACpB;MAEAV,SAAS,CAACC,KAAK,CAAC,CAACoB,IAAI,CAAEC,KAAK,IAAK;QAC/B,MAAMC,SAAS,GAAGC,cAAA,CAAczB,uBAAuB,EAAE,GAAGuB,KAAK,CAAC;QAClEzB,EAAE,CAAC4B,SAAS,CACV3B,IAAI,CAAC4B,IAAI,CAACR,YAAY,EAAE,uBAAuB,CAAC,EAChDS,eAAA,CAAeJ,SAAS,CAAC,EAExBK,QAAQ,IAAK;UACZ,IAAIA,QAAQ,EAAE;YACZ,OAAOpB,MAAM,CAACoB,QAAQ,CAAC;UACzB;UAEA,OAAOrB,OAAO,CAAC,CAAC;QAClB,CACF,CAAC;MACH,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutHints.js","names":["LayoutHintConfiguration","getHint","hint","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"sources":["../../src/constants/LayoutHints.js"],"sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,IAAY,IAAa;EACxC,IAAIF,uBAAuB,CAACE,IAAI,CAAC,EAAE;IACjC,OAAOF,uBAAuB,CAACE,IAAI,CAAC,CAACA,IAAI;EAC3C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,SAAiB,GAAGF,OAAO,CAAC,WAAW,CAAC;;AAErD;AACA;AACA;AACA;AACA,OAAO,MAAMG,QAAgB,GAAGH,OAAO,CAAC,UAAU,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,2BAA2B,GAAG,mBAAmB;AAC9D;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAwB,GAAGN,OAAO,CAAC,kBAAkB,CAAC;AACnE;AACA;AACA;AACA,OAAO,MAAMO,YAAoB,GAAGP,OAAO,CAAC,cAAc,CAAC;AAC3D;AACA;AACA;AACA,OAAO,MAAMQ,KAAa,GAAGR,OAAO,CAAC,OAAO,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,aAAqB,GAAGT,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AACA,OAAO,MAAMU,aAAqB,GAAGV,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AACA,OAAO,MAAMW,aAAqB,GAAGX,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,sBAA8B,GAAGZ,OAAO,CAAC,wBAAwB,CAAC;AAC/E;AACA;AACA;AACA,OAAO,MAAMa,kBAA0B,GAAGb,OAAO,CAAC,oBAAoB,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMc,yBAAiC,GAAGd,OAAO,CACtD,
|
|
1
|
+
{"version":3,"file":"LayoutHints.js","names":["LayoutHintConfiguration","getHint","hint","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"sources":["../../src/constants/LayoutHints.js"],"sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,IAAY,IAAa;EACxC,IAAIF,uBAAuB,CAACE,IAAI,CAAC,EAAE;IACjC,OAAOF,uBAAuB,CAACE,IAAI,CAAC,CAACA,IAAI;EAC3C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,SAAiB,GAAGF,OAAO,CAAC,WAAW,CAAC;;AAErD;AACA;AACA;AACA;AACA,OAAO,MAAMG,QAAgB,GAAGH,OAAO,CAAC,UAAU,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,2BAA2B,GAAG,mBAAmB;AAC9D;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAwB,GAAGN,OAAO,CAAC,kBAAkB,CAAC;AACnE;AACA;AACA;AACA,OAAO,MAAMO,YAAoB,GAAGP,OAAO,CAAC,cAAc,CAAC;AAC3D;AACA;AACA;AACA,OAAO,MAAMQ,KAAa,GAAGR,OAAO,CAAC,OAAO,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,aAAqB,GAAGT,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AACA,OAAO,MAAMU,aAAqB,GAAGV,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AACA,OAAO,MAAMW,aAAqB,GAAGX,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,sBAA8B,GAAGZ,OAAO,CAAC,wBAAwB,CAAC;AAC/E;AACA;AACA;AACA,OAAO,MAAMa,kBAA0B,GAAGb,OAAO,CAAC,oBAAoB,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMc,yBAAiC,GAAGd,OAAO,CACtD,2BACF,CAAC;AACD;AACA;AACA;AACA,OAAO,MAAMe,eAAuB,GAAGf,OAAO,CAAC,iBAAiB,CAAC;AACjE;AACA;AACA;AACA,OAAO,MAAMgB,cAAsB,GAAG,iBAAiB;AACvD;AACA;AACA;AACA,OAAO,MAAMC,aAAqB,GAAGjB,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AACA,OAAO,MAAMkB,oBAAoB,GAAG,sBAAsB;;AAE1D;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAGA,CAAA,KAAcpB,uBAAuB;AAE/E,eAAeC,OAAO"}
|
|
@@ -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","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","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","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\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\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 = (): string => `${getBasePath()}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (): string => `${getBasePath()}${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 = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/callback?client_name=FormClient\");\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,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,KAAK;EAE/B;EACAC,yBAAyB,EAAE,KAAK;EAEhC;EACAC,wCAAwC,EAAE,KAAK;EAE/C;EACAC,UAAU,EAAE,SAAS;EAErB;EACAC,wBAAwB,EAAE,EAAE;EAE5B;EACAC,WAAW,EAAE,UAAU;EAEvB;EACAC,qBAAqB,EAAE,IAAI;EAE3B;EACAC,wBAAwB,EAAE,GAAG;EAE7B;EACAC,+BAA+B,EAAE,kCAA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GA,cAAe,EAAC;EACvC;EACA,OAAOtE,wBAAwB,CAACsE,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAI1D,WAAmB,IAAK;EACrDwC,UAAU,CAAC,cAAc,EAAExC,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAM2D,IAAY,GAAGf,WAAW,EAAE"}
|
|
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","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","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","getCaptchaPath","hasAllContentInData","loginType","JAAS","loginPath","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\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\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 = (): string => `${getBasePath()}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (): string => `${getBasePath()}${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 = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/callback?client_name=FormClient\");\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;EAE5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AAC;AAClD;AACA;AACA,OAAO,MAAM8D,kBAAkB,GAAGA,CAAA,KAChCjB,UAAU,CAAC5C,sBAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AACA,OAAO,MAAM8D,UAAU,GAAGA,CAAA,KACxBlB,UAAU,CAAC3C,mBAAmB,EAAE,SAAS,CAAC;AAE5C,OAAO,MAAMuB,UAAkB,GAAGmC,SAAS,CAAC,CAAC;AAC7C,OAAO,MAAMjC,WAAmB,GAAGoC,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAGpB,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAACqB,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAI,IAAGA,cAAe,EAAC;EACvC;EACA,OAAOtE,wBAAwB,CAACsE,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAI1D,WAAmB,IAAK;EACrDwC,UAAU,CAAC,cAAc,EAAExC,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAM2D,IAAY,GAAGf,WAAW,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkException.js","names":["NetworkException","Error","constructor","url","method","_defineProperty","name","id","status"],"sources":["../../src/exceptions/NetworkException.js"],"sourcesContent":["// @flow\n/**\n * NetworkException\n */\nclass NetworkException extends Error {\n status: number;\n id: string;\n\n constructor(url: string, method: string) {\n super(\n `An unexpected network error occurred, cannot request resource ${url} with method ${method}`\n );\n\n this.name = \"NetworkException\";\n this.id = \"NetworkException\";\n this.status = 0;\n }\n}\n\nexport default NetworkException;\n"],"mappings":";AACA;AACA;AACA;AACA,MAAMA,gBAAgB,SAASC,KAAK,CAAC;EAInCC,WAAWA,CAACC,GAAW,EAAEC,MAAc,EAAE;IACvC,KAAK,CACF,iEAAgED,GAAI,gBAAeC,MAAO,
|
|
1
|
+
{"version":3,"file":"NetworkException.js","names":["NetworkException","Error","constructor","url","method","_defineProperty","name","id","status"],"sources":["../../src/exceptions/NetworkException.js"],"sourcesContent":["// @flow\n/**\n * NetworkException\n */\nclass NetworkException extends Error {\n status: number;\n id: string;\n\n constructor(url: string, method: string) {\n super(\n `An unexpected network error occurred, cannot request resource ${url} with method ${method}`\n );\n\n this.name = \"NetworkException\";\n this.id = \"NetworkException\";\n this.status = 0;\n }\n}\n\nexport default NetworkException;\n"],"mappings":";AACA;AACA;AACA;AACA,MAAMA,gBAAgB,SAASC,KAAK,CAAC;EAInCC,WAAWA,CAACC,GAAW,EAAEC,MAAc,EAAE;IACvC,KAAK,CACF,iEAAgED,GAAI,gBAAeC,MAAO,EAC7F,CAAC;IAACC,eAAA;IAAAA,eAAA;IAEF,IAAI,CAACC,IAAI,GAAG,kBAAkB;IAC9B,IAAI,CAACC,EAAE,GAAG,kBAAkB;IAC5B,IAAI,CAACC,MAAM,GAAG,CAAC;EACjB;AACF;AAEA,eAAeR,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAllFormsOnModel.js","names":["useState","useEffect","useModularUIRequest","HTTP_METHODS","ListModel","FormModel","useRetrieveFormsOnModel","model","modularui","forms","setForms","requestCount","setRequestCount","responseCount","setResponseCount","_context","requests","_mapInstanceProperty","getActions","call","action","href","selfhref","addParameter","method","POST","fetch","then","form","tokens","name","length","_Promise","all","responses","actionForms","_Object$assign","_context2","actionCollection","createActions","_filterInstanceProperty","getActionsByType","isDisabled","allActions","listItemCollection","forEach","listItem","_context3","updateActions","push","actions","unique","_includesInstanceProperty"],"sources":["../../src/hooks/useAllFormsOnModel.js"],"sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport { HTTP_METHODS } from \"../constants\";\n\nimport ListModel from \"../models/list/ListModel\";\nimport FormModel from \"../models/form/FormModel\";\n\nimport type DetailModel from \"../models/detail/DetailModel\";\nimport type TabModel from \"../models/tab/TabModel\";\nimport type ActionModel from \"../models/actions/ActionModel\";\n\n/**\n * Retrieve all forms configured on a model with actions\n * @param model\n * @returns Object - { actionName: FormModel }\n */\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel\n): null | { [actionName: string]: FormModel } => {\n const modularui = useModularUIRequest();\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (\n model: ListModel | DetailModel | TabModel\n): Array<ActionModel> => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions = [];\n const unique = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n"],"mappings":";;;;;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,SAASC,YAAY,QAAQ,cAAc;AAE3C,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,SAAS,MAAM,0BAA0B;AAMhD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAClCC,KAAyC,IACM;EAC/C,MAAMC,SAAS,GAAGN,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useAllFormsOnModel.js","names":["useState","useEffect","useModularUIRequest","HTTP_METHODS","ListModel","FormModel","useRetrieveFormsOnModel","model","modularui","forms","setForms","requestCount","setRequestCount","responseCount","setResponseCount","_context","requests","_mapInstanceProperty","getActions","call","action","href","selfhref","addParameter","method","POST","fetch","then","form","tokens","name","length","_Promise","all","responses","actionForms","_Object$assign","_context2","actionCollection","createActions","_filterInstanceProperty","getActionsByType","isDisabled","allActions","listItemCollection","forEach","listItem","_context3","updateActions","push","actions","unique","_includesInstanceProperty"],"sources":["../../src/hooks/useAllFormsOnModel.js"],"sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport { HTTP_METHODS } from \"../constants\";\n\nimport ListModel from \"../models/list/ListModel\";\nimport FormModel from \"../models/form/FormModel\";\n\nimport type DetailModel from \"../models/detail/DetailModel\";\nimport type TabModel from \"../models/tab/TabModel\";\nimport type ActionModel from \"../models/actions/ActionModel\";\n\n/**\n * Retrieve all forms configured on a model with actions\n * @param model\n * @returns Object - { actionName: FormModel }\n */\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel\n): null | { [actionName: string]: FormModel } => {\n const modularui = useModularUIRequest();\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (\n model: ListModel | DetailModel | TabModel\n): Array<ActionModel> => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions = [];\n const unique = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n"],"mappings":";;;;;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,SAASC,YAAY,QAAQ,cAAc;AAE3C,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,SAAS,MAAM,0BAA0B;AAMhD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAClCC,KAAyC,IACM;EAC/C,MAAMC,SAAS,GAAGN,mBAAmB,CAAC,CAAC;EACvC,MAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAGV,QAAQ,CAAC,IAAI,CAAC;EACxC,MAAM,CAACW,YAAY,EAAEC,eAAe,CAAC,GAAGZ,QAAQ,CAAC,CAAC,CAAC;EACnD,MAAM,CAACa,aAAa,EAAEC,gBAAgB,CAAC,GAAGd,QAAQ,CAAC,CAAC,CAAC;EAErDC,SAAS,CAAC,MAAM;IAAA,IAAAc,QAAA;IACd,MAAMC,QAAQ,GAAGC,oBAAA,CAAAF,QAAA,GAAAG,UAAU,CAACX,KAA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CAACsB,UAAU,CAAC;EAEzC,MAAMC,UAAU,GAAG,CAAC,GAAGJ,aAAa,CAAC;EAErC,IAAIhC,KAAK,YAAYH,SAAS,EAAE;IAC9BG,KAAK,CAACqC,kBAAkB,CAACC,OAAO,CAAEC,QAAQ,IAAK;MAAA,IAAAC,SAAA;MAC7C,MAAMC,aAAa,GAAGR,uBAAA,CAAAO,SAAA,GAAAD,QAAQ,CAACR,gBAAgB,CAC5CG,gBAAgB,CAAC,QAAQ,CAAC,EAAAtB,IAAA,CAAA4B,SAAA,EAClB3B,MAAM,IAAK,CAACA,MAAM,CAACsB,UAAU,CAAC;MAEzCC,UAAU,CAACM,IAAI,CAAC,GAAGD,aAAa,CAAC;IACnC,CAAC,CAAC;EACJ;EAEA,MAAME,OAAO,GAAG,EAAE;EAClB,MAAMC,MAAM,GAAG,EAAE;EACjBR,UAAU,CAACE,OAAO,CAAEzB,MAAM,IAAK;IAC7B,IAAI,CAACgC,yBAAA,CAAAD,MAAM,EAAAhC,IAAA,CAANgC,MAAM,EAAU/B,MAAM,CAACU,IAAI,CAAC,EAAE;MACjCqB,MAAM,CAACF,IAAI,CAAC7B,MAAM,CAACU,IAAI,CAAC;MACxBoB,OAAO,CAACD,IAAI,CAAC7B,MAAM,CAAC;IACtB;EACF,CAAC,CAAC;EAEF,OAAO8B,OAAO;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePath","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 getBasePath,\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 `${getBasePath()}${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 = getBasePath();\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.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,cAAc,QAAQ,wCAAwC;AACvE,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AAEjE,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,SACEC,2BAA2B,EAC3BC,WAAW,EACXC,UAAU,QACL,cAAc;AAIrB,SAASC,qBAAqB,QAAQ,eAAe;AAerD;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;EACvCL,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAGZ,WAAW,
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePath","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 getBasePath,\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 `${getBasePath()}${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 = getBasePath();\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.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,cAAc,QAAQ,wCAAwC;AACvE,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AAEjE,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,SACEC,2BAA2B,EAC3BC,WAAW,EACXC,UAAU,QACL,cAAc;AAIrB,SAASC,qBAAqB,QAAQ,eAAe;AAerD;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;EACvCL,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAGZ,WAAW,CAAC,CAAC;EAE9B,MAAMa,WAAW,GAAGd,WAAW,CAACE,cAAc,CAAC;EAC/C,MAAMa,IAAI,GAAGf,WAAW,CAAEgB,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;EAE/C,MAAME,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EAExD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDZ,2BAA2B,CAC5B;IACDa,YAAY,EAAEL,IAAI,CAACM,KAAK;IACxBC,WAAW,EAAEA,CAAA,KAAMT,QAAQ,CAACR,eAAe,CAAC,CAAC,CAAC;IAC9CF,KAAK,EAAEA,CAACoB,QAAgB,EAAEC,QAAgB,KACxCX,QAAQ,CAACV,KAAK,CAACoB,QAAQ,EAAEC,QAAQ,CAAC,CAAC;IACrCC,aAAa,EAAGC,kBAAsC,IAAK;MACzD,IAAIpB,KAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC;QACA,MAAM,IAAIjB,qBAAqB,CAC5B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
|
-
{"version":3,"file":"useContent.js","names":["useState","useEffect","SourceReferenceCollection","ModularUIRequest","useProgressIndicator","useLocale","useContentFromSourceReferences","sourceReferences","renderChildSections","_context","_context2","content","setContent","localeCode","start","finish","hrefs","_mapInstanceProperty","_filterInstanceProperty","call","sourceReference","link","selfhref","href","index","self","indexOf","toString","allHrefs","_JSON$stringify","_context3","requests","JSON","parse","modularuiRequest","locale","fetchContent","_Promise","all","then","responseContent"],"sources":["../../src/hooks/useContent.js"],"sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport SourceReferenceCollection from \"../models/concepts/SourceReferenceCollection\";\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport { useProgressIndicator } from \"../hooks/useProgressIndicator\";\nimport { useLocale } from \"../hooks/useI18n\";\n\nimport type ContentModel from \"../models/content/ContentModel\";\n\n/**\n * Hook to retrieve multiple source references at once\n */\nexport const useContentFromSourceReferences = (\n sourceReferences: SourceReferenceCollection,\n renderChildSections: boolean\n): Array<ContentModel> => {\n const [content, setContent] = useState([]);\n const localeCode = useLocale();\n\n const { start, finish } = useProgressIndicator();\n\n const hrefs = sourceReferences\n .map((sourceReference) => sourceReference.link.selfhref.href)\n .filter((href, index, self) => self.indexOf(href) === index)\n .map((href) => href.toString());\n\n const allHrefs = JSON.stringify(hrefs);\n useEffect(() => {\n const requests = JSON.parse(allHrefs).map((href) => {\n const modularuiRequest = new ModularUIRequest(href);\n modularuiRequest.locale = localeCode;\n return modularuiRequest.fetchContent(renderChildSections);\n });\n\n start();\n Promise.all(requests).then((responseContent) => {\n setContent(responseContent);\n finish();\n });\n\n // start and finish don't change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allHrefs, localeCode, renderChildSections]);\n\n return content;\n};\n"],"mappings":";;;;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,OAAOC,yBAAyB,MAAM,8CAA8C;AACpF,OAAOC,gBAAgB,MAAM,+BAA+B;AAE5D,SAASC,oBAAoB,QAAQ,+BAA+B;AACpE,SAASC,SAAS,QAAQ,kBAAkB;AAI5C;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,GAAGA,CAC5CC,gBAA2C,EAC3CC,mBAA4B,KACJ;EAAA,IAAAC,QAAA,EAAAC,SAAA;EACxB,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGZ,QAAQ,CAAC,EAAE,CAAC;EAC1C,MAAMa,UAAU,GAAGR,SAAS,
|
|
1
|
+
{"version":3,"file":"useContent.js","names":["useState","useEffect","SourceReferenceCollection","ModularUIRequest","useProgressIndicator","useLocale","useContentFromSourceReferences","sourceReferences","renderChildSections","_context","_context2","content","setContent","localeCode","start","finish","hrefs","_mapInstanceProperty","_filterInstanceProperty","call","sourceReference","link","selfhref","href","index","self","indexOf","toString","allHrefs","_JSON$stringify","_context3","requests","JSON","parse","modularuiRequest","locale","fetchContent","_Promise","all","then","responseContent"],"sources":["../../src/hooks/useContent.js"],"sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport SourceReferenceCollection from \"../models/concepts/SourceReferenceCollection\";\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport { useProgressIndicator } from \"../hooks/useProgressIndicator\";\nimport { useLocale } from \"../hooks/useI18n\";\n\nimport type ContentModel from \"../models/content/ContentModel\";\n\n/**\n * Hook to retrieve multiple source references at once\n */\nexport const useContentFromSourceReferences = (\n sourceReferences: SourceReferenceCollection,\n renderChildSections: boolean\n): Array<ContentModel> => {\n const [content, setContent] = useState([]);\n const localeCode = useLocale();\n\n const { start, finish } = useProgressIndicator();\n\n const hrefs = sourceReferences\n .map((sourceReference) => sourceReference.link.selfhref.href)\n .filter((href, index, self) => self.indexOf(href) === index)\n .map((href) => href.toString());\n\n const allHrefs = JSON.stringify(hrefs);\n useEffect(() => {\n const requests = JSON.parse(allHrefs).map((href) => {\n const modularuiRequest = new ModularUIRequest(href);\n modularuiRequest.locale = localeCode;\n return modularuiRequest.fetchContent(renderChildSections);\n });\n\n start();\n Promise.all(requests).then((responseContent) => {\n setContent(responseContent);\n finish();\n });\n\n // start and finish don't change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allHrefs, localeCode, renderChildSections]);\n\n return content;\n};\n"],"mappings":";;;;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,OAAOC,yBAAyB,MAAM,8CAA8C;AACpF,OAAOC,gBAAgB,MAAM,+BAA+B;AAE5D,SAASC,oBAAoB,QAAQ,+BAA+B;AACpE,SAASC,SAAS,QAAQ,kBAAkB;AAI5C;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,GAAGA,CAC5CC,gBAA2C,EAC3CC,mBAA4B,KACJ;EAAA,IAAAC,QAAA,EAAAC,SAAA;EACxB,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGZ,QAAQ,CAAC,EAAE,CAAC;EAC1C,MAAMa,UAAU,GAAGR,SAAS,CAAC,CAAC;EAE9B,MAAM;IAAES,KAAK;IAAEC;EAAO,CAAC,GAAGX,oBAAoB,CAAC,CAAC;EAEhD,MAAMY,KAAK,GAAGC,oBAAA,CAAAR,QAAA,GAAAS,uBAAA,CAAAR,SAAA,GAAAO,oBAAA,CAAAV,gBAAgB,EAAAY,IAAA,CAAhBZ,gBAAgB,EACtBa,eAAe,IAAKA,eAAe,CAACC,IAAI,CAACC,QAAQ,CAACC,IAAI,CAAC,EAAAJ,IAAA,CAAAT,SAAA,EACrD,CAACa,IAAI,EAAEC,KAAK,EAAEC,IAAI,KAAKA,IAAI,CAACC,OAAO,CAACH,IAAI,CAAC,KAAKC,KAAK,CAAC,EAAAL,IAAA,CAAAV,QAAA,EACtDc,IAAI,IAAKA,IAAI,CAACI,QAAQ,CAAC,CAAC,CAAC;EAEjC,MAAMC,QAAQ,GAAGC,eAAA,CAAeb,KAAK,CAAC;EACtCf,SAAS,CAAC,MAAM;IAAA,IAAA6B,SAAA;IACd,MAAMC,QAAQ,GAAGd,oBAAA,CAAAa,SAAA,GAAAE,IAAI,CAACC,KAAK,CAACL,QAAQ,CAAC,EAAAT,IAAA,CAAAW,SAAA,EAAMP,IAAI,IAAK;MAClD,MAAMW,gBAAgB,GAAG,IAAI/B,gBAAgB,CAACoB,IAAI,CAAC;MACnDW,gBAAgB,CAACC,MAAM,GAAGtB,UAAU;MACpC,OAAOqB,gBAAgB,CAACE,YAAY,CAAC5B,mBAAmB,CAAC;IAC3D,CAAC,CAAC;IAEFM,KAAK,CAAC,CAAC;IACPuB,QAAA,CAAQC,GAAG,CAACP,QAAQ,CAAC,CAACQ,IAAI,CAAEC,eAAe,IAAK;MAC9C5B,UAAU,CAAC4B,eAAe,CAAC;MAC3BzB,MAAM,CAAC,CAAC;IACV,CAAC,CAAC;;IAEF;IACA;EACF,CAAC,EAAE,CAACa,QAAQ,EAAEf,UAAU,EAAEL,mBAAmB,CAAC,CAAC;EAE/C,OAAOG,OAAO;AAChB,CAAC"}
|
package/esm/hooks/useForm.js
CHANGED
|
@@ -8,7 +8,7 @@ import FormModel from "../models/form/FormModel";
|
|
|
8
8
|
/**
|
|
9
9
|
* Load a form by href
|
|
10
10
|
*/
|
|
11
|
-
export const useForm = href => {
|
|
11
|
+
export const useForm = (href, data) => {
|
|
12
12
|
const formHref = new Href(href);
|
|
13
13
|
if (!getSetting("ALWAYS_COMMIT_FORM")) {
|
|
14
14
|
formHref.addParameter("commit", "false");
|
|
@@ -16,7 +16,8 @@ export const useForm = href => {
|
|
|
16
16
|
const form = useModularUI("form", formHref, {
|
|
17
17
|
method: HTTP_METHODS.POST,
|
|
18
18
|
targetModel: FormModel,
|
|
19
|
-
removeOnUnmount: true
|
|
19
|
+
removeOnUnmount: true,
|
|
20
|
+
data
|
|
20
21
|
});
|
|
21
22
|
if (form?.model) {
|
|
22
23
|
return form.model;
|
package/esm/hooks/useForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.js","names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","
|
|
1
|
+
{"version":3,"file":"useForm.js","names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","data","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"sources":["../../src/hooks/useForm.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel, AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateFormAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateFormAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateFormAction,\n cancel: (object: FormObjectModel) => UpdateFormAction,\n remove: (object: FormObjectModel) => UpdateFormAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href, data?: Object): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n data,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,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ANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.js","names":["useSelector","createSelector","memoize","getLocales","getLocale","getMessage","locales","localeCode","id","defaultMessage","placeholders","_len","arguments","length","args","Array","_key","_JSON$stringify","useMessage","useTranslate","useLocale"],"sources":["../../src/hooks/useI18n.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { createSelector } from \"reselect\";\nimport memoize from \"lodash/memoize\";\n\nimport { getLocales, getLocale } from \"../redux/selectors/i18n\";\n\nconst getMessage = createSelector(\n [getLocales, getLocale],\n (locales, localeCode) =>\n memoize(\n (id: string, defaultMessage?: string, placeholders?: Object) =>\n locales\n .getLocale(localeCode)\n .getMessage(id, defaultMessage, placeholders),\n (...args) => JSON.stringify(args)\n )\n);\n\n/**\n */\nconst useMessage = (\n id: string,\n defaultMessage?: string,\n placeholders?: Object | null\n): any => useSelector(getMessage)(id, defaultMessage, placeholders);\n\n/**\n */\nconst useTranslate = (): ((...any) => any) => useSelector(getMessage);\n\n/**\n */\nconst useLocale = (): string => useSelector(getLocale);\n\nexport { useTranslate, useMessage, useLocale };\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,cAAc,QAAQ,UAAU;AACzC,OAAOC,OAAO,MAAM,gBAAgB;AAEpC,SAASC,UAAU,EAAEC,SAAS,QAAQ,yBAAyB;AAE/D,MAAMC,UAAU,GAAGJ,cAAc,CAC/B,CAACE,UAAU,EAAEC,SAAS,CAAC,EACvB,CAACE,OAAO,EAAEC,UAAU,KAClBL,OAAO,CACL,CAACM,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDJ,OAAO,CACJF,SAAS,CAACG,UAAU,CAAC,CACrBF,UAAU,CAACG,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC,EACjD;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAIC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,OAAKC,eAAA,CAAeH,IAAI,CAAC;AAAA,
|
|
1
|
+
{"version":3,"file":"useI18n.js","names":["useSelector","createSelector","memoize","getLocales","getLocale","getMessage","locales","localeCode","id","defaultMessage","placeholders","_len","arguments","length","args","Array","_key","_JSON$stringify","useMessage","useTranslate","useLocale"],"sources":["../../src/hooks/useI18n.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { createSelector } from \"reselect\";\nimport memoize from \"lodash/memoize\";\n\nimport { getLocales, getLocale } from \"../redux/selectors/i18n\";\n\nconst getMessage = createSelector(\n [getLocales, getLocale],\n (locales, localeCode) =>\n memoize(\n (id: string, defaultMessage?: string, placeholders?: Object) =>\n locales\n .getLocale(localeCode)\n .getMessage(id, defaultMessage, placeholders),\n (...args) => JSON.stringify(args)\n )\n);\n\n/**\n */\nconst useMessage = (\n id: string,\n defaultMessage?: string,\n placeholders?: Object | null\n): any => useSelector(getMessage)(id, defaultMessage, placeholders);\n\n/**\n */\nconst useTranslate = (): ((...any) => any) => useSelector(getMessage);\n\n/**\n */\nconst useLocale = (): string => useSelector(getLocale);\n\nexport { useTranslate, useMessage, useLocale };\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,cAAc,QAAQ,UAAU;AACzC,OAAOC,OAAO,MAAM,gBAAgB;AAEpC,SAASC,UAAU,EAAEC,SAAS,QAAQ,yBAAyB;AAE/D,MAAMC,UAAU,GAAGJ,cAAc,CAC/B,CAACE,UAAU,EAAEC,SAAS,CAAC,EACvB,CAACE,OAAO,EAAEC,UAAU,KAClBL,OAAO,CACL,CAACM,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDJ,OAAO,CACJF,SAAS,CAACG,UAAU,CAAC,CACrBF,UAAU,CAACG,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC,EACjD;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAIC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAAA,OAAKC,eAAA,CAAeH,IAAI,CAAC;AAAA,CACnC,CACJ,CAAC;;AAED;AACA;AACA,MAAMI,UAAU,GAAGA,CACjBV,EAAU,EACVC,cAAuB,EACvBC,YAA4B,KACpBV,WAAW,CAACK,UAAU,CAAC,CAACG,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC;;AAEnE;AACA;AACA,MAAMS,YAAY,GAAGA,CAAA,KAAyBnB,WAAW,CAACK,UAAU,CAAC;;AAErE;AACA;AACA,MAAMe,SAAS,GAAGA,CAAA,KAAcpB,WAAW,CAACI,SAAS,CAAC;AAEtD,SAASe,YAAY,EAAED,UAAU,EAAEE,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModal.js","names":["useCallback","useDispatch","useSelector","showModal","closeModal","IllegalArgumentException","useModal","modalId","dispatch","modal","_ref","_context","modals","_findInstanceProperty","call","m","key","show","close","size","visible"],"sources":["../../src/hooks/useModal.js"],"sourcesContent":["// @flow\nimport { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { showModal, closeModal } from \"../redux/actions/Modals\";\nimport { IllegalArgumentException } from \"../exceptions\";\n\ntype ModalHook = (modalId: string) => {\n key: string | null,\n size: string | null,\n visible: boolean,\n show: () => void,\n close: () => void,\n};\n\n/**\n * Manage modals\n */\nexport const useModal: ModalHook = (modalId: string) => {\n if (!modalId) {\n throw new IllegalArgumentException(\n \"Missing modalId argument for useModal hook\"\n );\n }\n\n const dispatch = useDispatch();\n const modal = useSelector(({ modals }) =>\n modals.modals.find((m) => m.key === modalId)\n );\n\n const show = useCallback(() => {\n dispatch(showModal(modalId));\n }, [dispatch, modalId]);\n\n const close = useCallback(() => {\n dispatch(closeModal(modalId));\n }, [dispatch, modalId]);\n\n return {\n key: modal ? modal.key : null,\n size: modal ? modal.size : null,\n visible: modal ? modal.visible : false,\n show,\n close,\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,SAAS,EAAEC,UAAU,QAAQ,yBAAyB;AAC/D,SAASC,wBAAwB,QAAQ,eAAe;AAUxD;AACA;AACA;AACA,OAAO,MAAMC,QAAmB,GAAIC,OAAe,IAAK;EACtD,IAAI,CAACA,OAAO,EAAE;IACZ,MAAM,IAAIF,wBAAwB,CAChC,
|
|
1
|
+
{"version":3,"file":"useModal.js","names":["useCallback","useDispatch","useSelector","showModal","closeModal","IllegalArgumentException","useModal","modalId","dispatch","modal","_ref","_context","modals","_findInstanceProperty","call","m","key","show","close","size","visible"],"sources":["../../src/hooks/useModal.js"],"sourcesContent":["// @flow\nimport { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { showModal, closeModal } from \"../redux/actions/Modals\";\nimport { IllegalArgumentException } from \"../exceptions\";\n\ntype ModalHook = (modalId: string) => {\n key: string | null,\n size: string | null,\n visible: boolean,\n show: () => void,\n close: () => void,\n};\n\n/**\n * Manage modals\n */\nexport const useModal: ModalHook = (modalId: string) => {\n if (!modalId) {\n throw new IllegalArgumentException(\n \"Missing modalId argument for useModal hook\"\n );\n }\n\n const dispatch = useDispatch();\n const modal = useSelector(({ modals }) =>\n modals.modals.find((m) => m.key === modalId)\n );\n\n const show = useCallback(() => {\n dispatch(showModal(modalId));\n }, [dispatch, modalId]);\n\n const close = useCallback(() => {\n dispatch(closeModal(modalId));\n }, [dispatch, modalId]);\n\n return {\n key: modal ? modal.key : null,\n size: modal ? modal.size : null,\n visible: modal ? modal.visible : false,\n show,\n close,\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ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alogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","expectedModels","targetModel","useConceptIndex","href","getHref","context","dynamic","location","_startsWithInstanceProperty","call","replace","search","useConceptDetail","concept","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\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\";\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel =>\n useModularUIBasic(\"conceptindex\", href, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n\nconst getHref = (context: string, dynamic: string, location?: Location) => {\n let href = dynamic;\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search) {\n href = `${href}${location.search}`;\n }\n\n return href;\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = getHref(\"concepts\", concept, location);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel =>\n useModularUIBasic(\"contentindex\", href, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = getHref(\"content\", content, location);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = getHref(\"content\", contentSection);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = getHref(\"contenttypes\", contentType);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,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;AAG5C;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAC7BF,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDG,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEZ;AACf,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMa,eAAe,GAAIC,IAAY,IAC1CN,iBAAiB,CAAC,cAAc,EAAEM,IAAI,EAAE;EACtCH,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEX;AACf,CAAC,CAAC;AAEJ,MAAMc,OAAO,GAAGA,CAACC,OAAe,EAAEC,OAAe,EAAEC,QAAmB,KAAK;EACzE,IAAIJ,IAAI,GAAGG,OAAO;EAClB,IAAI,CAACE,2BAAA,CAAAL,IAAI,EAAAM,IAAA,CAAJN,IAAI,EAAa,IAAGE,OAAQ,GAAE,CAAC,EAAE;IACpCF,IAAI,GAAI,IAAGE,OAAQ,IAAGF,IAAK,EAAC;EAC9B;EAEAA,IAAI,GAAGA,IAAI,CAACO,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;EAEjC,IAAIH,QAAQ,EAAEI,MAAM,EAAE;IACpBR,IAAI,GAAI,GAAEA,IAAK,GAAEI,QAAQ,CAACI,MAAO,EAAC;EACpC;EAEA,OAAOR,IAAI;AACb,CAAC;;AAED;AACA;AACA,OAAO,MAAMS,gBAAgB,GAC3BC,OAAe,IACkC;EACjD,MAAMN,QAAQ,GAAGnB,WAAW,
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["useLocation","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","useModelCatalog","expectedModels","targetModel","useConceptIndex","href","getHref","context","dynamic","location","_startsWithInstanceProperty","call","replace","search","useConceptDetail","concept","useContentIndex","useContentTOC","content","useContent","contentSection","useContentType","contentType"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useLocation } from \"./useRouter\";\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\";\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const useModelCatalog = (): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n });\n\n/**\n */\nexport const useConceptIndex = (href: string): ?ConceptIndexModel =>\n useModularUIBasic(\"conceptindex\", href, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n });\n\nconst getHref = (context: string, dynamic: string, location?: Location) => {\n let href = dynamic;\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replace(/\\/\\//g, \"/\");\n\n if (location?.search) {\n href = `${href}${location.search}`;\n }\n\n return href;\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const location = useLocation();\n\n const href = getHref(\"concepts\", concept, location);\n return useModularUIBasic(\"conceptdetail\", href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n });\n};\n\n/**\n */\nexport const useContentIndex = (href: string): ?ContentIndexModel =>\n useModularUIBasic(\"contentindex\", href, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n });\n\n/**\n */\nexport const useContentTOC = (content: string): ?ContentTOCModel => {\n const location = useLocation();\n const href = getHref(\"content\", content, location);\n return useModularUIBasic(\"contenttoc\", href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n });\n};\n\n/**\n */\nexport const useContent = (contentSection: string): ?ContentModel => {\n const href = getHref(\"content\", contentSection);\n return useModularUIBasic(\"content\", href, {\n expectedModels: [\"Content\"],\n targetModel: ContentModel,\n });\n};\n\n/**\n */\nexport const useContentType = (contentType: string): ?ContentTypeModel => {\n const href = getHref(\"contenttypes\", contentType);\n return useModularUIBasic(\"contenttypes\", href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n });\n};\n"],"mappings":";AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,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;AAG5C;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAC7BF,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDG,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEZ;AACf,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMa,eAAe,GAAIC,IAAY,IAC1CN,iBAAiB,CAAC,cAAc,EAAEM,IAAI,EAAE;EACtCH,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEX;AACf,CAAC,CAAC;AAEJ,MAAMc,OAAO,GAAGA,CAACC,OAAe,EAAEC,OAAe,EAAEC,QAAmB,KAAK;EACzE,IAAIJ,IAAI,GAAGG,OAAO;EAClB,IAAI,CAACE,2BAAA,CAAAL,IAAI,EAAAM,IAAA,CAAJN,IAAI,EAAa,IAAGE,OAAQ,GAAE,CAAC,EAAE;IACpCF,IAAI,GAAI,IAAGE,OAAQ,IAAGF,IAAK,EAAC;EAC9B;EAEAA,IAAI,GAAGA,IAAI,CAACO,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;EAEjC,IAAIH,QAAQ,EAAEI,MAAM,EAAE;IACpBR,IAAI,GAAI,GAAEA,IAAK,GAAEI,QAAQ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c,EAAEgB,WAAW,CAAC;EACjD,OAAOvB,iBAAiB,CAAC,cAAc,EAAEM,IAAI,EAAE;IAC7CH,cAAc,EAAE,CAAC,aAAa,CAAC;IAC/BC,WAAW,EAAEH;EACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModels.js","names":["useDispatch","reloadModel","useModels","dispatch","reload","model","options"],"sources":["../../src/hooks/useModels.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport { reloadModel } from \"../redux/_modularui/ModularUIActions\";\n\nimport type { ModularUIModel } from \"../models/types\";\n\ntype UseModels = () => {\n reload: (model: ModularUIModel, options?: any) => void,\n};\n\n/**\n * Hook that contains the reload property that can be used to reload a model\n */\nexport const useModels: UseModels = () => {\n const dispatch = useDispatch();\n return {\n reload: (model: ModularUIModel, options?: Object) => {\n dispatch(reloadModel(model, options));\n },\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,WAAW,QAAQ,sCAAsC;AAQlE;AACA;AACA;AACA,OAAO,MAAMC,SAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,QAAQ,GAAGH,WAAW,
|
|
1
|
+
{"version":3,"file":"useModels.js","names":["useDispatch","reloadModel","useModels","dispatch","reload","model","options"],"sources":["../../src/hooks/useModels.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport { reloadModel } from \"../redux/_modularui/ModularUIActions\";\n\nimport type { ModularUIModel } from \"../models/types\";\n\ntype UseModels = () => {\n reload: (model: ModularUIModel, options?: any) => void,\n};\n\n/**\n * Hook that contains the reload property that can be used to reload a model\n */\nexport const useModels: UseModels = () => {\n const dispatch = useDispatch();\n return {\n reload: (model: ModularUIModel, options?: Object) => {\n dispatch(reloadModel(model, options));\n },\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SAASC,WAAW,QAAQ,sCAAsC;AAQlE;AACA;AACA;AACA,OAAO,MAAMC,SAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,QAAQ,GAAGH,WAAW,CAAC,CAAC;EAC9B,OAAO;IACLI,MAAM,EAAEA,CAACC,KAAqB,EAAEC,OAAgB,KAAK;MACnDH,QAAQ,CAACF,WAAW,CAACI,KAAK,EAAEC,OAAO,CAAC,CAAC;IACvC;EACF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUI.js","names":["useEffect","useRef","useDispatch","useSelector","HTTP_METHODS","loadModularUI","removeModelByKey","useDeepCompareEffect","useLocale","useKeyForHook","modelKey","url","locale","split","useModularUI","options","arguments","length","undefined","method","GET","removeOnUnmount","dispatch","href","toString","key","prevOptions","prevHref","isOldReload","current","isReload","state","modularui"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport { useLocale } from \"./useI18n\";\n\nimport type Href from \"../models/href/Href\";\nimport type { RequestModularUIOptions } from \"../utils\";\n\n/**\n */\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return `${modelKey}(${url.split(\"?\")[0]})(${locale})`;\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n }\n): any => {\n const dispatch = useDispatch();\n const href = url.toString();\n const key = useKeyForHook(modelKey, href);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n\n // dispatch loadModularUI\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n if (!isOldReload) {\n dispatch(loadModularUI(key, href, options));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n }, [key, href, options]);\n\n const { removeOnUnmount = false } = options;\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(key));\n }\n };\n }, [dispatch, key, removeOnUnmount]);\n\n // retrieve current model from modularui reducer\n return useSelector((state) => {\n return state.modularui[key];\n });\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,YAAY,QAAQ,cAAc;AAC3C,SACEC,aAAa,EACbC,gBAAgB,QACX,sCAAsC;AAE7C,OAAOC,oBAAoB,MAAM,wBAAwB;AAEzD,SAASC,SAAS,QAAQ,WAAW;AAKrC;AACA;AACA,MAAMC,aAAa,GAAGA,CAACC,QAAgB,EAAEC,GAAW,KAAK;EACvD,MAAMC,MAAM,GAAGJ,SAAS,
|
|
1
|
+
{"version":3,"file":"useModularUI.js","names":["useEffect","useRef","useDispatch","useSelector","HTTP_METHODS","loadModularUI","removeModelByKey","useDeepCompareEffect","useLocale","useKeyForHook","modelKey","url","locale","split","useModularUI","options","arguments","length","undefined","method","GET","removeOnUnmount","dispatch","href","toString","key","prevOptions","prevHref","isOldReload","current","isReload","state","modularui"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport { useLocale } from \"./useI18n\";\n\nimport type Href from \"../models/href/Href\";\nimport type { RequestModularUIOptions } from \"../utils\";\n\n/**\n */\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return `${modelKey}(${url.split(\"?\")[0]})(${locale})`;\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n }\n): any => {\n const dispatch = useDispatch();\n const href = url.toString();\n const key = useKeyForHook(modelKey, href);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n\n // dispatch loadModularUI\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n if (!isOldReload) {\n dispatch(loadModularUI(key, href, options));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n }, [key, href, options]);\n\n const { removeOnUnmount = false } = options;\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(key));\n }\n };\n }, [dispatch, key, removeOnUnmount]);\n\n // retrieve current model from modularui reducer\n return useSelector((state) => {\n return state.modularui[key];\n });\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,YAAY,QAAQ,cAAc;AAC3C,SACEC,aAAa,EACbC,gBAAgB,QACX,sCAAsC;AAE7C,OAAOC,oBAAoB,MAAM,wBAAwB;AAEzD,SAASC,SAAS,QAAQ,WAAW;AAKrC;AACA;AACA,MAAMC,aAAa,GAAGA,CAACC,QAAgB,EAAEC,GAAW,KAAK;EACvD,MAAMC,MAAM,GAAGJ,SAAS,CAAC,CAAC;EAC1B,OAAQ,GAAEE,QAAS,IAAGC,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,KAAID,MAAO,GAAE;AACvD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,YAAY,GAAG,SAAAA,CAC1BJ,QAAgB,EAChBC,GAAkB,EAKV;EAAA,I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,CAAC;EAC7B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIBasic.js","names":["useModularUI","useLocation","IllegalArgumentException","IllegalStateException","useModularUIBasic","key","href","_context","options","arguments","length","undefined","expectedModels","targetModel","forceTargetModel","location","useModularUIOptions","isReload","state","reload","_startsWithInstanceProperty","pathname","call","toString","modularUI","model","isCorrectModel","some","expectedModel","type","console","error"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useModularUI } from \"./useModularUI\";\n\nimport { useLocation } from \"./useRouter\";\n\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\ntype UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n};\n\n/**\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 }\n): T | null => {\n const location = useLocation();\n if (!href) {\n throw new IllegalArgumentException(\"Missing href\");\n }\n\n const useModularUIOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n };\n if (options.targetModel) {\n useModularUIOptions.targetModel = options.targetModel;\n useModularUIOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // reload when the modular service starts with the current location\n if (location.state?.reload && location.pathname.startsWith(href.toString())) {\n useModularUIOptions.isReload = true;\n }\n\n // $FlowFixMe[incompatible-call]\n const modularUI = useModularUI(key, href, useModularUIOptions);\n\n if (modularUI?.model) {\n const { model } = modularUI;\n if (options.expectedModels.length > 0) {\n const isCorrectModel = options.expectedModels.some((expectedModel) => {\n return model.type === expectedModel;\n });\n\n if (!isCorrectModel) {\n console.error(modularUI, \"is not of instance\", options.expectedModels);\n throw new IllegalStateException(\"Resolved model has incorrect type\");\n }\n }\n\n return model;\n }\n\n return null;\n};\n"],"mappings":";AACA,SAASA,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,wBAAwB,EAAEC,qBAAqB,QAAQ,eAAe;AAU/E;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,SAAAA,CAC/BC,GAAW,EACXC,IAAmB,EAMN;EAAA,IAAAC,QAAA;EAAA,IALbC,OAAoC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACrCG,cAAc,EAAE,EAAE;IAClBC,WAAW,EAAEF,SAAS;IACtBG,gBAAgB,EAAE;EACpB,CAAC;EAED,MAAMC,QAAQ,GAAGd,WAAW,
|
|
1
|
+
{"version":3,"file":"useModularUIBasic.js","names":["useModularUI","useLocation","IllegalArgumentException","IllegalStateException","useModularUIBasic","key","href","_context","options","arguments","length","undefined","expectedModels","targetModel","forceTargetModel","location","useModularUIOptions","isReload","state","reload","_startsWithInstanceProperty","pathname","call","toString","modularUI","model","isCorrectModel","some","expectedModel","type","console","error"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useModularUI } from \"./useModularUI\";\n\nimport { useLocation } from \"./useRouter\";\n\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\ntype UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n};\n\n/**\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 }\n): T | null => {\n const location = useLocation();\n if (!href) {\n throw new IllegalArgumentException(\"Missing href\");\n }\n\n const useModularUIOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n };\n if (options.targetModel) {\n useModularUIOptions.targetModel = options.targetModel;\n useModularUIOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // reload when the modular service starts with the current location\n if (location.state?.reload && location.pathname.startsWith(href.toString())) {\n useModularUIOptions.isReload = true;\n }\n\n // $FlowFixMe[incompatible-call]\n const modularUI = useModularUI(key, href, useModularUIOptions);\n\n if (modularUI?.model) {\n const { model } = modularUI;\n if (options.expectedModels.length > 0) {\n const isCorrectModel = options.expectedModels.some((expectedModel) => {\n return model.type === expectedModel;\n });\n\n if (!isCorrectModel) {\n console.error(modularUI, \"is not of instance\", options.expectedModels);\n throw new IllegalStateException(\"Resolved model has incorrect type\");\n }\n }\n\n return model;\n }\n\n return null;\n};\n"],"mappings":";AACA,SAASA,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,wBAAwB,EAAEC,qBAAqB,QAAQ,eAAe;AAU/E;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,SAAAA,CAC/BC,GAAW,EACXC,IAAmB,EAMN;EAAA,IAAAC,QAAA;EAAA,IALbC,OAAoC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACrCG,cAAc,EAAE,EAAE;IAClBC,WAAW,EAAEF,SAAS;IACtBG,gBAAgB,EAAE;EACpB,CAAC;EAED,MAAMC,QAAQ,GAAGd,WAAW,CAAC,CAAC;EAC9B,IAAI,CAACK,IAAI,EAAE;IACT,MAAM,IAAIJ,wBAAwB,CAAC,cAAc,CAAC;EACpD;EAEA,MAAMc,mBAAmB,GAAG;IAC1BH,WAAW,EAAEF,SAAS;IACtBG,gBAAgB,EAAEH,SAAS;IAC3BM,QAAQ,EAAE;EACZ,CAAC;EACD,IAAIT,OAAO,CAACK,WAAW,EAAE;IACvBG,mBAAmB,CAACH,WAAW,GAAGL,OAAO,CAACK,WAAW;IACrDG,mBAAmB,CAACF,gBAAgB,GAAGN,OAAO,CAACM,gBAAgB;EACjE;;EAEA;EACA,IAAIC,QAAQ,CAACG,KAAK,EAAEC,MAAM,IAAIC,2BAAA,CAAAb,QAAA,GAAAQ,QAAQ,CAACM,QAAQ,EAAAC,IAAA,CAAAf,QAAA,EAAYD,IAAI,CAACiB,QAAQ,CAAC,CAAC,CAAC,EAAE;IAC3EP,mBAAmB,CAACC,QAAQ,GAAG,IAAI;EACrC;;EAEA;EACA,MAAMO,SAAS,GAAGxB,YAAY,CAACK,GAAG,EAAEC,IAAI,EAAEU,mBAAmB,CAAC;EAE9D,IAAIQ,SAAS,EAAEC,KAAK,EAAE;IACpB,MAAM;MAAEA;IAAM,CAAC,GAAGD,SAAS;IAC3B,IAAIhB,OAAO,CAACI,cAAc,CAACF,MAAM,GAAG,CAAC,EAAE;MACrC,MAAMgB,cAAc,GAAGlB,OAAO,CAACI,cAAc,CAACe,IAAI,CAAEC,aAAa,IAAK;QACpE,OAAOH,KAAK,CAACI,IAAI,KAAKD,aAAa;MACrC,CAAC,CAAC;MAEF,IAAI,CAACF,cAAc,EAAE;QACnBI,OAAO,CAACC,KAAK,CAACP,SAAS,EAAE,oBAAoB,EAAEhB,OAAO,CAACI,cAAc,CAAC;QACtE,MAAM,IAAIT,qBAAqB,CAAC,mCAAmC,CAAC;MACtE;IACF;IAEA,OAAOsB,KAAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotification.js","names":["useSelector","useDispatch","dismissNotification","showNotification","NOTIFICATION_TYPES","useNotification","dispatch","render","messageType","message","error","state","notification","dismiss","useErrorNotification","ERROR"],"sources":["../../src/hooks/useNotification.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification, showNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n ShowNotificationAction,\n} from \"../redux/types\";\n\nimport { NOTIFICATION_TYPES } from \"../constants\";\n\nimport type { MessageObject } from \"../i18n\";\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\ntype ErrorNotificationHook = (\n message: MessageObject,\n error?: ?ErrorResponse\n) => ShowNotificationAction;\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n\n/**\n */\nexport const useErrorNotification = (): ErrorNotificationHook => {\n const dispatch = useDispatch();\n return (message: MessageObject, error?: ?ErrorResponse) => {\n return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,kBAAkB;AAQxE,SAASC,kBAAkB,QAAQ,cAAc;AAajD;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAwB;EACrD,MAAMC,QAAQ,GAAGL,WAAW,
|
|
1
|
+
{"version":3,"file":"useNotification.js","names":["useSelector","useDispatch","dismissNotification","showNotification","NOTIFICATION_TYPES","useNotification","dispatch","render","messageType","message","error","state","notification","dismiss","useErrorNotification","ERROR"],"sources":["../../src/hooks/useNotification.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification, showNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n ShowNotificationAction,\n} from \"../redux/types\";\n\nimport { NOTIFICATION_TYPES } from \"../constants\";\n\nimport type { MessageObject } from \"../i18n\";\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\ntype ErrorNotificationHook = (\n message: MessageObject,\n error?: ?ErrorResponse\n) => ShowNotificationAction;\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n\n/**\n */\nexport const useErrorNotification = (): ErrorNotificationHook => {\n const dispatch = useDispatch();\n return (message: MessageObject, error?: ?ErrorResponse) => {\n return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,kBAAkB;AAQxE,SAASC,kBAAkB,QAAQ,cAAc;AAajD;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAwB;EACrD,MAAMC,QAAQ,GAAGL,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEM,MAAM;IAAEC,WAAW;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGV,WAAW,CACxDW,KAAK,IAAKA,KAAK,CAACC,YACnB,CAAC;EAED,OAAO;IACLL,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,KAAK;IACLG,OAAO,EAAEA,CAAA,KAAMP,QAAQ,CAACJ,mBAAmB,CAAC,CAAC;EAC/C,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMY,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,MAAMR,QAAQ,GAAGL,WAAW,CAAC,CAAC;EAC9B,OAAO,CAACQ,OAAsB,EAAEC,KAAsB,KAAK;IACzD,OAAOJ,QAAQ,CAACH,gBAAgB,CAACC,kBAAkB,CAACW,KAAK,EAAEN,OAAO,EAAEC,KAAK,CAAC,CAAC;EAC7E,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProgressIndicator.js","names":["useDispatch","useSelector","startProgress","finishProgress","resetProgress","updateProgress","useProgressIndicator","dispatch","progress","state","progressindicator","start","finish","reset","update","percentComplete"],"sources":["../../src/hooks/useProgressIndicator.js"],"sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport {\n startProgress,\n finishProgress,\n resetProgress,\n updateProgress,\n} from \"../redux/actions/ProgressIndicator\";\nimport type { ProgressIndicatorState } from \"../redux/types\";\n\ntype ProgressIndicatorHook = {\n ...ProgressIndicatorState,\n start: () => void,\n finish: () => void,\n reset: () => void,\n update: (percentComplete: number) => void,\n};\n\n/**\n */\nexport const useProgressIndicator = (): ProgressIndicatorHook => {\n const dispatch = useDispatch();\n const progress = useSelector((state) => state.progressindicator);\n\n return {\n ...progress,\n start: () => dispatch(startProgress()),\n finish: () => dispatch(finishProgress()),\n reset: () => dispatch(resetProgress()),\n update: (percentComplete: number) =>\n dispatch(updateProgress(percentComplete)),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,cAAc,QACT,oCAAoC;AAW3C;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,MAAMC,QAAQ,GAAGP,WAAW,
|
|
1
|
+
{"version":3,"file":"useProgressIndicator.js","names":["useDispatch","useSelector","startProgress","finishProgress","resetProgress","updateProgress","useProgressIndicator","dispatch","progress","state","progressindicator","start","finish","reset","update","percentComplete"],"sources":["../../src/hooks/useProgressIndicator.js"],"sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport {\n startProgress,\n finishProgress,\n resetProgress,\n updateProgress,\n} from \"../redux/actions/ProgressIndicator\";\nimport type { ProgressIndicatorState } from \"../redux/types\";\n\ntype ProgressIndicatorHook = {\n ...ProgressIndicatorState,\n start: () => void,\n finish: () => void,\n reset: () => void,\n update: (percentComplete: number) => void,\n};\n\n/**\n */\nexport const useProgressIndicator = (): ProgressIndicatorHook => {\n const dispatch = useDispatch();\n const progress = useSelector((state) => state.progressindicator);\n\n return {\n ...progress,\n start: () => dispatch(startProgress()),\n finish: () => dispatch(finishProgress()),\n reset: () => dispatch(resetProgress()),\n update: (percentComplete: number) =>\n dispatch(updateProgress(percentComplete)),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,cAAc,QACT,oCAAoC;AAW3C;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,MAAMC,QAAQ,GAAGP,WAAW,CAAC,CAAC;EAC9B,MAAMQ,QAAQ,GAAGP,WAAW,CAAEQ,KAAK,IAAKA,KAAK,CAACC,iBAAiB,CAAC;EAEhE,OAAO;IACL,GAAGF,QAAQ;IACXG,KAAK,EAAEA,CAAA,KAAMJ,QAAQ,CAACL,aAAa,CAAC,CAAC,CAAC;IACtCU,MAAM,EAAEA,CAAA,KAAML,QAAQ,CAACJ,cAAc,CAAC,CAAC,CAAC;IACxCU,KAAK,EAAEA,CAAA,KAAMN,QAAQ,CAACH,aAAa,CAAC,CAAC,CAAC;IACtCU,MAAM,EAAGC,eAAuB,IAC9BR,QAAQ,CAACF,cAAc,CAACU,eAAe,CAAC;EAC5C,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.js","names":["useDispatch","useSelector","push","replace","go","goBack","goForward","useLocation","state","router","location","useLocationKey","key","useQuerystring","search","usePathname","pathname","useNavigation","dispatch","delta"],"sources":["../../src/hooks/useRouter.js"],"sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport type { Location, LocationShape } from \"react-router\";\n\nimport {\n push,\n replace,\n go,\n goBack,\n goForward,\n} from \"../redux/_router/RouterActions\";\nimport type {\n GoAction,\n GoBackAction,\n GoForwardAction,\n PushAction,\n ReplaceAction,\n} from \"../redux\";\n\ntype UseLocationHook = () => Location;\ntype UseLocationKeyHook = () => string;\ntype UseQuerystringHook = () => string;\ntype UsePathnameHook = () => string;\ntype UseNavigationHook = () => {\n push: (location: LocationShape | string, state?: { ... }) => PushAction,\n replace: (location: LocationShape | string, state?: { ... }) => ReplaceAction,\n go: (delta: number) => GoAction,\n goBack: () => GoBackAction,\n goForward: () => GoForwardAction,\n};\n\n/**\n */\nexport const useLocation: UseLocationHook = () =>\n useSelector((state) => state.router.location);\n\n/**\n */\nexport const useLocationKey: UseLocationKeyHook = () =>\n useLocation()?.key ?? \"\";\n\n/**\n */\nexport const useQuerystring: UseQuerystringHook = () => useLocation()?.search;\n\n/**\n */\nexport const usePathname: UsePathnameHook = () => useLocation()?.pathname;\n\n/**\n */\nexport const useNavigation: UseNavigationHook = () => {\n const dispatch = useDispatch();\n\n return {\n push: (location: LocationShape | string, state?: { ... }) =>\n dispatch(push(location, state)),\n replace: (location: LocationShape | string, state?: { ... }) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAGtD,SACEC,IAAI,EACJC,OAAO,EACPC,EAAE,EACFC,MAAM,EACNC,SAAS,QACJ,gCAAgC;AAqBvC;AACA;AACA,OAAO,MAAMC,WAA4B,GAAGA,CAAA,KAC1CN,WAAW,CAAEO,KAAK,IAAKA,KAAK,CAACC,MAAM,CAACC,QAAQ,CAAC;;AAE/C;AACA;AACA,OAAO,MAAMC,cAAkC,GAAGA,CAAA,KAChDJ,WAAW,
|
|
1
|
+
{"version":3,"file":"useRouter.js","names":["useDispatch","useSelector","push","replace","go","goBack","goForward","useLocation","state","router","location","useLocationKey","key","useQuerystring","search","usePathname","pathname","useNavigation","dispatch","delta"],"sources":["../../src/hooks/useRouter.js"],"sourcesContent":["// @flow\nimport { useDispatch, useSelector } from \"react-redux\";\nimport type { Location, LocationShape } from \"react-router\";\n\nimport {\n push,\n replace,\n go,\n goBack,\n goForward,\n} from \"../redux/_router/RouterActions\";\nimport type {\n GoAction,\n GoBackAction,\n GoForwardAction,\n PushAction,\n ReplaceAction,\n} from \"../redux\";\n\ntype UseLocationHook = () => Location;\ntype UseLocationKeyHook = () => string;\ntype UseQuerystringHook = () => string;\ntype UsePathnameHook = () => string;\ntype UseNavigationHook = () => {\n push: (location: LocationShape | string, state?: { ... }) => PushAction,\n replace: (location: LocationShape | string, state?: { ... }) => ReplaceAction,\n go: (delta: number) => GoAction,\n goBack: () => GoBackAction,\n goForward: () => GoForwardAction,\n};\n\n/**\n */\nexport const useLocation: UseLocationHook = () =>\n useSelector((state) => state.router.location);\n\n/**\n */\nexport const useLocationKey: UseLocationKeyHook = () =>\n useLocation()?.key ?? \"\";\n\n/**\n */\nexport const useQuerystring: UseQuerystringHook = () => useLocation()?.search;\n\n/**\n */\nexport const usePathname: UsePathnameHook = () => useLocation()?.pathname;\n\n/**\n */\nexport const useNavigation: UseNavigationHook = () => {\n const dispatch = useDispatch();\n\n return {\n push: (location: LocationShape | string, state?: { ... }) =>\n dispatch(push(location, state)),\n replace: (location: LocationShape | string, state?: { ... }) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAGtD,SACEC,IAAI,EACJC,OAAO,EACPC,EAAE,EACFC,MAAM,EACNC,SAAS,QACJ,gCAAgC;AAqBvC;AACA;AACA,OAAO,MAAMC,WAA4B,GAAGA,CAAA,KAC1CN,WAAW,CAAEO,KAAK,IAAKA,KAAK,CAACC,MAAM,CAACC,QAAQ,CAAC;;AAE/C;AACA;AACA,OAAO,MAAMC,cAAkC,GAAGA,CAAA,KAChDJ,WAAW,CAAC,CAAC,EAAEK,GAAG,IAAI,EAAE;;AAE1B;AACA;AACA,OAAO,MAAMC,cAAkC,GAAGA,CAAA,KAAMN,WAAW,CAAC,CAAC,EAAEO,MAAM;;AAE7E;AACA;AACA,OAAO,MAAMC,WAA4B,GAAGA,CAAA,KAAMR,WAAW,CAAC,CAAC,EAAES,QAAQ;;AAEzE;AACA;AACA,OAAO,MAAMC,aAAgC,GAAGA,CAAA,KAAM;EACpD,MAAMC,QAAQ,GAAGlB,WAAW,CAAC,CAAC;EAE9B,OAAO;IACLE,IAAI,EAAEA,CAACQ,QAAgC,EAAEF,KAAe,KACtDU,QAAQ,CAAChB,IAAI,CAACQ,QAAQ,EAAEF,KAAK,CAAC,CAAC;IACjCL,OAAO,EAAEA,CAACO,QAAgC,EAAEF,KAAe,KACzDU,QAAQ,CAACf,OAAO,CAACO,QAAQ,EAAEF,KAAK,CAAC,CAAC;IACpCJ,EAAE,EAAGe,KAAa,IAAKD,QAAQ,CAACd,EAAE,CAACe,KAAK,CAAC,CAAC;IAC1Cd,MAAM,EAAEA,CAAA,KAAMa,QAAQ,CAACb,MAAM,CAAC,CAAC,CAAC;IAChCC,SAAS,EAAEA,CAAA,KAAMY,QAAQ,CAACZ,SAAS,CAAC,CAAC;EACvC,CAAC;AACH,CAAC"}
|
package/esm/i18n/Locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Locale.js","names":["formatMessage","languages","IllegalStateException","getSetting","Locale","constructor","locale","_defineProperty","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","setup","missingTranslation","aLocale","split","length","language","lang","toUpperCase","fixPlaceHolders","message","replace","arguments","undefined","JSON","parse","_JSON$stringify","getBaseMessage","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","console","debug","parameters","getMessage","update"],"sources":["../../src/i18n/Locale.js"],"sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\")\n );\n }\n\n /**\n * Retrieve message by id\n */\n getBaseMessage(id: string, defaultMessage?: string): string {\n if (!id && !defaultMessage) {\n return \"[message: id or defaultMessage missing]\";\n }\n\n const messageFromLocale = this._messages[id] || this._errors[id];\n\n if (\n (typeof process === \"undefined\" ||\n process.env.NODE_ENV !== \"production\") &&\n !messageFromLocale &&\n id &&\n getSetting(\"DEBUG_I18N_MESSAGE_NOT_FOUND\")\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `Message with id ${id} not found for locale ${this.code} in layout translations`\n );\n }\n return messageFromLocale || this.fixPlaceHolders(defaultMessage) || id;\n }\n\n /**\n * Format message using formatMessage library\n */\n formatMessage(message: string, parameters?: MessageParameters): string {\n if (parameters) {\n return formatMessage(message, parameters);\n }\n\n return message;\n }\n\n /**\n * Retrieve a messages with replaced parameters\n */\n getMessage(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ): string {\n const message = this.getBaseMessage(id, defaultMessage);\n return this.formatMessage(message, parameters);\n }\n\n /**\n * Add or change messages for this locale. It is not possible to remove messages.\n */\n update(messages: Object = {}, errors: Object = {}) {\n this._messages = {\n ...this._messages,\n ...this.fixPlaceHoldersInObject(messages),\n };\n\n this._errors = {\n ...this._errors,\n ...this.fixPlaceHoldersInObject(errors),\n };\n }\n}\n\nexport default Locale;\n"],"mappings":";;AACA,OAAOA,aAAa,MAAM,gBAAgB;AAE1C,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,qBAAqB,QAAQ,eAAe;AAErD,SAASC,UAAU,QAAQ,cAAc;AAIzC;AACA;AACA;AACA,MAAMC,MAAM,CAAC;EAMXC,WAAWA,CAACC,MAA2B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACvC,IAAI,CAACC,KAAK,GAAGF,MAAM,CAACG,IAAI;IAExB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACC,uBAAuB,CAACL,MAAM,CAACM,QAAQ,CAAC;IAC9D,IAAI,CAACC,OAAO,GAAG,IAAI,CAACF,uBAAuB,CAACL,MAAM,CAACQ,MAAM,CAAC;IAE1D,IAAI,CAACC,WAAW,GAAGT,MAAM,CAACU,UAAU;IAEpChB,aAAa,CAACiB,KAAK,CAAC;MAClBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;EACE,IAAIT,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACD,KAAK;EACnB;;EAEA;AACF;AACA;EACE,IAAIQ,UAAUA,CAAA,EAAW;IACvB,IAAI,IAAI,CAACD,WAAW,EAAE;MACpB,OAAO,IAAI,CAACA,WAAW;IACzB;IAEA,MAAMI,OAAO,GAAG,IAAI,CAACV,IAAI,CAACW,KAAK,CAAC,GAAG,CAAC;IAEpC,IAAID,OAAO,CAACE,MAAM,GAAG,CAAC,EAAE;MACtB,MAAMC,QAAQ,GAAGrB,SAAS,CAACsB,IAAI,CAACJ,OAAO,CAAC,CAAC,CAAC,CAAC;MAE3C,IAAIG,QAAQ,EAAE;QACZ,OACEA,QAAQ,CAAC,CAAC,CAAC,IAAIH,OAAO,CAAC,CAAC,CAAC,GAAI,KAAIA,OAAO,CAAC,CAAC,CAAC,CAACK,WAAW,
|
|
1
|
+
{"version":3,"file":"Locale.js","names":["formatMessage","languages","IllegalStateException","getSetting","Locale","constructor","locale","_defineProperty","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","setup","missingTranslation","aLocale","split","length","language","lang","toUpperCase","fixPlaceHolders","message","replace","arguments","undefined","JSON","parse","_JSON$stringify","getBaseMessage","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","console","debug","parameters","getMessage","update"],"sources":["../../src/i18n/Locale.js"],"sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\")\n );\n }\n\n /**\n * Retrieve message by id\n */\n getBaseMessage(id: string, defaultMessage?: string): string {\n if (!id && !defaultMessage) {\n return \"[message: id or defaultMessage missing]\";\n }\n\n const messageFromLocale = this._messages[id] || this._errors[id];\n\n if (\n (typeof process === \"undefined\" ||\n process.env.NODE_ENV !== \"production\") &&\n !messageFromLocale &&\n id &&\n getSetting(\"DEBUG_I18N_MESSAGE_NOT_FOUND\")\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `Message with id ${id} not found for locale ${this.code} in layout translations`\n );\n }\n return messageFromLocale || this.fixPlaceHolders(defaultMessage) || id;\n }\n\n /**\n * Format message using formatMessage library\n */\n formatMessage(message: string, parameters?: MessageParameters): string {\n if (parameters) {\n return formatMessage(message, parameters);\n }\n\n return message;\n }\n\n /**\n * Retrieve a messages with replaced parameters\n */\n getMessage(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ): string {\n const message = this.getBaseMessage(id, defaultMessage);\n return this.formatMessage(message, parameters);\n }\n\n /**\n * Add or change messages for this locale. It is not possible to remove messages.\n */\n update(messages: Object = {}, errors: Object = {}) {\n this._messages = {\n ...this._messages,\n ...this.fixPlaceHoldersInObject(messages),\n };\n\n this._errors = {\n ...this._errors,\n ...this.fixPlaceHoldersInObject(errors),\n };\n }\n}\n\nexport default Locale;\n"],"mappings":";;AACA,OAAOA,aAAa,MAAM,gBAAgB;AAE1C,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,qBAAqB,QAAQ,eAAe;AAErD,SAASC,UAAU,QAAQ,cAAc;AAIzC;AACA;AACA;AACA,MAAMC,MAAM,CAAC;EAMXC,WAAWA,CAACC,MAA2B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACvC,IAAI,CAACC,KAAK,GAAGF,MAAM,CAACG,IAAI;IAExB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACC,uBAAuB,CAACL,MAAM,CAACM,QAAQ,CAAC;IAC9D,IAAI,CAACC,OAAO,GAAG,IAAI,CAACF,uBAAuB,CAACL,MAAM,CAACQ,MAAM,CAAC;IAE1D,IAAI,CAACC,WAAW,GAAGT,MAAM,CAACU,UAAU;IAEpChB,aAAa,CAACiB,KAAK,CAAC;MAClBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;EACE,IAAIT,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACD,KAAK;EACnB;;EAEA;AACF;AACA;EACE,IAAIQ,UAAUA,CAAA,EAAW;IACvB,IAAI,IAAI,CAACD,WAAW,EAAE;MACpB,OAAO,IAAI,CAACA,WAAW;IAC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AAO,GAAG;MACb,GAAG,IAAI,CAACA,OAAO;MACf,GAAG,IAAI,CAACF,uBAAuB,CAACG,MAAM;IACxC,CAAC;EACH;AACF;AAEA,eAAeV,MAAM"}
|
package/esm/i18n/Locales.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Locales.js","names":["Locale","englishErrors","dutchErrors","BaseCollection","IllegalArgumentException","availableLocales","code","messages","errors","createLocalesWithConfiguredErrors","configuredErrors","_mapInstanceProperty","call","availableLocale","Locales","constructor","locales","arguments","length","undefined","locale","rehydrate","hydatedLocales","_collection","_context","_code","_messages","_errors","hasLocale","localeCode","some","item","_startsWithInstanceProperty","getLocale","_context2","_findInstanceProperty","availableLocaleCodes","_context3","getPreferredLocale","acceptLanguageHeader","_context4","acceptLanguages","match","preferredLocales","_filterInstanceProperty","_context5","update","add"],"sources":["../../src/i18n/Locales.js"],"sourcesContent":["// @flow\nimport Locale from \"./Locale\";\n\nimport englishErrors from \"./translations/beinformed_error_messages_en.nl\";\nimport dutchErrors from \"./translations/beinformed_error_messages_nl.nl\";\n\nimport BaseCollection from \"../models/base/BaseCollection\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport type { LocaleConfiguration } from \"./types\";\n\ntype ErrorMessageObject = {\n [languageCode: string]: {\n [messageID: string]: string,\n },\n};\n\ntype HydratedLocales = {\n _collection: Array<{\n _code: string,\n _messages: {\n [string]: string,\n },\n _errors: {\n [string]: string,\n },\n }>,\n};\n\n/**\n * Array of available locales\n * Order of locales is the preferred order of locales.\n * When user has an accept language header that does not correspond to the locales array,\n * the first one is used as the preferred language\n */\nexport const availableLocales: Array<LocaleConfiguration> = [\n {\n code: \"en\",\n messages: {},\n errors: englishErrors,\n },\n {\n code: \"nl\",\n messages: {},\n errors: dutchErrors,\n },\n];\n\n/**\n * Merge an object with custom error messages (exported and translated from be informed for example) and merge them with the existing translations.\n */\nexport const createLocalesWithConfiguredErrors = (\n configuredErrors: ErrorMessageObject\n): Array<Object> =>\n availableLocales.map((availableLocale) => {\n if (configuredErrors[availableLocale.code]) {\n return {\n ...availableLocale,\n errors: {\n ...availableLocale.errors,\n ...configuredErrors[availableLocale.code],\n },\n };\n }\n\n return availableLocale;\n });\n\n/**\n * Locales, collection of Locale\n */\nclass Locales extends BaseCollection<Locale> {\n constructor(locales: Array<LocaleConfiguration> = availableLocales) {\n super(locales.map((locale) => new Locale(locale)));\n }\n\n /**\n * rehydrate\n */\n static rehydrate(hydatedLocales: HydratedLocales): Locales {\n if (hydatedLocales && hydatedLocales._collection) {\n return new Locales(\n hydatedLocales._collection.map((locale) => ({\n code: locale._code,\n messages: locale._messages,\n errors: locale._errors,\n }))\n );\n }\n\n return new Locales([]);\n }\n\n /**\n * Check if locale with localeCode exists\n */\n hasLocale(localeCode: string): boolean {\n return this.some((item) => localeCode.startsWith(item.code));\n }\n\n /**\n * Retrieve locales by localeCode from Locales collection\n */\n getLocale(localeCode: string): Locale {\n if (this.hasLocale(localeCode)) {\n const locale = this.find((item) => localeCode.startsWith(item.code));\n if (locale) {\n return locale;\n }\n }\n throw new IllegalArgumentException(\n `Locale configuration for locale ${localeCode} not found`\n );\n }\n\n /**\n * Retrieve all available locale codes\n */\n get availableLocaleCodes(): Array<string> {\n return this.map((locale) => locale.code);\n }\n\n /**\n * Retrieve preferred locale based on the accept header of a browser\n */\n getPreferredLocale(acceptLanguageHeader: string | null): void | string {\n if (acceptLanguageHeader != null) {\n const acceptLanguages =\n acceptLanguageHeader.match(/[-A-Za-z]{2,10}/gu) || [];\n\n const preferredLocales = acceptLanguages\n .filter((locale) =>\n this.availableLocaleCodes.some((availableLocale) =>\n locale.startsWith(availableLocale)\n )\n )\n .map((locale) =>\n this.availableLocaleCodes.find((availableLocale) =>\n locale.startsWith(availableLocale)\n )\n );\n\n if (preferredLocales.length > 0) {\n return preferredLocales[0];\n }\n }\n\n return this.availableLocaleCodes[0];\n }\n\n /**\n * Add or change messages and errors for the given locale.<br>\n * It is not possible to remove messages.\n */\n update(locale: string, messages: Object = {}, errors: Object = {}) {\n if (this.hasLocale(locale)) {\n this.getLocale(locale).update(messages, errors);\n } else {\n this.add(\n new Locale({\n code: locale,\n messages,\n errors,\n })\n );\n }\n }\n}\n\nexport default Locales;\n"],"mappings":";;;;AACA,OAAOA,MAAM,MAAM,UAAU;AAE7B,OAAOC,aAAa,MAAM,gDAAgD;AAC1E,OAAOC,WAAW,MAAM,gDAAgD;AAExE,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,SAASC,wBAAwB,QAAQ,eAAe;AAsBxD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAA4C,GAAG,CAC1D;EACEC,IAAI,EAAE,IAAI;EACVC,QAAQ,EAAE,CAAC,CAAC;EACZC,MAAM,EAAEP;AACV,CAAC,EACD;EACEK,IAAI,EAAE,IAAI;EACVC,QAAQ,EAAE,CAAC,CAAC;EACZC,MAAM,EAAEN;AACV,CAAC,CACF;;AAED;AACA;AACA;AACA,OAAO,MAAMO,iCAAiC,GAC5CC,gBAAoC,IAEpCC,oBAAA,CAAAN,gBAAgB,EAAAO,IAAA,CAAhBP,gBAAgB,EAAMQ,eAAe,IAAK;EACxC,IAAIH,gBAAgB,CAACG,eAAe,CAACP,IAAI,CAAC,EAAE;IAC1C,OAAO;MACL,GAAGO,eAAe;MAClBL,MAAM,EAAE;QACN,GAAGK,eAAe,CAACL,MAAM;QACzB,GAAGE,gBAAgB,CAACG,eAAe,CAACP,IAAI;MAC1C;IACF,CAAC;EACH;EAEA,OAAOO,eAAe;AACxB,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,MAAMC,OAAO,SAASX,cAAc,CAAS;EAC3CY,WAAWA,CAAA,EAAyD;IAAA,IAAxDC,OAAmC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGZ,gBAAgB;IAChE,KAAK,CAACM,oBAAA,CAAAK,OAAO,EAAAJ,IAAA,CAAPI,OAAO,EAAMI,MAAM,IAAK,IAAIpB,MAAM,CAACoB,MAAM,CAAC,CAAC,CAAC;EACpD;;EAEA;AACF;AACA;EACE,OAAOC,SAASA,CAACC,cAA+B,EAAW;IACzD,IAAIA,cAAc,IAAIA,cAAc,CAACC,WAAW,EAAE;MAAA,IAAAC,QAAA;MAChD,OAAO,IAAIV,OAAO,CAChBH,oBAAA,CAAAa,QAAA,GAAAF,cAAc,CAACC,WAAW,EAAAX,IAAA,CAAAY,QAAA,EAAMJ,MAAM,KAAM;QAC1Cd,IAAI,EAAEc,MAAM,CAACK,KAAK;QAClBlB,QAAQ,EAAEa,MAAM,CAACM,SAAS;QAC1BlB,MAAM,EAAEY,MAAM,CAACO;MACjB,CAAC,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"Locales.js","names":["Locale","englishErrors","dutchErrors","BaseCollection","IllegalArgumentException","availableLocales","code","messages","errors","createLocalesWithConfiguredErrors","configuredErrors","_mapInstanceProperty","call","availableLocale","Locales","constructor","locales","arguments","length","undefined","locale","rehydrate","hydatedLocales","_collection","_context","_code","_messages","_errors","hasLocale","localeCode","some","item","_startsWithInstanceProperty","getLocale","_context2","_findInstanceProperty","availableLocaleCodes","_context3","getPreferredLocale","acceptLanguageHeader","_context4","acceptLanguages","match","preferredLocales","_filterInstanceProperty","_context5","update","add"],"sources":["../../src/i18n/Locales.js"],"sourcesContent":["// @flow\nimport Locale from \"./Locale\";\n\nimport englishErrors from \"./translations/beinformed_error_messages_en.nl\";\nimport dutchErrors from \"./translations/beinformed_error_messages_nl.nl\";\n\nimport BaseCollection from \"../models/base/BaseCollection\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport type { LocaleConfiguration } from \"./types\";\n\ntype ErrorMessageObject = {\n [languageCode: string]: {\n [messageID: string]: string,\n },\n};\n\ntype HydratedLocales = {\n _collection: Array<{\n _code: string,\n _messages: {\n [string]: string,\n },\n _errors: {\n [string]: string,\n },\n }>,\n};\n\n/**\n * Array of available locales\n * Order of locales is the preferred order of locales.\n * When user has an accept language header that does not correspond to the locales array,\n * the first one is used as the preferred language\n */\nexport const availableLocales: Array<LocaleConfiguration> = [\n {\n code: \"en\",\n messages: {},\n errors: englishErrors,\n },\n {\n code: \"nl\",\n messages: {},\n errors: dutchErrors,\n },\n];\n\n/**\n * Merge an object with custom error messages (exported and translated from be informed for example) and merge them with the existing translations.\n */\nexport const createLocalesWithConfiguredErrors = (\n configuredErrors: ErrorMessageObject\n): Array<Object> =>\n availableLocales.map((availableLocale) => {\n if (configuredErrors[availableLocale.code]) {\n return {\n ...availableLocale,\n errors: {\n ...availableLocale.errors,\n ...configuredErrors[availableLocale.code],\n },\n };\n }\n\n return availableLocale;\n });\n\n/**\n * Locales, collection of Locale\n */\nclass Locales extends BaseCollection<Locale> {\n constructor(locales: Array<LocaleConfiguration> = availableLocales) {\n super(locales.map((locale) => new Locale(locale)));\n }\n\n /**\n * rehydrate\n */\n static rehydrate(hydatedLocales: HydratedLocales): Locales {\n if (hydatedLocales && hydatedLocales._collection) {\n return new Locales(\n hydatedLocales._collection.map((locale) => ({\n code: locale._code,\n messages: locale._messages,\n errors: locale._errors,\n }))\n );\n }\n\n return new Locales([]);\n }\n\n /**\n * Check if locale with localeCode exists\n */\n hasLocale(localeCode: string): boolean {\n return this.some((item) => localeCode.startsWith(item.code));\n }\n\n /**\n * Retrieve locales by localeCode from Locales collection\n */\n getLocale(localeCode: string): Locale {\n if (this.hasLocale(localeCode)) {\n const locale = this.find((item) => localeCode.startsWith(item.code));\n if (locale) {\n return locale;\n }\n }\n throw new IllegalArgumentException(\n `Locale configuration for locale ${localeCode} not found`\n );\n }\n\n /**\n * Retrieve all available locale codes\n */\n get availableLocaleCodes(): Array<string> {\n return this.map((locale) => locale.code);\n }\n\n /**\n * Retrieve preferred locale based on the accept header of a browser\n */\n getPreferredLocale(acceptLanguageHeader: string | null): void | string {\n if (acceptLanguageHeader != null) {\n const acceptLanguages =\n acceptLanguageHeader.match(/[-A-Za-z]{2,10}/gu) || [];\n\n const preferredLocales = acceptLanguages\n .filter((locale) =>\n this.availableLocaleCodes.some((availableLocale) =>\n locale.startsWith(availableLocale)\n )\n )\n .map((locale) =>\n this.availableLocaleCodes.find((availableLocale) =>\n locale.startsWith(availableLocale)\n )\n );\n\n if (preferredLocales.length > 0) {\n return preferredLocales[0];\n }\n }\n\n return this.availableLocaleCodes[0];\n }\n\n /**\n * Add or change messages and errors for the given locale.<br>\n * It is not possible to remove messages.\n */\n update(locale: string, messages: Object = {}, errors: Object = {}) {\n if (this.hasLocale(locale)) {\n this.getLocale(locale).update(messages, errors);\n } else {\n this.add(\n new Locale({\n code: locale,\n messages,\n errors,\n })\n );\n }\n }\n}\n\nexport default Locales;\n"],"mappings":";;;;AACA,OAAOA,MAAM,MAAM,UAAU;AAE7B,OAAOC,aAAa,MAAM,gDAAgD;AAC1E,OAAOC,WAAW,MAAM,gDAAgD;AAExE,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,SAASC,wBAAwB,QAAQ,eAAe;AAsBxD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAA4C,GAAG,CAC1D;EACEC,IAAI,EAAE,IAAI;EACVC,QAAQ,EAAE,CAAC,CAAC;EACZC,MAAM,EAAEP;AACV,CAAC,EACD;EACEK,IAAI,EAAE,IAAI;EACVC,QAAQ,EAAE,CAAC,CAAC;EACZC,MAAM,EAAEN;AACV,CAAC,CACF;;AAED;AACA;AACA;AACA,OAAO,MAAMO,iCAAiC,GAC5CC,gBAAoC,IAEpCC,oBAAA,CAAAN,gBAAgB,EAAAO,IAAA,CAAhBP,gBAAgB,EAAMQ,eAAe,IAAK;EACxC,IAAIH,gBAAgB,CAACG,eAAe,CAACP,IAAI,CAAC,EAAE;IAC1C,OAAO;MACL,GAAGO,eAAe;MAClBL,MAAM,EAAE;QACN,GAAGK,eAAe,CAACL,MAAM;QACzB,GAAGE,gBAAgB,CAACG,eAAe,CAACP,IAAI;MAC1C;IACF,CAAC;EACH;EAEA,OAAO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