@arquimedes.co/eureka-forms 2.0.99-test → 3.0.0-refactor
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/dist/App/App.js +21 -46
- package/dist/App/AppFunctions.js +177 -328
- package/dist/App/AppFunctions.test.js +638 -0
- package/dist/App/AppHooks.js +127 -223
- package/dist/App/AppHooks.test.js +154 -0
- package/dist/Contexts/CustomContext.js +1 -1
- package/dist/Contexts/FormContext.js +3 -2
- package/dist/Contexts/SectionContext.js +1 -1
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +43 -62
- package/dist/Form/Form.js +75 -160
- package/dist/Form/FormFunctions.js +64 -114
- package/dist/Form/FormFunctions.test.js +454 -0
- package/dist/Form/FormHooks.js +14 -21
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +34 -105
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +48 -110
- package/dist/Form/Section/MaterialSection/MaterialSection.js +10 -23
- package/dist/Form/Section/MaterialSection/MaterialSection.module.css +0 -2
- package/dist/Form/Section/Section.js +4 -15
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +30 -65
- package/dist/Form/Terms/Term/Term.js +2 -13
- package/dist/Form/Terms/Terms.js +11 -27
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +36 -106
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +12 -40
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +57 -77
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +46 -111
- package/dist/FormSteps/AYFStepMapper.js +63 -127
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.js +2 -13
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +63 -165
- package/dist/FormSteps/CBRStepMapper.js +61 -152
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.js +2 -13
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +19 -37
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.js +2 -13
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +47 -80
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.js +3 -26
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +33 -61
- package/dist/FormSteps/CustomStep.js +17 -31
- package/dist/FormSteps/DatePickerStep/DatePickerStep.js +2 -13
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +7 -20
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.js +2 -13
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.js +16 -32
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +94 -180
- package/dist/FormSteps/FileUploadStep/FileUploadStep.js +2 -13
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +33 -95
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileFunctions.js +3 -0
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +86 -180
- package/dist/FormSteps/MapperStep/MapperStep.js +2 -13
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +16 -38
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +21 -31
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.js +89 -175
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +20 -47
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +81 -117
- package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.js +15 -33
- package/dist/FormSteps/PhoneInputStep/PhoneInputStep.js +2 -13
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +17 -31
- package/dist/FormSteps/RatingStep/RatingStep.js +2 -13
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +35 -61
- package/dist/FormSteps/SelectorStep/SelectorStep.js +2 -13
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +2 -3
- package/dist/FormSteps/SeparatorStep/SeparatorStep.js +2 -13
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +77 -142
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.js +2 -13
- package/dist/FormSteps/Step.js +29 -58
- package/dist/FormSteps/StepFunctions.js +149 -204
- package/dist/FormSteps/StepFunctions.test.js +695 -0
- package/dist/FormSteps/StepHooks.js +94 -146
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +38 -74
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +12 -28
- package/dist/FormSteps/TextAreaStep/TextAreaStep.js +3 -14
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +12 -30
- package/dist/FormSteps/TextInputStep/TextInputStep.js +2 -13
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.js +9 -26
- package/dist/FormSteps/TimePickerStep/TimePickerStep.js +2 -13
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +13 -26
- package/dist/FormSteps/TitleStep/TitleStep.js +2 -13
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +14 -26
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +6 -18
- package/dist/Icons/ArrowLeftIcon.js +6 -0
- package/dist/Icons/ArrowRightIcon.js +6 -0
- package/dist/Icons/CalendarIcon.js +3 -14
- package/dist/Icons/CheckCircleIcon.js +6 -0
- package/dist/Icons/CheckboxCheckedIcon.js +6 -0
- package/dist/Icons/CheckboxUncheckedIcon.js +6 -0
- package/dist/Icons/ClockIcon.js +6 -0
- package/dist/Icons/CloseIcon.js +6 -0
- package/dist/Icons/Construction/LeakIcon.js +3 -14
- package/dist/Icons/Construction/ProjectIcon.js +3 -14
- package/dist/Icons/Construction/PropertyIcon.js +3 -14
- package/dist/Icons/Construction/SpaceIcon.js +3 -14
- package/dist/Icons/DeleteIcon.js +6 -0
- package/dist/Icons/DocumentIcon.js +3 -14
- package/dist/Icons/Entities/CheckListIcon.js +3 -14
- package/dist/Icons/Entities/GenericEntityIcon.js +4 -15
- package/dist/Icons/Entities/HandshakeIcon.js +4 -15
- package/dist/Icons/Entities/SupplierIcon.js +4 -15
- package/dist/Icons/ErkIcon.module.css +9 -0
- package/dist/Icons/ErrorIcon.js +6 -0
- package/dist/Icons/ExpandLessIcon.js +6 -0
- package/dist/Icons/ExpandMoreIcon.js +6 -0
- package/dist/Icons/FileIcon.js +6 -0
- package/dist/Icons/InfoIcon.js +6 -0
- package/dist/Icons/LocationIcon.js +3 -14
- package/dist/Icons/PersonIcon.js +4 -15
- package/dist/Icons/Ratings/DislikeIcon.js +6 -0
- package/dist/Icons/Ratings/DissatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/LikeIcon.js +6 -0
- package/dist/Icons/Ratings/SatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/StarIcon.js +6 -0
- package/dist/Icons/Ratings/VeryDissatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/VerySatisfiedIcon.js +6 -0
- package/dist/Icons/WarningIcon.js +6 -0
- package/dist/Init.js +2 -0
- package/dist/Services/FileService.js +29 -86
- package/dist/Services/FormService.js +11 -56
- package/dist/Services/OrganizationService.js +11 -62
- package/dist/Shared/CustomBtn/CustomBtn.js +25 -88
- package/dist/Shared/ErkButton/ErkButton.js +31 -0
- package/dist/Shared/{RoundedButton/RoundedButton.stories.js → ErkButton/ErkButton.stories.js} +6 -6
- package/dist/Shared/ErkCheckbox/ErkCheckBox.js +30 -0
- package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.js +37 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.js +210 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.js +103 -0
- package/dist/Shared/ErkPhoneInput/EkrPhoneInput.js +83 -0
- package/dist/Shared/ErkSelect/ErkSelect.js +90 -0
- package/dist/Shared/ErkSelect/ErkSelect.stories.js +64 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.js +56 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.js +167 -0
- package/dist/Shared/ErkTextField/ErkTextField.js +111 -0
- package/dist/Shared/ErkTextField/ErkTextField.stories.js +105 -0
- package/dist/Shared/ErkTimePicker/ErkTimePicker.js +131 -0
- package/dist/Shared/InputIcon/InputIcon.js +25 -48
- package/dist/Shared/Loader/Loader.js +6 -18
- package/dist/Shared/Navbar/Navbar.js +2 -14
- package/dist/Shared/Navbar/Navbar.stories.js +2 -2
- package/dist/Shared/Rating/Rating.js +4 -27
- package/dist/Shared/Rating/Rating.stories.js +13 -19
- package/dist/Shared/Rating/Ratings/LikeRating.js +19 -33
- package/dist/Shared/Rating/Ratings/SatisfactionRating.js +27 -47
- package/dist/Shared/Rating/Ratings/ScaleRating.js +23 -54
- package/dist/Shared/Toggle/Toggle.js +11 -34
- package/dist/States/GlobalSlice.js +6 -17
- package/dist/States/SiteSlice.js +58 -76
- package/dist/States/WidthStatsSlice.js +8 -9
- package/dist/Utils/AxiosAPI.js +3 -3
- package/dist/Utils/AxiosWidget.js +4 -4
- package/dist/Utils/CBRFunctions.js +29 -30
- package/dist/Utils/DraftFunctions.js +102 -143
- package/dist/Utils/FormStepFunctions.js +27 -45
- package/dist/Utils/LocaleUtils.js +12 -0
- package/dist/Utils/MaterialProviders.js +43 -28
- package/dist/Utils/MuiClassnameSetup.js +3 -0
- package/dist/Utils/PhoneFunctions.js +5 -5
- package/dist/Utils/TestUtils.js +22 -51
- package/dist/Utils/store.js +10 -65
- package/dist/Widget.js +15 -26
- package/dist/constants/Files/FileExtensions.js +3 -3
- package/dist/constants/Files/FileMaxSize.js +1 -1
- package/dist/constants/InternalFormStyle.js +1 -1
- package/dist/hooks.js +14 -16
- package/dist/index.css +4 -0
- package/dist/main.js +22 -0
- package/package.json +108 -124
- package/dist/@Types/@Types.d.ts +0 -2
- package/dist/@Types/AYFFormStep.d.ts +0 -19
- package/dist/@Types/Branding.d.ts +0 -13
- package/dist/@Types/CBRFormStep.d.ts +0 -74
- package/dist/@Types/Condition.d.ts +0 -143
- package/dist/@Types/Draft/Draft.d.ts +0 -12
- package/dist/@Types/Draft/DraftEntityData.d.ts +0 -54
- package/dist/@Types/Entity.d.ts +0 -36
- package/dist/@Types/Form.d.ts +0 -75
- package/dist/@Types/FormStep.d.ts +0 -219
- package/dist/@Types/GenericFormSteps.d.ts +0 -84
- package/dist/@Types/MapperElement.d.ts +0 -8
- package/dist/@Types/Organization.d.ts +0 -11
- package/dist/@Types/Time.d.ts +0 -6
- package/dist/@Types/index.d.ts +0 -1
- package/dist/App/App.d.ts +0 -59
- package/dist/App/AppFunctions.d.ts +0 -23
- package/dist/App/AppHooks.d.ts +0 -10
- package/dist/Contexts/CustomContext.d.ts +0 -12
- package/dist/Contexts/FormContext.d.ts +0 -6
- package/dist/Contexts/SectionContext.d.ts +0 -3
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +0 -12
- package/dist/Form/Form.d.ts +0 -40
- package/dist/Form/FormFunctions.d.ts +0 -12
- package/dist/Form/FormHooks.d.ts +0 -3
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +0 -4
- package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +0 -4
- package/dist/Form/Section/MaterialSection/MaterialSection.d.ts +0 -4
- package/dist/Form/Section/Section.d.ts +0 -6
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.d.ts +0 -4
- package/dist/Form/Terms/Term/Term.d.ts +0 -8
- package/dist/Form/Terms/Terms.d.ts +0 -3
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.d.ts +0 -8
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +0 -9
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +0 -8
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +0 -11
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +0 -8
- package/dist/FormSteps/AYFStepMapper.d.ts +0 -12
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.d.ts +0 -15
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +0 -4
- package/dist/FormSteps/CBRStepMapper.d.ts +0 -13
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.d.ts +0 -9
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +0 -4
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +0 -9
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +0 -4
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.d.ts +0 -9
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.d.ts +0 -4
- package/dist/FormSteps/CustomStep.d.ts +0 -27
- package/dist/FormSteps/DatePickerStep/DatePickerStep.d.ts +0 -11
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +0 -4
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.d.ts +0 -15
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.d.ts +0 -12
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +0 -4
- package/dist/FormSteps/FileUploadStep/FileUploadStep.d.ts +0 -9
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +0 -14
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +0 -18
- package/dist/FormSteps/MapperStep/MapperStep.d.ts +0 -18
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +0 -5
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.d.ts +0 -15
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.d.ts +0 -5
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +0 -5
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +0 -21
- package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.d.ts +0 -4
- package/dist/FormSteps/PhoneInputStep/PhoneInputStep.d.ts +0 -11
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +0 -4
- package/dist/FormSteps/RatingStep/RatingStep.d.ts +0 -9
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +0 -4
- package/dist/FormSteps/SelectorStep/SelectorStep.d.ts +0 -9
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +0 -4
- package/dist/FormSteps/SeparatorStep/SeparatorStep.d.ts +0 -9
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +0 -5
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +0 -35
- package/dist/FormSteps/Step.d.ts +0 -8
- package/dist/FormSteps/StepFunctions.d.ts +0 -29
- package/dist/FormSteps/StepHooks.d.ts +0 -55
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.d.ts +0 -10
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +0 -8
- package/dist/FormSteps/TextAreaStep/TextAreaStep.d.ts +0 -10
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +0 -4
- package/dist/FormSteps/TextInputStep/TextInputStep.d.ts +0 -17
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.d.ts +0 -4
- package/dist/FormSteps/TimePickerStep/TimePickerStep.d.ts +0 -12
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +0 -4
- package/dist/FormSteps/TitleStep/TitleStep.d.ts +0 -9
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.d.ts +0 -9
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +0 -12
- package/dist/Icons/@IconTypes.d.ts +0 -7
- package/dist/Icons/CalendarIcon.d.ts +0 -4
- package/dist/Icons/Construction/LeakIcon.d.ts +0 -3
- package/dist/Icons/Construction/ProjectIcon.d.ts +0 -3
- package/dist/Icons/Construction/PropertyIcon.d.ts +0 -3
- package/dist/Icons/Construction/SpaceIcon.d.ts +0 -3
- package/dist/Icons/DocumentIcon.d.ts +0 -3
- package/dist/Icons/Entities/CheckListIcon.d.ts +0 -3
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +0 -3
- package/dist/Icons/Entities/HandshakeIcon.d.ts +0 -3
- package/dist/Icons/Entities/SupplierIcon.d.ts +0 -3
- package/dist/Icons/LocationIcon.d.ts +0 -4
- package/dist/Icons/PersonIcon.d.ts +0 -4
- package/dist/Services/FileService.d.ts +0 -5
- package/dist/Services/FormService.d.ts +0 -5
- package/dist/Services/OrganizationService.d.ts +0 -2
- package/dist/Shared/CustomBtn/CustomBtn.d.ts +0 -18
- package/dist/Shared/InputIcon/InputIcon.d.ts +0 -7
- package/dist/Shared/Loader/Loader.d.ts +0 -18
- package/dist/Shared/Navbar/Navbar.d.ts +0 -9
- package/dist/Shared/Navbar/Navbar.stories.d.ts +0 -13
- package/dist/Shared/Rating/Rating.d.ts +0 -15
- package/dist/Shared/Rating/Rating.stories.d.ts +0 -15
- package/dist/Shared/Rating/Ratings/LikeRating.d.ts +0 -4
- package/dist/Shared/Rating/Ratings/SatisfactionRating.d.ts +0 -4
- package/dist/Shared/Rating/Ratings/ScaleRating.d.ts +0 -4
- package/dist/Shared/RoundedButton/RoundedButton.d.ts +0 -30
- package/dist/Shared/RoundedButton/RoundedButton.js +0 -45
- package/dist/Shared/RoundedButton/RoundedButton.stories.d.ts +0 -23
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.d.ts +0 -24
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.js +0 -101
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.d.ts +0 -21
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.js +0 -50
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.d.ts +0 -49
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.js +0 -351
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.d.ts +0 -36
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.js +0 -223
- package/dist/Shared/RoundedPhoneInput/RoundedPhoneInput.d.ts +0 -43
- package/dist/Shared/RoundedPhoneInput/RoundedPhoneInput.js +0 -226
- package/dist/Shared/RoundedSelect/RoundedSelect.d.ts +0 -68
- package/dist/Shared/RoundedSelect/RoundedSelect.js +0 -214
- package/dist/Shared/RoundedSelect/RoundedSelect.stories.d.ts +0 -28
- package/dist/Shared/RoundedSelect/RoundedSelect.stories.js +0 -91
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -63
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.js +0 -236
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.d.ts +0 -36
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.js +0 -318
- package/dist/Shared/RoundedTextField/RoundedTextField.d.ts +0 -45
- package/dist/Shared/RoundedTextField/RoundedTextField.js +0 -175
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.d.ts +0 -37
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +0 -224
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.d.ts +0 -41
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.js +0 -314
- package/dist/Shared/Toggle/Toggle.d.ts +0 -18
- package/dist/States/GlobalSlice.d.ts +0 -46
- package/dist/States/SiteSlice.d.ts +0 -95
- package/dist/States/WidthStatsSlice.d.ts +0 -7
- package/dist/Utils/AxiosAPI.d.ts +0 -2
- package/dist/Utils/AxiosWidget.d.ts +0 -2
- package/dist/Utils/CBRFunctions.d.ts +0 -8
- package/dist/Utils/DraftFunctions.d.ts +0 -56
- package/dist/Utils/FormStepFunctions.d.ts +0 -15
- package/dist/Utils/MaterialProviders.d.ts +0 -6
- package/dist/Utils/PhoneFunctions.d.ts +0 -2
- package/dist/Utils/TestUtils.d.ts +0 -77
- package/dist/Utils/store.d.ts +0 -27
- package/dist/Widget.d.ts +0 -1
- package/dist/__mocks__/axios.d.ts +0 -2
- package/dist/__mocks__/axios.js +0 -2
- package/dist/constants/AYFFormStepTypes.d.ts +0 -9
- package/dist/constants/CBRFormStepTypes.d.ts +0 -21
- package/dist/constants/ConditionTypes.d.ts +0 -27
- package/dist/constants/Draft/DraftEntityDataTypes.d.ts +0 -11
- package/dist/constants/Draft/DraftEntityTypes.d.ts +0 -3
- package/dist/constants/Draft/DraftStyleTypes.d.ts +0 -7
- package/dist/constants/EntityPropertyTypes.d.ts +0 -10
- package/dist/constants/Files/FileExtensions.d.ts +0 -3
- package/dist/constants/Files/FileMaxSize.d.ts +0 -2
- package/dist/constants/FormStepTypes.d.ts +0 -64
- package/dist/constants/IconTypes.d.ts +0 -15
- package/dist/constants/InternalFormStyle.d.ts +0 -3
- package/dist/constants/MaterialClassNameSeed.d.ts +0 -1
- package/dist/constants/MaterialClassNameSeed.js +0 -1
- package/dist/constants/TicketPropertyTypes.d.ts +0 -3
- package/dist/hooks.d.ts +0 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -31
- package/dist/index.lib.d.ts +0 -7
- package/dist/setupTests.d.ts +0 -1
- /package/dist/Shared/{RoundedTimePicker/RoundedTimePicker.module.css → ErkTimePicker/ErkTimePicker.module.css} +0 -0
- /package/dist/{setupTests.js → __tests__/setup.js} +0 -0
|
@@ -1,139 +1,99 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
-
if (ar || !(i in from)) {
|
|
26
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
-
ar[i] = from[i];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
-
};
|
|
32
1
|
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
33
2
|
import { useAppSelector, useAppDispatch } from '../hooks';
|
|
34
|
-
import { clearDependency, setStepDependency
|
|
3
|
+
import { clearDependency, setStepDependency } from '../States/SiteSlice';
|
|
35
4
|
import { createSelector } from '@reduxjs/toolkit';
|
|
36
5
|
import { calcDefaultValue, evaluateCondition } from './StepFunctions';
|
|
37
|
-
import { useController
|
|
6
|
+
import { useController } from 'react-hook-form';
|
|
38
7
|
import { SizeChangeContext } from './Utils/@StepFiller/StepFiller';
|
|
39
8
|
import ConditionTypes from '../constants/ConditionTypes';
|
|
40
9
|
import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, } from '../constants/FormStepTypes';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
],
|
|
10
|
+
const selectIsDependency = createSelector([
|
|
11
|
+
(state) => state.site.dependencies,
|
|
12
|
+
(_state, step) => step,
|
|
13
|
+
], (dependencies, step) => {
|
|
45
14
|
return dependencies[step.id] !== undefined;
|
|
46
15
|
});
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var isDependency = useAppSelector(function (state) {
|
|
54
|
-
return selectIsDependency(state, step);
|
|
55
|
-
});
|
|
56
|
-
var originalValue = useAppSelector(function (state) {
|
|
57
|
-
return selectOriginalValue(state, step);
|
|
58
|
-
});
|
|
59
|
-
var dispatch = useAppDispatch();
|
|
60
|
-
useEffect(function () {
|
|
16
|
+
export const selectOriginalValue = createSelector([(state) => state.site.values, (_state, step) => step], (values, step) => values.sections[step?.idSection]?.[step?.id]);
|
|
17
|
+
export const useStepDependency = (step, defaultValue) => {
|
|
18
|
+
const isDependency = useAppSelector((state) => selectIsDependency(state, step));
|
|
19
|
+
const originalValue = useAppSelector((state) => selectOriginalValue(state, step));
|
|
20
|
+
const dispatch = useAppDispatch();
|
|
21
|
+
useEffect(() => {
|
|
61
22
|
if (isDependency && !originalValue && defaultValue) {
|
|
62
23
|
dispatch(setStepDependency({
|
|
63
|
-
step
|
|
24
|
+
step,
|
|
64
25
|
value: defaultValue,
|
|
65
26
|
}));
|
|
66
27
|
}
|
|
67
|
-
return
|
|
28
|
+
return () => {
|
|
68
29
|
dispatch(clearDependency(step));
|
|
69
30
|
};
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
32
|
}, [isDependency]);
|
|
71
|
-
|
|
33
|
+
const handleStepDep = useCallback((value) => {
|
|
72
34
|
if (!isDependency)
|
|
73
35
|
return;
|
|
74
36
|
dispatch(setStepDependency({
|
|
75
|
-
step
|
|
76
|
-
value: value
|
|
37
|
+
step,
|
|
38
|
+
value: value ?? null,
|
|
77
39
|
}));
|
|
78
|
-
},
|
|
40
|
+
},
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
[step.id, step.type, isDependency]);
|
|
79
43
|
return {
|
|
80
|
-
handleStepDep
|
|
81
|
-
isDependency
|
|
82
|
-
originalValue:
|
|
44
|
+
handleStepDep,
|
|
45
|
+
isDependency,
|
|
46
|
+
originalValue: originalValue ?? defaultValue ?? calcDefaultValue(step),
|
|
83
47
|
};
|
|
84
48
|
};
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
],
|
|
90
|
-
|
|
91
|
-
|
|
49
|
+
export const selectStepDependencies = createSelector([
|
|
50
|
+
(state) => state.site.dependencies,
|
|
51
|
+
(_state, step) => step,
|
|
52
|
+
(_state, _step, form) => form,
|
|
53
|
+
], (dependencies, step, form) => {
|
|
54
|
+
const invalids = [];
|
|
55
|
+
let emptyDep = false;
|
|
92
56
|
/** Show deep error changes even if not in dependencies */
|
|
93
|
-
for (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if ((dependency === null || dependency === void 0 ? void 0 : dependency.value) === null && form.steps[idDep]) {
|
|
57
|
+
for (const idDep of calcDeepDependencies(step.id, form)) {
|
|
58
|
+
const dependency = dependencies[idDep];
|
|
59
|
+
if (dependency?.value === null && form.steps[idDep]) {
|
|
97
60
|
invalids.push(idDep);
|
|
98
61
|
}
|
|
99
|
-
if (dependency
|
|
62
|
+
if (dependency?.empty)
|
|
100
63
|
emptyDep = true;
|
|
101
64
|
}
|
|
102
|
-
return { invalids
|
|
65
|
+
return { invalids, emptyDep };
|
|
103
66
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
for (var _i = 0, _a = step.dependencies; _i < _a.length; _i++) {
|
|
109
|
-
var dep = _a[_i];
|
|
67
|
+
const calcDeepDependencies = (idStep, form, deps = []) => {
|
|
68
|
+
const step = form.steps[idStep];
|
|
69
|
+
if (step?.dependencies) {
|
|
70
|
+
for (const dep of step.dependencies) {
|
|
110
71
|
if (!deps.includes(dep)) {
|
|
111
|
-
deps.push
|
|
72
|
+
deps.push(...calcDeepDependencies(dep, form, deps), dep);
|
|
112
73
|
}
|
|
113
74
|
}
|
|
114
75
|
}
|
|
115
76
|
return deps;
|
|
116
77
|
};
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var _d = useController({
|
|
78
|
+
export const useFormStep = (step, { rules, debounce, sizeChange, defaultValue }) => {
|
|
79
|
+
const [timer, setTimer] = useState();
|
|
80
|
+
const { isDependency, handleStepDep, originalValue } = useStepDependency(step, defaultValue);
|
|
81
|
+
const { field: { ref, value, onChange: fieldOnChange, ...field }, fieldState: { error }, } = useController({
|
|
122
82
|
name: step.id,
|
|
123
|
-
rules
|
|
83
|
+
rules,
|
|
124
84
|
shouldUnregister: true,
|
|
125
85
|
defaultValue: originalValue,
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
|
|
86
|
+
});
|
|
87
|
+
const handleSizeChange = useContext(SizeChangeContext);
|
|
88
|
+
const onChange = useCallback((value) => {
|
|
129
89
|
if (isDependency) {
|
|
130
90
|
if (debounce) {
|
|
131
91
|
try {
|
|
132
92
|
clearTimeout(timer);
|
|
133
|
-
// eslint-disable-next-line no-empty
|
|
93
|
+
// eslint-disable-next-line no-empty, @typescript-eslint/no-unused-vars
|
|
134
94
|
}
|
|
135
95
|
catch (e) { }
|
|
136
|
-
setTimer(setTimeout(
|
|
96
|
+
setTimer(setTimeout(() => {
|
|
137
97
|
handleStepDep(value);
|
|
138
98
|
setTimer(undefined);
|
|
139
99
|
}, 1000));
|
|
@@ -144,88 +104,78 @@ export var useFormStep = function (step, _a) {
|
|
|
144
104
|
}
|
|
145
105
|
fieldOnChange(value);
|
|
146
106
|
if (sizeChange)
|
|
147
|
-
handleSizeChange
|
|
148
|
-
},
|
|
107
|
+
handleSizeChange?.();
|
|
108
|
+
},
|
|
109
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
|
+
[handleStepDep, isDependency, fieldOnChange]);
|
|
149
111
|
return {
|
|
150
|
-
ref
|
|
151
|
-
value
|
|
152
|
-
onChange
|
|
153
|
-
error
|
|
154
|
-
field
|
|
112
|
+
ref,
|
|
113
|
+
value,
|
|
114
|
+
onChange,
|
|
115
|
+
error,
|
|
116
|
+
field,
|
|
155
117
|
};
|
|
156
118
|
};
|
|
157
|
-
|
|
158
|
-
export
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
]
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
var ids = useMemo(function () { return recursivelyCalcConditionSteps(condition); }, []);
|
|
171
|
-
var dependencies = useAppSelector(function (state) {
|
|
172
|
-
return selectDependencies(state, ids);
|
|
173
|
-
});
|
|
174
|
-
return useMemo(function () {
|
|
119
|
+
const EMPTY_ARRAY = [];
|
|
120
|
+
export const selectDependencies = createSelector([
|
|
121
|
+
(state) => state.site.dependencies,
|
|
122
|
+
(_state, idDeps) => idDeps ?? EMPTY_ARRAY,
|
|
123
|
+
], (dependencies, idDeps) => idDeps.reduce((acc, idDep) => ({
|
|
124
|
+
...acc,
|
|
125
|
+
[idDep]: dependencies[idDep],
|
|
126
|
+
}), {}));
|
|
127
|
+
export const useCondition = (condition) => {
|
|
128
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
129
|
+
const ids = useMemo(() => recursivelyCalcConditionSteps(condition), []);
|
|
130
|
+
const dependencies = useAppSelector((state) => selectDependencies(state, ids));
|
|
131
|
+
return useMemo(() => {
|
|
175
132
|
return !condition || evaluateCondition(condition, dependencies);
|
|
176
|
-
},
|
|
133
|
+
},
|
|
134
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
|
+
ids.map((id) => dependencies[id].value));
|
|
177
136
|
};
|
|
178
|
-
export
|
|
179
|
-
|
|
180
|
-
var dependencies = __spreadArray([], ((_a = step.dependencies) !== null && _a !== void 0 ? _a : []), true);
|
|
137
|
+
export const calcStepDeps = (step) => {
|
|
138
|
+
const dependencies = [...(step.dependencies ?? [])];
|
|
181
139
|
if (step.condition) {
|
|
182
|
-
dependencies.push
|
|
140
|
+
dependencies.push(...recursivelyCalcConditionSteps(step.condition));
|
|
183
141
|
}
|
|
184
142
|
switch (step.type) {
|
|
185
143
|
case FormStepTypes.CLASSIFIER_SELECTOR:
|
|
186
144
|
{
|
|
187
|
-
for (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
option.condition) {
|
|
191
|
-
dependencies.push.apply(dependencies, recursivelyCalcConditionSteps(option.condition));
|
|
145
|
+
for (const option of Object.values(step.options)) {
|
|
146
|
+
if (option.type !== ClassifierOptionTypes.HIDE && option.condition) {
|
|
147
|
+
dependencies.push(...recursivelyCalcConditionSteps(option.condition));
|
|
192
148
|
}
|
|
193
149
|
}
|
|
194
150
|
}
|
|
195
151
|
break;
|
|
196
152
|
case FormStepTypes.ENTITYVALUEPICKER:
|
|
197
153
|
{
|
|
198
|
-
for (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
option.condition) {
|
|
202
|
-
dependencies.push.apply(dependencies, recursivelyCalcConditionSteps(option.condition));
|
|
154
|
+
for (const option of Object.values(step.options)) {
|
|
155
|
+
if (option.type !== EntityValueOptionTypes.HIDE && option.condition) {
|
|
156
|
+
dependencies.push(...recursivelyCalcConditionSteps(option.condition));
|
|
203
157
|
}
|
|
204
158
|
}
|
|
205
159
|
if (step.dialogs)
|
|
206
|
-
for (
|
|
207
|
-
|
|
208
|
-
dependencies.push.apply(dependencies, recursivelyCalcConditionSteps(dialog.condition));
|
|
160
|
+
for (const dialog of Object.values(step.dialogs)) {
|
|
161
|
+
dependencies.push(...recursivelyCalcConditionSteps(dialog.condition));
|
|
209
162
|
}
|
|
210
163
|
}
|
|
211
164
|
break;
|
|
212
165
|
case FormStepTypes.API_SELECTOR:
|
|
213
166
|
{
|
|
214
|
-
for (
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
option.condition) {
|
|
218
|
-
dependencies.push.apply(dependencies, recursivelyCalcConditionSteps(option.condition));
|
|
167
|
+
for (const option of Object.values(step.options)) {
|
|
168
|
+
if (option.type !== ApiSelectorOptionTypes.HIDE && option.condition) {
|
|
169
|
+
dependencies.push(...recursivelyCalcConditionSteps(option.condition));
|
|
219
170
|
}
|
|
220
171
|
}
|
|
221
172
|
}
|
|
222
173
|
break;
|
|
223
174
|
case FormStepTypes.SELECTOR:
|
|
224
175
|
{
|
|
225
|
-
for (
|
|
226
|
-
var option = _k[_j];
|
|
176
|
+
for (const option of Object.values(step.options)) {
|
|
227
177
|
if (option.condition) {
|
|
228
|
-
dependencies.push
|
|
178
|
+
dependencies.push(...recursivelyCalcConditionSteps(option.condition));
|
|
229
179
|
}
|
|
230
180
|
}
|
|
231
181
|
}
|
|
@@ -235,14 +185,12 @@ export var calcStepDeps = function (step) {
|
|
|
235
185
|
}
|
|
236
186
|
return dependencies;
|
|
237
187
|
};
|
|
238
|
-
export
|
|
188
|
+
export const recursivelyCalcConditionSteps = (condition) => {
|
|
239
189
|
if (!condition)
|
|
240
190
|
return [];
|
|
241
191
|
switch (condition.type) {
|
|
242
192
|
case ConditionTypes.EXPRESSION: {
|
|
243
|
-
return condition.conditions
|
|
244
|
-
.map(function (condition) { return recursivelyCalcConditionSteps(condition); })
|
|
245
|
-
.flat();
|
|
193
|
+
return condition.conditions.map((condition) => recursivelyCalcConditionSteps(condition)).flat();
|
|
246
194
|
}
|
|
247
195
|
case ConditionTypes.FORM_STEP: {
|
|
248
196
|
return [condition.idStep];
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import styles from './MaterialTextAreaStep.module.css';
|
|
25
3
|
import { useController } from 'react-hook-form';
|
|
@@ -27,124 +5,110 @@ import { Editor } from 'react-draft-wysiwyg'; //Load programatically only if ste
|
|
|
27
5
|
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
|
28
6
|
import './DraftEditor.css';
|
|
29
7
|
import { useCallback, useState } from 'react';
|
|
30
|
-
import { ClickAwayListener } from '@material-ui/core';
|
|
31
8
|
import { useAppSelector } from '../../../hooks';
|
|
32
9
|
import { useStepDependency } from '../../StepHooks';
|
|
33
10
|
import { EditorState, convertFromRaw } from 'draft-js';
|
|
34
11
|
import { getRawText } from '../../../Utils/DraftFunctions';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var _h = useController({
|
|
12
|
+
import { ClickAwayListener } from '@mui/material';
|
|
13
|
+
function TextAreaStep({ step, editable }) {
|
|
14
|
+
const { formStyle, postview } = useAppSelector((state) => state.global);
|
|
15
|
+
const [hovering, setHovering] = useState(false);
|
|
16
|
+
const [focus, setFocus] = useState(false);
|
|
17
|
+
const [timer, setTimer] = useState();
|
|
18
|
+
const { handleStepDep, originalValue, isDependency } = useStepDependency(step, getRawText());
|
|
19
|
+
const { field: { ref, onChange, ...field }, fieldState: { error }, } = useController({
|
|
44
20
|
name: step.id,
|
|
45
21
|
shouldUnregister: true,
|
|
46
22
|
rules: step.required
|
|
47
23
|
? {
|
|
48
|
-
validate:
|
|
49
|
-
return editorState.getCurrentContent().hasText();
|
|
50
|
-
},
|
|
24
|
+
validate: (editorState) => editorState.getCurrentContent().hasText(),
|
|
51
25
|
}
|
|
52
26
|
: {},
|
|
53
27
|
defaultValue: EditorState.createWithContent(convertFromRaw(originalValue)),
|
|
54
|
-
})
|
|
55
|
-
|
|
28
|
+
});
|
|
29
|
+
const handleChange = useCallback((value) => {
|
|
56
30
|
if (isDependency) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// eslint-disable-next-line no-empty
|
|
60
|
-
}
|
|
61
|
-
catch (e) { }
|
|
62
|
-
setTimer(setTimeout(function () {
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
setTimer(setTimeout(() => {
|
|
63
33
|
handleStepDep(value.getCurrentContent().getPlainText());
|
|
64
34
|
setTimer(undefined);
|
|
65
35
|
}, 1000));
|
|
66
36
|
}
|
|
67
37
|
onChange(value);
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
|
|
38
|
+
},
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
[handleStepDep, isDependency, onChange]);
|
|
41
|
+
const calcStyle = () => {
|
|
42
|
+
const backgroundColor = formStyle.stepBackgroundColor;
|
|
71
43
|
if (focus) {
|
|
72
44
|
return {
|
|
73
45
|
border: '2px solid ' + formStyle.primaryColor,
|
|
74
46
|
marginTop: -1,
|
|
75
47
|
marginLeft: -1,
|
|
76
48
|
marginBottom: 0,
|
|
77
|
-
backgroundColor
|
|
49
|
+
backgroundColor,
|
|
78
50
|
};
|
|
79
51
|
}
|
|
80
52
|
else if (hovering) {
|
|
81
53
|
return {
|
|
82
54
|
border: '1px solid ' + formStyle.primaryColor,
|
|
83
|
-
backgroundColor
|
|
55
|
+
backgroundColor,
|
|
84
56
|
};
|
|
85
57
|
}
|
|
86
58
|
else {
|
|
87
59
|
return {
|
|
88
60
|
border: '1px solid ' + formStyle.outlineColor,
|
|
89
|
-
backgroundColor
|
|
61
|
+
backgroundColor,
|
|
90
62
|
};
|
|
91
63
|
}
|
|
92
64
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
65
|
+
const canEdit = editable && !postview;
|
|
66
|
+
const value = field.value;
|
|
67
|
+
let editorClassName = styles.editor;
|
|
96
68
|
if (!value.getCurrentContent().hasText()) {
|
|
97
|
-
if (value.getCurrentContent().getBlockMap().first().getType() !==
|
|
98
|
-
'unstyled') {
|
|
69
|
+
if (value.getCurrentContent().getBlockMap().first().getType() !== 'unstyled') {
|
|
99
70
|
editorClassName += ' RichEditor-hidePlaceholder';
|
|
100
71
|
}
|
|
101
72
|
}
|
|
102
73
|
if (!canEdit) {
|
|
103
74
|
editorClassName += ' postview-editor';
|
|
104
75
|
}
|
|
105
|
-
return (_jsxs("div",
|
|
76
|
+
return (_jsxs("div", { className: styles.textEditorContainer, style: {
|
|
106
77
|
'--eureka-outline': formStyle.outlineColor,
|
|
107
78
|
'--eureka-primary': formStyle.primaryColor,
|
|
108
|
-
}
|
|
109
|
-
color: error
|
|
110
|
-
|
|
111
|
-
: formStyle.textColor,
|
|
112
|
-
} }, { children: [step.label, " ", step.required ? ' *' : ''] }))), _jsx(ClickAwayListener, __assign({ mouseEvent: "onMouseDown", onClickAway: function () {
|
|
79
|
+
}, children: [step.label && (_jsxs("div", { className: styles.textEditorLabel, style: {
|
|
80
|
+
color: error ? formStyle.errorColor : formStyle.textColor,
|
|
81
|
+
}, children: [step.label, " ", step.required ? ' *' : ''] })), _jsx(ClickAwayListener, { mouseEvent: "onMouseDown", onClickAway: () => {
|
|
113
82
|
if (canEdit) {
|
|
114
83
|
setFocus(false);
|
|
115
84
|
}
|
|
116
|
-
}
|
|
85
|
+
}, children: _jsx("div", { className: postview
|
|
117
86
|
? styles.postViewContainer + ' EF-DraftContainer'
|
|
118
|
-
: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter:
|
|
87
|
+
: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: () => {
|
|
119
88
|
if (canEdit) {
|
|
120
89
|
setHovering(true);
|
|
121
90
|
}
|
|
122
|
-
}, onMouseLeave:
|
|
91
|
+
}, onMouseLeave: () => {
|
|
123
92
|
if (canEdit) {
|
|
124
93
|
setHovering(false);
|
|
125
94
|
}
|
|
126
|
-
}, onClick:
|
|
95
|
+
}, onClick: () => {
|
|
127
96
|
if (canEdit) {
|
|
128
97
|
setFocus(true);
|
|
129
98
|
}
|
|
130
|
-
}, "data-testid": step.id
|
|
99
|
+
}, "data-testid": step.id, children: _jsx(Editor, { ...field, editorRef: ref, onFocus: () => {
|
|
131
100
|
setFocus(true);
|
|
132
|
-
}, readOnly: !canEdit, stripPastedStyles: true, onEditorStateChange: handleChange, toolbarClassName: !canEdit ? ' postview-editor-toolbar' : '', editorState: value, editorClassName: editorClassName, wrapperClassName: styles.wrapper, placeholder:
|
|
101
|
+
}, readOnly: !canEdit, stripPastedStyles: true, onEditorStateChange: handleChange, toolbarClassName: !canEdit ? ' postview-editor-toolbar' : '', editorState: value, editorClassName: editorClassName, wrapperClassName: styles.wrapper, placeholder: step.description ?? '', toolbar: {
|
|
133
102
|
options: ['inline', 'list', 'history'],
|
|
134
103
|
inline: {
|
|
135
|
-
options: [
|
|
136
|
-
'bold',
|
|
137
|
-
'italic',
|
|
138
|
-
'underline',
|
|
139
|
-
'strikethrough',
|
|
140
|
-
],
|
|
104
|
+
options: ['bold', 'italic', 'underline', 'strikethrough'],
|
|
141
105
|
},
|
|
142
106
|
list: {
|
|
143
107
|
options: ['unordered'],
|
|
144
108
|
},
|
|
145
|
-
} })
|
|
109
|
+
} }) }) }), _jsx("div", { className: styles.errorMsg, style: {
|
|
146
110
|
color: formStyle.errorColor,
|
|
147
111
|
height: !postview && editable ? '0.75rem' : 0,
|
|
148
|
-
}
|
|
112
|
+
}, children: !!error && 'Este campo es obligatorio' })] }));
|
|
149
113
|
}
|
|
150
114
|
export default TextAreaStep;
|
|
@@ -1,47 +1,31 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
2
|
+
import ErkTextField from '../../../Shared/ErkTextField/ErkTextField';
|
|
14
3
|
import styles from './MaterialTextAreaStep.module.css';
|
|
15
4
|
import React from 'react';
|
|
16
5
|
import { useAppSelector } from '../../../hooks';
|
|
17
6
|
import { useFormStep } from '../../StepHooks';
|
|
18
|
-
function TextAreaStep(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _d = useAppSelector(function (state) { return state.global; }), formStyle = _d.formStyle, postview = _d.postview, partial = _d.partial;
|
|
22
|
-
var _e = useFormStep(step, {
|
|
7
|
+
function TextAreaStep({ step, editable, maxLength }) {
|
|
8
|
+
const { formStyle, postview, partial } = useAppSelector((state) => state.global);
|
|
9
|
+
const { ref, value, onChange, error, field } = useFormStep(step, {
|
|
23
10
|
debounce: true,
|
|
24
11
|
defaultValue: '',
|
|
25
12
|
rules: {
|
|
26
13
|
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
27
14
|
},
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
? '0px'
|
|
33
|
-
: '5px',
|
|
34
|
-
} }, { children: [_jsx("div", __assign({ className: styles.erkTextArea }, { children: _jsx(RoundedTextField, __assign({}, field, { inputRef: ref, value: value, onChange: function (e) { return onChange(e.target.value); }, "data-testid": step.id, maxLength: maxLength, label: step.label, required: step.required, cantEdit: !canEdit, fontWeight: 400, multiline: true, minRows: postview && partial ? undefined : 4, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.stepBackgroundColor, helperTextColor: formStyle.descriptionTextColor, helperText: (_c = (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : step.description) !== null && _c !== void 0 ? _c : (step.required ? ' ' : null), error: !!error })) })), _jsxs("div", __assign({ className: styles.print }, { children: [value && (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.printLbl, style: {
|
|
15
|
+
});
|
|
16
|
+
return (_jsxs("div", { className: styles.container, style: {
|
|
17
|
+
paddingBottom: step.required || step.description || !!error ? '0px' : '5px',
|
|
18
|
+
}, children: [_jsx("div", { className: styles.erkTextArea, children: _jsx(ErkTextField, { ...field, multiline: true, value: value, inputRef: ref, error: !!error, label: step.label, onChange: onChange, "data-testid": step.id, maxLength: maxLength, required: step.required, disabled: !editable || postview, minRows: postview && partial ? undefined : 4, helperText: error?.message ?? step.description ?? (step.required ? ' ' : null) }) }), _jsxs("div", { className: styles.print, children: [value && (_jsxs(React.Fragment, { children: [_jsx("div", { className: styles.printLbl, style: {
|
|
35
19
|
color: formStyle.descriptionTextColor,
|
|
36
|
-
}
|
|
20
|
+
}, children: step.label }), _jsx("div", { className: styles.printLine, style: {
|
|
37
21
|
color: formStyle.stepBackgroundColor,
|
|
38
22
|
backgroundColor: formStyle.stepBackgroundColor,
|
|
39
|
-
}
|
|
23
|
+
}, children: step.label })] })), !value && (_jsx("div", { className: styles.emptyPrintLbl, style: {
|
|
40
24
|
color: formStyle.textColor + '8a',
|
|
41
|
-
}
|
|
25
|
+
}, children: step.label })), _jsx("p", { className: styles.printContainer, style: {
|
|
42
26
|
backgroundColor: formStyle.stepBackgroundColor,
|
|
43
27
|
borderColor: formStyle.outlineColor,
|
|
44
28
|
whiteSpace: 'pre-wrap',
|
|
45
|
-
}
|
|
29
|
+
}, children: value })] })] }));
|
|
46
30
|
}
|
|
47
31
|
export default TextAreaStep;
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import { useAppSelector } from '../../hooks';
|
|
14
3
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
15
4
|
import MaterialTextAreaStep from './MaterialTextAreaStep/MaterialTextAreaStep';
|
|
16
5
|
import MaterialTextAreaEditorStep from './MaterialTextAreaStep/MaterialTextAreaEditorStep';
|
|
17
6
|
function TextAreaStep(props) {
|
|
18
|
-
|
|
7
|
+
const { formStyle } = useAppSelector((state) => state.global);
|
|
19
8
|
switch (formStyle.type) {
|
|
20
9
|
case FormStyleTypes.MATERIAL:
|
|
21
10
|
default: {
|
|
22
11
|
if (props.step.hasTextEditor)
|
|
23
|
-
return _jsx(MaterialTextAreaEditorStep,
|
|
12
|
+
return _jsx(MaterialTextAreaEditorStep, { ...props });
|
|
24
13
|
else
|
|
25
|
-
return _jsx(MaterialTextAreaStep,
|
|
14
|
+
return _jsx(MaterialTextAreaStep, { ...props });
|
|
26
15
|
}
|
|
27
16
|
}
|
|
28
17
|
}
|