@oneblink/apps-react 2.3.0-beta.2 → 2.3.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/dist/OneBlinkAutoSaveForm.d.ts +10 -10
- package/dist/OneBlinkAutoSaveForm.js +28 -28
- package/dist/OneBlinkForm.d.ts +11 -11
- package/dist/OneBlinkForm.js +11 -11
- package/dist/OneBlinkFormBase.d.ts +29 -28
- package/dist/OneBlinkFormBase.js +476 -472
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/OneBlinkReadOnlyForm.d.ts +11 -11
- package/dist/OneBlinkReadOnlyForm.js +48 -48
- package/dist/components/CopyToClipboardIconButton.d.ts +10 -10
- package/dist/components/CopyToClipboardIconButton.js +32 -32
- package/dist/components/CustomAccordion.d.ts +27 -27
- package/dist/components/CustomAccordion.js +37 -37
- package/dist/components/ErrorSnackbar.d.ts +8 -8
- package/dist/components/ErrorSnackbar.js +25 -25
- package/dist/components/Lists.d.ts +25 -25
- package/dist/components/Lists.js +44 -44
- package/dist/components/LoadingWithMessage.d.ts +6 -6
- package/dist/components/LoadingWithMessage.js +11 -11
- package/dist/components/formStore/FormStoreTableProvider.d.ts +6 -6
- package/dist/components/formStore/FormStoreTableProvider.js +90 -90
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +19 -19
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +66 -66
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +86 -86
- package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -8
- package/dist/components/formStore/OneBlinkFormStoreProvider.js +24 -24
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -5
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +11 -11
- package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -4
- package/dist/components/formStore/OneBlinkFormStoreTable.js +194 -194
- package/dist/components/formStore/display/ElementDisplay.d.ts +23 -23
- package/dist/components/formStore/display/ElementDisplay.js +77 -77
- package/dist/components/formStore/display/FormStoreIcon.d.ts +2 -2
- package/dist/components/formStore/display/FormStoreIcon.js +2 -2
- package/dist/components/formStore/table/ActionedByTableCell.d.ts +11 -11
- package/dist/components/formStore/table/ActionedByTableCell.js +43 -43
- package/dist/components/formStore/table/ColumnFilters.d.ts +9 -9
- package/dist/components/formStore/table/ColumnFilters.js +179 -179
- package/dist/components/formStore/table/FormElementTableCell.d.ts +10 -10
- package/dist/components/formStore/table/FormElementTableCell.js +228 -228
- package/dist/components/formStore/table/HeaderCellMoreButton.d.ts +9 -9
- package/dist/components/formStore/table/HeaderCellMoreButton.js +48 -48
- package/dist/components/formStore/table/RepeatableSetCell.d.ts +8 -8
- package/dist/components/formStore/table/RepeatableSetCell.js +62 -62
- package/dist/components/formStore/table/RepeatableSetCellAccordion.d.ts +9 -9
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js +11 -11
- package/dist/components/formStore/table/TableCellCopyButton.d.ts +7 -7
- package/dist/components/formStore/table/TableCellCopyButton.js +27 -27
- package/dist/components/formStore/table/generateColumns.d.ts +24 -24
- package/dist/components/formStore/table/generateColumns.js +290 -290
- package/dist/components/formStore/table/useFormStoreTable.d.ts +52 -52
- package/dist/components/formStore/table/useFormStoreTable.js +157 -157
- package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -44
- package/dist/components/formStore/useFormStoreTableContext.js +9 -9
- package/dist/components/messages/ErrorMessage.d.ts +12 -12
- package/dist/components/messages/ErrorMessage.js +12 -12
- package/dist/components/messages/LargeIconMessage.d.ts +18 -18
- package/dist/components/messages/LargeIconMessage.js +33 -33
- package/dist/components/messages/NoResourcesYet.d.ts +11 -11
- package/dist/components/messages/NoResourcesYet.js +6 -6
- package/dist/components/pickers/V4CompatibleDatePicker.d.ts +32 -32
- package/dist/components/pickers/V4CompatibleDatePicker.js +70 -70
- package/dist/components/pickers/V4CompatibleDateTimePicker.d.ts +32 -32
- package/dist/components/pickers/V4CompatibleDateTimePicker.js +70 -70
- package/dist/components/pickers/V4CompatibleTimePicker.d.ts +28 -28
- package/dist/components/pickers/V4CompatibleTimePicker.js +53 -53
- package/dist/components/renderer/AnnotationModal.d.ts +8 -8
- package/dist/components/renderer/AnnotationModal.js +101 -101
- package/dist/components/renderer/AutocompleteDropdown.d.ts +26 -26
- package/dist/components/renderer/AutocompleteDropdown.js +175 -175
- package/dist/components/renderer/CopyToClipboardButton.d.ts +8 -8
- package/dist/components/renderer/CopyToClipboardButton.js +13 -13
- package/dist/components/renderer/CustomisableButtonInner.d.ts +7 -7
- package/dist/components/renderer/CustomisableButtonInner.js +8 -8
- package/dist/components/renderer/FormElementLabelContainer.d.ts +12 -12
- package/dist/components/renderer/FormElementLabelContainer.js +15 -15
- package/dist/components/renderer/FormElementOptions.d.ts +9 -9
- package/dist/components/renderer/FormElementOptions.js +14 -14
- package/dist/components/renderer/LookupButton.d.ts +10 -10
- package/dist/components/renderer/LookupButton.js +29 -29
- package/dist/components/renderer/LookupNotification.d.ts +12 -12
- package/dist/components/renderer/LookupNotification.js +230 -230
- package/dist/components/renderer/Modal.d.ts +14 -14
- package/dist/components/renderer/Modal.js +14 -14
- package/dist/components/renderer/OnLoading.d.ts +10 -10
- package/dist/components/renderer/OnLoading.js +11 -11
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.d.ts +7 -7
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js +12 -12
- package/dist/components/renderer/OneBlinkFormElements.d.ts +19 -19
- package/dist/components/renderer/OneBlinkFormElements.js +202 -202
- package/dist/components/renderer/PageFormElements.d.ts +17 -17
- package/dist/components/renderer/PageFormElements.js +48 -48
- package/dist/components/renderer/ProgressBar.d.ts +7 -7
- package/dist/components/renderer/ProgressBar.js +6 -6
- package/dist/components/renderer/ProgressBar.js.map +1 -1
- package/dist/components/renderer/ToggleAllCheckbox.d.ts +13 -13
- package/dist/components/renderer/ToggleAllCheckbox.js +26 -26
- package/dist/components/renderer/attachments/AttachmentStatus.d.ts +10 -10
- package/dist/components/renderer/attachments/AttachmentStatus.js +36 -36
- package/dist/components/renderer/attachments/FileCard.d.ts +19 -19
- package/dist/components/renderer/attachments/FileCard.js +60 -60
- package/dist/components/renderer/attachments/FileCardContent.d.ts +5 -5
- package/dist/components/renderer/attachments/FileCardContent.js +10 -10
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.d.ts +4 -4
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js +11 -11
- package/dist/components/renderer/attachments/ProgressBar.d.ts +8 -8
- package/dist/components/renderer/attachments/ProgressBar.js +33 -33
- package/dist/form-elements/ComplianceButton.d.ts +10 -10
- package/dist/form-elements/ComplianceButton.js +11 -11
- package/dist/form-elements/FormElementABN.d.ts +14 -14
- package/dist/form-elements/FormElementABN.js +155 -155
- package/dist/form-elements/FormElementAutocomplete.d.ts +19 -19
- package/dist/form-elements/FormElementAutocomplete.js +81 -81
- package/dist/form-elements/FormElementBSB.d.ts +18 -18
- package/dist/form-elements/FormElementBSB.js +100 -100
- package/dist/form-elements/FormElementBarcodeScanner.d.ts +14 -14
- package/dist/form-elements/FormElementBarcodeScanner.js +306 -306
- package/dist/form-elements/FormElementBoolean.d.ts +14 -14
- package/dist/form-elements/FormElementBoolean.js +16 -16
- package/dist/form-elements/FormElementCalculation.d.ts +11 -11
- package/dist/form-elements/FormElementCalculation.js +179 -179
- package/dist/form-elements/FormElementCamera.d.ts +15 -15
- package/dist/form-elements/FormElementCamera.js +227 -227
- package/dist/form-elements/FormElementCaptcha.d.ts +12 -12
- package/dist/form-elements/FormElementCaptcha.js +14 -14
- package/dist/form-elements/FormElementCheckBoxes.d.ts +15 -15
- package/dist/form-elements/FormElementCheckBoxes.js +64 -64
- package/dist/form-elements/FormElementCivicaNameRecord.d.ts +8 -8
- package/dist/form-elements/FormElementCivicaNameRecord.js +51 -51
- package/dist/form-elements/FormElementCivicaStreetName.d.ts +15 -15
- package/dist/form-elements/FormElementCivicaStreetName.js +38 -38
- package/dist/form-elements/FormElementCompliance.d.ts +22 -22
- package/dist/form-elements/FormElementCompliance.js +129 -129
- package/dist/form-elements/FormElementDate.d.ts +14 -14
- package/dist/form-elements/FormElementDate.js +74 -74
- package/dist/form-elements/FormElementDateTime.d.ts +14 -14
- package/dist/form-elements/FormElementDateTime.js +67 -67
- package/dist/form-elements/FormElementEmail.d.ts +14 -14
- package/dist/form-elements/FormElementEmail.js +22 -22
- package/dist/form-elements/FormElementFile.d.ts +13 -13
- package/dist/form-elements/FormElementFile.js +31 -31
- package/dist/form-elements/FormElementFiles.d.ts +15 -15
- package/dist/form-elements/FormElementFiles.js +42 -42
- package/dist/form-elements/FormElementForm.d.ts +17 -17
- package/dist/form-elements/FormElementForm.js +63 -63
- package/dist/form-elements/FormElementFreshdeskDependentField.d.ts +8 -8
- package/dist/form-elements/FormElementFreshdeskDependentField.js +15 -15
- package/dist/form-elements/FormElementGeoscapeAddress.d.ts +15 -15
- package/dist/form-elements/FormElementGeoscapeAddress.js +62 -62
- package/dist/form-elements/FormElementHTML.d.ts +8 -8
- package/dist/form-elements/FormElementHTML.js +15 -15
- package/dist/form-elements/FormElementHeading.d.ts +8 -8
- package/dist/form-elements/FormElementHeading.js +23 -23
- package/dist/form-elements/FormElementImage.d.ts +8 -8
- package/dist/form-elements/FormElementImage.js +6 -6
- package/dist/form-elements/FormElementLocation.d.ts +20 -20
- package/dist/form-elements/FormElementLocation.js +204 -204
- package/dist/form-elements/FormElementNumber.d.ts +14 -14
- package/dist/form-elements/FormElementNumber.js +72 -72
- package/dist/form-elements/FormElementPointAddress.d.ts +15 -15
- package/dist/form-elements/FormElementPointAddress.js +69 -69
- package/dist/form-elements/FormElementRadio.d.ts +15 -15
- package/dist/form-elements/FormElementRadio.js +41 -41
- package/dist/form-elements/FormElementRepeatableSet.d.ts +19 -19
- package/dist/form-elements/FormElementRepeatableSet.js +126 -126
- package/dist/form-elements/FormElementSection.d.ts +8 -8
- package/dist/form-elements/FormElementSection.js +69 -69
- package/dist/form-elements/FormElementSelect.d.ts +15 -15
- package/dist/form-elements/FormElementSelect.js +44 -44
- package/dist/form-elements/FormElementSignature.d.ts +15 -15
- package/dist/form-elements/FormElementSignature.js +138 -138
- package/dist/form-elements/FormElementSummary.d.ts +11 -11
- package/dist/form-elements/FormElementSummary.js +159 -159
- package/dist/form-elements/FormElementTelephone.d.ts +14 -14
- package/dist/form-elements/FormElementTelephone.js +22 -22
- package/dist/form-elements/FormElementText.d.ts +14 -14
- package/dist/form-elements/FormElementText.js +29 -29
- package/dist/form-elements/FormElementTextarea.d.ts +14 -14
- package/dist/form-elements/FormElementTextarea.js +30 -30
- package/dist/form-elements/FormElementTime.d.ts +14 -14
- package/dist/form-elements/FormElementTime.js +53 -53
- package/dist/form-elements/OptionButton.d.ts +11 -11
- package/dist/form-elements/OptionButton.js +9 -9
- package/dist/hooks/attachments/useAttachment.d.ts +12 -12
- package/dist/hooks/attachments/useAttachment.js +242 -242
- package/dist/hooks/attachments/useAttachmentBlobs.d.ts +19 -19
- package/dist/hooks/attachments/useAttachmentBlobs.js +23 -23
- package/dist/hooks/attachments/useAttachments.d.ts +10 -10
- package/dist/hooks/attachments/useAttachments.js +69 -69
- package/dist/hooks/useAbnLookupAuthenticationGuid.d.ts +3 -3
- package/dist/hooks/useAbnLookupAuthenticationGuid.js +5 -5
- package/dist/hooks/useAuth.d.ts +15 -15
- package/dist/hooks/useAuth.js +42 -42
- package/dist/hooks/useBooleanState.d.ts +5 -5
- package/dist/hooks/useBooleanState.js +8 -8
- package/dist/hooks/useCaptchaSiteKey.d.ts +3 -3
- package/dist/hooks/useCaptchaSiteKey.js +5 -5
- package/dist/hooks/useClickOutsideElement.d.ts +3 -3
- package/dist/hooks/useClickOutsideElement.js +14 -14
- package/dist/hooks/useConditionalLogic.d.ts +6 -6
- package/dist/hooks/useConditionalLogic.js +22 -22
- package/dist/hooks/useContrastColor.d.ts +2 -2
- package/dist/hooks/useContrastColor.js +12 -12
- package/dist/hooks/useDynamicOptionsLoaderState.d.ts +7 -7
- package/dist/hooks/useDynamicOptionsLoaderState.js +44 -44
- package/dist/hooks/useExecutedLookupCallback.d.ts +12 -12
- package/dist/hooks/useExecutedLookupCallback.js +15 -15
- package/dist/hooks/useFlatpickr.d.ts +10 -10
- package/dist/hooks/useFlatpickr.js +73 -73
- package/dist/hooks/useFlatpickrGuid.d.ts +7 -7
- package/dist/hooks/useFlatpickrGuid.js +11 -11
- package/dist/hooks/useFlattenElementsContext.d.ts +2 -2
- package/dist/hooks/useFlattenElementsContext.js +7 -7
- package/dist/hooks/useFormDefinition.d.ts +4 -4
- package/dist/hooks/useFormDefinition.js +9 -9
- package/dist/hooks/useFormElementOptions.d.ts +9 -9
- package/dist/hooks/useFormElementOptions.js +35 -35
- package/dist/hooks/useFormIsReadOnly.d.ts +3 -3
- package/dist/hooks/useFormIsReadOnly.js +5 -5
- package/dist/hooks/useFormSubmissionAutoSaveState.d.ts +24 -24
- package/dist/hooks/useFormSubmissionAutoSaveState.js +145 -145
- package/dist/hooks/useFormSubmissionModelContext.d.ts +15 -15
- package/dist/hooks/useFormSubmissionModelContext.js +32 -32
- package/dist/hooks/useFormSubmissionState.d.ts +10 -10
- package/dist/hooks/useFormSubmissionState.js +13 -13
- package/dist/hooks/useFormValidation.d.ts +7 -7
- package/dist/hooks/useFormValidation.js +29 -29
- package/dist/hooks/useGoogleMapsApiKey.d.ts +3 -3
- package/dist/hooks/useGoogleMapsApiKey.js +5 -5
- package/dist/hooks/useInfiniteScrollDataLoad.d.ts +30 -30
- package/dist/hooks/useInfiniteScrollDataLoad.js +124 -124
- package/dist/hooks/useInjectPages.d.ts +7 -7
- package/dist/hooks/useInjectPages.js +5 -5
- package/dist/hooks/useIsHovering.d.ts +5 -5
- package/dist/hooks/useIsHovering.js +12 -12
- package/dist/hooks/useIsMounted.d.ts +3 -3
- package/dist/hooks/useIsMounted.js +11 -11
- package/dist/hooks/useIsOffline.d.ts +6 -6
- package/dist/hooks/useIsOffline.js +26 -26
- package/dist/hooks/useIsPageVisible.d.ts +9 -9
- package/dist/hooks/useIsPageVisible.js +8 -8
- package/dist/hooks/useLoadDataState.d.ts +15 -15
- package/dist/hooks/useLoadDataState.js +54 -54
- package/dist/hooks/useLogin.d.ts +46 -46
- package/dist/hooks/useLogin.js +295 -295
- package/dist/hooks/useLookupNotification.d.ts +9 -9
- package/dist/hooks/useLookupNotification.js +10 -10
- package/dist/hooks/useLookups.d.ts +5 -5
- package/dist/hooks/useLookups.js +62 -62
- package/dist/hooks/useNullableState.d.ts +2 -2
- package/dist/hooks/useNullableState.js +6 -6
- package/dist/hooks/usePages.d.ts +24 -24
- package/dist/hooks/usePages.js +141 -141
- package/dist/hooks/useQuery.d.ts +2 -2
- package/dist/hooks/useQuery.js +7 -7
- package/dist/hooks/useSubmissionIdIsValid.d.ts +3 -3
- package/dist/hooks/useSubmissionIdIsValid.js +19 -19
- package/dist/hooks/useToggleComplianceChildren.d.ts +3 -3
- package/dist/hooks/useToggleComplianceChildren.js +13 -13
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -23
- package/dist/services/attachments.d.ts +10 -10
- package/dist/services/attachments.js +72 -72
- package/dist/services/barcode-readers/quagger.d.ts +1 -1
- package/dist/services/barcode-readers/quagger.js +34 -34
- package/dist/services/blob-utils.d.ts +5 -5
- package/dist/services/blob-utils.js +73 -73
- package/dist/services/checkBsbsAreInvalid.d.ts +3 -3
- package/dist/services/checkBsbsAreInvalid.js +40 -40
- package/dist/services/checkIfAttachmentsExist.d.ts +5 -5
- package/dist/services/checkIfAttachmentsExist.js +144 -144
- package/dist/services/checkIfBsbsAreValidating.d.ts +3 -3
- package/dist/services/checkIfBsbsAreValidating.js +40 -40
- package/dist/services/cleanFormSubmissionModel.d.ts +6 -6
- package/dist/services/cleanFormSubmissionModel.js +203 -203
- package/dist/services/defaultCoordinates.d.ts +5 -5
- package/dist/services/defaultCoordinates.js +8 -8
- package/dist/services/download-file.d.ts +3 -3
- package/dist/services/download-file.js +90 -90
- package/dist/services/drawTimestampOnCanvas.d.ts +1 -1
- package/dist/services/drawTimestampOnCanvas.js +22 -22
- package/dist/services/form-validation.d.ts +10 -10
- package/dist/services/form-validation.js +561 -561
- package/dist/services/generate-default-data.d.ts +13 -13
- package/dist/services/generate-default-data.js +494 -494
- package/dist/services/generateCivicaNameRecordElements.d.ts +2 -2
- package/dist/services/generateCivicaNameRecordElements.js +140 -140
- package/dist/services/generateFreshdeskDependentFieldElements.d.ts +2 -2
- package/dist/services/generateFreshdeskDependentFieldElements.js +69 -69
- package/dist/services/sanitize-html.d.ts +2 -2
- package/dist/services/sanitize-html.js +20 -20
- package/dist/services/scrolling-service.d.ts +7 -7
- package/dist/services/scrolling-service.js +38 -38
- package/dist/services/utils-service.d.ts +5 -5
- package/dist/services/utils-service.js +16 -16
- package/dist/types/attachments.d.ts +19 -19
- package/dist/types/attachments.js +1 -1
- package/dist/types/form.d.ts +40 -40
- package/dist/types/form.js +2 -2
- package/package.json +2 -2
- package/dist/OneBlinkFormStoreView.d.ts +0 -8
- package/dist/OneBlinkFormStoreView.js +0 -55
- package/dist/OneBlinkFormStoreView.js.map +0 -1
- package/dist/components/AnnotationModal.d.ts +0 -8
- package/dist/components/AnnotationModal.js +0 -104
- package/dist/components/AnnotationModal.js.map +0 -1
- package/dist/components/AutocompleteDropdown.d.ts +0 -26
- package/dist/components/AutocompleteDropdown.js +0 -174
- package/dist/components/AutocompleteDropdown.js.map +0 -1
- package/dist/components/CopyToClipboardButton.d.ts +0 -9
- package/dist/components/CopyToClipboardButton.js +0 -14
- package/dist/components/CopyToClipboardButton.js.map +0 -1
- package/dist/components/CustomisableButtonInner.d.ts +0 -7
- package/dist/components/CustomisableButtonInner.js +0 -9
- package/dist/components/CustomisableButtonInner.js.map +0 -1
- package/dist/components/ErrorMessage.d.ts +0 -13
- package/dist/components/ErrorMessage.js +0 -13
- package/dist/components/ErrorMessage.js.map +0 -1
- package/dist/components/FormElementLabelContainer.d.ts +0 -12
- package/dist/components/FormElementLabelContainer.js +0 -16
- package/dist/components/FormElementLabelContainer.js.map +0 -1
- package/dist/components/FormElementOptions.d.ts +0 -9
- package/dist/components/FormElementOptions.js +0 -15
- package/dist/components/FormElementOptions.js.map +0 -1
- package/dist/components/LookupButton.d.ts +0 -10
- package/dist/components/LookupButton.js +0 -30
- package/dist/components/LookupButton.js.map +0 -1
- package/dist/components/LookupNotification.d.ts +0 -12
- package/dist/components/LookupNotification.js +0 -231
- package/dist/components/LookupNotification.js.map +0 -1
- package/dist/components/Modal.d.ts +0 -14
- package/dist/components/Modal.js +0 -15
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/NoResourcesYet.d.ts +0 -12
- package/dist/components/NoResourcesYet.js +0 -7
- package/dist/components/NoResourcesYet.js.map +0 -1
- package/dist/components/OnLoading.d.ts +0 -10
- package/dist/components/OnLoading.js +0 -12
- package/dist/components/OnLoading.js.map +0 -1
- package/dist/components/OneBlinkAppsErrorOriginalMessage.d.ts +0 -7
- package/dist/components/OneBlinkAppsErrorOriginalMessage.js +0 -13
- package/dist/components/OneBlinkAppsErrorOriginalMessage.js.map +0 -1
- package/dist/components/OneBlinkFormElements.d.ts +0 -19
- package/dist/components/OneBlinkFormElements.js +0 -196
- package/dist/components/OneBlinkFormElements.js.map +0 -1
- package/dist/components/PageFormElements.d.ts +0 -17
- package/dist/components/PageFormElements.js +0 -49
- package/dist/components/PageFormElements.js.map +0 -1
- package/dist/components/ToggleAllCheckbox.d.ts +0 -13
- package/dist/components/ToggleAllCheckbox.js +0 -27
- package/dist/components/ToggleAllCheckbox.js.map +0 -1
- package/dist/components/attachments/AttachmentStatus.d.ts +0 -12
- package/dist/components/attachments/AttachmentStatus.js +0 -35
- package/dist/components/attachments/AttachmentStatus.js.map +0 -1
- package/dist/components/attachments/FileCard.d.ts +0 -18
- package/dist/components/attachments/FileCard.js +0 -58
- package/dist/components/attachments/FileCard.js.map +0 -1
- package/dist/components/attachments/FileCardContent.d.ts +0 -5
- package/dist/components/attachments/FileCardContent.js +0 -11
- package/dist/components/attachments/FileCardContent.js.map +0 -1
- package/dist/components/attachments/Files.d.ts +0 -14
- package/dist/components/attachments/Files.js +0 -27
- package/dist/components/attachments/Files.js.map +0 -1
- package/dist/components/attachments/ImagePreviewUnavailable.d.ts +0 -4
- package/dist/components/attachments/ImagePreviewUnavailable.js +0 -12
- package/dist/components/attachments/ImagePreviewUnavailable.js.map +0 -1
- package/dist/components/attachments/UploadingAttachment.d.ts +0 -4
- package/dist/components/attachments/UploadingAttachment.js +0 -13
- package/dist/components/attachments/UploadingAttachment.js.map +0 -1
- package/dist/components/formStore/ColumnsConfigurationButton.d.ts +0 -10
- package/dist/components/formStore/ColumnsConfigurationButton.js +0 -29
- package/dist/components/formStore/ColumnsConfigurationButton.js.map +0 -1
- package/dist/components/formStore/DownloadSubmissionDataButton.d.ts +0 -13
- package/dist/components/formStore/DownloadSubmissionDataButton.js +0 -45
- package/dist/components/formStore/DownloadSubmissionDataButton.js.map +0 -1
- package/dist/components/formStore/FormStore.d.ts +0 -9
- package/dist/components/formStore/FormStore.js +0 -103
- package/dist/components/formStore/FormStore.js.map +0 -1
- package/dist/components/formStore/table/index.d.ts +0 -17
- package/dist/components/formStore/table/index.js +0 -194
- package/dist/components/formStore/table/index.js.map +0 -1
- package/dist/components/renderer/attachments/Files.d.ts +0 -14
- package/dist/components/renderer/attachments/Files.js +0 -27
- package/dist/components/renderer/attachments/Files.js.map +0 -1
- package/dist/components/renderer/attachments/UploadingAttachment.d.ts +0 -4
- package/dist/components/renderer/attachments/UploadingAttachment.js +0 -13
- package/dist/components/renderer/attachments/UploadingAttachment.js.map +0 -1
- package/dist/form-elements/FormElementFiles/FormElementFile.d.ts +0 -13
- package/dist/form-elements/FormElementFiles/FormElementFile.js +0 -32
- package/dist/form-elements/FormElementFiles/FormElementFile.js.map +0 -1
- package/dist/form-elements/FormElementFiles/FormElementFileDisplay.d.ts +0 -10
- package/dist/form-elements/FormElementFiles/FormElementFileDisplay.js +0 -11
- package/dist/form-elements/FormElementFiles/FormElementFileDisplay.js.map +0 -1
- package/dist/form-elements/FormElementFiles/FormElementFiles.d.ts +0 -15
- package/dist/form-elements/FormElementFiles/FormElementFiles.js +0 -17
- package/dist/form-elements/FormElementFiles/FormElementFiles.js.map +0 -1
- package/dist/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.d.ts +0 -7
- package/dist/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.js +0 -11
- package/dist/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.js.map +0 -1
- package/dist/form-elements/FormElementFiles/index.d.ts +0 -17
- package/dist/form-elements/FormElementFiles/index.js +0 -18
- package/dist/form-elements/FormElementFiles/index.js.map +0 -1
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.d.ts +0 -18
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js +0 -61
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js.map +0 -1
- package/dist/hooks/attachments/useAttachmentObjectURLs.d.ts +0 -24
- package/dist/hooks/attachments/useAttachmentObjectURLs.js +0 -37
- package/dist/hooks/attachments/useAttachmentObjectURLs.js.map +0 -1
- package/dist/hooks/attachments/useLocalAttachmentBlobs.d.ts +0 -24
- package/dist/hooks/attachments/useLocalAttachmentBlobs.js +0 -40
- package/dist/hooks/attachments/useLocalAttachmentBlobs.js.map +0 -1
- package/dist/hooks/useButtonsConfiguration.d.ts +0 -45
- package/dist/hooks/useButtonsConfiguration.js +0 -6
- package/dist/hooks/useButtonsConfiguration.js.map +0 -1
- package/dist/hooks/useChangeEffect.d.ts +0 -1
- package/dist/hooks/useChangeEffect.js +0 -14
- package/dist/hooks/useChangeEffect.js.map +0 -1
- package/dist/hooks/useConditionallyShowOptionCallback.d.ts +0 -5
- package/dist/hooks/useConditionallyShowOptionCallback.js +0 -20
- package/dist/hooks/useConditionallyShowOptionCallback.js.map +0 -1
- package/dist/hooks/useCustomValidation.d.ts +0 -1
- package/dist/hooks/useCustomValidation.js +0 -9
- package/dist/hooks/useCustomValidation.js.map +0 -1
- package/dist/hooks/useDynamicOptionsLoaderEffect.d.ts +0 -7
- package/dist/hooks/useDynamicOptionsLoaderEffect.js +0 -45
- package/dist/hooks/useDynamicOptionsLoaderEffect.js.map +0 -1
- package/dist/hooks/useLegacyElements.d.ts +0 -16
- package/dist/hooks/useLegacyElements.js +0 -55
- package/dist/hooks/useLegacyElements.js.map +0 -1
- package/dist/hooks/useToggleAll.d.ts +0 -6
- package/dist/hooks/useToggleAll.js +0 -24
- package/dist/hooks/useToggleAll.js.map +0 -1
- package/dist/services/checkIfAttachmentsAreUploading.d.ts +0 -3
- package/dist/services/checkIfAttachmentsAreUploading.js +0 -58
- package/dist/services/checkIfAttachmentsAreUploading.js.map +0 -1
- package/dist/services/clean-form-elements-ctrl-model.d.ts +0 -4
- package/dist/services/clean-form-elements-ctrl-model.js +0 -166
- package/dist/services/clean-form-elements-ctrl-model.js.map +0 -1
- package/dist/services/conditionally-show-element.d.ts +0 -11
- package/dist/services/conditionally-show-element.js +0 -92
- package/dist/services/conditionally-show-element.js.map +0 -1
- package/dist/services/conditionally-show-option.d.ts +0 -3
- package/dist/services/conditionally-show-option.js +0 -135
- package/dist/services/conditionally-show-option.js.map +0 -1
- package/dist/services/flattenFormElements.d.ts +0 -2
- package/dist/services/flattenFormElements.js +0 -13
- package/dist/services/flattenFormElements.js.map +0 -1
- package/dist/services/getCorrectDateFromDateOnlyString.d.ts +0 -2
- package/dist/services/getCorrectDateFromDateOnlyString.js +0 -4
- package/dist/services/getCorrectDateFromDateOnlyString.js.map +0 -1
- package/dist/styles/boolean.scss +0 -12
- package/dist/styles/ob-file.scss +0 -63
package/dist/OneBlinkFormBase.js
CHANGED
@@ -1,473 +1,477 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { createTheme as createMuiTheme, ThemeProvider, Tooltip, } from '@mui/material';
|
3
|
-
import { Prompt, useHistory } from 'react-router-dom';
|
4
|
-
import clsx from 'clsx';
|
5
|
-
import * as bulmaToast from 'bulma-toast';
|
6
|
-
import { localisationService } from '@oneblink/apps';
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import
|
19
|
-
import
|
20
|
-
import {
|
21
|
-
import {
|
22
|
-
import {
|
23
|
-
import {
|
24
|
-
import
|
25
|
-
import useIsOffline from './hooks/useIsOffline';
|
26
|
-
import CustomisableButtonInner from './components/renderer/CustomisableButtonInner';
|
27
|
-
import checkBsbsAreInvalid from './services/checkBsbsAreInvalid';
|
28
|
-
import checkIfBsbsAreValidating from './services/checkIfBsbsAreValidating';
|
29
|
-
import checkIfAttachmentsExist from './services/checkIfAttachmentsExist';
|
30
|
-
function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, primaryColour, attachmentRetentionInDays, }) {
|
31
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
32
|
-
const isOffline = useIsOffline();
|
33
|
-
const theme = React.useMemo(() => createMuiTheme({
|
34
|
-
palette: {
|
35
|
-
primary: {
|
36
|
-
main: primaryColour || '#4c8da7',
|
37
|
-
},
|
38
|
-
},
|
39
|
-
}), [primaryColour]);
|
40
|
-
//
|
41
|
-
//
|
42
|
-
// #region Form Definition
|
43
|
-
const pages = React.useMemo(() => {
|
44
|
-
if (definition.isMultiPage) {
|
45
|
-
return definition.elements.reduce((pageElements, formElement) => {
|
46
|
-
if (formElement.type === 'page') {
|
47
|
-
pageElements.push(formElement);
|
48
|
-
}
|
49
|
-
return pageElements;
|
50
|
-
}, []);
|
51
|
-
}
|
52
|
-
else {
|
53
|
-
return [
|
54
|
-
{
|
55
|
-
type: 'page',
|
56
|
-
id: definition.id.toString(),
|
57
|
-
label: definition.name,
|
58
|
-
elements: definition.elements,
|
59
|
-
conditionallyShow: false,
|
60
|
-
requiresAllConditionallyShowPredicates: false,
|
61
|
-
},
|
62
|
-
];
|
63
|
-
}
|
64
|
-
}, [
|
65
|
-
definition.elements,
|
66
|
-
definition.id,
|
67
|
-
definition.isMultiPage,
|
68
|
-
definition.name,
|
69
|
-
]);
|
70
|
-
// #endregion
|
71
|
-
//
|
72
|
-
//
|
73
|
-
//
|
74
|
-
//
|
75
|
-
// #region Unsaved Changed
|
76
|
-
const history = useHistory();
|
77
|
-
const [{ isDirty, isNavigationAllowed, hasConfirmedNavigation, goToLocation }, setUnsavedChangesState,] = React.useState({
|
78
|
-
isDirty: false,
|
79
|
-
isNavigationAllowed: false,
|
80
|
-
hasConfirmedNavigation: null,
|
81
|
-
goToLocation: null,
|
82
|
-
});
|
83
|
-
const handleBlockedNavigation = React.useCallback((location) => {
|
84
|
-
setUnsavedChangesState((current) => ({
|
85
|
-
...current,
|
86
|
-
goToLocation: location,
|
87
|
-
hasConfirmedNavigation: false,
|
88
|
-
}));
|
89
|
-
return false;
|
90
|
-
}, []);
|
91
|
-
const handleKeepGoing = React.useCallback(() => {
|
92
|
-
setUnsavedChangesState((current) => ({
|
93
|
-
...current,
|
94
|
-
goToLocation: null,
|
95
|
-
hasConfirmedNavigation: null,
|
96
|
-
}));
|
97
|
-
}, []);
|
98
|
-
const handleDiscardUnsavedChanges = React.useCallback(() => {
|
99
|
-
setUnsavedChangesState((current) => ({
|
100
|
-
...current,
|
101
|
-
isNavigationAllowed: true,
|
102
|
-
hasConfirmedNavigation: true,
|
103
|
-
}));
|
104
|
-
}, []);
|
105
|
-
React.useEffect(() => {
|
106
|
-
if (hasConfirmedNavigation) {
|
107
|
-
// Navigate to the previous blocked location with your navigate function
|
108
|
-
if (goToLocation) {
|
109
|
-
history.push(`${goToLocation.pathname}${goToLocation.search}`);
|
110
|
-
}
|
111
|
-
else {
|
112
|
-
onCancel();
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}, [goToLocation, hasConfirmedNavigation, history, onCancel]);
|
116
|
-
const handleCancel = React.useCallback(() => {
|
117
|
-
if (isDirty) {
|
118
|
-
setUnsavedChangesState((current) => ({
|
119
|
-
...current,
|
120
|
-
hasConfirmedNavigation: false,
|
121
|
-
}));
|
122
|
-
}
|
123
|
-
else {
|
124
|
-
onCancel();
|
125
|
-
}
|
126
|
-
}, [isDirty, onCancel]);
|
127
|
-
const allowNavigation = React.useCallback(() => {
|
128
|
-
setUnsavedChangesState((current) => ({
|
129
|
-
...current,
|
130
|
-
isNavigationAllowed: true,
|
131
|
-
}));
|
132
|
-
}, []);
|
133
|
-
// #endregion Unsaved Changed
|
134
|
-
//
|
135
|
-
//
|
136
|
-
//
|
137
|
-
//
|
138
|
-
// #region Conditional Logic
|
139
|
-
const { formElementsConditionallyShown, conditionalLogicError } = useConditionalLogic(definition, submission);
|
140
|
-
// #endregion
|
141
|
-
//
|
142
|
-
//
|
143
|
-
//
|
144
|
-
//
|
145
|
-
// #region Validation
|
146
|
-
const { validate, executedLookup, executeLookupFailed } = useFormValidation(pages);
|
147
|
-
const formElementsValidation = React.useMemo(() => validate(submission, formElementsConditionallyShown), [formElementsConditionallyShown, submission, validate]);
|
148
|
-
// #endregion
|
149
|
-
//
|
150
|
-
//
|
151
|
-
//
|
152
|
-
//
|
153
|
-
// #region Pages
|
154
|
-
const { visiblePages, isFirstVisiblePage, isLastVisiblePage, isDisplayingCurrentPageError, isShowingMultiplePages, isStepsHeaderActive, toggleStepsNavigation, currentPageIndex, currentPage, currentPageNumber, checkDisplayPageError, setPageId, goToPreviousPage, goToNextPage, scrollToTopOfPageHTMLElementRef, } = usePages({
|
155
|
-
pages,
|
156
|
-
formElementsValidation,
|
157
|
-
formElementsConditionallyShown,
|
158
|
-
});
|
159
|
-
// #endregion
|
160
|
-
//
|
161
|
-
//
|
162
|
-
//
|
163
|
-
//
|
164
|
-
// #region Dynamic Options
|
165
|
-
const loadDynamicOptionsState = useDynamicOptionsLoaderState(definition, setFormSubmission);
|
166
|
-
// #endregion
|
167
|
-
//
|
168
|
-
//
|
169
|
-
//
|
170
|
-
//
|
171
|
-
// #region Submissions
|
172
|
-
const [hasAttemptedSubmit, setHasAttemptedSubmit] = React.useState(false);
|
173
|
-
const getCurrentSubmissionData = React.useCallback((stripBinaryData) => {
|
174
|
-
const { model, captchaTokens } = cleanFormSubmissionModel(submission, definition.elements, formElementsConditionallyShown, stripBinaryData);
|
175
|
-
return {
|
176
|
-
submission: model,
|
177
|
-
captchaTokens,
|
178
|
-
};
|
179
|
-
}, [definition.elements, formElementsConditionallyShown, submission]);
|
180
|
-
const obFormContainerHTMLElementRef = React.useRef(null);
|
181
|
-
React.useEffect(() => {
|
182
|
-
const obFormContainerHTMLElement = obFormContainerHTMLElementRef.current;
|
183
|
-
if (obFormContainerHTMLElement) {
|
184
|
-
console.log('Setting toast notifications to be appended to HTML Element', obFormContainerHTMLElement);
|
185
|
-
bulmaToast.setDefaults({
|
186
|
-
position: 'bottom-right',
|
187
|
-
opacity: 0.95,
|
188
|
-
appendTo: obFormContainerHTMLElement,
|
189
|
-
});
|
190
|
-
}
|
191
|
-
return () => {
|
192
|
-
bulmaToast.resetDefaults();
|
193
|
-
};
|
194
|
-
}, []);
|
195
|
-
const checkAttachmentsCanBeSubmitted = React.useCallback((submission) => {
|
196
|
-
// Prevent submission until all attachment uploads are finished
|
197
|
-
// Unless the user is offline, in which case, the uploads will
|
198
|
-
// be taken care of by a pending queue...hopefully.
|
199
|
-
if (isOffline) {
|
200
|
-
return true;
|
201
|
-
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
if (
|
239
|
-
return;
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
}
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
//
|
329
|
-
//
|
330
|
-
|
331
|
-
//
|
332
|
-
//
|
333
|
-
//
|
334
|
-
|
335
|
-
//
|
336
|
-
//
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
}
|
345
|
-
|
346
|
-
...
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
React.createElement(
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
React.createElement("
|
392
|
-
React.createElement("
|
393
|
-
React.createElement("
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
React.createElement(
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
}
|
472
|
-
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createTheme as createMuiTheme, ThemeProvider, Tooltip, } from '@mui/material';
|
3
|
+
import { Prompt, useHistory } from 'react-router-dom';
|
4
|
+
import clsx from 'clsx';
|
5
|
+
import * as bulmaToast from 'bulma-toast';
|
6
|
+
import { localisationService } from '@oneblink/apps';
|
7
|
+
import { attachmentsService } from '@oneblink/apps';
|
8
|
+
import Modal from './components/renderer/Modal';
|
9
|
+
import OneBlinkAppsErrorOriginalMessage from './components/renderer/OneBlinkAppsErrorOriginalMessage';
|
10
|
+
import cleanFormSubmissionModel from './services/cleanFormSubmissionModel';
|
11
|
+
import PageFormElements from './components/renderer/PageFormElements';
|
12
|
+
import useFormValidation from './hooks/useFormValidation';
|
13
|
+
import useConditionalLogic from './hooks/useConditionalLogic';
|
14
|
+
import usePages from './hooks/usePages';
|
15
|
+
import useLookups from './hooks/useLookups';
|
16
|
+
import { FormDefinitionContext } from './hooks/useFormDefinition';
|
17
|
+
import { InjectPagesContext } from './hooks/useInjectPages';
|
18
|
+
import { ExecutedLookupProvider } from './hooks/useExecutedLookupCallback';
|
19
|
+
import useDynamicOptionsLoaderState from './hooks/useDynamicOptionsLoaderState';
|
20
|
+
import { GoogleMapsApiKeyContext } from './hooks/useGoogleMapsApiKey';
|
21
|
+
import { AbnLookupAuthenticationGuidContext } from './hooks/useAbnLookupAuthenticationGuid';
|
22
|
+
import { CaptchaSiteKeyContext } from './hooks/useCaptchaSiteKey';
|
23
|
+
import { FormIsReadOnlyContext } from './hooks/useFormIsReadOnly';
|
24
|
+
import { AttachmentBlobsProvider } from './hooks/attachments/useAttachmentBlobs';
|
25
|
+
import useIsOffline from './hooks/useIsOffline';
|
26
|
+
import CustomisableButtonInner from './components/renderer/CustomisableButtonInner';
|
27
|
+
import checkBsbsAreInvalid from './services/checkBsbsAreInvalid';
|
28
|
+
import checkIfBsbsAreValidating from './services/checkIfBsbsAreValidating';
|
29
|
+
import checkIfAttachmentsExist from './services/checkIfAttachmentsExist';
|
30
|
+
function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, primaryColour, attachmentRetentionInDays, continueWithUploadingAttachments, }) {
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
32
|
+
const isOffline = useIsOffline();
|
33
|
+
const theme = React.useMemo(() => createMuiTheme({
|
34
|
+
palette: {
|
35
|
+
primary: {
|
36
|
+
main: primaryColour || '#4c8da7',
|
37
|
+
},
|
38
|
+
},
|
39
|
+
}), [primaryColour]);
|
40
|
+
//
|
41
|
+
//
|
42
|
+
// #region Form Definition
|
43
|
+
const pages = React.useMemo(() => {
|
44
|
+
if (definition.isMultiPage) {
|
45
|
+
return definition.elements.reduce((pageElements, formElement) => {
|
46
|
+
if (formElement.type === 'page') {
|
47
|
+
pageElements.push(formElement);
|
48
|
+
}
|
49
|
+
return pageElements;
|
50
|
+
}, []);
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
return [
|
54
|
+
{
|
55
|
+
type: 'page',
|
56
|
+
id: definition.id.toString(),
|
57
|
+
label: definition.name,
|
58
|
+
elements: definition.elements,
|
59
|
+
conditionallyShow: false,
|
60
|
+
requiresAllConditionallyShowPredicates: false,
|
61
|
+
},
|
62
|
+
];
|
63
|
+
}
|
64
|
+
}, [
|
65
|
+
definition.elements,
|
66
|
+
definition.id,
|
67
|
+
definition.isMultiPage,
|
68
|
+
definition.name,
|
69
|
+
]);
|
70
|
+
// #endregion
|
71
|
+
//
|
72
|
+
//
|
73
|
+
//
|
74
|
+
//
|
75
|
+
// #region Unsaved Changed
|
76
|
+
const history = useHistory();
|
77
|
+
const [{ isDirty, isNavigationAllowed, hasConfirmedNavigation, goToLocation }, setUnsavedChangesState,] = React.useState({
|
78
|
+
isDirty: false,
|
79
|
+
isNavigationAllowed: false,
|
80
|
+
hasConfirmedNavigation: null,
|
81
|
+
goToLocation: null,
|
82
|
+
});
|
83
|
+
const handleBlockedNavigation = React.useCallback((location) => {
|
84
|
+
setUnsavedChangesState((current) => ({
|
85
|
+
...current,
|
86
|
+
goToLocation: location,
|
87
|
+
hasConfirmedNavigation: false,
|
88
|
+
}));
|
89
|
+
return false;
|
90
|
+
}, []);
|
91
|
+
const handleKeepGoing = React.useCallback(() => {
|
92
|
+
setUnsavedChangesState((current) => ({
|
93
|
+
...current,
|
94
|
+
goToLocation: null,
|
95
|
+
hasConfirmedNavigation: null,
|
96
|
+
}));
|
97
|
+
}, []);
|
98
|
+
const handleDiscardUnsavedChanges = React.useCallback(() => {
|
99
|
+
setUnsavedChangesState((current) => ({
|
100
|
+
...current,
|
101
|
+
isNavigationAllowed: true,
|
102
|
+
hasConfirmedNavigation: true,
|
103
|
+
}));
|
104
|
+
}, []);
|
105
|
+
React.useEffect(() => {
|
106
|
+
if (hasConfirmedNavigation) {
|
107
|
+
// Navigate to the previous blocked location with your navigate function
|
108
|
+
if (goToLocation) {
|
109
|
+
history.push(`${goToLocation.pathname}${goToLocation.search}`);
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
onCancel();
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}, [goToLocation, hasConfirmedNavigation, history, onCancel]);
|
116
|
+
const handleCancel = React.useCallback(() => {
|
117
|
+
if (isDirty) {
|
118
|
+
setUnsavedChangesState((current) => ({
|
119
|
+
...current,
|
120
|
+
hasConfirmedNavigation: false,
|
121
|
+
}));
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
onCancel();
|
125
|
+
}
|
126
|
+
}, [isDirty, onCancel]);
|
127
|
+
const allowNavigation = React.useCallback(() => {
|
128
|
+
setUnsavedChangesState((current) => ({
|
129
|
+
...current,
|
130
|
+
isNavigationAllowed: true,
|
131
|
+
}));
|
132
|
+
}, []);
|
133
|
+
// #endregion Unsaved Changed
|
134
|
+
//
|
135
|
+
//
|
136
|
+
//
|
137
|
+
//
|
138
|
+
// #region Conditional Logic
|
139
|
+
const { formElementsConditionallyShown, conditionalLogicError } = useConditionalLogic(definition, submission);
|
140
|
+
// #endregion
|
141
|
+
//
|
142
|
+
//
|
143
|
+
//
|
144
|
+
//
|
145
|
+
// #region Validation
|
146
|
+
const { validate, executedLookup, executeLookupFailed } = useFormValidation(pages);
|
147
|
+
const formElementsValidation = React.useMemo(() => validate(submission, formElementsConditionallyShown), [formElementsConditionallyShown, submission, validate]);
|
148
|
+
// #endregion
|
149
|
+
//
|
150
|
+
//
|
151
|
+
//
|
152
|
+
//
|
153
|
+
// #region Pages
|
154
|
+
const { visiblePages, isFirstVisiblePage, isLastVisiblePage, isDisplayingCurrentPageError, isShowingMultiplePages, isStepsHeaderActive, toggleStepsNavigation, currentPageIndex, currentPage, currentPageNumber, checkDisplayPageError, setPageId, goToPreviousPage, goToNextPage, scrollToTopOfPageHTMLElementRef, } = usePages({
|
155
|
+
pages,
|
156
|
+
formElementsValidation,
|
157
|
+
formElementsConditionallyShown,
|
158
|
+
});
|
159
|
+
// #endregion
|
160
|
+
//
|
161
|
+
//
|
162
|
+
//
|
163
|
+
//
|
164
|
+
// #region Dynamic Options
|
165
|
+
const loadDynamicOptionsState = useDynamicOptionsLoaderState(definition, setFormSubmission);
|
166
|
+
// #endregion
|
167
|
+
//
|
168
|
+
//
|
169
|
+
//
|
170
|
+
//
|
171
|
+
// #region Submissions
|
172
|
+
const [hasAttemptedSubmit, setHasAttemptedSubmit] = React.useState(false);
|
173
|
+
const getCurrentSubmissionData = React.useCallback((stripBinaryData) => {
|
174
|
+
const { model, captchaTokens } = cleanFormSubmissionModel(submission, definition.elements, formElementsConditionallyShown, stripBinaryData);
|
175
|
+
return {
|
176
|
+
submission: model,
|
177
|
+
captchaTokens,
|
178
|
+
};
|
179
|
+
}, [definition.elements, formElementsConditionallyShown, submission]);
|
180
|
+
const obFormContainerHTMLElementRef = React.useRef(null);
|
181
|
+
React.useEffect(() => {
|
182
|
+
const obFormContainerHTMLElement = obFormContainerHTMLElementRef.current;
|
183
|
+
if (obFormContainerHTMLElement) {
|
184
|
+
console.log('Setting toast notifications to be appended to HTML Element', obFormContainerHTMLElement);
|
185
|
+
bulmaToast.setDefaults({
|
186
|
+
position: 'bottom-right',
|
187
|
+
opacity: 0.95,
|
188
|
+
appendTo: obFormContainerHTMLElement,
|
189
|
+
});
|
190
|
+
}
|
191
|
+
return () => {
|
192
|
+
bulmaToast.resetDefaults();
|
193
|
+
};
|
194
|
+
}, []);
|
195
|
+
const checkAttachmentsCanBeSubmitted = React.useCallback((submission) => {
|
196
|
+
// Prevent submission until all attachment uploads are finished
|
197
|
+
// Unless the user is offline, in which case, the uploads will
|
198
|
+
// be taken care of by a pending queue...hopefully.
|
199
|
+
if (isOffline) {
|
200
|
+
return true;
|
201
|
+
}
|
202
|
+
// consumer has signaled to continue with submission whilst attachments still uploading
|
203
|
+
if (continueWithUploadingAttachments) {
|
204
|
+
return true;
|
205
|
+
}
|
206
|
+
if (attachmentsService.checkIfAttachmentsAreUploading(definition, submission)) {
|
207
|
+
bulmaToast.toast({
|
208
|
+
message: 'Attachments are still uploading, please wait for them to finish before trying again.',
|
209
|
+
// @ts-expect-error bulma sets this string as a class, so we are hacking in our own classes
|
210
|
+
type: 'ob-toast is-primary cypress-still-uploading-toast',
|
211
|
+
duration: 4000,
|
212
|
+
pauseOnHover: true,
|
213
|
+
closeOnClick: true,
|
214
|
+
});
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
return true;
|
218
|
+
}, [definition, isOffline, continueWithUploadingAttachments]);
|
219
|
+
const checkBsbsCanBeSubmitted = React.useCallback((submission) => {
|
220
|
+
return !checkBsbsAreInvalid(definition, submission);
|
221
|
+
}, [definition]);
|
222
|
+
const checkBsbAreValidating = React.useCallback((submission) => {
|
223
|
+
if (checkIfBsbsAreValidating(definition, submission)) {
|
224
|
+
bulmaToast.toast({
|
225
|
+
message: 'Bsb(s) are still being validated, please wait for them to finish before trying again.',
|
226
|
+
// @ts-expect-error bulma sets this string as a class, so we are hacking in our own classes
|
227
|
+
type: 'ob-toast is-primary cypress-still-validating-toast',
|
228
|
+
duration: 4000,
|
229
|
+
pauseOnHover: true,
|
230
|
+
closeOnClick: true,
|
231
|
+
});
|
232
|
+
return false;
|
233
|
+
}
|
234
|
+
return true;
|
235
|
+
}, [definition]);
|
236
|
+
const handleSubmit = React.useCallback((event) => {
|
237
|
+
event.preventDefault();
|
238
|
+
if (disabled || isReadOnly)
|
239
|
+
return;
|
240
|
+
setHasAttemptedSubmit(true);
|
241
|
+
const submissionData = getCurrentSubmissionData(false);
|
242
|
+
if (!checkBsbAreValidating(submissionData.submission)) {
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
if (formElementsValidation) {
|
246
|
+
console.log('Validation errors', formElementsValidation);
|
247
|
+
bulmaToast.toast({
|
248
|
+
message: 'Please fix validation errors',
|
249
|
+
// @ts-expect-error bulma sets this string as a class, so we are hacking in our own classes
|
250
|
+
type: 'ob-toast is-danger cypress-invalid-submit-attempt',
|
251
|
+
duration: 4000,
|
252
|
+
pauseOnHover: true,
|
253
|
+
closeOnClick: true,
|
254
|
+
});
|
255
|
+
return;
|
256
|
+
}
|
257
|
+
if (!checkAttachmentsCanBeSubmitted(submissionData.submission)) {
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
if (!checkBsbsCanBeSubmitted(submissionData.submission)) {
|
261
|
+
return;
|
262
|
+
}
|
263
|
+
// check if attachments exist
|
264
|
+
const newSubmission = checkIfAttachmentsExist(definition, submissionData.submission, attachmentRetentionInDays);
|
265
|
+
if (newSubmission) {
|
266
|
+
setFormSubmission((currentFormSubmission) => ({
|
267
|
+
...currentFormSubmission,
|
268
|
+
submission: newSubmission,
|
269
|
+
}));
|
270
|
+
bulmaToast.toast({
|
271
|
+
message: "Some files that were included in your submission have been removed based on your administrator's data retention policy, please remove them and upload them again.",
|
272
|
+
// @ts-expect-error bulma sets this string as a class, so we are hacking in our own classes
|
273
|
+
type: 'ob-toast is-danger cypress-invalid-submit-attempt',
|
274
|
+
duration: 4000,
|
275
|
+
pauseOnHover: true,
|
276
|
+
closeOnClick: true,
|
277
|
+
});
|
278
|
+
return;
|
279
|
+
}
|
280
|
+
allowNavigation();
|
281
|
+
onSubmit({
|
282
|
+
definition,
|
283
|
+
submission: submissionData.submission,
|
284
|
+
captchaTokens: submissionData.captchaTokens,
|
285
|
+
});
|
286
|
+
}, [
|
287
|
+
disabled,
|
288
|
+
isReadOnly,
|
289
|
+
getCurrentSubmissionData,
|
290
|
+
checkBsbAreValidating,
|
291
|
+
formElementsValidation,
|
292
|
+
checkAttachmentsCanBeSubmitted,
|
293
|
+
checkBsbsCanBeSubmitted,
|
294
|
+
definition,
|
295
|
+
attachmentRetentionInDays,
|
296
|
+
allowNavigation,
|
297
|
+
onSubmit,
|
298
|
+
setFormSubmission,
|
299
|
+
]);
|
300
|
+
const handleSaveDraft = React.useCallback(() => {
|
301
|
+
if (disabled)
|
302
|
+
return;
|
303
|
+
if (onSaveDraft) {
|
304
|
+
allowNavigation();
|
305
|
+
// For drafts we don't need to save the captcha tokens,
|
306
|
+
// they will need to prove they are not robot again
|
307
|
+
const { submission } = getCurrentSubmissionData(false);
|
308
|
+
if (!checkBsbAreValidating(submission)) {
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
if (!checkAttachmentsCanBeSubmitted(submission)) {
|
312
|
+
return;
|
313
|
+
}
|
314
|
+
onSaveDraft({
|
315
|
+
definition,
|
316
|
+
submission,
|
317
|
+
});
|
318
|
+
}
|
319
|
+
}, [
|
320
|
+
allowNavigation,
|
321
|
+
checkAttachmentsCanBeSubmitted,
|
322
|
+
definition,
|
323
|
+
disabled,
|
324
|
+
getCurrentSubmissionData,
|
325
|
+
onSaveDraft,
|
326
|
+
checkBsbAreValidating,
|
327
|
+
]);
|
328
|
+
// #endregion
|
329
|
+
//
|
330
|
+
//
|
331
|
+
//
|
332
|
+
//
|
333
|
+
// #region Lookups
|
334
|
+
const { handlePagesLookupResult } = useLookups(definition.id, setFormSubmission);
|
335
|
+
// #endregion
|
336
|
+
//
|
337
|
+
//
|
338
|
+
//
|
339
|
+
//
|
340
|
+
// #region Submission/Definition Changes
|
341
|
+
const handleChange = React.useCallback((element, value) => {
|
342
|
+
if (disabled || element.type === 'page' || element.type === 'section') {
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
setUnsavedChangesState((current) => ({
|
346
|
+
...current,
|
347
|
+
isDirty: true,
|
348
|
+
}));
|
349
|
+
setFormSubmission((currentFormSubmission) => ({
|
350
|
+
...currentFormSubmission,
|
351
|
+
submission: {
|
352
|
+
...currentFormSubmission.submission,
|
353
|
+
[element.name]: typeof value === 'function'
|
354
|
+
? value(currentFormSubmission.submission[element.name])
|
355
|
+
: value,
|
356
|
+
},
|
357
|
+
}));
|
358
|
+
}, [disabled, setFormSubmission]);
|
359
|
+
// #endregion
|
360
|
+
//
|
361
|
+
//
|
362
|
+
if (conditionalLogicError) {
|
363
|
+
return (React.createElement(React.Fragment, null,
|
364
|
+
React.createElement("div", { className: "has-text-centered" },
|
365
|
+
React.createElement("i", { className: "material-icons has-text-warning icon-x-large" }, "error"),
|
366
|
+
React.createElement("h3", { className: "title is-3" }, "Bad Form Configuration"),
|
367
|
+
React.createElement("p", { className: "cypress-conditional-logic-error-message" }, conditionalLogicError.message),
|
368
|
+
React.createElement("p", { className: "has-text-grey" }, localisationService.formatDatetimeLong(new Date())))));
|
369
|
+
}
|
370
|
+
if (loadDynamicOptionsState) {
|
371
|
+
return (React.createElement(React.Fragment, null,
|
372
|
+
React.createElement("div", { className: "has-text-centered" },
|
373
|
+
React.createElement("i", { className: "material-icons has-text-warning icon-x-large" }, "error"),
|
374
|
+
React.createElement("h3", { className: "title is-3" }, loadDynamicOptionsState.error.title),
|
375
|
+
React.createElement("p", null, loadDynamicOptionsState.error.message),
|
376
|
+
React.createElement("p", { className: "has-text-grey" }, localisationService.formatDatetimeLong(new Date()))),
|
377
|
+
React.createElement(OneBlinkAppsErrorOriginalMessage, { error: loadDynamicOptionsState.error.originalError })));
|
378
|
+
}
|
379
|
+
return (React.createElement(ThemeProvider, { theme: theme },
|
380
|
+
React.createElement("div", { className: "ob-form-container", ref: obFormContainerHTMLElementRef },
|
381
|
+
React.createElement("form", { name: "obForm", className: `ob-form cypress-ob-form ob-form__page-${currentPageIndex + 1}`, noValidate: true, onSubmit: handleSubmit },
|
382
|
+
React.createElement("div", null,
|
383
|
+
React.createElement("div", { ref: scrollToTopOfPageHTMLElementRef }),
|
384
|
+
isShowingMultiplePages && (React.createElement("div", { className: clsx('ob-steps-navigation', {
|
385
|
+
'is-active': isStepsHeaderActive,
|
386
|
+
}) },
|
387
|
+
React.createElement("div", { className: clsx('ob-steps-navigation__header', {
|
388
|
+
'is-active': isStepsHeaderActive,
|
389
|
+
}), onClick: toggleStepsNavigation },
|
390
|
+
React.createElement("span", { className: "icon is-invisible" },
|
391
|
+
React.createElement("i", { className: "material-icons" }, "keyboard_arrow_down")),
|
392
|
+
React.createElement("div", { className: "steps-header-active-page" },
|
393
|
+
isDisplayingCurrentPageError ? (React.createElement("span", { className: "icon" },
|
394
|
+
React.createElement("i", { className: "material-icons has-text-danger is-size-4" }, "warning"))) : (React.createElement("span", { className: "steps-header-active-page-icon" }, currentPageNumber)),
|
395
|
+
React.createElement("span", { className: "steps-header-active-page-label cypress-tablet-step-title" }, currentPage ? currentPage.label : '')),
|
396
|
+
React.createElement("span", { className: "dropdown icon" },
|
397
|
+
React.createElement("i", { className: "material-icons" }, "keyboard_arrow_down"))),
|
398
|
+
React.createElement("div", { className: clsx('ob-steps-navigation__steps', {
|
399
|
+
'is-active': isStepsHeaderActive,
|
400
|
+
}) },
|
401
|
+
React.createElement("div", { className: "steps is-small is-horizontal-tablet cypress-steps" }, visiblePages.map((page, index) => {
|
402
|
+
const hasErrors = checkDisplayPageError(page);
|
403
|
+
return (React.createElement("div", { key: page.id, id: `steps-navigation-step-${page.id}`, className: clsx('step-item cypress-step-item', {
|
404
|
+
'is-active': currentPage.id === page.id,
|
405
|
+
'is-completed': currentPageIndex > index,
|
406
|
+
'is-error': hasErrors,
|
407
|
+
}), onClick: (e) => {
|
408
|
+
e.stopPropagation();
|
409
|
+
if (page.id !== currentPage.id) {
|
410
|
+
setPageId(page.id);
|
411
|
+
}
|
412
|
+
} },
|
413
|
+
React.createElement("div", { className: "step-marker step-marker-error ob-step-marker cypress-step-marker",
|
414
|
+
// @ts-expect-error ???
|
415
|
+
name: `cypress-page-stepper-${index + 1}`, value: index + 1 }, hasErrors ? (React.createElement(Tooltip, { title: "Page has errors" },
|
416
|
+
React.createElement("span", { className: "icon tooltip has-tooltip-top cypress-page-error" },
|
417
|
+
React.createElement("i", { className: "material-icons has-text-danger is-size-3" }, "warning")))) : (React.createElement("span", null, index + 1))),
|
418
|
+
React.createElement("div", { className: "step-details ob-step-details" },
|
419
|
+
React.createElement("p", { className: "step-title ob-step-title cypress-desktop-step-title" }, page.label))));
|
420
|
+
}))))),
|
421
|
+
React.createElement("div", { className: clsx('ob-steps-navigation__background', {
|
422
|
+
'is-active': isStepsHeaderActive,
|
423
|
+
}), onClick: toggleStepsNavigation }),
|
424
|
+
React.createElement("div", { className: "steps" },
|
425
|
+
React.createElement("div", { className: clsx('steps-content', {
|
426
|
+
'is-single-step': !isShowingMultiplePages,
|
427
|
+
}) },
|
428
|
+
React.createElement(FormDefinitionContext.Provider, { value: definition },
|
429
|
+
React.createElement(InjectPagesContext.Provider, { value: handlePagesLookupResult },
|
430
|
+
React.createElement(ExecutedLookupProvider, { executedLookup: executedLookup, executeLookupFailed: executeLookupFailed },
|
431
|
+
React.createElement(GoogleMapsApiKeyContext.Provider, { value: googleMapsApiKey },
|
432
|
+
React.createElement(AbnLookupAuthenticationGuidContext.Provider, { value: abnLookupAuthenticationGuid },
|
433
|
+
React.createElement(CaptchaSiteKeyContext.Provider, { value: captchaSiteKey },
|
434
|
+
React.createElement(AttachmentBlobsProvider, null,
|
435
|
+
React.createElement(FormIsReadOnlyContext.Provider, { value: isReadOnly }, visiblePages.map((pageElement) => (React.createElement(PageFormElements, { key: pageElement.id, isActive: pageElement.id === currentPage.id, formId: definition.id, formElementsConditionallyShown: formElementsConditionallyShown, formElementsValidation: formElementsValidation, displayValidationMessages: hasAttemptedSubmit ||
|
436
|
+
isDisplayingCurrentPageError, pageElement: pageElement, onChange: handleChange, model: submission, setFormSubmission: setFormSubmission })))))))))))),
|
437
|
+
isShowingMultiplePages && (React.createElement("div", { className: "steps-actions" },
|
438
|
+
React.createElement("div", { className: "steps-action" },
|
439
|
+
React.createElement("button", { type: "button", onClick: goToPreviousPage, disabled: isFirstVisiblePage, className: "button is-light cypress-pages-previous" },
|
440
|
+
React.createElement("span", { className: "icon" },
|
441
|
+
React.createElement("i", { className: "material-icons" }, "keyboard_arrow_left")),
|
442
|
+
React.createElement("span", null, "Back"))),
|
443
|
+
React.createElement("div", { className: "step-progress-mobile cypress-steps-mobile" }, visiblePages.map((page, index) => (React.createElement("div", { key: page.id, className: clsx('step-progress-mobile-dot', {
|
444
|
+
'is-active': currentPage.id === page.id,
|
445
|
+
'is-completed': currentPageIndex > index,
|
446
|
+
'has-background-danger': currentPage.id !== page.id &&
|
447
|
+
checkDisplayPageError(page),
|
448
|
+
}) })))),
|
449
|
+
React.createElement("div", { className: "steps-action" },
|
450
|
+
React.createElement("button", { type: "button", onClick: goToNextPage, disabled: isLastVisiblePage, className: "button is-light cypress-pages-next" },
|
451
|
+
React.createElement("span", null, "Next"),
|
452
|
+
React.createElement("span", { className: "icon" },
|
453
|
+
React.createElement("i", { className: "material-icons" }, "keyboard_arrow_right"))))))),
|
454
|
+
!isReadOnly && (React.createElement("div", { className: "buttons ob-buttons ob-buttons-submit" },
|
455
|
+
onSaveDraft && !definition.isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-primary ob-button-save-draft cypress-save-draft-form", onClick: handleSaveDraft, disabled: isPreview || disabled },
|
456
|
+
React.createElement(CustomisableButtonInner, { label: ((_a = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _a === void 0 ? void 0 : _a.label) || 'Save Draft', icon: (_b = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _b === void 0 ? void 0 : _b.icon }))),
|
457
|
+
React.createElement("span", { className: "ob-buttons-submit__spacer" }),
|
458
|
+
!definition.isInfoPage && (React.createElement("button", { type: "button", className: "button ob-button is-light ob-button-submit-cancel cypress-cancel-form", onClick: handleCancel, disabled: isPreview || disabled },
|
459
|
+
React.createElement(CustomisableButtonInner, { label: ((_c = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _c === void 0 ? void 0 : _c.label) || 'Cancel', icon: (_d = buttons === null || buttons === void 0 ? void 0 : buttons.cancel) === null || _d === void 0 ? void 0 : _d.icon }))),
|
460
|
+
isLastVisiblePage && (React.createElement("button", { type: "submit", className: "button ob-button is-success ob-button-submit cypress-submit-form-button cypress-submit-form", disabled: isPreview || disabled },
|
461
|
+
React.createElement(CustomisableButtonInner, { label: definition.isInfoPage
|
462
|
+
? 'Done'
|
463
|
+
: ((_e = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _e === void 0 ? void 0 : _e.label) || 'Submit', icon: (_f = buttons === null || buttons === void 0 ? void 0 : buttons.submit) === null || _f === void 0 ? void 0 : _f.icon }))))))),
|
464
|
+
!isReadOnly && (React.createElement(React.Fragment, null,
|
465
|
+
React.createElement(Prompt, { when: isDirty && !isNavigationAllowed, message: handleBlockedNavigation }),
|
466
|
+
React.createElement(Modal, { isOpen: hasConfirmedNavigation === false, title: "Unsaved Changes", cardClassName: "cypress-cancel-confirm", titleClassName: "cypress-cancel-confirm-title", bodyClassName: "cypress-cancel-confirm-body", actions: React.createElement(React.Fragment, null,
|
467
|
+
onSaveDraft && (React.createElement("button", { type: "button", className: "button ob-button is-success cypress-cancel-confirm-save-draft", onClick: handleSaveDraft },
|
468
|
+
React.createElement(CustomisableButtonInner, { label: ((_g = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _g === void 0 ? void 0 : _g.label) || 'Save Draft', icon: (_h = buttons === null || buttons === void 0 ? void 0 : buttons.saveDraft) === null || _h === void 0 ? void 0 : _h.icon }))),
|
469
|
+
React.createElement("span", { style: { flex: 1 } }),
|
470
|
+
React.createElement("button", { type: "button", className: "button ob-button is-light cypress-cancel-confirm-back", onClick: handleKeepGoing },
|
471
|
+
React.createElement(CustomisableButtonInner, { label: ((_j = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _j === void 0 ? void 0 : _j.label) || 'Back', icon: (_k = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptNo) === null || _k === void 0 ? void 0 : _k.icon })),
|
472
|
+
React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-cancel-confirm-discard", onClick: handleDiscardUnsavedChanges },
|
473
|
+
React.createElement(CustomisableButtonInner, { label: ((_l = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _l === void 0 ? void 0 : _l.label) || 'Discard', icon: (_m = buttons === null || buttons === void 0 ? void 0 : buttons.cancelPromptYes) === null || _m === void 0 ? void 0 : _m.icon }))) },
|
474
|
+
React.createElement("p", null, "You have unsaved changes, are you sure you want discard them?")))))));
|
475
|
+
}
|
476
|
+
export default React.memo(OneBlinkFormBase);
|
473
477
|
//# sourceMappingURL=OneBlinkFormBase.js.map
|