@digigov/form 2.0.0-13876dba → 2.0.0-16fbe090
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/Field/ErrorGroup.d.ts +4 -4
- package/Field/ErrorGroup.js +53 -0
- package/Field/FieldBase.d.ts +1 -1
- package/Field/FieldBase.js +77 -0
- package/Field/FieldBaseContainer.d.ts +2 -2
- package/Field/FieldBaseContainer.js +43 -0
- package/Field/FieldConditional.d.ts +1 -1
- package/Field/FieldConditional.js +45 -0
- package/Field/index.d.ts +1 -1
- package/Field/index.js +70 -112
- package/Field/types.d.ts +22 -12
- package/Field/types.js +0 -0
- package/Field/utils/evaluateFieldWithConditions.d.ts +2 -2
- package/Field/utils/evaluateFieldWithConditions.js +19 -0
- package/Field/utils/resolveField.d.ts +3 -0
- package/Field/utils/resolveField.js +32 -0
- package/Field/utils/useField.d.ts +1 -1
- package/Field/utils/useField.js +47 -0
- package/FieldArray/BaseFieldArray.d.ts +5 -0
- package/FieldArray/BaseFieldArray.js +46 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.d.ts +9 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js +13 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +26 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js +117 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js +6 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +15 -0
- package/FieldArray/FormDialog/ArrayDisplay/index.js +32 -0
- package/FieldArray/FormDialog/ArrayEditModal.d.ts +24 -0
- package/FieldArray/FormDialog/ArrayEditModal.js +138 -0
- package/FieldArray/FormDialog/index.d.ts +19 -0
- package/FieldArray/FormDialog/index.js +191 -271
- package/FieldArray/index.d.ts +5 -2
- package/FieldArray/index.js +62 -106
- package/FieldObject/index.d.ts +7 -4
- package/FieldObject/index.js +51 -72
- package/Fieldset/FieldsetWithContext.js +27 -0
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js +18 -30
- package/Fieldset/types.d.ts +2 -2
- package/Fieldset/types.js +0 -0
- package/FormBuilder/index.d.ts +2 -2
- package/FormBuilder/index.js +233 -231
- package/FormContext.d.ts +3 -2
- package/FormContext.js +7 -0
- package/MultiplicityField/add-objects.d.ts +2 -2
- package/MultiplicityField/add-objects.js +107 -0
- package/MultiplicityField/index.d.ts +2 -2
- package/MultiplicityField/index.js +81 -116
- package/MultiplicityField/types.d.ts +3 -2
- package/MultiplicityField/types.js +0 -0
- package/Questions/Questions.d.ts +1 -1
- package/Questions/Questions.js +48 -0
- package/Questions/QuestionsContext.d.ts +1 -1
- package/Questions/QuestionsContext.js +10 -0
- package/Questions/Step/ReviewStep.js +32 -0
- package/Questions/Step/Step.d.ts +1 -1
- package/Questions/Step/Step.js +39 -0
- package/Questions/Step/StepArrayReview.d.ts +1 -1
- package/Questions/Step/StepArrayReview.js +35 -0
- package/Questions/Step/StepContext.d.ts +1 -1
- package/Questions/Step/StepContext.js +28 -0
- package/Questions/Step/StepDescription.d.ts +1 -1
- package/Questions/Step/StepDescription.js +18 -0
- package/Questions/Step/StepForm.d.ts +2 -2
- package/Questions/Step/StepForm.js +29 -0
- package/Questions/Step/StepQuote.d.ts +1 -1
- package/Questions/Step/StepQuote.js +5 -0
- package/Questions/Step/StepTitle.d.ts +1 -1
- package/Questions/Step/StepTitle.js +25 -0
- package/Questions/Step/getAddMoreFields.d.ts +2 -2
- package/Questions/Step/getAddMoreFields.js +24 -0
- package/Questions/Step/index.d.ts +11 -11
- package/Questions/Step/index.js +13 -16
- package/Questions/Step/types.d.ts +1 -1
- package/Questions/Step/types.js +0 -0
- package/Questions/getNextStep.d.ts +1 -1
- package/Questions/getNextStep.js +13 -0
- package/Questions/index.d.ts +2 -2
- package/Questions/index.js +4 -7
- package/Questions/types.d.ts +1 -1
- package/Questions/types.js +0 -0
- package/hooks/useFieldFocusManager.d.ts +25 -0
- package/hooks/useFieldFocusManager.js +83 -0
- package/hooks/utils.d.ts +18 -0
- package/hooks/utils.js +60 -0
- package/index.d.ts +5 -5
- package/index.js +8 -13
- package/inputs/AutoCompleteInput/index.d.ts +3 -3
- package/inputs/AutoCompleteInput/index.js +38 -62
- package/inputs/Checkboxes/index.d.ts +5 -3
- package/inputs/Checkboxes/index.js +50 -78
- package/inputs/DateInput/index.d.ts +2 -5
- package/inputs/DateInput/index.js +125 -117
- package/inputs/DateTimeInput/index.d.ts +2 -5
- package/inputs/DateTimeInput/index.js +179 -170
- package/inputs/FileInput/index.d.ts +12 -5
- package/inputs/FileInput/index.js +58 -59
- package/inputs/ImageInput/index.d.ts +10 -2
- package/inputs/ImageInput/index.js +84 -53
- package/inputs/Input/index.d.ts +5 -2
- package/inputs/Input/index.js +60 -69
- package/inputs/Label/index.d.ts +1 -1
- package/inputs/Label/index.js +13 -16
- package/inputs/OtpInput/index.d.ts +1 -5
- package/inputs/OtpInput/index.js +117 -141
- package/inputs/Radio/index.d.ts +6 -4
- package/inputs/Radio/index.js +71 -102
- package/inputs/Select/index.d.ts +6 -3
- package/inputs/Select/index.js +23 -31
- package/inputs/index.d.ts +9 -9
- package/inputs/index.js +10 -21
- package/{Field/utils/index.d.ts → inputs/registry.d.ts} +2 -1
- package/inputs/registry.js +80 -0
- package/internal.d.ts +5 -5
- package/internal.js +6 -0
- package/lazy.d.ts +97 -0
- package/lazy.js +163 -0
- package/package.json +12 -12
- package/registry.d.ts +82 -0
- package/registry.js +170 -0
- package/src/Field/ErrorGroup.tsx +4 -4
- package/src/Field/FieldBase.tsx +9 -4
- package/src/Field/FieldBaseContainer.tsx +69 -48
- package/src/Field/FieldConditional.tsx +5 -1
- package/src/Field/index.tsx +27 -37
- package/src/Field/types.tsx +24 -14
- package/src/Field/utils/evaluateFieldWithConditions.ts +5 -2
- package/src/Field/utils/resolveField.ts +58 -0
- package/src/Field/utils/useField.ts +12 -2
- package/src/FieldArray/BaseFieldArray.tsx +97 -0
- package/src/FieldArray/FieldArray.stories.js +1 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.tsx +45 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +14 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +337 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.tsx +15 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.tsx +88 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.tsx +79 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.tsx +75 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.tsx +93 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.tsx +88 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.test.tsx +44 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +67 -0
- package/src/FieldArray/FormDialog/ArrayEditModal.tsx +241 -0
- package/src/FieldArray/FormDialog/index.tsx +302 -0
- package/src/FieldArray/__stories__/CardsWithError.tsx +124 -0
- package/src/FieldArray/__stories__/WithModal.tsx +3 -2
- package/src/FieldArray/__tests__/fieldset-multiplicity.spec.tsx +271 -0
- package/src/FieldArray/__tests__/multiplicity-attachment.spec.tsx +280 -0
- package/src/FieldArray/__tests__/multiplicity-optional.spec.tsx +232 -0
- package/src/FieldArray/__tests__/multiplicity-required.spec.tsx +170 -0
- package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +627 -0
- package/src/FieldArray/__tests__/preference-multiple-choice.spec.tsx +222 -0
- package/src/FieldArray/index.spec.tsx +355 -0
- package/src/FieldArray/index.test.tsx +4 -0
- package/src/FieldArray/index.tsx +49 -73
- package/src/FieldObject/index.tsx +36 -31
- package/src/Fieldset/FieldsetWithContext.tsx +1 -1
- package/src/Fieldset/index.tsx +1 -1
- package/src/Fieldset/types.tsx +2 -2
- package/src/FormBuilder/doc.mdx +1 -1
- package/src/FormBuilder/index.tsx +197 -146
- package/src/FormBuilder/scenarios.test.tsx +806 -9
- package/src/FormContext.tsx +7 -2
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +1 -3
- package/src/MultiplicityField/add-objects.tsx +14 -21
- package/src/MultiplicityField/index.tsx +6 -2
- package/src/MultiplicityField/types.ts +6 -2
- package/src/Questions/Questions.tsx +2 -2
- package/src/Questions/QuestionsContext.tsx +1 -1
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +2 -2
- package/src/Questions/Step/StepContext.tsx +1 -1
- package/src/Questions/Step/StepDescription.tsx +2 -1
- package/src/Questions/Step/StepForm.tsx +2 -2
- package/src/Questions/Step/StepQuote.tsx +2 -1
- package/src/Questions/Step/StepTitle.tsx +2 -1
- package/src/Questions/Step/getAddMoreFields.tsx +2 -2
- package/src/Questions/Step/types.tsx +1 -1
- package/src/Questions/getNextStep.tsx +1 -1
- package/src/Questions/types.tsx +1 -1
- package/src/hooks/__tests__/useFieldFocusManager.spec.tsx +1079 -0
- package/src/hooks/__tests__/utils.spec.ts +568 -0
- package/src/hooks/useFieldFocusManager.ts +162 -0
- package/src/hooks/utils.ts +122 -0
- package/src/inputs/AutoCompleteInput/doc.mdx +2 -2
- package/src/inputs/AutoCompleteInput/index.tsx +4 -6
- package/src/inputs/Checkboxes/doc.mdx +3 -3
- package/src/inputs/Checkboxes/index.tsx +98 -91
- package/src/inputs/DateInput/DateInput.stories.js +4 -0
- package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +26 -0
- package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +28 -0
- package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +26 -0
- package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +28 -0
- package/src/inputs/DateInput/doc.mdx +1 -1
- package/src/inputs/DateInput/index.test.tsx +16 -0
- package/src/inputs/DateInput/index.tsx +65 -20
- package/src/inputs/DateTimeInput/DateTimeInput.stories.js +9 -6
- package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +26 -0
- package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +28 -0
- package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +26 -0
- package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +28 -0
- package/src/inputs/DateTimeInput/doc.mdx +1 -1
- package/src/inputs/DateTimeInput/index.test.tsx +16 -0
- package/src/inputs/DateTimeInput/index.tsx +92 -40
- package/src/inputs/FileInput/FileInput.stories.js +1 -0
- package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
- package/src/inputs/FileInput/doc.mdx +1 -1
- package/src/inputs/FileInput/index.test.tsx +4 -0
- package/src/inputs/FileInput/index.tsx +83 -47
- package/src/inputs/ImageInput/ImageInput.stories.js +2 -1
- package/src/inputs/ImageInput/__stories__/MaxSize.tsx +2 -1
- package/src/inputs/ImageInput/__stories__/WithInitialValues.tsx +45 -0
- package/src/inputs/ImageInput/__stories__/logo.d.ts +4 -0
- package/src/inputs/ImageInput/__stories__/logo.png +0 -0
- package/src/inputs/ImageInput/doc.mdx +3 -3
- package/src/inputs/ImageInput/index.test.tsx +21 -17
- package/src/inputs/ImageInput/index.tsx +102 -50
- package/src/inputs/Input/Input.stories.js +3 -0
- package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
- package/src/inputs/Input/__stories__/Email.tsx +23 -0
- package/src/inputs/Input/__stories__/Rate.tsx +25 -0
- package/src/inputs/Input/doc.mdx +10 -10
- package/src/inputs/Input/index.test.tsx +12 -0
- package/src/inputs/Input/index.tsx +19 -10
- package/src/inputs/Label/doc.mdx +1 -1
- package/src/inputs/Label/index.tsx +1 -1
- package/src/inputs/OtpInput/doc.mdx +1 -1
- package/src/inputs/OtpInput/index.tsx +43 -34
- package/src/inputs/Radio/doc.mdx +3 -3
- package/src/inputs/Radio/index.tsx +33 -22
- package/src/inputs/Select/doc.mdx +1 -1
- package/src/inputs/Select/index.tsx +12 -7
- package/src/{Field/utils/index.ts → inputs/registry.ts} +5 -1
- package/{lazy/index.js → src/lazy.ts} +8 -29
- package/{registry/index.js → src/registry.ts} +33 -19
- package/src/types.tsx +14 -5
- package/src/utils.ts +41 -8
- package/src/validators/index.ts +50 -17
- package/src/validators/types.ts +1 -1
- package/src/validators/utils/amka.ts +39 -0
- package/src/validators/utils/date.ts +30 -6
- package/src/validators/utils/datetime.ts +123 -31
- package/src/validators/utils/email.ts +11 -0
- package/src/validators/utils/file.ts +35 -21
- package/src/validators/utils/iban.ts +2 -2
- package/src/validators/utils/image.ts +2 -2
- package/src/validators/utils/index.ts +13 -6
- package/src/validators/utils/int.ts +1 -1
- package/src/validators/utils/number.ts +1 -1
- package/src/validators/utils/otp.ts +2 -2
- package/src/validators/utils/phone.ts +2 -2
- package/src/validators/utils/postal_code.ts +2 -2
- package/src/validators/utils/text_limit.ts +2 -2
- package/types.d.ts +11 -5
- package/types.js +1 -0
- package/utils.d.ts +4 -1
- package/utils.js +56 -0
- package/validators/index.d.ts +6 -6
- package/validators/index.js +112 -139
- package/validators/types.d.ts +1 -1
- package/validators/types.js +0 -0
- package/validators/utils/afm.js +19 -0
- package/validators/utils/amka.d.ts +6 -0
- package/validators/utils/amka.js +27 -0
- package/validators/utils/date.d.ts +3 -3
- package/validators/utils/date.js +95 -0
- package/validators/utils/datetime.d.ts +3 -3
- package/validators/utils/datetime.js +121 -0
- package/validators/utils/email.d.ts +5 -0
- package/validators/utils/email.js +10 -0
- package/validators/utils/file.d.ts +2 -2
- package/validators/utils/file.js +31 -0
- package/validators/utils/iban.d.ts +2 -2
- package/validators/utils/iban.js +104 -0
- package/validators/utils/image.d.ts +2 -2
- package/validators/utils/image.js +65 -0
- package/validators/utils/index.d.ts +14 -13
- package/validators/utils/index.js +59 -90
- package/validators/utils/int.d.ts +1 -1
- package/validators/utils/int.js +13 -0
- package/validators/utils/number.d.ts +1 -1
- package/validators/utils/number.js +12 -0
- package/validators/utils/otp.d.ts +2 -2
- package/validators/utils/otp.js +21 -0
- package/validators/utils/phone.d.ts +2 -2
- package/validators/utils/phone.js +198 -0
- package/validators/utils/postal_code.d.ts +2 -2
- package/validators/utils/postal_code.js +18 -0
- package/validators/utils/text_limit.d.ts +2 -2
- package/validators/utils/text_limit.js +34 -0
- package/validators/utils/uuid4.js +14 -0
- package/Field/ErrorGroup/index.js +0 -48
- package/Field/ErrorGroup/package.json +0 -6
- package/Field/ErrorGroup.js.map +0 -7
- package/Field/FieldBase/index.js +0 -117
- package/Field/FieldBase/package.json +0 -6
- package/Field/FieldBase.js.map +0 -7
- package/Field/FieldBaseContainer/index.js +0 -33
- package/Field/FieldBaseContainer/package.json +0 -6
- package/Field/FieldBaseContainer.js.map +0 -7
- package/Field/FieldConditional/index.js +0 -85
- package/Field/FieldConditional/package.json +0 -6
- package/Field/FieldConditional.js.map +0 -7
- package/Field/index.js.map +0 -7
- package/Field/package.json +0 -6
- package/Field/types/index.js +0 -1
- package/Field/types/package.json +0 -6
- package/Field/types.js.map +0 -7
- package/Field/utils/calculateField/index.js +0 -27
- package/Field/utils/calculateField/package.json +0 -6
- package/Field/utils/calculateField.d.ts +0 -2
- package/Field/utils/calculateField.js.map +0 -7
- package/Field/utils/evaluateFieldWithConditions/index.js +0 -26
- package/Field/utils/evaluateFieldWithConditions/package.json +0 -6
- package/Field/utils/evaluateFieldWithConditions.js.map +0 -7
- package/Field/utils/index.js +0 -84
- package/Field/utils/index.js.map +0 -7
- package/Field/utils/package.json +0 -6
- package/Field/utils/useField/index.js +0 -57
- package/Field/utils/useField/package.json +0 -6
- package/Field/utils/useField.js.map +0 -7
- package/FieldArray/FieldArray.stories.d.ts +0 -10
- package/FieldArray/FormDialog/package.json +0 -6
- package/FieldArray/FormDialog.d.ts +0 -53
- package/FieldArray/FormDialog.js.map +0 -7
- package/FieldArray/__stories__/Default.d.ts +0 -2
- package/FieldArray/__stories__/WithExactLength.d.ts +0 -2
- package/FieldArray/__stories__/WithModal.d.ts +0 -2
- package/FieldArray/index.js.map +0 -7
- package/FieldArray/index.test.d.ts +0 -1
- package/FieldArray/package.json +0 -6
- package/FieldObject/index.js.map +0 -7
- package/FieldObject/package.json +0 -6
- package/Fieldset/FieldsetWithContext/index.js +0 -31
- package/Fieldset/FieldsetWithContext/package.json +0 -6
- package/Fieldset/FieldsetWithContext.js.map +0 -7
- package/Fieldset/index.js.map +0 -7
- package/Fieldset/package.json +0 -6
- package/Fieldset/types/index.js +0 -1
- package/Fieldset/types/package.json +0 -6
- package/Fieldset/types.js.map +0 -7
- package/Form.stories.d.ts +0 -4
- package/FormBuilder/FormBuilder.stories.d.ts +0 -12
- package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +0 -3
- package/FormBuilder/__stories__/Default.d.ts +0 -3
- package/FormBuilder/__stories__/ErrorGrouping.d.ts +0 -3
- package/FormBuilder/index.js.map +0 -7
- package/FormBuilder/index.test.d.ts +0 -1
- package/FormBuilder/interaction.test.d.ts +0 -1
- package/FormBuilder/package.json +0 -6
- package/FormBuilder/scenarios.test.d.ts +0 -88
- package/FormContext/index.js +0 -9
- package/FormContext/package.json +0 -6
- package/FormContext.js.map +0 -7
- package/MultiplicityField/MultiplicityField.stories.d.ts +0 -15
- package/MultiplicityField/__stories__/Default.d.ts +0 -2
- package/MultiplicityField/__stories__/PreviewDisplay.d.ts +0 -2
- package/MultiplicityField/__stories__/WithExactLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +0 -2
- package/MultiplicityField/__stories__/WithMinLength.d.ts +0 -2
- package/MultiplicityField/add-objects/index.js +0 -153
- package/MultiplicityField/add-objects/package.json +0 -6
- package/MultiplicityField/add-objects.js.map +0 -7
- package/MultiplicityField/index.js.map +0 -7
- package/MultiplicityField/index.test.d.ts +0 -1
- package/MultiplicityField/package.json +0 -6
- package/MultiplicityField/types/index.js +0 -1
- package/MultiplicityField/types/package.json +0 -6
- package/MultiplicityField/types.js.map +0 -7
- package/Questions/Questions/index.js +0 -67
- package/Questions/Questions/package.json +0 -6
- package/Questions/Questions.js.map +0 -7
- package/Questions/Questions.stories.d.ts +0 -10
- package/Questions/QuestionsContext/index.js +0 -11
- package/Questions/QuestionsContext/package.json +0 -6
- package/Questions/QuestionsContext.js.map +0 -7
- package/Questions/Step/ReviewStep/index.js +0 -38
- package/Questions/Step/ReviewStep/package.json +0 -6
- package/Questions/Step/ReviewStep.js.map +0 -7
- package/Questions/Step/Step/index.js +0 -54
- package/Questions/Step/Step/package.json +0 -6
- package/Questions/Step/Step.js.map +0 -7
- package/Questions/Step/StepArrayReview/index.js +0 -42
- package/Questions/Step/StepArrayReview/package.json +0 -6
- package/Questions/Step/StepArrayReview.js.map +0 -7
- package/Questions/Step/StepContext/index.js +0 -23
- package/Questions/Step/StepContext/package.json +0 -6
- package/Questions/Step/StepContext.js.map +0 -7
- package/Questions/Step/StepDescription/index.js +0 -24
- package/Questions/Step/StepDescription/package.json +0 -6
- package/Questions/Step/StepDescription.js.map +0 -7
- package/Questions/Step/StepForm/index.js +0 -34
- package/Questions/Step/StepForm/package.json +0 -6
- package/Questions/Step/StepForm.js.map +0 -7
- package/Questions/Step/StepQuote/index.js +0 -11
- package/Questions/Step/StepQuote/package.json +0 -6
- package/Questions/Step/StepQuote.js.map +0 -7
- package/Questions/Step/StepTitle/index.js +0 -44
- package/Questions/Step/StepTitle/package.json +0 -6
- package/Questions/Step/StepTitle.js.map +0 -7
- package/Questions/Step/getAddMoreFields/index.js +0 -29
- package/Questions/Step/getAddMoreFields/package.json +0 -6
- package/Questions/Step/getAddMoreFields.js.map +0 -7
- package/Questions/Step/index.js.map +0 -7
- package/Questions/Step/package.json +0 -6
- package/Questions/Step/types/index.js +0 -1
- package/Questions/Step/types/package.json +0 -6
- package/Questions/Step/types.js.map +0 -7
- package/Questions/__stories__/Default.d.ts +0 -3
- package/Questions/getNextStep/index.js +0 -22
- package/Questions/getNextStep/package.json +0 -6
- package/Questions/getNextStep.js.map +0 -7
- package/Questions/index.js.map +0 -7
- package/Questions/index.spec.d.ts +0 -1
- package/Questions/index.test.d.ts +0 -1
- package/Questions/package.json +0 -6
- package/Questions/types/index.js +0 -1
- package/Questions/types/package.json +0 -6
- package/Questions/types.js.map +0 -7
- package/cjs/Field/ErrorGroup/index.js +0 -82
- package/cjs/Field/ErrorGroup.js.map +0 -7
- package/cjs/Field/FieldBase/index.js +0 -150
- package/cjs/Field/FieldBase.js.map +0 -7
- package/cjs/Field/FieldBaseContainer/index.js +0 -66
- package/cjs/Field/FieldBaseContainer.js.map +0 -7
- package/cjs/Field/FieldConditional/index.js +0 -118
- package/cjs/Field/FieldConditional.js.map +0 -7
- package/cjs/Field/index.js +0 -144
- package/cjs/Field/index.js.map +0 -7
- package/cjs/Field/types/index.js +0 -16
- package/cjs/Field/types.js.map +0 -7
- package/cjs/Field/utils/calculateField/index.js +0 -50
- package/cjs/Field/utils/calculateField.js.map +0 -7
- package/cjs/Field/utils/evaluateFieldWithConditions/index.js +0 -49
- package/cjs/Field/utils/evaluateFieldWithConditions.js.map +0 -7
- package/cjs/Field/utils/index.js +0 -119
- package/cjs/Field/utils/index.js.map +0 -7
- package/cjs/Field/utils/useField/index.js +0 -80
- package/cjs/Field/utils/useField.js.map +0 -7
- package/cjs/FieldArray/FormDialog/index.js +0 -301
- package/cjs/FieldArray/FormDialog.js.map +0 -7
- package/cjs/FieldArray/index.js +0 -143
- package/cjs/FieldArray/index.js.map +0 -7
- package/cjs/FieldObject/index.js +0 -106
- package/cjs/FieldObject/index.js.map +0 -7
- package/cjs/Fieldset/FieldsetWithContext/index.js +0 -59
- package/cjs/Fieldset/FieldsetWithContext.js.map +0 -7
- package/cjs/Fieldset/index.js +0 -66
- package/cjs/Fieldset/index.js.map +0 -7
- package/cjs/Fieldset/types/index.js +0 -16
- package/cjs/Fieldset/types.js.map +0 -7
- package/cjs/FormBuilder/index.js +0 -273
- package/cjs/FormBuilder/index.js.map +0 -7
- package/cjs/FormContext/index.js +0 -32
- package/cjs/FormContext.js.map +0 -7
- package/cjs/MultiplicityField/add-objects/index.js +0 -181
- package/cjs/MultiplicityField/add-objects.js.map +0 -7
- package/cjs/MultiplicityField/index.js +0 -150
- package/cjs/MultiplicityField/index.js.map +0 -7
- package/cjs/MultiplicityField/types/index.js +0 -16
- package/cjs/MultiplicityField/types.js.map +0 -7
- package/cjs/Questions/Questions/index.js +0 -100
- package/cjs/Questions/Questions.js.map +0 -7
- package/cjs/Questions/QuestionsContext/index.js +0 -34
- package/cjs/Questions/QuestionsContext.js.map +0 -7
- package/cjs/Questions/Step/ReviewStep/index.js +0 -65
- package/cjs/Questions/Step/ReviewStep.js.map +0 -7
- package/cjs/Questions/Step/Step/index.js +0 -87
- package/cjs/Questions/Step/Step.js.map +0 -7
- package/cjs/Questions/Step/StepArrayReview/index.js +0 -67
- package/cjs/Questions/Step/StepArrayReview.js.map +0 -7
- package/cjs/Questions/Step/StepContext/index.js +0 -46
- package/cjs/Questions/Step/StepContext.js.map +0 -7
- package/cjs/Questions/Step/StepDescription/index.js +0 -58
- package/cjs/Questions/Step/StepDescription.js.map +0 -7
- package/cjs/Questions/Step/StepForm/index.js +0 -67
- package/cjs/Questions/Step/StepForm.js.map +0 -7
- package/cjs/Questions/Step/StepQuote/index.js +0 -44
- package/cjs/Questions/Step/StepQuote.js.map +0 -7
- package/cjs/Questions/Step/StepTitle/index.js +0 -76
- package/cjs/Questions/Step/StepTitle.js.map +0 -7
- package/cjs/Questions/Step/getAddMoreFields/index.js +0 -52
- package/cjs/Questions/Step/getAddMoreFields.js.map +0 -7
- package/cjs/Questions/Step/index.js +0 -59
- package/cjs/Questions/Step/index.js.map +0 -7
- package/cjs/Questions/Step/types/index.js +0 -16
- package/cjs/Questions/Step/types.js.map +0 -7
- package/cjs/Questions/getNextStep/index.js +0 -45
- package/cjs/Questions/getNextStep.js.map +0 -7
- package/cjs/Questions/index.js +0 -31
- package/cjs/Questions/index.js.map +0 -7
- package/cjs/Questions/types/index.js +0 -16
- package/cjs/Questions/types.js.map +0 -7
- package/cjs/index.js +0 -49
- package/cjs/index.js.map +0 -7
- package/cjs/inputs/AutoCompleteInput/index.js +0 -98
- package/cjs/inputs/AutoCompleteInput/index.js.map +0 -7
- package/cjs/inputs/Checkboxes/index.js +0 -107
- package/cjs/inputs/Checkboxes/index.js.map +0 -7
- package/cjs/inputs/DateInput/index.js +0 -156
- package/cjs/inputs/DateInput/index.js.map +0 -7
- package/cjs/inputs/DateTimeInput/index.js +0 -211
- package/cjs/inputs/DateTimeInput/index.js.map +0 -7
- package/cjs/inputs/FileInput/index.js +0 -95
- package/cjs/inputs/FileInput/index.js.map +0 -7
- package/cjs/inputs/ImageInput/index.js +0 -99
- package/cjs/inputs/ImageInput/index.js.map +0 -7
- package/cjs/inputs/Input/index.js +0 -111
- package/cjs/inputs/Input/index.js.map +0 -7
- package/cjs/inputs/Input/inputsInputScenarios/index.js +0 -439
- package/cjs/inputs/Input/inputsInputScenarios.js.map +0 -7
- package/cjs/inputs/Label/index.js +0 -50
- package/cjs/inputs/Label/index.js.map +0 -7
- package/cjs/inputs/OtpInput/index.js +0 -181
- package/cjs/inputs/OtpInput/index.js.map +0 -7
- package/cjs/inputs/Radio/index.js +0 -134
- package/cjs/inputs/Radio/index.js.map +0 -7
- package/cjs/inputs/Select/index.js +0 -62
- package/cjs/inputs/Select/index.js.map +0 -7
- package/cjs/inputs/index.js +0 -62
- package/cjs/inputs/index.js.map +0 -7
- package/cjs/inputs/inputsScenarios/index.js +0 -533
- package/cjs/inputs/inputsScenarios.js.map +0 -7
- package/cjs/internal/index.js +0 -38
- package/cjs/internal.js.map +0 -7
- package/cjs/lazy/index.js +0 -110
- package/cjs/lazy.js.map +0 -7
- package/cjs/locales/el/index.js +0 -35
- package/cjs/locales/el.js.map +0 -7
- package/cjs/registry/index.js +0 -195
- package/cjs/registry.js.map +0 -7
- package/cjs/types/index.js +0 -22
- package/cjs/types.js.map +0 -7
- package/cjs/utils/index.js +0 -83
- package/cjs/utils.js.map +0 -7
- package/cjs/validators/index.js +0 -160
- package/cjs/validators/index.js.map +0 -7
- package/cjs/validators/types/index.js +0 -16
- package/cjs/validators/types.js.map +0 -7
- package/cjs/validators/utils/afm/index.js +0 -55
- package/cjs/validators/utils/afm.js.map +0 -7
- package/cjs/validators/utils/date/index.js +0 -138
- package/cjs/validators/utils/date.js.map +0 -7
- package/cjs/validators/utils/datetime/index.js +0 -151
- package/cjs/validators/utils/datetime.js.map +0 -7
- package/cjs/validators/utils/file/index.js +0 -48
- package/cjs/validators/utils/file.js.map +0 -7
- package/cjs/validators/utils/iban/index.js +0 -142
- package/cjs/validators/utils/iban.js.map +0 -7
- package/cjs/validators/utils/image/index.js +0 -102
- package/cjs/validators/utils/image.js.map +0 -7
- package/cjs/validators/utils/index.js +0 -144
- package/cjs/validators/utils/index.js.map +0 -7
- package/cjs/validators/utils/int/index.js +0 -48
- package/cjs/validators/utils/int.js.map +0 -7
- package/cjs/validators/utils/number/index.js +0 -44
- package/cjs/validators/utils/number.js.map +0 -7
- package/cjs/validators/utils/otp/index.js +0 -54
- package/cjs/validators/utils/otp.js.map +0 -7
- package/cjs/validators/utils/phone/index.js +0 -198
- package/cjs/validators/utils/phone.js.map +0 -7
- package/cjs/validators/utils/postal_code/index.js +0 -54
- package/cjs/validators/utils/postal_code.js.map +0 -7
- package/cjs/validators/utils/text_limit/index.js +0 -69
- package/cjs/validators/utils/text_limit.js.map +0 -7
- package/cjs/validators/utils/uuid4/index.js +0 -46
- package/cjs/validators/utils/uuid4.js.map +0 -7
- package/index.js.map +0 -7
- package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +0 -11
- package/inputs/AutoCompleteInput/__stories__/Default.d.ts +0 -3
- package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +0 -3
- package/inputs/AutoCompleteInput/index.js.map +0 -7
- package/inputs/AutoCompleteInput/index.test.d.ts +0 -1
- package/inputs/AutoCompleteInput/package.json +0 -6
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +0 -12
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/Default.d.ts +0 -3
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Checkboxes/index.js.map +0 -7
- package/inputs/Checkboxes/index.test.d.ts +0 -1
- package/inputs/Checkboxes/package.json +0 -6
- package/inputs/DateInput/DateInput.stories.d.ts +0 -10
- package/inputs/DateInput/__stories__/Default.d.ts +0 -3
- package/inputs/DateInput/index.js.map +0 -7
- package/inputs/DateInput/index.test.d.ts +0 -1
- package/inputs/DateInput/package.json +0 -6
- package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +0 -9
- package/inputs/DateTimeInput/__stories__/Default.d.ts +0 -3
- package/inputs/DateTimeInput/index.js.map +0 -7
- package/inputs/DateTimeInput/index.test.d.ts +0 -1
- package/inputs/DateTimeInput/package.json +0 -6
- package/inputs/FileInput/FileInput.stories.d.ts +0 -10
- package/inputs/FileInput/__stories__/Default.d.ts +0 -3
- package/inputs/FileInput/index.js.map +0 -7
- package/inputs/FileInput/index.test.d.ts +0 -1
- package/inputs/FileInput/package.json +0 -6
- package/inputs/ImageInput/ImageInput.stories.d.ts +0 -12
- package/inputs/ImageInput/__stories__/Default.d.ts +0 -3
- package/inputs/ImageInput/__stories__/MaxSize.d.ts +0 -3
- package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +0 -3
- package/inputs/ImageInput/index.js.map +0 -7
- package/inputs/ImageInput/index.test.d.ts +0 -1
- package/inputs/ImageInput/package.json +0 -6
- package/inputs/Input/Input.stories.d.ts +0 -20
- package/inputs/Input/__stories__/AFM.d.ts +0 -3
- package/inputs/Input/__stories__/Boolean.d.ts +0 -3
- package/inputs/Input/__stories__/IBAN.d.ts +0 -3
- package/inputs/Input/__stories__/Integer.d.ts +0 -3
- package/inputs/Input/__stories__/LandlineNumber.d.ts +0 -3
- package/inputs/Input/__stories__/MobilePhone.d.ts +0 -3
- package/inputs/Input/__stories__/PhoneNumber.d.ts +0 -3
- package/inputs/Input/__stories__/PostalCode.d.ts +0 -3
- package/inputs/Input/__stories__/String.d.ts +0 -3
- package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +0 -3
- package/inputs/Input/__stories__/TextWithLimit.d.ts +0 -3
- package/inputs/Input/index.js.map +0 -7
- package/inputs/Input/index.test.d.ts +0 -1
- package/inputs/Input/inputsInputScenarios/index.js +0 -406
- package/inputs/Input/inputsInputScenarios/package.json +0 -6
- package/inputs/Input/inputsInputScenarios.d.ts +0 -57
- package/inputs/Input/inputsInputScenarios.js.map +0 -7
- package/inputs/Input/package.json +0 -6
- package/inputs/Label/Label.stories.d.ts +0 -10
- package/inputs/Label/__stories__/Default.d.ts +0 -3
- package/inputs/Label/index.js.map +0 -7
- package/inputs/Label/index.test.d.ts +0 -1
- package/inputs/Label/package.json +0 -6
- package/inputs/OtpInput/OtpInput.stories.d.ts +0 -10
- package/inputs/OtpInput/__stories__/Default.d.ts +0 -3
- package/inputs/OtpInput/index.js.map +0 -7
- package/inputs/OtpInput/index.test.d.ts +0 -1
- package/inputs/OtpInput/package.json +0 -6
- package/inputs/Radio/Radio.stories.d.ts +0 -12
- package/inputs/Radio/__stories__/Conditional.d.ts +0 -3
- package/inputs/Radio/__stories__/Default.d.ts +0 -3
- package/inputs/Radio/__stories__/WithDivider.d.ts +0 -3
- package/inputs/Radio/index.js.map +0 -7
- package/inputs/Radio/index.test.d.ts +0 -1
- package/inputs/Radio/package.json +0 -6
- package/inputs/Select/Select.stories.d.ts +0 -10
- package/inputs/Select/__stories__/Default.d.ts +0 -3
- package/inputs/Select/index.js.map +0 -7
- package/inputs/Select/index.test.d.ts +0 -1
- package/inputs/Select/package.json +0 -6
- package/inputs/index.js.map +0 -7
- package/inputs/inputsScenarios/index.js +0 -499
- package/inputs/inputsScenarios/package.json +0 -6
- package/inputs/inputsScenarios.d.ts +0 -296
- package/inputs/inputsScenarios.js.map +0 -7
- package/inputs/package.json +0 -6
- package/internal/index.js +0 -10
- package/internal/package.json +0 -6
- package/internal.js.map +0 -7
- package/lazy/package.json +0 -6
- package/locales/el/index.js +0 -6
- package/locales/el/package.json +0 -6
- package/locales/el.d.ts +0 -2
- package/locales/el.js.map +0 -7
- package/registry/package.json +0 -6
- package/src/Field/utils/calculateField.ts +0 -49
- package/src/FieldArray/FormDialog.tsx +0 -378
- package/src/inputs/Input/inputsInputScenarios.ts +0 -404
- package/src/inputs/inputsScenarios.ts +0 -496
- package/src/lazy.js +0 -77
- package/src/locales/el.ts +0 -3
- package/src/registry.js +0 -165
- package/types/index.js +0 -2
- package/types/package.json +0 -6
- package/types.js.map +0 -7
- package/utils/index.js +0 -60
- package/utils/package.json +0 -6
- package/utils.js.map +0 -7
- package/validators/index.js.map +0 -7
- package/validators/package.json +0 -6
- package/validators/types/index.js +0 -1
- package/validators/types/package.json +0 -6
- package/validators/types.js.map +0 -7
- package/validators/utils/afm/index.js +0 -31
- package/validators/utils/afm/package.json +0 -6
- package/validators/utils/afm.js.map +0 -7
- package/validators/utils/date/index.js +0 -103
- package/validators/utils/date/package.json +0 -6
- package/validators/utils/date.js.map +0 -7
- package/validators/utils/datetime/index.js +0 -116
- package/validators/utils/datetime/package.json +0 -6
- package/validators/utils/datetime.js.map +0 -7
- package/validators/utils/file/index.js +0 -25
- package/validators/utils/file/package.json +0 -6
- package/validators/utils/file.js.map +0 -7
- package/validators/utils/iban/index.js +0 -118
- package/validators/utils/iban/package.json +0 -6
- package/validators/utils/iban.js.map +0 -7
- package/validators/utils/image/index.js +0 -79
- package/validators/utils/image/package.json +0 -6
- package/validators/utils/image.js.map +0 -7
- package/validators/utils/index.js.map +0 -7
- package/validators/utils/int/index.js +0 -24
- package/validators/utils/int/package.json +0 -6
- package/validators/utils/int.js.map +0 -7
- package/validators/utils/number/index.js +0 -20
- package/validators/utils/number/package.json +0 -6
- package/validators/utils/number.js.map +0 -7
- package/validators/utils/otp/index.js +0 -30
- package/validators/utils/otp/package.json +0 -6
- package/validators/utils/otp.js.map +0 -7
- package/validators/utils/package.json +0 -6
- package/validators/utils/phone/index.js +0 -172
- package/validators/utils/phone/package.json +0 -6
- package/validators/utils/phone.js.map +0 -7
- package/validators/utils/postal_code/index.js +0 -30
- package/validators/utils/postal_code/package.json +0 -6
- package/validators/utils/postal_code.js.map +0 -7
- package/validators/utils/text_limit/index.js +0 -45
- package/validators/utils/text_limit/package.json +0 -6
- package/validators/utils/text_limit.js.map +0 -7
- package/validators/utils/uuid4/index.js +0 -22
- package/validators/utils/uuid4/package.json +0 -6
- package/validators/utils/uuid4.js.map +0 -7
- package/validators/validators.spec.d.ts +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/file.ts"],
|
|
4
|
-
"sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nconst DEFAULT_FILE_MAX_SIZE = 10000000;\n\nexport const FILE_MAX_SIZE_VALIDATOR = (field: FieldSpec): ValidatorSchema => ({\n name: 'file-max-size-validator',\n message: {\n key:\n field.type === 'file' ? 'form.error.file_size' : 'form.error.image_size',\n context: {\n maxSizeToMb:\n (field?.extra?.limit?.maxSize || DEFAULT_FILE_MAX_SIZE) / 1000000,\n },\n },\n test: (value: File[]): boolean => {\n if (value) {\n for (const file of value) {\n const maxSize = field?.extra?.limit?.maxSize || DEFAULT_FILE_MAX_SIZE;\n if (file.size > maxSize) {\n return false;\n }\n }\n }\n return true;\n },\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,MAAM,wBAAwB;AAEvB,MAAM,0BAA0B,CAAC,WAAuC;AAAA,EAC7E,MAAM;AAAA,EACN,SAAS;AAAA,IACP,KACE,MAAM,SAAS,SAAS,yBAAyB;AAAA,IACnD,SAAS;AAAA,MACP,cACG,OAAO,OAAO,OAAO,WAAW,yBAAyB;AAAA,IAC9D;AAAA,EACF;AAAA,EACA,MAAM,CAAC,UAA2B;AAChC,QAAI,OAAO;AACT,iBAAW,QAAQ,OAAO;AACxB,cAAM,UAAU,OAAO,OAAO,OAAO,WAAW;AAChD,YAAI,KAAK,OAAO,SAAS;AACvB,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var iban_exports = {};
|
|
19
|
-
__export(iban_exports, {
|
|
20
|
-
IBAN_VALIDATOR: () => IBAN_VALIDATOR,
|
|
21
|
-
validateIban: () => validateIban
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(iban_exports);
|
|
24
|
-
function validateIban(value, countryCode) {
|
|
25
|
-
value = value.replace(/\s/g, "").replace(/-/g, "");
|
|
26
|
-
if (value.match(/^[0-9]*$/i)) {
|
|
27
|
-
if (value.length !== 25) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
value = value.toUpperCase();
|
|
32
|
-
if (countryCode) {
|
|
33
|
-
if (!value.startsWith(countryCode.toUpperCase())) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
if (value.length === ibanCountryCodesLengths[countryCode.toUpperCase()]) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (value.length !== 27) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
const IBAN_VALIDATOR = (field) => {
|
|
47
|
-
const countryCode = field?.extra?.country;
|
|
48
|
-
return {
|
|
49
|
-
name: "iban-validator",
|
|
50
|
-
message: "form.error.iban",
|
|
51
|
-
test: (value) => {
|
|
52
|
-
if (!value) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return validateIban(value, countryCode);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const ibanCountryCodesLengths = {
|
|
60
|
-
AD: 24,
|
|
61
|
-
AT: 20,
|
|
62
|
-
AZ: 28,
|
|
63
|
-
BH: 22,
|
|
64
|
-
BY: 28,
|
|
65
|
-
BE: 16,
|
|
66
|
-
BA: 20,
|
|
67
|
-
BR: 29,
|
|
68
|
-
BG: 22,
|
|
69
|
-
CR: 22,
|
|
70
|
-
HR: 21,
|
|
71
|
-
CY: 28,
|
|
72
|
-
CZ: 24,
|
|
73
|
-
DK: 18,
|
|
74
|
-
DO: 28,
|
|
75
|
-
EG: 29,
|
|
76
|
-
SV: 28,
|
|
77
|
-
EE: 20,
|
|
78
|
-
FO: 18,
|
|
79
|
-
FI: 18,
|
|
80
|
-
FR: 27,
|
|
81
|
-
GE: 22,
|
|
82
|
-
DE: 22,
|
|
83
|
-
GI: 23,
|
|
84
|
-
GR: 27,
|
|
85
|
-
GL: 18,
|
|
86
|
-
GT: 28,
|
|
87
|
-
VA: 22,
|
|
88
|
-
HU: 28,
|
|
89
|
-
IS: 26,
|
|
90
|
-
IQ: 23,
|
|
91
|
-
IE: 22,
|
|
92
|
-
IL: 23,
|
|
93
|
-
IT: 27,
|
|
94
|
-
JO: 30,
|
|
95
|
-
KZ: 20,
|
|
96
|
-
XK: 20,
|
|
97
|
-
KW: 30,
|
|
98
|
-
LV: 21,
|
|
99
|
-
LB: 28,
|
|
100
|
-
LI: 21,
|
|
101
|
-
LT: 20,
|
|
102
|
-
LU: 20,
|
|
103
|
-
MT: 31,
|
|
104
|
-
MR: 27,
|
|
105
|
-
MU: 30,
|
|
106
|
-
MD: 24,
|
|
107
|
-
MC: 27,
|
|
108
|
-
ME: 22,
|
|
109
|
-
NL: 18,
|
|
110
|
-
MK: 19,
|
|
111
|
-
NO: 15,
|
|
112
|
-
PK: 24,
|
|
113
|
-
PS: 29,
|
|
114
|
-
PL: 28,
|
|
115
|
-
PT: 25,
|
|
116
|
-
QA: 29,
|
|
117
|
-
RO: 24,
|
|
118
|
-
LC: 32,
|
|
119
|
-
SM: 27,
|
|
120
|
-
ST: 25,
|
|
121
|
-
SA: 24,
|
|
122
|
-
RS: 22,
|
|
123
|
-
SC: 31,
|
|
124
|
-
SK: 24,
|
|
125
|
-
SI: 19,
|
|
126
|
-
ES: 24,
|
|
127
|
-
SE: 24,
|
|
128
|
-
CH: 21,
|
|
129
|
-
TL: 23,
|
|
130
|
-
TN: 24,
|
|
131
|
-
TR: 26,
|
|
132
|
-
UA: 29,
|
|
133
|
-
AE: 23,
|
|
134
|
-
GB: 22,
|
|
135
|
-
VG: 24
|
|
136
|
-
};
|
|
137
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
138
|
-
0 && (module.exports = {
|
|
139
|
-
IBAN_VALIDATOR,
|
|
140
|
-
validateIban
|
|
141
|
-
});
|
|
142
|
-
//# sourceMappingURL=iban.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/iban.ts"],
|
|
4
|
-
"sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nexport function validateIban(value: string, countryCode: string): boolean {\n value = value.replace(/\\s/g, '').replace(/-/g, '');\n if (value.match(/^[0-9]*$/i)) {\n // this is for greek iban without the country code\n if (value.length !== 25) {\n return false;\n }\n } else {\n value = value.toUpperCase();\n if (countryCode) {\n if (!value.startsWith(countryCode.toUpperCase())) {\n return false;\n }\n if (value.length === ibanCountryCodesLengths[countryCode.toUpperCase()]) {\n return true;\n }\n }\n if (value.length !== 27) {\n // this is for greek iban\n return false;\n }\n }\n return true;\n}\n\nexport const IBAN_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCode = field?.extra?.country;\n return {\n name: 'iban-validator',\n message: 'form.error.iban',\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateIban(value, countryCode);\n },\n };\n};\n\nconst ibanCountryCodesLengths = {\n AD: 24,\n AT: 20,\n AZ: 28,\n BH: 22,\n BY: 28,\n BE: 16,\n BA: 20,\n BR: 29,\n BG: 22,\n CR: 22,\n HR: 21,\n CY: 28,\n CZ: 24,\n DK: 18,\n DO: 28,\n EG: 29,\n SV: 28,\n EE: 20,\n FO: 18,\n FI: 18,\n FR: 27,\n GE: 22,\n DE: 22,\n GI: 23,\n GR: 27,\n GL: 18,\n GT: 28,\n VA: 22,\n HU: 28,\n IS: 26,\n IQ: 23,\n IE: 22,\n IL: 23,\n IT: 27,\n JO: 30,\n KZ: 20,\n XK: 20,\n KW: 30,\n LV: 21,\n LB: 28,\n LI: 21,\n LT: 20,\n LU: 20,\n MT: 31,\n MR: 27,\n MU: 30,\n MD: 24,\n MC: 27,\n ME: 22,\n NL: 18,\n MK: 19,\n NO: 15,\n PK: 24,\n PS: 29,\n PL: 28,\n PT: 25,\n QA: 29,\n RO: 24,\n LC: 32,\n SM: 27,\n ST: 25,\n SA: 24,\n RS: 22,\n SC: 31,\n SK: 24,\n SI: 19,\n ES: 24,\n SE: 24,\n CH: 21,\n TL: 23,\n TN: 24,\n TR: 26,\n UA: 29,\n AE: 23,\n GB: 22,\n VG: 24,\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,aAAa,OAAe,aAA8B;AACxE,UAAQ,MAAM,QAAQ,OAAO,EAAE,EAAE,QAAQ,MAAM,EAAE;AACjD,MAAI,MAAM,MAAM,WAAW,GAAG;AAE5B,QAAI,MAAM,WAAW,IAAI;AACvB,aAAO;AAAA,IACT;AAAA,EACF,OAAO;AACL,YAAQ,MAAM,YAAY;AAC1B,QAAI,aAAa;AACf,UAAI,CAAC,MAAM,WAAW,YAAY,YAAY,CAAC,GAAG;AAChD,eAAO;AAAA,MACT;AACA,UAAI,MAAM,WAAW,wBAAwB,YAAY,YAAY,CAAC,GAAG;AACvE,eAAO;AAAA,MACT;AAAA,IACF;AACA,QAAI,MAAM,WAAW,IAAI;AAEvB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,iBAAiB,CAAC,UAAsC;AACnE,QAAM,cAAc,OAAO,OAAO;AAClC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,CAAC,OAAO;AACV,eAAO;AAAA,MACT;AACA,aAAO,aAAa,OAAO,WAAW;AAAA,IACxC;AAAA,EACF;AACF;AAEA,MAAM,0BAA0B;AAAA,EAC9B,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var image_exports = {};
|
|
19
|
-
__export(image_exports, {
|
|
20
|
-
IMAGE_DIMENSION_VALIDATOR: () => IMAGE_DIMENSION_VALIDATOR
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(image_exports);
|
|
23
|
-
const DEFAULT_IMAGE_MAX_HEIGHT_SIZE = 2e3;
|
|
24
|
-
const DEFAULT_IMAGE_MAX_WIDTH_SIZE = 2e3;
|
|
25
|
-
const DEFAULT_IMAGE_MIN_HEIGHT_SIZE = 100;
|
|
26
|
-
const DEFAULT_IMAGE_MIN_WIDTH_SIZE = 100;
|
|
27
|
-
function getImageDimensions(file) {
|
|
28
|
-
return new Promise((resolve, reject) => {
|
|
29
|
-
const reader = new FileReader();
|
|
30
|
-
reader.onload = (event) => {
|
|
31
|
-
const img = new Image();
|
|
32
|
-
img.onload = () => {
|
|
33
|
-
resolve({ width: img.width, height: img.height });
|
|
34
|
-
};
|
|
35
|
-
img.onerror = reject;
|
|
36
|
-
const result = event?.target?.result;
|
|
37
|
-
if (result && typeof result === "string") {
|
|
38
|
-
img.src = result;
|
|
39
|
-
} else {
|
|
40
|
-
reject(new Error("Invalid file format"));
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
reader.onerror = reject;
|
|
44
|
-
reader.readAsDataURL(file);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const IMAGE_DIMENSION_VALIDATOR = (field) => ({
|
|
48
|
-
name: "image-dimension-validator",
|
|
49
|
-
message: (value) => {
|
|
50
|
-
const minHeight = field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;
|
|
51
|
-
const minWidth = field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;
|
|
52
|
-
const maxHeight = field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;
|
|
53
|
-
const maxWidth = field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;
|
|
54
|
-
if (!value || value.length === 0) {
|
|
55
|
-
return {
|
|
56
|
-
name: "image-validator",
|
|
57
|
-
message: "form.error.required"
|
|
58
|
-
};
|
|
59
|
-
} else {
|
|
60
|
-
return {
|
|
61
|
-
key: "form.error.image.image_dimension_size",
|
|
62
|
-
context: {
|
|
63
|
-
maxHeight,
|
|
64
|
-
maxWidth,
|
|
65
|
-
minHeight,
|
|
66
|
-
minWidth
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
test: async (value) => {
|
|
72
|
-
if (!value || value.length === 0) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
const file = value[0];
|
|
76
|
-
const { width, height } = await getImageDimensions(file);
|
|
77
|
-
const maxHeight = field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;
|
|
78
|
-
const maxWidth = field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;
|
|
79
|
-
const minHeight = field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;
|
|
80
|
-
const minWidth = field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;
|
|
81
|
-
if (!file) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
if (height > maxHeight || width > maxWidth) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (height < minHeight || width < minWidth) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error("Error getting image dimensions:", error);
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
-
0 && (module.exports = {
|
|
100
|
-
IMAGE_DIMENSION_VALIDATOR
|
|
101
|
-
});
|
|
102
|
-
//# sourceMappingURL=image.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/image.ts"],
|
|
4
|
-
"sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nconst DEFAULT_IMAGE_MAX_HEIGHT_SIZE = 2000;\nconst DEFAULT_IMAGE_MAX_WIDTH_SIZE = 2000;\nconst DEFAULT_IMAGE_MIN_HEIGHT_SIZE = 100;\nconst DEFAULT_IMAGE_MIN_WIDTH_SIZE = 100;\n\nfunction getImageDimensions(\n file: File\n): Promise<{ width: number; height: number }> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n const result = event?.target?.result;\n if (result && typeof result === 'string') {\n img.src = result;\n } else {\n reject(new Error('Invalid file format'));\n }\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n}\n\nexport const IMAGE_DIMENSION_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => ({\n name: 'image-dimension-validator',\n message: (value: any) => {\n const minHeight =\n field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;\n const minWidth =\n field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;\n const maxHeight =\n field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;\n const maxWidth =\n field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;\n if (!value || value.length === 0) {\n return {\n name: 'image-validator',\n message: 'form.error.required',\n };\n } else {\n return {\n key: 'form.error.image.image_dimension_size',\n context: {\n maxHeight: maxHeight,\n maxWidth: maxWidth,\n minHeight: minHeight,\n minWidth: minWidth,\n },\n };\n }\n },\n test: async (value: File[]): Promise<boolean> => {\n if (!value || value.length === 0) {\n return true;\n }\n const file = value[0];\n const { width, height } = await getImageDimensions(file);\n const maxHeight =\n field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;\n const maxWidth =\n field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;\n const minHeight =\n field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;\n const minWidth =\n field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;\n if (!file) {\n return true;\n }\n try {\n if (height > maxHeight || width > maxWidth) {\n return false;\n }\n if (height < minHeight || width < minWidth) {\n return false;\n }\n return true;\n } catch (error) {\n console.error('Error getting image dimensions:', error);\n return false; // Return false in case of an error.\n }\n },\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AACrC,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AAErC,SAAS,mBACP,MAC4C;AAC5C,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,IAAI,WAAW;AAC9B,WAAO,SAAS,CAAC,UAAU;AACzB,YAAM,MAAM,IAAI,MAAM;AACtB,UAAI,SAAS,MAAM;AACjB,gBAAQ,EAAE,OAAO,IAAI,OAAO,QAAQ,IAAI,OAAO,CAAC;AAAA,MAClD;AACA,UAAI,UAAU;AACd,YAAM,SAAS,OAAO,QAAQ;AAC9B,UAAI,UAAU,OAAO,WAAW,UAAU;AACxC,YAAI,MAAM;AAAA,MACZ,OAAO;AACL,eAAO,IAAI,MAAM,qBAAqB,CAAC;AAAA,MACzC;AAAA,IACF;AACA,WAAO,UAAU;AACjB,WAAO,cAAc,IAAI;AAAA,EAC3B,CAAC;AACH;AAEO,MAAM,4BAA4B,CACvC,WACqB;AAAA,EACrB,MAAM;AAAA,EACN,SAAS,CAAC,UAAe;AACvB,UAAM,YACJ,OAAO,OAAO,OAAO,aAAa;AACpC,UAAM,WACJ,OAAO,OAAO,OAAO,YAAY;AACnC,UAAM,YACJ,OAAO,OAAO,OAAO,aAAa;AACpC,UAAM,WACJ,OAAO,OAAO,OAAO,YAAY;AACnC,QAAI,CAAC,SAAS,MAAM,WAAW,GAAG;AAChC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF,OAAO;AACL,aAAO;AAAA,QACL,KAAK;AAAA,QACL,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM,OAAO,UAAoC;AAC/C,QAAI,CAAC,SAAS,MAAM,WAAW,GAAG;AAChC,aAAO;AAAA,IACT;AACA,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,EAAE,OAAO,OAAO,IAAI,MAAM,mBAAmB,IAAI;AACvD,UAAM,YACJ,OAAO,OAAO,OAAO,aAAa;AACpC,UAAM,WACJ,OAAO,OAAO,OAAO,YAAY;AACnC,UAAM,YACJ,OAAO,OAAO,OAAO,aAAa;AACpC,UAAM,WACJ,OAAO,OAAO,OAAO,YAAY;AACnC,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,IACT;AACA,QAAI;AACF,UAAI,SAAS,aAAa,QAAQ,UAAU;AAC1C,eAAO;AAAA,MACT;AACA,UAAI,SAAS,aAAa,QAAQ,UAAU;AAC1C,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,SAAS,OAAO;AACd,cAAQ,MAAM,mCAAmC,KAAK;AACtD,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var utils_exports = {};
|
|
30
|
-
__export(utils_exports, {
|
|
31
|
-
computeShape: () => computeShape,
|
|
32
|
-
getYupField: () => getYupField,
|
|
33
|
-
getYupObjectShape: () => getYupObjectShape
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(utils_exports);
|
|
36
|
-
var yup = __toESM(require("yup"));
|
|
37
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/afm"), module.exports);
|
|
38
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/file"), module.exports);
|
|
39
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/iban"), module.exports);
|
|
40
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/otp"), module.exports);
|
|
41
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/image"), module.exports);
|
|
42
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/phone"), module.exports);
|
|
43
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/postal_code"), module.exports);
|
|
44
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/uuid4"), module.exports);
|
|
45
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/text_limit"), module.exports);
|
|
46
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/date"), module.exports);
|
|
47
|
-
__reExport(utils_exports, require("@digigov/form/validators/utils/datetime"), module.exports);
|
|
48
|
-
function getYupField(field, yupTypeMap) {
|
|
49
|
-
const yupField = yupTypeMap[field?.type || "string"] || yupTypeMap["string"];
|
|
50
|
-
return yupField(field);
|
|
51
|
-
}
|
|
52
|
-
function computeShape(fields, yupTypeMap, validatorRegistry) {
|
|
53
|
-
const fieldSchemas = {};
|
|
54
|
-
const objectFields = {};
|
|
55
|
-
fields.forEach((field) => {
|
|
56
|
-
let yupField = getYupField(field, yupTypeMap);
|
|
57
|
-
if (field.condition) {
|
|
58
|
-
for (const key in field.condition) {
|
|
59
|
-
let then, otherwise;
|
|
60
|
-
if (field.condition[key].then) {
|
|
61
|
-
if (field.condition[key].then?.required === false) {
|
|
62
|
-
then = yupField.nullable();
|
|
63
|
-
} else if (field.condition[key].then?.required === true) {
|
|
64
|
-
then = yupField.nullable().required("form.error.required");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (field.condition[key].else) {
|
|
68
|
-
if (field.condition[key].else?.required === false) {
|
|
69
|
-
otherwise = yupField.nullable();
|
|
70
|
-
} else if (field.condition[key].else?.required === true) {
|
|
71
|
-
otherwise = yupField.nullable().required("form.error.required");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (then || otherwise) {
|
|
75
|
-
yupField = yupField.when(key, {
|
|
76
|
-
is: (val) => {
|
|
77
|
-
const is = field.condition[key].is;
|
|
78
|
-
if (is === val || Array.isArray(val) && val.includes(is)) {
|
|
79
|
-
return true;
|
|
80
|
-
} else {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
then,
|
|
85
|
-
otherwise
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
} else if (field.required) {
|
|
90
|
-
yupField = yupField.nullable().required("form.error.required");
|
|
91
|
-
}
|
|
92
|
-
if (validatorRegistry && field.type && validatorRegistry[field.type]) {
|
|
93
|
-
validatorRegistry[field.type].forEach((validator) => {
|
|
94
|
-
yupField = yupField.test(validator);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (field.validators) {
|
|
98
|
-
field.validators.forEach((validator) => {
|
|
99
|
-
yupField = yupField.test(validator);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
fieldSchemas[field.key] = yupField;
|
|
103
|
-
});
|
|
104
|
-
for (const objectKey in objectFields) {
|
|
105
|
-
fieldSchemas[objectKey] = getYupObjectShape(
|
|
106
|
-
objectFields[objectKey],
|
|
107
|
-
yupTypeMap,
|
|
108
|
-
validatorRegistry
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
return fieldSchemas;
|
|
112
|
-
}
|
|
113
|
-
function getYupObjectShape(fields, yupTypeMap, validatorRegistry) {
|
|
114
|
-
if (!fields.current) {
|
|
115
|
-
const fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);
|
|
116
|
-
return yup.object().shape(fieldSchemas);
|
|
117
|
-
}
|
|
118
|
-
return yup.lazy(function() {
|
|
119
|
-
const fieldSchemas = computeShape(
|
|
120
|
-
Object.values(fields.current),
|
|
121
|
-
yupTypeMap,
|
|
122
|
-
validatorRegistry
|
|
123
|
-
);
|
|
124
|
-
return yup.object().shape(fieldSchemas);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
-
0 && (module.exports = {
|
|
129
|
-
computeShape,
|
|
130
|
-
getYupField,
|
|
131
|
-
getYupObjectShape,
|
|
132
|
-
...require("@digigov/form/validators/utils/afm"),
|
|
133
|
-
...require("@digigov/form/validators/utils/file"),
|
|
134
|
-
...require("@digigov/form/validators/utils/iban"),
|
|
135
|
-
...require("@digigov/form/validators/utils/otp"),
|
|
136
|
-
...require("@digigov/form/validators/utils/image"),
|
|
137
|
-
...require("@digigov/form/validators/utils/phone"),
|
|
138
|
-
...require("@digigov/form/validators/utils/postal_code"),
|
|
139
|
-
...require("@digigov/form/validators/utils/uuid4"),
|
|
140
|
-
...require("@digigov/form/validators/utils/text_limit"),
|
|
141
|
-
...require("@digigov/form/validators/utils/date"),
|
|
142
|
-
...require("@digigov/form/validators/utils/datetime")
|
|
143
|
-
});
|
|
144
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as yup from 'yup';\nimport { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport * from '@digigov/form/validators/utils/afm';\nexport * from '@digigov/form/validators/utils/file';\nexport * from '@digigov/form/validators/utils/iban';\nexport * from '@digigov/form/validators/utils/otp';\nexport * from '@digigov/form/validators/utils/image';\nexport * from '@digigov/form/validators/utils/phone';\nexport * from '@digigov/form/validators/utils/postal_code';\nexport * from '@digigov/form/validators/utils/uuid4';\nexport * from '@digigov/form/validators/utils/text_limit';\nexport * from '@digigov/form/validators/utils/date';\nexport * from '@digigov/form/validators/utils/datetime';\n\nexport function getYupField(field: FieldSpec, yupTypeMap: Record<string, any>) {\n const yupField = yupTypeMap[field?.type || 'string'] || yupTypeMap['string'];\n return yupField(field);\n}\nexport function computeShape(\n fields: FieldSpec[],\n yupTypeMap: Record<string, ValidatorSchema>,\n validatorRegistry: Record<string, ValidatorSchema[]> | undefined\n) {\n const fieldSchemas = {};\n const objectFields: Record<string, FieldSpec[]> = {};\n fields.forEach((field) => {\n let yupField = getYupField(field, yupTypeMap);\n if (field.condition) {\n for (const key in field.condition) {\n let then: any, otherwise: any;\n if (field.condition[key].then) {\n if (field.condition[key].then?.required === false) {\n then = yupField.nullable();\n } else if (field.condition[key].then?.required === true) {\n then = yupField.nullable().required('form.error.required');\n }\n }\n if (field.condition[key].else) {\n if (field.condition[key].else?.required === false) {\n otherwise = yupField.nullable();\n } else if (field.condition[key].else?.required === true) {\n otherwise = yupField.nullable().required('form.error.required');\n }\n }\n if (then || otherwise) {\n yupField = yupField.when(key, {\n is: (val) => {\n //@ts-ignore\n const is = field.condition[key].is;\n if (is === val || (Array.isArray(val) && val.includes(is))) {\n return true;\n } else {\n return false;\n }\n },\n then,\n otherwise,\n });\n }\n }\n } else if (field.required) {\n yupField = yupField.nullable().required('form.error.required');\n }\n if (validatorRegistry && field.type && validatorRegistry[field.type]) {\n validatorRegistry[field.type].forEach((validator: any) => {\n yupField = yupField.test(validator);\n });\n }\n if (field.validators) {\n field.validators.forEach((validator) => {\n yupField = yupField.test(validator);\n });\n }\n fieldSchemas[field.key] = yupField;\n });\n for (const objectKey in objectFields) {\n fieldSchemas[objectKey] = getYupObjectShape(\n objectFields[objectKey],\n yupTypeMap,\n validatorRegistry\n );\n }\n return fieldSchemas;\n}\n\nexport function getYupObjectShape(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fields: FieldSpec[] | any,\n yupTypeMap: Record<string, any>,\n validatorRegistry?: Record<string, ValidatorSchema[]>\n) {\n if (!fields.current) {\n const fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);\n return yup.object().shape(fieldSchemas);\n }\n\n return yup.lazy(function () {\n const fieldSchemas = computeShape(\n Object.values(fields.current),\n yupTypeMap,\n validatorRegistry\n );\n return yup.object().shape(fieldSchemas);\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAAqB;AAIrB,0BAAc,+CAJd;AAKA,0BAAc,gDALd;AAMA,0BAAc,gDANd;AAOA,0BAAc,+CAPd;AAQA,0BAAc,iDARd;AASA,0BAAc,iDATd;AAUA,0BAAc,uDAVd;AAWA,0BAAc,iDAXd;AAYA,0BAAc,sDAZd;AAaA,0BAAc,gDAbd;AAcA,0BAAc,oDAdd;AAgBO,SAAS,YAAY,OAAkB,YAAiC;AAC7E,QAAM,WAAW,WAAW,OAAO,QAAQ,QAAQ,KAAK,WAAW,QAAQ;AAC3E,SAAO,SAAS,KAAK;AACvB;AACO,SAAS,aACd,QACA,YACA,mBACA;AACA,QAAM,eAAe,CAAC;AACtB,QAAM,eAA4C,CAAC;AACnD,SAAO,QAAQ,CAAC,UAAU;AACxB,QAAI,WAAW,YAAY,OAAO,UAAU;AAC5C,QAAI,MAAM,WAAW;AACnB,iBAAW,OAAO,MAAM,WAAW;AACjC,YAAI,MAAW;AACf,YAAI,MAAM,UAAU,GAAG,EAAE,MAAM;AAC7B,cAAI,MAAM,UAAU,GAAG,EAAE,MAAM,aAAa,OAAO;AACjD,mBAAO,SAAS,SAAS;AAAA,UAC3B,WAAW,MAAM,UAAU,GAAG,EAAE,MAAM,aAAa,MAAM;AACvD,mBAAO,SAAS,SAAS,EAAE,SAAS,qBAAqB;AAAA,UAC3D;AAAA,QACF;AACA,YAAI,MAAM,UAAU,GAAG,EAAE,MAAM;AAC7B,cAAI,MAAM,UAAU,GAAG,EAAE,MAAM,aAAa,OAAO;AACjD,wBAAY,SAAS,SAAS;AAAA,UAChC,WAAW,MAAM,UAAU,GAAG,EAAE,MAAM,aAAa,MAAM;AACvD,wBAAY,SAAS,SAAS,EAAE,SAAS,qBAAqB;AAAA,UAChE;AAAA,QACF;AACA,YAAI,QAAQ,WAAW;AACrB,qBAAW,SAAS,KAAK,KAAK;AAAA,YAC5B,IAAI,CAAC,QAAQ;AAEX,oBAAM,KAAK,MAAM,UAAU,GAAG,EAAE;AAChC,kBAAI,OAAO,OAAQ,MAAM,QAAQ,GAAG,KAAK,IAAI,SAAS,EAAE,GAAI;AAC1D,uBAAO;AAAA,cACT,OAAO;AACL,uBAAO;AAAA,cACT;AAAA,YACF;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF,WAAW,MAAM,UAAU;AACzB,iBAAW,SAAS,SAAS,EAAE,SAAS,qBAAqB;AAAA,IAC/D;AACA,QAAI,qBAAqB,MAAM,QAAQ,kBAAkB,MAAM,IAAI,GAAG;AACpE,wBAAkB,MAAM,IAAI,EAAE,QAAQ,CAAC,cAAmB;AACxD,mBAAW,SAAS,KAAK,SAAS;AAAA,MACpC,CAAC;AAAA,IACH;AACA,QAAI,MAAM,YAAY;AACpB,YAAM,WAAW,QAAQ,CAAC,cAAc;AACtC,mBAAW,SAAS,KAAK,SAAS;AAAA,MACpC,CAAC;AAAA,IACH;AACA,iBAAa,MAAM,GAAG,IAAI;AAAA,EAC5B,CAAC;AACD,aAAW,aAAa,cAAc;AACpC,iBAAa,SAAS,IAAI;AAAA,MACxB,aAAa,SAAS;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,kBAEd,QACA,YACA,mBACA;AACA,MAAI,CAAC,OAAO,SAAS;AACnB,UAAM,eAAe,aAAa,QAAQ,YAAY,iBAAiB;AACvE,WAAO,IAAI,OAAO,EAAE,MAAM,YAAY;AAAA,EACxC;AAEA,SAAO,IAAI,KAAK,WAAY;AAC1B,UAAM,eAAe;AAAA,MACnB,OAAO,OAAO,OAAO,OAAO;AAAA,MAC5B;AAAA,MACA;AAAA,IACF;AACA,WAAO,IAAI,OAAO,EAAE,MAAM,YAAY;AAAA,EACxC,CAAC;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var int_exports = {};
|
|
19
|
-
__export(int_exports, {
|
|
20
|
-
INT_VALIDATOR: () => INT_VALIDATOR,
|
|
21
|
-
validateIntNumber: () => validateIntNumber
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(int_exports);
|
|
24
|
-
function validateIntNumber(number) {
|
|
25
|
-
if (number === void 0) {
|
|
26
|
-
return false;
|
|
27
|
-
} else {
|
|
28
|
-
return Number.isInteger(number) && Number(number) > 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const INT_VALIDATOR = () => {
|
|
32
|
-
return {
|
|
33
|
-
name: "int-validator",
|
|
34
|
-
message: "form.error.positive_integer_number",
|
|
35
|
-
test: (value) => {
|
|
36
|
-
if (value === void 0) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return validateIntNumber(value);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
INT_VALIDATOR,
|
|
46
|
-
validateIntNumber
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=int.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/int.ts"],
|
|
4
|
-
"sourcesContent": ["import { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateIntNumber(number: number): boolean {\n if (number === undefined) {\n return false;\n } else {\n return Number.isInteger(number) && Number(number) > 0;\n }\n}\n\nexport const INT_VALIDATOR = (): ValidatorSchema => {\n return {\n name: 'int-validator',\n message: 'form.error.positive_integer_number',\n test: (value: number): boolean => {\n if (value === undefined) {\n return true;\n }\n return validateIntNumber(value);\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,kBAAkB,QAAyB;AACzD,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,EACT,OAAO;AACL,WAAO,OAAO,UAAU,MAAM,KAAK,OAAO,MAAM,IAAI;AAAA,EACtD;AACF;AAEO,MAAM,gBAAgB,MAAuB;AAClD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,UAAU,QAAW;AACvB,eAAO;AAAA,MACT;AACA,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var number_exports = {};
|
|
19
|
-
__export(number_exports, {
|
|
20
|
-
NUMBER_VALIDATOR: () => NUMBER_VALIDATOR,
|
|
21
|
-
validateNumber: () => validateNumber
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(number_exports);
|
|
24
|
-
function validateNumber(number) {
|
|
25
|
-
return !Number.isNaN(number);
|
|
26
|
-
}
|
|
27
|
-
const NUMBER_VALIDATOR = () => {
|
|
28
|
-
return {
|
|
29
|
-
name: "number-validator",
|
|
30
|
-
message: "form.error.number",
|
|
31
|
-
test: (value) => {
|
|
32
|
-
if (value === void 0) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return validateNumber(value);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
NUMBER_VALIDATOR,
|
|
42
|
-
validateNumber
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=number.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/number.ts"],
|
|
4
|
-
"sourcesContent": ["import { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateNumber(number: number): boolean {\n return !Number.isNaN(number);\n}\n\nexport const NUMBER_VALIDATOR = (): ValidatorSchema => {\n return {\n name: 'number-validator',\n message: 'form.error.number',\n test: (value: number): boolean => {\n if (value === undefined) {\n return true;\n }\n return validateNumber(value);\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,eAAe,QAAyB;AACtD,SAAO,CAAC,OAAO,MAAM,MAAM;AAC7B;AAEO,MAAM,mBAAmB,MAAuB;AACrD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,UAAU,QAAW;AACvB,eAAO;AAAA,MACT;AACA,aAAO,eAAe,KAAK;AAAA,IAC7B;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var otp_exports = {};
|
|
19
|
-
__export(otp_exports, {
|
|
20
|
-
OTP_VALIDATOR: () => OTP_VALIDATOR,
|
|
21
|
-
validateOtp: () => validateOtp
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(otp_exports);
|
|
24
|
-
function validateOtp(value, maxLength) {
|
|
25
|
-
if (value.length === maxLength) {
|
|
26
|
-
return true;
|
|
27
|
-
} else {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const OTP_VALIDATOR = (field) => {
|
|
32
|
-
const maxLength = field?.maxLength;
|
|
33
|
-
return {
|
|
34
|
-
name: "otp-validator",
|
|
35
|
-
message: {
|
|
36
|
-
key: "form.error.otp.less_than",
|
|
37
|
-
context: {
|
|
38
|
-
maxLength: field?.maxLength
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
test: (value) => {
|
|
42
|
-
if (!value) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return validateOtp(value, maxLength);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
OTP_VALIDATOR,
|
|
52
|
-
validateOtp
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=otp.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/validators/utils/otp.ts"],
|
|
4
|
-
"sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nexport function validateOtp(value: string, maxLength: number): boolean {\n if (value.length === maxLength) {\n return true;\n } else {\n return false;\n }\n}\n\nexport const OTP_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const maxLength = field?.maxLength;\n return {\n name: 'otp-validator',\n message: {\n key: 'form.error.otp.less_than',\n context: {\n maxLength: field?.maxLength,\n },\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateOtp(value, maxLength as number);\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,YAAY,OAAe,WAA4B;AACrE,MAAI,MAAM,WAAW,WAAW;AAC9B,WAAO;AAAA,EACT,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAEO,MAAM,gBAAgB,CAAC,UAAsC;AAClE,QAAM,YAAY,OAAO;AACzB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,MACP,KAAK;AAAA,MACL,SAAS;AAAA,QACP,WAAW,OAAO;AAAA,MACpB;AAAA,IACF;AAAA,IACA,MAAM,CAAC,UAA2B;AAChC,UAAI,CAAC,OAAO;AACV,eAAO;AAAA,MACT;AACA,aAAO,YAAY,OAAO,SAAmB;AAAA,IAC/C;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|