@oneblink/apps-react 2.3.0-beta.2 → 2.3.0-beta.4
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 +479 -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 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources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EAAE,EAAE,SAAS,EAAC,IAAI;wBAEtC,2BAA2B;wBAC3B,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;4BACrB,uBAAuB;4BACvB,OAAO,CACL,oBAAC,kBAAkB,OACb,IAAI,CAAC,YAAY,EAAE,EACvB,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE;oCACvB,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;iCACtC,CAAC;4BAGA,2BAA2B;4BAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAEF,CACtB,CAAA;wBACH,CAAC,CAAC,CAEA,CACP,CAAA;oBACH,CAAC,CAAC,CAEA,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC,GAAI,CACpB,CACG,CACS,CACX;QAEP,cAAc,IAAI,CACjB,oBAAC,cAAc,IACb,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAC,qBAAqB,sDAGZ,CAClB,CACA,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { TableInstance } from 'react-table'\nimport clsx from 'clsx'\nimport { Box, Paper, TableContainer, Tooltip } from '@mui/material'\nimport makeStyles from '@mui/styles/makeStyles'\nimport {\n FilterList as FilterListIcon,\n Warning as WarningIcon,\n ArrowDownward as SortingIcon,\n} from '@mui/icons-material'\nimport { SubmissionTypes } from '@oneblink/types'\nimport { IsHoveringProvider } from '../../../hooks/useIsHovering'\nimport { NoResourcesYet } from '../../NoResourcesYet'\nimport FormStoreIcon from '../display/FormStoreIcon'\nimport HeaderCellMoreButton from './HeaderCellMoreButton'\nimport { OnChangeFilters } from '../../../hooks/useInfiniteScrollDataLoad'\nimport { formStoreService } from '@oneblink/apps'\n\nconst useStyles = makeStyles((theme) => ({\n tooltip: {\n zIndex: theme.zIndex.drawer,\n },\n sortingIcon: {\n transition: theme.transitions.create('transform'),\n },\n sortingIconDescending: {\n transform: 'rotate(180deg)',\n },\n table: {\n display: 'inline-block',\n '& .tbody .tr:last-child .tc': {\n borderBottom: 0,\n },\n '& .tc': {\n padding: theme.spacing(1),\n borderBottomColor: theme.palette.divider,\n borderBottom: '1px solid',\n display: 'flex',\n alignItems: 'center',\n '&.is-clickable': {\n cursor: 'pointer',\n transition: theme.transitions.create('transform'),\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n },\n },\n '& .td': {\n position: 'relative',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n overflowX: 'hidden',\n // minus 1 to cater for the border\n minHeight: `${parseInt(theme.spacing(5.5)) - 1}px`,\n '&.is-resizing': {\n borderRightStyle: 'dashed',\n },\n },\n '& .th': {\n position: 'relative',\n fontWeight: theme.typography.fontWeightBold,\n paddingRight: 0,\n '& .th-content': {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n paddingRight: theme.spacing(),\n '& .th-label': {\n display: 'inline-flex',\n alignItems: 'center',\n '& .th-icon': {\n marginLeft: theme.spacing(),\n },\n },\n },\n '& .resizer': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderWidth: 0,\n borderLeftStyle: 'solid',\n borderRightStyle: 'solid',\n borderColor: theme.palette.divider,\n paddingTop: theme.spacing(),\n paddingBottom: theme.spacing(),\n paddingRight: `calc(${theme.spacing(1)} + 1px)`,\n position: 'absolute',\n right: 0,\n top: theme.spacing(0.5),\n bottom: theme.spacing(0.5),\n transform: `translateX(calc(${theme.spacing(0.5)} + 1px))`,\n zIndex: 1,\n // prevents from scrolling while dragging on touch devices\n touchAction: 'none',\n '&:hover': {\n borderWidth: '1px',\n },\n '&.is-resizing': {\n borderWidth: '1px',\n borderColor: theme.palette.grey[700],\n },\n },\n },\n },\n}))\n\ntype FormStoreTableInstance = TableInstance<SubmissionTypes.FormStoreRecord>\n\nfunction FormStoreTable({\n getTableProps,\n getTableBodyProps,\n headerGroups,\n rows,\n prepareRow,\n isEmptyResults,\n onChangeFilters,\n}: {\n getTableProps: FormStoreTableInstance['getTableProps']\n getTableBodyProps: FormStoreTableInstance['getTableBodyProps']\n headerGroups: FormStoreTableInstance['headerGroups']\n rows: FormStoreTableInstance['rows']\n prepareRow: FormStoreTableInstance['prepareRow']\n isEmptyResults: boolean\n onChangeFilters: OnChangeFilters<formStoreService.FormStoreFilters>\n}) {\n const classes = useStyles()\n\n return (\n <>\n <Paper>\n <TableContainer>\n <div className={classes.table} {...getTableProps()}>\n <div className=\"thead\">\n {\n // Loop over the header rows\n headerGroups.map((headerGroup) => (\n // Apply the header row props\n <div {...headerGroup.getHeaderGroupProps()} className=\"tr\">\n {\n // Loop over the headers in each row\n headerGroup.headers.map((headerGroup) => {\n const sortingProperty = headerGroup.sorting?.property\n const sortingDirection = headerGroup.sorting?.direction\n\n return (\n <Tooltip\n title={headerGroup.tooltip || ''}\n arrow\n key={headerGroup.id}\n classes={{\n popper: classes.tooltip,\n }}\n >\n <div\n className={clsx('th tc', {\n 'is-clickable': !!sortingProperty,\n })}\n onClick={\n sortingProperty\n ? () => {\n onChangeFilters((currentFilters) => {\n switch (sortingDirection) {\n case 'ascending': {\n return {\n ...currentFilters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'descending',\n },\n ],\n }\n }\n case 'descending': {\n return {\n ...currentFilters,\n sorting: undefined,\n }\n }\n default: {\n return {\n ...currentFilters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'ascending',\n },\n ],\n }\n }\n }\n }, false)\n }\n : undefined\n }\n // Apply the header cell props\n {...headerGroup.getHeaderProps()}\n >\n <IsHoveringProvider className=\"th-content\">\n <div className=\"th-label\">\n <span>{headerGroup.headerText}</span>\n {sortingDirection && (\n <SortingIcon\n fontSize=\"small\"\n color=\"primary\"\n className={clsx(\n 'th-icon',\n classes.sortingIcon,\n {\n [classes.sortingIconDescending]:\n sortingDirection === 'descending',\n },\n )}\n />\n )}\n {headerGroup.filter?.isInvalid ? (\n <Tooltip\n title={\n headerGroup.filter?.validationMessage ||\n ''\n }\n >\n <WarningIcon\n fontSize=\"small\"\n color=\"error\"\n className=\"th-icon\"\n />\n </Tooltip>\n ) : headerGroup.filter?.value ? (\n <FilterListIcon\n fontSize=\"small\"\n color=\"primary\"\n className=\"th-icon\"\n />\n ) : null}\n </div>\n <HeaderCellMoreButton\n headerGroup={headerGroup}\n onHide={headerGroup.toggleHidden}\n />\n <div\n {...headerGroup.getResizerProps()}\n className={clsx('resizer', {\n 'is-resizing': headerGroup.isResizing,\n })}\n onClick={(event) => {\n event.stopPropagation()\n }}\n />\n </IsHoveringProvider>\n </div>\n </Tooltip>\n )\n })\n }\n </div>\n ))\n }\n </div>\n {!isEmptyResults ? (\n <div {...getTableBodyProps()} className=\"tbody\">\n {\n // Loop over the table rows\n rows.map((row) => {\n // Prepare the row for display\n prepareRow(row)\n return (\n // Apply the row props\n <div {...row.getRowProps()} className=\"tr\">\n {\n // Loop over the rows cells\n row.cells.map((cell) => {\n // Apply the cell props\n return (\n <IsHoveringProvider\n {...cell.getCellProps()}\n className={clsx('td tc', {\n 'is-resizing': cell.column.isResizing,\n })}\n >\n {\n // Render the cell contents\n cell.render('Cell')\n }\n </IsHoveringProvider>\n )\n })\n }\n </div>\n )\n })\n }\n </div>\n ) : (\n <Box padding={2} />\n )}\n </div>\n </TableContainer>\n </Paper>\n\n {isEmptyResults && (\n <NoResourcesYet\n IconComponent={FormStoreIcon}\n title=\"No Records Found...\"\n >\n There are no Submissions matching your filters.\n </NoResourcesYet>\n )}\n </>\n )\n}\n\nexport default React.memo(FormStoreTable)\n"]}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
declare function Files<T>({ id, element, isDirty, attachments, validationMessage, displayValidationMessage, onAddFiles, onRenderAttachment, }: {
|
4
|
-
id: string;
|
5
|
-
element: FormTypes.FilesElement;
|
6
|
-
isDirty: boolean;
|
7
|
-
attachments: T[];
|
8
|
-
displayValidationMessage: boolean;
|
9
|
-
validationMessage: string | undefined;
|
10
|
-
onAddFiles: (files: File[]) => void;
|
11
|
-
onRenderAttachment: (attachment: T, index: number) => React.ReactNode;
|
12
|
-
}): JSX.Element;
|
13
|
-
declare const _default: React.MemoExoticComponent<typeof Files>;
|
14
|
-
export default _default;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import FormElementLabelContainer from '../FormElementLabelContainer';
|
3
|
-
function Files({ id, element, isDirty, attachments, validationMessage, displayValidationMessage, onAddFiles, onRenderAttachment, }) {
|
4
|
-
const inputRef = React.useRef(null);
|
5
|
-
const handleAdd = React.useCallback(() => {
|
6
|
-
if (!inputRef.current)
|
7
|
-
return;
|
8
|
-
// RESET HTML FILE INPUT VALUE SO FILES PREVIOUSLY ADDED AND REMOVED ARE RECOGNISED
|
9
|
-
inputRef.current.value = '';
|
10
|
-
inputRef.current.click();
|
11
|
-
}, []);
|
12
|
-
return (React.createElement("div", { className: "cypress-files-element" },
|
13
|
-
React.createElement(FormElementLabelContainer, { className: "ob-files", element: element, id: id, required: !!element.minEntries },
|
14
|
-
React.createElement("input", { ref: inputRef, type: "file", name: element.name, id: id, className: "file-input ob-input", multiple: element.maxEntries !== 1, disabled: element.readOnly, onChange: (event) => onAddFiles(event.target.files ? Array.from(event.target.files) : []) }),
|
15
|
-
React.createElement("div", { className: "control cypress-files-control" },
|
16
|
-
React.createElement("div", { className: "columns is-multiline" },
|
17
|
-
attachments.map(onRenderAttachment),
|
18
|
-
!element.readOnly &&
|
19
|
-
(!element.maxEntries ||
|
20
|
-
attachments.length < element.maxEntries) && (React.createElement("div", { className: "column is-one-quarter" },
|
21
|
-
React.createElement("button", { type: "button", className: "button ob-files__add-new-button", onClick: handleAdd },
|
22
|
-
React.createElement("i", { className: "material-icons icon-x-large" }, "add")))))),
|
23
|
-
(isDirty || displayValidationMessage) && !!validationMessage && (React.createElement("div", { role: "alert", className: "has-margin-top-8" },
|
24
|
-
React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage))))));
|
25
|
-
}
|
26
|
-
export default React.memo(Files);
|
27
|
-
//# sourceMappingURL=Files.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Files.js","sourceRoot":"","sources":["../../../../src/components/renderer/attachments/Files.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,yBAAyB,MAAM,8BAA8B,CAAA;AAEpE,SAAS,KAAK,CAAI,EAChB,EAAE,EACF,OAAO,EACP,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,wBAAwB,EACxB,UAAU,EACV,kBAAkB,GAUnB;IACC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAA;IAErD,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAM;QAC7B,mFAAmF;QACnF,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAA;QAC3B,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,6BAAK,SAAS,EAAC,uBAAuB;QACpC,oBAAC,yBAAyB,IACxB,SAAS,EAAC,UAAU,EACpB,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU;YAE9B,+BACE,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,MAAM,EACX,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,EAAE,EAAE,EAAE,EACN,SAAS,EAAC,qBAAqB,EAC/B,QAAQ,EAAE,OAAO,CAAC,UAAU,KAAK,CAAC,EAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAEtE;YACF,6BAAK,SAAS,EAAC,+BAA+B;gBAC5C,6BAAK,SAAS,EAAC,sBAAsB;oBAClC,WAAW,CAAC,GAAG,CAAC,kBAAkB,CAAC;oBACnC,CAAC,OAAO,CAAC,QAAQ;wBAChB,CAAC,CAAC,OAAO,CAAC,UAAU;4BAClB,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAC5C,6BAAK,SAAS,EAAC,uBAAuB;wBACpC,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iCAAiC,EAC3C,OAAO,EAAE,SAAS;4BAElB,2BAAG,SAAS,EAAC,6BAA6B,UAAQ,CAC3C,CACL,CACP,CACC,CACF;YAEL,CAAC,OAAO,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC,iBAAiB,IAAI,CAC/D,6BAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,kBAAkB;gBAC5C,6BAAK,SAAS,EAAC,2DAA2D,IACvE,iBAAiB,CACd,CACF,CACP,CACyB,CACxB,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA","sourcesContent":["import * as React from 'react'\n\nimport { FormTypes } from '@oneblink/types'\nimport FormElementLabelContainer from '../FormElementLabelContainer'\n\nfunction Files<T>({\n id,\n element,\n isDirty,\n attachments,\n validationMessage,\n displayValidationMessage,\n onAddFiles,\n onRenderAttachment,\n}: {\n id: string\n element: FormTypes.FilesElement\n isDirty: boolean\n attachments: T[]\n displayValidationMessage: boolean\n validationMessage: string | undefined\n onAddFiles: (files: File[]) => void\n onRenderAttachment: (attachment: T, index: number) => React.ReactNode\n}) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n const handleAdd = React.useCallback(() => {\n if (!inputRef.current) return\n // RESET HTML FILE INPUT VALUE SO FILES PREVIOUSLY ADDED AND REMOVED ARE RECOGNISED\n inputRef.current.value = ''\n inputRef.current.click()\n }, [])\n\n return (\n <div className=\"cypress-files-element\">\n <FormElementLabelContainer\n className=\"ob-files\"\n element={element}\n id={id}\n required={!!element.minEntries}\n >\n <input\n ref={inputRef}\n type=\"file\"\n name={element.name}\n id={id}\n className=\"file-input ob-input\"\n multiple={element.maxEntries !== 1}\n disabled={element.readOnly}\n onChange={(event) =>\n onAddFiles(event.target.files ? Array.from(event.target.files) : [])\n }\n />\n <div className=\"control cypress-files-control\">\n <div className=\"columns is-multiline\">\n {attachments.map(onRenderAttachment)}\n {!element.readOnly &&\n (!element.maxEntries ||\n attachments.length < element.maxEntries) && (\n <div className=\"column is-one-quarter\">\n <button\n type=\"button\"\n className=\"button ob-files__add-new-button\"\n onClick={handleAdd}\n >\n <i className=\"material-icons icon-x-large\">add</i>\n </button>\n </div>\n )}\n </div>\n </div>\n\n {(isDirty || displayValidationMessage) && !!validationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(Files)\n"]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Tooltip } from '@mui/material';
|
3
|
-
import useIsOffline from '../../../hooks/useIsOffline';
|
4
|
-
import OnLoading from '../OnLoading';
|
5
|
-
function UploadingAttachment() {
|
6
|
-
const isOffline = useIsOffline();
|
7
|
-
return (React.createElement(Tooltip, { title: isOffline
|
8
|
-
? 'Upload will start when you connect to the internet'
|
9
|
-
: 'Uploading' },
|
10
|
-
React.createElement("div", { className: "cypress-attachment-uploading" }, isOffline ? (React.createElement("i", { className: "material-icons has-text-warning" }, "wifi_off")) : (React.createElement(OnLoading, { tiny: true })))));
|
11
|
-
}
|
12
|
-
export default React.memo(UploadingAttachment);
|
13
|
-
//# sourceMappingURL=UploadingAttachment.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"UploadingAttachment.js","sourceRoot":"","sources":["../../../../src/components/renderer/attachments/UploadingAttachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,SAAS,mBAAmB;IAC1B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,CACL,oBAAC,OAAO,IACN,KAAK,EACH,SAAS;YACP,CAAC,CAAC,oDAAoD;YACtD,CAAC,CAAC,WAAW;QAGjB,6BAAK,SAAS,EAAC,8BAA8B,IAC1C,SAAS,CAAC,CAAC,CAAC,CACX,2BAAG,SAAS,EAAC,iCAAiC,eAAa,CAC5D,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,IAAC,IAAI,SAAG,CACnB,CACG,CACE,CACX,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Tooltip } from '@mui/material'\nimport useIsOffline from '../../../hooks/useIsOffline'\nimport OnLoading from '../OnLoading'\n\nfunction UploadingAttachment() {\n const isOffline = useIsOffline()\n\n return (\n <Tooltip\n title={\n isOffline\n ? 'Upload will start when you connect to the internet'\n : 'Uploading'\n }\n >\n <div className=\"cypress-attachment-uploading\">\n {isOffline ? (\n <i className=\"material-icons has-text-warning\">wifi_off</i>\n ) : (\n <OnLoading tiny />\n )}\n </div>\n </Tooltip>\n )\n}\n\nexport default React.memo(UploadingAttachment)\n"]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { OnChange } from '../../hooks/attachments/useAttachment';
|
4
|
-
import { Attachment } from '../../types/attachments';
|
5
|
-
declare type Props = {
|
6
|
-
element: FormTypes.FilesElement;
|
7
|
-
onRemove: (id: string) => void;
|
8
|
-
file: Attachment;
|
9
|
-
disableUpload: boolean;
|
10
|
-
onChange: OnChange;
|
11
|
-
};
|
12
|
-
declare const _default: React.NamedExoticComponent<Props>;
|
13
|
-
export default _default;
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import downloadAttachment from '../../services/download-file';
|
3
|
-
import useAttachment from '../../hooks/attachments/useAttachment';
|
4
|
-
import FileCard from '../../components/renderer/attachments/FileCard';
|
5
|
-
const FormElementFile = ({ element, onRemove, file, onChange, disableUpload, }) => {
|
6
|
-
const attachmentResult = useAttachment(file, element, onChange, disableUpload);
|
7
|
-
const handleRemove = React.useCallback(() => {
|
8
|
-
if (!file.type) {
|
9
|
-
return onRemove(file.id);
|
10
|
-
}
|
11
|
-
return onRemove(file._id);
|
12
|
-
}, [file, onRemove]);
|
13
|
-
const handleDownload = React.useCallback(async () => {
|
14
|
-
await downloadAttachment(file);
|
15
|
-
}, [file]);
|
16
|
-
const handleRetry = React.useMemo(() => {
|
17
|
-
if (file.type === 'ERROR' && file.data) {
|
18
|
-
return () => {
|
19
|
-
onChange(file._id, {
|
20
|
-
type: 'NEW',
|
21
|
-
_id: file._id,
|
22
|
-
data: file.data,
|
23
|
-
fileName: file.fileName,
|
24
|
-
isPrivate: file.isPrivate,
|
25
|
-
});
|
26
|
-
};
|
27
|
-
}
|
28
|
-
}, [file, onChange]);
|
29
|
-
return (React.createElement(FileCard, { element: element, isUploading: attachmentResult.isUploading, isUploadPaused: disableUpload, uploadErrorMessage: attachmentResult.uploadErrorMessage, loadImageUrlError: attachmentResult.loadImageUrlError, isLoadingImageUrl: attachmentResult.isLoadingImageUrl, imageUrl: attachmentResult.imageUrl, fileName: file.fileName, onDownload: attachmentResult.canDownload ? handleDownload : undefined, onRemove: handleRemove, onRetry: handleRetry }));
|
30
|
-
};
|
31
|
-
export default React.memo(FormElementFile);
|
32
|
-
//# sourceMappingURL=FormElementFile.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormElementFile.js","sourceRoot":"","sources":["../../../src/form-elements/FormElementFiles/FormElementFile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,kBAAkB,MAAM,8BAA8B,CAAA;AAE7D,OAAO,aAA2B,MAAM,uCAAuC,CAAA;AAC/E,OAAO,QAAQ,MAAM,gDAAgD,CAAA;AAWrE,MAAM,eAAe,GAAG,CAAC,EACvB,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,aAAa,GACP,EAAE,EAAE;IACV,MAAM,gBAAgB,GAAG,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAA;IAE9E,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SACzB;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC3B,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAEpB,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;QAClD,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE;YACtC,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE;oBACjB,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,SAAS,EAAE,IAAI,CAAC,SAAS;iBAC1B,CAAC,CAAA;YACJ,CAAC,CAAA;SACF;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAEpB,OAAO,CACL,oBAAC,QAAQ,IACP,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,cAAc,EAAE,aAAa,EAC7B,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,EACvD,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,EACrD,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,EACrD,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,EACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EACrE,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,GACpB,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,eAAe,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport downloadAttachment from '../../services/download-file'\nimport { FormTypes } from '@oneblink/types'\nimport useAttachment, { OnChange } from '../../hooks/attachments/useAttachment'\nimport FileCard from '../../components/renderer/attachments/FileCard'\nimport { Attachment } from '../../types/attachments'\n\ntype Props = {\n element: FormTypes.FilesElement\n onRemove: (id: string) => void\n file: Attachment\n disableUpload: boolean\n onChange: OnChange\n}\n\nconst FormElementFile = ({\n element,\n onRemove,\n file,\n onChange,\n disableUpload,\n}: Props) => {\n const attachmentResult = useAttachment(file, element, onChange, disableUpload)\n\n const handleRemove = React.useCallback(() => {\n if (!file.type) {\n return onRemove(file.id)\n }\n return onRemove(file._id)\n }, [file, onRemove])\n\n const handleDownload = React.useCallback(async () => {\n await downloadAttachment(file)\n }, [file])\n\n const handleRetry = React.useMemo(() => {\n if (file.type === 'ERROR' && file.data) {\n return () => {\n onChange(file._id, {\n type: 'NEW',\n _id: file._id,\n data: file.data,\n fileName: file.fileName,\n isPrivate: file.isPrivate,\n })\n }\n }\n }, [file, onChange])\n\n return (\n <FileCard\n element={element}\n isUploading={attachmentResult.isUploading}\n isUploadPaused={disableUpload}\n uploadErrorMessage={attachmentResult.uploadErrorMessage}\n loadImageUrlError={attachmentResult.loadImageUrlError}\n isLoadingImageUrl={attachmentResult.isLoadingImageUrl}\n imageUrl={attachmentResult.imageUrl}\n fileName={file.fileName}\n onDownload={attachmentResult.canDownload ? handleDownload : undefined}\n onRemove={handleRemove}\n onRetry={handleRetry}\n />\n )\n}\n\nexport default React.memo<Props>(FormElementFile)\n"]}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
declare const _default: React.NamedExoticComponent<{
|
3
|
-
canDownload: boolean;
|
4
|
-
imageUrl?: string | null | undefined;
|
5
|
-
loadImageUrlError?: Error | undefined;
|
6
|
-
isUploading: boolean;
|
7
|
-
uploadErrorMessage: string | undefined;
|
8
|
-
isLoadingImageUrl: boolean;
|
9
|
-
}>;
|
10
|
-
export default _default;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
const FormElementFileDisplay = ({ imageUrl, }) => {
|
3
|
-
if (imageUrl) {
|
4
|
-
return (React.createElement("div", { className: "ob-files__content-image" },
|
5
|
-
React.createElement("img", { className: "ob-files__image", src: imageUrl })));
|
6
|
-
}
|
7
|
-
return (React.createElement("div", { className: "ob-files__content-file has-text-centered" },
|
8
|
-
React.createElement("i", { className: "material-icons icon-large ob-files__attach-icon has-text-grey" }, "attach_file")));
|
9
|
-
};
|
10
|
-
export default React.memo(FormElementFileDisplay);
|
11
|
-
//# sourceMappingURL=FormElementFileDisplay.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormElementFileDisplay.js","sourceRoot":"","sources":["../../../src/form-elements/FormElementFiles/FormElementFileDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,sBAAsB,GAAG,CAAC,EAC9B,QAAQ,GACyB,EAAE,EAAE;IACrC,IAAI,QAAQ,EAAE;QACZ,OAAO,CACL,6BAAK,SAAS,EAAC,yBAAyB;YACtC,6BAAK,SAAS,EAAC,iBAAiB,EAAC,GAAG,EAAE,QAAQ,GAAI,CAC9C,CACP,CAAA;KACF;IAED,OAAO,CACL,6BAAK,SAAS,EAAC,0CAA0C;QACvD,2BAAG,SAAS,EAAC,+DAA+D,kBAExE,CACA,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CACvB,sBAAsB,CACvB,CAAA","sourcesContent":["import * as React from 'react'\nimport useAttachment from '../../hooks/attachments/useAttachment'\n\nconst FormElementFileDisplay = ({\n imageUrl,\n}: ReturnType<typeof useAttachment>) => {\n if (imageUrl) {\n return (\n <div className=\"ob-files__content-image\">\n <img className=\"ob-files__image\" src={imageUrl} />\n </div>\n )\n }\n\n return (\n <div className=\"ob-files__content-file has-text-centered\">\n <i className=\"material-icons icon-large ob-files__attach-icon has-text-grey\">\n attach_file\n </i>\n </div>\n )\n}\n\nexport default React.memo<ReturnType<typeof useAttachment>>(\n FormElementFileDisplay,\n)\n"]}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { Attachment } from '../../types/attachments';
|
4
|
-
import { FormElementValueChangeHandler } from '../../types/form';
|
5
|
-
declare type Props = {
|
6
|
-
id: string;
|
7
|
-
element: FormTypes.FilesElement;
|
8
|
-
value?: Attachment[];
|
9
|
-
onChange: FormElementValueChangeHandler<Attachment[]>;
|
10
|
-
displayValidationMessage: boolean;
|
11
|
-
validationMessage: string | undefined;
|
12
|
-
};
|
13
|
-
declare function FormElementFiles({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
14
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementFiles>;
|
15
|
-
export default _default;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import Files from '../../components/renderer/attachments/Files';
|
3
|
-
import FormElementFile from './FormElementFile';
|
4
|
-
import useAttachments from '../../hooks/attachments/useAttachments';
|
5
|
-
import { checkFileNameIsValid, checkFileNameExtensionIsValid, } from '../../services/form-validation';
|
6
|
-
function FormElementFiles({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
7
|
-
const { isDirty, addAttachments, removeAttachment, changeAttachment } = useAttachments(element, onChange);
|
8
|
-
const attachments = value || [];
|
9
|
-
const handleRenderAttachment = React.useCallback((attachment, index) => {
|
10
|
-
return (React.createElement(FormElementFile, { key: index, element: element, onRemove: removeAttachment, file: attachment, onChange: changeAttachment, disableUpload: (!!element.maxEntries && attachments.length > element.maxEntries) ||
|
11
|
-
!checkFileNameIsValid(element, attachment.fileName) ||
|
12
|
-
!checkFileNameExtensionIsValid(element, attachment.fileName) }));
|
13
|
-
}, [attachments.length, changeAttachment, element, removeAttachment]);
|
14
|
-
return (React.createElement(Files, { id: id, isDirty: isDirty, element: element, attachments: attachments, displayValidationMessage: displayValidationMessage, validationMessage: validationMessage, onAddFiles: addAttachments, onRenderAttachment: handleRenderAttachment }));
|
15
|
-
}
|
16
|
-
export default React.memo(FormElementFiles);
|
17
|
-
//# sourceMappingURL=FormElementFiles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormElementFiles.js","sourceRoot":"","sources":["../../../src/form-elements/FormElementFiles/FormElementFiles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK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wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,cAAc,EAC1B,kBAAkB,EAAE,sBAAsB,GAC1C,CACH,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport Files from '../../components/renderer/attachments/Files'\nimport FormElementFile from './FormElementFile'\nimport useAttachments from '../../hooks/attachments/useAttachments'\nimport {\n checkFileNameIsValid,\n checkFileNameExtensionIsValid,\n} from '../../services/form-validation'\nimport { Attachment } from '../../types/attachments'\nimport { FormElementValueChangeHandler } from '../../types/form'\ntype Props = {\n id: string\n element: FormTypes.FilesElement\n value?: Attachment[]\n onChange: FormElementValueChangeHandler<Attachment[]>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\nfunction FormElementFiles({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n}: Props) {\n const { isDirty, addAttachments, removeAttachment, changeAttachment } =\n useAttachments(element, onChange)\n\n const attachments = value || []\n\n const handleRenderAttachment = React.useCallback(\n (attachment, index) => {\n return (\n <FormElementFile\n key={index}\n element={element}\n onRemove={removeAttachment}\n file={attachment}\n onChange={changeAttachment}\n disableUpload={\n (!!element.maxEntries && attachments.length > element.maxEntries) ||\n !checkFileNameIsValid(element, attachment.fileName) ||\n !checkFileNameExtensionIsValid(element, attachment.fileName)\n }\n />\n )\n },\n [attachments.length, changeAttachment, element, removeAttachment],\n )\n\n return (\n <Files\n id={id}\n isDirty={isDirty}\n element={element}\n attachments={attachments}\n displayValidationMessage={displayValidationMessage}\n validationMessage={validationMessage}\n onAddFiles={addAttachments}\n onRenderAttachment={handleRenderAttachment}\n />\n )\n}\n\nexport default React.memo(FormElementFiles)\n"]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
const FormElementFilesInvalidAttachment = ({ file }) => {
|
3
|
-
return (React.createElement("div", { className: "ob-files__upload-error" },
|
4
|
-
React.createElement("i", { className: "material-icons has-text-warning icon-small ob-files__upload-error-icon" }, "error"),
|
5
|
-
React.createElement("span", null,
|
6
|
-
"An error occurred uploading the file ",
|
7
|
-
`"${file.fileName}"`,
|
8
|
-
".")));
|
9
|
-
};
|
10
|
-
export default React.memo(FormElementFilesInvalidAttachment);
|
11
|
-
//# sourceMappingURL=FormElementFilesInvalidAttachment.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormElementFilesInvalidAttachment.js","sourceRoot":"","sources":["../../../src/form-elements/FormElementFiles/FormElementFilesInvalidAttachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,iCAAiC,GAAG,CAAC,EAAE,IAAI,EAAS,EAAE,EAAE;IAC5D,OAAO,CACL,6BAAK,SAAS,EAAC,wBAAwB;QACrC,2BAAG,SAAS,EAAC,wEAAwE,YAEjF;QACJ;;YAA4C,IAAI,IAAI,CAAC,QAAQ,GAAG;gBAAS,CACrE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,iCAAiC,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { AttachmentError } from '../../types/attachments'\n\ninterface Props {\n file: AttachmentError\n}\n\nconst FormElementFilesInvalidAttachment = ({ file }: Props) => {\n return (\n <div className=\"ob-files__upload-error\">\n <i className=\"material-icons has-text-warning icon-small ob-files__upload-error-icon\">\n error\n </i>\n <span>An error occurred uploading the file {`\"${file.fileName}\"`}.</span>\n </div>\n )\n}\n\nexport default React.memo<Props>(FormElementFilesInvalidAttachment)\n"]}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FilesElementFile } from './legacy/FormElementFiles';
|
4
|
-
import { Attachment } from '../../types/attachments';
|
5
|
-
import { FormElementValueChangeHandler } from '../../types/form';
|
6
|
-
export declare type PossibleFileConfiguration = Attachment | FilesElementFile;
|
7
|
-
interface Props {
|
8
|
-
id: string;
|
9
|
-
element: FormTypes.FilesElement;
|
10
|
-
value: unknown;
|
11
|
-
onChange: FormElementValueChangeHandler;
|
12
|
-
displayValidationMessage: boolean;
|
13
|
-
validationMessage: string | undefined;
|
14
|
-
}
|
15
|
-
export declare function stringifyAttachments(value: Attachment[] | undefined): string;
|
16
|
-
declare const _default: React.NamedExoticComponent<Props>;
|
17
|
-
export default _default;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import FormElementFilesLegacy from './legacy/FormElementFiles';
|
3
|
-
import FormElementFiles from './FormElementFiles';
|
4
|
-
import { checkIsUsingLegacyStorage } from '../../services/attachments';
|
5
|
-
export function stringifyAttachments(value) {
|
6
|
-
if (value === null || value === void 0 ? void 0 : value.every((attachment) => !attachment.type)) {
|
7
|
-
return JSON.stringify(value);
|
8
|
-
}
|
9
|
-
return '';
|
10
|
-
}
|
11
|
-
const FormElementFilesController = ({ value, onChange, ...props }) => {
|
12
|
-
if (checkIsUsingLegacyStorage(props.element)) {
|
13
|
-
return (React.createElement(FormElementFilesLegacy, { value: value, onChange: onChange, ...props }));
|
14
|
-
}
|
15
|
-
return (React.createElement(FormElementFiles, { value: value, onChange: onChange, ...props }));
|
16
|
-
};
|
17
|
-
export default React.memo(FormElementFilesController);
|
18
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-elements/FormElementFiles/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,sBAEN,MAAM,2BAA2B,CAAA;AAClC,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAYtE,MAAM,UAAU,oBAAoB,CAAC,KAA+B;IAClE,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;KAC7B;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAS,EAAE,EAAE;IAC1E,IAAI,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;QAC5C,OAAO,CACL,oBAAC,sBAAsB,IACrB,KAAK,EAAE,KAAuC,EAC9C,QAAQ,EAAE,QAA6D,KACnE,KAAK,GACT,CACH,CAAA;KACF;IACD,OAAO,CACL,oBAAC,gBAAgB,IACf,KAAK,EAAE,KAAiC,EACxC,QAAQ,EAAE,QAAuD,KAC7D,KAAK,GACT,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,0BAA0B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport FormElementFilesLegacy, {\n FilesElementFile,\n} from './legacy/FormElementFiles'\nimport FormElementFiles from './FormElementFiles'\nimport { Attachment } from '../../types/attachments'\nimport { checkIsUsingLegacyStorage } from '../../services/attachments'\nimport { FormElementValueChangeHandler } from '../../types/form'\nexport type PossibleFileConfiguration = Attachment | FilesElementFile\ninterface Props {\n id: string\n element: FormTypes.FilesElement\n value: unknown\n onChange: FormElementValueChangeHandler\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\nexport function stringifyAttachments(value: Attachment[] | undefined): string {\n if (value?.every((attachment) => !attachment.type)) {\n return JSON.stringify(value)\n }\n return ''\n}\n\nconst FormElementFilesController = ({ value, onChange, ...props }: Props) => {\n if (checkIsUsingLegacyStorage(props.element)) {\n return (\n <FormElementFilesLegacy\n value={value as FilesElementFile[] | undefined}\n onChange={onChange as FormElementValueChangeHandler<FilesElementFile[]>}\n {...props}\n />\n )\n }\n return (\n <FormElementFiles\n value={value as Attachment[] | undefined}\n onChange={onChange as FormElementValueChangeHandler<Attachment[]>}\n {...props}\n />\n )\n}\n\nexport default React.memo<Props>(FormElementFilesController)\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
import { FormElementValueChangeHandler } from '../../../types/form';
|
4
|
-
export declare type FilesElementFile = {
|
5
|
-
data: string;
|
6
|
-
fileName: string;
|
7
|
-
};
|
8
|
-
declare type Props = {
|
9
|
-
id: string;
|
10
|
-
element: FormTypes.FilesElement;
|
11
|
-
value: FilesElementFile[] | undefined;
|
12
|
-
onChange: FormElementValueChangeHandler<FilesElementFile[]>;
|
13
|
-
displayValidationMessage: boolean;
|
14
|
-
validationMessage: string | undefined;
|
15
|
-
};
|
16
|
-
declare function FormElementFiles({ id, element, value, onChange, validationMessage, displayValidationMessage, }: Props): JSX.Element;
|
17
|
-
declare const _default: React.MemoExoticComponent<typeof FormElementFiles>;
|
18
|
-
export default _default;
|
@@ -1,61 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import useBooleanState from '../../../hooks/useBooleanState';
|
3
|
-
import useIsMounted from '../../../hooks/useIsMounted';
|
4
|
-
import FileCard from '../../../components/renderer/attachments/FileCard';
|
5
|
-
import { downloadFileLegacy } from '../../../services/download-file';
|
6
|
-
import Files from '../../../components/renderer/attachments/Files';
|
7
|
-
import { checkIfContentTypeIsImage, parseFilesAsAttachmentsLegacy, } from '../../../services/attachments';
|
8
|
-
const FormElementFile = ({ element, onRemove, file, index }) => {
|
9
|
-
const isImageType = React.useMemo(() => {
|
10
|
-
const matches = file.data.match(/data:(\w*\/\w*);base64/);
|
11
|
-
if (!matches) {
|
12
|
-
return false;
|
13
|
-
}
|
14
|
-
return checkIfContentTypeIsImage(matches[1]);
|
15
|
-
}, [file.data]);
|
16
|
-
const handleRemove = React.useCallback(() => onRemove(index), [index, onRemove]);
|
17
|
-
const handleDownload = React.useCallback(async () => {
|
18
|
-
await downloadFileLegacy(file.data, file.fileName);
|
19
|
-
}, [file]);
|
20
|
-
return (React.createElement(FileCard, { element: element, imageUrl: isImageType ? file.data : null, fileName: file.fileName, onDownload: handleDownload, onRemove: handleRemove }));
|
21
|
-
};
|
22
|
-
const MemorisedFile = React.memo(FormElementFile);
|
23
|
-
function FormElementFiles({ id, element, value, onChange, validationMessage, displayValidationMessage, }) {
|
24
|
-
const [isDirty, setIsDirty] = useBooleanState(false);
|
25
|
-
const isMounted = useIsMounted();
|
26
|
-
const addFile = React.useCallback(async (newFiles) => {
|
27
|
-
const attachments = await parseFilesAsAttachmentsLegacy(newFiles);
|
28
|
-
if (!attachments.length) {
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
onChange(element, (existingAttachments) => {
|
32
|
-
if (!existingAttachments) {
|
33
|
-
return attachments;
|
34
|
-
}
|
35
|
-
return [...existingAttachments, ...attachments];
|
36
|
-
});
|
37
|
-
if (isMounted.current) {
|
38
|
-
setIsDirty();
|
39
|
-
}
|
40
|
-
}, [element, isMounted, onChange, setIsDirty]);
|
41
|
-
const handleRemove = React.useCallback((index) => {
|
42
|
-
onChange(element, (existingValue) => {
|
43
|
-
if (!existingValue) {
|
44
|
-
return;
|
45
|
-
}
|
46
|
-
const newValue = existingValue.filter((file, i) => i !== index);
|
47
|
-
if (newValue.length) {
|
48
|
-
return newValue;
|
49
|
-
}
|
50
|
-
});
|
51
|
-
if (isMounted.current) {
|
52
|
-
setIsDirty();
|
53
|
-
}
|
54
|
-
}, [element, isMounted, onChange, setIsDirty]);
|
55
|
-
const handleRenderAttachment = React.useCallback((attachment, index) => {
|
56
|
-
return (React.createElement(MemorisedFile, { key: index, element: element, onRemove: handleRemove, file: attachment, index: index }));
|
57
|
-
}, [element, handleRemove]);
|
58
|
-
return (React.createElement(Files, { id: id, element: element, isDirty: isDirty, attachments: value || [], displayValidationMessage: displayValidationMessage, validationMessage: validationMessage, onAddFiles: addFile, onRenderAttachment: handleRenderAttachment }));
|
59
|
-
}
|
60
|
-
export default React.memo(FormElementFiles);
|
61
|
-
//# sourceMappingURL=FormElementFiles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormElementFiles.js","sourceRoot":"","sources":["../../../../src/form-elements/FormElementFiles/legacy/FormElementFiles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,eAAe,MAAM,gCAAgC,CAAA;AAC5D,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,QAAQ,MAAM,mDAAmD,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,OAAO,KAAK,MAAM,gDAAgD,CAAA;AAClE,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAA;AAwBtC,MAAM,eAAe,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAc,EAAE,EAAE;IACzE,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;QACzD,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,KAAK,CAAA;SACb;QACD,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACf,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CACpC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAClB,CAAA;IACD,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;Q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/useBooleanState'\nimport useIsMounted from '../../../hooks/useIsMounted'\nimport FileCard from '../../../components/renderer/attachments/FileCard'\nimport { downloadFileLegacy } from '../../../services/download-file'\nimport { FormTypes } from '@oneblink/types'\nimport Files from '../../../components/renderer/attachments/Files'\nimport {\n checkIfContentTypeIsImage,\n parseFilesAsAttachmentsLegacy,\n} from '../../../services/attachments'\nimport { FormElementValueChangeHandler } from '../../../types/form'\n\nexport type FilesElementFile = {\n data: string\n fileName: string\n}\n\ntype Props = {\n id: string\n element: FormTypes.FilesElement\n value: FilesElementFile[] | undefined\n onChange: FormElementValueChangeHandler<FilesElementFile[]>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\ntype ChildProps = {\n element: FormTypes.FilesElement\n onRemove: (index: number) => unknown\n file: FilesElementFile\n index: number\n}\n\nconst FormElementFile = ({ element, onRemove, file, index }: ChildProps) => {\n const isImageType = React.useMemo(() => {\n const matches = file.data.match(/data:(\\w*\\/\\w*);base64/)\n if (!matches) {\n return false\n }\n return checkIfContentTypeIsImage(matches[1])\n }, [file.data])\n const handleRemove = React.useCallback(\n () => onRemove(index),\n [index, onRemove],\n )\n const handleDownload = React.useCallback(async () => {\n await downloadFileLegacy(file.data, file.fileName)\n }, [file])\n\n return (\n <FileCard\n element={element}\n imageUrl={isImageType ? file.data : null}\n fileName={file.fileName}\n onDownload={handleDownload}\n onRemove={handleRemove}\n />\n )\n}\n\nconst MemorisedFile = React.memo(FormElementFile)\n\nfunction FormElementFiles({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n}: Props) {\n const [isDirty, setIsDirty] = useBooleanState(false)\n const isMounted = useIsMounted()\n\n const addFile = React.useCallback(\n async (newFiles) => {\n const attachments = await parseFilesAsAttachmentsLegacy(newFiles)\n if (!attachments.length) {\n return\n }\n\n onChange(element, (existingAttachments) => {\n if (!existingAttachments) {\n return attachments\n }\n return [...existingAttachments, ...attachments]\n })\n if (isMounted.current) {\n setIsDirty()\n }\n },\n [element, isMounted, onChange, setIsDirty],\n )\n\n const handleRemove = React.useCallback(\n (index: number) => {\n onChange(element, (existingValue) => {\n if (!existingValue) {\n return\n }\n const newValue = existingValue.filter((file, i) => i !== index)\n if (newValue.length) {\n return newValue\n }\n })\n if (isMounted.current) {\n setIsDirty()\n }\n },\n [element, isMounted, onChange, setIsDirty],\n )\n\n const handleRenderAttachment = React.useCallback(\n (attachment, index) => {\n return (\n <MemorisedFile\n key={index}\n element={element}\n onRemove={handleRemove}\n file={attachment}\n index={index}\n />\n )\n },\n [element, handleRemove],\n )\n\n return (\n <Files\n id={id}\n element={element}\n isDirty={isDirty}\n attachments={value || []}\n displayValidationMessage={displayValidationMessage}\n validationMessage={validationMessage}\n onAddFiles={addFile}\n onRenderAttachment={handleRenderAttachment}\n />\n )\n}\n\nexport default React.memo(FormElementFiles)\n"]}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
declare type AttachmentObjectBlob = {
|
3
|
-
attachmentId: string;
|
4
|
-
blob: Blob;
|
5
|
-
};
|
6
|
-
declare type RegisterAttachmentParam = {
|
7
|
-
blob: Blob;
|
8
|
-
attachmentId: string;
|
9
|
-
};
|
10
|
-
declare type ReplacePreUploadIdParam = {
|
11
|
-
attachmentId: string;
|
12
|
-
preUploadId: string;
|
13
|
-
};
|
14
|
-
declare type AttachmentObjectURLsContextValue = {
|
15
|
-
registerAttachmentObjectURL: (options: RegisterAttachmentParam) => void;
|
16
|
-
replacePreUploadIdWithAttachmentId: (options: ReplacePreUploadIdParam) => void;
|
17
|
-
attachmentObjectURLs: Array<AttachmentObjectBlob>;
|
18
|
-
};
|
19
|
-
declare type Props = {
|
20
|
-
children: React.ReactNode;
|
21
|
-
};
|
22
|
-
export declare const AttachmentObjectURLsProvider: ({ children }: Props) => JSX.Element;
|
23
|
-
declare const useAttachmentObjectURLs: () => AttachmentObjectURLsContextValue;
|
24
|
-
export default useAttachmentObjectURLs;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
const AttachmentObjectURLsContext = React.createContext({
|
3
|
-
registerAttachmentObjectURL: () => { },
|
4
|
-
replacePreUploadIdWithAttachmentId: () => { },
|
5
|
-
attachmentObjectURLs: [],
|
6
|
-
});
|
7
|
-
export const AttachmentObjectURLsProvider = ({ children }) => {
|
8
|
-
const [attachmentObjectURLs, setAttachmentObjectURLs] = React.useState([]);
|
9
|
-
const registerAttachmentObjectURL = React.useCallback((newAttachment) => {
|
10
|
-
setAttachmentObjectURLs((c) => [...c, newAttachment]);
|
11
|
-
}, []);
|
12
|
-
const replacePreUploadIdWithAttachmentId = React.useCallback(({ attachmentId: newAttachmentId, preUploadId, }) => {
|
13
|
-
setAttachmentObjectURLs((c) => {
|
14
|
-
return c.map(({ attachmentId, blob }) => {
|
15
|
-
return {
|
16
|
-
blob,
|
17
|
-
attachmentId: attachmentId === preUploadId ? newAttachmentId : attachmentId,
|
18
|
-
};
|
19
|
-
});
|
20
|
-
});
|
21
|
-
}, []);
|
22
|
-
const value = React.useMemo(() => ({
|
23
|
-
attachmentObjectURLs,
|
24
|
-
registerAttachmentObjectURL,
|
25
|
-
replacePreUploadIdWithAttachmentId,
|
26
|
-
}), [
|
27
|
-
attachmentObjectURLs,
|
28
|
-
registerAttachmentObjectURL,
|
29
|
-
replacePreUploadIdWithAttachmentId,
|
30
|
-
]);
|
31
|
-
return (React.createElement(AttachmentObjectURLsContext.Provider, { value: value }, children));
|
32
|
-
};
|
33
|
-
const useAttachmentObjectURLs = () => {
|
34
|
-
return React.useContext(AttachmentObjectURLsContext);
|
35
|
-
};
|
36
|
-
export default useAttachmentObjectURLs;
|
37
|
-
//# sourceMappingURL=useAttachmentObjectURLs.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useAttachmentObjectURLs.js","sourceRoot":"","sources":["../../../src/hooks/attachments/useAttachmentObjectURLs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAw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B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAC/C,QAAQ,CAC4B,CACxC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACnC,OAAO,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAA;AACtD,CAAC,CAAA;AACD,eAAe,uBAAuB,CAAA","sourcesContent":["import * as React from 'react'\n\ntype AttachmentObjectBlob = {\n attachmentId: string\n blob: Blob\n}\ntype RegisterAttachmentParam = {\n blob: Blob\n attachmentId: string\n}\ntype ReplacePreUploadIdParam = {\n attachmentId: string\n preUploadId: string\n}\ntype AttachmentObjectURLsContextValue = {\n registerAttachmentObjectURL: (options: RegisterAttachmentParam) => void\n replacePreUploadIdWithAttachmentId: (options: ReplacePreUploadIdParam) => void\n attachmentObjectURLs: Array<AttachmentObjectBlob>\n}\n\ntype Props = {\n children: React.ReactNode\n}\n\nconst AttachmentObjectURLsContext =\n React.createContext<AttachmentObjectURLsContextValue>({\n registerAttachmentObjectURL: () => {},\n replacePreUploadIdWithAttachmentId: () => {},\n attachmentObjectURLs: [],\n })\n\nexport const AttachmentObjectURLsProvider = ({ children }: Props) => {\n const [attachmentObjectURLs, setAttachmentObjectURLs] = React.useState<\n AttachmentObjectBlob[]\n >([])\n const registerAttachmentObjectURL = React.useCallback(\n (newAttachment: RegisterAttachmentParam) => {\n setAttachmentObjectURLs((c) => [...c, newAttachment])\n },\n [],\n )\n\n const replacePreUploadIdWithAttachmentId = React.useCallback(\n ({\n attachmentId: newAttachmentId,\n preUploadId,\n }: ReplacePreUploadIdParam) => {\n setAttachmentObjectURLs((c) => {\n return c.map(({ attachmentId, blob }) => {\n return {\n blob,\n attachmentId:\n attachmentId === preUploadId ? newAttachmentId : attachmentId,\n }\n })\n })\n },\n [],\n )\n\n const value = React.useMemo(\n () => ({\n attachmentObjectURLs,\n registerAttachmentObjectURL,\n replacePreUploadIdWithAttachmentId,\n }),\n [\n attachmentObjectURLs,\n registerAttachmentObjectURL,\n replacePreUploadIdWithAttachmentId,\n ],\n )\n\n return (\n <AttachmentObjectURLsContext.Provider value={value}>\n {children}\n </AttachmentObjectURLsContext.Provider>\n )\n}\n\nconst useAttachmentObjectURLs = () => {\n return React.useContext(AttachmentObjectURLsContext)\n}\nexport default useAttachmentObjectURLs\n"]}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
declare type AttachmentObjectBlob = {
|
3
|
-
attachmentId: string;
|
4
|
-
blob: Blob;
|
5
|
-
};
|
6
|
-
declare type RegisterAttachmentParam = {
|
7
|
-
blob: Blob;
|
8
|
-
attachmentId: string;
|
9
|
-
};
|
10
|
-
declare type ReplacePreUploadIdParam = {
|
11
|
-
attachmentId: string;
|
12
|
-
preUploadId: string;
|
13
|
-
};
|
14
|
-
declare type AttachmentBlobsContextValue = {
|
15
|
-
registerAttachmentBlob: (options: RegisterAttachmentParam) => void;
|
16
|
-
replacePreUploadIdWithAttachmentId: (options: ReplacePreUploadIdParam) => void;
|
17
|
-
getAttachmentBlob: (attachmentId: string) => AttachmentObjectBlob | undefined;
|
18
|
-
};
|
19
|
-
declare type Props = {
|
20
|
-
children: React.ReactNode;
|
21
|
-
};
|
22
|
-
export declare const AttachmentBlobsProvider: ({ children }: Props) => JSX.Element;
|
23
|
-
declare const useAttachmentBlobs: () => AttachmentBlobsContextValue;
|
24
|
-
export default useAttachmentBlobs;
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
const AttachmentBlobsContext = React.createContext({
|
3
|
-
registerAttachmentBlob: () => { },
|
4
|
-
replacePreUploadIdWithAttachmentId: () => { },
|
5
|
-
getAttachmentBlob: () => undefined,
|
6
|
-
});
|
7
|
-
export const AttachmentBlobsProvider = ({ children }) => {
|
8
|
-
const [attachmentBlobs, setAttachmentBlobs] = React.useState([]);
|
9
|
-
const registerAttachmentBlob = React.useCallback((newAttachment) => {
|
10
|
-
setAttachmentBlobs((c) => [...c, newAttachment]);
|
11
|
-
}, []);
|
12
|
-
const replacePreUploadIdWithAttachmentId = React.useCallback(({ attachmentId: newAttachmentId, preUploadId, }) => {
|
13
|
-
setAttachmentBlobs((c) => {
|
14
|
-
return c.map(({ attachmentId, blob }) => {
|
15
|
-
return {
|
16
|
-
blob,
|
17
|
-
attachmentId: attachmentId === preUploadId ? newAttachmentId : attachmentId,
|
18
|
-
};
|
19
|
-
});
|
20
|
-
});
|
21
|
-
}, []);
|
22
|
-
const getAttachmentBlob = React.useCallback((attachmentId) => {
|
23
|
-
return attachmentBlobs.find((b) => b.attachmentId === attachmentId);
|
24
|
-
}, [attachmentBlobs]);
|
25
|
-
const value = React.useMemo(() => ({
|
26
|
-
registerAttachmentBlob,
|
27
|
-
replacePreUploadIdWithAttachmentId,
|
28
|
-
getAttachmentBlob,
|
29
|
-
}), [
|
30
|
-
registerAttachmentBlob,
|
31
|
-
replacePreUploadIdWithAttachmentId,
|
32
|
-
getAttachmentBlob,
|
33
|
-
]);
|
34
|
-
return (React.createElement(AttachmentBlobsContext.Provider, { value: value }, children));
|
35
|
-
};
|
36
|
-
const useAttachmentBlobs = () => {
|
37
|
-
return React.useContext(AttachmentBlobsContext);
|
38
|
-
};
|
39
|
-
export default useAttachmentBlobs;
|
40
|
-
//# sourceMappingURL=useLocalAttachmentBlobs.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useLocalAttachmentBlobs.js","sourceRoot":"","sources":["../../../src/hooks/attachments/useLocalAttachmentBlobs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAwB9B,MAAM,sBAAsB,GAAG,KAAK,CAAC,aAAa,CAChD;IACE,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC;IAChC,kCAAkC,EAAE,GAAG,EAAE,GAAE,CAAC;IAC5C,iBAAiB,EAAE,GAAG,EAAE,CAAC,SAAS;CACnC,CACF,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG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sB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAC1C,QAAQ,CACuB,CACnC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAA;AACjD,CAAC,CAAA;AACD,eAAe,kBAAkB,CAAA","sourcesContent":["import * as React from 'react'\n\ntype AttachmentObjectBlob = {\n attachmentId: string\n blob: Blob\n}\ntype RegisterAttachmentParam = {\n blob: Blob\n attachmentId: string\n}\ntype ReplacePreUploadIdParam = {\n attachmentId: string\n preUploadId: string\n}\ntype AttachmentBlobsContextValue = {\n registerAttachmentBlob: (options: RegisterAttachmentParam) => void\n replacePreUploadIdWithAttachmentId: (options: ReplacePreUploadIdParam) => void\n getAttachmentBlob: (attachmentId: string) => AttachmentObjectBlob | undefined\n}\n\ntype Props = {\n children: React.ReactNode\n}\n\nconst AttachmentBlobsContext = React.createContext<AttachmentBlobsContextValue>(\n {\n registerAttachmentBlob: () => {},\n replacePreUploadIdWithAttachmentId: () => {},\n getAttachmentBlob: () => undefined,\n },\n)\n\nexport const AttachmentBlobsProvider = ({ children }: Props) => {\n const [attachmentBlobs, setAttachmentBlobs] = React.useState<\n AttachmentObjectBlob[]\n >([])\n const registerAttachmentBlob = React.useCallback(\n (newAttachment: RegisterAttachmentParam) => {\n setAttachmentBlobs((c) => [...c, newAttachment])\n },\n [],\n )\n\n const replacePreUploadIdWithAttachmentId = React.useCallback(\n ({\n attachmentId: newAttachmentId,\n preUploadId,\n }: ReplacePreUploadIdParam) => {\n setAttachmentBlobs((c) => {\n return c.map(({ attachmentId, blob }) => {\n return {\n blob,\n attachmentId:\n attachmentId === preUploadId ? newAttachmentId : attachmentId,\n }\n })\n })\n },\n [],\n )\n\n const getAttachmentBlob = React.useCallback(\n (attachmentId: string) => {\n return attachmentBlobs.find((b) => b.attachmentId === attachmentId)\n },\n [attachmentBlobs],\n )\n\n const value = React.useMemo(\n () => ({\n registerAttachmentBlob,\n replacePreUploadIdWithAttachmentId,\n getAttachmentBlob,\n }),\n [\n registerAttachmentBlob,\n replacePreUploadIdWithAttachmentId,\n getAttachmentBlob,\n ],\n )\n\n return (\n <AttachmentBlobsContext.Provider value={value}>\n {children}\n </AttachmentBlobsContext.Provider>\n )\n}\n\nconst useAttachmentBlobs = () => {\n return React.useContext(AttachmentBlobsContext)\n}\nexport default useAttachmentBlobs\n"]}
|