@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repositoryResource.js","names":["_constants","require","getRepositoryResourceUrl","resourceUrl","basePath","getBasePath","_startsWith","default","call","RESOURCE_PATH","exports"],"sources":["../../../src/utils/helpers/repositoryResource.js"],"sourcesContent":["// @flow\nimport { getBasePath, RESOURCE_PATH } from \"../../constants\";\n\n/**\n * Creates an url to a resource in the Be Informed repository\n * Only possible when serving using the UI Servlet of Be Informed\n */\nexport const getRepositoryResourceUrl = (resourceUrl: string): string => {\n const basePath = getBasePath();\n\n if (resourceUrl.startsWith(basePath)) {\n return resourceUrl;\n }\n\n if (resourceUrl.startsWith(RESOURCE_PATH)) {\n return `${basePath}${resourceUrl}`;\n }\n\n return `${basePath}${RESOURCE_PATH}${resourceUrl}`;\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAIC,WAAmB,IAAa;EACvE,MAAMC,QAAQ,GAAG,IAAAC,sBAAW,
|
|
1
|
+
{"version":3,"file":"repositoryResource.js","names":["_constants","require","getRepositoryResourceUrl","resourceUrl","basePath","getBasePath","_startsWith","default","call","RESOURCE_PATH","exports"],"sources":["../../../src/utils/helpers/repositoryResource.js"],"sourcesContent":["// @flow\nimport { getBasePath, RESOURCE_PATH } from \"../../constants\";\n\n/**\n * Creates an url to a resource in the Be Informed repository\n * Only possible when serving using the UI Servlet of Be Informed\n */\nexport const getRepositoryResourceUrl = (resourceUrl: string): string => {\n const basePath = getBasePath();\n\n if (resourceUrl.startsWith(basePath)) {\n return resourceUrl;\n }\n\n if (resourceUrl.startsWith(RESOURCE_PATH)) {\n return `${basePath}${resourceUrl}`;\n }\n\n return `${basePath}${RESOURCE_PATH}${resourceUrl}`;\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAIC,WAAmB,IAAa;EACvE,MAAMC,QAAQ,GAAG,IAAAC,sBAAW,EAAC,CAAC;EAE9B,IAAI,IAAAC,WAAA,CAAAC,OAAA,EAAAJ,WAAW,EAAAK,IAAA,CAAXL,WAAW,EAAYC,QAAQ,CAAC,EAAE;IACpC,OAAOD,WAAW;EACpB;EAEA,IAAI,IAAAG,WAAA,CAAAC,OAAA,EAAAJ,WAAW,EAAAK,IAAA,CAAXL,WAAW,EAAYM,wBAAa,CAAC,EAAE;IACzC,OAAQ,GAAEL,QAAS,GAAED,WAAY,EAAC;EACpC;EAEA,OAAQ,GAAEC,QAAS,GAAEK,wBAAc,GAAEN,WAAY,EAAC;AACpD,CAAC;AAACO,OAAA,CAAAR,wBAAA,GAAAA,wBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeHtml.js","names":["_he","_interopRequireDefault","require","_exceptions","properEntityEncoding","html","escapedGt","replace","escapedLt","properEntities","he","encode","decode","decimal","unescapedGt","removeUnwantedHtml","options","arguments","length","undefined","allowedTags","IllegalArgumentException","correctEntityHtml","htmlWithoutAttributes","htmlWithCorrectBR","Array","isArray","join","pattern","regex","RegExp","exports"],"sources":["../../../src/utils/helpers/sanitizeHtml.js"],"sourcesContent":["// @flow\nimport he from \"he\";\n\nimport { IllegalArgumentException } from \"../../exceptions\";\n\ntype removeUnwantedHtmlOptions = {\n allowedTags?: Array<string>,\n};\n\n/**\n * Translates html entities to their correct decimal equivalent\n * When path is only one deep better use optional chaining\n */\nconst properEntityEncoding = (html: string) => {\n const escapedGt = html.replace(/</g, \"[\");\n const escapedLt = escapedGt.replace(/>/g, \"]\");\n\n const properEntities = he.encode(he.decode(escapedLt), {\n decimal: true,\n });\n\n const unescapedGt = properEntities.replace(/\\[/g, \"<\");\n\n return unescapedGt.replace(/]/g, \">\");\n};\n\n/**\n * removes unwanted html, this might result in incorrect html, as it removes all html that we don't except,\n * like <b style=\"font-weight: 400\">bold</b> will result in bold</b>\n */\nconst removeUnwantedHtml = (\n html: string,\n options: removeUnwantedHtmlOptions = {\n allowedTags: [\"p\", \"br\", \"b\", \"i\", \"u\", \"strike\"],\n }\n): string => {\n if (typeof html !== \"string\") {\n throw new IllegalArgumentException(\"sanitizeHTML method expects a string\");\n }\n\n const correctEntityHtml = properEntityEncoding(html);\n\n // remove attributes from html elements\n const htmlWithoutAttributes = correctEntityHtml.replace(\n /<(\\w+)(.|[\\r\\n])*?>/gi,\n \"<$1>\"\n );\n\n const htmlWithCorrectBR = htmlWithoutAttributes.replace(\n /<br\\s*>/gi,\n \"<br />\"\n );\n\n // remove not allowed tags\n const allowedTags = Array.isArray(options.allowedTags)\n ? options.allowedTags.join(\"|\")\n : \"\";\n const pattern = `<(?!\\\\/?(${allowedTags})(>|\\\\s\\\\/))[^<]+?>`;\n const regex = new RegExp(pattern, \"gi\");\n\n return htmlWithCorrectBR.replace(regex, \"\");\n};\n\nexport { removeUnwantedHtml };\n"],"mappings":";;;;;;;AACA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACA;AACA,MAAME,oBAAoB,GAAIC,IAAY,IAAK;EAC7C,MAAMC,SAAS,GAAGD,IAAI,CAACE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;EACzC,MAAMC,SAAS,GAAGF,SAAS,CAACC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;EAE9C,MAAME,cAAc,GAAGC,WAAE,CAACC,MAAM,CAACD,WAAE,CAACE,MAAM,CAACJ,SAAS,CAAC,EAAE;IACrDK,OAAO,EAAE;EACX,CAAC,CAAC;EAEF,MAAMC,WAAW,GAAGL,cAAc,CAACF,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAEtD,OAAOO,WAAW,CAACP,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AACvC,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMQ,kBAAkB,GAAG,SAAAA,CACzBV,IAAY,EAID;EAAA,IAHXW,OAAkC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACnCG,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ;EAClD,CAAC;EAED,IAAI,OAAOf,IAAI,KAAK,QAAQ,EAAE;IAC5B,MAAM,IAAIgB,oCAAwB,CAAC,sCAAsC,CAAC;EAC5E;EAEA,MAAMC,iBAAiB,GAAGlB,oBAAoB,CAACC,IAAI,CAAC;;EAEpD;EACA,MAAMkB,qBAAqB,GAAGD,iBAAiB,CAACf,OAAO,CACrD,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"sanitizeHtml.js","names":["_he","_interopRequireDefault","require","_exceptions","properEntityEncoding","html","escapedGt","replace","escapedLt","properEntities","he","encode","decode","decimal","unescapedGt","removeUnwantedHtml","options","arguments","length","undefined","allowedTags","IllegalArgumentException","correctEntityHtml","htmlWithoutAttributes","htmlWithCorrectBR","Array","isArray","join","pattern","regex","RegExp","exports"],"sources":["../../../src/utils/helpers/sanitizeHtml.js"],"sourcesContent":["// @flow\nimport he from \"he\";\n\nimport { IllegalArgumentException } from \"../../exceptions\";\n\ntype removeUnwantedHtmlOptions = {\n allowedTags?: Array<string>,\n};\n\n/**\n * Translates html entities to their correct decimal equivalent\n * When path is only one deep better use optional chaining\n */\nconst properEntityEncoding = (html: string) => {\n const escapedGt = html.replace(/</g, \"[\");\n const escapedLt = escapedGt.replace(/>/g, \"]\");\n\n const properEntities = he.encode(he.decode(escapedLt), {\n decimal: true,\n });\n\n const unescapedGt = properEntities.replace(/\\[/g, \"<\");\n\n return unescapedGt.replace(/]/g, \">\");\n};\n\n/**\n * removes unwanted html, this might result in incorrect html, as it removes all html that we don't except,\n * like <b style=\"font-weight: 400\">bold</b> will result in bold</b>\n */\nconst removeUnwantedHtml = (\n html: string,\n options: removeUnwantedHtmlOptions = {\n allowedTags: [\"p\", \"br\", \"b\", \"i\", \"u\", \"strike\"],\n }\n): string => {\n if (typeof html !== \"string\") {\n throw new IllegalArgumentException(\"sanitizeHTML method expects a string\");\n }\n\n const correctEntityHtml = properEntityEncoding(html);\n\n // remove attributes from html elements\n const htmlWithoutAttributes = correctEntityHtml.replace(\n /<(\\w+)(.|[\\r\\n])*?>/gi,\n \"<$1>\"\n );\n\n const htmlWithCorrectBR = htmlWithoutAttributes.replace(\n /<br\\s*>/gi,\n \"<br />\"\n );\n\n // remove not allowed tags\n const allowedTags = Array.isArray(options.allowedTags)\n ? options.allowedTags.join(\"|\")\n : \"\";\n const pattern = `<(?!\\\\/?(${allowedTags})(>|\\\\s\\\\/))[^<]+?>`;\n const regex = new RegExp(pattern, \"gi\");\n\n return htmlWithCorrectBR.replace(regex, \"\");\n};\n\nexport { removeUnwantedHtml };\n"],"mappings":";;;;;;;AACA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACA;AACA,MAAME,oBAAoB,GAAIC,IAAY,IAAK;EAC7C,MAAMC,SAAS,GAAGD,IAAI,CAACE,O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AAE,IAAI,CAAC;EAEvC,OAAOJ,iBAAiB,CAACjB,OAAO,CAACsB,KAAK,EAAE,EAAE,CAAC;AAC7C,CAAC;AAACE,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA"}
|
|
@@ -12,22 +12,18 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
|
12
12
|
/**
|
|
13
13
|
*/
|
|
14
14
|
class DecimalFormat {
|
|
15
|
-
// Grouping size
|
|
16
|
-
|
|
17
|
-
// Minimum integer digits to be displayed
|
|
18
|
-
|
|
19
|
-
// Minimum fractional digits to be displayed
|
|
20
|
-
|
|
21
|
-
// Maximum fractional digits to be displayed
|
|
22
|
-
|
|
23
15
|
/**
|
|
24
16
|
*/
|
|
25
17
|
constructor(format) {
|
|
26
18
|
(0, _defineProperty2.default)(this, "_prefix", void 0);
|
|
27
19
|
(0, _defineProperty2.default)(this, "_suffix", void 0);
|
|
20
|
+
// Grouping size
|
|
28
21
|
(0, _defineProperty2.default)(this, "_comma", void 0);
|
|
22
|
+
// Minimum integer digits to be displayed
|
|
29
23
|
(0, _defineProperty2.default)(this, "_minInt", void 0);
|
|
24
|
+
// Minimum fractional digits to be displayed
|
|
30
25
|
(0, _defineProperty2.default)(this, "_minFrac", void 0);
|
|
26
|
+
// Maximum fractional digits to be displayed
|
|
31
27
|
(0, _defineProperty2.default)(this, "_maxFrac", void 0);
|
|
32
28
|
(0, _defineProperty2.default)(this, "_isPercentage", void 0);
|
|
33
29
|
this.setAffix(format);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecimalFormat.js","names":["DecimalFormat","constructor","format","_defineProperty2","default","setAffix","setFractionLengths","setGroupLength","setMinLength","setPercentage","prefix","_prefix","suffix","_suffix","comma","_comma","minInt","_minInt","minFrac","_minFrac","maxFrac","_maxFrac","isPercentage","_isPercentage","beforeDigit","_includes","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","_startsWith","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","_default","exports"],"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;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAC1B,IAAI,CAACC,QAAQ,CAACH,MAAM,CAAC;IACrB,IAAI,CAACI,kBAAkB,CAACJ,MAAM,CAAC;IAC/B,IAAI,CAACK,cAAc,CAACL,MAAM,CAAC;IAC3B,IAAI,CAACM,YAAY,CAACN,MAAM,CAAC;IAEzB,IAAI,CAACO,aAAa,EAAE;EACtB;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACC,OAAO;EACrB;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAAW;IACnB,OAAO,IAA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;IAEA,IAAIK,OAAO,GAAGhC,aAAa,CAAC+D,WAAW,CAAClB,eAAe,CAAC;IACxD,IAAIZ,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;AAAC,IAAAO,QAAA,GAEcjF,aAAa;AAAAkF,OAAA,CAAA9E,OAAA,GAAA6E,QAAA"}
|
|
1
|
+
{"version":3,"file":"DecimalFormat.js","names":["DecimalFormat","constructor","format","_defineProperty2","default","setAffix","setFractionLengths","setGroupLength","setMinLength","setPercentage","prefix","_prefix","suffix","_suffix","comma","_comma","minInt","_minInt","minFrac","_minFrac","maxFrac","_maxFrac","isPercentage","_isPercentage","beforeDigit","_includes","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","_startsWith","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","_default","exports"],"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;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAd5B;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAGA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAEA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAQE,IAAI,CAACC,QAAQ,CAACH,MAAM,CAAC;IACrB,IAAI,CAACI,kBAAkB,CAACJ,MAAM,CAAC;IAC/B,IAAI,CAACK,cAAc,CAACL,MAAM,CAAC;IAC3B,IAAI,CAACM,YAAY,CAACN,MAAM,CAAC;IAEzB,IAAI,CAACO,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;;EA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;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;AAAC,IAAAO,QAAA,GAEcjF,aAAa;AAAAkF,OAAA,CAAA9E,OAAA,GAAA6E,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatValue.js","names":["_exceptions","require","_DecimalFormat","_interopRequireDefault","_parseNumbers","updateGroupingSeparator","input","groupingSeparator","replace","formatValue","value","format","arguments","length","undefined","decimalSeparator","numberValue","parseToNumber","IllegalArgumentException","stringValue","parseNumberToString","formattedValue","DecimalFormat","integer","decimal","split","integerPart","_default","exports","default"],"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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA,MAAMI,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,GACL,IAAAO,2BAAa,EAACP,KAAK,EAAEH,iBAAiB,EAAEQ,gBAAgB,CAAC;EAE/D,IAAI,OAAOC,WAAW,KAAK,QAAQ,EAAE;IACnC,MAAM,IAAIE,oCAAwB,CAC/B,uBAAsBR,KAAM,
|
|
1
|
+
{"version":3,"file":"formatValue.js","names":["_exceptions","require","_DecimalFormat","_interopRequireDefault","_parseNumbers","updateGroupingSeparator","input","groupingSeparator","replace","formatValue","value","format","arguments","length","undefined","decimalSeparator","numberValue","parseToNumber","IllegalArgumentException","stringValue","parseNumberToString","formattedValue","DecimalFormat","integer","decimal","split","integerPart","_default","exports","default"],"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,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,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O,EAAEhB,iBAAiB,CAAC;IAEvE,IAAIiB,OAAO,EAAE;MACX,OAAQ,GAAEE,WAAY,GAAEX,gBAAiB,GAAES,OAAQ,EAAC;IACtD;IAEA,OAAOE,WAAW;EACpB;EAEA,OAAOP,WAAW;AACpB,CAAC;AAAC,IAAAQ,QAAA,GAEalB,WAAW;AAAAmB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseNumbers.js","names":["_big","_interopRequireDefault","require","removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","arguments","length","undefined","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","exports","parseNumberToString","big","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,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;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","_interopRequireDefault","require","removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","arguments","length","undefined","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","exports","parseNumberToString","big","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,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;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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,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,OAAO,IAAAW,YAAG,EAACJ,4BAA4B,CAAC,CAACK,OAAO,CAAC,CAAC;EACpD,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,OAAO,KAAK;EACd;AACF,CAAC;AAACJ,OAAA,CAAAC,mBAAA,GAAAA,mBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"clean:proxies": "node .build/proxies.js --clean",
|
|
27
27
|
"lint": "eslint --cache .",
|
|
28
28
|
"prettier": "prettier --write \"./{src,.flow}/**/*.js\"",
|
|
29
|
-
"flow": "flow
|
|
29
|
+
"flow": "flow",
|
|
30
30
|
"flow:ci": "flow check",
|
|
31
31
|
"flow-typed-install": "flow-typed install -l .flow/flow-typed/ --ignoreDeps peer --overwrite",
|
|
32
32
|
"test": "jest",
|
|
@@ -82,77 +82,77 @@
|
|
|
82
82
|
"styled-components": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@babel/runtime-corejs3": "^7.
|
|
85
|
+
"@babel/runtime-corejs3": "^7.22.5",
|
|
86
86
|
"big.js": "^6.2.1",
|
|
87
|
-
"date-fns": "^2.
|
|
87
|
+
"date-fns": "^2.30.0",
|
|
88
88
|
"deepmerge": "^4.3.1",
|
|
89
89
|
"dequal": "^2.0.3",
|
|
90
90
|
"file-size": "^1.0.0",
|
|
91
91
|
"format-message": "^6.2.4",
|
|
92
92
|
"he": "^1.2.0",
|
|
93
93
|
"iban": "^0.0.14",
|
|
94
|
-
"js-cookie": "^3.0.
|
|
94
|
+
"js-cookie": "^3.0.5",
|
|
95
95
|
"klona": "^2.0.6",
|
|
96
96
|
"lodash": "^4.17.21",
|
|
97
|
-
"reselect": "^4.1.
|
|
97
|
+
"reselect": "^4.1.8",
|
|
98
98
|
"setimmediate": "^1.0.5"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@babel/cli": "^7.
|
|
102
|
-
"@babel/core": "^7.
|
|
103
|
-
"@babel/eslint-parser": "^7.
|
|
104
|
-
"@babel/eslint-plugin": "^7.
|
|
101
|
+
"@babel/cli": "^7.22.5",
|
|
102
|
+
"@babel/core": "^7.22.5",
|
|
103
|
+
"@babel/eslint-parser": "^7.22.5",
|
|
104
|
+
"@babel/eslint-plugin": "^7.22.5",
|
|
105
105
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
106
106
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
107
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
108
|
-
"@babel/preset-env": "^7.
|
|
109
|
-
"@babel/preset-flow": "^7.
|
|
110
|
-
"@babel/preset-react": "^7.
|
|
111
|
-
"@commitlint/cli": "^17.
|
|
112
|
-
"@commitlint/config-conventional": "^17.
|
|
107
|
+
"@babel/plugin-transform-runtime": "^7.22.5",
|
|
108
|
+
"@babel/preset-env": "^7.22.5",
|
|
109
|
+
"@babel/preset-flow": "^7.22.5",
|
|
110
|
+
"@babel/preset-react": "^7.22.5",
|
|
111
|
+
"@commitlint/cli": "^17.6.6",
|
|
112
|
+
"@commitlint/config-conventional": "^17.6.6",
|
|
113
113
|
"@testing-library/react": "^14.0.0",
|
|
114
|
-
"auditjs": "^4.0.
|
|
114
|
+
"auditjs": "^4.0.40",
|
|
115
115
|
"babel-jest": "^29.5.0",
|
|
116
|
-
"babel-plugin-styled-components": "^2.
|
|
116
|
+
"babel-plugin-styled-components": "^2.1.4",
|
|
117
117
|
"cherry-pick": "^0.5.0",
|
|
118
|
-
"commit-and-tag-version": "^11.2.
|
|
118
|
+
"commit-and-tag-version": "^11.2.2",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
|
-
"documentation": "^14.0.
|
|
121
|
-
"eslint": "^8.
|
|
122
|
-
"eslint-config-prettier": "^8.
|
|
120
|
+
"documentation": "^14.0.2",
|
|
121
|
+
"eslint": "^8.43.0",
|
|
122
|
+
"eslint-config-prettier": "^8.8.0",
|
|
123
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
124
|
"eslint-plugin-ft-flow": "^2.0.3",
|
|
125
125
|
"eslint-plugin-import": "^2.27.5",
|
|
126
|
-
"eslint-plugin-jest": "^27.2.
|
|
127
|
-
"eslint-plugin-jsdoc": "^
|
|
126
|
+
"eslint-plugin-jest": "^27.2.2",
|
|
127
|
+
"eslint-plugin-jsdoc": "^46.4.2",
|
|
128
128
|
"eslint-plugin-react": "^7.32.2",
|
|
129
129
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
130
130
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
|
|
131
131
|
"flow-bin": "^0.200.1",
|
|
132
132
|
"flow-copy-source": "^2.0.9",
|
|
133
133
|
"flow-typed": "^3.8.0",
|
|
134
|
-
"glob": "^
|
|
134
|
+
"glob": "^10.3.1",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
136
|
"husky": "^8.0.3",
|
|
137
137
|
"jest": "^29.5.0",
|
|
138
138
|
"jest-environment-jsdom": "^29.5.0",
|
|
139
|
-
"jest-junit": "^
|
|
139
|
+
"jest-junit": "^16.0.0",
|
|
140
140
|
"jest-sonar-reporter": "^2.0.0",
|
|
141
|
-
"jscodeshift": "^0.
|
|
142
|
-
"lint-staged": "^13.2.
|
|
141
|
+
"jscodeshift": "^0.15.0",
|
|
142
|
+
"lint-staged": "^13.2.3",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^2.8.
|
|
144
|
+
"prettier": "^2.8.8",
|
|
145
145
|
"react": "^18.0.0",
|
|
146
146
|
"react-dom": "^18.0.0",
|
|
147
147
|
"react-helmet-async": "^1.0.0",
|
|
148
|
-
"react-redux": "^8.
|
|
148
|
+
"react-redux": "^8.1.1",
|
|
149
149
|
"react-router": "^5.0.0",
|
|
150
150
|
"react-test-renderer": "^18.1.0",
|
|
151
151
|
"redux": "^4.2.1",
|
|
152
152
|
"redux-mock-store": "^1.5.4",
|
|
153
153
|
"redux-thunk": "^2.4.2",
|
|
154
|
-
"rimraf": "^
|
|
155
|
-
"styled-components": "^5.3.
|
|
154
|
+
"rimraf": "^5.0.1",
|
|
155
|
+
"styled-components": "^5.3.11",
|
|
156
156
|
"xhr-mock": "^2.5.1"
|
|
157
157
|
},
|
|
158
158
|
"scarfSettings": {
|
package/src/hooks/useForm.js
CHANGED
|
@@ -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) {
|
|
@@ -253,7 +253,7 @@ export default class BooleanAttributeModel extends AttributeModel {
|
|
|
253
253
|
} else if (typeof value === "string" && this.isMultiple) {
|
|
254
254
|
values = value.split(",");
|
|
255
255
|
} else {
|
|
256
|
-
values = [value];
|
|
256
|
+
values = [value.toString()];
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
values.forEach((val) => {
|
|
@@ -61,6 +61,20 @@ describe("booleanAttributeModel", () => {
|
|
|
61
61
|
expect(attribute.getFormData()).toStrictEqual({ boolean: false });
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
it("handles update empty string", () => {
|
|
65
|
+
const data = { key: "boolean", value: null };
|
|
66
|
+
const contributions = { label: "Boolean", type: "boolean" };
|
|
67
|
+
|
|
68
|
+
const attribute = new BooleanAttributeModel(data, contributions);
|
|
69
|
+
|
|
70
|
+
attribute.update(false);
|
|
71
|
+
expect(attribute.value).toBe("false");
|
|
72
|
+
attribute.reset();
|
|
73
|
+
expect(attribute.value).toBe(null);
|
|
74
|
+
|
|
75
|
+
expect(attribute.getFormData()).toStrictEqual({ boolean: null });
|
|
76
|
+
});
|
|
77
|
+
|
|
64
78
|
it("should return proper AttributeWidth for attribute with alternative label", () => {
|
|
65
79
|
const attribute = new BooleanAttributeModel(
|
|
66
80
|
{},
|
|
@@ -51,6 +51,7 @@ class FormModel extends ResourceModel {
|
|
|
51
51
|
_commit: boolean;
|
|
52
52
|
_isFinished: boolean;
|
|
53
53
|
_isComplete: boolean;
|
|
54
|
+
_success: { redirect: string, data: Object } | null;
|
|
54
55
|
|
|
55
56
|
_parameters: Array<Parameter>;
|
|
56
57
|
_tokens: Array<string>;
|
|
@@ -72,6 +73,8 @@ class FormModel extends ResourceModel {
|
|
|
72
73
|
if (this.data.errors) {
|
|
73
74
|
this.handleRootErrors(this.data.errors);
|
|
74
75
|
}
|
|
76
|
+
|
|
77
|
+
this.createSuccess();
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
|
@@ -574,7 +577,7 @@ class FormModel extends ResourceModel {
|
|
|
574
577
|
* Inidicates if form is finished: Form is completely entered and committed
|
|
575
578
|
*/
|
|
576
579
|
get isFinished(): boolean {
|
|
577
|
-
return this._isFinished ||
|
|
580
|
+
return this._isFinished || this.success != undefined;
|
|
578
581
|
}
|
|
579
582
|
|
|
580
583
|
/**
|
|
@@ -600,8 +603,8 @@ class FormModel extends ResourceModel {
|
|
|
600
603
|
* Handle success redirects
|
|
601
604
|
*/
|
|
602
605
|
get successRedirect(): Href | null {
|
|
603
|
-
return this.isFinished && this.
|
|
604
|
-
? new Href(this.
|
|
606
|
+
return this.isFinished && this.success
|
|
607
|
+
? new Href(this.success.redirect)
|
|
605
608
|
: null;
|
|
606
609
|
}
|
|
607
610
|
|
|
@@ -615,7 +618,7 @@ class FormModel extends ResourceModel {
|
|
|
615
618
|
* Get the result data as plain json object
|
|
616
619
|
*/
|
|
617
620
|
getSuccessData(): ?Object {
|
|
618
|
-
return this.
|
|
621
|
+
return this.success?.data;
|
|
619
622
|
}
|
|
620
623
|
|
|
621
624
|
/**
|
|
@@ -888,6 +891,8 @@ class FormModel extends ResourceModel {
|
|
|
888
891
|
*/
|
|
889
892
|
setPreviousObject() {
|
|
890
893
|
this.isComplete = false;
|
|
894
|
+
this.isFinished = false;
|
|
895
|
+
this.success = null;
|
|
891
896
|
|
|
892
897
|
const oldCurrentFormObject = this.currentFormObject;
|
|
893
898
|
|
|
@@ -985,6 +990,7 @@ class FormModel extends ResourceModel {
|
|
|
985
990
|
|
|
986
991
|
this.isComplete = receivedForm.isComplete;
|
|
987
992
|
this.isFinished = receivedForm.isFinished;
|
|
993
|
+
this.success = receivedForm.success;
|
|
988
994
|
|
|
989
995
|
const receivedFormData = receivedForm.data ?? {};
|
|
990
996
|
const hasMissing = has(receivedFormData, "missing");
|
|
@@ -1016,6 +1022,28 @@ class FormModel extends ResourceModel {
|
|
|
1016
1022
|
return this;
|
|
1017
1023
|
}
|
|
1018
1024
|
|
|
1025
|
+
/**
|
|
1026
|
+
* Retrieve success information from response
|
|
1027
|
+
* @returns {{redirect: string, data: object}}
|
|
1028
|
+
*/
|
|
1029
|
+
get success(): { redirect: string, data: Object } | null {
|
|
1030
|
+
return this._success;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Set success information, contains redirect and event data
|
|
1035
|
+
* @param success
|
|
1036
|
+
*/
|
|
1037
|
+
set success(success: { redirect: string, data: Object } | null) {
|
|
1038
|
+
this._success = success;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
*/
|
|
1043
|
+
createSuccess() {
|
|
1044
|
+
this._success = this.data.success;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1019
1047
|
/**
|
|
1020
1048
|
* Process finished form
|
|
1021
1049
|
*/
|
|
@@ -458,11 +458,15 @@ describe("formModel", () => {
|
|
|
458
458
|
expect(form.completedFormObjects).toHaveLength(2);
|
|
459
459
|
expect(form.allObjects).toHaveLength(2);
|
|
460
460
|
expect(form.currentFormObject).toBeNull();
|
|
461
|
+
expect(form.success).toStrictEqual({ redirect: "/endredirect" });
|
|
462
|
+
expect(form.isFinished).toBe(true);
|
|
461
463
|
|
|
462
464
|
form.setPreviousObject();
|
|
463
465
|
expect(form.completedFormObjects).toHaveLength(1);
|
|
464
466
|
expect(form.currentFormObject).toBeInstanceOf(FormObjectModel);
|
|
465
467
|
expect(form.hasNextStep).toBeFalsy();
|
|
468
|
+
expect(form.success).toBeNull();
|
|
469
|
+
expect(form.isFinished).toBe(false);
|
|
466
470
|
});
|
|
467
471
|
|
|
468
472
|
it("is able to get formdata for request", () => {
|
|
@@ -29,8 +29,8 @@ export default class LayoutHintCollection extends BaseCollection<string> {
|
|
|
29
29
|
/**
|
|
30
30
|
* Checks if a specific layouthint exists in the component configuration
|
|
31
31
|
* This method matches all exact matches and hints starting with. For example
|
|
32
|
-
* when calling layouth.has("hide"), this will return true for both "hide" and "hide-when-empty"
|
|
33
|
-
* If only exact matches are required, use the method {@link hasExact}.
|
|
32
|
+
* when calling layouth.has("hide"), this will return true for both "hide" and "hide-when-empty".<br>
|
|
33
|
+
* If only exact matches are required, use the method {@link LayoutHintCollection#hasExact}.
|
|
34
34
|
*/
|
|
35
35
|
has(...hints: Array<string>): boolean {
|
|
36
36
|
const hintArray = hints.length > 0 ? [...hints] : [];
|
|
@@ -46,8 +46,8 @@ export default class LayoutHintCollection extends BaseCollection<string> {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Checks if a specific layouthint exists in the component configuration,
|
|
49
|
-
* only checks on exact matches
|
|
50
|
-
* If layouthints that start with the given hint should also match, use {@link has}.
|
|
49
|
+
* only checks on exact matches.<br>
|
|
50
|
+
* If layouthints that start with the given hint should also match, use {@link LayoutHintCollection#has}.
|
|
51
51
|
* @param hints
|
|
52
52
|
* @returns {boolean}
|
|
53
53
|
*/
|
|
@@ -97,7 +97,7 @@ class SortingModel extends BaseCollection<SortOptionModel> {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* @see {@link getUpdateQuerystring}
|
|
100
|
+
* @see {@link SortingModel#getUpdateQuerystring}
|
|
101
101
|
*/
|
|
102
102
|
getUpdateQuerystringBySortOption(sortOption: SortOptionModel): string {
|
|
103
103
|
if (!(sortOption instanceof SortOptionModel)) {
|