linear-react-components-ui 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/@types/Align.d.ts +2 -0
- package/lib/@types/ButtonTypes.d.ts +1 -0
- package/lib/@types/ColorStyles.d.ts +2 -0
- package/lib/@types/DataCombo.d.ts +1 -0
- package/lib/@types/Icon.d.ts +2 -0
- package/lib/@types/LabelStyles.d.ts +1 -0
- package/lib/@types/Period.d.ts +4 -0
- package/lib/@types/PermissionAttr.d.ts +12 -0
- package/lib/@types/PointerEvents.d.ts +1 -0
- package/lib/@types/Position.d.ts +2 -0
- package/lib/@types/PositionAlert.d.ts +1 -0
- package/lib/@types/Size.d.ts +1 -0
- package/lib/@types/SizePixels.d.ts +1 -0
- package/lib/@types/StorageMock.d.ts +3 -0
- package/lib/_virtual/_commonjsHelpers.js +9 -0
- package/lib/_virtual/_commonjsHelpers.js.map +1 -0
- package/lib/_virtual/compiler-runtime.js +6 -0
- package/lib/_virtual/compiler-runtime.js.map +1 -0
- package/lib/_virtual/compiler-runtime2.js +5 -0
- package/lib/_virtual/compiler-runtime2.js.map +1 -0
- package/lib/_virtual/index.js +8 -0
- package/lib/_virtual/index.js.map +1 -0
- package/lib/_virtual/index2.js +5 -0
- package/lib/_virtual/index2.js.map +1 -0
- package/lib/_virtual/index3.js +5 -0
- package/lib/_virtual/index3.js.map +1 -0
- package/lib/_virtual/lodash.js +9 -0
- package/lib/_virtual/lodash.js.map +1 -0
- package/lib/_virtual/lodash2.js +5 -0
- package/lib/_virtual/lodash2.js.map +1 -0
- package/lib/_virtual/memoize.js +8 -0
- package/lib/_virtual/memoize.js.map +1 -0
- package/lib/_virtual/react-compiler-runtime.development.js +5 -0
- package/lib/_virtual/react-compiler-runtime.development.js.map +1 -0
- package/lib/_virtual/react-compiler-runtime.production.js +5 -0
- package/lib/_virtual/react-compiler-runtime.production.js.map +1 -0
- package/lib/_virtual/react-is.development.js +5 -0
- package/lib/_virtual/react-is.development.js.map +1 -0
- package/lib/_virtual/react-is.production.min.js +5 -0
- package/lib/_virtual/react-is.production.min.js.map +1 -0
- package/lib/alerts/AlertContainer.d.ts +12 -0
- package/lib/alerts/AlertContainer.js +71 -0
- package/lib/alerts/AlertContainer.js.map +1 -0
- package/lib/alerts/AlertProvider.d.ts +3 -0
- package/lib/alerts/AlertProvider.js +47 -0
- package/lib/alerts/AlertProvider.js.map +1 -0
- package/lib/alerts/BaseAlert.d.ts +3 -0
- package/lib/alerts/BaseAlert.js +22 -0
- package/lib/alerts/BaseAlert.js.map +1 -0
- package/lib/alerts/Message.d.ts +3 -0
- package/lib/alerts/Message.js +95 -0
- package/lib/alerts/Message.js.map +1 -0
- package/lib/alerts/helpers.d.ts +3 -0
- package/lib/alerts/helpers.js +6 -0
- package/lib/alerts/helpers.js.map +1 -0
- package/lib/alerts/index.d.ts +4 -0
- package/lib/alerts/index.js +8 -0
- package/lib/alerts/index.js.map +1 -0
- package/lib/alerts/types.d.ts +47 -0
- package/lib/alerts/withAlert.d.ts +4 -0
- package/lib/alerts/withAlert.js +15 -0
- package/lib/alerts/withAlert.js.map +1 -0
- package/lib/assets/styles/alerts.css +1 -0
- package/lib/assets/styles/avatar.css +1 -0
- package/lib/assets/styles/badge.css +1 -0
- package/lib/assets/styles/button.css +1 -0
- package/lib/assets/styles/calendar.css +1 -0
- package/lib/assets/styles/checkbox.css +1 -0
- package/lib/assets/styles/checkbox2.css +1 -0
- package/lib/assets/styles/colorpicker.css +1 -0
- package/lib/assets/styles/datepicker.css +1 -0
- package/lib/assets/styles/datepicker2.css +1 -0
- package/lib/assets/styles/dialog.css +1 -0
- package/lib/assets/styles/drawers.css +1 -0
- package/lib/assets/styles/dropdown.css +1 -0
- package/lib/assets/styles/error.css +1 -0
- package/lib/assets/styles/fieldset.css +1 -0
- package/lib/assets/styles/file.css +1 -0
- package/lib/assets/styles/filefield.css +1 -0
- package/lib/assets/styles/floatMenu.css +1 -0
- package/lib/assets/styles/form.css +1 -0
- package/lib/assets/styles/gridlayout.css +1 -0
- package/lib/assets/styles/hint.css +1 -0
- package/lib/assets/styles/icon.css +1 -0
- package/lib/assets/styles/input.css +1 -0
- package/lib/assets/styles/label.css +1 -0
- package/lib/assets/styles/labelMessages.css +1 -0
- package/lib/assets/styles/list.css +1 -0
- package/lib/assets/styles/multiSelect.css +1 -0
- package/lib/assets/styles/noPermission.css +1 -0
- package/lib/assets/styles/numberfield.css +1 -0
- package/lib/assets/styles/numbers.css +1 -0
- package/lib/assets/styles/panel.css +1 -0
- package/lib/assets/styles/periodpicker.css +1 -0
- package/lib/assets/styles/popover.css +1 -0
- package/lib/assets/styles/progress.css +1 -0
- package/lib/assets/styles/radio.css +1 -0
- package/lib/assets/styles/radiofield.css +1 -0
- package/lib/assets/styles/search.css +1 -0
- package/lib/assets/styles/select.css +1 -0
- package/lib/assets/styles/selectfield.css +1 -0
- package/lib/assets/styles/shortcuts.css +1 -0
- package/lib/assets/styles/sidenav.css +1 -0
- package/lib/assets/styles/skeleton.css +1 -0
- package/lib/assets/styles/slot.css +1 -0
- package/lib/assets/styles/spinner.css +1 -0
- package/lib/assets/styles/split.css +1 -0
- package/lib/assets/styles/table.css +1 -0
- package/lib/assets/styles/tabs.css +1 -0
- package/lib/assets/styles/textContent.css +1 -0
- package/lib/assets/styles/textfield.css +1 -0
- package/lib/assets/styles/toolbar.css +1 -0
- package/lib/assets/styles/tooltip.css +1 -0
- package/lib/assets/styles/treetable.css +1 -0
- package/lib/assets/styles/treeview.css +1 -0
- package/lib/assets/styles/uitour.css +1 -0
- package/lib/assets/styles/wizard.css +1 -0
- package/lib/avatar/index.d.ts +6 -0
- package/lib/avatar/index.js +57 -0
- package/lib/avatar/index.js.map +1 -0
- package/lib/avatar/types.d.ts +27 -0
- package/lib/badge/index.d.ts +3 -0
- package/lib/badge/index.js +30 -0
- package/lib/badge/index.js.map +1 -0
- package/lib/badge/types.d.ts +10 -0
- package/lib/buttons/ActivateButton.d.ts +3 -0
- package/lib/buttons/ActivateButton.js +12 -0
- package/lib/buttons/ActivateButton.js.map +1 -0
- package/lib/buttons/AddButton.d.ts +3 -0
- package/lib/buttons/AddButton.js +15 -0
- package/lib/buttons/AddButton.js.map +1 -0
- package/lib/buttons/Button.d.ts +6 -0
- package/lib/buttons/Button.js +20 -0
- package/lib/buttons/Button.js.map +1 -0
- package/lib/buttons/ButtonGroups.d.ts +6 -0
- package/lib/buttons/CancelButton.d.ts +3 -0
- package/lib/buttons/CancelButton.js +17 -0
- package/lib/buttons/CancelButton.js.map +1 -0
- package/lib/buttons/DangerButton.d.ts +3 -0
- package/lib/buttons/DangerButton.js +18 -0
- package/lib/buttons/DangerButton.js.map +1 -0
- package/lib/buttons/DefaultButton.d.ts +6 -0
- package/lib/buttons/DefaultButton.js +100 -0
- package/lib/buttons/DefaultButton.js.map +1 -0
- package/lib/buttons/DestroyButton.d.ts +3 -0
- package/lib/buttons/DestroyButton.js +19 -0
- package/lib/buttons/DestroyButton.js.map +1 -0
- package/lib/buttons/EditButton.d.ts +3 -0
- package/lib/buttons/EditButton.js +12 -0
- package/lib/buttons/EditButton.js.map +1 -0
- package/lib/buttons/InactivateButton.d.ts +3 -0
- package/lib/buttons/InactivateButton.js +12 -0
- package/lib/buttons/InactivateButton.js.map +1 -0
- package/lib/buttons/InfoButton.d.ts +3 -0
- package/lib/buttons/InfoButton.js +18 -0
- package/lib/buttons/InfoButton.js.map +1 -0
- package/lib/buttons/PrimaryButton.d.ts +3 -0
- package/lib/buttons/PrimaryButton.js +18 -0
- package/lib/buttons/PrimaryButton.js.map +1 -0
- package/lib/buttons/RestoreButton.d.ts +3 -0
- package/lib/buttons/RestoreButton.js +12 -0
- package/lib/buttons/RestoreButton.js.map +1 -0
- package/lib/buttons/SaveButton.d.ts +3 -0
- package/lib/buttons/SaveButton.js +17 -0
- package/lib/buttons/SaveButton.js.map +1 -0
- package/lib/buttons/SuccessButton.d.ts +3 -0
- package/lib/buttons/SuccessButton.js +18 -0
- package/lib/buttons/SuccessButton.js.map +1 -0
- package/lib/buttons/WarningButton.d.ts +3 -0
- package/lib/buttons/WarningButton.js +18 -0
- package/lib/buttons/WarningButton.js.map +1 -0
- package/lib/buttons/button_container/index.d.ts +10 -0
- package/lib/buttons/button_container/index.js +24 -0
- package/lib/buttons/button_container/index.js.map +1 -0
- package/lib/buttons/index.d.ts +17 -0
- package/lib/buttons/index.js +35 -0
- package/lib/buttons/index.js.map +1 -0
- package/lib/buttons/split_button/index.d.ts +3 -0
- package/lib/buttons/split_button/index.js +60 -0
- package/lib/buttons/split_button/index.js.map +1 -0
- package/lib/buttons/types.d.ts +46 -0
- package/lib/calendar/DangerCalendar.d.ts +3 -0
- package/lib/calendar/DangerCalendar.js +16 -0
- package/lib/calendar/DangerCalendar.js.map +1 -0
- package/lib/calendar/InfoCalendar.d.ts +3 -0
- package/lib/calendar/InfoCalendar.js +16 -0
- package/lib/calendar/InfoCalendar.js.map +1 -0
- package/lib/calendar/PrimaryCalendar.d.ts +3 -0
- package/lib/calendar/PrimaryCalendar.js +16 -0
- package/lib/calendar/PrimaryCalendar.js.map +1 -0
- package/lib/calendar/SuccessCalendar.d.ts +3 -0
- package/lib/calendar/SuccessCalendar.js +16 -0
- package/lib/calendar/SuccessCalendar.js.map +1 -0
- package/lib/calendar/WarningCalendar.d.ts +3 -0
- package/lib/calendar/WarningCalendar.js +16 -0
- package/lib/calendar/WarningCalendar.js.map +1 -0
- package/lib/calendar/base/helpers.d.ts +58 -0
- package/lib/calendar/base/helpers.js +44 -0
- package/lib/calendar/base/helpers.js.map +1 -0
- package/lib/calendar/base/index.d.ts +3 -0
- package/lib/calendar/base/index.js +170 -0
- package/lib/calendar/base/index.js.map +1 -0
- package/lib/calendar/index.d.ts +8 -0
- package/lib/calendar/index.js +15 -0
- package/lib/calendar/index.js.map +1 -0
- package/lib/calendar/types.d.ts +27 -0
- package/lib/checkbox/index.d.ts +8 -0
- package/lib/checkbox/index.js +101 -0
- package/lib/checkbox/index.js.map +1 -0
- package/lib/checkbox/types.d.ts +46 -0
- package/lib/dialog/Alert.d.ts +3 -0
- package/lib/dialog/Alert.js +23 -0
- package/lib/dialog/Alert.js.map +1 -0
- package/lib/dialog/Custom.d.ts +3 -0
- package/lib/dialog/Custom.js +47 -0
- package/lib/dialog/Custom.js.map +1 -0
- package/lib/dialog/Error.d.ts +3 -0
- package/lib/dialog/Error.js +23 -0
- package/lib/dialog/Error.js.map +1 -0
- package/lib/dialog/Information.d.ts +3 -0
- package/lib/dialog/Information.js +23 -0
- package/lib/dialog/Information.js.map +1 -0
- package/lib/dialog/Question.d.ts +3 -0
- package/lib/dialog/Question.js +48 -0
- package/lib/dialog/Question.js.map +1 -0
- package/lib/dialog/Warning.d.ts +3 -0
- package/lib/dialog/Warning.js +23 -0
- package/lib/dialog/Warning.js.map +1 -0
- package/lib/dialog/base/Content.d.ts +3 -0
- package/lib/dialog/base/Content.js +17 -0
- package/lib/dialog/base/Content.js.map +1 -0
- package/lib/dialog/base/Footer.d.ts +3 -0
- package/lib/dialog/base/Footer.js +11 -0
- package/lib/dialog/base/Footer.js.map +1 -0
- package/lib/dialog/base/Header.d.ts +3 -0
- package/lib/dialog/base/Header.js +41 -0
- package/lib/dialog/base/Header.js.map +1 -0
- package/lib/dialog/base/index.d.ts +13 -0
- package/lib/dialog/base/index.js +180 -0
- package/lib/dialog/base/index.js.map +1 -0
- package/lib/dialog/base/style.d.ts +7 -0
- package/lib/dialog/base/style.js +10 -0
- package/lib/dialog/base/style.js.map +1 -0
- package/lib/dialog/form/index.d.ts +4 -0
- package/lib/dialog/form/index.js +112 -0
- package/lib/dialog/form/index.js.map +1 -0
- package/lib/dialog/index.d.ts +9 -0
- package/lib/dialog/index.js +17 -0
- package/lib/dialog/index.js.map +1 -0
- package/lib/dialog/types.d.ts +113 -0
- package/lib/dialog/wizard/index.d.ts +8 -0
- package/lib/dialog/wizard/index.js +67 -0
- package/lib/dialog/wizard/index.js.map +1 -0
- package/lib/dialog/wizard/progressbar.d.ts +11 -0
- package/lib/dialog/wizard/progressbar.js +31 -0
- package/lib/dialog/wizard/progressbar.js.map +1 -0
- package/lib/dialog/wizard/step.d.ts +2 -0
- package/lib/dialog/wizard/step.js +19 -0
- package/lib/dialog/wizard/step.js.map +1 -0
- package/lib/dialog/wizard/useWizard.d.ts +2 -0
- package/lib/dialog/wizard/useWizard.js +46 -0
- package/lib/dialog/wizard/useWizard.js.map +1 -0
- package/lib/drawer/Content.d.ts +3 -0
- package/lib/drawer/Content.js +19 -0
- package/lib/drawer/Content.js.map +1 -0
- package/lib/drawer/Drawer.d.ts +3 -0
- package/lib/drawer/Drawer.js +77 -0
- package/lib/drawer/Drawer.js.map +1 -0
- package/lib/drawer/Header.d.ts +3 -0
- package/lib/drawer/Header.js +57 -0
- package/lib/drawer/Header.js.map +1 -0
- package/lib/drawer/helpers.d.ts +3 -0
- package/lib/drawer/helpers.js +6 -0
- package/lib/drawer/helpers.js.map +1 -0
- package/lib/drawer/index.d.ts +5 -0
- package/lib/drawer/index.js +12 -0
- package/lib/drawer/index.js.map +1 -0
- package/lib/drawer/types.d.ts +38 -0
- package/lib/dropdown/Popup.d.ts +3 -0
- package/lib/dropdown/Popup.js +52 -0
- package/lib/dropdown/Popup.js.map +1 -0
- package/lib/dropdown/helper.d.ts +2 -0
- package/lib/dropdown/index.d.ts +3 -0
- package/lib/dropdown/index.js +6 -0
- package/lib/dropdown/index.js.map +1 -0
- package/lib/dropdown/types.d.ts +45 -0
- package/lib/dropdown/withDropdown.d.ts +9 -0
- package/lib/dropdown/withDropdown.js +82 -0
- package/lib/dropdown/withDropdown.js.map +1 -0
- package/lib/fieldset/index.d.ts +3 -0
- package/lib/fieldset/index.js +71 -0
- package/lib/fieldset/index.js.map +1 -0
- package/lib/fieldset/types.d.ts +27 -0
- package/lib/form/Field.d.ts +2 -0
- package/lib/form/Field.js +117 -0
- package/lib/form/Field.js.map +1 -0
- package/lib/form/FieldArray.d.ts +2 -0
- package/lib/form/FieldArray.js +64 -0
- package/lib/form/FieldArray.js.map +1 -0
- package/lib/form/FieldNumber.d.ts +2 -0
- package/lib/form/FieldNumber.js +62 -0
- package/lib/form/FieldNumber.js.map +1 -0
- package/lib/form/FieldPeriod.d.ts +2 -0
- package/lib/form/FieldPeriod.js +93 -0
- package/lib/form/FieldPeriod.js.map +1 -0
- package/lib/form/helpers.d.ts +11 -0
- package/lib/form/helpers.js +28 -0
- package/lib/form/helpers.js.map +1 -0
- package/lib/form/index.d.ts +8 -0
- package/lib/form/index.js +166 -0
- package/lib/form/index.js.map +1 -0
- package/lib/form/types.d.ts +245 -0
- package/lib/form/withFieldHOC.d.ts +4 -0
- package/lib/form/withFieldHOC.js +64 -0
- package/lib/form/withFieldHOC.js.map +1 -0
- package/lib/form/withFormSecurity.d.ts +6 -0
- package/lib/form/withFormSecurity.js +31 -0
- package/lib/form/withFormSecurity.js.map +1 -0
- package/lib/form2/helpers.d.ts +5 -0
- package/lib/form2/helpers.js +24 -0
- package/lib/form2/helpers.js.map +1 -0
- package/lib/form2/index.d.ts +7 -0
- package/lib/form2/index.js +23 -0
- package/lib/form2/index.js.map +1 -0
- package/lib/form2/types.d.ts +133 -0
- package/lib/form2/useForm/index.d.ts +3 -0
- package/lib/form2/useForm/index.js +132 -0
- package/lib/form2/useForm/index.js.map +1 -0
- package/lib/gridlayout/GridCol.d.ts +3 -0
- package/lib/gridlayout/GridCol.js +28 -0
- package/lib/gridlayout/GridCol.js.map +1 -0
- package/lib/gridlayout/GridRow.d.ts +3 -0
- package/lib/gridlayout/GridRow.js +27 -0
- package/lib/gridlayout/GridRow.js.map +1 -0
- package/lib/gridlayout/index.d.ts +4 -0
- package/lib/gridlayout/index.js +7 -0
- package/lib/gridlayout/index.js.map +1 -0
- package/lib/gridlayout/types.d.ts +17 -0
- package/lib/hint/helpers.d.ts +1 -0
- package/lib/hint/helpers.js +13 -0
- package/lib/hint/helpers.js.map +1 -0
- package/lib/hint/index.d.ts +3 -0
- package/lib/hint/index.js +32 -0
- package/lib/hint/index.js.map +1 -0
- package/lib/hint/types.d.ts +11 -0
- package/lib/icons/helper.d.ts +667 -0
- package/lib/icons/helper.js +670 -0
- package/lib/icons/helper.js.map +1 -0
- package/lib/icons/index.d.ts +3 -0
- package/lib/icons/index.js +76 -0
- package/lib/icons/index.js.map +1 -0
- package/lib/icons/types.d.ts +42 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/inputs/base/InputTextBase.d.ts +3 -0
- package/lib/inputs/base/InputTextBase.js +188 -0
- package/lib/inputs/base/InputTextBase.js.map +1 -0
- package/lib/inputs/base/helpers.d.ts +10 -0
- package/lib/inputs/base/helpers.js +31 -0
- package/lib/inputs/base/helpers.js.map +1 -0
- package/lib/inputs/base/types.d.ts +88 -0
- package/lib/inputs/color/index.d.ts +3 -0
- package/lib/inputs/color/index.js +58 -0
- package/lib/inputs/color/index.js.map +1 -0
- package/lib/inputs/color/types.d.ts +16 -0
- package/lib/inputs/date/Dialog.d.ts +3 -0
- package/lib/inputs/date/Dialog.js +18 -0
- package/lib/inputs/date/Dialog.js.map +1 -0
- package/lib/inputs/date/Dropdown.d.ts +3 -0
- package/lib/inputs/date/Dropdown.js +20 -0
- package/lib/inputs/date/Dropdown.js.map +1 -0
- package/lib/inputs/date/helpers.d.ts +34 -0
- package/lib/inputs/date/helpers.js +52 -0
- package/lib/inputs/date/helpers.js.map +1 -0
- package/lib/inputs/date/index.d.ts +3 -0
- package/lib/inputs/date/index.js +135 -0
- package/lib/inputs/date/index.js.map +1 -0
- package/lib/inputs/date/types.d.ts +57 -0
- package/lib/inputs/errorMessage/index.d.ts +3 -0
- package/lib/inputs/errorMessage/index.js +26 -0
- package/lib/inputs/errorMessage/index.js.map +1 -0
- package/lib/inputs/file/DefaultFile.d.ts +3 -0
- package/lib/inputs/file/DefaultFile.js +69 -0
- package/lib/inputs/file/DefaultFile.js.map +1 -0
- package/lib/inputs/file/DragDropFile.d.ts +3 -0
- package/lib/inputs/file/DragDropFile.js +135 -0
- package/lib/inputs/file/DragDropFile.js.map +1 -0
- package/lib/inputs/file/File.d.ts +3 -0
- package/lib/inputs/file/File.js +30 -0
- package/lib/inputs/file/File.js.map +1 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +3 -0
- package/lib/inputs/file/FileButtonSettings.js +25 -0
- package/lib/inputs/file/FileButtonSettings.js.map +1 -0
- package/lib/inputs/file/helpers.d.ts +2 -0
- package/lib/inputs/file/helpers.js +12 -0
- package/lib/inputs/file/helpers.js.map +1 -0
- package/lib/inputs/file/index.d.ts +5 -0
- package/lib/inputs/file/index.js +9 -0
- package/lib/inputs/file/index.js.map +1 -0
- package/lib/inputs/file/types.d.ts +49 -0
- package/lib/inputs/index.d.ts +14 -0
- package/lib/inputs/index.js +40 -0
- package/lib/inputs/index.js.map +1 -0
- package/lib/inputs/inputHOC.d.ts +4 -0
- package/lib/inputs/inputHOC.js +42 -0
- package/lib/inputs/inputHOC.js.map +1 -0
- package/lib/inputs/mask/BaseMask.d.ts +3 -0
- package/lib/inputs/mask/BaseMask.js +144 -0
- package/lib/inputs/mask/BaseMask.js.map +1 -0
- package/lib/inputs/mask/Cnpj.d.ts +6 -0
- package/lib/inputs/mask/Cnpj.js +47 -0
- package/lib/inputs/mask/Cnpj.js.map +1 -0
- package/lib/inputs/mask/Cpf.d.ts +6 -0
- package/lib/inputs/mask/Cpf.js +49 -0
- package/lib/inputs/mask/Cpf.js.map +1 -0
- package/lib/inputs/mask/Phone.d.ts +3 -0
- package/lib/inputs/mask/Phone.js +14 -0
- package/lib/inputs/mask/Phone.js.map +1 -0
- package/lib/inputs/mask/ZipCode.d.ts +3 -0
- package/lib/inputs/mask/ZipCode.js +12 -0
- package/lib/inputs/mask/ZipCode.js.map +1 -0
- package/lib/inputs/mask/helpers.d.ts +5 -0
- package/lib/inputs/mask/helpers.js +69 -0
- package/lib/inputs/mask/helpers.js.map +1 -0
- package/lib/inputs/mask/index.d.ts +7 -0
- package/lib/inputs/mask/index.js +13 -0
- package/lib/inputs/mask/index.js.map +1 -0
- package/lib/inputs/mask/types.d.ts +74 -0
- package/lib/inputs/multiSelect/ActionButtons.d.ts +3 -0
- package/lib/inputs/multiSelect/ActionButtons.js +39 -0
- package/lib/inputs/multiSelect/ActionButtons.js.map +1 -0
- package/lib/inputs/multiSelect/Dropdown.d.ts +3 -0
- package/lib/inputs/multiSelect/Dropdown.js +100 -0
- package/lib/inputs/multiSelect/Dropdown.js.map +1 -0
- package/lib/inputs/multiSelect/helper.d.ts +3 -0
- package/lib/inputs/multiSelect/helper.js +9 -0
- package/lib/inputs/multiSelect/helper.js.map +1 -0
- package/lib/inputs/multiSelect/index.d.ts +3 -0
- package/lib/inputs/multiSelect/index.js +196 -0
- package/lib/inputs/multiSelect/index.js.map +1 -0
- package/lib/inputs/multiSelect/types.d.ts +59 -0
- package/lib/inputs/number/Currency.d.ts +3 -0
- package/lib/inputs/number/Currency.js +84 -0
- package/lib/inputs/number/Currency.js.map +1 -0
- package/lib/inputs/number/Decimal.d.ts +3 -0
- package/lib/inputs/number/Decimal.js +82 -0
- package/lib/inputs/number/Decimal.js.map +1 -0
- package/lib/inputs/number/format_number.d.ts +3 -0
- package/lib/inputs/number/format_number.js +15 -0
- package/lib/inputs/number/format_number.js.map +1 -0
- package/lib/inputs/number/index.d.ts +6 -0
- package/lib/inputs/number/index.js +80 -0
- package/lib/inputs/number/index.js.map +1 -0
- package/lib/inputs/number/types.d.ts +37 -0
- package/lib/inputs/period/Dialog.d.ts +3 -0
- package/lib/inputs/period/Dialog.js +19 -0
- package/lib/inputs/period/Dialog.js.map +1 -0
- package/lib/inputs/period/Dropdown.d.ts +3 -0
- package/lib/inputs/period/Dropdown.js +19 -0
- package/lib/inputs/period/Dropdown.js.map +1 -0
- package/lib/inputs/period/PeriodList.d.ts +3 -0
- package/lib/inputs/period/PeriodList.js +44 -0
- package/lib/inputs/period/PeriodList.js.map +1 -0
- package/lib/inputs/period/helper.d.ts +11 -0
- package/lib/inputs/period/helper.js +32 -0
- package/lib/inputs/period/helper.js.map +1 -0
- package/lib/inputs/period/index.d.ts +3 -0
- package/lib/inputs/period/index.js +199 -0
- package/lib/inputs/period/index.js.map +1 -0
- package/lib/inputs/period/types.d.ts +72 -0
- package/lib/inputs/search/index.d.ts +3 -0
- package/lib/inputs/search/index.js +111 -0
- package/lib/inputs/search/index.js.map +1 -0
- package/lib/inputs/select/ActionButtons.d.ts +3 -0
- package/lib/inputs/select/ActionButtons.js +29 -0
- package/lib/inputs/select/ActionButtons.js.map +1 -0
- package/lib/inputs/select/Dropdown.d.ts +3 -0
- package/lib/inputs/select/Dropdown.js +71 -0
- package/lib/inputs/select/Dropdown.js.map +1 -0
- package/lib/inputs/select/helper.d.ts +11 -0
- package/lib/inputs/select/helper.js +48 -0
- package/lib/inputs/select/helper.js.map +1 -0
- package/lib/inputs/select/index.d.ts +3 -0
- package/lib/inputs/select/index.js +28 -0
- package/lib/inputs/select/index.js.map +1 -0
- package/lib/inputs/select/multiple/Selecteds.d.ts +3 -0
- package/lib/inputs/select/multiple/Selecteds.js +27 -0
- package/lib/inputs/select/multiple/Selecteds.js.map +1 -0
- package/lib/inputs/select/multiple/index.d.ts +3 -0
- package/lib/inputs/select/multiple/index.js +129 -0
- package/lib/inputs/select/multiple/index.js.map +1 -0
- package/lib/inputs/select/simple/index.d.ts +3 -0
- package/lib/inputs/select/simple/index.js +159 -0
- package/lib/inputs/select/simple/index.js.map +1 -0
- package/lib/inputs/select/types.d.ts +119 -0
- package/lib/inputs/text/index.d.ts +3 -0
- package/lib/inputs/text/index.js +12 -0
- package/lib/inputs/text/index.js.map +1 -0
- package/lib/inputs/text/types.d.ts +18 -0
- package/lib/inputs/textarea/index.d.ts +3 -0
- package/lib/inputs/textarea/index.js +17 -0
- package/lib/inputs/textarea/index.js.map +1 -0
- package/lib/inputs/textarea/types.d.ts +7 -0
- package/lib/inputs/types.d.ts +152 -0
- package/lib/inputs2/checkboxfield/base.d.ts +27 -0
- package/lib/inputs2/checkboxfield/base.js +100 -0
- package/lib/inputs2/checkboxfield/base.js.map +1 -0
- package/lib/inputs2/checkboxfield/index.d.ts +11 -0
- package/lib/inputs2/checkboxfield/index.js +47 -0
- package/lib/inputs2/checkboxfield/index.js.map +1 -0
- package/lib/inputs2/colorfield/index.d.ts +8 -0
- package/lib/inputs2/colorfield/index.js +89 -0
- package/lib/inputs2/colorfield/index.js.map +1 -0
- package/lib/inputs2/date/base/constants.d.ts +4 -0
- package/lib/inputs2/date/base/constants.js +39 -0
- package/lib/inputs2/date/base/constants.js.map +1 -0
- package/lib/inputs2/date/base/index.d.ts +6 -0
- package/lib/inputs2/date/base/index.js +134 -0
- package/lib/inputs2/date/base/index.js.map +1 -0
- package/lib/inputs2/date/datefield/base.d.ts +3 -0
- package/lib/inputs2/date/datefield/base.js +193 -0
- package/lib/inputs2/date/datefield/base.js.map +1 -0
- package/lib/inputs2/date/datefield/calendarbox.d.ts +6 -0
- package/lib/inputs2/date/datefield/calendarbox.js +74 -0
- package/lib/inputs2/date/datefield/calendarbox.js.map +1 -0
- package/lib/inputs2/date/datefield/context.d.ts +4 -0
- package/lib/inputs2/date/datefield/context.js +12 -0
- package/lib/inputs2/date/datefield/context.js.map +1 -0
- package/lib/inputs2/date/datefield/index.d.ts +5 -0
- package/lib/inputs2/date/datefield/index.js +47 -0
- package/lib/inputs2/date/datefield/index.js.map +1 -0
- package/lib/inputs2/date/datefield/triggers.d.ts +8 -0
- package/lib/inputs2/date/datefield/triggers.js +30 -0
- package/lib/inputs2/date/datefield/triggers.js.map +1 -0
- package/lib/inputs2/date/datefield/types.d.ts +63 -0
- package/lib/inputs2/date/dateperiodfield/base.d.ts +3 -0
- package/lib/inputs2/date/dateperiodfield/base.js +511 -0
- package/lib/inputs2/date/dateperiodfield/base.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +6 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +94 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/context.d.ts +4 -0
- package/lib/inputs2/date/dateperiodfield/context.js +12 -0
- package/lib/inputs2/date/dateperiodfield/context.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/index.d.ts +5 -0
- package/lib/inputs2/date/dateperiodfield/index.js +47 -0
- package/lib/inputs2/date/dateperiodfield/index.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/triggers.d.ts +5 -0
- package/lib/inputs2/date/dateperiodfield/triggers.js +61 -0
- package/lib/inputs2/date/dateperiodfield/triggers.js.map +1 -0
- package/lib/inputs2/date/dateperiodfield/types.d.ts +101 -0
- package/lib/inputs2/date/helpers.d.ts +10 -0
- package/lib/inputs2/date/helpers.js +42 -0
- package/lib/inputs2/date/helpers.js.map +1 -0
- package/lib/inputs2/date/types.d.ts +59 -0
- package/lib/inputs2/date/types.js +5 -0
- package/lib/inputs2/date/types.js.map +1 -0
- package/lib/inputs2/filefield/index.d.ts +11 -0
- package/lib/inputs2/filefield/index.js +120 -0
- package/lib/inputs2/filefield/index.js.map +1 -0
- package/lib/inputs2/index.d.ts +17 -0
- package/lib/inputs2/index.js +36 -0
- package/lib/inputs2/index.js.map +1 -0
- package/lib/inputs2/mask/Cnpj.d.ts +9 -0
- package/lib/inputs2/mask/Cnpj.js +112 -0
- package/lib/inputs2/mask/Cnpj.js.map +1 -0
- package/lib/inputs2/mask/Cpf.d.ts +9 -0
- package/lib/inputs2/mask/Cpf.js +94 -0
- package/lib/inputs2/mask/Cpf.js.map +1 -0
- package/lib/inputs2/mask/Phone.d.ts +8 -0
- package/lib/inputs2/mask/Phone.js +23 -0
- package/lib/inputs2/mask/Phone.js.map +1 -0
- package/lib/inputs2/mask/ZipCode.d.ts +7 -0
- package/lib/inputs2/mask/ZipCode.js +22 -0
- package/lib/inputs2/mask/ZipCode.js.map +1 -0
- package/lib/inputs2/mask/helpers.d.ts +2 -0
- package/lib/inputs2/mask/helpers.js +34 -0
- package/lib/inputs2/mask/helpers.js.map +1 -0
- package/lib/inputs2/mask/index.d.ts +6 -0
- package/lib/inputs2/mask/index.js +113 -0
- package/lib/inputs2/mask/index.js.map +1 -0
- package/lib/inputs2/mask/types.d.ts +16 -0
- package/lib/inputs2/numberfield/currency.d.ts +4 -0
- package/lib/inputs2/numberfield/currency.js +129 -0
- package/lib/inputs2/numberfield/currency.js.map +1 -0
- package/lib/inputs2/numberfield/decimal.d.ts +4 -0
- package/lib/inputs2/numberfield/decimal.js +122 -0
- package/lib/inputs2/numberfield/decimal.js.map +1 -0
- package/lib/inputs2/numberfield/helpers.d.ts +28 -0
- package/lib/inputs2/numberfield/helpers.js +19 -0
- package/lib/inputs2/numberfield/helpers.js.map +1 -0
- package/lib/inputs2/numberfield/index.d.ts +8 -0
- package/lib/inputs2/numberfield/index.js +118 -0
- package/lib/inputs2/numberfield/index.js.map +1 -0
- package/lib/inputs2/numberfield/types.d.ts +26 -0
- package/lib/inputs2/radiofield/base.d.ts +3 -0
- package/lib/inputs2/radiofield/base.js +111 -0
- package/lib/inputs2/radiofield/base.js.map +1 -0
- package/lib/inputs2/radiofield/index.d.ts +5 -0
- package/lib/inputs2/radiofield/index.js +47 -0
- package/lib/inputs2/radiofield/index.js.map +1 -0
- package/lib/inputs2/radiofield/types.d.ts +34 -0
- package/lib/inputs2/selectfield/base.d.ts +3 -0
- package/lib/inputs2/selectfield/base.js +412 -0
- package/lib/inputs2/selectfield/base.js.map +1 -0
- package/lib/inputs2/selectfield/context.d.ts +38 -0
- package/lib/inputs2/selectfield/context.js +12 -0
- package/lib/inputs2/selectfield/context.js.map +1 -0
- package/lib/inputs2/selectfield/helpers.d.ts +5 -0
- package/lib/inputs2/selectfield/helpers.js +17 -0
- package/lib/inputs2/selectfield/helpers.js.map +1 -0
- package/lib/inputs2/selectfield/index.d.ts +9 -0
- package/lib/inputs2/selectfield/index.js +57 -0
- package/lib/inputs2/selectfield/index.js.map +1 -0
- package/lib/inputs2/selectfield/item.d.ts +11 -0
- package/lib/inputs2/selectfield/item.js +57 -0
- package/lib/inputs2/selectfield/item.js.map +1 -0
- package/lib/inputs2/selectfield/listbox.d.ts +7 -0
- package/lib/inputs2/selectfield/listbox.js +73 -0
- package/lib/inputs2/selectfield/listbox.js.map +1 -0
- package/lib/inputs2/selectfield/options.d.ts +8 -0
- package/lib/inputs2/selectfield/options.js +20 -0
- package/lib/inputs2/selectfield/options.js.map +1 -0
- package/lib/inputs2/selectfield/search.d.ts +6 -0
- package/lib/inputs2/selectfield/search.js +58 -0
- package/lib/inputs2/selectfield/search.js.map +1 -0
- package/lib/inputs2/selectfield/selections.d.ts +9 -0
- package/lib/inputs2/selectfield/selections.js +66 -0
- package/lib/inputs2/selectfield/selections.js.map +1 -0
- package/lib/inputs2/selectfield/simple.d.ts +9 -0
- package/lib/inputs2/selectfield/simple.js +24 -0
- package/lib/inputs2/selectfield/simple.js.map +1 -0
- package/lib/inputs2/selectfield/triggers.d.ts +8 -0
- package/lib/inputs2/selectfield/triggers.js +82 -0
- package/lib/inputs2/selectfield/triggers.js.map +1 -0
- package/lib/inputs2/selectfield/types.d.ts +55 -0
- package/lib/inputs2/selectfield/types.js +6 -0
- package/lib/inputs2/selectfield/types.js.map +1 -0
- package/lib/inputs2/slot/index.d.ts +17 -0
- package/lib/inputs2/slot/index.js +50 -0
- package/lib/inputs2/slot/index.js.map +1 -0
- package/lib/inputs2/textareafield/base.d.ts +23 -0
- package/lib/inputs2/textareafield/base.js +137 -0
- package/lib/inputs2/textareafield/base.js.map +1 -0
- package/lib/inputs2/textareafield/index.d.ts +12 -0
- package/lib/inputs2/textareafield/index.js +51 -0
- package/lib/inputs2/textareafield/index.js.map +1 -0
- package/lib/inputs2/textfield/base.d.ts +23 -0
- package/lib/inputs2/textfield/base.js +107 -0
- package/lib/inputs2/textfield/base.js.map +1 -0
- package/lib/inputs2/textfield/index.d.ts +12 -0
- package/lib/inputs2/textfield/index.js +51 -0
- package/lib/inputs2/textfield/index.js.map +1 -0
- package/lib/internals/colorStyles.d.ts +8 -0
- package/lib/internals/colorStyles.js +11 -0
- package/lib/internals/colorStyles.js.map +1 -0
- package/lib/internals/constants.d.ts +12 -0
- package/lib/internals/constants.js +15 -0
- package/lib/internals/constants.js.map +1 -0
- package/lib/internals/types.d.ts +7 -0
- package/lib/labelMessages/index.d.ts +3 -0
- package/lib/labelMessages/index.js +55 -0
- package/lib/labelMessages/index.js.map +1 -0
- package/lib/labelMessages/types.d.ts +16 -0
- package/lib/labels/DangerLabel.d.ts +3 -0
- package/lib/labels/DangerLabel.js +16 -0
- package/lib/labels/DangerLabel.js.map +1 -0
- package/lib/labels/DefaultLabel.d.ts +3 -0
- package/lib/labels/DefaultLabel.js +63 -0
- package/lib/labels/DefaultLabel.js.map +1 -0
- package/lib/labels/InfoLabel.d.ts +3 -0
- package/lib/labels/InfoLabel.js +16 -0
- package/lib/labels/InfoLabel.js.map +1 -0
- package/lib/labels/PrimaryLabel.d.ts +3 -0
- package/lib/labels/PrimaryLabel.js +16 -0
- package/lib/labels/PrimaryLabel.js.map +1 -0
- package/lib/labels/SuccessLabel.d.ts +3 -0
- package/lib/labels/SuccessLabel.js +16 -0
- package/lib/labels/SuccessLabel.js.map +1 -0
- package/lib/labels/WarningLabel.d.ts +3 -0
- package/lib/labels/WarningLabel.js +16 -0
- package/lib/labels/WarningLabel.js.map +1 -0
- package/lib/labels/index.d.ts +9 -0
- package/lib/labels/index.js +19 -0
- package/lib/labels/index.js.map +1 -0
- package/lib/labels/label_container/index.d.ts +10 -0
- package/lib/labels/label_container/index.js +19 -0
- package/lib/labels/label_container/index.js.map +1 -0
- package/lib/labels/types.d.ts +19 -0
- package/lib/list/Header.d.ts +3 -0
- package/lib/list/Header.js +21 -0
- package/lib/list/Header.js.map +1 -0
- package/lib/list/Item.d.ts +3 -0
- package/lib/list/Item.js +151 -0
- package/lib/list/Item.js.map +1 -0
- package/lib/list/Separator.d.ts +2 -0
- package/lib/list/Separator.js +11 -0
- package/lib/list/Separator.js.map +1 -0
- package/lib/list/helpers.d.ts +8 -0
- package/lib/list/helpers.js +9 -0
- package/lib/list/helpers.js.map +1 -0
- package/lib/list/index.d.ts +7 -0
- package/lib/list/index.js +106 -0
- package/lib/list/index.js.map +1 -0
- package/lib/list/types.d.ts +66 -0
- package/lib/menus/float/MenuItem.d.ts +3 -0
- package/lib/menus/float/MenuItem.js +56 -0
- package/lib/menus/float/MenuItem.js.map +1 -0
- package/lib/menus/float/SubMenuContainer.d.ts +29 -0
- package/lib/menus/float/SubMenuContainer.js +78 -0
- package/lib/menus/float/SubMenuContainer.js.map +1 -0
- package/lib/menus/float/helpers.d.ts +3 -0
- package/lib/menus/float/helpers.js +6 -0
- package/lib/menus/float/helpers.js.map +1 -0
- package/lib/menus/float/index.d.ts +6 -0
- package/lib/menus/float/index.js +45 -0
- package/lib/menus/float/index.js.map +1 -0
- package/lib/menus/float/types.d.ts +26 -0
- package/lib/menus/index.d.ts +2 -0
- package/lib/menus/index.js +5 -0
- package/lib/menus/index.js.map +1 -0
- package/lib/menus/sidenav/ExpandMenu.d.ts +3 -0
- package/lib/menus/sidenav/ExpandMenu.js +20 -0
- package/lib/menus/sidenav/ExpandMenu.js.map +1 -0
- package/lib/menus/sidenav/MenuLink.d.ts +3 -0
- package/lib/menus/sidenav/MenuLink.js +32 -0
- package/lib/menus/sidenav/MenuLink.js.map +1 -0
- package/lib/menus/sidenav/NavMenuGroup.d.ts +3 -0
- package/lib/menus/sidenav/NavMenuGroup.js +23 -0
- package/lib/menus/sidenav/NavMenuGroup.js.map +1 -0
- package/lib/menus/sidenav/NavMenuItem.d.ts +3 -0
- package/lib/menus/sidenav/NavMenuItem.js +141 -0
- package/lib/menus/sidenav/NavMenuItem.js.map +1 -0
- package/lib/menus/sidenav/NavSubMenuItem.d.ts +3 -0
- package/lib/menus/sidenav/NavSubMenuItem.js +40 -0
- package/lib/menus/sidenav/NavSubMenuItem.js.map +1 -0
- package/lib/menus/sidenav/helpers.d.ts +5 -0
- package/lib/menus/sidenav/helpers.js +11 -0
- package/lib/menus/sidenav/helpers.js.map +1 -0
- package/lib/menus/sidenav/index.d.ts +8 -0
- package/lib/menus/sidenav/index.js +152 -0
- package/lib/menus/sidenav/index.js.map +1 -0
- package/lib/menus/sidenav/popup_menu_search/EmptyList.d.ts +3 -0
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +24 -0
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js.map +1 -0
- package/lib/menus/sidenav/popup_menu_search/index.d.ts +3 -0
- package/lib/menus/sidenav/popup_menu_search/index.js +57 -0
- package/lib/menus/sidenav/popup_menu_search/index.js.map +1 -0
- package/lib/menus/sidenav/types.d.ts +85 -0
- package/lib/noPermission/index.d.ts +2 -0
- package/lib/noPermission/index.js +17 -0
- package/lib/noPermission/index.js.map +1 -0
- package/lib/node_modules/imask/esm/controls/html-contenteditable-mask-element.js +35 -0
- package/lib/node_modules/imask/esm/controls/html-contenteditable-mask-element.js.map +1 -0
- package/lib/node_modules/imask/esm/controls/html-input-mask-element.js +32 -0
- package/lib/node_modules/imask/esm/controls/html-input-mask-element.js.map +1 -0
- package/lib/node_modules/imask/esm/controls/html-mask-element.js +49 -0
- package/lib/node_modules/imask/esm/controls/html-mask-element.js.map +1 -0
- package/lib/node_modules/imask/esm/controls/input-history.js +31 -0
- package/lib/node_modules/imask/esm/controls/input-history.js.map +1 -0
- package/lib/node_modules/imask/esm/controls/input.js +223 -0
- package/lib/node_modules/imask/esm/controls/input.js.map +1 -0
- package/lib/node_modules/imask/esm/controls/mask-element.js +44 -0
- package/lib/node_modules/imask/esm/controls/mask-element.js.map +1 -0
- package/lib/node_modules/imask/esm/core/action-details.js +52 -0
- package/lib/node_modules/imask/esm/core/action-details.js.map +1 -0
- package/lib/node_modules/imask/esm/core/change-details.js +37 -0
- package/lib/node_modules/imask/esm/core/change-details.js.map +1 -0
- package/lib/node_modules/imask/esm/core/continuous-tail-details.js +43 -0
- package/lib/node_modules/imask/esm/core/continuous-tail-details.js.map +1 -0
- package/lib/node_modules/imask/esm/core/holder.js +7 -0
- package/lib/node_modules/imask/esm/core/holder.js.map +1 -0
- package/lib/node_modules/imask/esm/core/utils.js +68 -0
- package/lib/node_modules/imask/esm/core/utils.js.map +1 -0
- package/lib/node_modules/imask/esm/index.js +51 -0
- package/lib/node_modules/imask/esm/index.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/base.js +253 -0
- package/lib/node_modules/imask/esm/masked/base.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/date.js +118 -0
- package/lib/node_modules/imask/esm/masked/date.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/dynamic.js +223 -0
- package/lib/node_modules/imask/esm/masked/dynamic.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/enum.js +70 -0
- package/lib/node_modules/imask/esm/masked/enum.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/factory.js +47 -0
- package/lib/node_modules/imask/esm/masked/factory.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/function.js +24 -0
- package/lib/node_modules/imask/esm/masked/function.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/number.js +213 -0
- package/lib/node_modules/imask/esm/masked/number.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/pattern/chunk-tail-details.js +104 -0
- package/lib/node_modules/imask/esm/masked/pattern/chunk-tail-details.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/pattern/cursor.js +101 -0
- package/lib/node_modules/imask/esm/masked/pattern/cursor.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/pattern/fixed-definition.js +103 -0
- package/lib/node_modules/imask/esm/masked/pattern/fixed-definition.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/pattern/input-definition.js +134 -0
- package/lib/node_modules/imask/esm/masked/pattern/input-definition.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/pattern.js +323 -0
- package/lib/node_modules/imask/esm/masked/pattern.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/pipe.js +24 -0
- package/lib/node_modules/imask/esm/masked/pipe.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/range.js +79 -0
- package/lib/node_modules/imask/esm/masked/range.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/regexp.js +22 -0
- package/lib/node_modules/imask/esm/masked/regexp.js.map +1 -0
- package/lib/node_modules/imask/esm/masked/repeat.js +105 -0
- package/lib/node_modules/imask/esm/masked/repeat.js.map +1 -0
- package/lib/node_modules/lodash/_Hash.js +23 -0
- package/lib/node_modules/lodash/_Hash.js.map +1 -0
- package/lib/node_modules/lodash/_ListCache.js +23 -0
- package/lib/node_modules/lodash/_ListCache.js.map +1 -0
- package/lib/node_modules/lodash/_Map.js +13 -0
- package/lib/node_modules/lodash/_Map.js.map +1 -0
- package/lib/node_modules/lodash/_MapCache.js +23 -0
- package/lib/node_modules/lodash/_MapCache.js.map +1 -0
- package/lib/node_modules/lodash/_Symbol.js +12 -0
- package/lib/node_modules/lodash/_Symbol.js.map +1 -0
- package/lib/node_modules/lodash/_assocIndexOf.js +18 -0
- package/lib/node_modules/lodash/_assocIndexOf.js.map +1 -0
- package/lib/node_modules/lodash/_baseGetTag.js +17 -0
- package/lib/node_modules/lodash/_baseGetTag.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsNative.js +23 -0
- package/lib/node_modules/lodash/_baseIsNative.js.map +1 -0
- package/lib/node_modules/lodash/_coreJsData.js +12 -0
- package/lib/node_modules/lodash/_coreJsData.js.map +1 -0
- package/lib/node_modules/lodash/_freeGlobal.js +12 -0
- package/lib/node_modules/lodash/_freeGlobal.js.map +1 -0
- package/lib/node_modules/lodash/_getMapData.js +16 -0
- package/lib/node_modules/lodash/_getMapData.js.map +1 -0
- package/lib/node_modules/lodash/_getNative.js +17 -0
- package/lib/node_modules/lodash/_getNative.js.map +1 -0
- package/lib/node_modules/lodash/_getRawTag.js +22 -0
- package/lib/node_modules/lodash/_getRawTag.js.map +1 -0
- package/lib/node_modules/lodash/_getValue.js +13 -0
- package/lib/node_modules/lodash/_getValue.js.map +1 -0
- package/lib/node_modules/lodash/_hashClear.js +15 -0
- package/lib/node_modules/lodash/_hashClear.js.map +1 -0
- package/lib/node_modules/lodash/_hashDelete.js +14 -0
- package/lib/node_modules/lodash/_hashDelete.js.map +1 -0
- package/lib/node_modules/lodash/_hashGet.js +20 -0
- package/lib/node_modules/lodash/_hashGet.js.map +1 -0
- package/lib/node_modules/lodash/_hashHas.js +16 -0
- package/lib/node_modules/lodash/_hashHas.js.map +1 -0
- package/lib/node_modules/lodash/_hashSet.js +16 -0
- package/lib/node_modules/lodash/_hashSet.js.map +1 -0
- package/lib/node_modules/lodash/_isKeyable.js +14 -0
- package/lib/node_modules/lodash/_isKeyable.js.map +1 -0
- package/lib/node_modules/lodash/_isMasked.js +18 -0
- package/lib/node_modules/lodash/_isMasked.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheClear.js +13 -0
- package/lib/node_modules/lodash/_listCacheClear.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheDelete.js +19 -0
- package/lib/node_modules/lodash/_listCacheDelete.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheGet.js +16 -0
- package/lib/node_modules/lodash/_listCacheGet.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheHas.js +15 -0
- package/lib/node_modules/lodash/_listCacheHas.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheSet.js +16 -0
- package/lib/node_modules/lodash/_listCacheSet.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheClear.js +21 -0
- package/lib/node_modules/lodash/_mapCacheClear.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheDelete.js +16 -0
- package/lib/node_modules/lodash/_mapCacheDelete.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheGet.js +15 -0
- package/lib/node_modules/lodash/_mapCacheGet.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheHas.js +15 -0
- package/lib/node_modules/lodash/_mapCacheHas.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheSet.js +16 -0
- package/lib/node_modules/lodash/_mapCacheSet.js.map +1 -0
- package/lib/node_modules/lodash/_nativeCreate.js +12 -0
- package/lib/node_modules/lodash/_nativeCreate.js.map +1 -0
- package/lib/node_modules/lodash/_objectToString.js +14 -0
- package/lib/node_modules/lodash/_objectToString.js.map +1 -0
- package/lib/node_modules/lodash/_root.js +12 -0
- package/lib/node_modules/lodash/_root.js.map +1 -0
- package/lib/node_modules/lodash/_toSource.js +24 -0
- package/lib/node_modules/lodash/_toSource.js.map +1 -0
- package/lib/node_modules/lodash/eq.js +13 -0
- package/lib/node_modules/lodash/eq.js.map +1 -0
- package/lib/node_modules/lodash/isFunction.js +19 -0
- package/lib/node_modules/lodash/isFunction.js.map +1 -0
- package/lib/node_modules/lodash/isObject.js +14 -0
- package/lib/node_modules/lodash/isObject.js.map +1 -0
- package/lib/node_modules/lodash/lodash.js +3678 -0
- package/lib/node_modules/lodash/lodash.js.map +1 -0
- package/lib/node_modules/lodash/memoize.js +24 -0
- package/lib/node_modules/lodash/memoize.js.map +1 -0
- package/lib/node_modules/moment/dist/moment.js +2590 -0
- package/lib/node_modules/moment/dist/moment.js.map +1 -0
- package/lib/node_modules/object-assign/index.js +55 -0
- package/lib/node_modules/object-assign/index.js.map +1 -0
- package/lib/node_modules/prop-types/checkPropTypes.js +55 -0
- package/lib/node_modules/prop-types/checkPropTypes.js.map +1 -0
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js +53 -0
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -0
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js +330 -0
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -0
- package/lib/node_modules/prop-types/index.js +18 -0
- package/lib/node_modules/prop-types/index.js.map +1 -0
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js +11 -0
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -0
- package/lib/node_modules/prop-types/lib/has.js +8 -0
- package/lib/node_modules/prop-types/lib/has.js.map +1 -0
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +96 -0
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +79 -0
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/lib/node_modules/prop-types/node_modules/react-is/index.js +11 -0
- package/lib/node_modules/prop-types/node_modules/react-is/index.js.map +1 -0
- package/lib/node_modules/react/cjs/react-compiler-runtime.development.js +31 -0
- package/lib/node_modules/react/cjs/react-compiler-runtime.development.js.map +1 -0
- package/lib/node_modules/react/cjs/react-compiler-runtime.production.js +24 -0
- package/lib/node_modules/react/cjs/react-compiler-runtime.production.js.map +1 -0
- package/lib/node_modules/react/compiler-runtime.js +11 -0
- package/lib/node_modules/react/compiler-runtime.js.map +1 -0
- package/lib/node_modules/react-imask/esm/hook.js +76 -0
- package/lib/node_modules/react-imask/esm/hook.js.map +1 -0
- package/lib/node_modules/react-imask/esm/input.js +24 -0
- package/lib/node_modules/react-imask/esm/input.js.map +1 -0
- package/lib/node_modules/react-imask/esm/mixin.js +132 -0
- package/lib/node_modules/react-imask/esm/mixin.js.map +1 -0
- package/lib/node_modules/uuid/dist/native.js +5 -0
- package/lib/node_modules/uuid/dist/native.js.map +1 -0
- package/lib/node_modules/uuid/dist/rng.js +14 -0
- package/lib/node_modules/uuid/dist/rng.js.map +1 -0
- package/lib/node_modules/uuid/dist/stringify.js +10 -0
- package/lib/node_modules/uuid/dist/stringify.js.map +1 -0
- package/lib/node_modules/uuid/dist/v1.js +35 -0
- package/lib/node_modules/uuid/dist/v1.js.map +1 -0
- package/lib/node_modules/uuid/dist/v4.js +17 -0
- package/lib/node_modules/uuid/dist/v4.js.map +1 -0
- package/lib/panel/Content.d.ts +3 -0
- package/lib/panel/Content.js +59 -0
- package/lib/panel/Content.js.map +1 -0
- package/lib/panel/DangerPanel.d.ts +3 -0
- package/lib/panel/DangerPanel.js +13 -0
- package/lib/panel/DangerPanel.js.map +1 -0
- package/lib/panel/Default.d.ts +3 -0
- package/lib/panel/Default.js +68 -0
- package/lib/panel/Default.js.map +1 -0
- package/lib/panel/Header.d.ts +3 -0
- package/lib/panel/Header.js +53 -0
- package/lib/panel/Header.js.map +1 -0
- package/lib/panel/InfoPanel.d.ts +3 -0
- package/lib/panel/InfoPanel.js +13 -0
- package/lib/panel/InfoPanel.js.map +1 -0
- package/lib/panel/PrimaryPanel.d.ts +3 -0
- package/lib/panel/PrimaryPanel.js +13 -0
- package/lib/panel/PrimaryPanel.js.map +1 -0
- package/lib/panel/SuccessPanel.d.ts +3 -0
- package/lib/panel/SuccessPanel.js +13 -0
- package/lib/panel/SuccessPanel.js.map +1 -0
- package/lib/panel/ToolBar.d.ts +3 -0
- package/lib/panel/WarningPanel.d.ts +3 -0
- package/lib/panel/WarningPanel.js +13 -0
- package/lib/panel/WarningPanel.js.map +1 -0
- package/lib/panel/helpers.d.ts +4 -0
- package/lib/panel/helpers.js +16 -0
- package/lib/panel/helpers.js.map +1 -0
- package/lib/panel/index.d.ts +10 -0
- package/lib/panel/index.js +20 -0
- package/lib/panel/index.js.map +1 -0
- package/lib/panel/types.d.ts +43 -0
- package/lib/permissionValidations.d.ts +12 -0
- package/lib/permissionValidations.js +47 -0
- package/lib/permissionValidations.js.map +1 -0
- package/lib/popover/PopoverText.d.ts +3 -0
- package/lib/popover/PopoverText.js +16 -0
- package/lib/popover/PopoverText.js.map +1 -0
- package/lib/popover/PopoverTitle.d.ts +3 -0
- package/lib/popover/PopoverTitle.js +13 -0
- package/lib/popover/PopoverTitle.js.map +1 -0
- package/lib/popover/index.d.ts +6 -0
- package/lib/popover/index.js +41 -0
- package/lib/popover/index.js.map +1 -0
- package/lib/popover/types.d.ts +32 -0
- package/lib/progress/Bar.d.ts +3 -0
- package/lib/progress/Bar.js +52 -0
- package/lib/progress/Bar.js.map +1 -0
- package/lib/progress/index.d.ts +5 -0
- package/lib/progress/index.js +28 -0
- package/lib/progress/index.js.map +1 -0
- package/lib/progress/types.d.ts +34 -0
- package/lib/radio/index.d.ts +11 -0
- package/lib/radio/index.js +114 -0
- package/lib/radio/index.js.map +1 -0
- package/lib/radio/types.d.ts +25 -0
- package/lib/shortcuts/index.d.ts +3 -0
- package/lib/shortcuts/index.js +24 -0
- package/lib/shortcuts/index.js.map +1 -0
- package/lib/shortcuts/types.d.ts +9 -0
- package/lib/skeleton/SkeletonContainer.d.ts +3 -0
- package/lib/skeleton/SkeletonContainer.js +20 -0
- package/lib/skeleton/SkeletonContainer.js.map +1 -0
- package/lib/skeleton/index.d.ts +5 -0
- package/lib/skeleton/index.js +49 -0
- package/lib/skeleton/index.js.map +1 -0
- package/lib/skeleton/types.d.ts +18 -0
- package/lib/spinner/SpinnerLoading.d.ts +3 -0
- package/lib/spinner/SpinnerLoading.js +56 -0
- package/lib/spinner/SpinnerLoading.js.map +1 -0
- package/lib/spinner/index.d.ts +5 -0
- package/lib/spinner/index.js +54 -0
- package/lib/spinner/index.js.map +1 -0
- package/lib/spinner/types.d.ts +17 -0
- package/lib/split/Split.d.ts +3 -0
- package/lib/split/Split.js +194 -0
- package/lib/split/Split.js.map +1 -0
- package/lib/split/SplitSide.d.ts +3 -0
- package/lib/split/SplitSide.js +28 -0
- package/lib/split/SplitSide.js.map +1 -0
- package/lib/split/helpers.d.ts +7 -0
- package/lib/split/helpers.js +6 -0
- package/lib/split/helpers.js.map +1 -0
- package/lib/split/index.d.ts +4 -0
- package/lib/split/index.js +8 -0
- package/lib/split/index.js.map +1 -0
- package/lib/split/types.d.ts +31 -0
- package/lib/table/Body.d.ts +3 -0
- package/lib/table/Body.js +46 -0
- package/lib/table/Body.js.map +1 -0
- package/lib/table/Header.d.ts +3 -0
- package/lib/table/Header.js +53 -0
- package/lib/table/Header.js.map +1 -0
- package/lib/table/HeaderColumn.d.ts +3 -0
- package/lib/table/HeaderColumn.js +44 -0
- package/lib/table/HeaderColumn.js.map +1 -0
- package/lib/table/Row.d.ts +3 -0
- package/lib/table/Row.js +54 -0
- package/lib/table/Row.js.map +1 -0
- package/lib/table/RowColumn.d.ts +3 -0
- package/lib/table/RowColumn.js +59 -0
- package/lib/table/RowColumn.js.map +1 -0
- package/lib/table/helpers.d.ts +6 -0
- package/lib/table/helpers.js +10 -0
- package/lib/table/helpers.js.map +1 -0
- package/lib/table/index.d.ts +9 -0
- package/lib/table/index.js +105 -0
- package/lib/table/index.js.map +1 -0
- package/lib/table/types.d.ts +95 -0
- package/lib/tabs/DropdownTabs.d.ts +3 -0
- package/lib/tabs/DropdownTabs.js +75 -0
- package/lib/tabs/DropdownTabs.js.map +1 -0
- package/lib/tabs/Menu.d.ts +3 -0
- package/lib/tabs/Menu.js +40 -0
- package/lib/tabs/Menu.js.map +1 -0
- package/lib/tabs/MenuTabs.d.ts +3 -0
- package/lib/tabs/MenuTabs.js +72 -0
- package/lib/tabs/MenuTabs.js.map +1 -0
- package/lib/tabs/Panel.d.ts +3 -0
- package/lib/tabs/Panel.js +63 -0
- package/lib/tabs/Panel.js.map +1 -0
- package/lib/tabs/context.d.ts +3 -0
- package/lib/tabs/context.js +67 -0
- package/lib/tabs/context.js.map +1 -0
- package/lib/tabs/index.d.ts +5 -0
- package/lib/tabs/index.js +84 -0
- package/lib/tabs/index.js.map +1 -0
- package/lib/tabs/tabHelpers.d.ts +27 -0
- package/lib/tabs/tabHelpers.js +48 -0
- package/lib/tabs/tabHelpers.js.map +1 -0
- package/lib/tabs/types.d.ts +102 -0
- package/lib/tabs/useTabs.d.ts +1 -0
- package/lib/tabs/useTabs.js +9 -0
- package/lib/tabs/useTabs.js.map +1 -0
- package/lib/textContent/index.d.ts +14 -0
- package/lib/textContent/index.js +44 -0
- package/lib/textContent/index.js.map +1 -0
- package/lib/toolbar/ButtonBar.d.ts +3 -0
- package/lib/toolbar/ButtonBar.js +68 -0
- package/lib/toolbar/ButtonBar.js.map +1 -0
- package/lib/toolbar/LabelBar.d.ts +3 -0
- package/lib/toolbar/LabelBar.js +52 -0
- package/lib/toolbar/LabelBar.js.map +1 -0
- package/lib/toolbar/Separator.d.ts +2 -0
- package/lib/toolbar/Separator.js +11 -0
- package/lib/toolbar/Separator.js.map +1 -0
- package/lib/toolbar/ToolBarGroup.d.ts +3 -0
- package/lib/toolbar/ToolBarGroup.js +17 -0
- package/lib/toolbar/ToolBarGroup.js.map +1 -0
- package/lib/toolbar/helpers.d.ts +3 -0
- package/lib/toolbar/helpers.js +6 -0
- package/lib/toolbar/helpers.js.map +1 -0
- package/lib/toolbar/index.d.ts +8 -0
- package/lib/toolbar/index.js +40 -0
- package/lib/toolbar/index.js.map +1 -0
- package/lib/toolbar/types.d.ts +43 -0
- package/lib/tooltip/TooltipContent.d.ts +3 -0
- package/lib/tooltip/TooltipContent.js +40 -0
- package/lib/tooltip/TooltipContent.js.map +1 -0
- package/lib/tooltip/index.d.ts +3 -0
- package/lib/tooltip/index.js +41 -0
- package/lib/tooltip/index.js.map +1 -0
- package/lib/tooltip/types.d.ts +40 -0
- package/lib/tooltip/useTooltip.d.ts +27 -0
- package/lib/tooltip/useTooltip.js +78 -0
- package/lib/tooltip/useTooltip.js.map +1 -0
- package/lib/treetable/Body.d.ts +2 -0
- package/lib/treetable/Body.js +31 -0
- package/lib/treetable/Body.js.map +1 -0
- package/lib/treetable/Header.d.ts +2 -0
- package/lib/treetable/Header.js +28 -0
- package/lib/treetable/Header.js.map +1 -0
- package/lib/treetable/Row.d.ts +3 -0
- package/lib/treetable/Row.js +218 -0
- package/lib/treetable/Row.js.map +1 -0
- package/lib/treetable/helpers.d.ts +14 -0
- package/lib/treetable/helpers.js +18 -0
- package/lib/treetable/helpers.js.map +1 -0
- package/lib/treetable/index.d.ts +4 -0
- package/lib/treetable/index.js +30 -0
- package/lib/treetable/index.js.map +1 -0
- package/lib/treeview/Header.d.ts +3 -0
- package/lib/treeview/Header.js +17 -0
- package/lib/treeview/Header.js.map +1 -0
- package/lib/treeview/Node.d.ts +3 -0
- package/lib/treeview/Node.js +208 -0
- package/lib/treeview/Node.js.map +1 -0
- package/lib/treeview/constants.d.ts +2 -0
- package/lib/treeview/constants.js +6 -0
- package/lib/treeview/constants.js.map +1 -0
- package/lib/treeview/index.d.ts +6 -0
- package/lib/treeview/index.js +270 -0
- package/lib/treeview/index.js.map +1 -0
- package/lib/treeview/types.d.ts +106 -0
- package/lib/uitour/helpers.d.ts +7 -0
- package/lib/uitour/helpers.js +10 -0
- package/lib/uitour/helpers.js.map +1 -0
- package/lib/uitour/index.d.ts +3 -0
- package/lib/uitour/index.js +188 -0
- package/lib/uitour/index.js.map +1 -0
- package/lib/uitour/types.d.ts +35 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/lib/form/index.tsx"],"sourcesContent":["import { Fragment, useState, useEffect, useContext, useRef, FormEvent, useCallback, KeyboardEvent, Dispatch, SetStateAction } from 'react';\nimport { v1 } from 'uuid';\nimport _ from 'lodash';\nimport { changeValue, FormContext } from './helpers';\nimport Field from './Field';\nimport FieldNumber from './FieldNumber';\nimport FieldArray from './FieldArray';\nimport FieldPeriod from './FieldPeriod';\nimport '../assets/styles/form.scss';\nimport { DialogQuestion } from '../dialog';\nimport { FormSecurityContext } from './withFormSecurity';\nimport { FieldErrors, FieldValidator, FormContextProps, FormProps, OnFielChangeEvent, Validator, type PropsValidateTabErrors } from './types';\n\nconst Form = ({\n submitOnPressEnterKey = true, dataSource, securityBeforeUnload, handlerReset, handlerSubmit,\n handlerValidates, style, customClass, securityTitle, securityText, securityData, onDataChange,\n onValidateForm, externalFieldErrors, onSubmit, skeletonize, disabled, children,\n useInternalState = false, onValidateErrorsOnTab,\n}: FormProps) => {\n const formId = v1();\n const [data, setData] = useState(dataSource);\n const [originalData, setOriginalData] = useState(dataSource);\n const [submitFormOnEnter, setSubmitFormOnEnter] = useState(submitOnPressEnterKey);\n const [fieldErrors, setFieldErrors] = useState<FieldErrors>({});\n const [oldFieldsValidatorsQuantity, setOldFieldsValidatorsQuantity] = useState(0);\n const [isValid, setIsValid] = useState(false);\n const context = useContext(FormSecurityContext);\n const formRef = useRef<HTMLFormElement | null>(null);\n const fieldsValidators = useRef<FieldValidator>({});\n const tabsWithErrorRef = useRef<PropsValidateTabErrors[]>([]);\n const usedData = useInternalState ? data : dataSource;\n\n const getValidatesErrorMessages = (validators: Validator | Validator[], fieldValue: string) => {\n const validatorsArray = (!(validators instanceof Array)) ? [validators] : validators;\n let errors: string[] = [];\n validatorsArray.forEach((validator: Validator) => {\n if (typeof validator === 'function') {\n const result = validator(fieldValue);\n if (result) errors = [...errors, result];\n }\n });\n return errors;\n };\n\n const getErrorMessages = (\n currentData: object,\n currentValidators: Validator | Validator[] | FieldValidator,\n ) => {\n const dataValidate = currentData || usedData;\n let currentFieldErrors: FieldErrors = _.pickBy(fieldErrors, (__, fieldName) => {\n const fieldValidatorsNames = Object.keys(currentValidators);\n return fieldValidatorsNames.includes(fieldName);\n }) as FieldErrors;\n _.forEach(currentValidators, (validators, fieldName) => {\n const fieldValue = _.get(dataValidate, fieldName);\n const messages = getValidatesErrorMessages(validators, fieldValue);\n currentFieldErrors = { ...currentFieldErrors, [fieldName]: messages };\n });\n return currentFieldErrors;\n };\n\n const checkIsValid = (\n currentData: object,\n updateState = true,\n currentValidators: Validator | Validator[] | FieldValidator | null = null,\n ): boolean => {\n const currentFieldErrors =\n getErrorMessages(currentData, currentValidators || fieldsValidators.current);\n const isValidNow = Object.values(currentFieldErrors).every(value => value.length === 0);\n if (updateState) setIsValid(isValidNow);\n return isValidNow;\n };\n\n const onFieldChange = useCallback((event: OnFielChangeEvent) => {\n const { target } = event;\n if (!useInternalState && onDataChange) {\n onDataChange((prevState: object) => changeValue(prevState, target));\n } else {\n setData(prevState => changeValue(prevState, target));\n }\n }, []);\n\n const onValidate = (\n fieldName: string,\n fieldValue: string,\n validators: Validator | Validator[],\n ) => {\n if (validators) {\n let currentFieldErrors = fieldErrors;\n const errors = getValidatesErrorMessages(validators, fieldValue);\n if (errors.length === 0) {\n currentFieldErrors = _.omit(currentFieldErrors, fieldName);\n } else {\n currentFieldErrors = { ...currentFieldErrors, [fieldName]: errors };\n }\n setFieldErrors(currentFieldErrors);\n }\n };\n\n const onFormSubmit = useCallback((event?: Event) => {\n if (event) { event.preventDefault(); event.stopPropagation(); }\n if (checkIsValid(usedData)) onSubmit(usedData);\n }, [usedData]);\n\n const onResetField = (\n cb: Dispatch<SetStateAction<object>>,\n fields?: string | string[],\n ) => {\n const fieldsArray = !fields ? [] : (fields instanceof Array ? fields : [fields]);\n if (fieldsArray.length > 0) {\n cb((state: any) => {\n const newState = JSON.parse(JSON.stringify(state));\n fieldsArray.forEach((field) => {\n if (field)\n _.set(newState, field, _.get(originalData, field));\n });\n return newState;\n });\n\n setFieldErrors((state) => {\n fieldsArray.forEach((field) => {\n delete state[field];\n });\n return state;\n });\n } else {\n cb(JSON.parse(JSON.stringify(originalData)));\n setFieldErrors({});\n }\n };\n\n const onReset = (fields?: string | string[]) => {\n if (!useInternalState && onDataChange) {\n onResetField(onDataChange, fields);\n } else {\n onResetField(setData, fields);\n }\n };\n\n const onRemoveFieldValidators = (fieldName: string) => {\n const newFieldsValidators = _.omit(fieldsValidators, fieldName);\n fieldsValidators.current = newFieldsValidators;\n };\n\n const onBeforeUnload = (e: Event) => {\n const event = e as Event;\n event.preventDefault();\n if (_.isEqual(usedData, originalData)) return;\n };\n\n const onValidateTabErrors = useCallback((props: PropsValidateTabErrors) => {\n if (!props.tabId) return;\n\n const tabIndex = [...tabsWithErrorRef.current].findIndex(tab => tab.name === props.name);\n\n if (tabIndex !== -1) {\n const novasTabs = [...tabsWithErrorRef.current];\n novasTabs[tabIndex] = props;\n tabsWithErrorRef.current = [...novasTabs];\n } else {\n tabsWithErrorRef.current = [...tabsWithErrorRef.current, props];\n }\n\n if (onValidateErrorsOnTab) {\n const tabIdsWithErrors = _.uniq(\n _.compact(\n tabsWithErrorRef.current.map((tab) => {\n if (tab.hasErrors) return String(tab.tabId);\n }),\n ),\n );\n onValidateErrorsOnTab(tabIdsWithErrors);\n }\n }, [onValidateErrorsOnTab]);\n\n const formProps = () => {\n let propsForm = null;\n\n if (!disabled) {\n propsForm = {\n onSubmit: (event: FormEvent<HTMLFormElement>) => event.preventDefault(),\n onKeyPress: (event: KeyboardEvent<HTMLFormElement>) => {\n if (event && event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n if (submitFormOnEnter) onFormSubmit();\n }\n },\n };\n }\n return propsForm;\n };\n\n const updateFormState = () => {\n if (!_.isEmpty(context)) {\n const { onChangedData } = context;\n if (securityData && !_.isEqual(usedData, securityData)) {\n onChangedData(true);\n } else {\n onChangedData(false);\n }\n }\n\n if (onDataChange && useInternalState) onDataChange(usedData);\n\n // TODO - Usar debounce para evitar chamada a cada letra digitada\n if (onValidateForm) {\n onValidateForm(checkIsValid(usedData, true));\n }\n\n if (!disabled) {\n handlerSubmit(onFormSubmit);\n if (handlerReset) handlerReset(onReset);\n if (handlerValidates) handlerValidates(() => checkIsValid(usedData));\n }\n if (_.isEmpty(usedData)) setOriginalData(usedData);\n };\n\n useEffect(() => {\n if (useInternalState) updateFormState();\n }, [JSON.stringify(data), useInternalState]);\n\n useEffect(() => {\n if (!useInternalState && onDataChange) updateFormState();\n }, [JSON.stringify(dataSource), useInternalState]);\n\n useEffect(() => {\n if (securityBeforeUnload) {\n if (Object.entries(context).length) context.setSecurityBeforeUnload(true);\n window.addEventListener('beforeunload', onBeforeUnload);\n }\n return () => {\n if (securityBeforeUnload && Object.entries(context).length) \n context.setSecurityBeforeUnload(false);\n window.removeEventListener('beforeunload', onBeforeUnload);\n };\n }, [securityBeforeUnload, onBeforeUnload]);\n\n useEffect(() => {\n if (!disabled && submitOnPressEnterKey !== submitFormOnEnter) {\n setSubmitFormOnEnter(submitOnPressEnterKey);\n }\n }, [submitOnPressEnterKey]);\n\n useEffect(() => {\n const validatorsQuantity = Object.values(fieldsValidators.current)\n .reduce((acc, currentValue) => acc + (currentValue?.length || 0), 0);\n\n if (fieldsValidators.current && onValidateForm\n && oldFieldsValidatorsQuantity !== validatorsQuantity) {\n setOldFieldsValidatorsQuantity(validatorsQuantity);\n onValidateForm(checkIsValid(usedData, true, fieldsValidators.current));\n }\n }, [\n fieldsValidators.current, oldFieldsValidatorsQuantity, onValidateForm, JSON.stringify(usedData),\n ]);\n\n const contextValues: FormContextProps = {\n skeletonize,\n handlerFieldChange: onFieldChange,\n handlerFieldValidate: onValidate,\n handleValidationErrorsOnTab: onValidateTabErrors,\n handlerStoreValidators: (fieldName, fieldValidates) => {\n fieldsValidators.current = { ...fieldsValidators.current, [fieldName]: fieldValidates };\n },\n handlerRemoveValidators: onRemoveFieldValidators,\n data: useInternalState ? data : dataSource,\n originalData,\n fieldErrors,\n externalFieldErrors,\n isFormValid: isValid,\n };\n\n return (\n <Fragment>\n <FormContext.Provider value={contextValues}>\n <form\n id={formId}\n ref={formRef}\n style={style}\n {...formProps()}\n role=\"presentation\"\n className={`form-component ${customClass}`}>\n {children}\n </form>\n </FormContext.Provider>\n <DialogQuestion\n zIndex=\"99999999\"\n title={securityTitle || 'Dados Alterados'}\n text={securityText || 'Você possui dados alterados, confirma o fechamento?'}\n visible={!_.isEmpty(context) && context.showQuestion}\n onConfirmClick={context ? context.onConfirmClick : () => {}}\n onUnconfirmClick={context ? context.onUnconfirmClick : () => {}} />\n </Fragment>\n );\n};\n\nexport default Form;\nexport {\n Field,\n FieldNumber,\n FieldArray,\n FieldPeriod,\n};\n"],"names":["Form","submitOnPressEnterKey","dataSource","securityBeforeUnload","handlerReset","handlerSubmit","handlerValidates","style","customClass","securityTitle","securityText","securityData","onDataChange","onValidateForm","externalFieldErrors","onSubmit","skeletonize","disabled","children","useInternalState","onValidateErrorsOnTab","formId","v1","data","setData","useState","originalData","setOriginalData","submitFormOnEnter","setSubmitFormOnEnter","fieldErrors","setFieldErrors","oldFieldsValidatorsQuantity","setOldFieldsValidatorsQuantity","isValid","setIsValid","context","useContext","FormSecurityContext","formRef","useRef","fieldsValidators","tabsWithErrorRef","usedData","getValidatesErrorMessages","validators","fieldValue","validatorsArray","Array","errors","forEach","validator","result","getErrorMessages","currentData","currentValidators","dataValidate","currentFieldErrors","_","pickBy","__","fieldName","Object","keys","includes","get","messages","checkIsValid","updateState","current","isValidNow","values","every","value","length","onFieldChange","useCallback","event","target","prevState","changeValue","onValidate","omit","onFormSubmit","preventDefault","stopPropagation","onResetField","cb","fields","fieldsArray","state","newState","JSON","parse","stringify","field","set","onReset","onRemoveFieldValidators","newFieldsValidators","onBeforeUnload","e","isEqual","onValidateTabErrors","props","tabId","tabIndex","findIndex","tab","name","novasTabs","tabIdsWithErrors","uniq","compact","map","hasErrors","String","formProps","propsForm","onKeyPress","key","updateFormState","isEmpty","onChangedData","useEffect","entries","setSecurityBeforeUnload","window","addEventListener","removeEventListener","validatorsQuantity","reduce","acc","currentValue","contextValues","handlerFieldChange","handlerFieldValidate","handleValidationErrorsOnTab","handlerStoreValidators","fieldValidates","handlerRemoveValidators","isFormValid","Fragment","jsx","FormContext","DialogQuestion","showQuestion","onConfirmClick","onUnconfirmClick"],"mappings":"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"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { ChangeEvent, ComponentType, CSSProperties, Dispatch, MouseEventHandler, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import { AllOptions } from '../inputs/select/types';
|
|
3
|
+
export type Validator = (value: string) => string | undefined;
|
|
4
|
+
export type PeriodValidator = (value: {
|
|
5
|
+
inicial: string;
|
|
6
|
+
final: string;
|
|
7
|
+
}) => string | undefined;
|
|
8
|
+
export type OnFielChangeEvent = Event & {
|
|
9
|
+
target: HTMLInputElement;
|
|
10
|
+
};
|
|
11
|
+
export type CustomKeyboardEvent = ChangeEvent<HTMLInputElement> & {
|
|
12
|
+
keyCode: number;
|
|
13
|
+
};
|
|
14
|
+
export type PropsValidateTabErrors = {
|
|
15
|
+
name: string;
|
|
16
|
+
tabId?: string | number;
|
|
17
|
+
hasErrors: boolean;
|
|
18
|
+
};
|
|
19
|
+
type BaseFormProps = {
|
|
20
|
+
dataSource: object;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
onSubmit: (data: object) => void;
|
|
23
|
+
handlerSubmit: (value: () => void) => void;
|
|
24
|
+
handlerReset?: (value: () => void) => void;
|
|
25
|
+
handlerValidates?: (value: any) => void;
|
|
26
|
+
onValidateForm?: (value: boolean) => void;
|
|
27
|
+
onValidateErrorsOnTab?: (tabIds: Array<string | number>) => void;
|
|
28
|
+
submitOnPressEnterKey?: boolean;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
customClass?: string;
|
|
31
|
+
securityBeforeUnload?: boolean;
|
|
32
|
+
securityTitle?: string;
|
|
33
|
+
securityText?: string;
|
|
34
|
+
securityData?: object;
|
|
35
|
+
externalFieldErrors?: object;
|
|
36
|
+
skeletonize?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
};
|
|
39
|
+
type OnDataChange = Dispatch<SetStateAction<object>>;
|
|
40
|
+
export type FormProps = BaseFormProps & ({
|
|
41
|
+
useInternalState?: false;
|
|
42
|
+
onDataChange: OnDataChange;
|
|
43
|
+
} | {
|
|
44
|
+
useInternalState: true;
|
|
45
|
+
onDataChange?: OnDataChange;
|
|
46
|
+
});
|
|
47
|
+
type Data = {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
};
|
|
50
|
+
export interface IFieldProps extends WithFieldProps {
|
|
51
|
+
data?: Data;
|
|
52
|
+
originalData?: Data;
|
|
53
|
+
dataSource?: Data;
|
|
54
|
+
name: string;
|
|
55
|
+
value?: string;
|
|
56
|
+
label?: string;
|
|
57
|
+
handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => ChangeEvent;
|
|
58
|
+
handlerFieldValidate?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
59
|
+
component: ComponentType<any>;
|
|
60
|
+
componentType?: 'Radio' | 'Checkbox';
|
|
61
|
+
onChange?: (event: ChangeEvent) => ChangeEvent;
|
|
62
|
+
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
63
|
+
onKeyDown?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
64
|
+
validators?: Validator | Validator[];
|
|
65
|
+
fieldErrors?: {
|
|
66
|
+
[name: string]: string[];
|
|
67
|
+
};
|
|
68
|
+
externalFieldErrors?: {
|
|
69
|
+
[name: string]: string[];
|
|
70
|
+
};
|
|
71
|
+
externalMessagesErrors?: string[];
|
|
72
|
+
fieldId?: string;
|
|
73
|
+
scale?: number;
|
|
74
|
+
required?: boolean;
|
|
75
|
+
idKey?: string;
|
|
76
|
+
descriptionKey?: string;
|
|
77
|
+
showClearButton?: boolean;
|
|
78
|
+
gridLayout?: string;
|
|
79
|
+
allOptions?: AllOptions;
|
|
80
|
+
searchNotFoundText?: string;
|
|
81
|
+
min?: number;
|
|
82
|
+
max?: number;
|
|
83
|
+
autoFocus?: boolean;
|
|
84
|
+
autoCompleteMask?: 'left' | 'right';
|
|
85
|
+
mask?: string;
|
|
86
|
+
hint?: string | string[];
|
|
87
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
88
|
+
themePopover?: 'light' | 'dark';
|
|
89
|
+
popoverAlign?: 'right' | 'left';
|
|
90
|
+
displayCurrencySymbol?: boolean;
|
|
91
|
+
removeZeroLeft?: boolean;
|
|
92
|
+
textAlign?: 'left' | 'right';
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
currencySymbol?: string;
|
|
95
|
+
checked?: boolean;
|
|
96
|
+
tabId?: string | number;
|
|
97
|
+
handleValidationErrorsOnTab?: (props: PropsValidateTabErrors) => void;
|
|
98
|
+
}
|
|
99
|
+
export interface CustomEvent {
|
|
100
|
+
target: {
|
|
101
|
+
value: string[];
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface IFieldArrayProps extends WithFieldProps {
|
|
106
|
+
data?: Data;
|
|
107
|
+
originalData?: Data;
|
|
108
|
+
dataSource?: Data;
|
|
109
|
+
name: string;
|
|
110
|
+
handlerFieldChange?: (event: CustomEvent) => void;
|
|
111
|
+
fieldErrors?: {
|
|
112
|
+
[name: string]: string[];
|
|
113
|
+
};
|
|
114
|
+
validators?: Validator | Validator[];
|
|
115
|
+
valuePropName?: string;
|
|
116
|
+
changePropName?: string;
|
|
117
|
+
handlerSelecionados?: (ids: string[]) => void;
|
|
118
|
+
label?: string;
|
|
119
|
+
skipLabel?: boolean;
|
|
120
|
+
bordered?: boolean;
|
|
121
|
+
cols?: string;
|
|
122
|
+
labelContainerStyle?: object;
|
|
123
|
+
externalMessagesErrors?: string[];
|
|
124
|
+
idKey?: string;
|
|
125
|
+
descriptionKey?: string;
|
|
126
|
+
showClearButton?: boolean;
|
|
127
|
+
gridLayout?: string;
|
|
128
|
+
multiple?: boolean;
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
131
|
+
handlerFieldValidate?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
132
|
+
required?: boolean;
|
|
133
|
+
hint?: string | string[];
|
|
134
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
135
|
+
themePopover?: 'light' | 'dark';
|
|
136
|
+
popoverAlign?: 'right' | 'left';
|
|
137
|
+
tabId?: string | number;
|
|
138
|
+
}
|
|
139
|
+
export type PeriodChangeEvent = {
|
|
140
|
+
initial: string;
|
|
141
|
+
final: string;
|
|
142
|
+
};
|
|
143
|
+
type PeriodFieldChangeEvent = {
|
|
144
|
+
target: {
|
|
145
|
+
name: string;
|
|
146
|
+
value: {
|
|
147
|
+
[valueDate: string]: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export interface IFieldPeriodProps extends WithFieldProps {
|
|
152
|
+
data?: Data;
|
|
153
|
+
originalData?: Data;
|
|
154
|
+
nameDateInitial: string;
|
|
155
|
+
nameDateFinal: string;
|
|
156
|
+
handlerFieldChange?: (event: PeriodFieldChangeEvent) => PeriodFieldChangeEvent;
|
|
157
|
+
label?: string;
|
|
158
|
+
onBlur?: () => void;
|
|
159
|
+
validators?: PeriodValidator | PeriodValidator[];
|
|
160
|
+
fieldErrors?: {
|
|
161
|
+
[name: string]: string[];
|
|
162
|
+
};
|
|
163
|
+
externalMessagesErrors?: string[];
|
|
164
|
+
externalFieldErrors?: {
|
|
165
|
+
[name: string]: string[];
|
|
166
|
+
};
|
|
167
|
+
handlerFieldValidate?: (name: string, value: object, validatorsArray: PeriodValidator[] | PeriodValidator) => void;
|
|
168
|
+
onChange?: (event: PeriodChangeEvent) => PeriodChangeEvent;
|
|
169
|
+
gridLayout?: string;
|
|
170
|
+
hint?: string | string[];
|
|
171
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
172
|
+
themePopover?: 'light' | 'dark';
|
|
173
|
+
popoverAlign?: 'right' | 'left';
|
|
174
|
+
tabId?: string | number;
|
|
175
|
+
}
|
|
176
|
+
export interface FormContextProps {
|
|
177
|
+
skeletonize?: boolean;
|
|
178
|
+
handlerFieldChange: (event: OnFielChangeEvent) => void;
|
|
179
|
+
handlerFieldValidate: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
180
|
+
handlerStoreValidators: (fieldName: string, fieldValidates: Validator) => void;
|
|
181
|
+
handlerRemoveValidators: (fieldName: string) => void;
|
|
182
|
+
data: object;
|
|
183
|
+
originalData: object;
|
|
184
|
+
fieldErrors: object;
|
|
185
|
+
externalFieldErrors?: object;
|
|
186
|
+
isFormValid?: boolean;
|
|
187
|
+
handleValidationErrorsOnTab?: (props: PropsValidateTabErrors) => void;
|
|
188
|
+
}
|
|
189
|
+
export interface WithFieldProps {
|
|
190
|
+
name: string;
|
|
191
|
+
data?: Data;
|
|
192
|
+
handlerStoreValidators?: (name: string, validators: Validator | Validator[]) => void;
|
|
193
|
+
handlerRemoveValidators?: (name: string) => void;
|
|
194
|
+
validators?: Validator | Validator[] | PeriodValidator | PeriodValidator[];
|
|
195
|
+
customClass?: string;
|
|
196
|
+
handleValidationErrorsOnTab?: (props: PropsValidateTabErrors) => void;
|
|
197
|
+
component: ComponentType<any>;
|
|
198
|
+
}
|
|
199
|
+
export interface IWithFieldContext {
|
|
200
|
+
validatorFromComponent: Validator | Validator[] | undefined;
|
|
201
|
+
handlerSetValidatorFromComponent: (validator: Validator | Validator[]) => void;
|
|
202
|
+
}
|
|
203
|
+
export interface IWithFormSecurity {
|
|
204
|
+
onOpenChange?: (open: boolean) => void;
|
|
205
|
+
handlerClose?: () => void;
|
|
206
|
+
onClick?: MouseEventHandler;
|
|
207
|
+
children?: ReactNode;
|
|
208
|
+
}
|
|
209
|
+
export interface IFormSecurityContext {
|
|
210
|
+
onChangedData: (value: boolean) => void;
|
|
211
|
+
showQuestion: boolean;
|
|
212
|
+
onConfirmClick: () => void;
|
|
213
|
+
onUnconfirmClick: () => void;
|
|
214
|
+
setSecurityBeforeUnload: (value: boolean) => void;
|
|
215
|
+
securityBeforeUnload?: boolean;
|
|
216
|
+
}
|
|
217
|
+
export interface IEventParams {
|
|
218
|
+
name: string;
|
|
219
|
+
data?: object;
|
|
220
|
+
validators?: Validator | Validator[];
|
|
221
|
+
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
222
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
223
|
+
onKeyDown?: (event: CustomKeyboardEvent) => void;
|
|
224
|
+
handlerFieldValidate?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
225
|
+
handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => void;
|
|
226
|
+
validatorFromComponent?: Validator | Validator[];
|
|
227
|
+
component?: ComponentType<any>;
|
|
228
|
+
}
|
|
229
|
+
export interface IGetErrorMessagesParams {
|
|
230
|
+
name: string;
|
|
231
|
+
fieldErrors?: {
|
|
232
|
+
[name: string]: string[];
|
|
233
|
+
};
|
|
234
|
+
externalFieldErrors?: {
|
|
235
|
+
[name: string]: string[];
|
|
236
|
+
};
|
|
237
|
+
externalMessagesErrors?: string[];
|
|
238
|
+
}
|
|
239
|
+
export type FieldErrors = {
|
|
240
|
+
[name: string]: string[];
|
|
241
|
+
};
|
|
242
|
+
export type FieldValidator = {
|
|
243
|
+
[name: string]: Validator | Validator[];
|
|
244
|
+
};
|
|
245
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { c as _ } from "../_virtual/compiler-runtime.js";
|
|
3
|
+
import { forwardRef as E, useState as b, useEffect as w } from "react";
|
|
4
|
+
import { FormContext as A, withFieldContext as g, getValidatorsArray as j } from "./helpers.js";
|
|
5
|
+
const k = (R) => {
|
|
6
|
+
const S = (a) => {
|
|
7
|
+
const e = _.c(23), {
|
|
8
|
+
name: o,
|
|
9
|
+
validators: t,
|
|
10
|
+
handlerStoreValidators: n,
|
|
11
|
+
handlerRemoveValidators: i
|
|
12
|
+
} = a, [r, x] = b(void 0);
|
|
13
|
+
let s;
|
|
14
|
+
e[0] !== n || e[1] !== o || e[2] !== r || e[3] !== t ? (s = () => {
|
|
15
|
+
const V = j(t, r);
|
|
16
|
+
V && n && n(o, V);
|
|
17
|
+
}, e[0] = n, e[1] = o, e[2] = r, e[3] = t, e[4] = s) : s = e[4];
|
|
18
|
+
const l = s;
|
|
19
|
+
let f;
|
|
20
|
+
e[5] !== i || e[6] !== o || e[7] !== l || e[8] !== t ? (f = () => (l(), () => {
|
|
21
|
+
t && i && i(o);
|
|
22
|
+
}), e[5] = i, e[6] = o, e[7] = l, e[8] = t, e[9] = f) : f = e[9];
|
|
23
|
+
let d;
|
|
24
|
+
e[10] === Symbol.for("react.memo_cache_sentinel") ? (d = [], e[10] = d) : d = e[10], w(f, d);
|
|
25
|
+
let c;
|
|
26
|
+
e[11] !== l ? (c = () => {
|
|
27
|
+
l();
|
|
28
|
+
}, e[11] = l, e[12] = c) : c = e[12];
|
|
29
|
+
let u;
|
|
30
|
+
e[13] !== t ? (u = [t], e[13] = t, e[14] = u) : u = e[14], w(c, u);
|
|
31
|
+
let h;
|
|
32
|
+
e[15] === Symbol.for("react.memo_cache_sentinel") ? (h = (V) => {
|
|
33
|
+
x(V);
|
|
34
|
+
}, e[15] = h) : h = e[15];
|
|
35
|
+
let C;
|
|
36
|
+
e[16] !== r ? (C = {
|
|
37
|
+
validatorFromComponent: r,
|
|
38
|
+
handlerSetValidatorFromComponent: h
|
|
39
|
+
}, e[16] = r, e[17] = C) : C = e[17];
|
|
40
|
+
const F = C;
|
|
41
|
+
let m;
|
|
42
|
+
e[18] !== a ? (m = /* @__PURE__ */ p(R, { ...a }), e[18] = a, e[19] = m) : m = e[19];
|
|
43
|
+
let v;
|
|
44
|
+
return e[20] !== F || e[21] !== m ? (v = /* @__PURE__ */ p(g.Provider, { value: F, children: m }), e[20] = F, e[21] = m, e[22] = v) : v = e[22], v;
|
|
45
|
+
};
|
|
46
|
+
function y(a, e) {
|
|
47
|
+
return /* @__PURE__ */ p(A.Consumer, { children: ({
|
|
48
|
+
handlerFieldChange: o,
|
|
49
|
+
handlerFieldValidate: t,
|
|
50
|
+
data: n,
|
|
51
|
+
fieldErrors: i,
|
|
52
|
+
externalFieldErrors: r,
|
|
53
|
+
handlerStoreValidators: x,
|
|
54
|
+
handlerRemoveValidators: s,
|
|
55
|
+
skeletonize: l,
|
|
56
|
+
handleValidationErrorsOnTab: f
|
|
57
|
+
}) => /* @__PURE__ */ p(S, { ...a, skeletonize: l, handlerFieldChange: o, handlerFieldValidate: t, handlerStoreValidators: x, handlerRemoveValidators: s, data: n, fieldErrors: i, externalFieldErrors: r, forwardedRef: e, handleValidationErrorsOnTab: f }) });
|
|
58
|
+
}
|
|
59
|
+
return E(y);
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
k as default
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=withFieldHOC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withFieldHOC.js","sources":["../../src/lib/form/withFieldHOC.tsx"],"sourcesContent":["import { ComponentType, forwardRef, Ref, useEffect, useState } from 'react';\nimport { FormContext, withFieldContext, getValidatorsArray } from './helpers';\nimport { IWithFieldContext, Validator, WithFieldProps } from './types';\n\nconst withFieldHOC = <ComponentProps extends WithFieldProps>(\n WrappedComponent: ComponentType<ComponentProps>,\n) => {\n const EnhancedComponent = (props: ComponentProps) => {\n const { name, validators, handlerStoreValidators, handlerRemoveValidators } = props;\n const [validatorFromComponent, setValidatorFromComponent] =\n useState<Validator | Validator[] | undefined>(undefined);\n\n const updateValidators = () => {\n const validatorsArray = getValidatorsArray(validators as Validator, validatorFromComponent);\n if (validatorsArray && handlerStoreValidators) handlerStoreValidators(name, validatorsArray);\n };\n\n useEffect(() => {\n updateValidators();\n\n return () => {\n if (validators && handlerRemoveValidators) handlerRemoveValidators(name);\n };\n }, []);\n\n useEffect(() => {\n updateValidators();\n }, [validators]);\n\n const contextValues: IWithFieldContext = {\n validatorFromComponent,\n handlerSetValidatorFromComponent: (validator: Validator | Validator[]) => {\n setValidatorFromComponent(validator);\n },\n };\n\n return (\n <withFieldContext.Provider value={contextValues}>\n <WrappedComponent {...props} />\n </withFieldContext.Provider>\n );\n };\n\n function forwardedRef(props: ComponentProps, ref: Ref<HTMLElement>) {\n return (\n <FormContext.Consumer>\n {({\n handlerFieldChange,\n handlerFieldValidate: handlerFieldValidate,\n data,\n fieldErrors,\n externalFieldErrors,\n handlerStoreValidators,\n handlerRemoveValidators,\n skeletonize,\n handleValidationErrorsOnTab,\n }) => (\n <EnhancedComponent\n {...props}\n skeletonize={skeletonize}\n handlerFieldChange={handlerFieldChange}\n handlerFieldValidate={handlerFieldValidate}\n handlerStoreValidators={handlerStoreValidators}\n handlerRemoveValidators={handlerRemoveValidators}\n data={data}\n fieldErrors={fieldErrors}\n externalFieldErrors={externalFieldErrors}\n forwardedRef={ref}\n handleValidationErrorsOnTab={handleValidationErrorsOnTab} />\n )}\n </FormContext.Consumer>\n );\n }\n return forwardRef(forwardedRef as any) as any;\n};\n\nexport default withFieldHOC;\n"],"names":["withFieldHOC","WrappedComponent","EnhancedComponent","props","$","_c","name","validators","handlerStoreValidators","handlerRemoveValidators","validatorFromComponent","setValidatorFromComponent","useState","undefined","t0","validatorsArray","getValidatorsArray","updateValidators","t1","t2","Symbol","for","useEffect","t3","t4","t5","validator","t6","handlerSetValidatorFromComponent","contextValues","t7","jsx","t8","withFieldContext","forwardedRef","ref","FormContext","handlerFieldChange","handlerFieldValidate","data","fieldErrors","externalFieldErrors","skeletonize","handleValidationErrorsOnTab","forwardRef"],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { IFormSecurityContext, IWithFormSecurity } from './types';
|
|
3
|
+
declare const FormSecurityContext: import('react').Context<IFormSecurityContext>;
|
|
4
|
+
declare const withFormSecurity: <ComponentProps extends IWithFormSecurity>(WrappedComponent: ComponentType<ComponentProps>) => (props: ComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default withFormSecurity;
|
|
6
|
+
export { FormSecurityContext };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as i, useState as d, createContext as h } from "react";
|
|
3
|
+
const m = h({}), w = (l) => (r) => {
|
|
4
|
+
const {
|
|
5
|
+
onOpenChange: e,
|
|
6
|
+
handlerClose: n
|
|
7
|
+
} = r, c = i(!1), o = i(!1), [f, s] = d(!1), u = () => {
|
|
8
|
+
c.current && o.current ? s(!0) : e ? e(!1) : n && n();
|
|
9
|
+
}, C = {
|
|
10
|
+
onChangedData: (t) => {
|
|
11
|
+
c.current = t;
|
|
12
|
+
},
|
|
13
|
+
showQuestion: f,
|
|
14
|
+
onConfirmClick: () => {
|
|
15
|
+
e && e(!1), n && n();
|
|
16
|
+
},
|
|
17
|
+
onUnconfirmClick: () => {
|
|
18
|
+
s(!1);
|
|
19
|
+
},
|
|
20
|
+
setSecurityBeforeUnload: (t) => {
|
|
21
|
+
o.current = t;
|
|
22
|
+
},
|
|
23
|
+
securityBeforeUnload: o.current
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ a(m.Provider, { value: C, children: /* @__PURE__ */ a(l, { ...r, handlerClose: u }) });
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
m as FormSecurityContext,
|
|
29
|
+
w as default
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=withFormSecurity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withFormSecurity.js","sources":["../../src/lib/form/withFormSecurity.tsx"],"sourcesContent":["import { ComponentType, createContext, useRef, useState } from 'react';\nimport { IFormSecurityContext, IWithFormSecurity } from './types';\n\nconst FormSecurityContext = createContext({} as IFormSecurityContext);\n\nconst withFormSecurity = <ComponentProps extends IWithFormSecurity>(\n WrappedComponent: ComponentType<ComponentProps>,\n) => {\n const EnhancedComponent = (props: ComponentProps) => {\n const { onOpenChange, handlerClose } = props;\n const changedData = useRef(false);\n const securityBeforeUnload = useRef(false);\n const [showQuestion, setShowQuestion] = useState(false);\n\n const newHandlerClose = () => {\n if (changedData.current && securityBeforeUnload.current) {\n setShowQuestion(true);\n } else if (onOpenChange) onOpenChange(false);\n else if (handlerClose) handlerClose();\n };\n\n const onConfirmClick = () => {\n if (onOpenChange) onOpenChange(false);\n if (handlerClose) handlerClose();\n };\n\n const onUnconfirmClick = () => {\n setShowQuestion(false);\n };\n\n const onChangedData = (value: boolean) => {\n changedData.current = value;\n };\n\n const setSecurityBeforeUnload = (value: boolean) => {\n securityBeforeUnload.current = value;\n };\n\n const contextValues: IFormSecurityContext = {\n onChangedData,\n showQuestion,\n onConfirmClick,\n onUnconfirmClick,\n setSecurityBeforeUnload,\n securityBeforeUnload: securityBeforeUnload.current,\n };\n\n return (\n <FormSecurityContext.Provider value={contextValues}>\n <WrappedComponent\n {...props}\n handlerClose={newHandlerClose} />\n </FormSecurityContext.Provider>\n );\n };\n\n return EnhancedComponent;\n};\n\nexport default withFormSecurity;\nexport { FormSecurityContext };\n"],"names":["FormSecurityContext","createContext","withFormSecurity","WrappedComponent","EnhancedComponent","props","onOpenChange","handlerClose","changedData","useRef","securityBeforeUnload","showQuestion","setShowQuestion","useState","newHandlerClose","current","contextValues","onChangedData","value","onConfirmClick","onUnconfirmClick","setSecurityBeforeUnload","jsx"],"mappings":";;AAGA,MAAMA,IAAsBC,EAAc,CAAA,CAA0B,GAE9DC,IAAmB,CACvBC,MAE0BC,CAACC,MAA0B;AACnD,QAAM;AAAA,IAAEC,cAAAA;AAAAA,IAAcC,cAAAA;AAAAA,EAAAA,IAAiBF,GACjCG,IAAcC,EAAO,EAAK,GAC1BC,IAAuBD,EAAO,EAAK,GACnC,CAACE,GAAcC,CAAe,IAAIC,EAAS,EAAK,GAEhDC,IAAkBA,MAAM;AAC5B,IAAIN,EAAYO,WAAWL,EAAqBK,UAC9CH,EAAgB,EAAI,IACXN,IAAcA,EAAa,EAAK,IAClCC,KAAcA,EAAAA;AAAAA,EACzB,GAmBMS,IAAsC;AAAA,IAC1CC,eAToBA,CAACC,MAAmB;AACxCV,MAAAA,EAAYO,UAAUG;AAAAA,IACxB;AAAA,IAQEP,cAAAA;AAAAA,IACAQ,gBApBqBA,MAAM;AAC3B,MAAIb,OAA2B,EAAK,GAChCC,KAAcA,EAAAA;AAAAA,IACpB;AAAA,IAkBEa,kBAhBuBA,MAAM;AAC7BR,MAAAA,EAAgB,EAAK;AAAA,IACvB;AAAA,IAeES,yBAT8BA,CAACH,MAAmB;AAClDR,MAAAA,EAAqBK,UAAUG;AAAAA,IACjC;AAAA,IAQER,sBAAsBA,EAAqBK;AAAAA,EAAAA;AAG7C,SACE,gBAAAO,EAACtB,EAAoB,UAApB,EAA6B,OAAOgB,GACnC,UAAA,gBAAAM,EAACnB,GAAA,EACC,GAAIE,GACJ,cAAcS,EAAAA,CAAgB,EAAA,CAClC;AAEJ;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { DeepPartial } from './types';
|
|
3
|
+
export declare const mergeRefs: <T>(...refs: (Ref<T> | undefined)[]) => (fieldElement: T) => void;
|
|
4
|
+
export declare const deepMergeValues: <T>(current: T, incoming: DeepPartial<T>) => T;
|
|
5
|
+
export declare const flattenValidators: (validators: Record<string, any>, prefix?: string) => Record<string, any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import s from "../_virtual/lodash.js";
|
|
2
|
+
const b = (...o) => (e) => {
|
|
3
|
+
o.forEach((t) => {
|
|
4
|
+
s.isFunction(t) ? t(e) : t && s.isObject(t) && (t.current = e);
|
|
5
|
+
});
|
|
6
|
+
}, f = (o, e) => s.mergeWith(s.cloneDeep(o), e, (t, c) => s.isPlainObject(t) && s.isPlainObject(c) ? void 0 : c), a = (o, e = "") => {
|
|
7
|
+
const t = {};
|
|
8
|
+
return Object.entries(o).forEach(([c, n]) => {
|
|
9
|
+
const i = e ? `${e}.${c}` : c;
|
|
10
|
+
if (Array.isArray(n))
|
|
11
|
+
t[i] = n;
|
|
12
|
+
else if (typeof n == "object" && n !== null) {
|
|
13
|
+
const r = a(n, i);
|
|
14
|
+
Object.assign(t, r);
|
|
15
|
+
} else
|
|
16
|
+
t[i] = [n];
|
|
17
|
+
}), t;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
f as deepMergeValues,
|
|
21
|
+
a as flattenValidators,
|
|
22
|
+
b as mergeRefs
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../src/lib/form2/helpers.ts"],"sourcesContent":["import _ from 'lodash';\nimport { Ref, RefObject } from 'react';\nimport { DeepPartial } from './types';\n\nexport const mergeRefs = <T>(...refs: (Ref<T> | undefined)[]) => {\n return (fieldElement: T) => {\n refs.forEach((ref) => {\n if (_.isFunction(ref)) ref(fieldElement);\n else if (ref && _.isObject(ref)) (ref as RefObject<T | null>).current = fieldElement;\n });\n };\n};\n\nexport const deepMergeValues = <T>(current: T, incoming: DeepPartial<T>): T => {\n return _.mergeWith(_.cloneDeep(current), incoming, (objValue, srcValue) =>\n _.isPlainObject(objValue) && _.isPlainObject(srcValue) ? undefined : srcValue);\n};\n\nexport const flattenValidators = (validators: Record<string, any>, prefix = ''): Record<string, any> => {\n const flattened: Record<string, any> = {};\n Object.entries(validators).forEach(([key, value]) => {\n const fullPath = prefix ? `${prefix}.${key}` : key;\n if (Array.isArray(value)) {\n flattened[fullPath] = value;\n } else if (typeof value === 'object' && value !== null) {\n const nestedFlattened = flattenValidators(value, fullPath);\n Object.assign(flattened, nestedFlattened);\n } else {\n flattened[fullPath] = [value];\n }\n });\n\n return flattened;\n};\n"],"names":["mergeRefs","refs","fieldElement","forEach","ref","_","isFunction","isObject","current","deepMergeValues","incoming","mergeWith","cloneDeep","objValue","srcValue","isPlainObject","undefined","flattenValidators","validators","prefix","flattened","Object","entries","key","value","fullPath","Array","isArray","nestedFlattened","assign"],"mappings":";AAIO,MAAMA,IAAY,IAAOC,MACvB,CAACC,MAAoB;AAC1BD,EAAAA,EAAKE,QAASC,CAAAA,MAAQ;AACpB,IAAIC,EAAEC,WAAWF,CAAG,MAAOF,CAAY,IAC9BE,KAAOC,EAAEE,SAASH,CAAG,MAAIA,EAA4BI,UAAUN;AAAAA,EAC1E,CAAC;AACH,GAGWO,IAAkB,CAAID,GAAYE,MACtCL,EAAEM,UAAUN,EAAEO,UAAUJ,CAAO,GAAGE,GAAU,CAACG,GAAUC,MAC5DT,EAAEU,cAAcF,CAAQ,KAAKR,EAAEU,cAAcD,CAAQ,IAAIE,SAAYF,CAAQ,GAGpEG,IAAoBA,CAACC,GAAiCC,IAAS,OAA4B;AACtG,QAAMC,IAAiC,CAAA;AACvCC,gBAAOC,QAAQJ,CAAU,EAAEf,QAAQ,CAAC,CAACoB,GAAKC,CAAK,MAAM;AACnD,UAAMC,IAAWN,IAAS,GAAGA,CAAM,IAAII,CAAG,KAAKA;AAC/C,QAAIG,MAAMC,QAAQH,CAAK;AACrBJ,MAAAA,EAAUK,CAAQ,IAAID;AAAAA,aACb,OAAOA,KAAU,YAAYA,MAAU,MAAM;AACtD,YAAMI,IAAkBX,EAAkBO,GAAOC,CAAQ;AACzDJ,aAAOQ,OAAOT,GAAWQ,CAAe;AAAA,IAC1C;AACER,MAAAA,EAAUK,CAAQ,IAAI,CAACD,CAAK;AAAA,EAEhC,CAAC,GAEMJ;AACT;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { default as useForm } from './useForm';
|
|
3
|
+
interface FormElementProps extends ComponentProps<'form'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Form: import('react').ForwardRefExoticComponent<Omit<FormElementProps, "ref"> & import('react').RefAttributes<HTMLFormElement>>;
|
|
6
|
+
export default Form;
|
|
7
|
+
export { useForm };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as d } from "../_virtual/compiler-runtime.js";
|
|
3
|
+
import { forwardRef as u } from "react";
|
|
4
|
+
import { default as R } from "./useForm/index.js";
|
|
5
|
+
const p = u((m, s) => {
|
|
6
|
+
const t = d.c(11);
|
|
7
|
+
let o, e, a, r;
|
|
8
|
+
t[0] !== m ? ({
|
|
9
|
+
noValidate: e,
|
|
10
|
+
autoComplete: a,
|
|
11
|
+
translate: r,
|
|
12
|
+
...o
|
|
13
|
+
} = m, t[0] = m, t[1] = o, t[2] = e, t[3] = a, t[4] = r) : (o = t[1], e = t[2], a = t[3], r = t[4]);
|
|
14
|
+
const i = e === void 0 ? !0 : e, n = a === void 0 ? "off" : a, f = r === void 0 ? "no" : r;
|
|
15
|
+
let l;
|
|
16
|
+
return t[5] !== n || t[6] !== i || t[7] !== s || t[8] !== o || t[9] !== f ? (l = /* @__PURE__ */ c("form", { ref: s, className: "form-container", translate: f, noValidate: i, autoComplete: n, ...o }), t[5] = n, t[6] = i, t[7] = s, t[8] = o, t[9] = f, t[10] = l) : l = t[10], l;
|
|
17
|
+
});
|
|
18
|
+
p.displayName = "Form";
|
|
19
|
+
export {
|
|
20
|
+
p as default,
|
|
21
|
+
R as useForm
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/lib/form2/index.tsx"],"sourcesContent":["import { ComponentProps, forwardRef } from 'react';\nimport useForm from './useForm';\n\ninterface FormElementProps extends ComponentProps<'form'> { }\n\nconst Form = forwardRef<HTMLFormElement, FormElementProps>((props, ref) => {\n const { noValidate = true, autoComplete = 'off', translate = 'no', ...rest } = props;\n\n return (\n <form\n ref={ref}\n className=\"form-container\"\n translate={translate}\n noValidate={noValidate}\n autoComplete={autoComplete}\n {...rest} />\n );\n});\n\nForm.displayName = 'Form';\n\nexport default Form;\nexport { useForm };\n"],"names":["Form","forwardRef","props","ref","$","_c","rest","t0","t1","t2","noValidate","autoComplete","translate","undefined","t3","jsx","displayName"],"mappings":";;;;AAKA,MAAMA,IAAOC,EAA8C,CAAAC,GAAAC,MAAA;AAAA,QAAAC,IAAAC,EAAAA,EAAA,EAAA;AAAA,MAAAC,GAAAC,GAAAC,GAAAC;AAAA,EAAAL,SAAAF,KACzD;AAAA,IAAAQ,YAAAH;AAAAA,IAAAI,cAAAH;AAAAA,IAAAI,WAAAH;AAAAA,IAAA,GAAAH;AAAAA,EAAAA,IAA+EJ,GAAME,OAAAF,GAAAE,OAAAE,GAAAF,OAAAG,GAAAH,OAAAI,GAAAJ,OAAAK,MAAAH,IAAAF,EAAA,CAAA,GAAAG,IAAAH,EAAA,CAAA,GAAAI,IAAAJ,EAAA,CAAA,GAAAK,IAAAL,EAAA,CAAA;AAA7E,QAAAM,IAAAH,MAAAM,SAAA,KAAAN,GAAmBI,IAAAH,MAAAK,SAAA,QAAAL,GAAsBI,IAAAH,MAAAI,SAAA,OAAAJ;AAAgB,MAAAK;AAAA,SAAAV,EAAA,CAAA,MAAAO,KAAAP,EAAA,CAAA,MAAAM,KAAAN,EAAA,CAAA,MAAAD,KAAAC,EAAA,CAAA,MAAAE,KAAAF,SAAAQ,KAG/DE,IAAA,gBAAAC,EAAA,UACOZ,KAAAA,GACK,WAAA,kBACCS,WAAAA,GACCF,YAAAA,GACEC,cAAAA,GAAY,GACtBL,EAAAA,CAAI,GAAIF,OAAAO,GAAAP,OAAAM,GAAAN,OAAAD,GAAAC,OAAAE,GAAAF,OAAAQ,GAAAR,QAAAU,KAAAA,IAAAV,EAAA,EAAA,GANdU;AAMc,CAEjB;AAEDd,EAAKgB,cAAc;"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ChangeEvent, ChangeEventHandler, FocusEvent, FocusEventHandler, FormEvent, Ref, RefCallback } from 'react';
|
|
2
|
+
export type DeepPartial<T> = {
|
|
3
|
+
[K in keyof T]?: T[K] extends Array<infer U> ? Array<DeepPartial<U>> : T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
4
|
+
};
|
|
5
|
+
export type NestedState<T, R = any> = {
|
|
6
|
+
[K in keyof T]?: [T[K]] extends [readonly any[]] ? R : T[K] extends object ? NestedState<T[K], R> : R;
|
|
7
|
+
};
|
|
8
|
+
export type FieldChanged<T> = NestedState<T, boolean>;
|
|
9
|
+
export type FieldTouched<T> = NestedState<T, boolean>;
|
|
10
|
+
export type FieldErrors<T> = NestedState<T, string[]>;
|
|
11
|
+
export type FieldFocusOptions = Partial<{
|
|
12
|
+
shouldSelect: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export type ValidatorFunction<T> = (value: T, data?: Record<string, any>) => string | null;
|
|
15
|
+
export type ValidatorsSchema = Record<string, ValidatorFunction<any>[]>;
|
|
16
|
+
export type ValidationMode = 'default' | 'onSubmit';
|
|
17
|
+
export type UseFormOptionsProps = Partial<{
|
|
18
|
+
validationMode: ValidationMode;
|
|
19
|
+
}>;
|
|
20
|
+
export type RegisterFunction = (name: string, externalRef?: Ref<HTMLInputElement>) => {
|
|
21
|
+
name: string;
|
|
22
|
+
value: any;
|
|
23
|
+
ref: (fieldElement: HTMLInputElement) => void;
|
|
24
|
+
onBlur: () => void;
|
|
25
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
26
|
+
};
|
|
27
|
+
export type RegisterOptions = {
|
|
28
|
+
onChange?: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
29
|
+
onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
30
|
+
ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
31
|
+
};
|
|
32
|
+
export interface UseFormProps<T> {
|
|
33
|
+
initialValues: T;
|
|
34
|
+
validators?: ValidatorsSchema;
|
|
35
|
+
options?: UseFormOptionsProps;
|
|
36
|
+
}
|
|
37
|
+
export interface UseFormReturn<T> {
|
|
38
|
+
/**
|
|
39
|
+
* Reseta os campos especificados ou todo o formulário para seus valores iniciais.
|
|
40
|
+
* Também limpa estados de `errors`, `touched` e `changed`.
|
|
41
|
+
* @param fields - Lista de nomes de campos a serem resetados. Se não informado, todos os campos são resetados.
|
|
42
|
+
*/
|
|
43
|
+
reset: (fields?: string[]) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Objeto que indica quais campos foram modificados em relação ao `initialValues`.
|
|
46
|
+
*/
|
|
47
|
+
changed: FieldChanged<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Objeto com os valores atuais dos campos do formulário.
|
|
50
|
+
*/
|
|
51
|
+
values: Record<string, any>;
|
|
52
|
+
/**
|
|
53
|
+
* Objeto contendo arrays de mensagens de erro por campo.
|
|
54
|
+
*/
|
|
55
|
+
errors: FieldErrors<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Objeto que indica se os campos foram tocados (interagidos via blur).
|
|
58
|
+
*/
|
|
59
|
+
touched: FieldTouched<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Indica se o formulário está válido com base nos validadores definidos.
|
|
62
|
+
*/
|
|
63
|
+
isValid: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Indica se houve alguma alteração em qualquer campo do formulário em relação ao `initialValues`.
|
|
66
|
+
*/
|
|
67
|
+
formHasChange: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Registra um campo no formulário, integrando com `ref`, `value`, `onChange` e `onBlur`.
|
|
70
|
+
* @param name - Nome do campo.
|
|
71
|
+
* @param registerOptions - Opções de registro, incluindo referências e manipuladores de eventos.
|
|
72
|
+
*/
|
|
73
|
+
register: (name: string, registerOptions?: RegisterOptions) => {
|
|
74
|
+
name: string;
|
|
75
|
+
ref: RefCallback<HTMLInputElement | HTMLTextAreaElement>;
|
|
76
|
+
value: any;
|
|
77
|
+
onBlur: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
78
|
+
onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Limpa mensagens de erro de campos especificados, ou de todos os campos se nenhum for informado.
|
|
82
|
+
* @param fields - Lista de campos a limpar.
|
|
83
|
+
*/
|
|
84
|
+
cleanErrors: (fields?: string[]) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Altera os valores dos campos do formulário com base em dados externos (ex: dados assíncronos).
|
|
87
|
+
* Preserva os dados atuais para campos não especificados.
|
|
88
|
+
* @param values - Novo objeto de dados com valores para atualizar no estado do formulário.
|
|
89
|
+
*/
|
|
90
|
+
changeValues: (values: DeepPartial<T>) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Compara o valor atual de um campo com um valor fornecido, retornando true se forem iguais.
|
|
93
|
+
* @param name - Nome do campo.
|
|
94
|
+
* @param value - Valor a ser comparado.
|
|
95
|
+
*/
|
|
96
|
+
compareField: (name: string, value: any) => boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Gera uma função de submit que é executada ao chamar a callback fornecida.
|
|
99
|
+
* @param callback - Função de submit executada em caso de formulário válido e retornando objeto de valores do formulário.
|
|
100
|
+
*/
|
|
101
|
+
handleSubmit: (callback: (data: T) => void) => (event: FormEvent) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Retorna o valor atual de um campo específico.
|
|
104
|
+
* @param name - Nome do campo.
|
|
105
|
+
*/
|
|
106
|
+
getFieldValue: (name: string) => any;
|
|
107
|
+
/**
|
|
108
|
+
* Retorna as mensagens de erro associadas a um campo específico.
|
|
109
|
+
* @param name - Nome do campo.
|
|
110
|
+
*/
|
|
111
|
+
getFieldError: (name: string) => string[];
|
|
112
|
+
/**
|
|
113
|
+
* Define o foco programaticamente em um campo registrado.
|
|
114
|
+
* @param name - Nome do campo.
|
|
115
|
+
* @param options - Opções adicionais como selecionar o texto ao focar.
|
|
116
|
+
*/
|
|
117
|
+
setFieldFocus: (name: string, options?: FieldFocusOptions) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Atualiza o valor de um campo específico e dispara validações quando apropriado.
|
|
120
|
+
* @param name - Nome do campo.
|
|
121
|
+
* @param value - Novo valor.
|
|
122
|
+
*/
|
|
123
|
+
setFieldValue: (name: string, value: any) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Objeto original passado como `initialValues`. Utilizado para reset e comparações.
|
|
126
|
+
*/
|
|
127
|
+
initialValues: Record<string, any>;
|
|
128
|
+
/**
|
|
129
|
+
* Define erros manualmente em campos do formulário, útil para erros externos (ex: backend).
|
|
130
|
+
* @param errors - Objeto contendo mensagens de erro para campos.
|
|
131
|
+
*/
|
|
132
|
+
setExternalErrors: (errors: Record<string, string[]>) => void;
|
|
133
|
+
}
|