@oneblink/apps-react 0.6.2-beta.2 → 1.0.0-beta.1
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.js +2 -2
- package/dist/OneBlinkAutoSaveForm.js.map +1 -1
- package/dist/OneBlinkFormBase.js +4 -4
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/OneBlinkFormStoreView.d.ts +8 -0
- package/dist/OneBlinkFormStoreView.js +55 -0
- package/dist/OneBlinkFormStoreView.js.map +1 -0
- package/dist/components/CopyToClipboardIconButton.d.ts +10 -0
- package/dist/components/CopyToClipboardIconButton.js +42 -0
- package/dist/components/CopyToClipboardIconButton.js.map +1 -0
- package/dist/components/CustomAccordion.d.ts +27 -0
- package/dist/components/CustomAccordion.js +40 -0
- package/dist/components/CustomAccordion.js.map +1 -0
- package/dist/components/ErrorMessage.d.ts +13 -0
- package/dist/components/ErrorMessage.js +13 -0
- package/dist/components/ErrorMessage.js.map +1 -0
- package/dist/components/ErrorSnackbar.d.ts +8 -0
- package/dist/components/ErrorSnackbar.js +49 -0
- package/dist/components/ErrorSnackbar.js.map +1 -0
- package/dist/components/Lists.d.ts +10 -0
- package/dist/components/Lists.js +43 -0
- package/dist/components/Lists.js.map +1 -0
- package/dist/components/LoadingWithMessage.d.ts +6 -0
- package/dist/components/LoadingWithMessage.js +12 -0
- package/dist/components/LoadingWithMessage.js.map +1 -0
- package/dist/components/NoResourcesYet.d.ts +12 -0
- package/dist/components/NoResourcesYet.js +7 -0
- package/dist/components/NoResourcesYet.js.map +1 -0
- package/dist/components/formStore/ColumnsConfigurationButton.d.ts +10 -0
- package/dist/components/formStore/ColumnsConfigurationButton.js +29 -0
- package/dist/components/formStore/ColumnsConfigurationButton.js.map +1 -0
- package/dist/components/formStore/DownloadSubmissionDataButton.d.ts +13 -0
- package/dist/components/formStore/DownloadSubmissionDataButton.js +45 -0
- package/dist/components/formStore/DownloadSubmissionDataButton.js.map +1 -0
- package/dist/components/formStore/FormStore.d.ts +9 -0
- package/dist/components/formStore/FormStore.js +103 -0
- package/dist/components/formStore/FormStore.js.map +1 -0
- package/dist/components/formStore/display/ElementDisplay.d.ts +23 -0
- package/dist/components/formStore/display/ElementDisplay.js +78 -0
- package/dist/components/formStore/display/ElementDisplay.js.map +1 -0
- package/dist/components/formStore/display/FormStoreIcon.d.ts +2 -0
- package/dist/components/formStore/display/FormStoreIcon.js +3 -0
- package/dist/components/formStore/display/FormStoreIcon.js.map +1 -0
- package/dist/components/formStore/table/ActionedByTableCell.d.ts +11 -0
- package/dist/components/formStore/table/ActionedByTableCell.js +44 -0
- package/dist/components/formStore/table/ActionedByTableCell.js.map +1 -0
- package/dist/components/formStore/table/ColumnFilters.d.ts +9 -0
- package/dist/components/formStore/table/ColumnFilters.js +180 -0
- package/dist/components/formStore/table/ColumnFilters.js.map +1 -0
- package/dist/components/formStore/table/FormElementTableCell.d.ts +10 -0
- package/dist/components/formStore/table/FormElementTableCell.js +195 -0
- package/dist/components/formStore/table/FormElementTableCell.js.map +1 -0
- package/dist/components/formStore/table/HeaderCellMoreButton.d.ts +9 -0
- package/dist/components/formStore/table/HeaderCellMoreButton.js +49 -0
- package/dist/components/formStore/table/HeaderCellMoreButton.js.map +1 -0
- package/dist/components/formStore/table/RepeatableSetCell.d.ts +9 -0
- package/dist/components/formStore/table/RepeatableSetCell.js +63 -0
- package/dist/components/formStore/table/RepeatableSetCell.js.map +1 -0
- package/dist/components/formStore/table/RepeatableSetCellAccordion.d.ts +9 -0
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js +12 -0
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js.map +1 -0
- package/dist/components/formStore/table/TableCellCopyButton.d.ts +7 -0
- package/dist/components/formStore/table/TableCellCopyButton.js +31 -0
- package/dist/components/formStore/table/TableCellCopyButton.js.map +1 -0
- package/dist/components/formStore/table/generateColumns.d.ts +18 -0
- package/dist/components/formStore/table/generateColumns.js +233 -0
- package/dist/components/formStore/table/generateColumns.js.map +1 -0
- package/dist/components/formStore/table/index.d.ts +17 -0
- package/dist/components/formStore/table/index.js +194 -0
- package/dist/components/formStore/table/index.js.map +1 -0
- package/dist/components/formStore/table/useFormStoreTable.d.ts +12 -0
- package/dist/components/formStore/table/useFormStoreTable.js +130 -0
- package/dist/components/formStore/table/useFormStoreTable.js.map +1 -0
- package/dist/components/messages/LargeIconMessage.d.ts +14 -0
- package/dist/components/messages/LargeIconMessage.js +68 -0
- package/dist/components/messages/LargeIconMessage.js.map +1 -0
- package/dist/components/pickers/V4CompatibleDatePicker.d.ts +30 -0
- package/dist/components/pickers/V4CompatibleDatePicker.js +58 -0
- package/dist/components/pickers/V4CompatibleDatePicker.js.map +1 -0
- package/dist/components/pickers/V4CompatibleDateTimePicker.d.ts +29 -0
- package/dist/components/pickers/V4CompatibleDateTimePicker.js +58 -0
- package/dist/components/pickers/V4CompatibleDateTimePicker.js.map +1 -0
- package/dist/components/pickers/V4CompatibleTimePicker.d.ts +26 -0
- package/dist/components/pickers/V4CompatibleTimePicker.js +41 -0
- package/dist/components/pickers/V4CompatibleTimePicker.js.map +1 -0
- package/dist/components/{AnnotationModal.d.ts → renderer/AnnotationModal.d.ts} +0 -0
- package/dist/components/{AnnotationModal.js → renderer/AnnotationModal.js} +2 -2
- package/dist/components/renderer/AnnotationModal.js.map +1 -0
- package/dist/components/{AutocompleteDropdown.d.ts → renderer/AutocompleteDropdown.d.ts} +0 -0
- package/dist/components/{AutocompleteDropdown.js → renderer/AutocompleteDropdown.js} +1 -1
- package/dist/components/renderer/AutocompleteDropdown.js.map +1 -0
- package/dist/components/{CopyToClipboardButton.d.ts → renderer/CopyToClipboardButton.d.ts} +0 -0
- package/dist/components/{CopyToClipboardButton.js → renderer/CopyToClipboardButton.js} +1 -1
- package/dist/components/renderer/CopyToClipboardButton.js.map +1 -0
- package/dist/components/{CustomisableButtonInner.d.ts → renderer/CustomisableButtonInner.d.ts} +0 -0
- package/dist/components/{CustomisableButtonInner.js → renderer/CustomisableButtonInner.js} +0 -0
- package/dist/components/renderer/CustomisableButtonInner.js.map +1 -0
- package/dist/components/{FormElementLabelContainer.d.ts → renderer/FormElementLabelContainer.d.ts} +0 -0
- package/dist/components/{FormElementLabelContainer.js → renderer/FormElementLabelContainer.js} +0 -0
- package/dist/components/renderer/FormElementLabelContainer.js.map +1 -0
- package/dist/components/{FormElementOptions.d.ts → renderer/FormElementOptions.d.ts} +0 -0
- package/dist/components/{FormElementOptions.js → renderer/FormElementOptions.js} +0 -0
- package/dist/components/renderer/FormElementOptions.js.map +1 -0
- package/dist/components/{LookupButton.d.ts → renderer/LookupButton.d.ts} +0 -0
- package/dist/components/{LookupButton.js → renderer/LookupButton.js} +3 -3
- package/dist/components/renderer/LookupButton.js.map +1 -0
- package/dist/components/{LookupNotification.d.ts → renderer/LookupNotification.d.ts} +1 -1
- package/dist/components/{LookupNotification.js → renderer/LookupNotification.js} +9 -9
- package/dist/components/renderer/LookupNotification.js.map +1 -0
- package/dist/components/{Modal.d.ts → renderer/Modal.d.ts} +0 -0
- package/dist/components/{Modal.js → renderer/Modal.js} +0 -0
- package/dist/components/renderer/Modal.js.map +1 -0
- package/dist/components/{OnLoading.d.ts → renderer/OnLoading.d.ts} +0 -0
- package/dist/components/{OnLoading.js → renderer/OnLoading.js} +0 -0
- package/dist/components/renderer/OnLoading.js.map +1 -0
- package/dist/components/{OneBlinkAppsErrorOriginalMessage.d.ts → renderer/OneBlinkAppsErrorOriginalMessage.d.ts} +0 -0
- package/dist/components/{OneBlinkAppsErrorOriginalMessage.js → renderer/OneBlinkAppsErrorOriginalMessage.js} +0 -0
- package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js.map +1 -0
- package/dist/components/{OneBlinkFormElements.d.ts → renderer/OneBlinkFormElements.d.ts} +1 -1
- package/dist/components/{OneBlinkFormElements.js → renderer/OneBlinkFormElements.js} +36 -36
- package/dist/components/renderer/OneBlinkFormElements.js.map +1 -0
- package/dist/components/{PageFormElements.d.ts → renderer/PageFormElements.d.ts} +1 -1
- package/dist/components/{PageFormElements.js → renderer/PageFormElements.js} +3 -3
- package/dist/components/renderer/PageFormElements.js.map +1 -0
- package/dist/components/{ToggleAllCheckbox.d.ts → renderer/ToggleAllCheckbox.d.ts} +1 -1
- package/dist/components/{ToggleAllCheckbox.js → renderer/ToggleAllCheckbox.js} +0 -0
- package/dist/components/renderer/ToggleAllCheckbox.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/AttachmentStatus.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/AttachmentStatus.js +1 -1
- package/dist/components/renderer/attachments/AttachmentStatus.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/FileCard.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/FileCard.js +4 -4
- package/dist/components/renderer/attachments/FileCard.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/FileCardContent.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/FileCardContent.js +0 -0
- package/dist/components/renderer/attachments/FileCardContent.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/Files.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/Files.js +0 -0
- package/dist/components/renderer/attachments/Files.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/ImagePreviewUnavailable.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/ImagePreviewUnavailable.js +1 -1
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js.map +1 -0
- package/dist/components/{attachments → renderer/attachments}/UploadingAttachment.d.ts +0 -0
- package/dist/components/{attachments → renderer/attachments}/UploadingAttachment.js +1 -1
- package/dist/components/renderer/attachments/UploadingAttachment.js.map +1 -0
- package/dist/form-elements/FormElementABN.js +3 -3
- package/dist/form-elements/FormElementABN.js.map +1 -1
- package/dist/form-elements/FormElementAutocomplete.js +3 -3
- package/dist/form-elements/FormElementAutocomplete.js.map +1 -1
- package/dist/form-elements/FormElementBSB.js +3 -3
- package/dist/form-elements/FormElementBSB.js.map +1 -1
- package/dist/form-elements/FormElementBarcodeScanner.js +4 -4
- package/dist/form-elements/FormElementBarcodeScanner.js.map +1 -1
- package/dist/form-elements/FormElementBoolean.js +1 -1
- package/dist/form-elements/FormElementBoolean.js.map +1 -1
- package/dist/form-elements/FormElementCamera.js +6 -6
- package/dist/form-elements/FormElementCamera.js.map +1 -1
- package/dist/form-elements/FormElementCheckBoxes.js +4 -4
- package/dist/form-elements/FormElementCheckBoxes.js.map +1 -1
- package/dist/form-elements/FormElementCivicaStreetName.js +2 -2
- package/dist/form-elements/FormElementCivicaStreetName.js.map +1 -1
- package/dist/form-elements/FormElementCompliance.js +2 -2
- package/dist/form-elements/FormElementCompliance.js.map +1 -1
- package/dist/form-elements/FormElementDate.js +4 -4
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/dist/form-elements/FormElementDateTime.js +4 -4
- package/dist/form-elements/FormElementDateTime.js.map +1 -1
- package/dist/form-elements/FormElementEmail.js +3 -3
- package/dist/form-elements/FormElementEmail.js.map +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFile.js +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFile.js.map +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFiles.js +1 -1
- package/dist/form-elements/FormElementFiles/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js +2 -2
- package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementForm.js +1 -1
- package/dist/form-elements/FormElementForm.js.map +1 -1
- package/dist/form-elements/FormElementGeoscapeAddress.js +2 -2
- package/dist/form-elements/FormElementGeoscapeAddress.js.map +1 -1
- package/dist/form-elements/FormElementLocation.js +2 -2
- package/dist/form-elements/FormElementLocation.js.map +1 -1
- package/dist/form-elements/FormElementNumber.js +3 -3
- package/dist/form-elements/FormElementNumber.js.map +1 -1
- package/dist/form-elements/FormElementPointAddress.js +2 -2
- package/dist/form-elements/FormElementPointAddress.js.map +1 -1
- package/dist/form-elements/FormElementRadio.js +2 -2
- package/dist/form-elements/FormElementRadio.js.map +1 -1
- package/dist/form-elements/FormElementRepeatableSet.js +3 -3
- package/dist/form-elements/FormElementRepeatableSet.js.map +1 -1
- package/dist/form-elements/FormElementSection.d.ts +1 -1
- package/dist/form-elements/FormElementSection.js +1 -1
- package/dist/form-elements/FormElementSection.js.map +1 -1
- package/dist/form-elements/FormElementSelect.js +4 -4
- package/dist/form-elements/FormElementSelect.js.map +1 -1
- package/dist/form-elements/FormElementSignature.js +4 -4
- package/dist/form-elements/FormElementSignature.js.map +1 -1
- package/dist/form-elements/FormElementTelephone.js +3 -3
- package/dist/form-elements/FormElementTelephone.js.map +1 -1
- package/dist/form-elements/FormElementText.js +3 -3
- package/dist/form-elements/FormElementText.js.map +1 -1
- package/dist/form-elements/FormElementTextarea.js +3 -3
- package/dist/form-elements/FormElementTextarea.js.map +1 -1
- package/dist/form-elements/FormElementTime.js +4 -4
- package/dist/form-elements/FormElementTime.js.map +1 -1
- package/dist/hooks/useConditionalLogic.js +1 -1
- package/dist/hooks/useConditionalLogic.js.map +1 -1
- package/dist/hooks/useInfiniteScrollDataLoad.d.ts +28 -0
- package/dist/hooks/useInfiniteScrollDataLoad.js +118 -0
- package/dist/hooks/useInfiniteScrollDataLoad.js.map +1 -0
- package/dist/hooks/useIsHovering.d.ts +5 -0
- package/dist/hooks/useIsHovering.js +13 -0
- package/dist/hooks/useIsHovering.js.map +1 -0
- package/dist/hooks/useLegacyElements.d.ts +16 -0
- package/dist/hooks/useLegacyElements.js +55 -0
- package/dist/hooks/useLegacyElements.js.map +1 -0
- package/dist/hooks/useQuery.d.ts +2 -0
- package/dist/hooks/useQuery.js +8 -0
- package/dist/hooks/useQuery.js.map +1 -0
- package/dist/hooks/useSubmissionIdIsValid.d.ts +4 -0
- package/dist/hooks/useSubmissionIdIsValid.js +21 -0
- package/dist/hooks/useSubmissionIdIsValid.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/services/defaultCoordinates.js +1 -1
- package/dist/services/defaultCoordinates.js.map +1 -1
- package/dist/services/generate-default-data.js +1 -1
- package/dist/services/generate-default-data.js.map +1 -1
- package/package.json +11 -4
- package/dist/components/AnnotationModal.js.map +0 -1
- package/dist/components/AutocompleteDropdown.js.map +0 -1
- package/dist/components/CopyToClipboardButton.js.map +0 -1
- package/dist/components/CustomisableButtonInner.js.map +0 -1
- package/dist/components/FormElementLabelContainer.js.map +0 -1
- package/dist/components/FormElementOptions.js.map +0 -1
- package/dist/components/LookupButton.js.map +0 -1
- package/dist/components/LookupNotification.js.map +0 -1
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/OnLoading.js.map +0 -1
- package/dist/components/OneBlinkAppsErrorOriginalMessage.js.map +0 -1
- package/dist/components/OneBlinkFormElements.js.map +0 -1
- package/dist/components/PageFormElements.js.map +0 -1
- package/dist/components/ToggleAllCheckbox.js.map +0 -1
- package/dist/components/attachments/AttachmentStatus.js.map +0 -1
- package/dist/components/attachments/FileCard.js.map +0 -1
- package/dist/components/attachments/FileCardContent.js.map +0 -1
- package/dist/components/attachments/Files.js.map +0 -1
- package/dist/components/attachments/ImagePreviewUnavailable.js.map +0 -1
- package/dist/components/attachments/UploadingAttachment.js.map +0 -1
@@ -0,0 +1,49 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import clsx from 'clsx';
|
3
|
+
import withStyles from '@mui/styles/withStyles';
|
4
|
+
import IconButton from '@mui/material/IconButton';
|
5
|
+
import Snackbar from '@mui/material/Snackbar';
|
6
|
+
import SnackbarContent from '@mui/material/SnackbarContent';
|
7
|
+
import ErrorIcon from '@mui/icons-material/Error';
|
8
|
+
import CloseIcon from '@mui/icons-material/Close';
|
9
|
+
const styles = (theme) => ({
|
10
|
+
snackbarContent: {
|
11
|
+
backgroundColor: theme.palette.error.dark,
|
12
|
+
},
|
13
|
+
icon: {
|
14
|
+
fontSize: 20,
|
15
|
+
},
|
16
|
+
iconVariant: {
|
17
|
+
marginRight: theme.spacing(2),
|
18
|
+
},
|
19
|
+
message: {
|
20
|
+
display: 'flex',
|
21
|
+
alignItems: 'center',
|
22
|
+
},
|
23
|
+
});
|
24
|
+
class ErrorSnackbar extends React.Component {
|
25
|
+
constructor() {
|
26
|
+
super(...arguments);
|
27
|
+
this.handleClose = (e, reason) => {
|
28
|
+
if (reason !== 'clickaway') {
|
29
|
+
this.props.onClose(null);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
}
|
33
|
+
render() {
|
34
|
+
const { classes, open, children } = this.props;
|
35
|
+
return (React.createElement(Snackbar, { anchorOrigin: {
|
36
|
+
vertical: 'bottom',
|
37
|
+
horizontal: 'right',
|
38
|
+
}, open: open, onClose: this.handleClose },
|
39
|
+
React.createElement(SnackbarContent, { className: classes.snackbarContent, message: React.createElement("span", { className: classes.message },
|
40
|
+
React.createElement(ErrorIcon, { className: clsx(classes.icon, classes.iconVariant) }),
|
41
|
+
children), action: [
|
42
|
+
// @ts-expect-error ???
|
43
|
+
React.createElement(IconButton, { key: "close", "aria-label": "Close", color: "inherit", className: classes.close, onClick: this.handleClose, "data-cypress": "error-snackbar-close", size: "large" },
|
44
|
+
React.createElement(CloseIcon, { className: classes.icon })),
|
45
|
+
] })));
|
46
|
+
}
|
47
|
+
}
|
48
|
+
export default withStyles(styles)(ErrorSnackbar);
|
49
|
+
//# sourceMappingURL=ErrorSnackbar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ErrorSnackbar.js","sourceRoot":"","sources":["../../src/components/ErrorSnackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,UAAU,MAAM,wBAAwB,CAAA;AAC/C,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,QAAQ,MAAM,wBAAwB,CAAA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E;oBACN,uBAAuB;oBACvB,oBAAC,UAAU,IACT,GAAG,EAAC,OAAO,gBACA,OAAO,EAClB,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,OAAO,CAAC,KAAK,EACxB,OAAO,EAAE,IAAI,CAAC,WAAW,kBACZ,sBAAsB,EACnC,IAAI,EAAC,OAAO;wBAEZ,oBAAC,SAAS,IAAC,SAAS,EAAE,OAAO,CAAC,IAAI,GAAI,CAC3B;iBACd,GACD,CACO,CACZ,CAAA;IACH,CAAC;CACF;AAED,eAAe,UAAU,CAAC,MAAM,CAAC,CAAC,aAAa,CAA+B,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport { Theme } from '@mui/material/styles'\nimport withStyles from '@mui/styles/withStyles'\nimport IconButton from '@mui/material/IconButton'\nimport Snackbar from '@mui/material/Snackbar'\nimport SnackbarContent from '@mui/material/SnackbarContent'\nimport ErrorIcon from '@mui/icons-material/Error'\nimport CloseIcon from '@mui/icons-material/Close'\n\nconst styles = (theme: Theme) => ({\n snackbarContent: {\n backgroundColor: theme.palette.error.dark,\n },\n icon: {\n fontSize: 20,\n },\n iconVariant: {\n marginRight: theme.spacing(2),\n },\n message: {\n display: 'flex',\n alignItems: 'center',\n },\n})\n\ntype Props = {\n open: boolean\n children: React.ReactNode\n onClose: (arg: null) => unknown\n}\n\nclass ErrorSnackbar extends React.Component<\n Props & {\n classes: Record<string, string>\n }\n> {\n handleClose = (e: unknown, reason: string) => {\n if (reason !== 'clickaway') {\n this.props.onClose(null)\n }\n }\n\n render() {\n const { classes, open, children } = this.props\n return (\n <Snackbar\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n open={open}\n onClose={this.handleClose}\n >\n <SnackbarContent\n className={classes.snackbarContent}\n message={\n <span className={classes.message}>\n <ErrorIcon className={clsx(classes.icon, classes.iconVariant)} />\n {children}\n </span>\n }\n action={[\n // @ts-expect-error ???\n <IconButton\n key=\"close\"\n aria-label=\"Close\"\n color=\"inherit\"\n className={classes.close}\n onClick={this.handleClose}\n data-cypress=\"error-snackbar-close\"\n size=\"large\"\n >\n <CloseIcon className={classes.icon} />\n </IconButton>,\n ]}\n />\n </Snackbar>\n )\n }\n}\n\nexport default withStyles(styles)(ErrorSnackbar) as React.ComponentType<Props>\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
declare type Props = {
|
3
|
+
children: React.ReactNode;
|
4
|
+
disablePadding?: boolean;
|
5
|
+
spaced?: boolean;
|
6
|
+
};
|
7
|
+
export declare const OrderedList: React.ComponentType<Props>;
|
8
|
+
export declare const UnorderedList: React.ComponentType<Props>;
|
9
|
+
export declare const ListItem: React.ComponentType<Props>;
|
10
|
+
export {};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import clsx from 'clsx';
|
3
|
+
import withStyles from '@mui/styles/withStyles';
|
4
|
+
import Typography from '@mui/material/Typography';
|
5
|
+
const styles = (theme) => ({
|
6
|
+
list: {
|
7
|
+
margin: 0,
|
8
|
+
padding: theme.spacing(1, 1, 1, 4),
|
9
|
+
'& > ul, & > ol': {
|
10
|
+
'padding-top': 0,
|
11
|
+
'padding-bottom': 0,
|
12
|
+
},
|
13
|
+
},
|
14
|
+
noPadding: {
|
15
|
+
'padding-top': 0,
|
16
|
+
'padding-bottom': 0,
|
17
|
+
},
|
18
|
+
listItem: {
|
19
|
+
display: 'list-item',
|
20
|
+
},
|
21
|
+
spacedLineHeight: {
|
22
|
+
lineHeight: 1.9,
|
23
|
+
},
|
24
|
+
});
|
25
|
+
function ol({ classes, disablePadding, children, ...props }) {
|
26
|
+
return (React.createElement("ol", { className: clsx(classes.list, {
|
27
|
+
[classes.noPadding]: disablePadding,
|
28
|
+
}), ...props }, children));
|
29
|
+
}
|
30
|
+
function ul({ classes, disablePadding, children, ...props }) {
|
31
|
+
return (React.createElement("ul", { className: clsx(classes.list, {
|
32
|
+
[classes.noPadding]: disablePadding,
|
33
|
+
}), ...props }, children));
|
34
|
+
}
|
35
|
+
function li({ classes, children, spaced, ...props }) {
|
36
|
+
return (React.createElement(Typography, { component: "li", color: "inherit", variant: "body2", className: clsx(classes.listItem, {
|
37
|
+
[classes.spacedLineHeight]: spaced,
|
38
|
+
}), ...props }, children));
|
39
|
+
}
|
40
|
+
export const OrderedList = withStyles(styles)(ol);
|
41
|
+
export const UnorderedList = withStyles(styles)(ul);
|
42
|
+
export const ListItem = withStyles(styles)(li);
|
43
|
+
//# sourceMappingURL=Lists.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Lists.js","sourceRoot":"","sources":["../../src/components/Lists.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,UAAU,MAAM,wBAAwB,CAAA;AAC/C,OAAO,UAAU,MAAM,0BAA0B,CAAA;AAMjD,MAAM,MAAM,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IAChC,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAClC,gBAAgB,EAAE;YAChB,aAAa,EAAE,CAAC;YAChB,gBAAgB,EAAE,CAAC;SACpB;KACF;IACD,SAAS,EAAE;QACT,aAAa,EAAE,CAAC;QAChB,gBAAgB,EAAE,CAAC;KACpB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,WAAW;KACrB;IACD,gBAAgB,EAAE;QAChB,UAAU,EAAE,GAAG;KAChB;CACF,CAAC,CAAA;AAQF,SAAS,EAAE,CAAC,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACgB;IACxB,OAAO,CACL,4BACE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YAC5B,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,cAAc;SACpC,CAAC,KACE,KAAK,IAER,QAAQ,CACN,CACN,CAAA;AACH,CAAC;AAED,SAAS,EAAE,CAAC,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACgB;IACxB,OAAO,CACL,4BACE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YAC5B,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,cAAc;SACpC,CAAC,KACE,KAAK,IAER,QAAQ,CACN,CACN,CAAA;AACH,CAAC;AAED,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAA2B;IAC1E,OAAO,CACL,oBAAC,UAAU,IACT,SAAS,EAAC,IAAI,EACd,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,OAAO,EACf,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YAChC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,MAAM;SACnC,CAAC,KACE,KAAK,IAER,QAAQ,CACE,CACd,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAA+B,CAAA;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAC7C,EAAE,CAC2B,CAAA;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAA+B,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport { Theme } from '@mui/material/styles'\nimport withStyles from '@mui/styles/withStyles'\nimport Typography from '@mui/material/Typography'\n\ninterface WithStylesProps {\n classes: Record<string, string>\n}\n\nconst styles = (theme: Theme) => ({\n list: {\n margin: 0,\n padding: theme.spacing(1, 1, 1, 4),\n '& > ul, & > ol': {\n 'padding-top': 0,\n 'padding-bottom': 0,\n },\n },\n noPadding: {\n 'padding-top': 0,\n 'padding-bottom': 0,\n },\n listItem: {\n display: 'list-item',\n },\n spacedLineHeight: {\n lineHeight: 1.9,\n },\n})\n\ntype Props = {\n children: React.ReactNode\n disablePadding?: boolean\n spaced?: boolean\n}\n\nfunction ol({\n classes,\n disablePadding,\n children,\n ...props\n}: Props & WithStylesProps) {\n return (\n <ol\n className={clsx(classes.list, {\n [classes.noPadding]: disablePadding,\n })}\n {...props}\n >\n {children}\n </ol>\n )\n}\n\nfunction ul({\n classes,\n disablePadding,\n children,\n ...props\n}: Props & WithStylesProps) {\n return (\n <ul\n className={clsx(classes.list, {\n [classes.noPadding]: disablePadding,\n })}\n {...props}\n >\n {children}\n </ul>\n )\n}\n\nfunction li({ classes, children, spaced, ...props }: Props & WithStylesProps) {\n return (\n <Typography\n component=\"li\"\n color=\"inherit\"\n variant=\"body2\"\n className={clsx(classes.listItem, {\n [classes.spacedLineHeight]: spaced,\n })}\n {...props}\n >\n {children}\n </Typography>\n )\n}\n\nexport const OrderedList = withStyles(styles)(ol) as React.ComponentType<Props>\nexport const UnorderedList = withStyles(styles)(\n ul,\n) as React.ComponentType<Props>\nexport const ListItem = withStyles(styles)(li) as React.ComponentType<Props>\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Box, CircularProgress, Grid, Typography } from '@mui/material';
|
3
|
+
const Loading = ({ message }) => {
|
4
|
+
return (React.createElement(Box, { p: 2 },
|
5
|
+
React.createElement(Grid, { container: true, spacing: 2 },
|
6
|
+
React.createElement(Grid, { xs: 12, container: true, item: true, justifyContent: "center" },
|
7
|
+
React.createElement(CircularProgress, null)),
|
8
|
+
message && (React.createElement(Grid, { xs: 12, container: true, item: true, justifyContent: "center" },
|
9
|
+
React.createElement(Typography, { variant: "body2", align: "center" }, message))))));
|
10
|
+
};
|
11
|
+
export default React.memo(Loading);
|
12
|
+
//# sourceMappingURL=LoadingWithMessage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LoadingWithMessage.js","sourceRoot":"","sources":["../../src/components/LoadingWithMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAKvE,MAAM,OAAO,GAAG,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE;IACrC,OAAO,CACL,oBAAC,GAAG,IAAC,CAAC,EAAE,CAAC;QACP,oBAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,CAAC;YACxB,oBAAC,IAAI,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,QAAC,IAAI,QAAC,cAAc,EAAC,QAAQ;gBAClD,oBAAC,gBAAgB,OAAoB,CAChC;YACN,OAAO,IAAI,CACV,oBAAC,IAAI,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,QAAC,IAAI,QAAC,cAAc,EAAC,QAAQ;gBAClD,oBAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,QAAQ,IACvC,OAAO,CACG,CACR,CACR,CACI,CACH,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,OAAO,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Box, CircularProgress, Grid, Typography } from '@mui/material'\ntype Props = {\n message?: string\n}\n\nconst Loading = ({ message }: Props) => {\n return (\n <Box p={2}>\n <Grid container spacing={2}>\n <Grid xs={12} container item justifyContent=\"center\">\n <CircularProgress></CircularProgress>\n </Grid>\n {message && (\n <Grid xs={12} container item justifyContent=\"center\">\n <Typography variant=\"body2\" align=\"center\">\n {message}\n </Typography>\n </Grid>\n )}\n </Grid>\n </Box>\n )\n}\n\nexport default React.memo<Props>(Loading)\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
declare type Props = {
|
3
|
+
IconComponent: React.ComponentType<{
|
4
|
+
className: string;
|
5
|
+
}>;
|
6
|
+
title: string;
|
7
|
+
gutterBottom?: boolean;
|
8
|
+
children?: React.ReactNode;
|
9
|
+
};
|
10
|
+
export declare function NoResourcesYet({ title, children, IconComponent, gutterBottom, }: Props): JSX.Element;
|
11
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
12
|
+
export default _default;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import LargeIconMessage from './messages/LargeIconMessage';
|
3
|
+
export function NoResourcesYet({ title, children, IconComponent, gutterBottom, }) {
|
4
|
+
return (React.createElement(LargeIconMessage, { IconComponent: IconComponent, title: title, variant: "primary", gutterBottom: gutterBottom, gutterTop: true }, children));
|
5
|
+
}
|
6
|
+
export default React.memo(NoResourcesYet);
|
7
|
+
//# sourceMappingURL=NoResourcesYet.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NoResourcesYet.js","sourceRoot":"","sources":["../../src/components/NoResourcesYet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAS1D,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,YAAY,GACN;IACN,OAAO,CACL,oBAAC,gBAAgB,IACf,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAC,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,SAAS,UAER,QAAQ,CACQ,CACpB,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAQ,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport LargeIconMessage from './messages/LargeIconMessage'\ntype Props = {\n IconComponent: React.ComponentType<{\n className: string\n }>\n title: string\n gutterBottom?: boolean\n children?: React.ReactNode\n}\nexport function NoResourcesYet({\n title,\n children,\n IconComponent,\n gutterBottom,\n}: Props) {\n return (\n <LargeIconMessage\n IconComponent={IconComponent}\n title={title}\n variant=\"primary\"\n gutterBottom={gutterBottom}\n gutterTop\n >\n {children}\n </LargeIconMessage>\n )\n}\nexport default React.memo<Props>(NoResourcesYet)\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { ColumnInstance } from 'react-table';
|
3
|
+
import { Checkbox } from '@mui/material';
|
4
|
+
import { SubmissionTypes } from '@oneblink/types';
|
5
|
+
declare function ColumnsConfigurationButton({ allColumns, getToggleHideAllColumnsProps, }: {
|
6
|
+
allColumns: ColumnInstance<SubmissionTypes.FormStoreRecord>[];
|
7
|
+
getToggleHideAllColumnsProps: () => React.ComponentProps<typeof Checkbox>;
|
8
|
+
}): JSX.Element;
|
9
|
+
declare const _default: React.MemoExoticComponent<typeof ColumnsConfigurationButton>;
|
10
|
+
export default _default;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, FormGroup, Typography, } from '@mui/material';
|
3
|
+
import { Settings as SettingsIcon } from '@mui/icons-material';
|
4
|
+
import useBooleanState from '../../hooks/useBooleanState';
|
5
|
+
function ColumnsConfigurationButton({ allColumns, getToggleHideAllColumnsProps, }) {
|
6
|
+
const [isConfiguringColumns, showColumnConfiguration, hideColumnConfiguration,] = useBooleanState(false);
|
7
|
+
const toggleHideAllColumnsProps = getToggleHideAllColumnsProps();
|
8
|
+
return (React.createElement(React.Fragment, null,
|
9
|
+
React.createElement(Button, { startIcon: React.createElement(SettingsIcon, null), onClick: showColumnConfiguration, variant: "outlined" }, "Columns"),
|
10
|
+
React.createElement(Dialog, { open: isConfiguringColumns, maxWidth: "sm", fullWidth: true, onClose: hideColumnConfiguration },
|
11
|
+
React.createElement(DialogTitle, null, "Column Configuration"),
|
12
|
+
React.createElement(DialogContent, { dividers: true },
|
13
|
+
React.createElement(FormGroup, null,
|
14
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { ...toggleHideAllColumnsProps, indeterminate: !!toggleHideAllColumnsProps.indeterminate }), label: React.createElement("b", null, "Toggle All") }),
|
15
|
+
allColumns.map((column) => {
|
16
|
+
return (React.createElement(React.Fragment, { key: column.id },
|
17
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { ...column.getToggleHiddenProps() }), label: React.createElement(React.Fragment, null,
|
18
|
+
column.headerText,
|
19
|
+
column.tooltip && (React.createElement(Typography, { component: "span", color: "textSecondary" },
|
20
|
+
' ',
|
21
|
+
"(",
|
22
|
+
column.tooltip,
|
23
|
+
")"))) })));
|
24
|
+
}))),
|
25
|
+
React.createElement(DialogActions, null,
|
26
|
+
React.createElement(Button, { onClick: hideColumnConfiguration, color: "primary", variant: "contained" }, "Done")))));
|
27
|
+
}
|
28
|
+
export default React.memo(ColumnsConfigurationButton);
|
29
|
+
//# sourceMappingURL=ColumnsConfigurationButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ColumnsConfigurationButton.js","sourceRoot":"","sources":["../../../src/components/formStore/ColumnsConfigurationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,eAAe,MAAM,6BAA6B,CAAA;AAGzD,SAAS,0BAA0B,CAAC,EAClC,UAAU,EACV,4BAA4B,GAI7B;IACC,MAAM,CACJ,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACxB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAE1B,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,CAAA;IAEhE,OAAO,CACL;QACE,oBAAC,MAAM,IACL,SAAS,EAAE,oBAAC,YAAY,OAAG,EAC3B,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAC,UAAU,cAGX;QACT,oBAAC,MAAM,IACL,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAC,IAAI,EACb,SAAS,QACT,OAAO,EAAE,uBAAuB;YAEhC,oBAAC,WAAW,+BAAmC;YAC/C,oBAAC,aAAa,IAAC,QAAQ;gBACrB,oBAAC,SAAS;oBACR,oBAAC,gBAAgB,IACf,OAAO,EACL,oBAAC,QAAQ,OACH,yBAAyB,EAC7B,aAAa,EAAE,CAAC,CAAC,yBAAyB,CAAC,aAAa,GACxD,EAEJ,KAAK,EAAE,4CAAiB,GACxB;oBACD,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;wBACzB,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,MAAM,CAAC,EAAE;4BAC5B,oBAAC,gBAAgB,IACf,OAAO,EAAE,oBAAC,QAAQ,OAAK,MAAM,CAAC,oBAAoB,EAAE,GAAI,EACxD,KAAK,EACH;oCACG,MAAM,CAAC,UAAU;oCACjB,MAAM,CAAC,OAAO,IAAI,CACjB,oBAAC,UAAU,IAAC,SAAS,EAAC,MAAM,EAAC,KAAK,EAAC,eAAe;wCAC/C,GAAG;;wCACF,MAAM,CAAC,OAAO;4CACL,CACd,CACA,GAEL,CACa,CAClB,CAAA;oBACH,CAAC,CAAC,CACQ,CACE;YAChB,oBAAC,aAAa;gBACZ,oBAAC,MAAM,IACL,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,WAGZ,CACK,CACT,CACR,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { ColumnInstance } from 'react-table'\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n FormGroup,\n Typography,\n} from '@mui/material'\nimport { Settings as SettingsIcon } from '@mui/icons-material'\nimport useBooleanState from '../../hooks/useBooleanState'\nimport { SubmissionTypes } from '@oneblink/types'\n\nfunction ColumnsConfigurationButton({\n allColumns,\n getToggleHideAllColumnsProps,\n}: {\n allColumns: ColumnInstance<SubmissionTypes.FormStoreRecord>[]\n getToggleHideAllColumnsProps: () => React.ComponentProps<typeof Checkbox>\n}) {\n const [\n isConfiguringColumns,\n showColumnConfiguration,\n hideColumnConfiguration,\n ] = useBooleanState(false)\n\n const toggleHideAllColumnsProps = getToggleHideAllColumnsProps()\n\n return (\n <>\n <Button\n startIcon={<SettingsIcon />}\n onClick={showColumnConfiguration}\n variant=\"outlined\"\n >\n Columns\n </Button>\n <Dialog\n open={isConfiguringColumns}\n maxWidth=\"sm\"\n fullWidth\n onClose={hideColumnConfiguration}\n >\n <DialogTitle>Column Configuration</DialogTitle>\n <DialogContent dividers>\n <FormGroup>\n <FormControlLabel\n control={\n <Checkbox\n {...toggleHideAllColumnsProps}\n indeterminate={!!toggleHideAllColumnsProps.indeterminate}\n />\n }\n label={<b>Toggle All</b>}\n />\n {allColumns.map((column) => {\n return (\n <React.Fragment key={column.id}>\n <FormControlLabel\n control={<Checkbox {...column.getToggleHiddenProps()} />}\n label={\n <>\n {column.headerText}\n {column.tooltip && (\n <Typography component=\"span\" color=\"textSecondary\">\n {' '}\n ({column.tooltip})\n </Typography>\n )}\n </>\n }\n />\n </React.Fragment>\n )\n })}\n </FormGroup>\n </DialogContent>\n <DialogActions>\n <Button\n onClick={hideColumnConfiguration}\n color=\"primary\"\n variant=\"contained\"\n >\n Done\n </Button>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n\nexport default React.memo(ColumnsConfigurationButton)\n"]}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Form } from '@oneblink/types/typescript/forms';
|
3
|
+
import { ColumnInstance } from 'react-table';
|
4
|
+
import { FormStoreRecord } from '@oneblink/types/typescript/submissions';
|
5
|
+
import { formStoreService } from '@oneblink/apps';
|
6
|
+
declare function DownloadSubmissionDataButton({ disabled, form, filters, visibleColumns, }: {
|
7
|
+
disabled: boolean;
|
8
|
+
form: Form;
|
9
|
+
filters?: formStoreService.FormStoreFilters;
|
10
|
+
visibleColumns: ColumnInstance<FormStoreRecord>[];
|
11
|
+
}): JSX.Element;
|
12
|
+
declare const _default: React.MemoExoticComponent<typeof DownloadSubmissionDataButton>;
|
13
|
+
export default _default;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Tooltip } from '@mui/material';
|
3
|
+
import { LoadingButton } from '@mui/lab';
|
4
|
+
import CsvIcon from '@mui/icons-material/Download';
|
5
|
+
import ErrorSnackbar from '../ErrorSnackbar';
|
6
|
+
import { formStoreService } from '@oneblink/apps';
|
7
|
+
function DownloadSubmissionDataButton({ disabled, form, filters, visibleColumns, }) {
|
8
|
+
const [{ isDownloadingCsv, downloadingCsvError }, setState] = React.useState({
|
9
|
+
isDownloadingCsv: false,
|
10
|
+
downloadingCsvError: null,
|
11
|
+
});
|
12
|
+
const clearError = React.useCallback(() => {
|
13
|
+
setState({
|
14
|
+
isDownloadingCsv: false,
|
15
|
+
downloadingCsvError: null,
|
16
|
+
});
|
17
|
+
}, []);
|
18
|
+
const downloadCsv = React.useCallback(async () => {
|
19
|
+
setState({ isDownloadingCsv: true, downloadingCsvError: null });
|
20
|
+
try {
|
21
|
+
await formStoreService.exportFormStoreRecords(form.name, {
|
22
|
+
formId: form.id,
|
23
|
+
filters,
|
24
|
+
includeColumns: visibleColumns.map((visibleColumn) => visibleColumn.id),
|
25
|
+
});
|
26
|
+
setState({
|
27
|
+
isDownloadingCsv: false,
|
28
|
+
downloadingCsvError: null,
|
29
|
+
});
|
30
|
+
}
|
31
|
+
catch (error) {
|
32
|
+
setState({
|
33
|
+
isDownloadingCsv: false,
|
34
|
+
downloadingCsvError: error,
|
35
|
+
});
|
36
|
+
}
|
37
|
+
}, [form, filters, visibleColumns]);
|
38
|
+
return (React.createElement(React.Fragment, null,
|
39
|
+
React.createElement(Tooltip, { title: "Download submission data as a CSV file" },
|
40
|
+
React.createElement(LoadingButton, { type: "button", loading: isDownloadingCsv, loadingPosition: "start", startIcon: React.createElement(CsvIcon, null), onClick: downloadCsv, color: "primary", variant: "outlined", disabled: disabled }, "Download")),
|
41
|
+
React.createElement(ErrorSnackbar, { open: !!downloadingCsvError, onClose: clearError },
|
42
|
+
React.createElement("span", { "data-cypress": "edit-dialog-error-message" }, downloadingCsvError && downloadingCsvError.message))));
|
43
|
+
}
|
44
|
+
export default React.memo(DownloadSubmissionDataButton);
|
45
|
+
//# sourceMappingURL=DownloadSubmissionDataButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DownloadSubmissionDataButton.js","sourceRoot":"","sources":["../../../src/components/formStore/DownloadSubmissionDataButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAElD,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,SAAS,4BAA4B,CAAC,EACpC,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,cAAc,GAMf;IACC,MAAM,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAGzE;QACD,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAA;IACF,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,QAAQ,CAAC;YACP,gBA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O,CAC9C,CACO,CACf,CACJ,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Tooltip } from '@mui/material'\nimport { LoadingButton } from '@mui/lab'\nimport CsvIcon from '@mui/icons-material/Download'\nimport { Form } from '@oneblink/types/typescript/forms'\nimport ErrorSnackbar from '../ErrorSnackbar'\nimport { ColumnInstance } from 'react-table'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\nimport { formStoreService } from '@oneblink/apps'\n\nfunction DownloadSubmissionDataButton({\n disabled,\n form,\n filters,\n visibleColumns,\n}: {\n disabled: boolean\n form: Form\n filters?: formStoreService.FormStoreFilters\n visibleColumns: ColumnInstance<FormStoreRecord>[]\n}) {\n const [{ isDownloadingCsv, downloadingCsvError }, setState] = React.useState<{\n isDownloadingCsv: boolean\n downloadingCsvError: Error | null\n }>({\n isDownloadingCsv: false,\n downloadingCsvError: null,\n })\n const clearError = React.useCallback(() => {\n setState({\n isDownloadingCsv: false,\n downloadingCsvError: null,\n })\n }, [])\n\n const downloadCsv = React.useCallback(async () => {\n setState({ isDownloadingCsv: true, downloadingCsvError: null })\n try {\n await formStoreService.exportFormStoreRecords(form.name, {\n formId: form.id,\n filters,\n includeColumns: visibleColumns.map(\n (visibleColumn: ColumnInstance<FormStoreRecord>) => visibleColumn.id,\n ),\n })\n setState({\n isDownloadingCsv: false,\n downloadingCsvError: null,\n })\n } catch (error) {\n setState({\n isDownloadingCsv: false,\n downloadingCsvError: error as Error,\n })\n }\n }, [form, filters, visibleColumns])\n\n return (\n <>\n <Tooltip title=\"Download submission data as a CSV file\">\n <LoadingButton\n type=\"button\"\n loading={isDownloadingCsv}\n loadingPosition=\"start\"\n startIcon={<CsvIcon />}\n onClick={downloadCsv}\n color=\"primary\"\n variant=\"outlined\"\n disabled={disabled}\n >\n Download\n </LoadingButton>\n </Tooltip>\n\n <ErrorSnackbar open={!!downloadingCsvError} onClose={clearError}>\n <span data-cypress=\"edit-dialog-error-message\">\n {downloadingCsvError && downloadingCsvError.message}\n </span>\n </ErrorSnackbar>\n </>\n )\n}\nexport default React.memo(DownloadSubmissionDataButton)\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Form } from '@oneblink/types/typescript/forms';
|
3
|
+
import { FormTypes } from '@oneblink/types';
|
4
|
+
declare function FormStoreContainer({ form, formElements, }: {
|
5
|
+
form: Form;
|
6
|
+
formElements: FormTypes.FormElementWithName[];
|
7
|
+
}): JSX.Element;
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof FormStoreContainer>;
|
9
|
+
export default _default;
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { useHistory } from 'react-router-dom';
|
3
|
+
import querystring from 'query-string';
|
4
|
+
import { formStoreService } from '@oneblink/apps';
|
5
|
+
import useInfiniteScrollDataLoad from '../../hooks/useInfiniteScrollDataLoad';
|
6
|
+
import FormStoreTable from './table';
|
7
|
+
import useFormStoreTable from './table/useFormStoreTable';
|
8
|
+
import { Box, Button, Grid, Typography } from '@mui/material';
|
9
|
+
import { FilterList as FilterIcon, Settings as SettingsIcon, Sync as SyncIcon, } from '@mui/icons-material';
|
10
|
+
import useSubmissionIdValidationMessage, { validateIsUUID, } from '../../hooks/useSubmissionIdIsValid';
|
11
|
+
import DownloadSubmissionDataButton from './DownloadSubmissionDataButton';
|
12
|
+
import ColumnsConfigurationButton from './ColumnsConfigurationButton';
|
13
|
+
import ErrorMessage from '../ErrorMessage';
|
14
|
+
import LoadingWithMessage from '../LoadingWithMessage';
|
15
|
+
import NoResourcesYet from '../NoResourcesYet';
|
16
|
+
function FormStoreContainer({ form, formElements, }) {
|
17
|
+
var _a;
|
18
|
+
const history = useHistory();
|
19
|
+
const { isLoading, loadError, records: formStoreRecords, onTryAgain, onRefresh, filters, onChangeFilters, } = useInfiniteScrollDataLoad({
|
20
|
+
limit: 50,
|
21
|
+
debounceSearchMs: 1000,
|
22
|
+
onDefaultFilters: React.useCallback((query) => {
|
23
|
+
let filters = {};
|
24
|
+
try {
|
25
|
+
if (typeof query.filters === 'string') {
|
26
|
+
filters = JSON.parse(query.filters);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
catch (error) {
|
30
|
+
console.warn('Could not parse filter as JSON', error);
|
31
|
+
}
|
32
|
+
if (!filters.sorting) {
|
33
|
+
filters.sorting = [
|
34
|
+
{ property: 'dateTimeSubmitted', direction: 'descending' },
|
35
|
+
];
|
36
|
+
}
|
37
|
+
return filters;
|
38
|
+
}, []),
|
39
|
+
onSearch: React.useCallback(async (filters, paging, abortSignal) => {
|
40
|
+
// Exclude all search parameters if searching
|
41
|
+
// for a specific submission using an identifier
|
42
|
+
const searchFilters = filters.submissionId
|
43
|
+
? {
|
44
|
+
submissionId: filters.submissionId,
|
45
|
+
}
|
46
|
+
: filters;
|
47
|
+
const result = await formStoreService.searchFormStoreRecords({
|
48
|
+
paging,
|
49
|
+
formId: form.id,
|
50
|
+
filters: searchFilters,
|
51
|
+
}, abortSignal);
|
52
|
+
return {
|
53
|
+
records: result.formStoreRecords,
|
54
|
+
meta: result.meta,
|
55
|
+
};
|
56
|
+
}, [form.id]),
|
57
|
+
onValidateFilters: React.useCallback((currentFilters) => {
|
58
|
+
var _a;
|
59
|
+
return validateIsUUID((_a = currentFilters.submissionId) === null || _a === void 0 ? void 0 : _a.$eq);
|
60
|
+
}, []),
|
61
|
+
});
|
62
|
+
React.useEffect(() => {
|
63
|
+
history.replace({
|
64
|
+
search: querystring.stringify({
|
65
|
+
filters: JSON.stringify(filters),
|
66
|
+
}),
|
67
|
+
});
|
68
|
+
}, [filters, history]);
|
69
|
+
const submissionIdValidationMessage = useSubmissionIdValidationMessage((_a = filters.submissionId) === null || _a === void 0 ? void 0 : _a.$eq);
|
70
|
+
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, allColumns, visibleColumns, getToggleHideAllColumnsProps, } = useFormStoreTable({
|
71
|
+
formStoreRecords,
|
72
|
+
filters,
|
73
|
+
onChangeFilters,
|
74
|
+
submissionIdValidationMessage,
|
75
|
+
form,
|
76
|
+
formElements,
|
77
|
+
});
|
78
|
+
return (React.createElement(Box, { padding: 2, paddingBottom: 16 },
|
79
|
+
React.createElement(Grid, { container: true, spacing: 2, alignItems: "center" },
|
80
|
+
React.createElement(Grid, { item: true, xs: true },
|
81
|
+
React.createElement(Typography, { variant: "h6" }, form === null || form === void 0 ? void 0 : form.name)),
|
82
|
+
React.createElement(Grid, { item: true, xs: false },
|
83
|
+
React.createElement(Button, { startIcon: React.createElement(FilterIcon, null), disabled: !Object.keys(filters).length, onClick: () => {
|
84
|
+
onChangeFilters((currentFilters) => ({
|
85
|
+
sorting: currentFilters.sorting,
|
86
|
+
}), false);
|
87
|
+
}, variant: "text" }, "Clear Filters")),
|
88
|
+
React.createElement(Grid, { item: true, xs: false },
|
89
|
+
React.createElement(ColumnsConfigurationButton, { allColumns: allColumns, getToggleHideAllColumnsProps: getToggleHideAllColumnsProps })),
|
90
|
+
React.createElement(Grid, { item: true, xs: false },
|
91
|
+
React.createElement(DownloadSubmissionDataButton, { disabled: false, form: form, filters: filters, visibleColumns: visibleColumns })),
|
92
|
+
React.createElement(Grid, { item: true, xs: false },
|
93
|
+
React.createElement(Button, { startIcon: React.createElement(SyncIcon, null), onClick: onRefresh, color: "primary", variant: "contained", disabled: !!submissionIdValidationMessage }, "Refresh")),
|
94
|
+
React.createElement(Grid, { item: true, xs: 12 },
|
95
|
+
visibleColumns.length ? (React.createElement(FormStoreTable, { isEmptyResults: !formStoreRecords.length && !isLoading && !loadError, getTableProps: getTableProps, getTableBodyProps: getTableBodyProps, headerGroups: headerGroups, rows: rows, prepareRow: prepareRow, onChangeFilters: onChangeFilters })) : (React.createElement(NoResourcesYet, { IconComponent: SettingsIcon, title: "No Columns Visible", gutterBottom: true }, "It looks like you have hidden all of the available columns. Please enable at least one column to view submissions.")),
|
96
|
+
isLoading && (React.createElement(LoadingWithMessage, { message: "Loading more records..." })),
|
97
|
+
loadError && (React.createElement(React.Fragment, null,
|
98
|
+
React.createElement(ErrorMessage, { title: "Error Retrieving Submissions", gutterBottom: true, gutterTop: true }, loadError.message),
|
99
|
+
React.createElement(Grid, { container: true, justifyContent: "center" },
|
100
|
+
React.createElement(Button, { variant: "outlined", color: "primary", onClick: () => onTryAgain() }, "Try Again"))))))));
|
101
|
+
}
|
102
|
+
export default React.memo(FormStoreContainer);
|
103
|
+
//# sourceMappingURL=FormStore.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FormStore.js","sourceRoot":"","sources":["../../../src/components/formStore/FormStore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,WAAW,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,yBAAyB,MAAM,uCAAuC,CAAA;AAC7E,OAAO,cAAc,MAAM,SAAS,CAAA;AACpC,OAAO,iBAAiB,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EACL,UAAU,IAAI,UAAU,EACxB,QAAQ,IAAI,YAAY,EACxB,IAAI,IAAI,QAAQ,GACjB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,gCAAgC,EAAE,EACvC,cAAc,GACf,MAAM,oCAAoC,CAAA;AAE3C,OAAO,4BAA4B,MAAM,gCAAgC,CAAA;AACzE,OAAO,0BAA0B,MAAM,8BAA8B,CAAA;AACrE,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,kBAAkB,MAAM,uBAAuB,CAAA;AACtD,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAE9C,SAAS,kBAAkB,CAA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AAE,YAAY,EAC1B,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,GAChC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,cAAc,IACb,aAAa,EAAE,YAAY,EAC3B,KAAK,EAAC,oBAAoB,EAC1B,YAAY,+HAIG,CAClB;gBAEA,SAAS,IAAI,CACZ,oBAAC,kBAAkB,IAAC,OAAO,EAAC,yBAAyB,GAAG,CACzD;gBAEA,SAAS,IAAI,CACZ;oBACE,oBAAC,YAAY,IACX,KAAK,EAAC,8BAA8B,EACpC,YAAY,QACZ,SAAS,UAER,SAAS,CAAC,OAAO,CACL;oBACf,oBAAC,IAAI,IAAC,SAAS,QAAC,cAAc,EAAC,QAAQ;wBACrC,oBAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,gBAGpB,CACJ,CACN,CACJ,CACI,CACF,CACH,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { useHistory } from 'react-router-dom'\nimport querystring from 'query-string'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\nimport { formStoreService } from '@oneblink/apps'\nimport useInfiniteScrollDataLoad from '../../hooks/useInfiniteScrollDataLoad'\nimport FormStoreTable from './table'\nimport useFormStoreTable from './table/useFormStoreTable'\nimport { Box, Button, Grid, Typography } from '@mui/material'\nimport {\n FilterList as FilterIcon,\n Settings as SettingsIcon,\n Sync as SyncIcon,\n} from '@mui/icons-material'\nimport { Form } from '@oneblink/types/typescript/forms'\nimport useSubmissionIdValidationMessage, {\n validateIsUUID,\n} from '../../hooks/useSubmissionIdIsValid'\nimport { FormTypes } from '@oneblink/types'\nimport DownloadSubmissionDataButton from './DownloadSubmissionDataButton'\nimport ColumnsConfigurationButton from './ColumnsConfigurationButton'\nimport ErrorMessage from '../ErrorMessage'\nimport LoadingWithMessage from '../LoadingWithMessage'\nimport NoResourcesYet from '../NoResourcesYet'\n\nfunction FormStoreContainer({\n form,\n formElements,\n}: {\n form: Form\n formElements: FormTypes.FormElementWithName[]\n}) {\n const history = useHistory()\n const {\n isLoading,\n loadError,\n records: formStoreRecords,\n onTryAgain,\n onRefresh,\n filters,\n onChangeFilters,\n } = useInfiniteScrollDataLoad<\n formStoreService.FormStoreFilters,\n FormStoreRecord\n >({\n limit: 50,\n debounceSearchMs: 1000,\n onDefaultFilters: React.useCallback((query) => {\n let filters: formStoreService.FormStoreFilters = {}\n try {\n if (typeof query.filters === 'string') {\n filters = JSON.parse(query.filters)\n }\n } catch (error) {\n console.warn('Could not parse filter as JSON', error)\n }\n if (!filters.sorting) {\n filters.sorting = [\n { property: 'dateTimeSubmitted', direction: 'descending' },\n ]\n }\n return filters\n }, []),\n onSearch: React.useCallback(\n async (filters, paging, abortSignal) => {\n // Exclude all search parameters if searching\n // for a specific submission using an identifier\n const searchFilters = filters.submissionId\n ? {\n submissionId: filters.submissionId,\n }\n : filters\n const result = await formStoreService.searchFormStoreRecords(\n {\n paging,\n formId: form.id,\n filters: searchFilters,\n },\n abortSignal,\n )\n return {\n records: result.formStoreRecords,\n meta: result.meta,\n }\n },\n [form.id],\n ),\n onValidateFilters: React.useCallback(\n (currentFilters: formStoreService.FormStoreFilters) => {\n return validateIsUUID(currentFilters.submissionId?.$eq)\n },\n [],\n ),\n })\n\n React.useEffect(() => {\n history.replace({\n search: querystring.stringify({\n filters: JSON.stringify(filters),\n }),\n })\n }, [filters, history])\n\n const submissionIdValidationMessage = useSubmissionIdValidationMessage(\n filters.submissionId?.$eq,\n )\n\n const {\n getTableProps,\n getTableBodyProps,\n headerGroups,\n rows,\n prepareRow,\n allColumns,\n visibleColumns,\n getToggleHideAllColumnsProps,\n } = useFormStoreTable({\n formStoreRecords,\n filters,\n onChangeFilters,\n submissionIdValidationMessage,\n form,\n formElements,\n })\n\n return (\n <Box padding={2} paddingBottom={16}>\n <Grid container spacing={2} alignItems=\"center\">\n <Grid item xs={true}>\n <Typography variant=\"h6\">{form?.name}</Typography>\n </Grid>\n <Grid item xs={false}>\n <Button\n startIcon={<FilterIcon />}\n disabled={!Object.keys(filters).length}\n onClick={() => {\n onChangeFilters(\n (currentFilters) => ({\n sorting: currentFilters.sorting,\n }),\n false,\n )\n }}\n variant=\"text\"\n >\n Clear Filters\n </Button>\n </Grid>\n <Grid item xs={false}>\n <ColumnsConfigurationButton\n allColumns={allColumns}\n getToggleHideAllColumnsProps={getToggleHideAllColumnsProps}\n />\n </Grid>\n <Grid item xs={false}>\n <DownloadSubmissionDataButton\n disabled={false}\n form={form}\n filters={filters}\n visibleColumns={visibleColumns}\n />\n </Grid>\n <Grid item xs={false}>\n <Button\n startIcon={<SyncIcon />}\n onClick={onRefresh}\n color=\"primary\"\n variant=\"contained\"\n disabled={!!submissionIdValidationMessage}\n >\n Refresh\n </Button>\n </Grid>\n <Grid item xs={12}>\n {visibleColumns.length ? (\n <FormStoreTable\n isEmptyResults={\n !formStoreRecords.length && !isLoading && !loadError\n }\n getTableProps={getTableProps}\n getTableBodyProps={getTableBodyProps}\n headerGroups={headerGroups}\n rows={rows}\n prepareRow={prepareRow}\n onChangeFilters={onChangeFilters}\n />\n ) : (\n <NoResourcesYet\n IconComponent={SettingsIcon}\n title=\"No Columns Visible\"\n gutterBottom\n >\n It looks like you have hidden all of the available columns. Please\n enable at least one column to view submissions.\n </NoResourcesYet>\n )}\n\n {isLoading && (\n <LoadingWithMessage message=\"Loading more records...\" />\n )}\n\n {loadError && (\n <>\n <ErrorMessage\n title=\"Error Retrieving Submissions\"\n gutterBottom\n gutterTop\n >\n {loadError.message}\n </ErrorMessage>\n <Grid container justifyContent=\"center\">\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => onTryAgain()}\n >\n Try Again\n </Button>\n </Grid>\n </>\n )}\n </Grid>\n </Grid>\n </Box>\n )\n}\n\nexport default React.memo(FormStoreContainer)\n"]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { FormElementWithOptions } from '@oneblink/types/typescript/forms';
|
3
|
+
export declare function FileChip({ file: { fileName, url, isPrivate, data }, }: {
|
4
|
+
file: {
|
5
|
+
fileName: string;
|
6
|
+
url?: string;
|
7
|
+
isPrivate?: boolean;
|
8
|
+
data?: string;
|
9
|
+
};
|
10
|
+
}): JSX.Element;
|
11
|
+
export declare function FilesElementDataTableCellContent({ value, }: {
|
12
|
+
value: Array<{
|
13
|
+
fileName: string;
|
14
|
+
url?: string | undefined;
|
15
|
+
isPrivate?: boolean | undefined;
|
16
|
+
data?: string | undefined;
|
17
|
+
}>;
|
18
|
+
}): JSX.Element;
|
19
|
+
export declare function MultiSelectFormElementTableCellContent({ value, formElement, }: {
|
20
|
+
value: string[];
|
21
|
+
formElement: FormElementWithOptions;
|
22
|
+
}): JSX.Element;
|
23
|
+
export declare function getSelectedOptionLabel(formElement: FormElementWithOptions, value: string): string;
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { saveAs } from 'file-saver';
|
3
|
+
import { Chip, CircularProgress, Grid } from '@mui/material';
|
4
|
+
import { SaveAlt, AttachFile } from '@mui/icons-material';
|
5
|
+
import ErrorSnackbar from '../../ErrorSnackbar';
|
6
|
+
import { UnorderedList, ListItem } from '../../Lists';
|
7
|
+
import { getCognitoIdToken } from '@oneblink/apps/dist/services/cognito';
|
8
|
+
async function fetchFile(url) {
|
9
|
+
const idToken = await getCognitoIdToken();
|
10
|
+
const response = await fetch(url, {
|
11
|
+
headers: {
|
12
|
+
Authorization: `Bearer ${idToken}`,
|
13
|
+
},
|
14
|
+
});
|
15
|
+
if (!response.ok) {
|
16
|
+
throw new Error(`Unable to download file. HTTP Status Code: ${response.status}`);
|
17
|
+
}
|
18
|
+
return await response.blob();
|
19
|
+
}
|
20
|
+
export function FileChip({ file: { fileName, url, isPrivate, data }, }) {
|
21
|
+
const [{ isDownloading, error }, setState] = React.useState({
|
22
|
+
isDownloading: false,
|
23
|
+
});
|
24
|
+
const clearError = React.useCallback(() => {
|
25
|
+
setState({
|
26
|
+
isDownloading: false,
|
27
|
+
});
|
28
|
+
}, []);
|
29
|
+
const handleDownload = React.useCallback(async () => {
|
30
|
+
try {
|
31
|
+
setState({
|
32
|
+
isDownloading: true,
|
33
|
+
});
|
34
|
+
if (url) {
|
35
|
+
if (isPrivate) {
|
36
|
+
const blob = await fetchFile(url);
|
37
|
+
saveAs(blob, fileName);
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
saveAs(url, fileName);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
else if (data) {
|
44
|
+
saveAs(data, fileName);
|
45
|
+
}
|
46
|
+
setState({
|
47
|
+
isDownloading: false,
|
48
|
+
});
|
49
|
+
}
|
50
|
+
catch (error) {
|
51
|
+
setState({
|
52
|
+
isDownloading: false,
|
53
|
+
error: error,
|
54
|
+
});
|
55
|
+
}
|
56
|
+
}, [data, fileName, isPrivate, url]);
|
57
|
+
return (React.createElement(React.Fragment, null,
|
58
|
+
React.createElement(Chip, { label: fileName, deleteIcon: React.createElement(SaveAlt, null), onDelete: handleDownload, variant: "outlined", icon: isDownloading ? React.createElement(CircularProgress, { size: 16 }) : React.createElement(AttachFile, null) }),
|
59
|
+
React.createElement(ErrorSnackbar, { open: !!error, onClose: clearError },
|
60
|
+
React.createElement("span", { "data-cypress": "download-legacy-file-error-message" }, error && error.message))));
|
61
|
+
}
|
62
|
+
export function FilesElementDataTableCellContent({ value, }) {
|
63
|
+
return (React.createElement(Grid, { container: true, spacing: 1 }, value.map((file, index) => {
|
64
|
+
return (React.createElement(Grid, { item: true, key: index, xs: 12 },
|
65
|
+
React.createElement(FileChip, { file: file })));
|
66
|
+
})));
|
67
|
+
}
|
68
|
+
export function MultiSelectFormElementTableCellContent({ value, formElement, }) {
|
69
|
+
return (React.createElement(UnorderedList, { disablePadding: true }, value.map((selection, index) => {
|
70
|
+
const label = getSelectedOptionLabel(formElement, selection);
|
71
|
+
return React.createElement(ListItem, { key: index }, label);
|
72
|
+
})));
|
73
|
+
}
|
74
|
+
export function getSelectedOptionLabel(formElement, value) {
|
75
|
+
const selectedOption = (formElement.options || []).find((opt) => opt.value === value);
|
76
|
+
return selectedOption ? selectedOption.label : value;
|
77
|
+
}
|
78
|
+
//# sourceMappingURL=ElementDisplay.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ElementDisplay.js","sourceRoot":"","sources":["../../../../src/components/formStore/display/ElementDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAExE,KAAK,UAAU,SAAS,CAAC,GAAW;IAClC,MAAM,OAAO,GAAG,MAAM,iBAAiB,EAAE,CAAA;IACzC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,EAAE;SACnC;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,8CAA8C,QAAQ,CAAC,MAAM,EAAE,CAChE,CAAA;KACF;IAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;AAC9B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,EACvB,IAAI,EAAE,EAAE,QAAQ,EAAE,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OAAO,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACtD,CAAC","sourcesContent":["import * as React from 'react'\nimport { saveAs } from 'file-saver'\nimport { Chip, CircularProgress, Grid } from '@mui/material'\nimport { SaveAlt, AttachFile } from '@mui/icons-material'\nimport ErrorSnackbar from '../../ErrorSnackbar'\nimport { UnorderedList, ListItem } from '../../Lists'\nimport { FormElementWithOptions } from '@oneblink/types/typescript/forms'\nimport { getCognitoIdToken } from '@oneblink/apps/dist/services/cognito'\n\nasync function fetchFile(url: string) {\n const idToken = await getCognitoIdToken()\n const response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${idToken}`,\n },\n })\n\n if (!response.ok) {\n throw new Error(\n `Unable to download file. HTTP Status Code: ${response.status}`,\n )\n }\n\n return await response.blob()\n}\n\nexport function FileChip({\n file: { fileName, url, isPrivate, data },\n}: {\n file: {\n fileName: string\n url?: string\n isPrivate?: boolean\n data?: string\n }\n}) {\n const [{ isDownloading, error }, setState] = React.useState<{\n error?: Error\n isDownloading: boolean\n }>({\n isDownloading: false,\n })\n const clearError = React.useCallback(() => {\n setState({\n isDownloading: false,\n })\n }, [])\n const handleDownload = React.useCallback(async () => {\n try {\n setState({\n isDownloading: true,\n })\n\n if (url) {\n if (isPrivate) {\n const blob = await fetchFile(url)\n saveAs(blob, fileName)\n } else {\n saveAs(url, fileName)\n }\n } else if (data) {\n saveAs(data, fileName)\n }\n\n setState({\n isDownloading: false,\n })\n } catch (error) {\n setState({\n isDownloading: false,\n error: error as Error,\n })\n }\n }, [data, fileName, isPrivate, url])\n return (\n <>\n <Chip\n label={fileName}\n deleteIcon={<SaveAlt />}\n onDelete={handleDownload}\n variant=\"outlined\"\n icon={isDownloading ? <CircularProgress size={16} /> : <AttachFile />}\n />\n <ErrorSnackbar open={!!error} onClose={clearError}>\n <span data-cypress=\"download-legacy-file-error-message\">\n {error && error.message}\n </span>\n </ErrorSnackbar>\n </>\n )\n}\n\nexport function FilesElementDataTableCellContent({\n value,\n}: {\n value: Array<{\n fileName: string\n url?: string | undefined\n isPrivate?: boolean | undefined\n data?: string | undefined\n }>\n}) {\n return (\n <Grid container spacing={1}>\n {value.map((file, index) => {\n return (\n <Grid item key={index} xs={12}>\n <FileChip file={file} />\n </Grid>\n )\n })}\n </Grid>\n )\n}\n\nexport function MultiSelectFormElementTableCellContent({\n value,\n formElement,\n}: {\n value: string[]\n formElement: FormElementWithOptions\n}) {\n return (\n <UnorderedList disablePadding>\n {value.map((selection, index) => {\n const label = getSelectedOptionLabel(formElement, selection)\n return <ListItem key={index}>{label}</ListItem>\n })}\n </UnorderedList>\n )\n}\n\nexport function getSelectedOptionLabel(\n formElement: FormElementWithOptions,\n value: string,\n) {\n const selectedOption = (formElement.options || []).find(\n (opt) => opt.value === value,\n )\n return selectedOption ? selectedOption.label : value\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FormStoreIcon.js","sourceRoot":"","sources":["../../../../src/components/formStore/display/FormStoreIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,0BAA0B,CAAA;AAC3C,eAAe,IAAI,CAAA","sourcesContent":["import Work from '@mui/icons-material/Work'\nexport default Work\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { UserProfile } from '@oneblink/types/typescript/misc';
|
3
|
+
import { Chip } from '@mui/material';
|
4
|
+
declare function ActionedByTableCell({ userProfile, developerKey, ...rest }: React.ComponentProps<typeof Chip> & {
|
5
|
+
userProfile?: UserProfile;
|
6
|
+
developerKey?: {
|
7
|
+
name: string;
|
8
|
+
};
|
9
|
+
}): JSX.Element;
|
10
|
+
declare const _default: React.MemoExoticComponent<typeof ActionedByTableCell>;
|
11
|
+
export default _default;
|