@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":"NumberAttributeModel.js","names":["_objects","require","_formatValue","_interopRequireDefault","_parseNumbers","_AttributeModel","_ConstraintCollection","_LayoutHints","_constants","_NumberFormatConstraint","_NumberGroupingConstraint","_NumberBoundaryConstraint","NumberAttributeModel","AttributeModel","isApplicableModel","contributions","type","getInitialInputValue","value","formatValue","groupingSeparator","getContribution","decimalSeparator","minNumber","minimum","maxNumber","maximum","maxDigits","format","_includes","default","call","split","length","unit","placeholder","operator","addConstraints","constraints","ConstraintCollection","add","NumberFormatConstraint","NumberGroupingConstraint","NumberBoundaryConstraint","reset","inputvalue","toString","readonlyvalue","isPlainObject","getInputValue","_inputvalue","validate","outputNumber","parseToNumber","isNaN","parseNumberToString","getValue","_value","Number","update","updateLastModification","isHidden","layouthint","has","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","CASEVIEW_LINK","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","exports"],"sources":["../../../src/models/attributes/NumberAttributeModel.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../../utils/helpers/objects\";\nimport formatValue from \"../../utils/number/formatValue\";\nimport {\n parseNumberToString,\n parseToNumber,\n} from \"../../utils/number/parseNumbers\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport {\n CASEVIEW_LINK,\n INITIAL_TOTAL_FILESIZE,\n MAX_TOTAL_FILESIZE,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport NumberFormatConstraint from \"./input-constraints/NumberFormatConstraint\";\nimport NumberGroupingConstraint from \"./input-constraints/NumberGroupingConstraint\";\nimport NumberBoundaryConstraint from \"./input-constraints/NumberBoundaryConstraint\";\n\n/**\n * Number attribute\n */\nexport default class NumberAttributeModel extends AttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return contributions.type === \"number\" || contributions.type === \"integer\";\n }\n\n /**\n */\n get type(): string {\n return \"number\";\n }\n\n /**\n * Get initial value\n */\n getInitialInputValue(value?: string): string {\n if (value == null) {\n return \"\";\n }\n\n return this.formatValue(value);\n }\n\n /**\n * Get grouping separator\n */\n get groupingSeparator(): string {\n return this.getContribution(\"groupingSeparator\", \"\");\n }\n\n /**\n * Get decimal separator\n */\n get decimalSeparator(): string {\n return this.getContribution(\"decimalSeparator\", \"\");\n }\n\n /**\n * Get minimum value\n */\n get minNumber(): ?number {\n return this.contributions.minimum;\n }\n\n /**\n * Get maximum value\n */\n get maxNumber(): ?number {\n return this.contributions.maximum;\n }\n\n /**\n * Gets the maximum digits based on the format\n */\n get maxDigits(): number {\n const format = this.format;\n\n if (format != null && format.includes(\".\")) {\n return format.split(\".\")[1].length;\n }\n\n return 0;\n }\n\n /**\n * Get unit text\n */\n get unit(): string {\n return this.getContribution(\"unit\", \"\");\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n * Add number constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(\n new NumberFormatConstraint(\n this.groupingSeparator,\n this.decimalSeparator,\n this.format\n )\n );\n constraints.add(\n new NumberGroupingConstraint(\n this.groupingSeparator,\n this.decimalSeparator,\n this.format\n )\n );\n constraints.add(\n new NumberBoundaryConstraint(\n this.minNumber,\n this.maxNumber,\n this.groupingSeparator,\n this.decimalSeparator,\n this.format\n )\n );\n\n return constraints;\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.inputvalue = \"\";\n }\n\n /**\n */\n formatValue(value: ?number | ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n return formatValue(\n value,\n this.format,\n this.groupingSeparator,\n this.decimalSeparator\n );\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (!isPlainObject(this.value)) {\n return this.formatValue(this.value);\n }\n\n return this.value;\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.validate(value);\n\n const outputNumber = parseToNumber(\n value,\n this.groupingSeparator,\n this.decimalSeparator\n );\n\n this.value = isNaN(outputNumber) ? null : parseNumberToString(outputNumber);\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): number | null {\n const value = this._value;\n\n return value == null || value === \"\" ? null : Number(value);\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): NumberAttributeModel {\n if (value === this.inputvalue) {\n return this;\n }\n\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get isHidden(): boolean {\n return (\n super.isHidden ||\n this.layouthint.has(\n INITIAL_TOTAL_FILESIZE,\n MAX_TOTAL_FILESIZE,\n CASEVIEW_LINK\n )\n );\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n super.isHidden = isHidden;\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAEA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAEA,IAAAQ,uBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,yBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,yBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAEA;AACA;AACA;AACe,MAAMW,oBAAoB,SAASC,uBAAc,CAAC;EAC/D;AACF;EACE,OAAOC,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,OAAOA,aAAa,CAACC,IAAI,KAAK,QAAQ,IAAID,aAAa,CAACC,IAAI,KAAK,SAAS;EAC5E;;EAEA;AACF;EACE,IAAIA,IAAIA,CAAA,EAAW;IACjB,OAAO,QAAQ;EACjB;;EAEA;AACF;AACA;EACEC,oBAAoBA,CAACC,KAAc,EAAU;IAC3C,IAAIA,KAAK,IAAI,IAAI,EAAE;MACjB,OAAO,EAAE;IACX;IAEA,OAAO,IAAI,CAACC,WAAW,CAACD,KAAK,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IACxB,IAAI,CAACiC,QAAQ,CAACjC,KAAK,CAAC;IAEpB,MAAMkC,YAAY,GAAG,IAAAC,2BAAa,EAChCnC,KAAK,EACL,IAAI,CAACE,iBAAiB,EACtB,IAAI,CAACE,gBACP,CAAC;IAED,IAAI,CAACJ,KAAK,GAAGoC,KAAK,CAACF,YAAY,CAAC,GAAG,IAAI,GAAG,IAAAG,iCAAmB,EAACH,YAAY,CAAC;EAC7E;;EAEA;AACF;AACA;EACEI,QAAQA,CAAA,EAAkB;IACxB,MAAMtC,KAAK,GAAG,IAAI,CAACuC,MAAM;IAEzB,OAAOvC,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,GAAG,IAAI,GAAGwC,MAAM,CAACxC,KAAK,CAAC;EAC7D;;EAEA;AACF;AACA;EACEyC,MAAMA,CAACzC,KAAa,EAAwB;IAC1C,IAAIA,KAAK,KAAK,IAAI,CAAC2B,UAAU,EAAE;MAC7B,OAAO,IAAI;IACb;IAEA,IAAI,CAACe,sBAAsB,CAAC,CAAC;IAC7B,IAAI,CAACf,UAAU,GAAG3B,KAAK;IAEvB,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAI2C,QAAQA,CAAA,EAAY;IACtB,OACE,KAAK,CAACA,QAAQ,IACd,IAAI,CAACC,UAAU,CAACC,GAAG,CACjBC,mCAAsB,EACtBC,+BAAkB,EAClBC,0BACF,CAAC;EAEL;;EAEA;AACF;EACE,IAAIL,QAAQA,CAACA,QAAiB,EAAE;IAC9B,KAAK,CAACA,QAAQ,GAAGA,QAAQ;EAC3B;;EAEA;AACF;EACE,IAAIM,aAAaA,CAAA,EAAkC;IACjD,OAAOC,0BAAe,CAACC,KAAK;EAC9B;AACF;AAACC,OAAA,CAAAxC,OAAA,GAAAlB,oBAAA"}
|
|
1
|
+
{"version":3,"file":"NumberAttributeModel.js","names":["_objects","require","_formatValue","_interopRequireDefault","_parseNumbers","_AttributeModel","_ConstraintCollection","_LayoutHints","_constants","_NumberFormatConstraint","_NumberGroupingConstraint","_NumberBoundaryConstraint","NumberAttributeModel","AttributeModel","isApplicableModel","contributions","type","getInitialInputValue","value","formatValue","groupingSeparator","getContribution","decimalSeparator","minNumber","minimum","maxNumber","maximum","maxDigits","format","_includes","default","call","split","length","unit","placeholder","operator","addConstraints","constraints","ConstraintCollection","add","NumberFormatConstraint","NumberGroupingConstraint","NumberBoundaryConstraint","reset","inputvalue","toString","readonlyvalue","isPlainObject","getInputValue","_inputvalue","validate","outputNumber","parseToNumber","isNaN","parseNumberToString","getValue","_value","Number","update","updateLastModification","isHidden","layouthint","has","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","CASEVIEW_LINK","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","exports"],"sources":["../../../src/models/attributes/NumberAttributeModel.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../../utils/helpers/objects\";\nimport formatValue from \"../../utils/number/formatValue\";\nimport {\n parseNumberToString,\n parseToNumber,\n} from \"../../utils/number/parseNumbers\";\n\nimport AttributeModel from \"./AttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport {\n CASEVIEW_LINK,\n INITIAL_TOTAL_FILESIZE,\n MAX_TOTAL_FILESIZE,\n} from \"../../constants/LayoutHints\";\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\nimport NumberFormatConstraint from \"./input-constraints/NumberFormatConstraint\";\nimport NumberGroupingConstraint from \"./input-constraints/NumberGroupingConstraint\";\nimport NumberBoundaryConstraint from \"./input-constraints/NumberBoundaryConstraint\";\n\n/**\n * Number attribute\n */\nexport default class NumberAttributeModel extends AttributeModel {\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return contributions.type === \"number\" || contributions.type === \"integer\";\n }\n\n /**\n */\n get type(): string {\n return \"number\";\n }\n\n /**\n * Get initial value\n */\n getInitialInputValue(value?: string): string {\n if (value == null) {\n return \"\";\n }\n\n return this.formatValue(value);\n }\n\n /**\n * Get grouping separator\n */\n get groupingSeparator(): string {\n return this.getContribution(\"groupingSeparator\", \"\");\n }\n\n /**\n * Get decimal separator\n */\n get decimalSeparator(): string {\n return this.getContribution(\"decimalSeparator\", \"\");\n }\n\n /**\n * Get minimum value\n */\n get minNumber(): ?number {\n return this.contributions.minimum;\n }\n\n /**\n * Get maximum value\n */\n get maxNumber(): ?number {\n return this.contributions.maximum;\n }\n\n /**\n * Gets the maximum digits based on the format\n */\n get maxDigits(): number {\n const format = this.format;\n\n if (format != null && format.includes(\".\")) {\n return format.split(\".\")[1].length;\n }\n\n return 0;\n }\n\n /**\n * Get unit text\n */\n get unit(): string {\n return this.getContribution(\"unit\", \"\");\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n */\n get operator(): string {\n return this.getContribution(\"operator\", \"\");\n }\n\n /**\n * Add number constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n constraints.add(\n new NumberFormatConstraint(\n this.groupingSeparator,\n this.decimalSeparator,\n this.format,\n ),\n );\n constraints.add(\n new NumberGroupingConstraint(\n this.groupingSeparator,\n this.decimalSeparator,\n this.format,\n ),\n );\n constraints.add(\n new NumberBoundaryConstraint(\n this.minNumber,\n this.maxNumber,\n this.groupingSeparator,\n this.decimalSeparator,\n this.format,\n ),\n );\n\n return constraints;\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.inputvalue = \"\";\n }\n\n /**\n */\n formatValue(value: ?number | ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n return formatValue(\n value,\n this.format,\n this.groupingSeparator,\n this.decimalSeparator,\n );\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (!isPlainObject(this.value)) {\n return this.formatValue(this.value);\n }\n\n return this.value;\n }\n\n /**\n * Returns the value as entered by the user. This can differ from the internal iso value that is stored\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n this.validate(value);\n\n const outputNumber = parseToNumber(\n value,\n this.groupingSeparator,\n this.decimalSeparator,\n );\n\n this.value = isNaN(outputNumber) ? null : parseNumberToString(outputNumber);\n }\n\n /**\n * Getting the value of the attribute\n */\n getValue(): number | null {\n const value = this._value;\n\n return value == null || value === \"\" ? null : Number(value);\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): NumberAttributeModel {\n if (value === this.inputvalue) {\n return this;\n }\n\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get isHidden(): boolean {\n return (\n super.isHidden ||\n this.layouthint.has(\n INITIAL_TOTAL_FILESIZE,\n MAX_TOTAL_FILESIZE,\n CASEVIEW_LINK,\n )\n );\n }\n\n /**\n */\n set isHidden(isHidden: boolean) {\n super.isHidden = isHidden;\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAEA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAEA,IAAAQ,uBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,yBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,yBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAEA;AACA;AACA;AACe,MAAMW,oBAAoB,SAASC,uBAAc,CAAC;EAC/D;AACF;EACE,OAAOC,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,OAAOA,aAAa,CAACC,IAAI,KAAK,QAAQ,IAAID,aAAa,CAACC,IAAI,KAAK,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AaA,CAAA,EAAkC;IACjD,OAAOC,0BAAe,CAACC,KAAK;EAC9B;AACF;AAACC,OAAA,CAAAxC,OAAA,GAAAlB,oBAAA"}
|
|
@@ -105,7 +105,7 @@ export default class PasswordAttributeModel extends StringAttributeModel {
|
|
|
105
105
|
getConfirmPasswordConstraints(): ConstraintCollection {
|
|
106
106
|
const constraints = new ConstraintCollection();
|
|
107
107
|
constraints.add(
|
|
108
|
-
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
|
|
108
|
+
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel),
|
|
109
109
|
);
|
|
110
110
|
return constraints;
|
|
111
111
|
}
|
|
@@ -123,24 +123,24 @@ export default class PasswordAttributeModel extends StringAttributeModel {
|
|
|
123
123
|
if (this.maxSequenceOfIdenticalCharacters) {
|
|
124
124
|
constraints.add(
|
|
125
125
|
new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
|
|
126
|
-
this.maxSequenceOfIdenticalCharacters
|
|
127
|
-
)
|
|
126
|
+
this.maxSequenceOfIdenticalCharacters,
|
|
127
|
+
),
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
if (this.minNumberOfNumericCharacters) {
|
|
132
132
|
constraints.add(
|
|
133
133
|
new PasswordMinNumericCharactersConstraint(
|
|
134
|
-
this.minNumberOfNumericCharacters
|
|
135
|
-
)
|
|
134
|
+
this.minNumberOfNumericCharacters,
|
|
135
|
+
),
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (this.minNumberOfSpecialCharacters) {
|
|
140
140
|
constraints.add(
|
|
141
141
|
new PasswordMinSpecialCharactersConstraint(
|
|
142
|
-
this.minNumberOfSpecialCharacters
|
|
143
|
-
)
|
|
142
|
+
this.minNumberOfSpecialCharacters,
|
|
143
|
+
),
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -155,7 +155,7 @@ export default class PasswordAttributeModel extends StringAttributeModel {
|
|
|
155
155
|
this.isConfirmPassword == null
|
|
156
156
|
) {
|
|
157
157
|
constraints.add(
|
|
158
|
-
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
|
|
158
|
+
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel),
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordAttributeModel.js","names":["_StringAttributeModel","_interopRequireDefault","require","_ConstraintCollection","_PasswordLowerAndUpperCaseConstraint","_PasswordThreeConsecutiveCharactersNotAllowedConstraint","_PasswordMinNumericCharactersConstraint","_PasswordMinSpecialCharactersConstraint","_RegexConstraint","_PasswordConfirmConstraint","_LayoutHints","PasswordAttributeModel","StringAttributeModel","constructor","arguments","_defineProperty2","default","isApplicableModel","contributions","layouthint","type","Array","isArray","_includes","call","update","value","updateLastModification","inputvalue","constraints","getContribution","upperAndLowerCaseMandatory","maxSequenceOfIdenticalCharacters","maxSequenceOfUsernameCharacters","minNumberOfNumericCharacters","minNumberOfSpecialCharacters","regexConstraints","regexConstraint","addConstraints","isConfirmPassword","getConfirmPasswordConstraints","getStandardPasswordConstraints","ConstraintCollection","add","PasswordConfirmConstraint","confirmValue","otherLabel","PasswordLowerAndUpperCaseConstraint","PasswordThreeConsecutiveCharactersNotAllowedConstraint","PasswordMinNumericCharactersConstraint","PasswordMinSpecialCharactersConstraint","length","forEach","RegexConstraint","has","CONFIRM_PASSWORD","constraintCollection","_isConfirmPassword","_confirmValue","validate","_otherLabel","useClientsideValidation","isOptionalAndEmpty","_isValid","_validatedValue","getFormData","inError","name","exports"],"sources":["../../../src/models/attributes/PasswordAttributeModel.js"],"sourcesContent":["// @flow\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport PasswordLowerAndUpperCaseConstraint from \"./input-constraints/PasswordLowerAndUpperCaseConstraint\";\nimport PasswordThreeConsecutiveCharactersNotAllowedConstraint from \"./input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint\";\nimport PasswordMinNumericCharactersConstraint from \"./input-constraints/PasswordMinNumericCharactersConstraint\";\nimport PasswordMinSpecialCharactersConstraint from \"./input-constraints/PasswordMinSpecialCharactersConstraint\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport PasswordConfirmConstraint from \"./input-constraints/PasswordConfirmConstraint\";\n\nimport { CONFIRM_PASSWORD } from \"../../constants/LayoutHints\";\n\nimport type { RegexObject } from \"./input-constraints/RegexConstraint\";\n\n/**\n * Password attribute\n */\nexport default class PasswordAttributeModel extends StringAttributeModel {\n _confirmValue: string;\n _isConfirmPassword: boolean;\n _otherLabel: string;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"password\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"password\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"password\";\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): PasswordAttributeModel {\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get constraints(): Object {\n return this.getContribution(\"constraints\", {});\n }\n\n /**\n */\n get upperAndLowerCaseMandatory(): ?boolean {\n return this.constraints.upperAndLowerCaseMandatory;\n }\n\n /**\n */\n get maxSequenceOfIdenticalCharacters(): ?number {\n return this.constraints.maxSequenceOfIdenticalCharacters;\n }\n\n /**\n */\n get maxSequenceOfUsernameCharacters(): ?number {\n return this.constraints.maxSequenceOfUsernameCharacters;\n }\n\n /**\n */\n get minNumberOfNumericCharacters(): ?number {\n return this.constraints.minNumberOfNumericCharacters;\n }\n\n /**\n */\n get minNumberOfSpecialCharacters(): ?number {\n return this.constraints.minNumberOfSpecialCharacters;\n }\n\n /**\n */\n get regexConstraints(): ?Array<RegexObject> {\n return this.constraints.regexConstraint;\n }\n\n /**\n * Add password constraints\n */\n addConstraints(): ConstraintCollection {\n if (this.isConfirmPassword) {\n return this.getConfirmPasswordConstraints();\n }\n return this.getStandardPasswordConstraints();\n }\n\n /**\n * Constraints for a confirmation password\n */\n getConfirmPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n return constraints;\n }\n\n /**\n * Constrains for a standard password\n */\n getStandardPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.upperAndLowerCaseMandatory) {\n constraints.add(new PasswordLowerAndUpperCaseConstraint());\n }\n\n if (this.maxSequenceOfIdenticalCharacters) {\n constraints.add(\n new PasswordThreeConsecutiveCharactersNotAllowedConstraint(\n this.maxSequenceOfIdenticalCharacters\n )\n );\n }\n\n if (this.minNumberOfNumericCharacters) {\n constraints.add(\n new PasswordMinNumericCharactersConstraint(\n this.minNumberOfNumericCharacters\n )\n );\n }\n\n if (this.minNumberOfSpecialCharacters) {\n constraints.add(\n new PasswordMinSpecialCharactersConstraint(\n this.minNumberOfSpecialCharacters\n )\n );\n }\n\n if (this.regexConstraints && this.regexConstraints.length > 0) {\n this.regexConstraints.forEach((regexConstraint) => {\n constraints.add(new RegexConstraint(regexConstraint));\n });\n }\n\n if (\n this.layouthint.has(CONFIRM_PASSWORD) &&\n this.isConfirmPassword == null\n ) {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n }\n\n return constraints;\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n if (this.isConfirmPassword) {\n // confirm password only needs local constraints, no server constraints\n return this.getConfirmPasswordConstraints();\n }\n\n return super.constraintCollection;\n }\n\n /**\n */\n get isConfirmPassword(): boolean | null {\n return this._isConfirmPassword;\n }\n\n /**\n */\n set isConfirmPassword(isConfirmPassword: boolean) {\n this._isConfirmPassword = isConfirmPassword;\n }\n\n /**\n */\n get confirmValue(): string {\n return this._confirmValue || \"\";\n }\n\n /**\n */\n set confirmValue(confirmValue: string) {\n this._confirmValue = confirmValue;\n\n this.validate(this.inputvalue);\n }\n\n /**\n */\n get otherLabel(): string {\n return this._otherLabel;\n }\n\n /**\n */\n set otherLabel(otherLabel: string) {\n this._otherLabel = otherLabel;\n }\n\n /**\n * Validate input\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== `${this.confirmValue}-${value}`) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = `${this.confirmValue}-${value}`;\n\n return this._isValid;\n }\n\n /**\n */\n getFormData(): { [string]: any } | null {\n if (this.isConfirmPassword || this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,oCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uDAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,uCAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,uCAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,0BAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,YAAA,GAAAR,OAAA;AAIA;AACA;AACA;AACe,MAAMS,sBAAsB,SAASC,6BAAoB,CAAC;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;EAAA;EAKvE;AACF;EACE,OAAOC,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,MAAMC,UAAU,GAAGD,aAAa,EAAEC,UAAU;IAC5C,OACED,aAAa,CAAC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EAAC,EAAE;MACnE,IAAI,CAACqC,QAAQ,GAAG,IAAI,CAACP,oBAAoB,CAACG,QAAQ,CAACjC,KAAK,CAAC;IAC3D;IACA,IAAI,CAACsC,eAAe,GAAI,GAAE,IAAI,CAACnB,YAAa,IAAGnB,KAAM,EAAC;IAEtD,OAAO,IAAI,CAACqC,QAAQ;EACtB;;EAEA;AACF;EACEE,WAAWA,CAAA,EAA6B;IACtC,IAAI,IAAI,CAAC1B,iBAAiB,IAAI,IAAI,CAAC2B,OAAO,CAAC,CAAC,EAAE;MAC5C,OAAO,IAAI;IACb;IAEA,OAAO;MACL,CAAC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACzC;IACpB,CAAC;EACH;AACF;AAAC0C,OAAA,CAAApD,OAAA,GAAAL,sBAAA"}
|
|
1
|
+
{"version":3,"file":"PasswordAttributeModel.js","names":["_StringAttributeModel","_interopRequireDefault","require","_ConstraintCollection","_PasswordLowerAndUpperCaseConstraint","_PasswordThreeConsecutiveCharactersNotAllowedConstraint","_PasswordMinNumericCharactersConstraint","_PasswordMinSpecialCharactersConstraint","_RegexConstraint","_PasswordConfirmConstraint","_LayoutHints","PasswordAttributeModel","StringAttributeModel","constructor","arguments","_defineProperty2","default","isApplicableModel","contributions","layouthint","type","Array","isArray","_includes","call","update","value","updateLastModification","inputvalue","constraints","getContribution","upperAndLowerCaseMandatory","maxSequenceOfIdenticalCharacters","maxSequenceOfUsernameCharacters","minNumberOfNumericCharacters","minNumberOfSpecialCharacters","regexConstraints","regexConstraint","addConstraints","isConfirmPassword","getConfirmPasswordConstraints","getStandardPasswordConstraints","ConstraintCollection","add","PasswordConfirmConstraint","confirmValue","otherLabel","PasswordLowerAndUpperCaseConstraint","PasswordThreeConsecutiveCharactersNotAllowedConstraint","PasswordMinNumericCharactersConstraint","PasswordMinSpecialCharactersConstraint","length","forEach","RegexConstraint","has","CONFIRM_PASSWORD","constraintCollection","_isConfirmPassword","_confirmValue","validate","_otherLabel","useClientsideValidation","isOptionalAndEmpty","_isValid","_validatedValue","getFormData","inError","name","exports"],"sources":["../../../src/models/attributes/PasswordAttributeModel.js"],"sourcesContent":["// @flow\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport PasswordLowerAndUpperCaseConstraint from \"./input-constraints/PasswordLowerAndUpperCaseConstraint\";\nimport PasswordThreeConsecutiveCharactersNotAllowedConstraint from \"./input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint\";\nimport PasswordMinNumericCharactersConstraint from \"./input-constraints/PasswordMinNumericCharactersConstraint\";\nimport PasswordMinSpecialCharactersConstraint from \"./input-constraints/PasswordMinSpecialCharactersConstraint\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport PasswordConfirmConstraint from \"./input-constraints/PasswordConfirmConstraint\";\n\nimport { CONFIRM_PASSWORD } from \"../../constants/LayoutHints\";\n\nimport type { RegexObject } from \"./input-constraints/RegexConstraint\";\n\n/**\n * Password attribute\n */\nexport default class PasswordAttributeModel extends StringAttributeModel {\n _confirmValue: string;\n _isConfirmPassword: boolean;\n _otherLabel: string;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"password\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"password\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"password\";\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): PasswordAttributeModel {\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get constraints(): Object {\n return this.getContribution(\"constraints\", {});\n }\n\n /**\n */\n get upperAndLowerCaseMandatory(): ?boolean {\n return this.constraints.upperAndLowerCaseMandatory;\n }\n\n /**\n */\n get maxSequenceOfIdenticalCharacters(): ?number {\n return this.constraints.maxSequenceOfIdenticalCharacters;\n }\n\n /**\n */\n get maxSequenceOfUsernameCharacters(): ?number {\n return this.constraints.maxSequenceOfUsernameCharacters;\n }\n\n /**\n */\n get minNumberOfNumericCharacters(): ?number {\n return this.constraints.minNumberOfNumericCharacters;\n }\n\n /**\n */\n get minNumberOfSpecialCharacters(): ?number {\n return this.constraints.minNumberOfSpecialCharacters;\n }\n\n /**\n */\n get regexConstraints(): ?Array<RegexObject> {\n return this.constraints.regexConstraint;\n }\n\n /**\n * Add password constraints\n */\n addConstraints(): ConstraintCollection {\n if (this.isConfirmPassword) {\n return this.getConfirmPasswordConstraints();\n }\n return this.getStandardPasswordConstraints();\n }\n\n /**\n * Constraints for a confirmation password\n */\n getConfirmPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel),\n );\n return constraints;\n }\n\n /**\n * Constrains for a standard password\n */\n getStandardPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.upperAndLowerCaseMandatory) {\n constraints.add(new PasswordLowerAndUpperCaseConstraint());\n }\n\n if (this.maxSequenceOfIdenticalCharacters) {\n constraints.add(\n new PasswordThreeConsecutiveCharactersNotAllowedConstraint(\n this.maxSequenceOfIdenticalCharacters,\n ),\n );\n }\n\n if (this.minNumberOfNumericCharacters) {\n constraints.add(\n new PasswordMinNumericCharactersConstraint(\n this.minNumberOfNumericCharacters,\n ),\n );\n }\n\n if (this.minNumberOfSpecialCharacters) {\n constraints.add(\n new PasswordMinSpecialCharactersConstraint(\n this.minNumberOfSpecialCharacters,\n ),\n );\n }\n\n if (this.regexConstraints && this.regexConstraints.length > 0) {\n this.regexConstraints.forEach((regexConstraint) => {\n constraints.add(new RegexConstraint(regexConstraint));\n });\n }\n\n if (\n this.layouthint.has(CONFIRM_PASSWORD) &&\n this.isConfirmPassword == null\n ) {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel),\n );\n }\n\n return constraints;\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n if (this.isConfirmPassword) {\n // confirm password only needs local constraints, no server constraints\n return this.getConfirmPasswordConstraints();\n }\n\n return super.constraintCollection;\n }\n\n /**\n */\n get isConfirmPassword(): boolean | null {\n return this._isConfirmPassword;\n }\n\n /**\n */\n set isConfirmPassword(isConfirmPassword: boolean) {\n this._isConfirmPassword = isConfirmPassword;\n }\n\n /**\n */\n get confirmValue(): string {\n return this._confirmValue || \"\";\n }\n\n /**\n */\n set confirmValue(confirmValue: string) {\n this._confirmValue = confirmValue;\n\n this.validate(this.inputvalue);\n }\n\n /**\n */\n get otherLabel(): string {\n return this._otherLabel;\n }\n\n /**\n */\n set otherLabel(otherLabel: string) {\n this._otherLabel = otherLabel;\n }\n\n /**\n * Validate input\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== `${this.confirmValue}-${value}`) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = `${this.confirmValue}-${value}`;\n\n return this._isValid;\n }\n\n /**\n */\n getFormData(): { [string]: any } | null {\n if (this.isConfirmPassword || this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,oCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,uDAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,uCAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,uCAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,0BAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,YAAA,GAAAR,OAAA;AAIA;AACA;AACA;AACe,MAAMS,sBAAsB,SAASC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AAW;IAC/B;IACA,IAAI,CAAC,IAAI,CAACmC,uBAAuB,CAAC,CAAC,EAAE;MACnC,OAAO,IAAI;IACb;IAEA,IAAI,IAAI,CAACC,kBAAkB,CAACpC,KAAK,CAAC,EAAE;MAClC,IAAI,CAACqC,QAAQ,GAAG,IAAI;IACtB,CAAC,MAAM,IAAI,IAAI,CAACC,eAAe,KAAM,GAAE,IAAI,CAACnB,YAAa,IAAGnB,KAAM,EAAC,EAAE;MACnE,IAAI,CAACqC,QAAQ,GAAG,IAAI,CAACP,oBAAoB,CAACG,QAAQ,CAACjC,KAAK,CAAC;IAC3D;IACA,IAAI,CAACsC,eAAe,GAAI,GAAE,IAAI,CAACnB,YAAa,IAAGnB,KAAM,EAAC;IAEtD,OAAO,IAAI,CAACqC,QAAQ;EACtB;;EAEA;AACF;EACEE,WAAWA,CAAA,EAA6B;IACtC,IAAI,IAAI,CAAC1B,iBAAiB,IAAI,IAAI,CAAC2B,OAAO,CAAC,CAAC,EAAE;MAC5C,OAAO,IAAI;IACb;IAEA,OAAO;MACL,CAAC,IAAI,CAACC,IAAI,GAAG,IAAI,CAACzC;IACpB,CAAC;EACH;AACF;AAAC0C,OAAA,CAAApD,OAAA,GAAAL,sBAAA"}
|
|
@@ -127,7 +127,7 @@ export default class StringAttributeModel extends AttributeModel {
|
|
|
127
127
|
messageKey: "Constraint.ZipCode.InvalidFormat",
|
|
128
128
|
defaultMessage: "Must be a valid Dutch ZIP code, e.g. 1234 AB",
|
|
129
129
|
regex: this.regexp,
|
|
130
|
-
})
|
|
130
|
+
}),
|
|
131
131
|
);
|
|
132
132
|
} else if (this.isEmail() && this.regexp) {
|
|
133
133
|
constraints.add(
|
|
@@ -135,7 +135,7 @@ export default class StringAttributeModel extends AttributeModel {
|
|
|
135
135
|
messageKey: "Constraint.Email.InvalidFormat",
|
|
136
136
|
defaultMessage: "Must be a valid e-mail address",
|
|
137
137
|
regex: new RegExp(this.regexp, "gi"),
|
|
138
|
-
})
|
|
138
|
+
}),
|
|
139
139
|
);
|
|
140
140
|
} else if (this.regexp) {
|
|
141
141
|
constraints.add(
|
|
@@ -143,7 +143,7 @@ export default class StringAttributeModel extends AttributeModel {
|
|
|
143
143
|
messageKey: "Constraint.String.InvalidRegex",
|
|
144
144
|
defaultMessage: this.regexpvalidationmessage,
|
|
145
145
|
regex: this.regexp,
|
|
146
|
-
})
|
|
146
|
+
}),
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringAttributeModel.js","names":["_AttributeModel","_interopRequireDefault","require","_ConstraintCollection","_RegexConstraint","_BSNConstraint","_IBANConstraint","_constants","StringAttributeModel","AttributeModel","constructor","attribute","attributeContributions","_defineProperty2","default","_placeholder","getContribution","getInitialInputValue","value","formatValue","isApplicableModel","contributions","layouthint","type","Array","isArray","_includes","call","regexp","regexpvalidationmessage","postfix","prefix","placeholder","isBSN","has","isIBAN","isZipcode","isEmail","addConstraints","constraints","ConstraintCollection","add","BSNConstraint","IBANConstraint","RegexConstraint","messageKey","defaultMessage","regex","RegExp","reset","inputvalue","formatIBAN","noFormat","removeFormat","groups","replace","match","join","formatZipcode","length","substring","toUpperCase","formatBSN","toString","validateValue","getInputValue","_inputvalue","validate","readonlyvalue","update","updateLastModification","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","LARGE","MEDIUM","exports"],"sources":["../../../src/models/attributes/StringAttributeModel.js"],"sourcesContent":["// @flow\nimport AttributeModel from \"./AttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport BSNConstraint from \"./input-constraints/BSNConstraint\";\nimport IBANConstraint from \"./input-constraints/IBANConstraint\";\n\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\n/**\n * String attribute\n */\nexport default class StringAttributeModel extends AttributeModel {\n _placeholder: string;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._placeholder = this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): string {\n return this.formatValue(value);\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"string\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"string\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"string\";\n }\n\n /**\n * Get Regexp pattern\n */\n get regexp(): string | null {\n return this.getContribution(\"regexp\");\n }\n\n /**\n */\n get regexpvalidationmessage(): string | null {\n return this.getContribution(\"regexpValidationMessage\");\n }\n\n /**\n * Get postfix text\n */\n get postfix(): string {\n return this.getContribution(\"postfix\", \"\");\n }\n\n /**\n * Get prefix text\n */\n get prefix(): string {\n return this.getContribution(\"prefix\", \"\");\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this._placeholder;\n }\n\n /**\n * Set placeholder text\n */\n set placeholder(placeholder: string) {\n this._placeholder = placeholder;\n }\n\n /**\n */\n isBSN(): boolean {\n return this.layouthint.has(\"bsn\");\n }\n\n /**\n */\n isIBAN(): boolean {\n return this.layouthint.has(\"iban\");\n }\n\n /**\n */\n isZipcode(): boolean {\n return this.layouthint.has(\"zipcode\");\n }\n\n /**\n */\n isEmail(): boolean {\n return this.layouthint.has(\"email\");\n }\n\n /**\n * Add regex constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.isBSN()) {\n constraints.add(new BSNConstraint());\n } else if (this.isIBAN()) {\n constraints.add(new IBANConstraint());\n }\n\n if (this.isZipcode() && this.regexp) {\n constraints.add(\n new RegexConstraint({\n messageKey: \"Constraint.ZipCode.InvalidFormat\",\n defaultMessage: \"Must be a valid Dutch ZIP code, e.g. 1234 AB\",\n regex: this.regexp,\n })\n );\n } else if (this.isEmail() && this.regexp) {\n constraints.add(\n new RegexConstraint({\n messageKey: \"Constraint.Email.InvalidFormat\",\n defaultMessage: \"Must be a valid e-mail address\",\n regex: new RegExp(this.regexp, \"gi\"),\n })\n );\n } else if (this.regexp) {\n constraints.add(\n new RegexConstraint({\n messageKey: \"Constraint.String.InvalidRegex\",\n defaultMessage: this.regexpvalidationmessage,\n regex: this.regexp,\n })\n );\n }\n\n return constraints;\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.inputvalue = \"\";\n }\n\n /**\n */\n formatIBAN(value: string): string {\n const noFormat = this.removeFormat(value);\n\n const groups = noFormat.replace(/\\s/g, \"\").match(/.{1,4}/g);\n return groups == null ? \"\" : groups.join(\" \");\n }\n\n /**\n */\n formatZipcode(value: string): string {\n const noFormat = this.removeFormat(value);\n if (noFormat.length > 4) {\n return (\n noFormat.substring(0, 4) + \" \" + noFormat.substring(4).toUpperCase()\n );\n }\n return noFormat;\n }\n\n /**\n */\n formatBSN(value: string): string {\n return this.removeFormat(value);\n }\n\n /**\n */\n formatValue(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n if (this.isIBAN()) {\n return this.formatIBAN(value);\n }\n\n if (this.isZipcode()) {\n return this.formatZipcode(value);\n }\n\n if (this.isBSN()) {\n return this.formatBSN(value);\n }\n\n return value;\n }\n\n /**\n */\n removeFormat(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n if (this.isIBAN() || this.isZipcode() || this.isBSN()) {\n return value.replace(/\\.|\\s/g, \"\");\n }\n\n return value;\n }\n\n /**\n */\n get validateValue(): string {\n return this.removeFormat(this.inputvalue);\n }\n\n /**\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n\n this.value = value == null ? value : this.removeFormat(value);\n this.validate(this.validateValue);\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (typeof this.value === \"string\") {\n return this.formatValue(this.value);\n }\n\n return this.value == null ? \"\" : this.value;\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): StringAttributeModel {\n if (this.inputvalue === value) {\n return this;\n }\n\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.isZipcode() || this.isBSN()) {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n if (this.isIBAN()) {\n return ATTRIBUTE_WIDTH.LARGE;\n }\n\n // default value (also applied for email address + download attribute)\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACe,MAAMM,oBAAoB,SAASC,uBAAc,CAAC;EAG/D;AACF;EACEC,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAEzC,IAAI,CAACC,YAAY,GAAG,IAAI,CAACC,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC;EAC7D;;EAEA;AACF;AACA;EACEC,oBAAoBA,CAACC,KAAU,EAAU;IACvC,OAAO,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;EAChC;;EAEA;AACF;EACE,OAAOE,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,MAAMC,UAAU,GAAGD,aAAa,EAAEC,UAAU;IAC5C,OACED,aAAa,CAACE,IAAI,KAAK,QAAQ,IAC9BC,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,IAAI,IAAAI,SAAA,CAAAZ,OAAA,EAAAQ,UAAU,EAAAK,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OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIqD,aAAaA,CAAA,EAAkC;IACjD,IAAI,IAAI,CAACnC,SAAS,CAAC,CAAC,IAAI,IAAI,CAACH,KAAK,CAAC,CAAC,EAAE;MACpC,OAAOuC,0BAAe,CAACC,KAAK;IAC9B;IAEA,IAAI,IAAI,CAACtC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOqC,0BAAe,CAACE,KAAK;IAC9B;;IAEA;IACA,OAAOF,0BAAe,CAACG,MAAM;EAC/B;AACF;AAACC,OAAA,CAAA9D,OAAA,GAAAN,oBAAA"}
|
|
1
|
+
{"version":3,"file":"StringAttributeModel.js","names":["_AttributeModel","_interopRequireDefault","require","_ConstraintCollection","_RegexConstraint","_BSNConstraint","_IBANConstraint","_constants","StringAttributeModel","AttributeModel","constructor","attribute","attributeContributions","_defineProperty2","default","_placeholder","getContribution","getInitialInputValue","value","formatValue","isApplicableModel","contributions","layouthint","type","Array","isArray","_includes","call","regexp","regexpvalidationmessage","postfix","prefix","placeholder","isBSN","has","isIBAN","isZipcode","isEmail","addConstraints","constraints","ConstraintCollection","add","BSNConstraint","IBANConstraint","RegexConstraint","messageKey","defaultMessage","regex","RegExp","reset","inputvalue","formatIBAN","noFormat","removeFormat","groups","replace","match","join","formatZipcode","length","substring","toUpperCase","formatBSN","toString","validateValue","getInputValue","_inputvalue","validate","readonlyvalue","update","updateLastModification","readonlyWidth","ATTRIBUTE_WIDTH","SMALL","LARGE","MEDIUM","exports"],"sources":["../../../src/models/attributes/StringAttributeModel.js"],"sourcesContent":["// @flow\nimport AttributeModel from \"./AttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport BSNConstraint from \"./input-constraints/BSNConstraint\";\nimport IBANConstraint from \"./input-constraints/IBANConstraint\";\n\nimport { ATTRIBUTE_WIDTH } from \"../../constants\";\n\n/**\n * String attribute\n */\nexport default class StringAttributeModel extends AttributeModel {\n _placeholder: string;\n\n /**\n */\n constructor(attribute: Object, attributeContributions: Object) {\n super(attribute, attributeContributions);\n\n this._placeholder = this.getContribution(\"placeholder\", \"\");\n }\n\n /**\n * Retrieve initial input value\n */\n getInitialInputValue(value: any): string {\n return this.formatValue(value);\n }\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"string\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"string\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"string\";\n }\n\n /**\n * Get Regexp pattern\n */\n get regexp(): string | null {\n return this.getContribution(\"regexp\");\n }\n\n /**\n */\n get regexpvalidationmessage(): string | null {\n return this.getContribution(\"regexpValidationMessage\");\n }\n\n /**\n * Get postfix text\n */\n get postfix(): string {\n return this.getContribution(\"postfix\", \"\");\n }\n\n /**\n * Get prefix text\n */\n get prefix(): string {\n return this.getContribution(\"prefix\", \"\");\n }\n\n /**\n * Get placeholder text\n */\n get placeholder(): string {\n return this._placeholder;\n }\n\n /**\n * Set placeholder text\n */\n set placeholder(placeholder: string) {\n this._placeholder = placeholder;\n }\n\n /**\n */\n isBSN(): boolean {\n return this.layouthint.has(\"bsn\");\n }\n\n /**\n */\n isIBAN(): boolean {\n return this.layouthint.has(\"iban\");\n }\n\n /**\n */\n isZipcode(): boolean {\n return this.layouthint.has(\"zipcode\");\n }\n\n /**\n */\n isEmail(): boolean {\n return this.layouthint.has(\"email\");\n }\n\n /**\n * Add regex constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.isBSN()) {\n constraints.add(new BSNConstraint());\n } else if (this.isIBAN()) {\n constraints.add(new IBANConstraint());\n }\n\n if (this.isZipcode() && this.regexp) {\n constraints.add(\n new RegexConstraint({\n messageKey: \"Constraint.ZipCode.InvalidFormat\",\n defaultMessage: \"Must be a valid Dutch ZIP code, e.g. 1234 AB\",\n regex: this.regexp,\n }),\n );\n } else if (this.isEmail() && this.regexp) {\n constraints.add(\n new RegexConstraint({\n messageKey: \"Constraint.Email.InvalidFormat\",\n defaultMessage: \"Must be a valid e-mail address\",\n regex: new RegExp(this.regexp, \"gi\"),\n }),\n );\n } else if (this.regexp) {\n constraints.add(\n new RegexConstraint({\n messageKey: \"Constraint.String.InvalidRegex\",\n defaultMessage: this.regexpvalidationmessage,\n regex: this.regexp,\n }),\n );\n }\n\n return constraints;\n }\n\n /**\n * Reset attribute to empty string\n */\n reset() {\n this.inputvalue = \"\";\n }\n\n /**\n */\n formatIBAN(value: string): string {\n const noFormat = this.removeFormat(value);\n\n const groups = noFormat.replace(/\\s/g, \"\").match(/.{1,4}/g);\n return groups == null ? \"\" : groups.join(\" \");\n }\n\n /**\n */\n formatZipcode(value: string): string {\n const noFormat = this.removeFormat(value);\n if (noFormat.length > 4) {\n return (\n noFormat.substring(0, 4) + \" \" + noFormat.substring(4).toUpperCase()\n );\n }\n return noFormat;\n }\n\n /**\n */\n formatBSN(value: string): string {\n return this.removeFormat(value);\n }\n\n /**\n */\n formatValue(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n if (this.isIBAN()) {\n return this.formatIBAN(value);\n }\n\n if (this.isZipcode()) {\n return this.formatZipcode(value);\n }\n\n if (this.isBSN()) {\n return this.formatBSN(value);\n }\n\n return value;\n }\n\n /**\n */\n removeFormat(value: ?string): string {\n if (value == null || value.toString() === \"\") {\n return \"\";\n }\n\n if (this.isIBAN() || this.isZipcode() || this.isBSN()) {\n return value.replace(/\\.|\\s/g, \"\");\n }\n\n return value;\n }\n\n /**\n */\n get validateValue(): string {\n return this.removeFormat(this.inputvalue);\n }\n\n /**\n */\n get inputvalue(): string {\n return this.getInputValue();\n }\n\n /**\n * Sets the input value to the value entered by the user\n */\n set inputvalue(value: string) {\n this._inputvalue = value;\n\n this.value = value == null ? value : this.removeFormat(value);\n this.validate(this.validateValue);\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (typeof this.value === \"string\") {\n return this.formatValue(this.value);\n }\n\n return this.value == null ? \"\" : this.value;\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): StringAttributeModel {\n if (this.inputvalue === value) {\n return this;\n }\n\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get readonlyWidth(): $Keys<typeof ATTRIBUTE_WIDTH> {\n if (this.isZipcode() || this.isBSN()) {\n return ATTRIBUTE_WIDTH.SMALL;\n }\n\n if (this.isIBAN()) {\n return ATTRIBUTE_WIDTH.LARGE;\n }\n\n // default value (also applied for email address + download attribute)\n return ATTRIBUTE_WIDTH.MEDIUM;\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACe,MAAMM,oBAAoB,SAASC,uBAAc,CAAC;EAG/D;AACF;EACEC,WAAWA,CAACC,SAAiB,EAAEC,sBAA8B,EAAE;IAC7D,KAAK,CAACD,SAAS,EAAEC,sBAAsB,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA;IAEzC,IAAI,CAACC,YAAY,GAAG,IAAI,CAACC,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC;EAC7D;;EAEA;AACF;AACA;EACEC,oBAAoBA,CAACC,KAAU,EAAU;IACvC,OAAO,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;EAChC;;EAEA;AACF;EACE,OAAOE,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,MAAMC,UAAU,GAAGD,aAAa,EAAEC,UAAU;IAC5C,OACED,aAAa,CAACE,IAAI,KAAK,QAAQ,IAC9BC,KAAK,CAACC,OAAO,CAACH,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BAAsB,CAAC,CAAC;IAC7B,IAAI,CAACpB,UAAU,GAAGhC,KAAK;IAEvB,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAIqD,aAAaA,CAAA,EAAkC;IACjD,IAAI,IAAI,CAACnC,SAAS,CAAC,CAAC,IAAI,IAAI,CAACH,KAAK,CAAC,CAAC,EAAE;MACpC,OAAOuC,0BAAe,CAACC,KAAK;IAC9B;IAEA,IAAI,IAAI,CAACtC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOqC,0BAAe,CAACE,KAAK;IAC9B;;IAEA;IACA,OAAOF,0BAAe,CAACG,MAAM;EAC/B;AACF;AAACC,OAAA,CAAA9D,OAAA,GAAAN,oBAAA"}
|
|
@@ -112,12 +112,12 @@ export default class UploadAttributeModel extends StringAttributeModel {
|
|
|
112
112
|
} {
|
|
113
113
|
const mimeTypes = this.contributions.allowedMimeTypes
|
|
114
114
|
? this.contributions.allowedMimeTypes.filter(
|
|
115
|
-
(mimeType) => mimeType !== "[...]"
|
|
115
|
+
(mimeType) => mimeType !== "[...]",
|
|
116
116
|
)
|
|
117
117
|
: [];
|
|
118
118
|
const extensions = this.contributions.allowedExtensions
|
|
119
119
|
? this.contributions.allowedExtensions.filter(
|
|
120
|
-
(extension) => extension !== "[...]"
|
|
120
|
+
(extension) => extension !== "[...]",
|
|
121
121
|
)
|
|
122
122
|
: [];
|
|
123
123
|
|
|
@@ -144,7 +144,7 @@ export default class UploadAttributeModel extends StringAttributeModel {
|
|
|
144
144
|
get acceptedFiles(): Array<string> {
|
|
145
145
|
const mimeTypes = this.contributions.allowedMimeTypes
|
|
146
146
|
? this.contributions.allowedMimeTypes.filter(
|
|
147
|
-
(mimeType) => mimeType !== "[...]"
|
|
147
|
+
(mimeType) => mimeType !== "[...]",
|
|
148
148
|
)
|
|
149
149
|
: [];
|
|
150
150
|
const extensions = this.contributions.allowedExtensions
|
|
@@ -164,7 +164,7 @@ export default class UploadAttributeModel extends StringAttributeModel {
|
|
|
164
164
|
|
|
165
165
|
if (this.uploadConstraints.fileTypes.length > 0) {
|
|
166
166
|
constraints.add(
|
|
167
|
-
new FileExtensionConstraint(this.uploadConstraints.fileTypes)
|
|
167
|
+
new FileExtensionConstraint(this.uploadConstraints.fileTypes),
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -174,7 +174,7 @@ export default class UploadAttributeModel extends StringAttributeModel {
|
|
|
174
174
|
|
|
175
175
|
if (hasFilesizeConstraint) {
|
|
176
176
|
constraints.add(
|
|
177
|
-
new FileSizeConstraint(this.uploadConstraints.maxFileSize)
|
|
177
|
+
new FileSizeConstraint(this.uploadConstraints.maxFileSize),
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadAttributeModel.js","names":["_ConstraintCollection","_interopRequireDefault","require","_StringAttributeModel","_FileExtensionConstraint","_FileSizeConstraint","UNCHANGED","UploadAttributeModel","StringAttributeModel","constructor","arguments","_defineProperty2","default","isApplicableModel","contributions","type","multiple","getContribution","initialTotalFileSize","_initialTotalFileSize","maxTotalFileSize","_maxTotalFileSize","currentFilesize","uploadedFileSize","maxFileSize","uploadMaxFileSize","_keys","files","length","accumulatedFileSize","forEach","fileName","file","size","uploadConstraints","_context","_context2","mimeTypes","allowedMimeTypes","_filter","call","mimeType","extensions","allowedExtensions","extension","fileTypes","_map","fileSize","isMaxTotal","undefined","acceptedFiles","_context3","_context4","_context5","addConstraints","constraints","ConstraintCollection","add","FileExtensionConstraint","hasFilesizeConstraint","FileSizeConstraint","_files","update","value","_context6","JSON","parse","inputvalue","token","join","error","updateLastModification","readonlyvalue","initvalue","toString","getValue","hasValue","_value","mergeAttribute","oldAttribute","isValid","_stringify","exports"],"sources":["../../../src/models/attributes/UploadAttributeModel.js"],"sourcesContent":["// @flow\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport FileExtensionConstraint from \"./input-constraints/FileExtensionConstraint\";\nimport FileSizeConstraint from \"./input-constraints/FileSizeConstraint\";\n\nimport type {\n AttributeType,\n FilesType,\n FiletypeConstraintsType,\n FilesizeConstraintsType,\n} from \"../types\";\n\nconst UNCHANGED = \"UNCHANGED\";\n\n/**\n * Upload attribute\n */\nexport default class UploadAttributeModel extends StringAttributeModel {\n _files: FilesType;\n _initialTotalFileSize: number;\n _maxTotalFileSize: number;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return contributions.type === \"binary\";\n }\n\n /**\n */\n get type(): string {\n return \"upload\";\n }\n\n /**\n * Retrieve single or multi upload\n */\n get multiple(): boolean {\n return this.getContribution(\"multiple\", false);\n }\n\n /**\n */\n get initialTotalFileSize(): number {\n return this._initialTotalFileSize || 0;\n }\n\n /**\n */\n set initialTotalFileSize(initialTotalFileSize: number) {\n this._initialTotalFileSize = initialTotalFileSize;\n }\n\n /**\n */\n get maxTotalFileSize(): number {\n return this._maxTotalFileSize;\n }\n\n /**\n */\n set maxTotalFileSize(maxTotalFileSize: number) {\n this._maxTotalFileSize = maxTotalFileSize;\n }\n\n /**\n */\n get currentFilesize(): number {\n return this.initialTotalFileSize + this.uploadedFileSize;\n }\n\n /**\n */\n get maxFileSize(): ?number {\n if (this.maxTotalFileSize) {\n const uploadMaxFileSize = this.maxTotalFileSize - this.currentFilesize;\n if (uploadMaxFileSize < 0) {\n return 0;\n }\n\n return uploadMaxFileSize;\n }\n\n return this.contributions.uploadMaxFileSize;\n }\n\n /**\n */\n get uploadedFileSize(): number {\n if (Object.keys(this.files).length === 0) {\n return 0;\n }\n\n let accumulatedFileSize = 0;\n Object.keys(this.files).forEach((fileName) => {\n const file = this.files[fileName];\n if (file.size) {\n accumulatedFileSize += file.size;\n }\n });\n return accumulatedFileSize;\n }\n\n /**\n * Upload constraints\n */\n get uploadConstraints(): {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n acceptedFiles: Array<string>,\n } {\n const mimeTypes = this.contributions.allowedMimeTypes\n ? this.contributions.allowedMimeTypes.filter(\n (mimeType) => mimeType !== \"[...]\"\n )\n : [];\n const extensions = this.contributions.allowedExtensions\n ? this.contributions.allowedExtensions.filter(\n (extension) => extension !== \"[...]\"\n )\n : [];\n\n const fileTypes: FiletypeConstraintsType = extensions.map((extension) => ({\n extensions: [extension],\n mimeTypes,\n }));\n\n return {\n fileTypes,\n maxFileSize: {\n fileSize: this.maxFileSize,\n maxTotalFileSize: this.maxTotalFileSize,\n isMaxTotal: this.maxTotalFileSize !== undefined,\n },\n acceptedFiles: this.acceptedFiles,\n };\n }\n\n /**\n * Array of accepted file extensions and mime types.\n * Convenience method for accept attribute of file input html control\n */\n get acceptedFiles(): Array<string> {\n const mimeTypes = this.contributions.allowedMimeTypes\n ? this.contributions.allowedMimeTypes.filter(\n (mimeType) => mimeType !== \"[...]\"\n )\n : [];\n const extensions = this.contributions.allowedExtensions\n ? this.contributions.allowedExtensions\n .filter((extension) => extension !== \"[...]\")\n .map((extension) => `.${extension}`)\n : [];\n\n return [...extensions, ...mimeTypes];\n }\n\n /**\n * Add upload constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.uploadConstraints.fileTypes.length > 0) {\n constraints.add(\n new FileExtensionConstraint(this.uploadConstraints.fileTypes)\n );\n }\n\n const hasFilesizeConstraint =\n this.uploadConstraints.maxFileSize.isMaxTotal ||\n this.uploadConstraints.maxFileSize.fileSize !== undefined;\n\n if (hasFilesizeConstraint) {\n constraints.add(\n new FileSizeConstraint(this.uploadConstraints.maxFileSize)\n );\n }\n\n return constraints;\n }\n\n /**\n */\n get files(): FilesType {\n return this._files || {};\n }\n\n /**\n */\n set files(files: FilesType) {\n this._files = files;\n }\n\n /**\n * Update the attribute\n */\n update(value: string): UploadAttributeModel {\n if (!value) {\n return this;\n }\n\n // parse to json and handle uploaded file\n // when the input value is a string but not json,\n // we assume that it is just a list of uploaded tokens and copy it as input value\n try {\n const files = JSON.parse(value);\n this.files = files;\n\n this.inputvalue = Object.keys(files)\n .map((fileName) => files[fileName].token)\n .join(\",\");\n } catch (error) {\n if (typeof value === \"string\") {\n this.inputvalue = value;\n }\n }\n\n this.updateLastModification();\n\n return this;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.initvalue) {\n return this.initvalue.toString();\n }\n\n return \"\";\n }\n\n /**\n * Getting the value of the attribute, return unchanged when the uploaded file has not changed\n */\n getValue(): any {\n if (!this.hasValue()) {\n return null;\n }\n\n if (this.initvalue === this.inputvalue) {\n return UNCHANGED;\n }\n\n return this._value;\n }\n\n /**\n */\n mergeAttribute(oldAttribute: AttributeType) {\n if (\n oldAttribute instanceof UploadAttributeModel &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(JSON.stringify(oldAttribute.files));\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AASA,MAAMI,SAAS,GAAG,WAAW;;AAE7B;AACA;AACA;AACe,MAAMC,oBAAoB,SAASC,6BAAoB,CAAC;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;EAAA;EAKrE;AACF;EACE,OAAOC,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,OAAOA,aAAa,CAACC,IAAI,KAAK,QAAQ;EACxC;;EAEA;AACF;EACE,IAAIA,IAAIA,CAAA,EAAW;IACjB,OAAO,QAAQ;EACjB;;EAEA;AACF;AACA;EACE,IAAIC,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACC,eAAe,CAAC,UAAU,EAAE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YAA2B,EAAE;IAC1C,IACEA,YAAY,YAAYxE,oBAAoB,IAC5CwE,YAAY,CAACC,OAAO,IACpBD,YAAY,CAACZ,UAAU,KAAK,IAAI,EAChC;MACA,IAAI,CAACL,MAAM,CAAC,IAAAmB,UAAA,CAAArE,OAAA,EAAemE,YAAY,CAACpD,KAAK,CAAC,CAAC;IACjD;EACF;AACF;AAACuD,OAAA,CAAAtE,OAAA,GAAAL,oBAAA"}
|
|
1
|
+
{"version":3,"file":"UploadAttributeModel.js","names":["_ConstraintCollection","_interopRequireDefault","require","_StringAttributeModel","_FileExtensionConstraint","_FileSizeConstraint","UNCHANGED","UploadAttributeModel","StringAttributeModel","constructor","arguments","_defineProperty2","default","isApplicableModel","contributions","type","multiple","getContribution","initialTotalFileSize","_initialTotalFileSize","maxTotalFileSize","_maxTotalFileSize","currentFilesize","uploadedFileSize","maxFileSize","uploadMaxFileSize","_keys","files","length","accumulatedFileSize","forEach","fileName","file","size","uploadConstraints","_context","_context2","mimeTypes","allowedMimeTypes","_filter","call","mimeType","extensions","allowedExtensions","extension","fileTypes","_map","fileSize","isMaxTotal","undefined","acceptedFiles","_context3","_context4","_context5","addConstraints","constraints","ConstraintCollection","add","FileExtensionConstraint","hasFilesizeConstraint","FileSizeConstraint","_files","update","value","_context6","JSON","parse","inputvalue","token","join","error","updateLastModification","readonlyvalue","initvalue","toString","getValue","hasValue","_value","mergeAttribute","oldAttribute","isValid","_stringify","exports"],"sources":["../../../src/models/attributes/UploadAttributeModel.js"],"sourcesContent":["// @flow\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport FileExtensionConstraint from \"./input-constraints/FileExtensionConstraint\";\nimport FileSizeConstraint from \"./input-constraints/FileSizeConstraint\";\n\nimport type {\n AttributeType,\n FilesType,\n FiletypeConstraintsType,\n FilesizeConstraintsType,\n} from \"../types\";\n\nconst UNCHANGED = \"UNCHANGED\";\n\n/**\n * Upload attribute\n */\nexport default class UploadAttributeModel extends StringAttributeModel {\n _files: FilesType;\n _initialTotalFileSize: number;\n _maxTotalFileSize: number;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n return contributions.type === \"binary\";\n }\n\n /**\n */\n get type(): string {\n return \"upload\";\n }\n\n /**\n * Retrieve single or multi upload\n */\n get multiple(): boolean {\n return this.getContribution(\"multiple\", false);\n }\n\n /**\n */\n get initialTotalFileSize(): number {\n return this._initialTotalFileSize || 0;\n }\n\n /**\n */\n set initialTotalFileSize(initialTotalFileSize: number) {\n this._initialTotalFileSize = initialTotalFileSize;\n }\n\n /**\n */\n get maxTotalFileSize(): number {\n return this._maxTotalFileSize;\n }\n\n /**\n */\n set maxTotalFileSize(maxTotalFileSize: number) {\n this._maxTotalFileSize = maxTotalFileSize;\n }\n\n /**\n */\n get currentFilesize(): number {\n return this.initialTotalFileSize + this.uploadedFileSize;\n }\n\n /**\n */\n get maxFileSize(): ?number {\n if (this.maxTotalFileSize) {\n const uploadMaxFileSize = this.maxTotalFileSize - this.currentFilesize;\n if (uploadMaxFileSize < 0) {\n return 0;\n }\n\n return uploadMaxFileSize;\n }\n\n return this.contributions.uploadMaxFileSize;\n }\n\n /**\n */\n get uploadedFileSize(): number {\n if (Object.keys(this.files).length === 0) {\n return 0;\n }\n\n let accumulatedFileSize = 0;\n Object.keys(this.files).forEach((fileName) => {\n const file = this.files[fileName];\n if (file.size) {\n accumulatedFileSize += file.size;\n }\n });\n return accumulatedFileSize;\n }\n\n /**\n * Upload constraints\n */\n get uploadConstraints(): {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n acceptedFiles: Array<string>,\n } {\n const mimeTypes = this.contributions.allowedMimeTypes\n ? this.contributions.allowedMimeTypes.filter(\n (mimeType) => mimeType !== \"[...]\",\n )\n : [];\n const extensions = this.contributions.allowedExtensions\n ? this.contributions.allowedExtensions.filter(\n (extension) => extension !== \"[...]\",\n )\n : [];\n\n const fileTypes: FiletypeConstraintsType = extensions.map((extension) => ({\n extensions: [extension],\n mimeTypes,\n }));\n\n return {\n fileTypes,\n maxFileSize: {\n fileSize: this.maxFileSize,\n maxTotalFileSize: this.maxTotalFileSize,\n isMaxTotal: this.maxTotalFileSize !== undefined,\n },\n acceptedFiles: this.acceptedFiles,\n };\n }\n\n /**\n * Array of accepted file extensions and mime types.\n * Convenience method for accept attribute of file input html control\n */\n get acceptedFiles(): Array<string> {\n const mimeTypes = this.contributions.allowedMimeTypes\n ? this.contributions.allowedMimeTypes.filter(\n (mimeType) => mimeType !== \"[...]\",\n )\n : [];\n const extensions = this.contributions.allowedExtensions\n ? this.contributions.allowedExtensions\n .filter((extension) => extension !== \"[...]\")\n .map((extension) => `.${extension}`)\n : [];\n\n return [...extensions, ...mimeTypes];\n }\n\n /**\n * Add upload constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.uploadConstraints.fileTypes.length > 0) {\n constraints.add(\n new FileExtensionConstraint(this.uploadConstraints.fileTypes),\n );\n }\n\n const hasFilesizeConstraint =\n this.uploadConstraints.maxFileSize.isMaxTotal ||\n this.uploadConstraints.maxFileSize.fileSize !== undefined;\n\n if (hasFilesizeConstraint) {\n constraints.add(\n new FileSizeConstraint(this.uploadConstraints.maxFileSize),\n );\n }\n\n return constraints;\n }\n\n /**\n */\n get files(): FilesType {\n return this._files || {};\n }\n\n /**\n */\n set files(files: FilesType) {\n this._files = files;\n }\n\n /**\n * Update the attribute\n */\n update(value: string): UploadAttributeModel {\n if (!value) {\n return this;\n }\n\n // parse to json and handle uploaded file\n // when the input value is a string but not json,\n // we assume that it is just a list of uploaded tokens and copy it as input value\n try {\n const files = JSON.parse(value);\n this.files = files;\n\n this.inputvalue = Object.keys(files)\n .map((fileName) => files[fileName].token)\n .join(\",\");\n } catch (error) {\n if (typeof value === \"string\") {\n this.inputvalue = value;\n }\n }\n\n this.updateLastModification();\n\n return this;\n }\n\n /**\n */\n get readonlyvalue(): string {\n if (this.initvalue) {\n return this.initvalue.toString();\n }\n\n return \"\";\n }\n\n /**\n * Getting the value of the attribute, return unchanged when the uploaded file has not changed\n */\n getValue(): any {\n if (!this.hasValue()) {\n return null;\n }\n\n if (this.initvalue === this.inputvalue) {\n return UNCHANGED;\n }\n\n return this._value;\n }\n\n /**\n */\n mergeAttribute(oldAttribute: AttributeType) {\n if (\n oldAttribute instanceof UploadAttributeModel &&\n oldAttribute.isValid &&\n oldAttribute.inputvalue !== null\n ) {\n this.update(JSON.stringify(oldAttribute.files));\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AASA,MAAMI,SAAS,GAAG,WAAW;;AAE7B;AACA;AACA;AACe,MAAMC,oBAAoB,SAASC,6BAAoB,CAAC;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;EAAA;EAKrE;AACF;EACE,OAAOC,iBAAiBA,CAACC,aAAqB,EAAW;IACvD,OAAOA,aAAa,CAACC,IAAI,KAAK,QAAQ;EACxC;;EAEA;AACF;EACE,IAAIA,IAAIA,CAAA,EAAW;IACjB,OAAO,QAAQ;EACjB;;EAEA;AACF;AACA;EACE,IAAIC,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACC,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC;EAChD;;EAEA;AACF;EACE,IAAIC,oBAAoBA,CAAA,EAAW;IACjC,OAAO,IAAI,CAACC,qBAAqB,IAAI,CAAC;EACxC;;EAEA;AACF;EACE,IAAID,oBAAoBA,CAACA,oBAA4B,EAAE;IACrD,IAAI,CAACC,qBAAqB,GA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,KAAK,CAAC,CAAC;IACjD;EACF;AACF;AAACuD,OAAA,CAAAtE,OAAA,GAAAL,oBAAA"}
|
|
@@ -21,14 +21,14 @@ describe("attributeCollection", () => {
|
|
|
21
21
|
expect(attributeCollection.visible).toHaveLength(0);
|
|
22
22
|
expect(attributeCollection.getAttributeByKey("not_existing")).toBeNull();
|
|
23
23
|
expect(
|
|
24
|
-
attributeCollection.getAttributeByLayoutHint("not_existing")
|
|
24
|
+
attributeCollection.getAttributeByLayoutHint("not_existing"),
|
|
25
25
|
).toBeNull();
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it("can create collection from form data and contributions", () => {
|
|
29
29
|
const attributeCollection = new AttributeCollection(
|
|
30
30
|
FormCollectionData,
|
|
31
|
-
FormCollectionContribution
|
|
31
|
+
FormCollectionContribution,
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
expect(attributeCollection).toBeInstanceOf(AttributeCollection);
|
|
@@ -37,14 +37,14 @@ describe("attributeCollection", () => {
|
|
|
37
37
|
expect(attributeCollection.visible).toHaveLength(32);
|
|
38
38
|
expect(attributeCollection.hasAttributeByKey("Address")).toBeTruthy();
|
|
39
39
|
expect(
|
|
40
|
-
attributeCollection.getAttributesByLayoutHint("zipcode")
|
|
40
|
+
attributeCollection.getAttributesByLayoutHint("zipcode"),
|
|
41
41
|
).toHaveLength(2);
|
|
42
42
|
|
|
43
43
|
expect(
|
|
44
|
-
attributeCollection.getChoiceAttributeByLayoutHint("combobox").label
|
|
44
|
+
attributeCollection.getChoiceAttributeByLayoutHint("combobox").label,
|
|
45
45
|
).toBe("Type");
|
|
46
46
|
expect(
|
|
47
|
-
attributeCollection.getChoiceAttributeByLayoutHint("bla")
|
|
47
|
+
attributeCollection.getChoiceAttributeByLayoutHint("bla"),
|
|
48
48
|
).toBeNull();
|
|
49
49
|
|
|
50
50
|
attributeCollection.setReferenceDate("2010-01-01");
|
|
@@ -65,7 +65,7 @@ describe("attributeCollection", () => {
|
|
|
65
65
|
it("can handle list detail data and contributions", () => {
|
|
66
66
|
const attributeCollection = new AttributeCollection(
|
|
67
67
|
ListDetailData,
|
|
68
|
-
ListDetailContributions
|
|
68
|
+
ListDetailContributions,
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
expect(attributeCollection).toBeInstanceOf(AttributeCollection);
|
|
@@ -79,14 +79,14 @@ describe("attributeCollection", () => {
|
|
|
79
79
|
expect(attributeCollection.hasAttributeByKey("ISBN10")).toBeTruthy();
|
|
80
80
|
|
|
81
81
|
expect(attributeCollection.getAttributeByKey("ISBN10").value).toBe(
|
|
82
|
-
"1847087302"
|
|
82
|
+
"1847087302",
|
|
83
83
|
);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it("can create an attribute collection from list item data and contributions", () => {
|
|
87
87
|
const attributeCollection = new AttributeCollection(
|
|
88
88
|
ListAttributeData,
|
|
89
|
-
ListAttributeContributions
|
|
89
|
+
ListAttributeContributions,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
expect(attributeCollection).toBeInstanceOf(AttributeCollection);
|
|
@@ -95,14 +95,14 @@ describe("attributeCollection", () => {
|
|
|
95
95
|
expect(attributeCollection.visible).toHaveLength(6);
|
|
96
96
|
expect(attributeCollection.hasAttributeByKey("Title")).toBeTruthy();
|
|
97
97
|
expect(
|
|
98
|
-
attributeCollection.getAttributesByLayoutHint("combobox")
|
|
98
|
+
attributeCollection.getAttributesByLayoutHint("combobox"),
|
|
99
99
|
).toHaveLength(1);
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
it("can handle actions fields data and contributions", () => {
|
|
103
103
|
const attributeCollection = new AttributeCollection(
|
|
104
104
|
ActionFieldsData,
|
|
105
|
-
ActionFieldsContributions
|
|
105
|
+
ActionFieldsContributions,
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
expect(attributeCollection).toBeInstanceOf(AttributeCollection);
|
|
@@ -150,7 +150,7 @@ describe("attributeCollection", () => {
|
|
|
150
150
|
|
|
151
151
|
const attributeCollection2 = new AttributeCollection(
|
|
152
152
|
FormCollectionData,
|
|
153
|
-
contributions2
|
|
153
|
+
contributions2,
|
|
154
154
|
);
|
|
155
155
|
|
|
156
156
|
attributeCollection.collection = attributeCollection2.collection;
|
|
@@ -162,7 +162,7 @@ describe("AttributeContent", () => {
|
|
|
162
162
|
const content = new AttributeContent(json);
|
|
163
163
|
|
|
164
164
|
expect(content.getConceptPropertiesByLabels("not-existing")).toHaveLength(
|
|
165
|
-
0
|
|
165
|
+
0,
|
|
166
166
|
);
|
|
167
167
|
expect(content.getTextFragmentsByLabels("not-existing")).toHaveLength(0);
|
|
168
168
|
expect(content.getSectionsByType("not-existing")).toHaveLength(0);
|
|
@@ -170,7 +170,7 @@ describe("AttributeContent", () => {
|
|
|
170
170
|
|
|
171
171
|
expect(content.getConceptPropertiesByLabels("Properties")).toHaveLength(1);
|
|
172
172
|
expect(
|
|
173
|
-
content.getTextFragmentsByLabels("Description TextFragment")
|
|
173
|
+
content.getTextFragmentsByLabels("Description TextFragment"),
|
|
174
174
|
).toHaveLength(1);
|
|
175
175
|
expect(content.getSectionsByType("Reference")).toHaveLength(1);
|
|
176
176
|
expect(content.getSectionsByLabels("Description Content")).toHaveLength(1);
|
|
@@ -183,24 +183,24 @@ describe("AttributeContent", () => {
|
|
|
183
183
|
expect(firstSection instanceof SectionModel).toBe(true);
|
|
184
184
|
|
|
185
185
|
expect(firstSection.selflink.href.toString()).toBe(
|
|
186
|
-
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert"
|
|
186
|
+
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert",
|
|
187
187
|
);
|
|
188
188
|
expect(firstSection.selfhref.toString()).toBe(
|
|
189
|
-
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert"
|
|
189
|
+
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert",
|
|
190
190
|
);
|
|
191
191
|
|
|
192
192
|
expect(firstSection.type).toBe("Reference");
|
|
193
193
|
expect(firstSection.label).toBe("Alert");
|
|
194
194
|
expect(firstSection.number).toBe("1");
|
|
195
195
|
expect(firstSection.body).toBe(
|
|
196
|
-
"<p>The limit of 0.5 per mille has been exceeded.</p>"
|
|
196
|
+
"<p>The limit of 0.5 per mille has been exceeded.</p>",
|
|
197
197
|
);
|
|
198
198
|
expect(firstSection.childSectionLinks).toHaveLength(2);
|
|
199
199
|
expect(firstSection.selfContentLink.selfhref.toString()).toBe(
|
|
200
|
-
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert"
|
|
200
|
+
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert",
|
|
201
201
|
);
|
|
202
202
|
expect(firstSection.selfContentLink.encodedHref.toString()).toBe(
|
|
203
|
-
"/content/_Context%2FPolice incident decisions%2FContent%2FBreath analysis%2FBreathalyzer test.formalsource/Alert"
|
|
203
|
+
"/content/_Context%2FPolice incident decisions%2FContent%2FBreath analysis%2FBreathalyzer test.formalsource/Alert",
|
|
204
204
|
);
|
|
205
205
|
|
|
206
206
|
expect(firstSection.childSections).toHaveLength(2);
|
|
@@ -119,7 +119,7 @@ describe("attributeModel", () => {
|
|
|
119
119
|
{
|
|
120
120
|
minLength: 5,
|
|
121
121
|
maxLength: 7,
|
|
122
|
-
}
|
|
122
|
+
},
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
expect(attribute.inError()).toBeFalsy();
|
|
@@ -180,7 +180,7 @@ describe("attributeModel", () => {
|
|
|
180
180
|
href: "/concepts/Incident/Business design/Process elementen/Eerste contact.bixml/UitslagBlaastestType",
|
|
181
181
|
},
|
|
182
182
|
},
|
|
183
|
-
}
|
|
183
|
+
},
|
|
184
184
|
);
|
|
185
185
|
|
|
186
186
|
attribute.hasContentConfiguration = true;
|
|
@@ -190,7 +190,7 @@ describe("attributeModel", () => {
|
|
|
190
190
|
setSetting(ALL_CONTENT_IN_DATA_SETTING, true);
|
|
191
191
|
|
|
192
192
|
expect(attribute.conceptLink.href.path).toBe(
|
|
193
|
-
"/concepts/Incident/Business design/Process elementen/Eerste contact.bixml/UitslagBlaastestType"
|
|
193
|
+
"/concepts/Incident/Business design/Process elementen/Eerste contact.bixml/UitslagBlaastestType",
|
|
194
194
|
);
|
|
195
195
|
|
|
196
196
|
expect(attribute.referenceDate).toBe("2010-09-10");
|
|
@@ -199,7 +199,7 @@ describe("attributeModel", () => {
|
|
|
199
199
|
expect(attribute.referenceDate).toBe("2010-10-10");
|
|
200
200
|
|
|
201
201
|
expect(attribute.conceptLink.href.getParameter("entryDate").value).toBe(
|
|
202
|
-
"2010-10-10"
|
|
202
|
+
"2010-10-10",
|
|
203
203
|
);
|
|
204
204
|
});
|
|
205
205
|
|
|
@@ -219,7 +219,7 @@ describe("attributeModel", () => {
|
|
|
219
219
|
href: "/concepts/Incident/Business design/Process elementen/Eerste contact.bixml/UitslagBlaastestType",
|
|
220
220
|
},
|
|
221
221
|
},
|
|
222
|
-
}
|
|
222
|
+
},
|
|
223
223
|
);
|
|
224
224
|
|
|
225
225
|
const concept = new ConceptDetailModel({
|
|
@@ -9,7 +9,7 @@ describe("attributeSetModel", () => {
|
|
|
9
9
|
expect(attributeset.key).toBe("");
|
|
10
10
|
expect(attributeset.label).toBeUndefined();
|
|
11
11
|
expect(attributeset.attributeCollection).toBeInstanceOf(
|
|
12
|
-
AttributeCollection
|
|
12
|
+
AttributeCollection,
|
|
13
13
|
);
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -28,7 +28,7 @@ describe("attributeSetModel", () => {
|
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
],
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
expect(attributeset.key).toBe("key");
|