@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
@@ -1,228 +1,228 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import useBooleanState from '../hooks/useBooleanState';
|
3
|
-
import downloadAttachment, { downloadFileLegacy, } from '../services/download-file';
|
4
|
-
import OnLoading from '../components/renderer/OnLoading';
|
5
|
-
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
6
|
-
import drawTimestampOnCanvas from '../services/drawTimestampOnCanvas';
|
7
|
-
import useAttachment from '../hooks/attachments/useAttachment';
|
8
|
-
import AnnotationModal from '../components/renderer/AnnotationModal';
|
9
|
-
import Modal from '../components/renderer/Modal';
|
10
|
-
import { checkIfContentTypeIsImage, prepareNewAttachment, correctFileOrientation, } from '../services/attachments';
|
11
|
-
import AttachmentStatus from '../components/renderer/attachments/AttachmentStatus';
|
12
|
-
import { canvasToBlob, urlToBlobAsync } from '../services/blob-utils';
|
13
|
-
import ImagePreviewUnavailable from '../components/renderer/attachments/ImagePreviewUnavailable';
|
14
|
-
import ProgressBar from '../components/renderer/attachments/ProgressBar';
|
15
|
-
import { Fade } from '@mui/material';
|
16
|
-
function FormElementCamera({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
17
|
-
const [{ cameraError, isLoading }, setState] = React.useState({
|
18
|
-
isLoading: false,
|
19
|
-
});
|
20
|
-
const [isDirty, setIsDirty] = useBooleanState(false);
|
21
|
-
const [isAnnotating, setIsAnnotating, clearIsAnnotating] = useBooleanState(false);
|
22
|
-
const fileInputRef = React.useRef(null);
|
23
|
-
const clearImage = React.useCallback(() => {
|
24
|
-
onChange(element, undefined);
|
25
|
-
}, [element, onChange]);
|
26
|
-
const fileChange = React.useCallback(async (changeEvent) => {
|
27
|
-
if (!changeEvent.target || !changeEvent.target.files) {
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
const file = changeEvent.target.files[0];
|
31
|
-
if (!file) {
|
32
|
-
return;
|
33
|
-
}
|
34
|
-
setState({
|
35
|
-
isLoading: true,
|
36
|
-
});
|
37
|
-
console.log('File selected event', file);
|
38
|
-
try {
|
39
|
-
if (!checkIfContentTypeIsImage(file.type)) {
|
40
|
-
throw new Error(`Invalid file type "${file.type}". Please select an image.`);
|
41
|
-
}
|
42
|
-
const result = await correctFileOrientation(file, element.includeTimestampWatermark ? drawTimestampOnCanvas : undefined);
|
43
|
-
if (result instanceof Blob) {
|
44
|
-
onChange(element, prepareNewAttachment(result, file.name, element));
|
45
|
-
}
|
46
|
-
else {
|
47
|
-
const blob = await canvasToBlob(result);
|
48
|
-
onChange(element, prepareNewAttachment(blob, file.name, element));
|
49
|
-
}
|
50
|
-
setIsDirty();
|
51
|
-
setState({
|
52
|
-
isLoading: false,
|
53
|
-
});
|
54
|
-
}
|
55
|
-
catch (error) {
|
56
|
-
setState({
|
57
|
-
isLoading: false,
|
58
|
-
cameraError: error,
|
59
|
-
});
|
60
|
-
}
|
61
|
-
}, [element, onChange, setIsDirty]);
|
62
|
-
const openCamera = React.useCallback(() => {
|
63
|
-
if (window.cordova && navigator.camera && navigator.camera.getPicture) {
|
64
|
-
setState({
|
65
|
-
isLoading: true,
|
66
|
-
});
|
67
|
-
navigator.camera.getPicture((base64Data) => {
|
68
|
-
urlToBlobAsync(`data:image/jpeg;base64,${base64Data}`)
|
69
|
-
.then((blob) => {
|
70
|
-
onChange(element, prepareNewAttachment(blob, 'photo.jpeg', element));
|
71
|
-
setState({
|
72
|
-
isLoading: false,
|
73
|
-
});
|
74
|
-
})
|
75
|
-
.catch((error) => {
|
76
|
-
setState({
|
77
|
-
cameraError: error,
|
78
|
-
isLoading: false,
|
79
|
-
});
|
80
|
-
});
|
81
|
-
}, (error) => {
|
82
|
-
console.warn('An error occurred while attempting to take a photo', error);
|
83
|
-
setState({
|
84
|
-
isLoading: false,
|
85
|
-
cameraError: error,
|
86
|
-
});
|
87
|
-
}, {
|
88
|
-
quality: 100,
|
89
|
-
destinationType: window.Camera.DestinationType.DATA_URL,
|
90
|
-
sourceType: window.Camera.PictureSourceType.CAMERA,
|
91
|
-
allowEdit: false,
|
92
|
-
encodingType: window.Camera.EncodingType.JPEG,
|
93
|
-
mediaType: window.Camera.MediaType.PICTURE,
|
94
|
-
correctOrientation: true,
|
95
|
-
saveToPhotoAlbum: false,
|
96
|
-
cameraDirection: window.Camera.Direction.BACK,
|
97
|
-
});
|
98
|
-
}
|
99
|
-
else if (fileInputRef.current) {
|
100
|
-
// RESET HTML FILE INPUT VALUE SO FILES PREVIOUSLY ADDED AND REMOVED ARE RECOGNIZED
|
101
|
-
fileInputRef.current.value = '';
|
102
|
-
fileInputRef.current.click();
|
103
|
-
}
|
104
|
-
else {
|
105
|
-
console.error('Could not find "input" element in Camera component template');
|
106
|
-
}
|
107
|
-
}, [element, onChange]);
|
108
|
-
const { isUploading, uploadErrorMessage, isLoadingImageUrl, imageUrl, loadImageUrlError, canDownload, progress, } = useAttachment(value, element, React.useCallback((id, attachment) => {
|
109
|
-
onChange(element, attachment);
|
110
|
-
}, [element, onChange]));
|
111
|
-
const handleDownload = React.useCallback(async () => {
|
112
|
-
if (typeof value === 'string') {
|
113
|
-
await downloadFileLegacy(value, id);
|
114
|
-
}
|
115
|
-
else if (value && value.type !== 'ERROR') {
|
116
|
-
await downloadAttachment(value);
|
117
|
-
}
|
118
|
-
}, [value, id]);
|
119
|
-
const handleSaveAnnotation = React.useCallback((annotationDataUri) => {
|
120
|
-
clearIsAnnotating();
|
121
|
-
if (typeof imageUrl !== 'string') {
|
122
|
-
return;
|
123
|
-
}
|
124
|
-
setState({
|
125
|
-
isLoading: true,
|
126
|
-
});
|
127
|
-
const canvas = document.createElement('canvas');
|
128
|
-
const ctx = canvas.getContext('2d');
|
129
|
-
if (!ctx) {
|
130
|
-
return;
|
131
|
-
}
|
132
|
-
const image = new Image();
|
133
|
-
image.onload = function () {
|
134
|
-
canvas.width = image.width;
|
135
|
-
canvas.height = image.height;
|
136
|
-
ctx.drawImage(image, 0, 0);
|
137
|
-
const annotationImage = new Image();
|
138
|
-
annotationImage.onload = function () {
|
139
|
-
ctx.drawImage(annotationImage, 0, 0, canvas.width, canvas.height);
|
140
|
-
try {
|
141
|
-
canvasToBlob(canvas)
|
142
|
-
.then((blob) => {
|
143
|
-
const attachment = prepareNewAttachment(blob, 'photo.png', element);
|
144
|
-
onChange(element, attachment);
|
145
|
-
setState({
|
146
|
-
isLoading: false,
|
147
|
-
});
|
148
|
-
})
|
149
|
-
.catch((error) => {
|
150
|
-
setState({
|
151
|
-
cameraError: error,
|
152
|
-
isLoading: false,
|
153
|
-
});
|
154
|
-
});
|
155
|
-
}
|
156
|
-
catch (error) {
|
157
|
-
setState({
|
158
|
-
cameraError: error,
|
159
|
-
isLoading: false,
|
160
|
-
});
|
161
|
-
}
|
162
|
-
};
|
163
|
-
annotationImage.src = annotationDataUri;
|
164
|
-
};
|
165
|
-
image.setAttribute('crossorigin', 'anonymous');
|
166
|
-
image.src = imageUrl;
|
167
|
-
}, [clearIsAnnotating, element, imageUrl, onChange]);
|
168
|
-
const progressTooltipRef = React.useRef(null);
|
169
|
-
return (React.createElement(React.Fragment, null,
|
170
|
-
React.createElement(FormElementLabelContainer, { className: "ob-camera", element: element, id: id, required: element.required },
|
171
|
-
React.createElement("div", { className: "control" },
|
172
|
-
(value || isLoading) && (React.createElement(React.Fragment, null,
|
173
|
-
React.createElement("figure", { className: "ob-figure", ref: progressTooltipRef },
|
174
|
-
React.createElement(DisplayImage, { isUploading: isUploading, uploadErrorMessage: uploadErrorMessage, isLoadingImageUrl: isLoadingImageUrl, imageUrl: imageUrl, loadImageUrlError: loadImageUrlError, isLoading: isLoading, element: element, onAnnotate: setIsAnnotating, canDownload: canDownload, progress: progress }),
|
175
|
-
progressTooltipRef.current && (React.createElement(Fade, { in: isUploading },
|
176
|
-
React.createElement("span", null,
|
177
|
-
React.createElement(ProgressBar, { isShowing: isUploading, progress: progress, tooltipAnchorEl: progressTooltipRef.current }))))))),
|
178
|
-
React.createElement("input", { ref: fileInputRef, className: "ob-input ob-camera__input-hidden cypress-camera-control", type: "file", accept: "image/*", capture: "environment", id: id, name: element.name, required: element.required, disabled: element.readOnly, onChange: fileChange }),
|
179
|
-
React.createElement("div", { className: "buttons ob-buttons" }, value ? (React.createElement(React.Fragment, null,
|
180
|
-
React.createElement("button", { type: "button", className: "button ob-button ob-button__clear is-light cypress-clear-camera", onClick: clearImage, disabled: element.readOnly || isLoading }, "Clear"),
|
181
|
-
canDownload && (React.createElement("button", { type: "button", className: "button ob-button ob-button__download is-primary cypress-download-file-button", onClick: handleDownload },
|
182
|
-
React.createElement("span", { className: "icon" },
|
183
|
-
React.createElement("i", { className: "material-icons" }, "cloud_download")),
|
184
|
-
React.createElement("span", null, "\u00A0Download"))))) : (React.createElement("button", { type: "button", className: "button ob-button ob-button__open is-primary cypress-open-camera", onClick: openCamera, disabled: element.readOnly || isLoading }, "Open Camera")))),
|
185
|
-
(isDirty || displayValidationMessage) && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
186
|
-
React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage)))),
|
187
|
-
isAnnotating && imageUrl && (React.createElement(AnnotationModal, { imageSrc: imageUrl, onClose: clearIsAnnotating, onSave: handleSaveAnnotation })),
|
188
|
-
cameraError && (React.createElement(Modal, { isOpen: true, title: "Whoops...", className: "cypress-error-modal", titleClassName: "cypress-error-title", actions: React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-close-error-button", onClick: () => setState({ isLoading: false }) }, "Okay") },
|
189
|
-
React.createElement("p", null,
|
190
|
-
"An error occurred while attempting to take a photo. Please click",
|
191
|
-
' ',
|
192
|
-
React.createElement("b", null, "Okay"),
|
193
|
-
" below to try again. If the problem persists, please contact support."),
|
194
|
-
React.createElement("div", { className: "content has-margin-top-6" },
|
195
|
-
React.createElement("blockquote", null, cameraError.toString()))))));
|
196
|
-
}
|
197
|
-
export default React.memo(FormElementCamera);
|
198
|
-
const DisplayImage = React.memo(function DisplayImage({ uploadErrorMessage, isUploading, isLoadingImageUrl, imageUrl, loadImageUrlError, isLoading, element, onAnnotate, }) {
|
199
|
-
if (uploadErrorMessage) {
|
200
|
-
return (React.createElement("div", { className: "figure-content" },
|
201
|
-
React.createElement("h3", { className: "title is-3" }, "Upload Failed"),
|
202
|
-
React.createElement("p", null,
|
203
|
-
"Your photo failed to upload, please press the ",
|
204
|
-
React.createElement("b", null, "Clear"),
|
205
|
-
" button and try again.")));
|
206
|
-
}
|
207
|
-
if (loadImageUrlError) {
|
208
|
-
return (React.createElement("div", { className: "figure-content" },
|
209
|
-
React.createElement("h3", { className: "title is-3" }, "Preview Failed"),
|
210
|
-
React.createElement("p", null, loadImageUrlError.message)));
|
211
|
-
}
|
212
|
-
if (isLoadingImageUrl || isLoading) {
|
213
|
-
return (React.createElement("div", { className: "figure-content has-text-centered cypress-camera-loading-image" },
|
214
|
-
React.createElement(OnLoading, { small: true })));
|
215
|
-
}
|
216
|
-
if (imageUrl) {
|
217
|
-
return (React.createElement(React.Fragment, null,
|
218
|
-
React.createElement("span", { className: "ob-figure__status" },
|
219
|
-
React.createElement(AttachmentStatus, { isLoadingImageUrl: isLoadingImageUrl, loadImageUrlError: loadImageUrlError, isUploading: isUploading, imageUrl: imageUrl })),
|
220
|
-
React.createElement("img", { src: imageUrl, className: "cypress-camera-image ob-camera__img", crossOrigin: "anonymous" }),
|
221
|
-
React.createElement("button", { type: "button", className: "button is-primary ob-camera__annotate-button cypress-annotate-button", onClick: onAnnotate, disabled: element.readOnly },
|
222
|
-
React.createElement("span", { className: "icon" },
|
223
|
-
React.createElement("i", { className: "material-icons" }, "brush")))));
|
224
|
-
}
|
225
|
-
return (React.createElement("div", { className: "figure-content" },
|
226
|
-
React.createElement(ImagePreviewUnavailable, null)));
|
227
|
-
});
|
1
|
+
import * as React from 'react';
|
2
|
+
import useBooleanState from '../hooks/useBooleanState';
|
3
|
+
import downloadAttachment, { downloadFileLegacy, } from '../services/download-file';
|
4
|
+
import OnLoading from '../components/renderer/OnLoading';
|
5
|
+
import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
|
6
|
+
import drawTimestampOnCanvas from '../services/drawTimestampOnCanvas';
|
7
|
+
import useAttachment from '../hooks/attachments/useAttachment';
|
8
|
+
import AnnotationModal from '../components/renderer/AnnotationModal';
|
9
|
+
import Modal from '../components/renderer/Modal';
|
10
|
+
import { checkIfContentTypeIsImage, prepareNewAttachment, correctFileOrientation, } from '../services/attachments';
|
11
|
+
import AttachmentStatus from '../components/renderer/attachments/AttachmentStatus';
|
12
|
+
import { canvasToBlob, urlToBlobAsync } from '../services/blob-utils';
|
13
|
+
import ImagePreviewUnavailable from '../components/renderer/attachments/ImagePreviewUnavailable';
|
14
|
+
import ProgressBar from '../components/renderer/attachments/ProgressBar';
|
15
|
+
import { Fade } from '@mui/material';
|
16
|
+
function FormElementCamera({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
17
|
+
const [{ cameraError, isLoading }, setState] = React.useState({
|
18
|
+
isLoading: false,
|
19
|
+
});
|
20
|
+
const [isDirty, setIsDirty] = useBooleanState(false);
|
21
|
+
const [isAnnotating, setIsAnnotating, clearIsAnnotating] = useBooleanState(false);
|
22
|
+
const fileInputRef = React.useRef(null);
|
23
|
+
const clearImage = React.useCallback(() => {
|
24
|
+
onChange(element, undefined);
|
25
|
+
}, [element, onChange]);
|
26
|
+
const fileChange = React.useCallback(async (changeEvent) => {
|
27
|
+
if (!changeEvent.target || !changeEvent.target.files) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
const file = changeEvent.target.files[0];
|
31
|
+
if (!file) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
setState({
|
35
|
+
isLoading: true,
|
36
|
+
});
|
37
|
+
console.log('File selected event', file);
|
38
|
+
try {
|
39
|
+
if (!checkIfContentTypeIsImage(file.type)) {
|
40
|
+
throw new Error(`Invalid file type "${file.type}". Please select an image.`);
|
41
|
+
}
|
42
|
+
const result = await correctFileOrientation(file, element.includeTimestampWatermark ? drawTimestampOnCanvas : undefined);
|
43
|
+
if (result instanceof Blob) {
|
44
|
+
onChange(element, prepareNewAttachment(result, file.name, element));
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
const blob = await canvasToBlob(result);
|
48
|
+
onChange(element, prepareNewAttachment(blob, file.name, element));
|
49
|
+
}
|
50
|
+
setIsDirty();
|
51
|
+
setState({
|
52
|
+
isLoading: false,
|
53
|
+
});
|
54
|
+
}
|
55
|
+
catch (error) {
|
56
|
+
setState({
|
57
|
+
isLoading: false,
|
58
|
+
cameraError: error,
|
59
|
+
});
|
60
|
+
}
|
61
|
+
}, [element, onChange, setIsDirty]);
|
62
|
+
const openCamera = React.useCallback(() => {
|
63
|
+
if (window.cordova && navigator.camera && navigator.camera.getPicture) {
|
64
|
+
setState({
|
65
|
+
isLoading: true,
|
66
|
+
});
|
67
|
+
navigator.camera.getPicture((base64Data) => {
|
68
|
+
urlToBlobAsync(`data:image/jpeg;base64,${base64Data}`)
|
69
|
+
.then((blob) => {
|
70
|
+
onChange(element, prepareNewAttachment(blob, 'photo.jpeg', element));
|
71
|
+
setState({
|
72
|
+
isLoading: false,
|
73
|
+
});
|
74
|
+
})
|
75
|
+
.catch((error) => {
|
76
|
+
setState({
|
77
|
+
cameraError: error,
|
78
|
+
isLoading: false,
|
79
|
+
});
|
80
|
+
});
|
81
|
+
}, (error) => {
|
82
|
+
console.warn('An error occurred while attempting to take a photo', error);
|
83
|
+
setState({
|
84
|
+
isLoading: false,
|
85
|
+
cameraError: error,
|
86
|
+
});
|
87
|
+
}, {
|
88
|
+
quality: 100,
|
89
|
+
destinationType: window.Camera.DestinationType.DATA_URL,
|
90
|
+
sourceType: window.Camera.PictureSourceType.CAMERA,
|
91
|
+
allowEdit: false,
|
92
|
+
encodingType: window.Camera.EncodingType.JPEG,
|
93
|
+
mediaType: window.Camera.MediaType.PICTURE,
|
94
|
+
correctOrientation: true,
|
95
|
+
saveToPhotoAlbum: false,
|
96
|
+
cameraDirection: window.Camera.Direction.BACK,
|
97
|
+
});
|
98
|
+
}
|
99
|
+
else if (fileInputRef.current) {
|
100
|
+
// RESET HTML FILE INPUT VALUE SO FILES PREVIOUSLY ADDED AND REMOVED ARE RECOGNIZED
|
101
|
+
fileInputRef.current.value = '';
|
102
|
+
fileInputRef.current.click();
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
console.error('Could not find "input" element in Camera component template');
|
106
|
+
}
|
107
|
+
}, [element, onChange]);
|
108
|
+
const { isUploading, uploadErrorMessage, isLoadingImageUrl, imageUrl, loadImageUrlError, canDownload, progress, } = useAttachment(value, element, React.useCallback((id, attachment) => {
|
109
|
+
onChange(element, attachment);
|
110
|
+
}, [element, onChange]));
|
111
|
+
const handleDownload = React.useCallback(async () => {
|
112
|
+
if (typeof value === 'string') {
|
113
|
+
await downloadFileLegacy(value, id);
|
114
|
+
}
|
115
|
+
else if (value && value.type !== 'ERROR') {
|
116
|
+
await downloadAttachment(value);
|
117
|
+
}
|
118
|
+
}, [value, id]);
|
119
|
+
const handleSaveAnnotation = React.useCallback((annotationDataUri) => {
|
120
|
+
clearIsAnnotating();
|
121
|
+
if (typeof imageUrl !== 'string') {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
setState({
|
125
|
+
isLoading: true,
|
126
|
+
});
|
127
|
+
const canvas = document.createElement('canvas');
|
128
|
+
const ctx = canvas.getContext('2d');
|
129
|
+
if (!ctx) {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
const image = new Image();
|
133
|
+
image.onload = function () {
|
134
|
+
canvas.width = image.width;
|
135
|
+
canvas.height = image.height;
|
136
|
+
ctx.drawImage(image, 0, 0);
|
137
|
+
const annotationImage = new Image();
|
138
|
+
annotationImage.onload = function () {
|
139
|
+
ctx.drawImage(annotationImage, 0, 0, canvas.width, canvas.height);
|
140
|
+
try {
|
141
|
+
canvasToBlob(canvas)
|
142
|
+
.then((blob) => {
|
143
|
+
const attachment = prepareNewAttachment(blob, 'photo.png', element);
|
144
|
+
onChange(element, attachment);
|
145
|
+
setState({
|
146
|
+
isLoading: false,
|
147
|
+
});
|
148
|
+
})
|
149
|
+
.catch((error) => {
|
150
|
+
setState({
|
151
|
+
cameraError: error,
|
152
|
+
isLoading: false,
|
153
|
+
});
|
154
|
+
});
|
155
|
+
}
|
156
|
+
catch (error) {
|
157
|
+
setState({
|
158
|
+
cameraError: error,
|
159
|
+
isLoading: false,
|
160
|
+
});
|
161
|
+
}
|
162
|
+
};
|
163
|
+
annotationImage.src = annotationDataUri;
|
164
|
+
};
|
165
|
+
image.setAttribute('crossorigin', 'anonymous');
|
166
|
+
image.src = imageUrl;
|
167
|
+
}, [clearIsAnnotating, element, imageUrl, onChange]);
|
168
|
+
const progressTooltipRef = React.useRef(null);
|
169
|
+
return (React.createElement(React.Fragment, null,
|
170
|
+
React.createElement(FormElementLabelContainer, { className: "ob-camera", element: element, id: id, required: element.required },
|
171
|
+
React.createElement("div", { className: "control" },
|
172
|
+
(value || isLoading) && (React.createElement(React.Fragment, null,
|
173
|
+
React.createElement("figure", { className: "ob-figure", ref: progressTooltipRef },
|
174
|
+
React.createElement(DisplayImage, { isUploading: isUploading, uploadErrorMessage: uploadErrorMessage, isLoadingImageUrl: isLoadingImageUrl, imageUrl: imageUrl, loadImageUrlError: loadImageUrlError, isLoading: isLoading, element: element, onAnnotate: setIsAnnotating, canDownload: canDownload, progress: progress }),
|
175
|
+
progressTooltipRef.current && (React.createElement(Fade, { in: isUploading },
|
176
|
+
React.createElement("span", null,
|
177
|
+
React.createElement(ProgressBar, { isShowing: isUploading, progress: progress, tooltipAnchorEl: progressTooltipRef.current }))))))),
|
178
|
+
React.createElement("input", { ref: fileInputRef, className: "ob-input ob-camera__input-hidden cypress-camera-control", type: "file", accept: "image/*", capture: "environment", id: id, name: element.name, required: element.required, disabled: element.readOnly, onChange: fileChange }),
|
179
|
+
React.createElement("div", { className: "buttons ob-buttons" }, value ? (React.createElement(React.Fragment, null,
|
180
|
+
React.createElement("button", { type: "button", className: "button ob-button ob-button__clear is-light cypress-clear-camera", onClick: clearImage, disabled: element.readOnly || isLoading }, "Clear"),
|
181
|
+
canDownload && (React.createElement("button", { type: "button", className: "button ob-button ob-button__download is-primary cypress-download-file-button", onClick: handleDownload },
|
182
|
+
React.createElement("span", { className: "icon" },
|
183
|
+
React.createElement("i", { className: "material-icons" }, "cloud_download")),
|
184
|
+
React.createElement("span", null, "\u00A0Download"))))) : (React.createElement("button", { type: "button", className: "button ob-button ob-button__open is-primary cypress-open-camera", onClick: openCamera, disabled: element.readOnly || isLoading }, "Open Camera")))),
|
185
|
+
(isDirty || displayValidationMessage) && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
186
|
+
React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage)))),
|
187
|
+
isAnnotating && imageUrl && (React.createElement(AnnotationModal, { imageSrc: imageUrl, onClose: clearIsAnnotating, onSave: handleSaveAnnotation })),
|
188
|
+
cameraError && (React.createElement(Modal, { isOpen: true, title: "Whoops...", className: "cypress-error-modal", titleClassName: "cypress-error-title", actions: React.createElement("button", { type: "button", className: "button ob-button is-primary cypress-close-error-button", onClick: () => setState({ isLoading: false }) }, "Okay") },
|
189
|
+
React.createElement("p", null,
|
190
|
+
"An error occurred while attempting to take a photo. Please click",
|
191
|
+
' ',
|
192
|
+
React.createElement("b", null, "Okay"),
|
193
|
+
" below to try again. If the problem persists, please contact support."),
|
194
|
+
React.createElement("div", { className: "content has-margin-top-6" },
|
195
|
+
React.createElement("blockquote", null, cameraError.toString()))))));
|
196
|
+
}
|
197
|
+
export default React.memo(FormElementCamera);
|
198
|
+
const DisplayImage = React.memo(function DisplayImage({ uploadErrorMessage, isUploading, isLoadingImageUrl, imageUrl, loadImageUrlError, isLoading, element, onAnnotate, }) {
|
199
|
+
if (uploadErrorMessage) {
|
200
|
+
return (React.createElement("div", { className: "figure-content" },
|
201
|
+
React.createElement("h3", { className: "title is-3" }, "Upload Failed"),
|
202
|
+
React.createElement("p", null,
|
203
|
+
"Your photo failed to upload, please press the ",
|
204
|
+
React.createElement("b", null, "Clear"),
|
205
|
+
" button and try again.")));
|
206
|
+
}
|
207
|
+
if (loadImageUrlError) {
|
208
|
+
return (React.createElement("div", { className: "figure-content" },
|
209
|
+
React.createElement("h3", { className: "title is-3" }, "Preview Failed"),
|
210
|
+
React.createElement("p", null, loadImageUrlError.message)));
|
211
|
+
}
|
212
|
+
if (isLoadingImageUrl || isLoading) {
|
213
|
+
return (React.createElement("div", { className: "figure-content has-text-centered cypress-camera-loading-image" },
|
214
|
+
React.createElement(OnLoading, { small: true })));
|
215
|
+
}
|
216
|
+
if (imageUrl) {
|
217
|
+
return (React.createElement(React.Fragment, null,
|
218
|
+
React.createElement("span", { className: "ob-figure__status" },
|
219
|
+
React.createElement(AttachmentStatus, { isLoadingImageUrl: isLoadingImageUrl, loadImageUrlError: loadImageUrlError, isUploading: isUploading, imageUrl: imageUrl })),
|
220
|
+
React.createElement("img", { src: imageUrl, className: "cypress-camera-image ob-camera__img", crossOrigin: "anonymous" }),
|
221
|
+
React.createElement("button", { type: "button", className: "button is-primary ob-camera__annotate-button cypress-annotate-button", onClick: onAnnotate, disabled: element.readOnly },
|
222
|
+
React.createElement("span", { className: "icon" },
|
223
|
+
React.createElement("i", { className: "material-icons" }, "brush")))));
|
224
|
+
}
|
225
|
+
return (React.createElement("div", { className: "figure-content" },
|
226
|
+
React.createElement(ImagePreviewUnavailable, null)));
|
227
|
+
});
|
228
228
|
//# sourceMappingURL=FormElementCamera.js.map
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
-
declare type Props = {
|
5
|
-
element: FormTypes.CaptchaElement;
|
6
|
-
onChange: FormElementValueChangeHandler<string>;
|
7
|
-
displayValidationMessage: boolean;
|
8
|
-
validationMessage: string | undefined;
|
9
|
-
};
|
10
|
-
declare function FormElementCaptcha({ element, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
11
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementCaptcha>;
|
12
|
-
export default _default;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
+
declare type Props = {
|
5
|
+
element: FormTypes.CaptchaElement;
|
6
|
+
onChange: FormElementValueChangeHandler<string>;
|
7
|
+
displayValidationMessage: boolean;
|
8
|
+
validationMessage: string | undefined;
|
9
|
+
};
|
10
|
+
declare function FormElementCaptcha({ element, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
11
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementCaptcha>;
|
12
|
+
export default _default;
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import ReCAPTCHA from 'react-google-recaptcha';
|
3
|
-
import useCaptchaSiteKey from '../hooks/useCaptchaSiteKey';
|
4
|
-
function FormElementCaptcha({ element, onChange, validationMessage, displayValidationMessage, }) {
|
5
|
-
const captchaSiteKey = useCaptchaSiteKey();
|
6
|
-
return (React.createElement("div", { className: "cypress-captcha-element" },
|
7
|
-
React.createElement("div", { className: "ob-form__element ob-captcha" },
|
8
|
-
React.createElement(ReCAPTCHA, { sitekey: captchaSiteKey || '', onChange: (val) => {
|
9
|
-
onChange(element, val || undefined);
|
10
|
-
}, className: "ob-input cypress-captcha-control" }),
|
11
|
-
displayValidationMessage && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
12
|
-
React.createElement("div", { className: "has-text-danger ob-error__text cypress-required cypress-validation-message" }, validationMessage))))));
|
13
|
-
}
|
14
|
-
export default React.memo(FormElementCaptcha);
|
1
|
+
import * as React from 'react';
|
2
|
+
import ReCAPTCHA from 'react-google-recaptcha';
|
3
|
+
import useCaptchaSiteKey from '../hooks/useCaptchaSiteKey';
|
4
|
+
function FormElementCaptcha({ element, onChange, validationMessage, displayValidationMessage, }) {
|
5
|
+
const captchaSiteKey = useCaptchaSiteKey();
|
6
|
+
return (React.createElement("div", { className: "cypress-captcha-element" },
|
7
|
+
React.createElement("div", { className: "ob-form__element ob-captcha" },
|
8
|
+
React.createElement(ReCAPTCHA, { sitekey: captchaSiteKey || '', onChange: (val) => {
|
9
|
+
onChange(element, val || undefined);
|
10
|
+
}, className: "ob-input cypress-captcha-control" }),
|
11
|
+
displayValidationMessage && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
12
|
+
React.createElement("div", { className: "has-text-danger ob-error__text cypress-required cypress-validation-message" }, validationMessage))))));
|
13
|
+
}
|
14
|
+
export default React.memo(FormElementCaptcha);
|
15
15
|
//# sourceMappingURL=FormElementCaptcha.js.map
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
-
declare type Props = {
|
5
|
-
id: string;
|
6
|
-
element: FormTypes.CheckboxElement;
|
7
|
-
value: unknown;
|
8
|
-
onChange: FormElementValueChangeHandler<string[]>;
|
9
|
-
displayValidationMessage: boolean;
|
10
|
-
validationMessage: string | undefined;
|
11
|
-
conditionallyShownOptions: FormTypes.ChoiceElementOption[] | undefined;
|
12
|
-
};
|
13
|
-
declare function FormElementCheckboxes({ id, element, value, onChange, validationMessage, displayValidationMessage, conditionallyShownOptions, }: Props): JSX.Element;
|
14
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementCheckboxes>;
|
15
|
-
export default _default;
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
import { FormElementValueChangeHandler } from '../types/form';
|
4
|
+
declare type Props = {
|
5
|
+
id: string;
|
6
|
+
element: FormTypes.CheckboxElement;
|
7
|
+
value: unknown;
|
8
|
+
onChange: FormElementValueChangeHandler<string[]>;
|
9
|
+
displayValidationMessage: boolean;
|
10
|
+
validationMessage: string | undefined;
|
11
|
+
conditionallyShownOptions: FormTypes.ChoiceElementOption[] | undefined;
|
12
|
+
};
|
13
|
+
declare function FormElementCheckboxes({ id, element, value, onChange, validationMessage, displayValidationMessage, conditionallyShownOptions, }: Props): JSX.Element;
|
14
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementCheckboxes>;
|
15
|
+
export default _default;
|