@beinformed/ui 1.63.2 → 1.63.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/esm/constants/Settings.js +3 -14
- package/esm/constants/Settings.js.map +1 -1
- package/esm/exceptions/NotFoundException.js +1 -2
- package/esm/exceptions/NotFoundException.js.map +1 -1
- package/esm/hooks/useI18n.js +1 -6
- package/esm/hooks/useI18n.js.map +1 -1
- package/esm/hooks/useModal.js +3 -4
- package/esm/hooks/useModal.js.map +1 -1
- package/esm/hooks/useModelCatalog.js +10 -30
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/hooks/useModularUI.js +4 -5
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +7 -8
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/i18n/Locale.js +2 -5
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/i18n/Locales.js +2 -5
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/i18n/Message.js +9 -10
- package/esm/i18n/Message.js.map +1 -1
- package/esm/i18n/withMessage.js +1 -6
- package/esm/i18n/withMessage.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +3 -6
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js +1 -4
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +2 -2
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js +4 -14
- package/esm/models/attributes/AttributeCollection.js.map +1 -1
- package/esm/models/attributes/AttributeDataHelper.js +1 -2
- package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
- package/esm/models/attributes/AttributeSetModel.js +1 -5
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/esm/models/attributes/CaptchaAttributeModel.js +2 -2
- package/esm/models/attributes/CaptchaAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -3
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js +3 -9
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -8
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/PasswordAttributeModel.js +2 -2
- package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/esm/models/attributes/UploadAttributeModel.js +2 -2
- package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintCollection.js +1 -2
- package/esm/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintModel.js +1 -2
- package/esm/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -4
- package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -6
- package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -4
- package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
- package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js +2 -2
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/esm/models/base/BaseCollection.js +1 -2
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/BaseModel.js +6 -9
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +1 -2
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +2 -2
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +1 -2
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +1 -3
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationCollection.js +1 -4
- package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js +1 -3
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +1 -4
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +7 -3
- package/esm/models/concepts/SourceReferenceModel.js.flow +6 -0
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +1 -3
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +2 -2
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/contentconfiguration/ContentConfigurationElements.js +1 -2
- package/esm/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/esm/models/error/ErrorModel.js +1 -3
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js +1 -4
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/form/FormModel.js +3 -9
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +2 -4
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/href/Href.js +3 -6
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/href/ListHref.js +1 -2
- package/esm/models/href/ListHref.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js +3 -10
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/links/LinkCollection.js +6 -15
- package/esm/models/links/LinkCollection.js.map +1 -1
- package/esm/models/list/ListModel.js +2 -2
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCategoryCollection.js +1 -2
- package/esm/models/modelcatalog/ModelCategoryCollection.js.map +1 -1
- package/esm/models/parameter/Parameter.js +2 -4
- package/esm/models/parameter/Parameter.js.map +1 -1
- package/esm/models/resolveModel.js +1 -2
- package/esm/models/resolveModel.js.map +1 -1
- package/esm/models/sorting/SortingModel.js +1 -2
- package/esm/models/sorting/SortingModel.js.map +1 -1
- package/esm/models/user/UserServicesModel.js +2 -2
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +4 -6
- package/esm/modularui/Authenticate.js.flow +6 -6
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +1 -2
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/react/ErrorBoundary.js +2 -2
- package/esm/react/ErrorBoundary.js.map +1 -1
- package/esm/react/ErrorBoundaryFallback.js +13 -16
- package/esm/react/ErrorBoundaryFallback.js.map +1 -1
- package/esm/react/utils.js +1 -3
- package/esm/react/utils.js.map +1 -1
- package/esm/react-client/Init.js +20 -23
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js +9 -13
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +9 -10
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/renderSSRMinimal.js +7 -8
- package/esm/react-server/renderSSRMinimal.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +11 -12
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/react-server/serverSSR.js +11 -12
- package/esm/react-server/serverSSR.js.map +1 -1
- package/esm/react-server/serverUtil.js +1 -3
- package/esm/react-server/serverUtil.js.map +1 -1
- package/esm/react-theme/ThemeProvider.js +7 -11
- package/esm/react-theme/ThemeProvider.js.map +1 -1
- package/esm/react-theme/createTheme.js +3 -10
- package/esm/react-theme/createTheme.js.map +1 -1
- package/esm/react-theme/utils/background.js +3 -4
- package/esm/react-theme/utils/background.js.map +1 -1
- package/esm/react-theme/utils/colors.js +7 -16
- package/esm/react-theme/utils/colors.js.map +1 -1
- package/esm/react-theme/utils/contrast.js +11 -19
- package/esm/react-theme/utils/contrast.js.map +1 -1
- package/esm/react-theme/utils/corners.js +10 -16
- package/esm/react-theme/utils/corners.js.map +1 -1
- package/esm/react-theme/utils/spacers.js +15 -38
- package/esm/react-theme/utils/spacers.js.map +1 -1
- package/esm/react-theme/utils/themeProps.js +7 -22
- package/esm/react-theme/utils/themeProps.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js +5 -8
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +19 -23
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +4 -5
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +14 -19
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUIUtils.js +1 -2
- package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js +1 -2
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/_router/RouterReducer.js +1 -3
- package/esm/redux/_router/RouterReducer.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js +34 -37
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAutosubmit.js +1 -2
- package/esm/redux/actions/FormAutosubmit.js.map +1 -1
- package/esm/redux/actions/Preferences.js +8 -15
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/connectors/CaseView.js +3 -6
- package/esm/redux/connectors/CaseView.js.map +1 -1
- package/esm/redux/connectors/ConceptDetail.js +4 -7
- package/esm/redux/connectors/ConceptDetail.js.map +1 -1
- package/esm/redux/connectors/ContentBrowser.js +3 -6
- package/esm/redux/connectors/ContentBrowser.js.map +1 -1
- package/esm/redux/connectors/ContentDetail.js +4 -7
- package/esm/redux/connectors/ContentDetail.js.map +1 -1
- package/esm/redux/connectors/ContentDetailSection.js +5 -8
- package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
- package/esm/redux/connectors/Form.js +4 -5
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js +5 -8
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/connectors/ListDetail.js +3 -6
- package/esm/redux/connectors/ListDetail.js.map +1 -1
- package/esm/redux/connectors/ModelCatalog.js +3 -6
- package/esm/redux/connectors/ModelCatalog.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +5 -6
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/redux/connectors/QuickSearch.js +3 -6
- package/esm/redux/connectors/QuickSearch.js.map +1 -1
- package/esm/redux/connectors/Tab.js +3 -6
- package/esm/redux/connectors/Tab.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js +1 -3
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/redux/reducers/ErrorReducer.js +1 -3
- package/esm/redux/reducers/ErrorReducer.js.map +1 -1
- package/esm/redux/reducers/ModalsReducer.js +1 -3
- package/esm/redux/reducers/ModalsReducer.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +1 -3
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/esm/redux/reducers/NotificationReducer.js +1 -3
- package/esm/redux/reducers/NotificationReducer.js.map +1 -1
- package/esm/redux/reducers/PreferencesReducer.js +1 -3
- package/esm/redux/reducers/PreferencesReducer.js.map +1 -1
- package/esm/redux/reducers/ProgressIndicatorReducer.js +1 -3
- package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/esm/redux/store/beforeRenderHooks.js +1 -3
- package/esm/redux/store/beforeRenderHooks.js.map +1 -1
- package/esm/utils/browser/Cache.js +1 -5
- package/esm/utils/browser/Cache.js.map +1 -1
- package/esm/utils/datetime/DateTimeUtil.js +45 -91
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/esm/utils/fetch/xhr.js +1 -2
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/repositoryResource.js +1 -3
- package/esm/utils/helpers/repositoryResource.js.map +1 -1
- package/esm/utils/helpers/sanitizeHtml.js +3 -4
- package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
- package/esm/utils/number/DecimalFormat.js +1 -2
- package/esm/utils/number/DecimalFormat.js.map +1 -1
- package/esm/utils/number/formatValue.js +1 -4
- package/esm/utils/number/formatValue.js.map +1 -1
- package/esm/utils/number/parseNumbers.js +2 -6
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/constants/Settings.js +3 -14
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/NotFoundException.js +1 -2
- package/lib/exceptions/NotFoundException.js.map +1 -1
- package/lib/hooks/useI18n.js +1 -6
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js +3 -4
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js +10 -30
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModularUI.js +4 -5
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +7 -8
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/i18n/Locale.js +2 -5
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js +2 -5
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js +9 -10
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/withMessage.js +1 -6
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +3 -6
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js +1 -4
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +2 -2
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js +4 -14
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js +1 -2
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js +1 -5
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/CaptchaAttributeModel.js +2 -2
- package/lib/models/attributes/CaptchaAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -3
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js +3 -9
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -8
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/PasswordAttributeModel.js +2 -2
- package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/lib/models/attributes/UploadAttributeModel.js +2 -2
- package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js +1 -2
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js +1 -2
- package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -4
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -6
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -4
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js +2 -2
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/lib/models/base/BaseCollection.js +1 -2
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js +6 -9
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +1 -2
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +2 -2
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +1 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +1 -3
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationCollection.js +1 -4
- package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js +1 -3
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +1 -4
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +7 -3
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +1 -3
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +2 -2
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationElements.js +1 -2
- package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/lib/models/error/ErrorModel.js +1 -3
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js +1 -4
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/form/FormModel.js +3 -9
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +2 -4
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/href/Href.js +3 -6
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/ListHref.js +1 -2
- package/lib/models/href/ListHref.js.map +1 -1
- package/lib/models/layouthint/LayoutHintCollection.js +3 -10
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js +6 -15
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/list/ListModel.js +2 -2
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCategoryCollection.js +1 -2
- package/lib/models/modelcatalog/ModelCategoryCollection.js.map +1 -1
- package/lib/models/parameter/Parameter.js +2 -4
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/resolveModel.js +1 -2
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js +1 -2
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +2 -2
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +4 -6
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +1 -2
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/react/ErrorBoundary.js +2 -2
- package/lib/react/ErrorBoundary.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js +13 -16
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react/utils.js +1 -3
- package/lib/react/utils.js.map +1 -1
- package/lib/react-client/Init.js +20 -23
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js +9 -13
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js +9 -10
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js +7 -8
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +11 -12
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js +11 -12
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js +1 -3
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js +7 -11
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js +3 -10
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/utils/background.js +3 -4
- package/lib/react-theme/utils/background.js.map +1 -1
- package/lib/react-theme/utils/colors.js +7 -16
- package/lib/react-theme/utils/colors.js.map +1 -1
- package/lib/react-theme/utils/contrast.js +11 -19
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js +10 -16
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js +15 -38
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js +7 -22
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js +5 -8
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +19 -23
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +4 -5
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +14 -19
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUIUtils.js +1 -2
- package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js +1 -2
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/RouterReducer.js +1 -3
- package/lib/redux/_router/RouterReducer.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js +34 -37
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js +1 -2
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/Preferences.js +8 -15
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/connectors/CaseView.js +3 -6
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js +4 -7
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js +3 -6
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js +4 -7
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js +5 -8
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js +4 -5
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js +5 -8
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js +3 -6
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js +3 -6
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +5 -6
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js +3 -6
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/Tab.js +3 -6
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +1 -3
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/ErrorReducer.js +1 -3
- package/lib/redux/reducers/ErrorReducer.js.map +1 -1
- package/lib/redux/reducers/ModalsReducer.js +1 -3
- package/lib/redux/reducers/ModalsReducer.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +1 -3
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/lib/redux/reducers/NotificationReducer.js +1 -3
- package/lib/redux/reducers/NotificationReducer.js.map +1 -1
- package/lib/redux/reducers/PreferencesReducer.js +1 -3
- package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js +1 -3
- package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/lib/redux/store/beforeRenderHooks.js +1 -3
- package/lib/redux/store/beforeRenderHooks.js.map +1 -1
- package/lib/utils/browser/Cache.js +1 -5
- package/lib/utils/browser/Cache.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js +45 -91
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/xhr.js +1 -2
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/repositoryResource.js +1 -3
- package/lib/utils/helpers/repositoryResource.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js +3 -4
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/number/DecimalFormat.js +1 -2
- package/lib/utils/number/DecimalFormat.js.map +1 -1
- package/lib/utils/number/formatValue.js +1 -4
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js +2 -6
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +23 -23
- package/src/models/concepts/SourceReferenceModel.js +6 -0
- package/src/modularui/Authenticate.js +6 -6
|
@@ -6,10 +6,7 @@ import IllegalStateException from "../../exceptions/IllegalStateException";
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*/
|
|
9
|
-
const getSize =
|
|
10
|
-
let ratio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
11
|
-
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "SPACER";
|
|
12
|
-
let unit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "rem";
|
|
9
|
+
const getSize = (theme, ratio = 1, path = "SPACER", unit = "rem") => {
|
|
13
10
|
if (typeof ratio === "string") {
|
|
14
11
|
return ratio;
|
|
15
12
|
}
|
|
@@ -28,17 +25,11 @@ const getSize = function (theme) {
|
|
|
28
25
|
*/
|
|
29
26
|
/**
|
|
30
27
|
*/
|
|
31
|
-
const spacer =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
settings: {}
|
|
37
|
-
}
|
|
38
|
-
} = _ref;
|
|
39
|
-
return getSize(theme, ratio);
|
|
40
|
-
};
|
|
41
|
-
};
|
|
28
|
+
const spacer = (ratio = 1) => ({
|
|
29
|
+
theme = {
|
|
30
|
+
settings: {}
|
|
31
|
+
}
|
|
32
|
+
}) => getSize(theme, ratio);
|
|
42
33
|
|
|
43
34
|
/*
|
|
44
35
|
* Render spacers based on the given ratio * theme SPACER
|
|
@@ -47,35 +38,21 @@ const spacer = function () {
|
|
|
47
38
|
*/
|
|
48
39
|
/**
|
|
49
40
|
*/
|
|
50
|
-
const spacers =
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
const spacers = (...ratios) => ({
|
|
42
|
+
theme = {
|
|
43
|
+
settings: {}
|
|
53
44
|
}
|
|
54
|
-
|
|
55
|
-
let {
|
|
56
|
-
theme = {
|
|
57
|
-
settings: {}
|
|
58
|
-
}
|
|
59
|
-
} = _ref2;
|
|
60
|
-
return _mapInstanceProperty(ratios).call(ratios, ratio => getSize(theme, ratio)).join(" ");
|
|
61
|
-
};
|
|
62
|
-
};
|
|
45
|
+
}) => _mapInstanceProperty(ratios).call(ratios, ratio => getSize(theme, ratio)).join(" ");
|
|
63
46
|
|
|
64
47
|
/*
|
|
65
48
|
* Render a gutter based on GUTTER property
|
|
66
49
|
*/
|
|
67
50
|
/**
|
|
68
51
|
*/
|
|
69
|
-
const gutter =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
settings: {}
|
|
75
|
-
}
|
|
76
|
-
} = _ref3;
|
|
77
|
-
return getSize(theme, ratio, "GRID_GUTTER", "px");
|
|
78
|
-
};
|
|
79
|
-
};
|
|
52
|
+
const gutter = (ratio = 1) => ({
|
|
53
|
+
theme = {
|
|
54
|
+
settings: {}
|
|
55
|
+
}
|
|
56
|
+
}) => getSize(theme, ratio, "GRID_GUTTER", "px");
|
|
80
57
|
export { spacer, spacers, gutter };
|
|
81
58
|
//# sourceMappingURL=spacers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacers.js","names":["Big","IllegalArgumentException","IllegalStateException","getSize","theme","ratio","
|
|
1
|
+
{"version":3,"file":"spacers.js","names":["Big","IllegalArgumentException","IllegalStateException","getSize","theme","ratio","path","unit","size","times","_JSON$stringify","spacer","settings","spacers","ratios","_mapInstanceProperty","call","join","gutter"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\",\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`,\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio, \"GRID_GUTTER\", \"px\");\n\nexport { spacer, spacers, gutter };\n"],"mappings":";;AACA,OAAOA,GAAG,MAAM,QAAQ;AAGxB,OAAOC,wBAAwB,MAAM,2CAA2C;AAChF,OAAOC,qBAAqB,MAAM,wCAAwC;;AAE1E;AACA;AACA,MAAMC,OAAO,GAAGA,CACdC,KAAY,EACZC,KAAsB,GAAG,CAAC,EAC1BC,IAAY,GAAG,QAAQ,EACvBC,IAAY,GAAG,KAAK,KACjB;EACH,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAI,OAAOD,KAAK,CAACE,IAAI,CAAC,KAAK,QAAQ,EAAE;MACnC,MAAME,IAAI,GAAGR,GAAG,CAACK,KAAK,CAAC,CAACI,KAAK,CAACL,KAAK,CAACE,IAAI,CAAC,CAAC;MAC1C,OAAO,GAAGE,IAAI,GAAGD,IAAI,EAAE;IACzB;IACA,MAAM,IAAIL,qBAAqB,CAAC,QAAQI,IAAI,mBAAmB,CAAC;EAClE;EAEA,MAAM,IAAIL,wBAAwB,CAChC,SAASS,eAAA,CAAeL,KAAK,CAAC,6BAChC,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMM,MAAM,GACVA,CAACN,KAAa,GAAG,CAAC,KAClB,CAAC;EAAED,KAAK,GAAG;IAAEQ,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAC3CT,OAAO,CAACC,KAAK,EAAEC,KAAK,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMQ,OAAO,GACXA,CAAC,GAAGC,MAA8B,KAClC,CAAC;EAAEV,KAAK,GAAG;IAAEQ,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAC3CG,oBAAA,CAAAD,MAAM,EAAAE,IAAA,CAANF,MAAM,EAAMT,KAAK,IAAKF,OAAO,CAACC,KAAK,EAAEC,KAAK,CAAC,CAAC,CAACY,IAAI,CAAC,GAAG,CAAC;;AAE1D;AACA;AACA;AACA;AACA;AACA,MAAMC,MAAM,GACVA,CAACb,KAAa,GAAG,CAAC,KAClB,CAAC;EAAED,KAAK,GAAG;IAAEQ,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAC3CT,OAAO,CAACC,KAAK,EAAEC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC;AAE9C,SAASM,MAAM,EAAEE,OAAO,EAAEK,MAAM","ignoreList":[]}
|
|
@@ -2,19 +2,13 @@ import { get } from "../../utils/helpers/objects";
|
|
|
2
2
|
import { ThemePropertyException } from "../../exceptions";
|
|
3
3
|
/**
|
|
4
4
|
*/
|
|
5
|
-
export const getProp =
|
|
6
|
-
let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
8
|
-
let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
5
|
+
export const getProp = (theme = {}, path = "", defaultValue = "") => {
|
|
9
6
|
return path === "" ? defaultValue : get(theme, path, defaultValue);
|
|
10
7
|
};
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*/
|
|
14
|
-
export const getThemeProp =
|
|
15
|
-
let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
-
let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
17
|
-
let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
11
|
+
export const getThemeProp = (theme = {}, path = "", defaultValue = "") => {
|
|
18
12
|
const value = getProp(theme, path, defaultValue);
|
|
19
13
|
if (value != null && (typeof value === "string" || typeof value === "number" || typeof value === "object")) {
|
|
20
14
|
return value;
|
|
@@ -24,10 +18,7 @@ export const getThemeProp = function () {
|
|
|
24
18
|
|
|
25
19
|
/**
|
|
26
20
|
*/
|
|
27
|
-
export const getThemeStringProp =
|
|
28
|
-
let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
|
-
let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
30
|
-
let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
21
|
+
export const getThemeStringProp = (theme = {}, path = "", defaultValue = "") => {
|
|
31
22
|
const value = getProp(theme, path, defaultValue);
|
|
32
23
|
if (typeof value === "string") {
|
|
33
24
|
return value;
|
|
@@ -39,10 +30,7 @@ export const getThemeStringProp = function () {
|
|
|
39
30
|
|
|
40
31
|
/**
|
|
41
32
|
*/
|
|
42
|
-
export const getThemeNumberProp =
|
|
43
|
-
let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
44
|
-
let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
45
|
-
let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
33
|
+
export const getThemeNumberProp = (theme = {}, path = "", defaultValue = 0) => {
|
|
46
34
|
const value = getProp(theme, path, defaultValue);
|
|
47
35
|
if (typeof value === "number") {
|
|
48
36
|
return value;
|
|
@@ -55,10 +43,7 @@ export const getThemeNumberProp = function () {
|
|
|
55
43
|
*/
|
|
56
44
|
/**
|
|
57
45
|
*/
|
|
58
|
-
export const themeProp = (path, defaultValue) =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} = _ref;
|
|
62
|
-
return getThemeProp(theme, path, defaultValue);
|
|
63
|
-
};
|
|
46
|
+
export const themeProp = (path, defaultValue) => ({
|
|
47
|
+
theme
|
|
48
|
+
}) => getThemeProp(theme, path, defaultValue);
|
|
64
49
|
//# sourceMappingURL=themeProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeProps.js","names":["get","ThemePropertyException","getProp","theme","
|
|
1
|
+
{"version":3,"file":"themeProps.js","names":["get","ThemePropertyException","getProp","theme","path","defaultValue","getThemeProp","value","getThemeStringProp","toString","getThemeNumberProp","themeProp"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\",\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\",\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`,\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\",\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`,\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0,\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`,\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue,\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":"AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,SAASC,sBAAsB,QAAQ,kBAAkB;AAIzD;AACA;AACA,OAAO,MAAMC,OAAO,GAAGA,CACrBC,KAAoB,GAAG,CAAC,CAAC,EACzBC,IAAY,GAAG,EAAE,EACjBC,YAA4B,GAAG,EAAE,KACb;EACpB,OAAOD,IAAI,KAAK,EAAE,GAAGC,YAAY,GAAGL,GAAG,CAACG,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC;AACpE,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,YAAY,GAAGA,CAC1BH,KAAoB,GAAG,CAAC,CAAC,EACzBC,IAAY,GAAG,EAAE,EACjBC,YAA4B,GAAG,EAAE,KACd;EACnB,MAAME,KAAK,GAAGL,OAAO,CAACC,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC;EAEhD,IACEE,KAAK,IAAI,IAAI,KACZ,OAAOA,KAAK,KAAK,QAAQ,IACxB,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,QAAQ,CAAC,EAC5B;IACA,OAAOA,KAAK;EACd;EAEA,MAAM,IAAIN,sBAAsB,CAC9B,GAAGG,IAAI,kDAAkD,OAAOG,KAAK,EACvE,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAChCL,KAAoB,GAAG,CAAC,CAAC,EACzBC,IAAY,GAAG,EAAE,EACjBC,YAAoB,GAAG,EAAE,KACd;EACX,MAAME,KAAK,GAAGL,OAAO,CAACC,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC;EAEhD,IAAI,OAAOE,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd,CAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACpC,OAAOA,KAAK,CAACE,QAAQ,CAAC,CAAC;EACzB;EAEA,MAAM,IAAIR,sBAAsB,CAC9B,GAAGG,IAAI,0BAA0B,OAAOG,KAAK,EAC/C,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMG,kBAAkB,GAAGA,CAChCP,KAAoB,GAAG,CAAC,CAAC,EACzBC,IAAY,GAAG,EAAE,EACjBC,YAAoB,GAAG,CAAC,KACb;EACX,MAAME,KAAK,GAAGL,OAAO,CAACC,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC;EAEhD,IAAI,OAAOE,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,MAAM,IAAIN,sBAAsB,CAC9B,GAAGG,IAAI,0BAA0B,OAAOG,KAAK,EAC/C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,SAAS,GACpBA,CACEP,IAAY,EACZC,YAA6B,KAE/B,CAAC;EAAEF;AAAwB,CAAC,KAC1BG,YAAY,CAACH,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC","ignoreList":[]}
|
|
@@ -21,11 +21,10 @@ const updateLocale = (state, locale) => {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
*/
|
|
24
|
-
const setLocales = (state,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
24
|
+
const setLocales = (state, {
|
|
25
|
+
locale,
|
|
26
|
+
locales
|
|
27
|
+
}) => {
|
|
29
28
|
// set locale in cookie
|
|
30
29
|
if (state.locales.length > 1) {
|
|
31
30
|
setCookie("locale", locale);
|
|
@@ -60,9 +59,7 @@ const initialState = {
|
|
|
60
59
|
/**
|
|
61
60
|
* Form reducer
|
|
62
61
|
*/
|
|
63
|
-
export const I18nReducer =
|
|
64
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
65
|
-
let action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0;
|
|
62
|
+
export const I18nReducer = (state = initialState, action = void 0) => {
|
|
66
63
|
if (!action) {
|
|
67
64
|
return state;
|
|
68
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nReducer.js","names":["Cache","setCookie","clearCookie","Locales","updateLocale","state","locale","locales","length","clear","setLocales","
|
|
1
|
+
{"version":3,"file":"I18nReducer.js","names":["Cache","setCookie","clearCookie","Locales","updateLocale","state","locale","locales","length","clear","setLocales","getDefaultLocale","navigator","language","split","initialState","I18nReducer","action","type","payload"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie, clearCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n if (state.locales?.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales },\n) => {\n // set locale in cookie\n if (state.locales.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\nconst getDefaultLocale = () => {\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator?.language.split(\"-\")[0] || \"en\";\n }\n return \"en\";\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: getDefaultLocale(),\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,2BAA2B;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,6BAA6B;AAEpE,OAAOC,OAAO,MAAM,oBAAoB;AAMxC;AACA;AACA,MAAMC,YAAY,GAAGA,CAACC,KAAgB,EAAEC,MAAc,KAAK;EACzD;EACA,IAAID,KAAK,CAACE,OAAO,EAAEC,MAAM,GAAG,CAAC,EAAE;IAC7BP,SAAS,CAAC,QAAQ,EAAEK,MAAM,CAAC;EAC7B,CAAC,MAAM;IACLJ,WAAW,CAAC,QAAQ,CAAC;EACvB;;EAEA;EACAF,KAAK,CAACS,KAAK,CAAC,CAAC;EAEb,OAAO;IACL,GAAGJ,KAAK;IACRC;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMI,UAAU,GAAGA,CACjBL,KAAgB,EAChB;EAAEC,MAAM;EAAEC;AAA8C,CAAC,KACtD;EACH;EACA,IAAIF,KAAK,CAACE,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;IAC5BP,SAAS,CAAC,QAAQ,EAAEK,MAAM,CAAC;EAC7B,CAAC,MAAM;IACLJ,WAAW,CAAC,QAAQ,CAAC;EACvB;EAEA,IAAII,MAAM,EAAE;IACV,OAAO;MACL,GAAGD,KAAK;MACRE,OAAO;MACPD;IACF,CAAC;EACH;EAEA,OAAO;IACL,GAAGD,KAAK;IACRE;EACF,CAAC;AACH,CAAC;AAED,MAAMI,gBAAgB,GAAGA,CAAA,KAAM;EAC7B,IAAI,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,EAAEC,QAAQ,EAAE;IAC3D,OAAOD,SAAS,EAAEC,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI;EAClD;EACA,OAAO,IAAI;AACb,CAAC;;AAED;AACA,MAAMC,YAAuB,GAAG;EAC9BR,OAAO,EAAE,IAAIJ,OAAO,CAAC,CAAC;EACtBG,MAAM,EAAEK,gBAAgB,CAAC;AAC3B,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,WAA4C,GAAGA,CAC1DX,KAAK,GAAGU,YAAY,EACpBE,MAAM,GAAG,KAAK,CAAC,KACZ;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOZ,KAAK;EACd;EAEA,QAAQY,MAAM,CAACC,IAAI;IACjB,KAAK,aAAa;MAChB,OAAOR,UAAU,CAACL,KAAK,EAAEY,MAAM,CAACE,OAAO,CAAC;IAE1C,KAAK,eAAe;MAClB,OAAOf,YAAY,CAACC,KAAK,EAAEY,MAAM,CAACE,OAAO,CAAC;IAE5C;MACE,OAAOd,KAAK;EAChB;AACF,CAAC","ignoreList":[]}
|
|
@@ -133,30 +133,26 @@ export const loadModel = (key, href, options) => ({
|
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
*/
|
|
136
|
-
export const loadModularUI =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
resolve(dispatch(loadModularUI(key, href, options, retryCount - 1, retryDelay)));
|
|
149
|
-
}, retryDelay);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Same request is already loading — do nothing
|
|
154
|
-
return _Promise.resolve();
|
|
136
|
+
export const loadModularUI = (key, href, options, retryCount = 3, retryDelay = 200) => (dispatch, getState) => {
|
|
137
|
+
const modularuiStore = getState()?.modularui;
|
|
138
|
+
const currentRequest = modularuiStore?.[key];
|
|
139
|
+
const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;
|
|
140
|
+
if (isLoading) {
|
|
141
|
+
const isDifferentRequest = currentRequest.requestOptions?.href?.toString() !== href.toString();
|
|
142
|
+
if (isDifferentRequest && retryCount > 0) {
|
|
143
|
+
return new _Promise(resolve => {
|
|
144
|
+
setTimeout(() => {
|
|
145
|
+
resolve(dispatch(loadModularUI(key, href, options, retryCount - 1, retryDelay)));
|
|
146
|
+
}, retryDelay);
|
|
147
|
+
});
|
|
155
148
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return _Promise.resolve(
|
|
159
|
-
}
|
|
149
|
+
|
|
150
|
+
// Same request is already loading — do nothing
|
|
151
|
+
return _Promise.resolve();
|
|
152
|
+
}
|
|
153
|
+
dispatch(startProgress());
|
|
154
|
+
const loadModelPromise = dispatch(loadModel(key, href, options));
|
|
155
|
+
return _Promise.resolve(loadModelPromise).then(() => dispatch(finishProgress())).catch(error => dispatch(handleError(error)));
|
|
160
156
|
};
|
|
161
157
|
|
|
162
158
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIActions.js","names":["HTTP_METHODS","MODULARUI_STATUS","Href","ErrorResponse","finishProgress","startProgress","handleError","setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","method","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","retryCount","arguments","length","undefined","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_Promise","resolve","setTimeout","loadModelPromise","then","catch","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";AACA,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,2BAA2B;AAC1E,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAmB9C;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMI,UAAU,GACrBC,MAAqD,KAChC;EACrBH,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEE;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,WAAW,GAAIN,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMO,UAAU,GAAIP,KAAqB,KAAwB;EACtEE,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF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S,CAACrB,GAAG,EAAEsB,IAAI,EAAEC,OAAO,CAAC,CAAC;IAEhE,OAAOwC,QAAA,CAAQC,OAAO,CAACE,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMb,QAAQ,CAAC1D,cAAc,CAAC,CAAC,CAAC,CAAC,CACtCwE,KAAK,CAAEzB,KAAK,IAAKW,QAAQ,CAACxD,WAAW,CAAC6C,KAAK,CAAC,CAAC,CAAC;EACnD,CAAC;AAAA;;AAEH;AACA;AACA,OAAO,MAAM0B,WAAW,GAAGA,CACzBpE,KAAqB,EACrBsB,OAAiC,KAEjCyB,aAAa,CAAC/C,KAAK,CAACC,UAAU,EAAED,KAAK,CAACqE,QAAQ,EAAE;EAC9C,GAAG/C,OAAO;EACVgB,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ModularUIActions.js","names":["HTTP_METHODS","MODULARUI_STATUS","Href","ErrorResponse","finishProgress","startProgress","handleError","setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","method","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","retryCount","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_Promise","resolve","setTimeout","loadModelPromise","then","catch","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";AACA,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,2BAA2B;AAC1E,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAmB9C;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMI,UAAU,GACrBC,MAAqD,KAChC;EACrBH,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEE;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,WAAW,GAAIN,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMO,UAAU,GAAIP,KAAqB,KAAwB;EACtEE,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMQ,gBAAgB,GAAIT,GAAW,KAA8B;EACxEG,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAEJ;AACX,CAAC,CAAC;;AAEF;AACA;A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AACA;AACA,OAAO,MAAMuB,WAAW,GAAGA,CACzBjE,KAAqB,EACrBsB,OAAiC,KAEjCyB,aAAa,CAAC/C,KAAK,CAACC,UAAU,EAAED,KAAK,CAACkE,QAAQ,EAAE;EAC9C,GAAG5C,OAAO;EACVgB,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -29,11 +29,10 @@ const patchUpdateModelOption = oldOptions => {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
*/
|
|
32
|
-
const modularUIConnector =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
32
|
+
const modularUIConnector = (name, resource, options = {
|
|
33
|
+
propName: "data",
|
|
34
|
+
removeOnUnmount: false
|
|
35
|
+
}) => {
|
|
37
36
|
const {
|
|
38
37
|
propName = "data",
|
|
39
38
|
removeOnUnmount = false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIConnector.js","names":["useEffect","useDispatch","useLocation","loadModularUI","reloadModel","removeModelByKey","Href","getDisplayName","useUrl","useReload","useModularUI","useLocale","FormModel","jsx","_jsx","patchUpdateModelOption","oldOptions","updateModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","
|
|
1
|
+
{"version":3,"file":"ModularUIConnector.js","names":["useEffect","useDispatch","useLocation","loadModularUI","reloadModel","removeModelByKey","Href","getDisplayName","useUrl","useReload","useModularUI","useLocale","FormModel","jsx","_jsx","patchUpdateModelOption","oldOptions","updateModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","location","url","displayName","contextId","modelEntry","modelKey","model","connectKey","handleManualReload","reloadOptions","handleFetch","href","fetchOptions","reload","state","doReload","isReload","locale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n // explicit property for removeOnMount overwrite the setting\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (finalRemoveOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey, finalRemoveOnUnmount]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry?.model ?? null,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,SACEC,aAAa,EACbC,WAAW,EACXC,gBAAgB,QACX,oBAAoB;AAE3B,OAAOC,IAAI,MAAM,wBAAwB;AACzC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ACN,QAAQ,EAAEM,QAAQ,EAAEP,oBAAoB,CAAC,CAAC;;MAE9C;MACA,MAAMmB,MAAM,GAAGzC,SAAS,CAAC,CAAC;MAC1B,MAAM0C,QAAuB,GAAG;QAC9Bb,QAAQ;QACR,CAACb,QAAQ,GAAGY,UAAU,EAAEE,KAAK,IAAI,IAAI;QACrCN,QAAQ;QACRmB,MAAM,EAAEf,UAAU,EAAEe,MAAM,IAAI,IAAI;QAClCC,gBAAgB,EAAEhB,UAAU,EAAEgB,gBAAgB,IAAI,IAAI;QACtDC,QAAQ,EAAEC,OAAO,CAAClB,UAAU,CAAC;QAC7Ba,MAAM;QACNM,cAAc,EAAEb,WAAW;QAC3BzC,WAAW,EAAEuC;MACf,CAAC;MAED,oBAAO7B,IAAA,CAACgB,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMqB;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDtB,gBAAgB,CAACM,WAAW,GAAG,gBAAgB9B,cAAc,CAC3DwB,gBAAgB,EAChBP,IACF,CAAC,EAAE;IAEH,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAED,eAAeR,kBAAkB","ignoreList":[]}
|
|
@@ -5,12 +5,11 @@ import { MODULARUI_STATUS } from "../../constants/Constants";
|
|
|
5
5
|
import { ApplicationModel } from "../../models";
|
|
6
6
|
/**
|
|
7
7
|
*/
|
|
8
|
-
const updateStatus = (state,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
8
|
+
const updateStatus = (state, {
|
|
9
|
+
key,
|
|
10
|
+
status,
|
|
11
|
+
requestOptions
|
|
12
|
+
}) => {
|
|
14
13
|
// model should always be available when status is not loading
|
|
15
14
|
if (status !== MODULARUI_STATUS.LOADING && !state[key]) {
|
|
16
15
|
return state;
|
|
@@ -28,11 +27,10 @@ const updateStatus = (state, _ref) => {
|
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
*/
|
|
31
|
-
const setModel = (state,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref2;
|
|
30
|
+
const setModel = (state, {
|
|
31
|
+
key,
|
|
32
|
+
model
|
|
33
|
+
}) => {
|
|
36
34
|
if (!state[key]) {
|
|
37
35
|
return state;
|
|
38
36
|
}
|
|
@@ -57,11 +55,10 @@ const setModel = (state, _ref2) => {
|
|
|
57
55
|
*/
|
|
58
56
|
const initModularUI = (state, models) => {
|
|
59
57
|
const newState = _Object$assign({}, state);
|
|
60
|
-
models.forEach(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref3;
|
|
58
|
+
models.forEach(({
|
|
59
|
+
key,
|
|
60
|
+
model
|
|
61
|
+
}) => {
|
|
65
62
|
newState[key] = {
|
|
66
63
|
status: MODULARUI_STATUS.FINISHED,
|
|
67
64
|
lastModification: Date.now(),
|
|
@@ -124,9 +121,7 @@ const initialState = {};
|
|
|
124
121
|
/**
|
|
125
122
|
* Modular UI Reducer
|
|
126
123
|
*/
|
|
127
|
-
export const ModularUIReducer =
|
|
128
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
129
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
124
|
+
export const ModularUIReducer = (state = initialState, action) => {
|
|
130
125
|
if (!action) {
|
|
131
126
|
return state;
|
|
132
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIReducer.js","names":["MODULARUI_STATUS","ApplicationModel","updateStatus","state","
|
|
1
|
+
{"version":3,"file":"ModularUIReducer.js","names":["MODULARUI_STATUS","ApplicationModel","updateStatus","state","key","status","requestOptions","LOADING","lastModification","Date","now","setModel","model","FINISHED","console","debug","initModularUI","models","newState","_Object$assign","forEach","getModelKey","_context","_findInstanceProperty","_Object$keys","call","connectKey","updateModel","modelKey","removeKey","resetModularUI","initialState","ModularUIReducer","action","type","payload"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n {\n key,\n status,\n requestOptions,\n }: {\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n requestOptions: requestOptions || state[key]?.requestOptions,\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n // eslint-disable-next-line no-console\n console.debug(\"No model for setModel\");\n return state;\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n return state;\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;AACA,SAASA,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,gBAAgB,QAAQ,cAAc;AAO/C;AACA;AACA,MAAMC,YAAY,GAAGA,CACnBC,KAAqB,EACrB;EACEC,GAAG;EACHC,MAAM;EACNC;AAKF,CAAC,KACE;EACH;EACA,IAAID,MAAM,KAAKL,gBAAgB,CAACO,OAAO,IAAI,CAACJ,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OAAOD,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACC,GAAG,GAAG;MACL,GAAGD,KAAK,CAACC,GAAG,CAAC;MACbC,MAAM;MACNG,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC5BJ,cAAc,EAAEA,cAAc,IAAIH,KAAK,CAACC,GAAG,CAAC,EAAEE;IAChD;EACF,CAAC;AACH,CAAC;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a,CAACb,KAAK,EAAE8B,MAAM,CAACE,OAAO,CAAC;IAE7C,KAAK,iBAAiB;MACpB,OAAOL,cAAc,CAAC3B,KAAK,CAAC;IAE9B,KAAK,kBAAkB;MACrB,OAAOD,YAAY,CAACC,KAAK,EAAE8B,MAAM,CAACE,OAAO,CAAC;IAE5C,KAAK,eAAe;MAClB,OAAOxB,QAAQ,CAACR,KAAK,EAAE8B,MAAM,CAACE,OAAO,CAAC;IAExC,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC1B,OAAOR,WAAW,CAACxB,KAAK,EAAE8B,MAAM,CAACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAON,SAAS,CAACI,MAAM,CAACE,OAAO,EAAEhC,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAChB;AACF,CAAC","ignoreList":[]}
|
|
@@ -61,8 +61,7 @@ export const getKey = (WrappedComponent, name, url) => {
|
|
|
61
61
|
/**
|
|
62
62
|
* Check if the model corresponding to a modular ui service should be reloaded
|
|
63
63
|
*/
|
|
64
|
-
export const useReload =
|
|
65
|
-
let reload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
64
|
+
export const useReload = (modelEntry, reload = 0) => {
|
|
66
65
|
if (reload > 0) {
|
|
67
66
|
const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;
|
|
68
67
|
const lastModification = modelEntry?.lastModification ?? 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIUtils.js","names":["useState","getDisplayName","MODULARUI_STATUS","Href","getUrl","resource","props","url","useUrl","_context","previousUrl","setPreviousUrl","previousExact","setPreviousExact","match","equalsWithParameters","isExact","Function","call","bind","_startsWithInstanceProperty","getKey","WrappedComponent","name","split","useReload","modelEntry","reload","
|
|
1
|
+
{"version":3,"file":"ModularUIUtils.js","names":["useState","getDisplayName","MODULARUI_STATUS","Href","getUrl","resource","props","url","useUrl","_context","previousUrl","setPreviousUrl","previousExact","setPreviousExact","match","equalsWithParameters","isExact","Function","call","bind","_startsWithInstanceProperty","getKey","WrappedComponent","name","split","useReload","modelEntry","reload","isFullyLoaded","status","FINISHED","lastModification"],"sources":["../../../src/redux/_modularui/ModularUIUtils.js"],"sourcesContent":["// @flow\nimport { useState } from \"react\";\n\nimport { getDisplayName } from \"../../react/utils\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\n\nimport type { ComponentType } from \"react\";\n\n/**\n * Generate modular ui url\n */\nconst getUrl = (resource: string | Function | Href, props: Object): Href => {\n const url = typeof resource === \"function\" ? resource(props) : resource;\n\n if (url instanceof Href) {\n return url;\n }\n\n return new Href(url);\n};\n\n/**\n */\nexport const useUrl = (\n resource: string | Function | Href,\n props: Object,\n): Href => {\n const [previousUrl, setPreviousUrl] = useState(null);\n const [previousExact, setPreviousExact] = useState(false);\n\n const url = getUrl(resource, props);\n\n if (url == null && previousUrl == null) {\n return new Href(\"\");\n }\n\n const { match } = props;\n\n // when match is not available through props,\n // this is a direct call to the modular ui hoc, not using a route\n if (!match) {\n return url;\n }\n\n if (url.equalsWithParameters(previousUrl)) {\n return previousUrl || url;\n }\n\n // Always create an url when the match is exact\n // Or when the match is not exact AND the original match also was not exact\n // Or when the new start uri is different from the previous url --> different resource for same panel\n if (\n match.isExact === true ||\n previousExact === match.isExact ||\n !previousUrl?.startsWith(match.url)\n ) {\n setPreviousUrl(url);\n setPreviousExact(match.isExact);\n\n return url;\n }\n\n return previousUrl || new Href(\"\");\n};\n\n/**\n * Create key for modularui request based on component name and requested url\n */\nexport const getKey = (\n WrappedComponent: ComponentType<any>,\n name: string,\n url: string,\n): string => {\n if (url) {\n return `${getDisplayName(WrappedComponent, name)}(${url.split(\"?\")[0]})`;\n }\n\n return getDisplayName(WrappedComponent, name);\n};\n\n/**\n * Check if the model corresponding to a modular ui service should be reloaded\n */\nexport const useReload = (modelEntry: Object, reload: number = 0): boolean => {\n if (reload > 0) {\n const isFullyLoaded = modelEntry?.status === MODULARUI_STATUS.FINISHED;\n const lastModification = modelEntry?.lastModification ?? 0;\n\n if (isFullyLoaded && lastModification < reload) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":";AACA,SAASA,QAAQ,QAAQ,OAAO;AAEhC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA;AACA,MAAMC,MAAM,GAAGA,CAACC,QAAkC,EAAEC,KAAa,KAAW;EAC1E,MAAMC,GAAG,GAAG,OAAOF,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACC,KAAK,CAAC,GAAGD,QAAQ;EAEvE,IAAIE,GAAG,YAAYJ,IAAI,EAAE;IACvB,OAAOI,GAAG;EACZ;EAEA,OAAO,IAAIJ,IAAI,CAACI,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CACpBH,QAAkC,EAClCC,KAAa,KACJ;EAAA,IAAAG,QAAA;EACT,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGX,QAAQ,CAAC,IAAI,CAAC;EACpD,MAAM,CAACY,aAAa,EAAEC,gBAAgB,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EAEzD,MAAMO,GAAG,GAAGH,MAAM,CAACC,QAAQ,EAAEC,KAAK,CAAC;EAEnC,IAAIC,GAAG,IAAI,IAAI,IAAIG,WAAW,IAAI,IAAI,EAAE;IACtC,OAAO,IAAIP,IAAI,CAAC,EAAE,CAAC;EACrB;EAEA,MAAM;IAAEW;EAAM,CAAC,GAAGR,KAAK;;EAEvB;EACA;EACA,IAAI,CAACQ,KAAK,EAAE;IACV,OAAOP,GAAG;EACZ;EAEA,IAAIA,GAAG,CAACQ,oBAAoB,CAACL,WAAW,CAAC,EAAE;IACzC,OAAOA,WAAW,IAAIH,GAAG;EAC3B;;EAEA;EACA;EACA;EACA,IACEO,KAAK,CAACE,OAAO,KAAK,IAAI,IACtBJ,aAAa,KAAKE,KAAK,CAACE,OAAO,IAC/B,CAAC,EAAAP,QAAA,GAAAC,WAAW,qBAAAO,QAAA,CAAAC,IAAA,CAAAC,IAAA,CAAAC,2BAAA,CAAAX,QAAA,GAAAA,QAAA,KAAaK,KAAK,CAACP,GAAG,CAAC,EACnC;IACAI,cAAc,CAACJ,GAAG,CAAC;IACnBM,gBAAgB,CAACC,KAAK,CAACE,OAAO,CAAC;IAE/B,OAAOT,GAAG;EACZ;EAEA,OAAOG,WAAW,IAAI,IAAIP,IAAI,CAAC,EAAE,CAAC;AACpC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMkB,MAAM,GAAGA,CACpBC,gBAAoC,EACpCC,IAAY,EACZhB,GAAW,KACA;EACX,IAAIA,GAAG,EAAE;IACP,OAAO,GAAGN,cAAc,CAACqB,gBAAgB,EAAEC,IAAI,CAAC,IAAIhB,GAAG,CAACiB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;EAC1E;EAEA,OAAOvB,cAAc,CAACqB,gBAAgB,EAAEC,IAAI,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,SAAS,GAAGA,CAACC,UAAkB,EAAEC,MAAc,GAAG,CAAC,KAAc;EAC5E,IAAIA,MAAM,GAAG,CAAC,EAAE;IACd,MAAMC,aAAa,GAAGF,UAAU,EAAEG,MAAM,KAAK3B,gBAAgB,CAAC4B,QAAQ;IACtE,MAAMC,gBAAgB,GAAGL,UAAU,EAAEK,gBAAgB,IAAI,CAAC;IAE1D,IAAIH,aAAa,IAAIG,gBAAgB,GAAGJ,MAAM,EAAE;MAC9C,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC","ignoreList":[]}
|
|
@@ -5,8 +5,7 @@ import { startProgress, finishProgress } from "../actions/ProgressIndicator";
|
|
|
5
5
|
import { handleError } from "../actions/Error";
|
|
6
6
|
import { getLocale } from "../selectors/i18n";
|
|
7
7
|
import { reloadModel } from "./ModularUIActions";
|
|
8
|
-
const modularui = createSelector([getLocale], localeCode =>
|
|
9
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8
|
+
const modularui = createSelector([getLocale], localeCode => (href, options = {}) => {
|
|
10
9
|
const modularuiRequest = new ModularUIRequest(href, options);
|
|
11
10
|
modularuiRequest.locale = localeCode;
|
|
12
11
|
return modularuiRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withModularUI.js","names":["connect","createSelector","ModularUIRequest","startProgress","finishProgress","handleError","getLocale","reloadModel","modularui","localeCode","href","options","
|
|
1
|
+
{"version":3,"file":"withModularUI.js","names":["connect","createSelector","ModularUIRequest","startProgress","finishProgress","handleError","getLocale","reloadModel","modularui","localeCode","href","options","modularuiRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","withModularui"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n },\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _,\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,aAAa;AAErC,SAASC,cAAc,QAAQ,UAAU;AAEzC,OAAOC,gBAAgB,MAAM,kCAAkC;AAE/D,SAASC,aAAa,EAAEC,cAAc,QAAQ,8BAA8B;AAE5E,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,SAASC,SAAS,QAAQ,mBAAmB;AAE7C,SAASC,WAAW,QAAQ,oBAAoB;AAkChD,MAAMC,SAAS,GAAGP,cAAc,CAC9B,CAACK,SAAS,CAAC,EACVG,UAAU,IACT,CAACC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,KAAK;EACtB,MAAMC,gBAAgB,GAAG,IAAIV,gBAAgB,CAACQ,IAAI,EAAEC,OAAO,CAAC;EAC5DC,gBAAgB,CAACC,MAAM,GAAGJ,UAAU;EACpC,OAAOG,gBAAgB;AACzB,CACJ,CAAC;;AAED;AACA;AACA,MAAME,eAAe,GAAIC,KAAiB,KAAkB;EAC1DP,SAAS,EAAEA,SAAS,CAACO,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCd,aAAa;EACbC,cAAc;EACdG,WAAW;EACXF;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMa,aAAiC,GAAGlB,OAAO,CAO/Cc,eAAe,EAAEG,kBAAkB,CAAC;AAEtC,eAAeC,aAAa","ignoreList":[]}
|