@beinformed/ui 1.30.0 → 1.31.0
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 +13 -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 +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.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- 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 +5 -7
- package/esm/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js +2 -0
- 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 +6 -0
- 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 +30 -3
- 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 +4 -8
- 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 +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.flow +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.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- 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/__tests__/BooleanAttributeModel.spec.js.flow +14 -0
- 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 +5 -7
- 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 +2 -0
- 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 +6 -0
- 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 +30 -3
- package/lib/models/form/FormModel.js.flow +32 -4
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/form/__tests__/FormModel.spec.js.flow +4 -0
- 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 +4 -8
- 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 +32 -32
- package/src/hooks/useForm.js +2 -1
- package/src/models/attributes/BooleanAttributeModel.js +1 -1
- package/src/models/attributes/__tests__/BooleanAttributeModel.spec.js +14 -0
- package/src/models/attributes/layouthint-rules/BaseLayoutHintRule.js +0 -1
- package/src/models/form/FormModel.js +32 -4
- package/src/models/form/__tests__/FormModel.spec.js +4 -0
- 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 -320
- 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 -94
- 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
|
@@ -5,22 +5,18 @@ import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/i
|
|
|
5
5
|
/**
|
|
6
6
|
*/
|
|
7
7
|
class DecimalFormat {
|
|
8
|
-
// Grouping size
|
|
9
|
-
|
|
10
|
-
// Minimum integer digits to be displayed
|
|
11
|
-
|
|
12
|
-
// Minimum fractional digits to be displayed
|
|
13
|
-
|
|
14
|
-
// Maximum fractional digits to be displayed
|
|
15
|
-
|
|
16
8
|
/**
|
|
17
9
|
*/
|
|
18
10
|
constructor(format) {
|
|
19
11
|
_defineProperty(this, "_prefix", void 0);
|
|
20
12
|
_defineProperty(this, "_suffix", void 0);
|
|
13
|
+
// Grouping size
|
|
21
14
|
_defineProperty(this, "_comma", void 0);
|
|
15
|
+
// Minimum integer digits to be displayed
|
|
22
16
|
_defineProperty(this, "_minInt", void 0);
|
|
17
|
+
// Minimum fractional digits to be displayed
|
|
23
18
|
_defineProperty(this, "_minFrac", void 0);
|
|
19
|
+
// Maximum fractional digits to be displayed
|
|
24
20
|
_defineProperty(this, "_maxFrac", void 0);
|
|
25
21
|
_defineProperty(this, "_isPercentage", void 0);
|
|
26
22
|
this.setAffix(format);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecimalFormat.js","names":["DecimalFormat","constructor","format","_defineProperty","setAffix","setFractionLengths","setGroupLength","setMinLength","setPercentage","prefix","_prefix","suffix","_suffix","comma","_comma","minInt","_minInt","minFrac","_minFrac","maxFrac","_maxFrac","isPercentage","_isPercentage","beforeDigit","_includesInstanceProperty","call","substring","indexOf","length","replace","numberStr","fracStr","intStr","lastIndexOf","intFormatStr","charAt","getNumericString","stringNumber","number","Number","string","String","precision","formatBack","formattedNumber","isNaN","tempNumber","negative","substr","hasPrefix","_startsWithInstanceProperty","suffixIndex","scientificNumber","Infinity","getFracAsNumber","DECIMAL_RADIX","Math","round","toString","toFixed","getRoundedFrac","num","getFraction","getFracCorrectLength","frac","i","getInteger","doCarry","x","j","addGrouping","groupedIntStr","getFormattedValue","isNegative","formattedValue","arguments","undefined","toLowerCase","addZeroToFrac","lastTwoFrac"],"sources":["../../../src/utils/number/DecimalFormat.js"],"sourcesContent":["// @flow\n// @see: https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html\n/**\n */\nclass DecimalFormat {\n _prefix: string;\n _suffix: string;\n\n // Grouping size\n _comma: number;\n // Minimum integer digits to be displayed\n _minInt: number;\n\n // Minimum fractional digits to be displayed\n _minFrac: number;\n // Maximum fractional digits to be displayed\n _maxFrac: number;\n\n _isPercentage: boolean;\n\n /**\n */\n constructor(format: string) {\n this.setAffix(format);\n this.setFractionLengths(format);\n this.setGroupLength(format);\n this.setMinLength(format);\n\n this.setPercentage();\n }\n\n /**\n */\n get prefix(): string {\n return this._prefix;\n }\n\n /**\n */\n get suffix(): string {\n return this._suffix;\n }\n\n /**\n */\n get comma(): number {\n return this._comma;\n }\n\n /**\n */\n get minInt(): number {\n return this._minInt;\n }\n\n /**\n */\n get minFrac(): number {\n return this._minFrac;\n }\n\n /**\n */\n get maxFrac(): number {\n return this._maxFrac;\n }\n\n /**\n */\n get isPercentage(): boolean {\n return this._isPercentage;\n }\n\n /**\n */\n setAffix(format: string) {\n const beforeDigit = format.includes(\"#\")\n ? format.substring(0, format.indexOf(\"#\"))\n : format;\n\n this._prefix = beforeDigit.includes(\"0\")\n ? beforeDigit.substring(0, beforeDigit.indexOf(\"0\"))\n : beforeDigit;\n this._suffix = format\n .substring(this._prefix.length)\n .replace(/[#,.0]/gu, \"\");\n }\n\n /**\n */\n setFractionLengths(format: string) {\n this._minFrac = 0;\n this._maxFrac = 0;\n\n const numberStr = format.replace(/[^#,.0]/gu, \"\");\n if (numberStr.includes(\".\")) {\n const fracStr = numberStr.substring(numberStr.indexOf(\".\") + 1);\n\n const maxFrac = fracStr.replace(/,|\\.+/g, \"\");\n this._maxFrac = maxFrac.length;\n\n // replace all but zeros\n const minFrac = maxFrac.replace(/[^0]/gu, \"\");\n this._minFrac = minFrac.length;\n }\n }\n\n /**\n */\n setGroupLength(format: string) {\n this._comma = 0;\n\n const numberStr = format.replace(/[^#,.0]/gu, \"\");\n const intStr = numberStr.includes(\".\")\n ? numberStr.substring(0, numberStr.indexOf(\".\"))\n : numberStr;\n\n if (intStr.includes(\",\")) {\n this._comma = intStr.length - 1 - intStr.lastIndexOf(\",\");\n }\n }\n\n /**\n */\n setMinLength(format: string) {\n const intFormatStr = format.includes(\".\")\n ? format.substring(0, format.indexOf(\".\"))\n : format;\n const intStr = intFormatStr.replace(/[^0]/gu, \"\");\n\n this._minInt = intStr.length > 1 ? intStr.length : 1;\n }\n\n /**\n */\n setPercentage() {\n this._isPercentage = this.suffix.charAt(0) === \"%\";\n }\n\n /**\n * Solves problem where big numbers loose the precision:\n * e.g. Number(23423423423342234.34) => 23423423423342236\n */\n static getNumericString(stringNumber: string): string {\n const number = Number(stringNumber);\n const string = String(number);\n\n if (!string.includes(\".\") && stringNumber.includes(\".\")) {\n // check if original string has all zeros after dot or not\n const precision = stringNumber.substring(stringNumber.indexOf(\".\") + 1);\n if (precision.replace(/0/gu, \"\").length > 0) {\n return stringNumber;\n }\n\n return string;\n }\n\n return stringNumber;\n }\n\n /**\n * Converts formatted value back to non-formatted value\n * e.g. $1,223.06 --> 1223.06\n */\n formatBack(formattedNumber: string): string {\n const stringNumber = String(formattedNumber);\n\n if (!stringNumber) {\n return \"\";\n }\n\n if (!isNaN(stringNumber)) {\n return DecimalFormat.getNumericString(stringNumber);\n }\n\n let tempNumber = formattedNumber;\n\n let negative = false;\n if (formattedNumber.charAt(0) === \"-\") {\n tempNumber = formattedNumber.substr(1);\n negative = true;\n }\n\n const hasPrefix = formattedNumber.startsWith(this.prefix);\n\n const suffixIndex =\n this.suffix === \"\"\n ? formattedNumber.length\n : formattedNumber.indexOf(this.suffix, this.prefix.length + 1);\n\n if (hasPrefix && suffixIndex > 0) {\n tempNumber = tempNumber.substr(0, suffixIndex);\n tempNumber = tempNumber.substr(this.prefix.length);\n tempNumber = tempNumber.replace(/,/gu, \"\");\n\n if (negative) {\n tempNumber = `-${tempNumber}`;\n }\n\n if (!isNaN(tempNumber)) {\n return DecimalFormat.getNumericString(tempNumber);\n }\n }\n\n return tempNumber;\n }\n\n /**\n */\n static scientificNumber(stringNumber: string): string {\n if (stringNumber.includes(\"e\")) {\n const number = Number(stringNumber);\n if (number === Infinity || number === -Infinity) {\n return stringNumber;\n }\n\n return String(number);\n }\n\n return stringNumber;\n }\n\n /**\n */\n getFracAsNumber(fracStr: string): string {\n const number = Number(`0.${fracStr}`);\n const DECIMAL_RADIX = 10;\n\n return this.maxFrac === 0\n ? Math.round(number).toString(DECIMAL_RADIX)\n : number.toFixed(this.maxFrac);\n }\n\n /**\n */\n getRoundedFrac(fracStr: string): string {\n const num = this.getFracAsNumber(fracStr);\n\n // toFixed method has bugs on IE (0.7 --> 0)\n return num.substr(2);\n }\n\n /**\n */\n static getFraction(number: string): string {\n let fracStr = number.includes(\".\")\n ? number.substring(number.indexOf(\".\") + 1)\n : \"\";\n\n fracStr = fracStr.replace(/\\./, \"\");\n\n return fracStr;\n }\n\n /**\n */\n getFracCorrectLength(frac: string): string {\n let fracStr = frac;\n\n if (fracStr.length > this.maxFrac) {\n fracStr = this.getRoundedFrac(fracStr);\n }\n\n for (let i = fracStr.length; i < this.minFrac; i++) {\n // if minFrac=4 then 1.12 --> 1.1200\n fracStr = `${fracStr}0`;\n }\n\n while (\n fracStr.length > this.minFrac &&\n fracStr.charAt(fracStr.length - 1) === \"0\"\n ) {\n // if minInt=4 then 00034 --> 0034)\n fracStr = fracStr.substring(0, fracStr.length - 1);\n }\n\n return fracStr;\n }\n\n /**\n */\n getInteger(number: string): string {\n let intStr = number.includes(\".\")\n ? number.substring(0, number.indexOf(\".\"))\n : number;\n\n let doCarry = Number(this.getFracAsNumber(number)) > 1;\n let i = intStr.length - 1;\n\n while (doCarry) {\n if (i === -1) {\n intStr = `1${intStr}`;\n break;\n }\n\n let x = intStr.charAt(i);\n if (x === \"9\") {\n x = \"0\";\n } else {\n x = `${x + 1}`;\n doCarry = false;\n }\n\n intStr =\n intStr.substring(0, i) + x + intStr.substring(i + 1, intStr.length);\n\n i -= 1;\n }\n\n for (let j = intStr.length; j < this.minInt; j++) {\n // if minInt=4 then 034 --> 0034\n intStr = `0${intStr}`;\n }\n\n while (intStr.length > this.minInt && intStr.charAt(0) === \"0\") {\n // if minInt=4 then 00034 --> 0034)\n intStr = intStr.substring(1);\n }\n\n return intStr;\n }\n\n /**\n */\n addGrouping(intStr: string): string {\n let groupedIntStr = intStr;\n\n let j = 0;\n for (let i = groupedIntStr.length; i > 0; i--) {\n // add commas\n if (j !== 0 && j % this.comma === 0) {\n groupedIntStr = `${groupedIntStr.substring(\n 0,\n i\n )},${groupedIntStr.substring(i)}`;\n j = 0;\n }\n\n j += 1;\n }\n\n return groupedIntStr;\n }\n\n /**\n */\n getFormattedValue(\n intStr: string,\n fracStr: string,\n isNegative: boolean\n ): string {\n let formattedValue;\n if (fracStr.length > 0)\n formattedValue = `${this.prefix + intStr}.${fracStr}${this.suffix}`;\n else formattedValue = this.prefix + intStr + this.suffix;\n\n if (isNegative) {\n formattedValue = `-${formattedValue}`;\n }\n\n return formattedValue;\n }\n\n /**\n * Formats given value, using the pattern\n * e.g. $#,###.00: 1223.06 --> $1,223.06\n */\n format(stringNumber: string = \"\"): string {\n if (stringNumber === null) {\n return \"\";\n }\n\n let formattedNumber = this.formatBack(stringNumber).toLowerCase();\n\n if (isNaN(formattedNumber) || formattedNumber.length === 0) {\n return stringNumber;\n }\n\n formattedNumber = DecimalFormat.scientificNumber(formattedNumber);\n if (formattedNumber.includes(\"e\")) {\n return formattedNumber;\n }\n\n const isNegative = formattedNumber.charAt(0) === \"-\";\n if (isNegative || formattedNumber.charAt(0) === \"+\") {\n formattedNumber = formattedNumber.substring(1);\n }\n\n let fracStr = DecimalFormat.getFraction(formattedNumber);\n let intStr = this.getInteger(formattedNumber);\n if (this.isPercentage) {\n // Add zeros behind fraction to make sure we have at least two characters and take first two character:\n // 1 --> 100 --> 10\n const addZeroToFrac = `${fracStr}00`.substr(0, 2);\n // Add zeros in front of frac and get last two characters\n const lastTwoFrac = `00${addZeroToFrac}`.substr(-2);\n\n intStr = `${intStr}${lastTwoFrac}`;\n fracStr = fracStr.substr(2);\n }\n\n fracStr = this.getFracCorrectLength(fracStr);\n\n intStr = this.addGrouping(intStr);\n\n return this.getFormattedValue(intStr, fracStr, isNegative);\n }\n}\n\nexport default DecimalFormat;\n"],"mappings":";;;AACA;AACA;AACA;AACA,MAAMA,aAAa,CAAC;EAIlB;;EAEA;;EAGA;;EAEA;;EAKA;AACF;EACEC,WAAWA,CAACC,MAAc,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAC1B,IAAI,CAACC,QAAQ,CAACF,MAAM,CAAC;IACrB,IAAI,CAACG,kBAAkB,CAACH,MAAM,CAAC;IAC/B,IAAI,CAACI,cAAc,CAACJ,MAAM,CAAC;IAC3B,IAAI,CAACK,YAAY,CAACL,MAAM,CAAC;IAEzB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AIZ,MAAM,GAAG,IAAI,CAACkC,UAAU,CAACtB,eAAe,CAAC;IAC7C,IAAI,IAAI,CAACvB,YAAY,EAAE;MACrB;MACA;MACA,MAAMyD,aAAa,GAAI,GAAE/C,OAAQ,IAAG,CAACiB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;MACjD;MACA,MAAM+B,WAAW,GAAI,KAAID,aAAc,EAAC,CAAC9B,MAAM,CAAC,CAAC,CAAC,CAAC;MAEnDhB,MAAM,GAAI,GAAEA,MAAO,GAAE+C,WAAY,EAAC;MAClChD,OAAO,GAAGA,OAAO,CAACiB,MAAM,CAAC,CAAC,CAAC;IAC7B;IAEAjB,OAAO,GAAG,IAAI,CAACgC,oBAAoB,CAAChC,OAAO,CAAC;IAE5CC,MAAM,GAAG,IAAI,CAACsC,WAAW,CAACtC,MAAM,CAAC;IAEjC,OAAO,IAAI,CAACwC,iBAAiB,CAACxC,MAAM,EAAED,OAAO,EAAE0C,UAAU,CAAC;EAC5D;AACF;AAEA,eAAezE,aAAa"}
|
|
1
|
+
{"version":3,"file":"DecimalFormat.js","names":["DecimalFormat","constructor","format","_defineProperty","setAffix","setFractionLengths","setGroupLength","setMinLength","setPercentage","prefix","_prefix","suffix","_suffix","comma","_comma","minInt","_minInt","minFrac","_minFrac","maxFrac","_maxFrac","isPercentage","_isPercentage","beforeDigit","_includesInstanceProperty","call","substring","indexOf","length","replace","numberStr","fracStr","intStr","lastIndexOf","intFormatStr","charAt","getNumericString","stringNumber","number","Number","string","String","precision","formatBack","formattedNumber","isNaN","tempNumber","negative","substr","hasPrefix","_startsWithInstanceProperty","suffixIndex","scientificNumber","Infinity","getFracAsNumber","DECIMAL_RADIX","Math","round","toString","toFixed","getRoundedFrac","num","getFraction","getFracCorrectLength","frac","i","getInteger","doCarry","x","j","addGrouping","groupedIntStr","getFormattedValue","isNegative","formattedValue","arguments","undefined","toLowerCase","addZeroToFrac","lastTwoFrac"],"sources":["../../../src/utils/number/DecimalFormat.js"],"sourcesContent":["// @flow\n// @see: https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html\n/**\n */\nclass DecimalFormat {\n _prefix: string;\n _suffix: string;\n\n // Grouping size\n _comma: number;\n // Minimum integer digits to be displayed\n _minInt: number;\n\n // Minimum fractional digits to be displayed\n _minFrac: number;\n // Maximum fractional digits to be displayed\n _maxFrac: number;\n\n _isPercentage: boolean;\n\n /**\n */\n constructor(format: string) {\n this.setAffix(format);\n this.setFractionLengths(format);\n this.setGroupLength(format);\n this.setMinLength(format);\n\n this.setPercentage();\n }\n\n /**\n */\n get prefix(): string {\n return this._prefix;\n }\n\n /**\n */\n get suffix(): string {\n return this._suffix;\n }\n\n /**\n */\n get comma(): number {\n return this._comma;\n }\n\n /**\n */\n get minInt(): number {\n return this._minInt;\n }\n\n /**\n */\n get minFrac(): number {\n return this._minFrac;\n }\n\n /**\n */\n get maxFrac(): number {\n return this._maxFrac;\n }\n\n /**\n */\n get isPercentage(): boolean {\n return this._isPercentage;\n }\n\n /**\n */\n setAffix(format: string) {\n const beforeDigit = format.includes(\"#\")\n ? format.substring(0, format.indexOf(\"#\"))\n : format;\n\n this._prefix = beforeDigit.includes(\"0\")\n ? beforeDigit.substring(0, beforeDigit.indexOf(\"0\"))\n : beforeDigit;\n this._suffix = format\n .substring(this._prefix.length)\n .replace(/[#,.0]/gu, \"\");\n }\n\n /**\n */\n setFractionLengths(format: string) {\n this._minFrac = 0;\n this._maxFrac = 0;\n\n const numberStr = format.replace(/[^#,.0]/gu, \"\");\n if (numberStr.includes(\".\")) {\n const fracStr = numberStr.substring(numberStr.indexOf(\".\") + 1);\n\n const maxFrac = fracStr.replace(/,|\\.+/g, \"\");\n this._maxFrac = maxFrac.length;\n\n // replace all but zeros\n const minFrac = maxFrac.replace(/[^0]/gu, \"\");\n this._minFrac = minFrac.length;\n }\n }\n\n /**\n */\n setGroupLength(format: string) {\n this._comma = 0;\n\n const numberStr = format.replace(/[^#,.0]/gu, \"\");\n const intStr = numberStr.includes(\".\")\n ? numberStr.substring(0, numberStr.indexOf(\".\"))\n : numberStr;\n\n if (intStr.includes(\",\")) {\n this._comma = intStr.length - 1 - intStr.lastIndexOf(\",\");\n }\n }\n\n /**\n */\n setMinLength(format: string) {\n const intFormatStr = format.includes(\".\")\n ? format.substring(0, format.indexOf(\".\"))\n : format;\n const intStr = intFormatStr.replace(/[^0]/gu, \"\");\n\n this._minInt = intStr.length > 1 ? intStr.length : 1;\n }\n\n /**\n */\n setPercentage() {\n this._isPercentage = this.suffix.charAt(0) === \"%\";\n }\n\n /**\n * Solves problem where big numbers loose the precision:\n * e.g. Number(23423423423342234.34) => 23423423423342236\n */\n static getNumericString(stringNumber: string): string {\n const number = Number(stringNumber);\n const string = String(number);\n\n if (!string.includes(\".\") && stringNumber.includes(\".\")) {\n // check if original string has all zeros after dot or not\n const precision = stringNumber.substring(stringNumber.indexOf(\".\") + 1);\n if (precision.replace(/0/gu, \"\").length > 0) {\n return stringNumber;\n }\n\n return string;\n }\n\n return stringNumber;\n }\n\n /**\n * Converts formatted value back to non-formatted value\n * e.g. $1,223.06 --> 1223.06\n */\n formatBack(formattedNumber: string): string {\n const stringNumber = String(formattedNumber);\n\n if (!stringNumber) {\n return \"\";\n }\n\n if (!isNaN(stringNumber)) {\n return DecimalFormat.getNumericString(stringNumber);\n }\n\n let tempNumber = formattedNumber;\n\n let negative = false;\n if (formattedNumber.charAt(0) === \"-\") {\n tempNumber = formattedNumber.substr(1);\n negative = true;\n }\n\n const hasPrefix = formattedNumber.startsWith(this.prefix);\n\n const suffixIndex =\n this.suffix === \"\"\n ? formattedNumber.length\n : formattedNumber.indexOf(this.suffix, this.prefix.length + 1);\n\n if (hasPrefix && suffixIndex > 0) {\n tempNumber = tempNumber.substr(0, suffixIndex);\n tempNumber = tempNumber.substr(this.prefix.length);\n tempNumber = tempNumber.replace(/,/gu, \"\");\n\n if (negative) {\n tempNumber = `-${tempNumber}`;\n }\n\n if (!isNaN(tempNumber)) {\n return DecimalFormat.getNumericString(tempNumber);\n }\n }\n\n return tempNumber;\n }\n\n /**\n */\n static scientificNumber(stringNumber: string): string {\n if (stringNumber.includes(\"e\")) {\n const number = Number(stringNumber);\n if (number === Infinity || number === -Infinity) {\n return stringNumber;\n }\n\n return String(number);\n }\n\n return stringNumber;\n }\n\n /**\n */\n getFracAsNumber(fracStr: string): string {\n const number = Number(`0.${fracStr}`);\n const DECIMAL_RADIX = 10;\n\n return this.maxFrac === 0\n ? Math.round(number).toString(DECIMAL_RADIX)\n : number.toFixed(this.maxFrac);\n }\n\n /**\n */\n getRoundedFrac(fracStr: string): string {\n const num = this.getFracAsNumber(fracStr);\n\n // toFixed method has bugs on IE (0.7 --> 0)\n return num.substr(2);\n }\n\n /**\n */\n static getFraction(number: string): string {\n let fracStr = number.includes(\".\")\n ? number.substring(number.indexOf(\".\") + 1)\n : \"\";\n\n fracStr = fracStr.replace(/\\./, \"\");\n\n return fracStr;\n }\n\n /**\n */\n getFracCorrectLength(frac: string): string {\n let fracStr = frac;\n\n if (fracStr.length > this.maxFrac) {\n fracStr = this.getRoundedFrac(fracStr);\n }\n\n for (let i = fracStr.length; i < this.minFrac; i++) {\n // if minFrac=4 then 1.12 --> 1.1200\n fracStr = `${fracStr}0`;\n }\n\n while (\n fracStr.length > this.minFrac &&\n fracStr.charAt(fracStr.length - 1) === \"0\"\n ) {\n // if minInt=4 then 00034 --> 0034)\n fracStr = fracStr.substring(0, fracStr.length - 1);\n }\n\n return fracStr;\n }\n\n /**\n */\n getInteger(number: string): string {\n let intStr = number.includes(\".\")\n ? number.substring(0, number.indexOf(\".\"))\n : number;\n\n let doCarry = Number(this.getFracAsNumber(number)) > 1;\n let i = intStr.length - 1;\n\n while (doCarry) {\n if (i === -1) {\n intStr = `1${intStr}`;\n break;\n }\n\n let x = intStr.charAt(i);\n if (x === \"9\") {\n x = \"0\";\n } else {\n x = `${x + 1}`;\n doCarry = false;\n }\n\n intStr =\n intStr.substring(0, i) + x + intStr.substring(i + 1, intStr.length);\n\n i -= 1;\n }\n\n for (let j = intStr.length; j < this.minInt; j++) {\n // if minInt=4 then 034 --> 0034\n intStr = `0${intStr}`;\n }\n\n while (intStr.length > this.minInt && intStr.charAt(0) === \"0\") {\n // if minInt=4 then 00034 --> 0034)\n intStr = intStr.substring(1);\n }\n\n return intStr;\n }\n\n /**\n */\n addGrouping(intStr: string): string {\n let groupedIntStr = intStr;\n\n let j = 0;\n for (let i = groupedIntStr.length; i > 0; i--) {\n // add commas\n if (j !== 0 && j % this.comma === 0) {\n groupedIntStr = `${groupedIntStr.substring(\n 0,\n i\n )},${groupedIntStr.substring(i)}`;\n j = 0;\n }\n\n j += 1;\n }\n\n return groupedIntStr;\n }\n\n /**\n */\n getFormattedValue(\n intStr: string,\n fracStr: string,\n isNegative: boolean\n ): string {\n let formattedValue;\n if (fracStr.length > 0)\n formattedValue = `${this.prefix + intStr}.${fracStr}${this.suffix}`;\n else formattedValue = this.prefix + intStr + this.suffix;\n\n if (isNegative) {\n formattedValue = `-${formattedValue}`;\n }\n\n return formattedValue;\n }\n\n /**\n * Formats given value, using the pattern\n * e.g. $#,###.00: 1223.06 --> $1,223.06\n */\n format(stringNumber: string = \"\"): string {\n if (stringNumber === null) {\n return \"\";\n }\n\n let formattedNumber = this.formatBack(stringNumber).toLowerCase();\n\n if (isNaN(formattedNumber) || formattedNumber.length === 0) {\n return stringNumber;\n }\n\n formattedNumber = DecimalFormat.scientificNumber(formattedNumber);\n if (formattedNumber.includes(\"e\")) {\n return formattedNumber;\n }\n\n const isNegative = formattedNumber.charAt(0) === \"-\";\n if (isNegative || formattedNumber.charAt(0) === \"+\") {\n formattedNumber = formattedNumber.substring(1);\n }\n\n let fracStr = DecimalFormat.getFraction(formattedNumber);\n let intStr = this.getInteger(formattedNumber);\n if (this.isPercentage) {\n // Add zeros behind fraction to make sure we have at least two characters and take first two character:\n // 1 --> 100 --> 10\n const addZeroToFrac = `${fracStr}00`.substr(0, 2);\n // Add zeros in front of frac and get last two characters\n const lastTwoFrac = `00${addZeroToFrac}`.substr(-2);\n\n intStr = `${intStr}${lastTwoFrac}`;\n fracStr = fracStr.substr(2);\n }\n\n fracStr = this.getFracCorrectLength(fracStr);\n\n intStr = this.addGrouping(intStr);\n\n return this.getFormattedValue(intStr, fracStr, isNegative);\n }\n}\n\nexport default DecimalFormat;\n"],"mappings":";;;AACA;AACA;AACA;AACA,MAAMA,aAAa,CAAC;EAgBlB;AACF;EACEC,WAAWA,CAACC,MAAc,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAd5B;IAAAA,eAAA;IAEA;IAAAA,eAAA;IAGA;IAAAA,eAAA;IAEA;IAAAA,eAAA;IAAAA,eAAA;IAQE,IAAI,CAACC,QAAQ,CAACF,MAAM,CAAC;IACrB,IAAI,CAACG,kBAAkB,CAACH,MAAM,CAAC;IAC/B,IAAI,CAACI,cAAc,CAACJ,MAAM,CAAC;IAC3B,IAAI,CAACK,YAAY,CAACL,MAAM,CAAC;IAEzB,IAAI,CAACM,aAAa,CAAC,CAAC;EACtB;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACC,OAAO;EACrB;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACC,OAAO;EACrB;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACC,MAAM;EACpB;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACC,OAAO;EACrB;;EAEA;AACF;EACE,IAAIC,OAAOA,CAAA,EAAW;IACpB,OAAO,IAAI,CAACC,QAAQ;EACtB;;EAEA;AACF;EACE,IAAIC,OAAOA,CAAA,EAAW;IACpB,OAAO,IAAI,CAACC,QAAQ;EACtB;;EAEA;AACF;EACE,IAAIC,YAAYA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACC,aAAa;EAC3B;;EAEA;AACF;EACElB,QAAQA,CAACF,MAAc,EAA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ezE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatValue.js","names":["IllegalArgumentException","DecimalFormat","parseNumberToString","parseToNumber","updateGroupingSeparator","input","groupingSeparator","replace","formatValue","value","format","arguments","length","undefined","decimalSeparator","numberValue","stringValue","formattedValue","integer","decimal","split","integerPart"],"sources":["../../../src/utils/number/formatValue.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport DecimalFormat from \"./DecimalFormat\";\nimport { parseNumberToString, parseToNumber } from \"./parseNumbers\";\n\n/**\n * @private\n */\nconst updateGroupingSeparator = (input: string, groupingSeparator: string) => {\n if (groupingSeparator == null) {\n return input;\n }\n\n return input.replace(/,/g, groupingSeparator);\n};\n\n/**\n */\nconst formatValue = (\n value: ?number | ?string,\n format: ?string = \"0\",\n groupingSeparator: string = \",\",\n decimalSeparator: string = \".\"\n): string => {\n if (value == null) {\n return \"\";\n }\n\n const numberValue =\n typeof value === \"number\"\n ? value\n : parseToNumber(value, groupingSeparator, decimalSeparator);\n\n if (typeof numberValue !== \"number\") {\n throw new IllegalArgumentException(\n `Not a valid number: ${value} for formatValue`\n );\n }\n\n const stringValue = parseNumberToString(numberValue);\n\n if (format != null) {\n const formattedValue = new DecimalFormat(format).format(stringValue);\n\n const [integer, decimal] = formattedValue.split(\".\");\n\n const integerPart = updateGroupingSeparator(integer, groupingSeparator);\n\n if (decimal) {\n return `${integerPart}${decimalSeparator}${decimal}`;\n }\n\n return integerPart;\n }\n\n return stringValue;\n};\n\nexport default formatValue;\n"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,kBAAkB;AAE3D,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,gBAAgB;;AAEnE;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAACC,KAAa,EAAEC,iBAAyB,KAAK;EAC5E,IAAIA,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOD,KAAK;EACd;EAEA,OAAOA,KAAK,CAACE,OAAO,CAAC,IAAI,EAAED,iBAAiB,CAAC;AAC/C,CAAC;;AAED;AACA;AACA,MAAME,WAAW,GAAG,SAAAA,CAClBC,KAAwB,EAIb;EAAA,IAHXC,MAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IACrBL,iBAAyB,GAAAK,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IAC/BG,gBAAwB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAE9B,IAAIF,KAAK,IAAI,IAAI,EAAE;IACjB,OAAO,EAAE;EACX;EAEA,MAAMM,WAAW,GACf,OAAON,KAAK,KAAK,QAAQ,GACrBA,KAAK,GACLN,aAAa,CAACM,KAAK,EAAEH,iBAAiB,EAAEQ,gBAAgB,CAAC;EAE/D,IAAI,OAAOC,WAAW,KAAK,QAAQ,EAAE;IACnC,MAAM,IAAIf,wBAAwB,CAC/B,uBAAsBS,KAAM,
|
|
1
|
+
{"version":3,"file":"formatValue.js","names":["IllegalArgumentException","DecimalFormat","parseNumberToString","parseToNumber","updateGroupingSeparator","input","groupingSeparator","replace","formatValue","value","format","arguments","length","undefined","decimalSeparator","numberValue","stringValue","formattedValue","integer","decimal","split","integerPart"],"sources":["../../../src/utils/number/formatValue.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport DecimalFormat from \"./DecimalFormat\";\nimport { parseNumberToString, parseToNumber } from \"./parseNumbers\";\n\n/**\n * @private\n */\nconst updateGroupingSeparator = (input: string, groupingSeparator: string) => {\n if (groupingSeparator == null) {\n return input;\n }\n\n return input.replace(/,/g, groupingSeparator);\n};\n\n/**\n */\nconst formatValue = (\n value: ?number | ?string,\n format: ?string = \"0\",\n groupingSeparator: string = \",\",\n decimalSeparator: string = \".\"\n): string => {\n if (value == null) {\n return \"\";\n }\n\n const numberValue =\n typeof value === \"number\"\n ? value\n : parseToNumber(value, groupingSeparator, decimalSeparator);\n\n if (typeof numberValue !== \"number\") {\n throw new IllegalArgumentException(\n `Not a valid number: ${value} for formatValue`\n );\n }\n\n const stringValue = parseNumberToString(numberValue);\n\n if (format != null) {\n const formattedValue = new DecimalFormat(format).format(stringValue);\n\n const [integer, decimal] = formattedValue.split(\".\");\n\n const integerPart = updateGroupingSeparator(integer, groupingSeparator);\n\n if (decimal) {\n return `${integerPart}${decimalSeparator}${decimal}`;\n }\n\n return integerPart;\n }\n\n return stringValue;\n};\n\nexport default formatValue;\n"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,kBAAkB;AAE3D,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,gBAAgB;;AAEnE;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAACC,KAAa,EAAEC,iBAAyB,KAAK;EAC5E,IAAIA,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOD,KAAK;EACd;EAEA,OAAOA,KAAK,CAACE,OAAO,CAAC,IAAI,EAAED,iBAAiB,CAAC;AAC/C,CAAC;;AAED;AACA;AACA,MAAME,WAAW,GAAG,SAAAA,CAClBC,KAAwB,EAIb;EAAA,IAHXC,MAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IACrBL,iBAAyB,GAAAK,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IAC/BG,gBAAwB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAE9B,IAAIF,KAAK,IAAI,IAAI,EAAE;IACjB,OAAO,EAAE;EACX;EAEA,MAAMM,WAAW,GACf,OAAON,KAAK,KAAK,QAAQ,GACrBA,KAAK,GACLN,aAAa,CAACM,KAAK,EAAEH,iBAAiB,EAAEQ,gBAAgB,CAAC;EAE/D,IAAI,OAAOC,WAAW,KAAK,QAAQ,EAAE;IACnC,MAAM,IAAIf,wBAAwB,CAC/B,uBAAsBS,KAAM,kBAC/B,CAAC;EACH;EAEA,MAAMO,WAAW,GAAGd,mBAAmB,CAACa,WAAW,CAAC;EAEpD,IAAIL,MAAM,IAAI,IAAI,EAAE;IAClB,MAAMO,cAAc,GAAG,IAAIhB,aAAa,CAACS,MAAM,CAAC,CAACA,MAAM,CAACM,WAAW,CAAC;IAEpE,MAAM,CAACE,OAAO,EAAEC,OAAO,CAAC,GAAGF,cAAc,CAACG,KAAK,CAAC,GAAG,CAAC;IAEpD,MAAMC,WAAW,GAAGjB,uBAAuB,CAACc,OAAO,EAAEZ,iBAAiB,CAAC;IAEvE,IAAIa,OAAO,EAAE;MACX,OAAQ,GAAEE,WAAY,GAAEP,gBAAiB,GAAEK,OAAQ,EAAC;IACtD;IAEA,OAAOE,WAAW;EACpB;EAEA,OAAOL,WAAW;AACpB,CAAC;AAED,eAAeR,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseNumbers.js","names":["big","removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","arguments","length","undefined","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","parseNumberToString","toFixed","error"],"sources":["../../../src/utils/number/parseNumbers.js"],"sourcesContent":["// @flow\nimport big from \"big.js\";\n\n/**\n * @private\n */\nconst removeGroupingSeparator = (\n input: string | number,\n groupingSeparator?: ?string\n) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (groupingSeparator == null) {\n return input;\n }\n\n const escapedGroupingSeparator = groupingSeparator.replace(\n /[$()*+.?[\\\\\\]^{|}]/g,\n \"\\\\$&\"\n );\n\n return input.replace(new RegExp(escapedGroupingSeparator, \"g\"), \"\");\n};\n\n/**\n * @private\n */\nconst updateDecimalSeparator = (\n input: string | number,\n decimalSeparator?: ?string\n) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (decimalSeparator == null || decimalSeparator === \"\") {\n return input;\n }\n\n return input.replace(decimalSeparator, \".\");\n};\n\n/**\n * Parses input into a number, removes the grouping separator from the input and\n * replaces the decimal separator with a dot to make it a JavaScript parseable number\n */\nconst parseToNumber = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): number => {\n if (input == null || input === \"\") {\n return NaN;\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n return Number(inputCorrectDecimalSeparator);\n};\n\n/**\n * parses Numbers To String\n */\nconst parseNumberToString = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): string => {\n if (input == null || input === \"\") {\n return \"NaN\";\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n try {\n return big(inputCorrectDecimalSeparator).toFixed();\n } catch (error) {\n return \"NaN\";\n }\n};\n\nexport { parseToNumber, parseNumberToString };\n"],"mappings":"AACA,OAAOA,GAAG,MAAM,QAAQ;;AAExB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAC9BC,KAAsB,EACtBC,iBAA2B,KACxB;EACH,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAIC,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOD,KAAK;EACd;EAEA,MAAME,wBAAwB,GAAGD,iBAAiB,CAACE,OAAO,CACxD,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"parseNumbers.js","names":["big","removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","arguments","length","undefined","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","parseNumberToString","toFixed","error"],"sources":["../../../src/utils/number/parseNumbers.js"],"sourcesContent":["// @flow\nimport big from \"big.js\";\n\n/**\n * @private\n */\nconst removeGroupingSeparator = (\n input: string | number,\n groupingSeparator?: ?string\n) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (groupingSeparator == null) {\n return input;\n }\n\n const escapedGroupingSeparator = groupingSeparator.replace(\n /[$()*+.?[\\\\\\]^{|}]/g,\n \"\\\\$&\"\n );\n\n return input.replace(new RegExp(escapedGroupingSeparator, \"g\"), \"\");\n};\n\n/**\n * @private\n */\nconst updateDecimalSeparator = (\n input: string | number,\n decimalSeparator?: ?string\n) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (decimalSeparator == null || decimalSeparator === \"\") {\n return input;\n }\n\n return input.replace(decimalSeparator, \".\");\n};\n\n/**\n * Parses input into a number, removes the grouping separator from the input and\n * replaces the decimal separator with a dot to make it a JavaScript parseable number\n */\nconst parseToNumber = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): number => {\n if (input == null || input === \"\") {\n return NaN;\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n return Number(inputCorrectDecimalSeparator);\n};\n\n/**\n * parses Numbers To String\n */\nconst parseNumberToString = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): string => {\n if (input == null || input === \"\") {\n return \"NaN\";\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n try {\n return big(inputCorrectDecimalSeparator).toFixed();\n } catch (error) {\n return \"NaN\";\n }\n};\n\nexport { parseToNumber, parseNumberToString };\n"],"mappings":"AACA,OAAOA,GAAG,MAAM,QAAQ;;AAExB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAC9BC,KAAsB,EACtBC,iBAA2B,KACxB;EACH,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAIC,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOD,KAAK;EACd;EAEA,MAAME,wBAAwB,GAAGD,iBAAiB,CAACE,OAAO,CACxD,qBAAqB,EACrB,MACF,CAAC;EAED,OAAOH,KAAK,CAACG,OAAO,CAAC,IAAIC,MAAM,CAACF,wBAAwB,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AACA,MAAMG,sBAAsB,GAAGA,CAC7BL,KAAsB,EACtBM,gBAA0B,KACvB;EACH,IAAI,OAAON,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAIM,gBAAgB,IAAI,IAAI,IAAIA,gBAAgB,KAAK,EAAE,EAAE;IACvD,OAAON,KAAK;EACd;EAEA,OAAOA,KAAK,CAACG,OAAO,CAACG,gBAAgB,EAAE,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,SAAAA,CACpBP,KAAwB,EAGb;EAAA,IAFXC,iBAA0B,GAAAO,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IAChCF,gBAAyB,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAE/B,IAAIR,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACjC,OAAOW,GAAG;EACZ;EAEA,MAAMC,eAAe,GAAGb,uBAAuB,CAACC,KAAK,EAAEC,iBAAiB,CAAC;EAEzE,MAAMY,4BAA4B,GAAGR,sBAAsB,CACzDO,eAAe,EACfN,gBACF,CAAC;EAED,OAAOQ,MAAM,CAACD,4BAA4B,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA,MAAME,mBAAmB,GAAG,SAAAA,CAC1Bf,KAAwB,EAGb;EAAA,IAFXC,iBAA0B,GAAAO,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAAA,IAChCF,gBAAyB,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAE/B,IAAIR,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,MAAMY,eAAe,GAAGb,uBAAuB,CAACC,KAAK,EAAEC,iBAAiB,CAAC;EAEzE,MAAMY,4BAA4B,GAAGR,sBAAsB,CACzDO,eAAe,EACfN,gBACF,CAAC;EAED,IAAI;IACF,OAAOR,GAAG,CAACe,4BAA4B,CAAC,CAACG,OAAO,CAAC,CAAC;EACpD,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,OAAO,KAAK;EACd;AACF,CAAC;AAED,SAASV,aAAa,EAAEQ,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["glob","require","fs","path","LayoutHintConfiguration","readFiles","files","filePromises","_map","default","call","file","_promise","resolve","reject","readFile","err","data","JSON","parse","all","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","then","jsons","newConfig","_assign","writeFile","join","_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,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAH,KAAK,EAAAI,IAAA,CAALJ,KAAK,EACvBK,IAAI,IACH,IAAAC,QAAA,CAAAH,OAAA,CAAY,CAACI,OAAO,EAAEC,MAAM,KAAK;IAC/BZ,EAAE,CAACa,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","_map","default","call","file","_promise","resolve","reject","readFile","err","data","JSON","parse","all","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","then","jsons","newConfig","_assign","writeFile","join","_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 });\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S,CAACC,KAAK,CAAC,CAACqB,IAAI,CAAEC,KAAK,IAAK;QAC/B,MAAMC,SAAS,GAAG,IAAAC,OAAA,CAAArB,OAAA,EAAcL,uBAAuB,EAAE,GAAGwB,KAAK,CAAC;QAClE1B,EAAE,CAAC6B,SAAS,CACV5B,IAAI,CAAC6B,IAAI,CAACR,YAAY,EAAE,uBAAuB,CAAC,EAChD,IAAAS,UAAA,CAAAxB,OAAA,EAAeoB,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":["_LayoutHintConfig","require","getHint","hint","LayoutHintConfiguration","MANDATORY","exports","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","_default","default"],"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,IAAAA,iBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,IAAY,IAAa;EACxC,IAAIC,yCAAuB,CAACD,IAAI,CAAC,EAAE;IACjC,OAAOC,yCAAuB,CAACD,IAAI,CAAC,CAACA,IAAI;EAC3C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACO,MAAME,SAAiB,GAAGH,OAAO,CAAC,WAAW,CAAC;;AAErD;AACA;AACA;AACA;AAHAI,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAIO,MAAME,QAAgB,GAAGL,OAAO,CAAC,UAAU,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFAI,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAGO,MAAMC,2BAA2B,GAAG,mBAAmB;AAC9D;AACA;AADAF,OAAA,CAAAE,2BAAA,GAAAA,2BAAA;AAEO,MAAMC,mBAAmB,GAAG,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFAH,OAAA,CAAAG,mBAAA,GAAAA,mBAAA;AAGO,MAAMC,gBAAwB,GAAGR,OAAO,CAAC,kBAAkB,CAAC;AACnE;AACA;AACA;AAFAI,OAAA,CAAAI,gBAAA,GAAAA,gBAAA;AAGO,MAAMC,YAAoB,GAAGT,OAAO,CAAC,cAAc,CAAC;AAC3D;AACA;AACA;AAFAI,OAAA,CAAAK,YAAA,GAAAA,YAAA;AAGO,MAAMC,KAAa,GAAGV,OAAO,CAAC,OAAO,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFAI,OAAA,CAAAM,KAAA,GAAAA,KAAA;AAGO,MAAMC,aAAqB,GAAGX,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AAFAI,OAAA,CAAAO,aAAA,GAAAA,aAAA;AAGO,MAAMC,aAAqB,GAAGZ,OAAO,CAAC,eAAe,CAAC;AAC7D;AACA;AACA;AAFAI,OAAA,CAAAQ,aAAA,GAAAA,aAAA;AAGO,MAAMC,aAAqB,GAAGb,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFAI,OAAA,CAAAS,aAAA,GAAAA,aAAA;AAGO,MAAMC,sBAA8B,GAAGd,OAAO,CAAC,wBAAwB,CAAC;AAC/E;AACA;AACA;AAFAI,OAAA,CAAAU,sBAAA,GAAAA,sBAAA;AAGO,MAAMC,kBAA0B,GAAGf,OAAO,CAAC,oBAAoB,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFAI,OAAA,CAAAW,kBAAA,GAAAA,kBAAA;AAGO,MAAMC,yBAAiC,GAAGhB,OAAO,CACtD,
|
|
1
|
+
{"version":3,"file":"LayoutHints.js","names":["_LayoutHintConfig","require","getHint","hint","LayoutHintConfiguration","MANDATORY","exports","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","_default","default"],"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,IAAAA,iBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA,MAAMC,OAAO,GAAIC,IAAY,IAAa;EACxC,IAAIC,yCAAuB,CAACD,IAAI,CAAC,EAAE;IACjC,OAAOC,yCAAuB,CAACD,IAAI,CAAC,CAACA,IAAI;EAC3C;EAEA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACO,MAAME,SAAiB,GAAGH,OAAO,CAAC,WAAW,CAAC;;AAErD;AACA;AACA;AACA;AAHAI,OAAA,CAAAD,SAA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;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFAI,OAAA,CAAAW,kBAAA,GAAAA,kBAAA;AAGO,MAAMC,yBAAiC,GAAGhB,OAAO,CACtD,2BACF,CAAC;AACD;AACA;AACA;AAFAI,OAAA,CAAAY,yBAAA,GAAAA,yBAAA;AAGO,MAAMC,eAAuB,GAAGjB,OAAO,CAAC,iBAAiB,CAAC;AACjE;AACA;AACA;AAFAI,OAAA,CAAAa,eAAA,GAAAA,eAAA;AAGO,MAAMC,cAAsB,GAAG,iBAAiB;AACvD;AACA;AACA;AAFAd,OAAA,CAAAc,cAAA,GAAAA,cAAA;AAGO,MAAMC,aAAqB,GAAGnB,OAAO,CAAC,eAAe,CAAC;;AAE7D;AACA;AACA;AAFAI,OAAA,CAAAe,aAAA,GAAAA,aAAA;AAGO,MAAMC,oBAAoB,GAAG,sBAAsB;;AAE1D;AACA;AADAhB,OAAA,CAAAgB,oBAAA,GAAAA,oBAAA;AAEO,MAAMC,0BAA0B,GAAGA,CAAA,KAAcnB,yCAAuB;AAACE,OAAA,CAAAiB,0BAAA,GAAAA,0BAAA;AAAA,IAAAC,QAAA,GAEjEtB,OAAO;AAAAI,OAAA,CAAAmB,OAAA,GAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","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","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","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,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UA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AAmB,GAAGgD,UAAU,EAAE;;AAE/C;AACA;AACA;AAFA5B,OAAA,CAAApB,WAAA,GAAAA,WAAA;AAGO,MAAMkD,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG9B,UAAU,CAC7B,iCAAiC,EACjC,kCAAkC,CACnC;EACD,IAAI,CAAC,IAAA+B,WAAA,CAAAjC,OAAA,EAAAgC,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAI,IAAGA,cAAe,EAAC;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFA/B,OAAA,CAAA8B,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAIxE,WAAmB,IAAK;EACrD4C,UAAU,CAAC,cAAc,EAAE5C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAqC,OAAA,CAAAmC,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAGzB,WAAW,EAAE;AAACX,OAAA,CAAAoC,IAAA,GAAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","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","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getUploadPath","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","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,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAcA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAA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AApB,WAAA,GAAAA,WAAA;AAGO,MAAMkD,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG9B,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAA+B,WAAA,CAAAjC,OAAA,EAAAgC,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAI,IAAGA,cAAe,EAAC;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFA/B,OAAA,CAAA8B,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAIxE,WAAmB,IAAK;EACrD4C,UAAU,CAAC,cAAc,EAAE5C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAqC,OAAA,CAAAmC,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAGzB,WAAW,CAAC,CAAC;AAACX,OAAA,CAAAoC,IAAA,GAAAA,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkException.js","names":["NetworkException","Error","constructor","url","method","_defineProperty2","default","name","id","status","_default","exports"],"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","_defineProperty2","default","name","id","status","_default","exports"],"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;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEF,IAAI,CAACC,IAAI,GAAG,kBAAkB;IAC9B,IAAI,CAACC,EAAE,GAAG,kBAAkB;IAC5B,IAAI,CAACC,MAAM,GAAG,CAAC;EACjB;AACF;AAAC,IAAAC,QAAA,GAEcV,gBAAgB;AAAAW,OAAA,CAAAL,OAAA,GAAAI,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAllFormsOnModel.js","names":["_react","require","_useModularUIRequest","_constants","_ListModel","_interopRequireDefault","_FormModel","useRetrieveFormsOnModel","model","modularui","useModularUIRequest","forms","setForms","useState","requestCount","setRequestCount","responseCount","setResponseCount","useEffect","_context","requests","_map","default","getActions","call","action","href","selfhref","addParameter","method","HTTP_METHODS","POST","fetch","then","form","FormModel","tokens","name","length","_promise","all","responses","actionForms","_assign","exports","_context2","actionCollection","createActions","_filter","getActionsByType","isDisabled","allActions","ListModel","listItemCollection","forEach","listItem","_context3","updateActions","push","actions","unique","_includes"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAMA;AACA;AACA;AACA;AACA;AACO,MAAMM,uBAAuB,GAClCC,KAAyC,IACM;EAC/C,MAAMC,SAAS,GAAG,IAAAC,wCAAmB,
|
|
1
|
+
{"version":3,"file":"useAllFormsOnModel.js","names":["_react","require","_useModularUIRequest","_constants","_ListModel","_interopRequireDefault","_FormModel","useRetrieveFormsOnModel","model","modularui","useModularUIRequest","forms","setForms","useState","requestCount","setRequestCount","responseCount","setResponseCount","useEffect","_context","requests","_map","default","getActions","call","action","href","selfhref","addParameter","method","HTTP_METHODS","POST","fetch","then","form","FormModel","tokens","name","length","_promise","all","responses","actionForms","_assign","exports","_context2","actionCollection","createActions","_filter","getActionsByType","isDisabled","allActions","ListModel","listItemCollection","forEach","listItem","_context3","updateActions","push","actions","unique","_includes"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAMA;AACA;AACA;AACA;AACA;AACO,MAAMM,uBAAuB,GAClCC,KAAyC,IACM;EAC/C,MAAMC,SAAS,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACvC,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAI,CAAC;EACxC,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAF,eAAQ,EAAC,CAAC,CAAC;EACnD,MAAM,CAACG,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAJ,eAAQ,EAAC,CAAC,CAAC;EAErD,IAAAK,gBAAS,EAAC,MAAM;IAAA,IAAAC,QAAA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AEA,MAAMC,aAAa,GAAG,IAAAC,OAAA,CAAA1B,OAAA,EAAAuB,SAAA,GAAArC,KAAK,CAACsC,gBAAgB,CACzCG,gBAAgB,CAAC,QAAQ,CAAC,EAAAzB,IAAA,CAAAqB,SAAA,EAClBpB,MAAM,IAAK,CAACA,MAAM,CAACyB,UAAU,CAAC;EAEzC,MAAMC,UAAU,GAAG,CAAC,GAAGJ,aAAa,CAAC;EAErC,IAAIvC,KAAK,YAAY4C,kBAAS,EAAE;IAC9B5C,KAAK,CAAC6C,kBAAkB,CAACC,OAAO,CAAEC,QAAQ,IAAK;MAAA,IAAAC,SAAA;MAC7C,MAAMC,aAAa,GAAG,IAAAT,OAAA,CAAA1B,OAAA,EAAAkC,SAAA,GAAAD,QAAQ,CAACT,gBAAgB,CAC5CG,gBAAgB,CAAC,QAAQ,CAAC,EAAAzB,IAAA,CAAAgC,SAAA,EAClB/B,MAAM,IAAK,CAACA,MAAM,CAACyB,UAAU,CAAC;MAEzCC,UAAU,CAACO,IAAI,CAAC,GAAGD,aAAa,CAAC;IACnC,CAAC,CAAC;EACJ;EAEA,MAAME,OAAO,GAAG,EAAE;EAClB,MAAMC,MAAM,GAAG,EAAE;EACjBT,UAAU,CAACG,OAAO,CAAE7B,MAAM,IAAK;IAC7B,IAAI,CAAC,IAAAoC,SAAA,CAAAvC,OAAA,EAAAsC,MAAM,EAAApC,IAAA,CAANoC,MAAM,EAAUnC,MAAM,CAACY,IAAI,CAAC,EAAE;MACjCuB,MAAM,CAACF,IAAI,CAACjC,MAAM,CAACY,IAAI,CAAC;MACxBsB,OAAO,CAACD,IAAI,CAACjC,MAAM,CAAC;IACtB;EACF,CAAC,CAAC;EAEF,OAAOkC,OAAO;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["_reactRedux","require","_ModularUISelectors","_actions","_Cache","_interopRequireDefault","_constants","_exceptions","useLogin","Cache","setItem","dispatch","useDispatch","application","useSelector","getApplication","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","DEFAULT_AUTHENTICATION_TYPE","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","getItem","IllegalStateException","authentication","redirectUri","window","location","assign","getBasePath","exports","useLogout","LOGOUT_PATH","logoutPath","BASE_PATH","logout","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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAQA,IAAAM,WAAA,GAAAN,OAAA;AAeA;AACA;AACO,MAAMO,QAAQ,GAAGA,CAAA,KAAiB;EACvCC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["_reactRedux","require","_ModularUISelectors","_actions","_Cache","_interopRequireDefault","_constants","_exceptions","useLogin","Cache","setItem","dispatch","useDispatch","application","useSelector","getApplication","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","DEFAULT_AUTHENTICATION_TYPE","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","getItem","IllegalStateException","authentication","redirectUri","window","location","assign","getBasePath","exports","useLogout","LOGOUT_PATH","logoutPath","BASE_PATH","logout","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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAQA,IAAAM,WAAA,GAAAN,OAAA;AAeA;AACA;AACO,MAAMO,QAAQ,GAAGA,CAAA,KAAiB;EACvCC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,MAAMC,WAAW,GAAG,IAAAC,uBAAW,EAACC,kCAAc,CAAC;EAC/C,MAAMC,IAAI,GAAG,IAAAF,uBAAW,EAAEG,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;EAE/C,MAAME,eAAe,GAAGL,WAAW,EAAEM,UAAU,IAAI,KAAK;EAExD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEP,WAAW,EAAEO,mBAAmB,IAAI,CACvDC,sCAA2B,CAC5B;IACDC,YAAY,EAAEN,IAAI,CAACO,KAAK;IACxBC,WAAW,EAAEA,CAAA,KAAMb,QAAQ,CAAC,IAAAc,wB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AM;QACrC,MAAMC,GAAG,GAAI,GAAED,MAAO,GAAEF,SAAU,eAAcE,MAAO,GAAEF,SAAU,GAAEF,WAAY,EAAC;QAClFhC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCyB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACS,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOnC,QAAQ,CAAC,IAAAiC,eAAM,EAAC,CAAC,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC;AAACL,OAAA,CAAAC,SAAA,GAAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContent.js","names":["_react","require","_SourceReferenceCollection","_interopRequireDefault","_ModularUIRequest","_useProgressIndicator","_useI18n","useContentFromSourceReferences","sourceReferences","renderChildSections","_context","_context2","content","setContent","useState","localeCode","useLocale","start","finish","useProgressIndicator","hrefs","_map","default","_filter","call","sourceReference","link","selfhref","href","index","self","indexOf","toString","allHrefs","_stringify","useEffect","_context3","requests","JSON","parse","modularuiRequest","ModularUIRequest","locale","fetchContent","_promise","all","then","responseContent","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAIA;AACA;AACA;AACO,MAAMM,8BAA8B,GAAGA,CAC5CC,gBAA2C,EAC3CC,mBAA4B,KACJ;EAAA,IAAAC,QAAA,EAAAC,SAAA;EACxB,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAC,EAAE,CAAC;EAC1C,MAAMC,UAAU,GAAG,IAAAC,kBAAS,
|
|
1
|
+
{"version":3,"file":"useContent.js","names":["_react","require","_SourceReferenceCollection","_interopRequireDefault","_ModularUIRequest","_useProgressIndicator","_useI18n","useContentFromSourceReferences","sourceReferences","renderChildSections","_context","_context2","content","setContent","useState","localeCode","useLocale","start","finish","useProgressIndicator","hrefs","_map","default","_filter","call","sourceReference","link","selfhref","href","index","self","indexOf","toString","allHrefs","_stringify","useEffect","_context3","requests","JSON","parse","modularuiRequest","ModularUIRequest","locale","fetchContent","_promise","all","then","responseContent","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAIA;AACA;AACA;AACO,MAAMM,8BAA8B,GAAGA,CAC5CC,gBAA2C,EAC3CC,mBAA4B,KACJ;EAAA,IAAAC,QAAA,EAAAC,SAAA;EACxB,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAC,EAAE,CAAC;EAC1C,MAAMC,UAAU,GAAG,IAAAC,kBAAS,EAAC,CAAC;EAE9B,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAG,IAAAC,0CAAoB,EAAC,CAAC;EAEhD,MAAMC,KAAK,GAAG,IAAAC,IAAA,CAAAC,OAA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AA,8BAAA"}
|
package/lib/hooks/useForm.js
CHANGED
|
@@ -15,7 +15,7 @@ var _FormModel = _interopRequireDefault(require("../models/form/FormModel"));
|
|
|
15
15
|
/**
|
|
16
16
|
* Load a form by href
|
|
17
17
|
*/
|
|
18
|
-
const useForm = href => {
|
|
18
|
+
const useForm = (href, data) => {
|
|
19
19
|
const formHref = new _Href.default(href);
|
|
20
20
|
if (!(0, _constants.getSetting)("ALWAYS_COMMIT_FORM")) {
|
|
21
21
|
formHref.addParameter("commit", "false");
|
|
@@ -23,7 +23,8 @@ const useForm = href => {
|
|
|
23
23
|
const form = (0, _useModularUI.useModularUI)("form", formHref, {
|
|
24
24
|
method: _constants.HTTP_METHODS.POST,
|
|
25
25
|
targetModel: _FormModel.default,
|
|
26
|
-
removeOnUnmount: true
|
|
26
|
+
removeOnUnmount: true,
|
|
27
|
+
data
|
|
27
28
|
});
|
|
28
29
|
if (form?.model) {
|
|
29
30
|
return form.model;
|
|
@@ -50,7 +50,7 @@ type AttributeUpdateHook = (
|
|
|
50
50
|
/**
|
|
51
51
|
* Load a form by href
|
|
52
52
|
*/
|
|
53
|
-
export const useForm = (href: string | Href): ?FormModel => {
|
|
53
|
+
export const useForm = (href: string | Href, data?: Object): ?FormModel => {
|
|
54
54
|
const formHref = new Href(href);
|
|
55
55
|
|
|
56
56
|
if (!getSetting("ALWAYS_COMMIT_FORM")) {
|
|
@@ -61,6 +61,7 @@ export const useForm = (href: string | Href): ?FormModel => {
|
|
|
61
61
|
method: HTTP_METHODS.POST,
|
|
62
62
|
targetModel: FormModel,
|
|
63
63
|
removeOnUnmount: true,
|
|
64
|
+
data,
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
if (form?.model) {
|
package/lib/hooks/useForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.js","names":["_reactRedux","require","_Href","_interopRequireDefault","_constants","_modularui","_useModularUI","_actions","_FormModel","useForm","href","formHref","Href","getSetting","addParameter","form","useModularUI","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","exports","useFormNavigation","dispatch","useDispatch","previous","previousObject","cancel","cancelForm","submit","loadModularUI","connectKey","selfhref","
|
|
1
|
+
{"version":3,"file":"useForm.js","names":["_reactRedux","require","_Href","_interopRequireDefault","_constants","_modularui","_useModularUI","_actions","_FormModel","useForm","href","data","formHref","Href","getSetting","addParameter","form","useModularUI","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","exports","useFormNavigation","dispatch","useDispatch","previous","previousObject","cancel","cancelForm","submit","loadModularUI","connectKey","selfhref","formdata","updateModel","remove","removeModelByKey","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","updateFormAttribute","useAttributeSet","save","addRepeatableAttributeSet","cancelRepeatableAttributeSet","removeRepeatableAttributeSet"],"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,IAAAA,WAAA,GAAAC,OAA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C9BjB,QAAQ,CAAC,IAAA0B,qCAA4B,EAACrC,IAAI,EAAE4B,MAAM,CAAC;EACvD,CAAC;AACH,CAAC;AAACnB,OAAA,CAAAwB,eAAA,GAAAA,eAAA"}
|
package/lib/hooks/useI18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.js","names":["_reactRedux","require","_reselect","_memoize","_interopRequireDefault","_i18n","getMessage","createSelector","getLocales","getLocale","locales","localeCode","memoize","id","defaultMessage","placeholders","_len","arguments","length","args","Array","_key","_stringify","default","useMessage","useSelector","exports","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,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,MAAMK,UAAU,GAAG,IAAAC,wBAAc,EAC/B,CAACC,gBAAU,EAAEC,eAAS,CAAC,EACvB,CAACC,OAAO,EAAEC,UAAU,KAClB,IAAAC,gBAAO,EACL,CAACC,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDL,OAAO,CACJD,SAAS,CAACE,UAAU,CAAC,CACrBL,UAAU,CAACO,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,OAAK,IAAAC,UAAA,CAAAC,OAAA,EAAeJ,IAAI,CAAC;AAAA,
|
|
1
|
+
{"version":3,"file":"useI18n.js","names":["_reactRedux","require","_reselect","_memoize","_interopRequireDefault","_i18n","getMessage","createSelector","getLocales","getLocale","locales","localeCode","memoize","id","defaultMessage","placeholders","_len","arguments","length","args","Array","_key","_stringify","default","useMessage","useSelector","exports","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,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,MAAMK,UAAU,GAAG,IAAAC,wBAAc,EAC/B,CAACC,gBAAU,EAAEC,eAAS,CAAC,EACvB,CAACC,OAAO,EAAEC,UAAU,KAClB,IAAAC,gBAAO,EACL,CAACC,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDL,OAAO,CACJD,SAAS,CAACE,UAAU,CAAC,CACrBL,UAAU,CAACO,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,OAAK,IAAAC,UAAA,CAAAC,OAAA,EAAeJ,IAAI,CAAC;AAAA,CACnC,CACJ,CAAC;;AAED;AACA;AACA,MAAMK,UAAU,GAAGA,CACjBX,EAAU,EACVC,cAAuB,EACvBC,YAA4B,KACpB,IAAAU,uBAAW,EAACnB,UAAU,CAAC,CAACO,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC;;AAEnE;AACA;AADAW,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAEA,MAAMG,YAAY,GAAGA,CAAA,KAAyB,IAAAF,uBAAW,EAACnB,UAAU,CAAC;;AAErE;AACA;AADAoB,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEA,MAAMC,SAAS,GAAGA,CAAA,KAAc,IAAAH,uBAAW,EAAChB,eAAS,CAAC;AAACiB,OAAA,CAAAE,SAAA,GAAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModal.js","names":["_react","require","_reactRedux","_Modals","_exceptions","useModal","modalId","IllegalArgumentException","dispatch","useDispatch","modal","useSelector","_ref","_context","modals","_find","default","call","m","key","show","useCallback","showModal","close","closeModal","size","visible","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAUA;AACA;AACA;AACO,MAAMI,QAAmB,GAAIC,OAAe,IAAK;EACtD,IAAI,CAACA,OAAO,EAAE;IACZ,MAAM,IAAIC,oCAAwB,CAChC,
|
|
1
|
+
{"version":3,"file":"useModal.js","names":["_react","require","_reactRedux","_Modals","_exceptions","useModal","modalId","IllegalArgumentException","dispatch","useDispatch","modal","useSelector","_ref","_context","modals","_find","default","call","m","key","show","useCallback","showModal","close","closeModal","size","visible","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAUA;AACA;AACA;AACO,MAAMI,QAAmB,GAAIC,OAAe,IAAK;EACtD,IAAI,CAACA,OAAO,EAAE;IACZ,MAAM,IAAIC,oCAAwB,CAChC,4CACF,CAAC;EACH;EAEA,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMC,KAAK,GAAG,IAAAC,uBAAW,EAACC,IAAA;IAAA,IAAAC,QAAA;IAAA,IAAC;MAAEC;IAAO,CAAC,GAAAF,IAAA;IAAA,OACnC,IAAAG,KAAA,CAAAC,OAAA,EAAAH,QAAA,GAAAC,MAAM,CAACA,MAAM,EAAAG,IAAA,CAAAJ,QAAA,EAAOK,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKb,OAAO,CAAC;EAAA,CAC9C,CAAC;EAED,MAAMc,IAAI,GAAG,IAAAC,kBAAW,EAAC,MAAM;IAC7Bb,QAAQ,CAAC,IAAAc,iBAAS,EAAChB,OAAO,CAAC,CAAC;EAC9B,CAAC,EAAE,CAACE,QAAQ,EAAEF,OAAO,CAAC,CAAC;EAEvB,MAAMiB,KAAK,GAAG,IAAAF,kBAAW,EAAC,MAAM;IAC9Bb,QAAQ,CAAC,IAAAgB,kBAAU,EAAClB,OAAO,CAAC,CAAC;EAC/B,CAAC,EAAE,CAACE,QAAQ,EAAEF,OAAO,CAAC,CAAC;EAEvB,OAAO;IACLa,GAAG,EAAET,KAAK,GAAGA,KAAK,CAACS,GAAG,GAAG,IAAI;IAC7BM,IAAI,EAAEf,KAAK,GAAGA,KAAK,CAACe,IAAI,GAAG,IAAI;IAC/BC,OAAO,EAAEhB,KAAK,GAAGA,KAAK,CAACgB,OAAO,GAAG,KAAK;IACtCN,IAAI;IACJG;EACF,CAAC;AACH,CAAC;AAACI,OAAA,CAAAtB,QAAA,GAAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["_useRouter","require","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","useModelCatalog","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","ConceptIndexModel","getHref","context","dynamic","location","_startsWith","default","call","replace","search","useConceptDetail","concept","useLocation","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel"],"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":";;;;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,EAAEK,MAAM,EAAE;IACpBV,IAAI,GAAI,GAAEA,IAAK,GAAEK,QAAQ,CAACK,MAAO,EAAC;EACpC;EAEA,OAAOV,IAAI;AACb,CAAC;;AAED;AACA;AACO,MAAMW,gBAAgB,GAC3BC,OAAe,IACkC;EACjD,MAAMP,QAAQ,GAAG,IAAAQ,sBAAW,
|
|
1
|
+
{"version":3,"file":"useModelCatalog.js","names":["_useRouter","require","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","useModelCatalog","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","ConceptIndexModel","getHref","context","dynamic","location","_startsWith","default","call","replace","search","useConceptDetail","concept","useLocation","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","contentSection","ContentModel","useContentType","contentType","ContentTypeModel"],"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,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,sBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sB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,WAAW,CAAC;EACjD,OAAO,IAAA7B,oCAAiB,EAAC,cAAc,EAAEM,IAAI,EAAE;IAC7CL,cAAc,EAAE,CAAC,aAAa,CAAC;IAC/BC,WAAW,EAAE4B;EACf,CAAC,CAAC;AACJ,CAAC;AAAC1B,OAAA,CAAAwB,cAAA,GAAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModels.js","names":["_reactRedux","require","_ModularUIActions","useModels","dispatch","useDispatch","reload","model","options","reloadModel","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAQA;AACA;AACA;AACO,MAAME,SAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,
|
|
1
|
+
{"version":3,"file":"useModels.js","names":["_reactRedux","require","_ModularUIActions","useModels","dispatch","useDispatch","reload","model","options","reloadModel","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAQA;AACA;AACA;AACO,MAAME,SAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,OAAO;IACLC,MAAM,EAAEA,CAACC,KAAqB,EAAEC,OAAgB,KAAK;MACnDJ,QAAQ,CAAC,IAAAK,6BAAW,EAACF,KAAK,EAAEC,OAAO,CAAC,CAAC;IACvC;EACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAP,SAAA,GAAAA,SAAA"}
|