@beinformed/ui 1.31.0 → 1.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/esm/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/FetchException.js.map +1 -1
- package/esm/exceptions/NetworkException.js.map +1 -1
- package/esm/exceptions/UnauthorizedException.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/useDeepCompareEffect.js.map +1 -1
- 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/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/hooks/useModularUIRequest.js.map +1 -1
- package/esm/hooks/useNotification.js.map +1 -1
- package/esm/hooks/usePreference.js +8 -2
- package/esm/hooks/usePreference.js.map +1 -1
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/i18n/Message.js.map +1 -1
- package/esm/i18n/withMessage.js.map +1 -1
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/actions/ActionModel.js.map +1 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/AttributeSetModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
- package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/esm/models/attributes/StringAttributeModel.js.map +1 -1
- package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
- package/esm/models/attributes/_createAttribute.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/esm/models/attributes/input-constraints/ConstraintModel.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/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/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/esm/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/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/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/ContentConfigurationEndResults.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/filters/AssignmentFilterModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js.map +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/grouping/GroupingModel.js.map +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/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/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/types.js.map +1 -1
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/react/utils.js.map +1 -1
- package/esm/react-client/client.js +1 -0
- 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/createSSRComplete.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/serverUtil.js.map +1 -1
- package/esm/react-theme/createTheme.js.map +1 -1
- package/esm/react-theme/utils/colors.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/types.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/_router/RouterActions.js.map +1 -1
- package/esm/redux/_router/RouterConnectors.js.map +1 -1
- package/esm/redux/_router/RouterReducer.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/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/ProgressIndicator.js.map +1 -1
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/connectors/Application.js.map +1 -1
- package/esm/redux/connectors/Breadcrumb.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/Modal.js.map +1 -1
- package/esm/redux/connectors/ModelCatalog.js.map +1 -1
- package/esm/redux/connectors/Notification.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/Progress.js.map +1 -1
- package/esm/redux/connectors/ProgressIndicator.js.map +1 -1
- package/esm/redux/connectors/QuickSearch.js.map +1 -1
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.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/ErrorReducer.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/PreferencesReducer.js.map +1 -1
- package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/esm/redux/store/beforeRenderHooks.js.map +1 -1
- package/esm/redux/store/configureStore.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/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
- package/esm/utils/helpers/text.js.map +1 -1
- package/esm/utils/number/DecimalFormat.js.map +1 -1
- package/esm/utils/number/formatValue.js.map +1 -1
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/__tests__/mergeLayoutHintConfigurations.spec.js.flow +4 -4
- package/lib/builder/mergeLayoutHintConfigurations.js.flow +3 -3
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/LayoutHints.js.flow +1 -1
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js.flow +2 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/FetchException.js.flow +2 -2
- package/lib/exceptions/FetchException.js.map +1 -1
- package/lib/exceptions/NetworkException.js.flow +1 -1
- package/lib/exceptions/NetworkException.js.map +1 -1
- package/lib/exceptions/UnauthorizedException.js.flow +1 -1
- package/lib/exceptions/UnauthorizedException.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +9 -9
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +2 -2
- package/lib/hooks/__tests__/useForm.spec.js.flow +2 -2
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +7 -7
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +2 -2
- package/lib/hooks/__tests__/usePreference.spec.js.flow +1 -1
- package/lib/hooks/useAllFormsOnModel.js.flow +2 -2
- package/lib/hooks/useAllFormsOnModel.js.map +1 -1
- package/lib/hooks/useAuthentication.js.flow +2 -2
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useContent.js.flow +1 -1
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js.flow +1 -1
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/hooks/useForm.js.flow +4 -4
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useI18n.js.flow +3 -3
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js.flow +2 -2
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.flow +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModularUI.js.flow +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js.flow +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js.flow +1 -1
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js.flow +1 -1
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/hooks/useNotification.js.flow +2 -2
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/usePreference.js +8 -2
- package/lib/hooks/usePreference.js.flow +17 -7
- package/lib/hooks/usePreference.js.map +1 -1
- package/lib/i18n/Locale.js.flow +4 -4
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js.flow +8 -8
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js.flow +2 -2
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/__tests__/Locale.spec.js.flow +3 -3
- package/lib/i18n/__tests__/Locales.spec.js.flow +15 -13
- package/lib/i18n/withMessage.js.flow +4 -4
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/actions/ActionCollection.js.flow +4 -4
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/actions/ActionModel.js.flow +4 -4
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/actions/__tests__/ActionCollection.spec.js.flow +3 -3
- package/lib/models/actions/__tests__/ActionModel.spec.js.flow +1 -1
- package/lib/models/application/ApplicationModel.js.flow +3 -3
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.flow +7 -7
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js.flow +9 -9
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.flow +9 -9
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +24 -24
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js.flow +1 -1
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.flow +4 -4
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +7 -7
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +15 -15
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +8 -0
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +19 -11
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +10 -10
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.flow +7 -7
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +6 -6
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js.flow +9 -9
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/PasswordAttributeModel.js.flow +8 -8
- package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js.flow +3 -3
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/UploadAttributeModel.js.flow +5 -5
- package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/AttributeCollection.spec.js.flow +11 -11
- package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +7 -7
- package/lib/models/attributes/__tests__/AttributeModel.spec.js.flow +5 -5
- package/lib/models/attributes/__tests__/AttributeSetModel.spec.js.flow +2 -2
- package/lib/models/attributes/__tests__/BooleanAttributeModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/ChoiceAttributeModel.spec.js.flow +8 -8
- package/lib/models/attributes/__tests__/ChoiceAttributeOptionCollection.spec.js.flow +8 -8
- package/lib/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/DateAttributeModel.spec.js.flow +4 -4
- package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +11 -11
- package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +3 -3
- package/lib/models/attributes/__tests__/MemoAttributeModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/MoneyAttributeModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/NumberAttributeModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/PasswordAttributeModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/StringAttributeModel.spec.js.flow +4 -4
- package/lib/models/attributes/__tests__/TimeAttributeModel.spec.js.flow +2 -2
- package/lib/models/attributes/__tests__/TimestampModel.spec.js.flow +2 -2
- package/lib/models/attributes/__tests__/UploadAttributeModel.spec.js.flow +4 -4
- package/lib/models/attributes/__tests__/_createAttribute.spec.js.flow +6 -6
- package/lib/models/attributes/__tests__/createAttributeComposite.spec.js.flow +3 -3
- package/lib/models/attributes/__tests__/createAttributeDynamicSchema.spec.js.flow +3 -3
- package/lib/models/attributes/_createAttribute.js.flow +5 -5
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.flow +5 -5
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js.flow +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.flow +6 -6
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryConstraint.js.flow +1 -1
- package/lib/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.flow +6 -6
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.flow +2 -2
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.flow +2 -2
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/__tests__/ConstraintModel.spec.js.flow +1 -1
- package/lib/models/attributes/input-constraints/__tests__/DateBoundaryConstraint.spec.js.flow +6 -6
- package/lib/models/attributes/input-constraints/__tests__/DateTimeDateFormatConstraint.spec.js.flow +2 -2
- package/lib/models/attributes/input-constraints/__tests__/DateTimeTimeFormatConstraint.spec.js.flow +2 -2
- package/lib/models/attributes/input-constraints/__tests__/DatetimeFormatConstraint.spec.js.flow +5 -5
- package/lib/models/attributes/input-constraints/__tests__/NumberBoundaryConstraint.spec.js.flow +6 -6
- package/lib/models/attributes/input-constraints/__tests__/NumberFormatConstraint.spec.js.flow +3 -3
- package/lib/models/attributes/input-constraints/__tests__/NumberGroupingConstraint.spec.js.flow +2 -2
- package/lib/models/attributes/input-constraints/__tests__/RegexConstraint.spec.js.flow +1 -1
- package/lib/models/attributes/input-constraints/__tests__/StringLengthConstraint.spec.js.flow +4 -4
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.flow +4 -4
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.flow +15 -15
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.flow +2 -2
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.flow +2 -2
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/__tests__/DependentAttribute.spec.js.flow +22 -22
- package/lib/models/attributes/layouthint-rules/__tests__/LayoutHintRuleCollection.spec.js.flow +1 -1
- package/lib/models/attributes/layouthint-rules/__tests__/RemainingTotalUploadSize.spec.js.flow +4 -4
- package/lib/models/base/BaseCollection.js.flow +6 -6
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js.flow +1 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js.flow +5 -5
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/base/__tests__/ResourceCollection.spec.js.flow +1 -1
- package/lib/models/caseview/CaseViewModel.js.flow +4 -4
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +3 -3
- package/lib/models/concepts/BusinessScenarioModel.js.flow +9 -9
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +17 -17
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.flow +2 -2
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.flow +6 -4
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationCollection.js.flow +5 -5
- package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js.flow +2 -2
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js.flow +2 -2
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +1 -1
- package/lib/models/content/ContentIndexModel.js.flow +3 -3
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js.flow +11 -9
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentModel.js.flow +2 -2
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.flow +4 -4
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/SectionModel.js.flow +4 -4
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js.flow +2 -2
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/content/__tests__/ContentModel.spec.js.flow +16 -16
- package/lib/models/contentconfiguration/ContentConfiguration.js.flow +1 -1
- package/lib/models/contentconfiguration/ContentConfiguration.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationElements.js.flow +5 -5
- package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationEndResults.js.flow +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationEndResults.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.js.flow +2 -2
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
- package/lib/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js.flow +12 -12
- package/lib/models/detail/DetailModel.js.flow +5 -5
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/error/ErrorCollection.js.flow +4 -4
- package/lib/models/error/ErrorCollection.js.map +1 -1
- package/lib/models/error/ErrorModel.js.flow +1 -1
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/__tests__/ErrorModel.spec.js.flow +1 -1
- package/lib/models/filters/AssignmentFilterModel.js.flow +3 -3
- package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js.flow +3 -3
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js.flow +5 -5
- package/lib/models/filters/FilterCollection.js.map +1 -1
- package/lib/models/filters/__tests__/AssignmentFilterModel.spec.js.flow +4 -4
- package/lib/models/filters/__tests__/FilterCollection.spec.js.flow +11 -11
- package/lib/models/filters/__tests__/FilterModel.spec.js.flow +1 -1
- package/lib/models/filters/__tests__/RangeFilterModel.spec.js.flow +1 -1
- package/lib/models/form/FormModel.js.flow +39 -39
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.flow +16 -16
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/form/__tests__/FormModel.instrument.spec.js.flow +7 -7
- package/lib/models/form/__tests__/FormModel.repeating.spec.js.flow +2 -2
- package/lib/models/form/__tests__/FormModel.selfhref.spec.js.flow +1 -1
- package/lib/models/form/__tests__/FormModel.spec.js.flow +6 -6
- package/lib/models/form/__tests__/FormResultData.spec.js.flow +1 -1
- package/lib/models/form/__tests__/FormWithContent.spec.js.flow +3 -3
- package/lib/models/grouping/GroupingModel.js.flow +7 -7
- package/lib/models/grouping/GroupingModel.js.map +1 -1
- package/lib/models/grouping/__tests__/GroupingModel.spec.js.flow +2 -2
- package/lib/models/href/Href.js.flow +6 -6
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +18 -16
- package/lib/models/layouthint/LayoutHintCollection.js.flow +3 -3
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js.flow +4 -4
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js.flow +3 -3
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/links/__tests__/LinkModel.spec.js.flow +4 -4
- package/lib/models/links/normalizeLinkJSON.js.flow +6 -6
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/models/list/ListDetailModel.js.flow +7 -7
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js.flow +2 -2
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListItemModel.js.flow +2 -2
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js.flow +6 -6
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/list/__tests__/ListDetailModel.spec.js.flow +4 -4
- package/lib/models/list/__tests__/ListItemCollection.spec.js.flow +1 -1
- package/lib/models/list/__tests__/ListModel.spec.js.flow +3 -3
- package/lib/models/list/__tests__/ListResultDetail.spec.js.flow +3 -3
- package/lib/models/lookup/LookupOptionCollection.js.flow +1 -1
- package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js.flow +4 -4
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/lookup/__tests__/LookupOptionsModel.spec.js.flow +3 -3
- package/lib/models/modelcatalog/ModelCatalogModel.js.flow +2 -2
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/paging/PagingModel.js.flow +1 -1
- package/lib/models/paging/PagingModel.js.map +1 -1
- package/lib/models/paging/__tests__/PagingModel.spec.js.flow +2 -2
- package/lib/models/panels/GroupingPanelModel.js.flow +5 -5
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +8 -8
- package/lib/models/parameter/__tests__/Parameter.spec.js.flow +5 -5
- package/lib/models/process/ProcessStatusSettingsModel.js.flow +1 -1
- package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/lib/models/process/__tests__/ProcessStatusSettingsModel.spec.js.flow +1 -1
- package/lib/models/resolveModel.js.flow +4 -4
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js.flow +4 -4
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/sorting/__tests__/SortingModel.spec.js.flow +3 -3
- package/lib/models/tab/TabModel.js.flow +3 -3
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/tab/__tests__/TabModel.spec.js.flow +5 -5
- package/lib/models/taskgroup/TaskGroupModel.js.flow +2 -2
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/types.js.flow +1 -1
- package/lib/models/types.js.map +1 -1
- package/lib/models/user/UserProfileModel.js.flow +1 -1
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/__tests__/UserModel.spec.js.flow +2 -2
- package/lib/models/user/__tests__/UserProfileModel.spec.js.flow +2 -2
- package/lib/models/user/__tests__/UserServicesModel.spec.js.flow +1 -1
- package/lib/modularui/CaptchaRequest.js.flow +1 -1
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.flow +26 -26
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/UploadRequest.js.flow +6 -6
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/modularui/__tests__/ModularUIError.spec.js.flow +1 -1
- package/lib/modularui/__tests__/ModularUIRequest.spec.js.flow +9 -9
- package/lib/react/utils.js.flow +1 -1
- package/lib/react/utils.js.map +1 -1
- package/lib/react-client/client.js +1 -0
- package/lib/react-client/client.js.flow +11 -10
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/contextPath.js.flow +2 -2
- package/lib/react-client/contextPath.js.map +1 -1
- package/lib/react-client/rehydrate.js.flow +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +2 -2
- package/lib/react-server/createSSRComplete.js.flow +3 -3
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js.flow +4 -4
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js.flow +1 -1
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/requestInformation.js.flow +2 -2
- package/lib/react-server/requestInformation.js.map +1 -1
- package/lib/react-server/serverUtil.js.flow +8 -8
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/__tests__/createTheme.spec.js.flow +4 -4
- package/lib/react-theme/createTheme.js.flow +1 -1
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/utils/__tests__/background.spec.js.flow +2 -2
- package/lib/react-theme/utils/__tests__/contrast.spec.js.flow +1 -1
- package/lib/react-theme/utils/__tests__/corners.spec.js.flow +3 -3
- package/lib/react-theme/utils/__tests__/spacers.spec.js.flow +1 -1
- package/lib/react-theme/utils/__tests__/themeProps.spec.js.flow +9 -9
- package/lib/react-theme/utils/colors.js.flow +3 -3
- package/lib/react-theme/utils/colors.js.map +1 -1
- package/lib/react-theme/utils/contrast.js.flow +6 -6
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js.flow +2 -2
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js.flow +2 -2
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js.flow +8 -8
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.flow +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js.flow +2 -2
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/_i18n/__tests__/reducer.spec.js.flow +2 -2
- package/lib/redux/_modularui/ModularUIActions.js.flow +8 -8
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js.flow +4 -4
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +6 -6
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js.flow +5 -5
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js.flow +11 -11
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/ModularUIUtils.js.flow +1 -1
- package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -1
- package/lib/redux/_modularui/__tests__/reducer.spec.js.flow +13 -13
- package/lib/redux/_modularui/__tests__/selectors.spec.js.flow +3 -3
- package/lib/redux/_modularui/types.js.flow +4 -4
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.flow +3 -3
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/RouterActions.js.flow +3 -3
- package/lib/redux/_router/RouterActions.js.map +1 -1
- package/lib/redux/_router/RouterConnectors.js.flow +5 -5
- package/lib/redux/_router/RouterConnectors.js.map +1 -1
- package/lib/redux/_router/RouterReducer.js.flow +1 -1
- package/lib/redux/_router/RouterReducer.js.map +1 -1
- package/lib/redux/_router/__tests__/reducer.spec.js.flow +2 -2
- package/lib/redux/actions/Application.js.flow +1 -1
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js.flow +1 -1
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js.flow +3 -3
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.flow +2 -2
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.flow +3 -3
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.flow +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.flow +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.flow +3 -3
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.flow +4 -4
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js.flow +11 -11
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/ProgressIndicator.js.flow +1 -1
- package/lib/redux/actions/ProgressIndicator.js.map +1 -1
- package/lib/redux/actions/SignIn.js.flow +3 -3
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/__tests__/Authorization.spec.js.flow +2 -2
- package/lib/redux/actions/__tests__/Error-server.spec.js.flow +13 -13
- package/lib/redux/actions/__tests__/Error.spec.js.flow +6 -6
- package/lib/redux/actions/__tests__/Notification.spec.js.flow +1 -1
- package/lib/redux/actions/__tests__/Preferences.spec.js.flow +2 -2
- package/lib/redux/connectors/Application.js.flow +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js.flow +1 -1
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js.flow +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js.flow +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js.flow +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js.flow +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.flow +2 -2
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js.flow +5 -5
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.flow +6 -6
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js.flow +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js.flow +1 -1
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js.flow +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js.flow +1 -1
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js.flow +2 -2
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.flow +3 -3
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/Progress.js.flow +1 -1
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js.flow +1 -1
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js.flow +2 -2
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js.flow +1 -1
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js.flow +1 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js.flow +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js.flow +1 -1
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/ErrorReducer.js.flow +1 -1
- package/lib/redux/reducers/ErrorReducer.js.map +1 -1
- package/lib/redux/reducers/ModalsReducer.js.flow +1 -1
- package/lib/redux/reducers/ModalsReducer.js.map +1 -1
- package/lib/redux/reducers/NotificationReducer.js.flow +1 -1
- package/lib/redux/reducers/NotificationReducer.js.map +1 -1
- package/lib/redux/reducers/PreferencesReducer.js.flow +1 -1
- package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js.flow +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +10 -10
- package/lib/redux/reducers/__tests__/ErrorReducer.spec.js.flow +1 -1
- package/lib/redux/reducers/__tests__/ModalsReducer.spec.js.flow +3 -3
- package/lib/redux/reducers/__tests__/NotificationReducer.spec.js.flow +3 -3
- package/lib/redux/reducers/__tests__/PreferencesReducer.spec.js.flow +2 -2
- package/lib/redux/reducers/__tests__/ProgressIndicatorReducer.spec.js.flow +8 -8
- package/lib/redux/store/beforeRenderHooks.js.flow +1 -1
- package/lib/redux/store/beforeRenderHooks.js.map +1 -1
- package/lib/redux/store/configureStore.js.flow +3 -3
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/browser/Cookies.js.flow +1 -1
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/browser/__tests__/Cookies.spec.js.flow +1 -1
- package/lib/utils/datetime/DateTimeUtil.js.flow +15 -15
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/datetime/__tests__/DateTime.spec.js.flow +84 -81
- package/lib/utils/fetch/__tests__/xhr.spec.js.flow +2 -2
- package/lib/utils/fetch/universalFetch.js.flow +1 -1
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.flow +6 -6
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/__tests__/sanitizeHTML.spec.js.flow +8 -8
- package/lib/utils/helpers/sanitizeHtml.js.flow +3 -3
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/helpers/text.js.flow +1 -1
- package/lib/utils/helpers/text.js.map +1 -1
- package/lib/utils/number/DecimalFormat.js.flow +2 -2
- package/lib/utils/number/DecimalFormat.js.map +1 -1
- package/lib/utils/number/__tests__/formatValue.spec.js.flow +1 -1
- package/lib/utils/number/formatValue.js.flow +2 -2
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.flow +7 -7
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +20 -20
- package/src/builder/__tests__/mergeLayoutHintConfigurations.spec.js +4 -4
- package/src/builder/mergeLayoutHintConfigurations.js +3 -3
- package/src/constants/LayoutHints.js +1 -1
- package/src/constants/Settings.js +2 -2
- package/src/exceptions/FetchException.js +2 -2
- package/src/exceptions/NetworkException.js +1 -1
- package/src/exceptions/UnauthorizedException.js +1 -1
- package/src/hooks/__tests__/UseModularUIModel.spec.js +9 -9
- package/src/hooks/__tests__/useAuthentication.spec.js +2 -2
- package/src/hooks/__tests__/useForm.spec.js +2 -2
- package/src/hooks/__tests__/useModelCatalog.spec.js +7 -7
- package/src/hooks/__tests__/useModularUIBasic.spec.js +2 -2
- package/src/hooks/__tests__/usePreference.spec.js +1 -1
- package/src/hooks/useAllFormsOnModel.js +2 -2
- package/src/hooks/useAuthentication.js +2 -2
- package/src/hooks/useContent.js +1 -1
- package/src/hooks/useDeepCompareEffect.js +1 -1
- package/src/hooks/useForm.js +4 -4
- package/src/hooks/useI18n.js +3 -3
- package/src/hooks/useModal.js +2 -2
- package/src/hooks/useModelCatalog.js +1 -1
- package/src/hooks/useModularUI.js +1 -1
- package/src/hooks/useModularUIBasic.js +1 -1
- package/src/hooks/useModularUIModel.js +1 -1
- package/src/hooks/useModularUIRequest.js +1 -1
- package/src/hooks/useNotification.js +2 -2
- package/src/hooks/usePreference.js +17 -7
- package/src/i18n/Locale.js +4 -4
- package/src/i18n/Locales.js +8 -8
- package/src/i18n/Message.js +2 -2
- package/src/i18n/__tests__/Locale.spec.js +3 -3
- package/src/i18n/__tests__/Locales.spec.js +15 -13
- package/src/i18n/withMessage.js +4 -4
- package/src/models/actions/ActionCollection.js +4 -4
- package/src/models/actions/ActionModel.js +4 -4
- package/src/models/actions/__tests__/ActionCollection.spec.js +3 -3
- package/src/models/actions/__tests__/ActionModel.spec.js +1 -1
- package/src/models/application/ApplicationModel.js +3 -3
- package/src/models/attributes/AttributeCollection.js +7 -7
- package/src/models/attributes/AttributeContent.js +9 -9
- package/src/models/attributes/AttributeDataHelper.js +9 -9
- package/src/models/attributes/AttributeModel.js +24 -24
- package/src/models/attributes/AttributeSetModel.js +1 -1
- package/src/models/attributes/BooleanAttributeModel.js +4 -4
- package/src/models/attributes/ChoiceAttributeModel.js +7 -7
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +15 -15
- package/src/models/attributes/ChoiceAttributeOptionModel.js +19 -11
- package/src/models/attributes/CompositeAttributeChildCollection.js +10 -10
- package/src/models/attributes/CompositeAttributeModel.js +7 -7
- package/src/models/attributes/DatetimeAttributeModel.js +6 -6
- package/src/models/attributes/NumberAttributeModel.js +9 -9
- package/src/models/attributes/PasswordAttributeModel.js +8 -8
- package/src/models/attributes/StringAttributeModel.js +3 -3
- package/src/models/attributes/UploadAttributeModel.js +5 -5
- package/src/models/attributes/__tests__/AttributeCollection.spec.js +11 -11
- package/src/models/attributes/__tests__/AttributeContent.spec.js +7 -7
- package/src/models/attributes/__tests__/AttributeModel.spec.js +5 -5
- package/src/models/attributes/__tests__/AttributeSetModel.spec.js +2 -2
- package/src/models/attributes/__tests__/BooleanAttributeModel.spec.js +1 -1
- package/src/models/attributes/__tests__/ChoiceAttributeModel.spec.js +8 -8
- package/src/models/attributes/__tests__/ChoiceAttributeOptionCollection.spec.js +8 -8
- package/src/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js +1 -1
- package/src/models/attributes/__tests__/DateAttributeModel.spec.js +4 -4
- package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +11 -11
- package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +3 -3
- package/src/models/attributes/__tests__/MemoAttributeModel.spec.js +1 -1
- package/src/models/attributes/__tests__/MoneyAttributeModel.spec.js +1 -1
- package/src/models/attributes/__tests__/NumberAttributeModel.spec.js +1 -1
- package/src/models/attributes/__tests__/PasswordAttributeModel.spec.js +1 -1
- package/src/models/attributes/__tests__/StringAttributeModel.spec.js +4 -4
- package/src/models/attributes/__tests__/TimeAttributeModel.spec.js +2 -2
- package/src/models/attributes/__tests__/TimestampModel.spec.js +2 -2
- package/src/models/attributes/__tests__/UploadAttributeModel.spec.js +4 -4
- package/src/models/attributes/__tests__/_createAttribute.spec.js +6 -6
- package/src/models/attributes/__tests__/createAttributeComposite.spec.js +3 -3
- package/src/models/attributes/__tests__/createAttributeDynamicSchema.spec.js +3 -3
- package/src/models/attributes/_createAttribute.js +5 -5
- package/src/models/attributes/input-constraints/ConstraintCollection.js +5 -5
- package/src/models/attributes/input-constraints/ConstraintModel.js +1 -1
- package/src/models/attributes/input-constraints/DateBoundaryConstraint.js +6 -6
- package/src/models/attributes/input-constraints/MandatoryConstraint.js +1 -1
- package/src/models/attributes/input-constraints/NumberBoundaryConstraint.js +6 -6
- package/src/models/attributes/input-constraints/NumberFormatConstraint.js +2 -2
- package/src/models/attributes/input-constraints/NumberGroupingConstraint.js +2 -2
- package/src/models/attributes/input-constraints/__tests__/ConstraintModel.spec.js +1 -1
- package/src/models/attributes/input-constraints/__tests__/DateBoundaryConstraint.spec.js +6 -6
- package/src/models/attributes/input-constraints/__tests__/DateTimeDateFormatConstraint.spec.js +2 -2
- package/src/models/attributes/input-constraints/__tests__/DateTimeTimeFormatConstraint.spec.js +2 -2
- package/src/models/attributes/input-constraints/__tests__/DatetimeFormatConstraint.spec.js +5 -5
- package/src/models/attributes/input-constraints/__tests__/NumberBoundaryConstraint.spec.js +6 -6
- package/src/models/attributes/input-constraints/__tests__/NumberFormatConstraint.spec.js +3 -3
- package/src/models/attributes/input-constraints/__tests__/NumberGroupingConstraint.spec.js +2 -2
- package/src/models/attributes/input-constraints/__tests__/RegexConstraint.spec.js +1 -1
- package/src/models/attributes/input-constraints/__tests__/StringLengthConstraint.spec.js +4 -4
- package/src/models/attributes/layouthint-rules/BaseLayoutHintRule.js +4 -4
- package/src/models/attributes/layouthint-rules/DependentAttribute.js +15 -15
- package/src/models/attributes/layouthint-rules/LayoutHintRuleCollection.js +2 -2
- package/src/models/attributes/layouthint-rules/RemainingTotalUploadSize.js +2 -2
- package/src/models/attributes/layouthint-rules/__tests__/DependentAttribute.spec.js +22 -22
- package/src/models/attributes/layouthint-rules/__tests__/LayoutHintRuleCollection.spec.js +1 -1
- package/src/models/attributes/layouthint-rules/__tests__/RemainingTotalUploadSize.spec.js +4 -4
- package/src/models/base/BaseCollection.js +6 -6
- package/src/models/base/BaseModel.js +1 -1
- package/src/models/base/ResourceModel.js +5 -5
- package/src/models/base/__tests__/ResourceCollection.spec.js +1 -1
- package/src/models/caseview/CaseViewModel.js +4 -4
- package/src/models/caseview/__tests__/CaseViewModel.spec.js +3 -3
- package/src/models/concepts/BusinessScenarioModel.js +9 -9
- package/src/models/concepts/ConceptDetailModel.js +17 -17
- package/src/models/concepts/ConceptIndexModel.js +2 -2
- package/src/models/concepts/ConceptLinkModel.js +6 -4
- package/src/models/concepts/ConceptRelationCollection.js +5 -5
- package/src/models/concepts/SourceReferenceCollection.js +2 -2
- package/src/models/concepts/SourceReferenceModel.js +2 -2
- package/src/models/concepts/__tests__/ConceptDetailModel.spec.js +1 -1
- package/src/models/content/ContentIndexModel.js +3 -3
- package/src/models/content/ContentLinkModel.js +11 -9
- package/src/models/content/ContentModel.js +2 -2
- package/src/models/content/ContentTOCModel.js +4 -4
- package/src/models/content/SectionModel.js +4 -4
- package/src/models/content/SubSectionModel.js +2 -2
- package/src/models/content/__tests__/ContentModel.spec.js +16 -16
- package/src/models/contentconfiguration/ContentConfiguration.js +1 -1
- package/src/models/contentconfiguration/ContentConfigurationElements.js +5 -5
- package/src/models/contentconfiguration/ContentConfigurationEndResults.js +1 -1
- package/src/models/contentconfiguration/ContentConfigurationQuestions.js +2 -2
- package/src/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js +12 -12
- package/src/models/detail/DetailModel.js +5 -5
- package/src/models/error/ErrorCollection.js +4 -4
- package/src/models/error/ErrorModel.js +1 -1
- package/src/models/error/__tests__/ErrorModel.spec.js +1 -1
- package/src/models/filters/AssignmentFilterModel.js +3 -3
- package/src/models/filters/BaseFilterModel.js +3 -3
- package/src/models/filters/FilterCollection.js +5 -5
- package/src/models/filters/__tests__/AssignmentFilterModel.spec.js +4 -4
- package/src/models/filters/__tests__/FilterCollection.spec.js +11 -11
- package/src/models/filters/__tests__/FilterModel.spec.js +1 -1
- package/src/models/filters/__tests__/RangeFilterModel.spec.js +1 -1
- package/src/models/form/FormModel.js +39 -39
- package/src/models/form/FormObjectModel.js +16 -16
- package/src/models/form/__tests__/FormModel.instrument.spec.js +7 -7
- package/src/models/form/__tests__/FormModel.repeating.spec.js +2 -2
- package/src/models/form/__tests__/FormModel.selfhref.spec.js +1 -1
- package/src/models/form/__tests__/FormModel.spec.js +6 -6
- package/src/models/form/__tests__/FormResultData.spec.js +1 -1
- package/src/models/form/__tests__/FormWithContent.spec.js +3 -3
- package/src/models/grouping/GroupingModel.js +7 -7
- package/src/models/grouping/__tests__/GroupingModel.spec.js +2 -2
- package/src/models/href/Href.js +6 -6
- package/src/models/href/__tests__/Href.spec.js +18 -16
- package/src/models/layouthint/LayoutHintCollection.js +3 -3
- package/src/models/links/LinkCollection.js +4 -4
- package/src/models/links/LinkModel.js +3 -3
- package/src/models/links/__tests__/LinkModel.spec.js +4 -4
- package/src/models/links/normalizeLinkJSON.js +6 -6
- package/src/models/list/ListDetailModel.js +7 -7
- package/src/models/list/ListItemCollection.js +2 -2
- package/src/models/list/ListItemModel.js +2 -2
- package/src/models/list/ListModel.js +6 -6
- package/src/models/list/__tests__/ListDetailModel.spec.js +4 -4
- package/src/models/list/__tests__/ListItemCollection.spec.js +1 -1
- package/src/models/list/__tests__/ListModel.spec.js +3 -3
- package/src/models/list/__tests__/ListResultDetail.spec.js +3 -3
- package/src/models/lookup/LookupOptionCollection.js +1 -1
- package/src/models/lookup/LookupOptionsModel.js +4 -4
- package/src/models/lookup/__tests__/LookupOptionsModel.spec.js +3 -3
- package/src/models/modelcatalog/ModelCatalogModel.js +2 -2
- package/src/models/paging/PagingModel.js +1 -1
- package/src/models/paging/__tests__/PagingModel.spec.js +2 -2
- package/src/models/panels/GroupingPanelModel.js +5 -5
- package/src/models/panels/__tests__/GroupingPanelModel.spec.js +8 -8
- package/src/models/parameter/__tests__/Parameter.spec.js +5 -5
- package/src/models/process/ProcessStatusSettingsModel.js +1 -1
- package/src/models/process/__tests__/ProcessStatusSettingsModel.spec.js +1 -1
- package/src/models/resolveModel.js +4 -4
- package/src/models/sorting/SortingModel.js +4 -4
- package/src/models/sorting/__tests__/SortingModel.spec.js +3 -3
- package/src/models/tab/TabModel.js +3 -3
- package/src/models/tab/__tests__/TabModel.spec.js +5 -5
- package/src/models/taskgroup/TaskGroupModel.js +2 -2
- package/src/models/types.js +1 -1
- package/src/models/user/UserProfileModel.js +1 -1
- package/src/models/user/__tests__/UserModel.spec.js +2 -2
- package/src/models/user/__tests__/UserProfileModel.spec.js +2 -2
- package/src/models/user/__tests__/UserServicesModel.spec.js +1 -1
- package/src/modularui/CaptchaRequest.js +1 -1
- package/src/modularui/ModularUIRequest.js +26 -26
- package/src/modularui/UploadRequest.js +6 -6
- package/src/modularui/__tests__/ModularUIError.spec.js +1 -1
- package/src/modularui/__tests__/ModularUIRequest.spec.js +9 -9
- package/src/react/utils.js +1 -1
- package/src/react-client/client.js +11 -10
- package/src/react-client/contextPath.js +2 -2
- package/src/react-client/rehydrate.js +1 -1
- package/src/react-server/__tests__/serverUtil.spec.js +2 -2
- package/src/react-server/createSSRComplete.js +3 -3
- package/src/react-server/renderSSRComplete.js +4 -4
- package/src/react-server/renderSSRMinimal.js +1 -1
- package/src/react-server/requestInformation.js +2 -2
- package/src/react-server/serverUtil.js +8 -8
- package/src/react-theme/__tests__/createTheme.spec.js +4 -4
- package/src/react-theme/createTheme.js +1 -1
- package/src/react-theme/utils/__tests__/background.spec.js +2 -2
- package/src/react-theme/utils/__tests__/contrast.spec.js +1 -1
- package/src/react-theme/utils/__tests__/corners.spec.js +3 -3
- package/src/react-theme/utils/__tests__/spacers.spec.js +1 -1
- package/src/react-theme/utils/__tests__/themeProps.spec.js +9 -9
- package/src/react-theme/utils/colors.js +3 -3
- package/src/react-theme/utils/contrast.js +6 -6
- package/src/react-theme/utils/corners.js +2 -2
- package/src/react-theme/utils/spacers.js +2 -2
- package/src/react-theme/utils/themeProps.js +8 -8
- package/src/redux/_i18n/I18nActions.js +1 -1
- package/src/redux/_i18n/I18nReducer.js +2 -2
- package/src/redux/_i18n/__tests__/reducer.spec.js +2 -2
- package/src/redux/_modularui/ModularUIActions.js +8 -8
- package/src/redux/_modularui/ModularUIConnector.js +4 -4
- package/src/redux/_modularui/ModularUIMiddleware.js +6 -6
- package/src/redux/_modularui/ModularUIReducer.js +5 -5
- package/src/redux/_modularui/ModularUISelectors.js +11 -11
- package/src/redux/_modularui/ModularUIUtils.js +1 -1
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -1
- package/src/redux/_modularui/__tests__/reducer.spec.js +13 -13
- package/src/redux/_modularui/__tests__/selectors.spec.js +3 -3
- package/src/redux/_modularui/types.js +4 -4
- package/src/redux/_modularui/withModularUI.js +3 -3
- package/src/redux/_router/RouterActions.js +3 -3
- package/src/redux/_router/RouterConnectors.js +5 -5
- package/src/redux/_router/RouterReducer.js +1 -1
- package/src/redux/_router/__tests__/reducer.spec.js +2 -2
- package/src/redux/actions/Application.js +1 -1
- package/src/redux/actions/Authorization.js +1 -1
- package/src/redux/actions/Error.js +3 -3
- package/src/redux/actions/FormAttributeSet.js +2 -2
- package/src/redux/actions/FormAttributeSetRepeatable.js +3 -3
- package/src/redux/actions/FormAutosave.js +1 -1
- package/src/redux/actions/FormAutosubmit.js +1 -1
- package/src/redux/actions/FormValidations.js +3 -3
- package/src/redux/actions/Notification.js +4 -4
- package/src/redux/actions/Preferences.js +11 -11
- package/src/redux/actions/ProgressIndicator.js +1 -1
- package/src/redux/actions/SignIn.js +3 -3
- package/src/redux/actions/__tests__/Authorization.spec.js +2 -2
- package/src/redux/actions/__tests__/Error-server.spec.js +13 -13
- package/src/redux/actions/__tests__/Error.spec.js +6 -6
- package/src/redux/actions/__tests__/Notification.spec.js +1 -1
- package/src/redux/actions/__tests__/Preferences.spec.js +2 -2
- package/src/redux/connectors/Application.js +1 -1
- package/src/redux/connectors/Breadcrumb.js +1 -1
- package/src/redux/connectors/CaseView.js +1 -1
- package/src/redux/connectors/ConceptDetail.js +1 -1
- package/src/redux/connectors/ContentBrowser.js +1 -1
- package/src/redux/connectors/ContentDetail.js +1 -1
- package/src/redux/connectors/ContentDetailSection.js +2 -2
- package/src/redux/connectors/Form.js +5 -5
- package/src/redux/connectors/FormAttributeSet.js +6 -6
- package/src/redux/connectors/ListDetail.js +1 -1
- package/src/redux/connectors/Modal.js +1 -1
- package/src/redux/connectors/ModelCatalog.js +1 -1
- package/src/redux/connectors/Notification.js +1 -1
- package/src/redux/connectors/PanelRenderer.js +2 -2
- package/src/redux/connectors/Preferences.js +3 -3
- package/src/redux/connectors/Progress.js +1 -1
- package/src/redux/connectors/ProgressIndicator.js +1 -1
- package/src/redux/connectors/QuickSearch.js +2 -2
- package/src/redux/connectors/SignIn.js +1 -1
- package/src/redux/connectors/SignOut.js +1 -1
- package/src/redux/connectors/Tab.js +1 -1
- package/src/redux/reducers/AuthReducer.js +1 -1
- package/src/redux/reducers/ErrorReducer.js +1 -1
- package/src/redux/reducers/ModalsReducer.js +1 -1
- package/src/redux/reducers/NotificationReducer.js +1 -1
- package/src/redux/reducers/PreferencesReducer.js +1 -1
- package/src/redux/reducers/ProgressIndicatorReducer.js +1 -1
- package/src/redux/reducers/__tests__/AuthReducer.spec.js +10 -10
- package/src/redux/reducers/__tests__/ErrorReducer.spec.js +1 -1
- package/src/redux/reducers/__tests__/ModalsReducer.spec.js +3 -3
- package/src/redux/reducers/__tests__/NotificationReducer.spec.js +3 -3
- package/src/redux/reducers/__tests__/PreferencesReducer.spec.js +2 -2
- package/src/redux/reducers/__tests__/ProgressIndicatorReducer.spec.js +8 -8
- package/src/redux/store/beforeRenderHooks.js +1 -1
- package/src/redux/store/configureStore.js +3 -3
- package/src/utils/browser/Cookies.js +1 -1
- package/src/utils/browser/__tests__/Cookies.spec.js +1 -1
- package/src/utils/datetime/DateTimeUtil.js +15 -15
- package/src/utils/datetime/__tests__/DateTime.spec.js +84 -81
- package/src/utils/fetch/__tests__/xhr.spec.js +2 -2
- package/src/utils/fetch/universalFetch.js +1 -1
- package/src/utils/fetch/xhr.js +6 -6
- package/src/utils/helpers/__tests__/sanitizeHTML.spec.js +8 -8
- package/src/utils/helpers/sanitizeHtml.js +3 -3
- package/src/utils/helpers/text.js +1 -1
- package/src/utils/number/DecimalFormat.js +2 -2
- package/src/utils/number/__tests__/formatValue.spec.js +1 -1
- package/src/utils/number/formatValue.js +2 -2
- package/src/utils/number/parseNumbers.js +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.js","names":["_objects","require","_exceptions","_Cache","_interopRequireDefault","_Constants","_Settings","NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","constructor","options","_defineProperty2","default","_options","_attempts","xmlhttp","_xmlhttp","attempts","url","params","_includes","call","aUrl","split","data","method","HTTP_METHODS","GET","timeout","getSetting","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","TimeoutException","errorHandler","responseJSON","arguments","length","undefined","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","getResponse","response","getResponseHeader","isPlainObject","JSON","parse","error","JsonParseException","responseHandler","resolve","has","setEventListeners","forEach","eventType","addEventListener","_keys","eventName","openConnection","open","setBasicAuthentication","Cache","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","_stringify","setXMLHttpRequest","_promise","XMLHttpRequest","fetch","err","validateInputArguments","args","IllegalArgumentException","toString","xhr","_default","exports"],"sources":["../../../src/utils/fetch/xhr.js"],"sourcesContent":["// @flow\nimport { has, isPlainObject } from \"../helpers/objects\";\n\nimport {\n IllegalArgumentException,\n UnauthorizedException,\n FetchException,\n TimeoutException,\n NotFoundException,\n JsonParseException,\n NetworkException,\n} from \"../../exceptions\";\n\nimport Cache from \"../browser/Cache\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { RequestOptions } from \"./types\";\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\n/**\n * @private\n */\nclass XHR {\n _options: RequestOptions;\n _xmlhttp: XMLHttpRequest;\n _attempts: number;\n\n /**\n */\n constructor(options: RequestOptions) {\n this._options = options;\n this._attempts = 0;\n }\n\n /**\n */\n get xmlhttp(): XMLHttpRequest {\n return this._xmlhttp;\n }\n\n /**\n */\n set xmlhttp(xmlhttp: XMLHttpRequest) {\n this._xmlhttp = xmlhttp;\n }\n\n /**\n */\n get options(): RequestOptions {\n return this._options;\n }\n\n /**\n */\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n /**\n */\n get attempts(): number {\n return this._attempts;\n }\n\n /**\n */\n set attempts(attempts: number) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url(): string {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n /**\n */\n get params(): string {\n return this.options.params || \"\";\n }\n\n /**\n */\n get data(): any | null {\n return this.options.data || null;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n /**\n */\n get timeout(): number {\n return this.options.timeout || getSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n /**\n */\n get responseType(): string {\n return this.options.responseType || \"json\";\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n if (this.options.onProgress) {\n return this.options.onProgress;\n }\n\n return () => {\n // do nothing\n };\n }\n\n /**\n */\n get events(): { [eventName: string]: () => void } {\n return this.options.events || {};\n }\n\n /**\n */\n get headers(): { [string]: string } {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": \"en\",\n };\n\n if (this.options.headers) {\n // $FlowFixMe[cannot-spread-indexer]\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n /**\n */\n timeoutHandler(reject: Function): any {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n /**\n */\n errorHandler(reject: Function, responseJSON: any = null): any {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON)\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n /**\n */\n getResponse(): any {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error);\n }\n }\n\n return response;\n }\n\n /**\n */\n responseHandler(resolve: Function, reject: Function): any {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response);\n }\n\n /**\n */\n setEventListeners(resolve: Function, reject: Function) {\n if (this.options.onProgress) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, this.onProgress);\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject)\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n /**\n */\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n /**\n */\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n this.xmlhttp.withCredentials = true;\n const basicToken = Cache.getItem(\"basic\");\n\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n /**\n */\n getResponseHeader(headerName: string): string | null {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n /**\n */\n setCustomHeaders() {\n Object.keys(this.headers).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, this.headers[headerName]);\n });\n }\n\n /**\n */\n setOtherOptions() {\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n /**\n */\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData = isPlainObject(this.data)\n ? JSON.stringify(this.data)\n : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n /**\n */\n setXMLHttpRequest(): Promise<any> {\n return new Promise((resolve, reject) => {\n this.xmlhttp = new XMLHttpRequest();\n\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n /**\n */\n async fetch(): Promise<any> {\n try {\n return await this.setXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\n/**\n */\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\"\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args\n )}`\n );\n }\n\n return true;\n};\n\n/**\n */\nconst xhr = (args: RequestOptions): Promise<any> => {\n validateInputArguments(args);\n\n return new XHR(args).fetch();\n};\n\nexport default xhr;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAUA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;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AACA;AACA,MAAMG,GAAG,GAAIH,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAIjF,GAAG,CAACiF,IAAI,CAAC,CAACH,KAAK,CAAC,CAAC;AAC9B,CAAC;AAAC,IAAAO,QAAA,GAEaD,GAAG;AAAAE,OAAA,CAAAlF,OAAA,GAAAiF,QAAA"}
|
|
1
|
+
{"version":3,"file":"xhr.js","names":["_objects","require","_exceptions","_Cache","_interopRequireDefault","_Constants","_Settings","NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","constructor","options","_defineProperty2","default","_options","_attempts","xmlhttp","_xmlhttp","attempts","url","params","_includes","call","aUrl","split","data","method","HTTP_METHODS","GET","timeout","getSetting","responseType","onProgress","events","headers","baseHeaders","Accept","timeoutHandler","reject","TimeoutException","errorHandler","responseJSON","arguments","length","undefined","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","getResponse","response","getResponseHeader","isPlainObject","JSON","parse","error","JsonParseException","responseHandler","resolve","has","setEventListeners","forEach","eventType","addEventListener","_keys","eventName","openConnection","open","setBasicAuthentication","Cache","hasItem","withCredentials","basicToken","getItem","setRequestHeader","headerName","setCustomHeaders","setOtherOptions","sendData","send","stringData","_stringify","setXMLHttpRequest","_promise","XMLHttpRequest","fetch","err","validateInputArguments","args","IllegalArgumentException","toString","xhr","_default","exports"],"sources":["../../../src/utils/fetch/xhr.js"],"sourcesContent":["// @flow\nimport { has, isPlainObject } from \"../helpers/objects\";\n\nimport {\n IllegalArgumentException,\n UnauthorizedException,\n FetchException,\n TimeoutException,\n NotFoundException,\n JsonParseException,\n NetworkException,\n} from \"../../exceptions\";\n\nimport Cache from \"../browser/Cache\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { RequestOptions } from \"./types\";\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\n/**\n * @private\n */\nclass XHR {\n _options: RequestOptions;\n _xmlhttp: XMLHttpRequest;\n _attempts: number;\n\n /**\n */\n constructor(options: RequestOptions) {\n this._options = options;\n this._attempts = 0;\n }\n\n /**\n */\n get xmlhttp(): XMLHttpRequest {\n return this._xmlhttp;\n }\n\n /**\n */\n set xmlhttp(xmlhttp: XMLHttpRequest) {\n this._xmlhttp = xmlhttp;\n }\n\n /**\n */\n get options(): RequestOptions {\n return this._options;\n }\n\n /**\n */\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n /**\n */\n get attempts(): number {\n return this._attempts;\n }\n\n /**\n */\n set attempts(attempts: number) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url(): string {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n /**\n */\n get params(): string {\n return this.options.params || \"\";\n }\n\n /**\n */\n get data(): any | null {\n return this.options.data || null;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n /**\n */\n get timeout(): number {\n return this.options.timeout || getSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n /**\n */\n get responseType(): string {\n return this.options.responseType || \"json\";\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n if (this.options.onProgress) {\n return this.options.onProgress;\n }\n\n return () => {\n // do nothing\n };\n }\n\n /**\n */\n get events(): { [eventName: string]: () => void } {\n return this.options.events || {};\n }\n\n /**\n */\n get headers(): { [string]: string } {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": \"en\",\n };\n\n if (this.options.headers) {\n // $FlowFixMe[cannot-spread-indexer]\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n /**\n */\n timeoutHandler(reject: Function): any {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n /**\n */\n errorHandler(reject: Function, responseJSON: any = null): any {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON),\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n /**\n */\n getResponse(): any {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error);\n }\n }\n\n return response;\n }\n\n /**\n */\n responseHandler(resolve: Function, reject: Function): any {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response);\n }\n\n /**\n */\n setEventListeners(resolve: Function, reject: Function) {\n if (this.options.onProgress) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, this.onProgress);\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject),\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n /**\n */\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n /**\n */\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n this.xmlhttp.withCredentials = true;\n const basicToken = Cache.getItem(\"basic\");\n\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n /**\n */\n getResponseHeader(headerName: string): string | null {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n /**\n */\n setCustomHeaders() {\n Object.keys(this.headers).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, this.headers[headerName]);\n });\n }\n\n /**\n */\n setOtherOptions() {\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n /**\n */\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData = isPlainObject(this.data)\n ? JSON.stringify(this.data)\n : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n /**\n */\n setXMLHttpRequest(): Promise<any> {\n return new Promise((resolve, reject) => {\n this.xmlhttp = new XMLHttpRequest();\n\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n /**\n */\n async fetch(): Promise<any> {\n try {\n return await this.setXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\n/**\n */\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\",\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`,\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args,\n )}`,\n );\n }\n\n return true;\n};\n\n/**\n */\nconst xhr = (args: RequestOptions): Promise<any> => {\n validateInputArguments(args);\n\n return new XHR(args).fetch();\n};\n\nexport default xhr;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAUA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AAIA,MAAMM,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,SAAS,GAAG,kBAAkB;;AAEpC;AACA;AACA;AACA,MAAMC,GAAG,CAAC;EAKR;AACF;EACEC,WAAWA,CAACC,OAAuB,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IACnC,IAAI,CAACC,QAAQ,GAAGH,OAAO;IACvB,IAAI,CAACI,SAAS,GAAG,CAAC;EACpB;;EAEA;AACF;EACE,IAAIC,OAAOA,CAAA,EAAmB;IAC5B,OAAO,IAAI,CAACC,QAAQ;EACtB;;EAEA;AACF;EACE,IAAID,OAAOA,CAACA,OAAuB,EAAE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I,CAAC;QAClB,OAAO,IAAI,CAACqE,KAAK,CAAC,CAAC;MACrB;MAEA,MAAMC,GAAG;IACX;EACF;AACF;;AAEA;AACA;AACA,MAAMC,sBAAsB,GAAIC,IAAoB,IAAK;EACvD,IAAIA,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIC,oCAAwB,CAChC,kEACF,CAAC;EACH;EAEA,IAAI,CAAC,IAAArC,sBAAa,EAACoC,IAAI,CAAC,EAAE;IACxB,MAAM,IAAIC,oCAAwB,CAC/B,0DAAyDD,IAAI,CAACE,QAAQ,CAAC,CAAE,EAC5E,CAAC;EACH;EAEA,IAAI,CAAC,IAAA/B,YAAG,EAAC6B,IAAI,EAAE,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,oCAAwB,CAC/B,wDAAuD,IAAAR,UAAA,CAAAtE,OAAA,EACtD6E,IACF,CAAE,EACJ,CAAC;EACH;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA,MAAMG,GAAG,GAAIH,IAAoB,IAAmB;EAClDD,sBAAsB,CAACC,IAAI,CAAC;EAE5B,OAAO,IAAIjF,GAAG,CAACiF,IAAI,CAAC,CAACH,KAAK,CAAC,CAAC;AAC9B,CAAC;AAAC,IAAAO,QAAA,GAEaD,GAAG;AAAAE,OAAA,CAAAlF,OAAA,GAAAiF,QAAA"}
|
|
@@ -3,29 +3,29 @@ import { removeUnwantedHtml } from "../sanitizeHtml";
|
|
|
3
3
|
describe("sanitizeHTML", () => {
|
|
4
4
|
it("remove unwanted html", () => {
|
|
5
5
|
expect(removeUnwantedHtml("String without HTML")).toBe(
|
|
6
|
-
"String without HTML"
|
|
6
|
+
"String without HTML",
|
|
7
7
|
);
|
|
8
8
|
|
|
9
9
|
expect(
|
|
10
|
-
removeUnwantedHtml("<p>String with <b>allowed <i>html</i></b></p>")
|
|
10
|
+
removeUnwantedHtml("<p>String with <b>allowed <i>html</i></b></p>"),
|
|
11
11
|
).toBe("<p>String with <b>allowed <i>html</i></b></p>");
|
|
12
12
|
|
|
13
13
|
expect(
|
|
14
14
|
removeUnwantedHtml(
|
|
15
|
-
"<p>String with <b>allowed <i>html</i></b><br /> and <strong>NOT</strong> allowed html</p>"
|
|
16
|
-
)
|
|
15
|
+
"<p>String with <b>allowed <i>html</i></b><br /> and <strong>NOT</strong> allowed html</p>",
|
|
16
|
+
),
|
|
17
17
|
).toBe(
|
|
18
|
-
"<p>String with <b>allowed <i>html</i></b><br /> and NOT allowed html</p>"
|
|
18
|
+
"<p>String with <b>allowed <i>html</i></b><br /> and NOT allowed html</p>",
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
expect(
|
|
22
|
-
removeUnwantedHtml("String<p><br /> with <u>allowed</u></p> html")
|
|
22
|
+
removeUnwantedHtml("String<p><br /> with <u>allowed</u></p> html"),
|
|
23
23
|
).toBe("String<p><br /> with <u>allowed</u></p> html");
|
|
24
24
|
|
|
25
25
|
expect(
|
|
26
26
|
removeUnwantedHtml(
|
|
27
|
-
'<p>String <b style="font-weight: 400" id="bold">not allowed attribute</b> string</p>'
|
|
28
|
-
)
|
|
27
|
+
'<p>String <b style="font-weight: 400" id="bold">not allowed attribute</b> string</p>',
|
|
28
|
+
),
|
|
29
29
|
).toBe("<p>String <b>not allowed attribute</b> string</p>");
|
|
30
30
|
});
|
|
31
31
|
});
|
|
@@ -32,7 +32,7 @@ const removeUnwantedHtml = (
|
|
|
32
32
|
html: string,
|
|
33
33
|
options: removeUnwantedHtmlOptions = {
|
|
34
34
|
allowedTags: ["p", "br", "b", "i", "u", "strike"],
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
36
|
): string => {
|
|
37
37
|
if (typeof html !== "string") {
|
|
38
38
|
throw new IllegalArgumentException("sanitizeHTML method expects a string");
|
|
@@ -43,12 +43,12 @@ const removeUnwantedHtml = (
|
|
|
43
43
|
// remove attributes from html elements
|
|
44
44
|
const htmlWithoutAttributes = correctEntityHtml.replace(
|
|
45
45
|
/<(\w+)(.|[\r\n])*?>/gi,
|
|
46
|
-
"<$1>"
|
|
46
|
+
"<$1>",
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const htmlWithCorrectBR = htmlWithoutAttributes.replace(
|
|
50
50
|
/<br\s*>/gi,
|
|
51
|
-
"<br />"
|
|
51
|
+
"<br />",
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
// remove not allowed tags
|
|
@@ -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 }
|
|
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,GAA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O,CAACI,WAAW,CAACO,IAAI,CAAC,GAAG,CAAC,GAC7B,EAAE;EACN,MAAMC,OAAO,GAAI,YAAWR,WAAY,qBAAoB;EAC5D,MAAMS,KAAK,GAAG,IAAIC,MAAM,CAACF,OAAO,EAAE,IAAI,CAAC;EAEvC,OAAOJ,iBAAiB,CAACjB,OAAO,CAACsB,KAAK,EAAE,EAAE,CAAC;AAC7C,CAAC;AAACE,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA"}
|
|
@@ -9,7 +9,7 @@ import { isPlainObject } from "./objects";
|
|
|
9
9
|
export const retrieveText = (
|
|
10
10
|
text:
|
|
11
11
|
| string
|
|
12
|
-
| { id?: string, message: string, properties?: { [key: string]: any } }
|
|
12
|
+
| { id?: string, message: string, properties?: { [key: string]: any } },
|
|
13
13
|
): string => {
|
|
14
14
|
if (typeof text === "string") {
|
|
15
15
|
return text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":["_objects","require","retrieveText","text","isPlainObject","message","exports"],"sources":["../../../src/utils/helpers/text.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"./objects\";\n\n/**\n * Handles text that is in the ApplicationMessage form ({ id: string, message: string, properties: object })\n * @param text\n * @returns {string}\n */\nexport const retrieveText = (\n text:\n | string\n | { id?: string, message: string, properties?: { [key: string]: any } }
|
|
1
|
+
{"version":3,"file":"text.js","names":["_objects","require","retrieveText","text","isPlainObject","message","exports"],"sources":["../../../src/utils/helpers/text.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"./objects\";\n\n/**\n * Handles text that is in the ApplicationMessage form ({ id: string, message: string, properties: object })\n * @param text\n * @returns {string}\n */\nexport const retrieveText = (\n text:\n | string\n | { id?: string, message: string, properties?: { [key: string]: any } },\n): string => {\n if (typeof text === \"string\") {\n return text;\n }\n\n if (isPlainObject(text) && \"message\" in text) {\n return text.message;\n }\n\n return \"\";\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,GACvBC,IAEyE,IAC9D;EACX,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI;EACb;EAEA,IAAI,IAAAC,sBAAa,EAACD,IAAI,CAAC,IAAI,SAAS,IAAIA,IAAI,EAAE;IAC5C,OAAOA,IAAI,CAACE,OAAO;EACrB;EAEA,OAAO,EAAE;AACX,CAAC;AAACC,OAAA,CAAAJ,YAAA,GAAAA,YAAA"}
|
|
@@ -331,7 +331,7 @@ class DecimalFormat {
|
|
|
331
331
|
if (j !== 0 && j % this.comma === 0) {
|
|
332
332
|
groupedIntStr = `${groupedIntStr.substring(
|
|
333
333
|
0,
|
|
334
|
-
i
|
|
334
|
+
i,
|
|
335
335
|
)},${groupedIntStr.substring(i)}`;
|
|
336
336
|
j = 0;
|
|
337
337
|
}
|
|
@@ -347,7 +347,7 @@ class DecimalFormat {
|
|
|
347
347
|
getFormattedValue(
|
|
348
348
|
intStr: string,
|
|
349
349
|
fracStr: string,
|
|
350
|
-
isNegative: boolean
|
|
350
|
+
isNegative: boolean,
|
|
351
351
|
): string {
|
|
352
352
|
let formattedValue;
|
|
353
353
|
if (fracStr.length > 0)
|
|
@@ -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;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,OA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Y,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;;EAEA;AACF;EACE,IAAIC,OAAOA,CAAA,EAAW;IACpB,OAAO,IAAI,CAACC,QAAQ;EACtB;;EAEA;AACF;EACE,IAAIC,OAAOA,CAAA,EAAW;IACpB,OAAO,IAAI,CAACC,QAAQ;EACtB;;EA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AAC,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"}
|
|
@@ -25,7 +25,7 @@ describe("formatValue", () => {
|
|
|
25
25
|
expect(formatValue(null, "#.##")).toBe("");
|
|
26
26
|
expect(formatValue(5.56789, "#.##")).toBe("5.57");
|
|
27
27
|
expect(formatValue(5.567898934722384e16, "#.00")).toBe(
|
|
28
|
-
"55678989347223840.00"
|
|
28
|
+
"55678989347223840.00",
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
expect(formatValue(0)).toBe("0");
|
|
@@ -21,7 +21,7 @@ const formatValue = (
|
|
|
21
21
|
value: ?number | ?string,
|
|
22
22
|
format: ?string = "0",
|
|
23
23
|
groupingSeparator: string = ",",
|
|
24
|
-
decimalSeparator: string = "."
|
|
24
|
+
decimalSeparator: string = ".",
|
|
25
25
|
): string => {
|
|
26
26
|
if (value == null) {
|
|
27
27
|
return "";
|
|
@@ -34,7 +34,7 @@ const formatValue = (
|
|
|
34
34
|
|
|
35
35
|
if (typeof numberValue !== "number") {
|
|
36
36
|
throw new IllegalArgumentException(
|
|
37
|
-
`Not a valid number: ${value} for formatValue
|
|
37
|
+
`Not a valid number: ${value} for formatValue`,
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -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 = \".\"
|
|
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,kBAC/B,CAAC;EACH;EAEA,MAAMS,WAAW,GAAG,IAAAC,iCAAmB,EAACJ,WAAW,CAAC;EAEpD,IAAIL,MAAM,IAAI,IAAI,EAAE;IAClB,MAAMU,cAAc,GAAG,IAAIC,sBAAa,CAACX,MAAM,CAAC,CAACA,MAAM,CAACQ,WAAW,CAAC;IAEpE,MAAM,CAACI,OAAO,EAAEC,OAAO,CAAC,GAAGH,cAAc,CAACI,KAAK,CAAC,GAAG,CAAC;IAEpD,MAAMC,WAAW,GAAGrB,uBAAuB,CAACkB,OAAO,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"}
|
|
@@ -6,7 +6,7 @@ import big from "big.js";
|
|
|
6
6
|
*/
|
|
7
7
|
const removeGroupingSeparator = (
|
|
8
8
|
input: string | number,
|
|
9
|
-
groupingSeparator?: ?string
|
|
9
|
+
groupingSeparator?: ?string,
|
|
10
10
|
) => {
|
|
11
11
|
if (typeof input === "number") {
|
|
12
12
|
return input;
|
|
@@ -18,7 +18,7 @@ const removeGroupingSeparator = (
|
|
|
18
18
|
|
|
19
19
|
const escapedGroupingSeparator = groupingSeparator.replace(
|
|
20
20
|
/[$()*+.?[\\\]^{|}]/g,
|
|
21
|
-
"\\$&"
|
|
21
|
+
"\\$&",
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
return input.replace(new RegExp(escapedGroupingSeparator, "g"), "");
|
|
@@ -29,7 +29,7 @@ const removeGroupingSeparator = (
|
|
|
29
29
|
*/
|
|
30
30
|
const updateDecimalSeparator = (
|
|
31
31
|
input: string | number,
|
|
32
|
-
decimalSeparator?: ?string
|
|
32
|
+
decimalSeparator?: ?string,
|
|
33
33
|
) => {
|
|
34
34
|
if (typeof input === "number") {
|
|
35
35
|
return input;
|
|
@@ -49,7 +49,7 @@ const updateDecimalSeparator = (
|
|
|
49
49
|
const parseToNumber = (
|
|
50
50
|
input: ?string | ?number,
|
|
51
51
|
groupingSeparator: ?string = ",",
|
|
52
|
-
decimalSeparator: ?string = "."
|
|
52
|
+
decimalSeparator: ?string = ".",
|
|
53
53
|
): number => {
|
|
54
54
|
if (input == null || input === "") {
|
|
55
55
|
return NaN;
|
|
@@ -59,7 +59,7 @@ const parseToNumber = (
|
|
|
59
59
|
|
|
60
60
|
const inputCorrectDecimalSeparator = updateDecimalSeparator(
|
|
61
61
|
inputNoGrouping,
|
|
62
|
-
decimalSeparator
|
|
62
|
+
decimalSeparator,
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
return Number(inputCorrectDecimalSeparator);
|
|
@@ -71,7 +71,7 @@ const parseToNumber = (
|
|
|
71
71
|
const parseNumberToString = (
|
|
72
72
|
input: ?string | ?number,
|
|
73
73
|
groupingSeparator: ?string = ",",
|
|
74
|
-
decimalSeparator: ?string = "."
|
|
74
|
+
decimalSeparator: ?string = ".",
|
|
75
75
|
): string => {
|
|
76
76
|
if (input == null || input === "") {
|
|
77
77
|
return "NaN";
|
|
@@ -81,7 +81,7 @@ const parseNumberToString = (
|
|
|
81
81
|
|
|
82
82
|
const inputCorrectDecimalSeparator = updateDecimalSeparator(
|
|
83
83
|
inputNoGrouping,
|
|
84
|
-
decimalSeparator
|
|
84
|
+
decimalSeparator,
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
try {
|
|
@@ -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
|
|
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,MACF,CAAC;EAED,OAAOH,KAAK,CAACG,OAAO,CAAC,IAAIC,MAAM,CAACF,wBAAwB,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AACA,MAAMG,sBAAsB,GAAGA,CAC7BL,KAAsB,EACtBM,gBAA0B,KACvB;EACH,IAAI,OAAON,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAIM,gBAAgB,IAAI,IAAI,IAAIA,gBAAgB,KAAK,EAAE,EAAE;IACvD,OAAON,KAAK;EACd;EAEA,OAAOA,KAAK,CAACG,OAAO,CAACG,gBAAgB,EAAE,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,SAAAA,CACpBP,KAAwB,EAGb;EAAA,IAFXC,iBAA0B,GAAAO,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,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
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.3",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"clean": "rimraf lib dist esm coverage && npm run clean:proxies",
|
|
26
26
|
"clean:proxies": "node .build/proxies.js --clean",
|
|
27
27
|
"lint": "eslint --cache .",
|
|
28
|
-
"prettier": "prettier --write \"./
|
|
28
|
+
"prettier": "prettier --write \"./src/**/*.js\"",
|
|
29
29
|
"flow": "flow",
|
|
30
30
|
"flow:ci": "flow check",
|
|
31
31
|
"flow-typed-install": "flow-typed install -l .flow/flow-typed/ --ignoreDeps peer --overwrite",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"styled-components": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@babel/runtime-corejs3": "^7.22.
|
|
85
|
+
"@babel/runtime-corejs3": "^7.22.6",
|
|
86
86
|
"big.js": "^6.2.1",
|
|
87
87
|
"date-fns": "^2.30.0",
|
|
88
88
|
"deepmerge": "^4.3.1",
|
|
@@ -98,50 +98,50 @@
|
|
|
98
98
|
"setimmediate": "^1.0.5"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@babel/cli": "^7.22.
|
|
102
|
-
"@babel/core": "^7.22.
|
|
103
|
-
"@babel/eslint-parser": "^7.22.
|
|
101
|
+
"@babel/cli": "^7.22.9",
|
|
102
|
+
"@babel/core": "^7.22.9",
|
|
103
|
+
"@babel/eslint-parser": "^7.22.9",
|
|
104
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.22.
|
|
108
|
-
"@babel/preset-env": "^7.22.
|
|
107
|
+
"@babel/plugin-transform-runtime": "^7.22.9",
|
|
108
|
+
"@babel/preset-env": "^7.22.9",
|
|
109
109
|
"@babel/preset-flow": "^7.22.5",
|
|
110
110
|
"@babel/preset-react": "^7.22.5",
|
|
111
|
-
"@commitlint/cli": "^17.6.
|
|
112
|
-
"@commitlint/config-conventional": "^17.6.
|
|
111
|
+
"@commitlint/cli": "^17.6.7",
|
|
112
|
+
"@commitlint/config-conventional": "^17.6.7",
|
|
113
113
|
"@testing-library/react": "^14.0.0",
|
|
114
|
-
"auditjs": "^4.0.
|
|
115
|
-
"babel-jest": "^29.
|
|
114
|
+
"auditjs": "^4.0.41",
|
|
115
|
+
"babel-jest": "^29.6.1",
|
|
116
116
|
"babel-plugin-styled-components": "^2.1.4",
|
|
117
117
|
"cherry-pick": "^0.5.0",
|
|
118
118
|
"commit-and-tag-version": "^11.2.2",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
120
|
"documentation": "^14.0.2",
|
|
121
|
-
"eslint": "^8.
|
|
121
|
+
"eslint": "^8.45.0",
|
|
122
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": "^46.4.
|
|
128
|
-
"eslint-plugin-react": "^7.
|
|
126
|
+
"eslint-plugin-jest": "^27.2.3",
|
|
127
|
+
"eslint-plugin-jsdoc": "^46.4.4",
|
|
128
|
+
"eslint-plugin-react": "^7.33.0",
|
|
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": "^10.3.
|
|
134
|
+
"glob": "^10.3.3",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
136
|
"husky": "^8.0.3",
|
|
137
|
-
"jest": "^29.
|
|
138
|
-
"jest-environment-jsdom": "^29.
|
|
137
|
+
"jest": "^29.6.1",
|
|
138
|
+
"jest-environment-jsdom": "^29.6.1",
|
|
139
139
|
"jest-junit": "^16.0.0",
|
|
140
140
|
"jest-sonar-reporter": "^2.0.0",
|
|
141
141
|
"jscodeshift": "^0.15.0",
|
|
142
142
|
"lint-staged": "^13.2.3",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^
|
|
144
|
+
"prettier": "^3.0.0",
|
|
145
145
|
"react": "^18.0.0",
|
|
146
146
|
"react-dom": "^18.0.0",
|
|
147
147
|
"react-helmet-async": "^1.0.0",
|
|
@@ -16,15 +16,15 @@ const projectJson = {
|
|
|
16
16
|
|
|
17
17
|
jest.mock("fs", () => ({
|
|
18
18
|
readFile: jest.fn((path, options, callback) =>
|
|
19
|
-
callback(null, JSON.stringify(projectJson))
|
|
19
|
+
callback(null, JSON.stringify(projectJson)),
|
|
20
20
|
),
|
|
21
21
|
writeFile: jest.fn((path, options, callback) => callback(null)),
|
|
22
22
|
}));
|
|
23
23
|
|
|
24
24
|
jest.mock("glob", () =>
|
|
25
25
|
jest.fn((pattern, options, callback) =>
|
|
26
|
-
callback(null, ["/input/LayoutHintConfig.json"])
|
|
27
|
-
)
|
|
26
|
+
callback(null, ["/input/LayoutHintConfig.json"]),
|
|
27
|
+
),
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
describe("mergeLayoutHintConfigurations", () => {
|
|
@@ -38,7 +38,7 @@ describe("mergeLayoutHintConfigurations", () => {
|
|
|
38
38
|
expect(fs.writeFile).toHaveBeenCalledWith(
|
|
39
39
|
expect.stringContaining("LayoutHintConfig.json"),
|
|
40
40
|
JSON.stringify(expectedJson),
|
|
41
|
-
expect.anything()
|
|
41
|
+
expect.anything(),
|
|
42
42
|
);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -16,7 +16,7 @@ const readFiles = (files: Array<string>) => {
|
|
|
16
16
|
return resolve(JSON.parse(data));
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
})
|
|
19
|
+
}),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
return Promise.all(filePromises);
|
|
@@ -29,7 +29,7 @@ const readFiles = (files: Array<string>) => {
|
|
|
29
29
|
*/
|
|
30
30
|
exports.mergeLayoutHintConfigurations = async (
|
|
31
31
|
srcFolder: string,
|
|
32
|
-
outputFolder: string
|
|
32
|
+
outputFolder: string,
|
|
33
33
|
): Promise<void> => {
|
|
34
34
|
const escapedSrcFolder = srcFolder.replace(/\\/g, "/");
|
|
35
35
|
return new Promise((resolve, reject) => {
|
|
@@ -50,7 +50,7 @@ exports.mergeLayoutHintConfigurations = async (
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return resolve();
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
54
|
);
|
|
55
55
|
});
|
|
56
56
|
});
|
|
@@ -95,7 +95,7 @@ export const MAX_TOTAL_FILESIZE: string = getHint("MAX_TOTAL_FILESIZE");
|
|
|
95
95
|
* Layout-hint: A list with only one detail must be shown as a detail
|
|
96
96
|
*/
|
|
97
97
|
export const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(
|
|
98
|
-
"SHOW_ONE_RESULT_AS_DETAIL"
|
|
98
|
+
"SHOW_ONE_RESULT_AS_DETAIL",
|
|
99
99
|
);
|
|
100
100
|
/**
|
|
101
101
|
* Layout-hint: A list without list-items and list-tasks should not be shown.
|