@oneblink/apps-react 0.6.2-beta.3 → 1.0.0-beta.10
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/components/CopyToClipboardIconButton.d.ts +10 -0
- package/dist/components/CopyToClipboardIconButton.js +33 -0
- package/dist/components/CopyToClipboardIconButton.js.map +1 -0
- package/dist/components/CustomAccordion.d.ts +27 -0
- package/dist/components/CustomAccordion.js +38 -0
- package/dist/components/CustomAccordion.js.map +1 -0
- package/dist/components/ErrorSnackbar.d.ts +8 -0
- package/dist/components/ErrorSnackbar.js +26 -0
- package/dist/components/ErrorSnackbar.js.map +1 -0
- package/dist/components/Lists.d.ts +25 -0
- package/dist/components/Lists.js +45 -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/formStore/FormStoreTableProvider.d.ts +6 -0
- package/dist/components/formStore/FormStoreTableProvider.js +89 -0
- package/dist/components/formStore/FormStoreTableProvider.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +19 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +33 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +49 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.js +25 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +12 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.js +184 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.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 +215 -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 +8 -0
- package/dist/components/formStore/table/RepeatableSetCell.js +61 -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 +28 -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/useFormStoreTable.d.ts +52 -0
- package/dist/components/formStore/table/useFormStoreTable.js +139 -0
- package/dist/components/formStore/table/useFormStoreTable.js.map +1 -0
- package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -0
- package/dist/components/formStore/useFormStoreTableContext.js +10 -0
- package/dist/components/formStore/useFormStoreTableContext.js.map +1 -0
- package/dist/components/messages/ErrorMessage.d.ts +12 -0
- package/dist/components/messages/ErrorMessage.js +13 -0
- package/dist/components/messages/ErrorMessage.js.map +1 -0
- package/dist/components/messages/LargeIconMessage.d.ts +17 -0
- package/dist/components/messages/LargeIconMessage.js +38 -0
- package/dist/components/messages/LargeIconMessage.js.map +1 -0
- package/dist/components/messages/NoResourcesYet.d.ts +11 -0
- package/dist/components/messages/NoResourcesYet.js +7 -0
- package/dist/components/messages/NoResourcesYet.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 +29 -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/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 +3 -0
- package/dist/hooks/useSubmissionIdIsValid.js +20 -0
- package/dist/hooks/useSubmissionIdIsValid.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -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 +14 -5
- 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,215 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Link, Typography } from '@mui/material';
|
3
|
+
import { localisationService } from '@oneblink/apps';
|
4
|
+
import { abnService } from '@oneblink/sdk-core';
|
5
|
+
import { FileChip, FilesElementDataTableCellContent, MultiSelectFormElementTableCellContent, getSelectedOptionLabel, } from '../display/ElementDisplay';
|
6
|
+
import RepeatableSetCell from './RepeatableSetCell';
|
7
|
+
import TableCellCopyButton from './TableCellCopyButton';
|
8
|
+
import { format } from 'date-fns';
|
9
|
+
const { shortDate: shortDateFormat, time: timeFormat, shortDateTime: shortDateTimeFormat, } = localisationService.getDateFnsFormats();
|
10
|
+
function FormElementTableCell({ formElement, submission, allowCopy }) {
|
11
|
+
var _a, _b;
|
12
|
+
if (formElement.type === 'page' || formElement.type === 'section') {
|
13
|
+
return null;
|
14
|
+
}
|
15
|
+
const unknown = submission === null || submission === void 0 ? void 0 : submission[formElement.name];
|
16
|
+
if (unknown === undefined || unknown === null) {
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
switch (formElement.type) {
|
20
|
+
case 'repeatableSet': {
|
21
|
+
return (React.createElement(RepeatableSetCell, { formElement: formElement, value: unknown }));
|
22
|
+
}
|
23
|
+
case 'location': {
|
24
|
+
const value = unknown;
|
25
|
+
if (!value.latitude || !value.longitude) {
|
26
|
+
break;
|
27
|
+
}
|
28
|
+
const latLong = `${value.latitude},${value.longitude}`;
|
29
|
+
return (React.createElement(React.Fragment, null,
|
30
|
+
React.createElement("div", null,
|
31
|
+
React.createElement(Typography, { variant: "inherit", component: "p" },
|
32
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `https://maps.google.com/?q=${latLong}` }, "View in Google Maps")),
|
33
|
+
React.createElement(Typography, { variant: "inherit", component: "p", color: "textSecondary" },
|
34
|
+
"Latitude: ",
|
35
|
+
value.latitude),
|
36
|
+
React.createElement(Typography, { variant: "inherit", component: "p", color: "textSecondary" },
|
37
|
+
"Longitude: ",
|
38
|
+
value.longitude)),
|
39
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: latLong })));
|
40
|
+
}
|
41
|
+
case 'camera':
|
42
|
+
case 'draw': {
|
43
|
+
return (React.createElement(FileChip, { file: unknown }));
|
44
|
+
}
|
45
|
+
case 'textarea': {
|
46
|
+
const value = unknown;
|
47
|
+
return (React.createElement(React.Fragment, null,
|
48
|
+
React.createElement("span", { style: {
|
49
|
+
whiteSpace: 'pre-line',
|
50
|
+
} }, value),
|
51
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
52
|
+
}
|
53
|
+
case 'date': {
|
54
|
+
const value = unknown;
|
55
|
+
const text = format(new Date(value), shortDateFormat);
|
56
|
+
return (React.createElement(React.Fragment, null,
|
57
|
+
text,
|
58
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
59
|
+
}
|
60
|
+
case 'time': {
|
61
|
+
const value = unknown;
|
62
|
+
const text = format(new Date(value), timeFormat);
|
63
|
+
return (React.createElement(React.Fragment, null,
|
64
|
+
text,
|
65
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
66
|
+
}
|
67
|
+
case 'datetime': {
|
68
|
+
const value = unknown;
|
69
|
+
const text = format(new Date(value), shortDateTimeFormat);
|
70
|
+
return (React.createElement(React.Fragment, null,
|
71
|
+
text,
|
72
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
73
|
+
}
|
74
|
+
case 'number': {
|
75
|
+
const value = unknown;
|
76
|
+
const text = localisationService.formatNumber(value);
|
77
|
+
return (React.createElement(React.Fragment, null,
|
78
|
+
text,
|
79
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
80
|
+
}
|
81
|
+
case 'radio':
|
82
|
+
case 'autocomplete':
|
83
|
+
case 'checkboxes':
|
84
|
+
case 'select': {
|
85
|
+
if (formElement.type === 'checkboxes' ||
|
86
|
+
(formElement.type === 'select' && formElement.multi)) {
|
87
|
+
const value = unknown;
|
88
|
+
if (!Array.isArray(value) || !value.length) {
|
89
|
+
break;
|
90
|
+
}
|
91
|
+
const text = value
|
92
|
+
.map((selection) => getSelectedOptionLabel(formElement, selection))
|
93
|
+
.join(', ');
|
94
|
+
return (React.createElement(React.Fragment, null,
|
95
|
+
React.createElement(MultiSelectFormElementTableCellContent, { value: value, formElement: formElement }),
|
96
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
97
|
+
}
|
98
|
+
else {
|
99
|
+
const value = unknown;
|
100
|
+
const text = getSelectedOptionLabel(formElement, value);
|
101
|
+
return (React.createElement(React.Fragment, null,
|
102
|
+
text,
|
103
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
104
|
+
}
|
105
|
+
}
|
106
|
+
case 'email': {
|
107
|
+
const value = unknown;
|
108
|
+
return (React.createElement(React.Fragment, null,
|
109
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `mailto:${value}` }, value),
|
110
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
111
|
+
}
|
112
|
+
case 'telephone': {
|
113
|
+
const value = unknown;
|
114
|
+
return (React.createElement(React.Fragment, null,
|
115
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `tel:${value}` }, value),
|
116
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
117
|
+
}
|
118
|
+
case 'text':
|
119
|
+
case 'bsb':
|
120
|
+
case 'barcodeScanner': {
|
121
|
+
const value = unknown;
|
122
|
+
return (React.createElement(React.Fragment, null,
|
123
|
+
value,
|
124
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
125
|
+
}
|
126
|
+
case 'files': {
|
127
|
+
const value = unknown;
|
128
|
+
if (!Array.isArray(value) || !value.length) {
|
129
|
+
break;
|
130
|
+
}
|
131
|
+
return React.createElement(FilesElementDataTableCellContent, { value: value });
|
132
|
+
}
|
133
|
+
case 'calculation': {
|
134
|
+
const value = unknown;
|
135
|
+
if (formElement.displayAsCurrency) {
|
136
|
+
const text = localisationService.formatCurrency(value);
|
137
|
+
return (React.createElement(React.Fragment, null,
|
138
|
+
text,
|
139
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value.toString() })));
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
const text = localisationService.formatNumber(value);
|
143
|
+
return (React.createElement(React.Fragment, null,
|
144
|
+
text,
|
145
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value.toString() })));
|
146
|
+
}
|
147
|
+
}
|
148
|
+
case 'civicaStreetName': {
|
149
|
+
const value = unknown;
|
150
|
+
return (React.createElement(React.Fragment, null,
|
151
|
+
value.formattedStreet,
|
152
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value.formattedStreet })));
|
153
|
+
}
|
154
|
+
case 'civicaNameRecord': {
|
155
|
+
const value = unknown;
|
156
|
+
const text = [value === null || value === void 0 ? void 0 : value.title, value === null || value === void 0 ? void 0 : value.givenName1, value === null || value === void 0 ? void 0 : value.familyName]
|
157
|
+
.filter((t) => t)
|
158
|
+
.join(' ') || (value === null || value === void 0 ? void 0 : value.emailAddress);
|
159
|
+
return (React.createElement(React.Fragment, null,
|
160
|
+
text,
|
161
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
162
|
+
}
|
163
|
+
case 'geoscapeAddress': {
|
164
|
+
const value = unknown;
|
165
|
+
const fullAddress = ((_a = value === null || value === void 0 ? void 0 : value.addressDetails) === null || _a === void 0 ? void 0 : _a.formattedAddress) || (React.createElement(React.Fragment, null,
|
166
|
+
"Geoscape Address ID: ",
|
167
|
+
React.createElement("i", null, value.addressId)));
|
168
|
+
return (React.createElement(React.Fragment, null,
|
169
|
+
fullAddress,
|
170
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: fullAddress })));
|
171
|
+
}
|
172
|
+
case 'pointAddress': {
|
173
|
+
const value = unknown;
|
174
|
+
const fullAddress = ((_b = value === null || value === void 0 ? void 0 : value.addressDetails) === null || _b === void 0 ? void 0 : _b.formattedAddress) || (React.createElement(React.Fragment, null,
|
175
|
+
"NSW Point Address ID: ",
|
176
|
+
React.createElement("i", null, value.addressId)));
|
177
|
+
return (React.createElement(React.Fragment, null,
|
178
|
+
fullAddress,
|
179
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: fullAddress })));
|
180
|
+
}
|
181
|
+
case 'boolean': {
|
182
|
+
const value = unknown;
|
183
|
+
const text = value ? 'Yes' : 'No';
|
184
|
+
return (React.createElement(React.Fragment, null,
|
185
|
+
text,
|
186
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
187
|
+
}
|
188
|
+
case 'abn': {
|
189
|
+
const value = unknown;
|
190
|
+
const abnNumber = abnService.displayABNNumberFromABNRecord(value);
|
191
|
+
return (React.createElement(React.Fragment, null,
|
192
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `https://www.abr.business.gov.au/ABN/View/${abnNumber}` },
|
193
|
+
abnNumber,
|
194
|
+
" |",
|
195
|
+
' ',
|
196
|
+
React.createElement("i", null, abnService.displayBusinessNameFromABNRecord(value))),
|
197
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: abnNumber })));
|
198
|
+
}
|
199
|
+
case 'html':
|
200
|
+
case 'form':
|
201
|
+
case 'infoPage':
|
202
|
+
case 'captcha':
|
203
|
+
case 'image':
|
204
|
+
case 'heading':
|
205
|
+
case 'summary': {
|
206
|
+
break;
|
207
|
+
}
|
208
|
+
default: {
|
209
|
+
console.warn('Unsupported element type in Submission Data rendering', formElement);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
return null;
|
213
|
+
}
|
214
|
+
export default React.memo(FormElementTableCell);
|
215
|
+
//# sourceMappingURL=FormElementTableCell.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FormElementTableCell.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/FormElementTableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EACL,QAAQ,EACR,gCAAgC,EAChC,sCAAsC,EACtC,sBAAsB,GACvB,MAAM,2BAA2B,CAAA;AAClC,OAAO,iBAAiB,MAAM,qBAAqB,CAAA;AACnD,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAWjC,MAAM,EACJ,SAAS,EAAE,eAAe,EAC1B,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,mBAAmB,GACnC,GAAG,mBAAmB,CAAC,iBAAiB,EAAE,CAAA;AAE3C,SAAS,oBAAoB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAS;;IACzE,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE;QACjE,OAAO,IAAI,CAAA;KACZ;IACD,MAAM,OAAO,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,WAAW,CAAC,IAAI,CAAC,CAAA;IAC9C,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE;QAC7C,OAAO,IAAI,CAAA;KACZ;IAED,QAAQ,WAAW,CAAC,IAAI,EAAE;QACxB,KAAK,eAAe,CAAC,CAAC;YACpB,OAAO,CACL,oBAAC,iBAAiB,IAChB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,OAAoC,GAC3C,CACH,CAAA;SACF;QAED,K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AAC;QACf,KAAK,SAAS,CAAC,CAAC;YACd,MAAK;SACN;QAED,OAAO,CAAC,CAAC;YACP,OAAO,CAAC,IAAI,CACV,uDAAuD,EACvD,WAAW,CACZ,CAAA;SACF;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Link, Typography } from '@mui/material'\nimport { localisationService } from '@oneblink/apps'\nimport { FormTypes, SubmissionTypes } from '@oneblink/types'\nimport { abnService } from '@oneblink/sdk-core'\nimport {\n FileChip,\n FilesElementDataTableCellContent,\n MultiSelectFormElementTableCellContent,\n getSelectedOptionLabel,\n} from '../display/ElementDisplay'\nimport RepeatableSetCell from './RepeatableSetCell'\nimport TableCellCopyButton from './TableCellCopyButton'\nimport { format } from 'date-fns'\nimport { ABNRecord } from '@oneblink/types/typescript/misc'\nimport { GeoscapeAddress } from '@oneblink/types/typescript/geoscape'\nimport { PointAddress } from '@oneblink/types/typescript/point'\n\ntype Props = {\n formElement: FormTypes.FormElement\n submission: SubmissionTypes.S3SubmissionData['submission'] | undefined\n allowCopy: boolean\n}\n\nconst {\n shortDate: shortDateFormat,\n time: timeFormat,\n shortDateTime: shortDateTimeFormat,\n} = localisationService.getDateFnsFormats()\n\nfunction FormElementTableCell({ formElement, submission, allowCopy }: Props) {\n if (formElement.type === 'page' || formElement.type === 'section') {\n return null\n }\n const unknown = submission?.[formElement.name]\n if (unknown === undefined || unknown === null) {\n return null\n }\n\n switch (formElement.type) {\n case 'repeatableSet': {\n return (\n <RepeatableSetCell\n formElement={formElement}\n value={unknown as Record<string, unknown>[]}\n />\n )\n }\n\n case 'location': {\n const value = unknown as {\n latitude: number\n longitude: number\n }\n if (!value.latitude || !value.longitude) {\n break\n }\n\n const latLong = `${value.latitude},${value.longitude}`\n return (\n <>\n <div>\n <Typography variant=\"inherit\" component=\"p\">\n <Link\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={`https://maps.google.com/?q=${latLong}`}\n >\n View in Google Maps\n </Link>\n </Typography>\n <Typography variant=\"inherit\" component=\"p\" color=\"textSecondary\">\n Latitude: {value.latitude}\n </Typography>\n <Typography variant=\"inherit\" component=\"p\" color=\"textSecondary\">\n Longitude: {value.longitude}\n </Typography>\n </div>\n <TableCellCopyButton isHidden={!allowCopy} text={latLong} />\n </>\n )\n }\n\n case 'camera':\n case 'draw': {\n return (\n <FileChip\n file={unknown as React.ComponentProps<typeof FileChip>['file']}\n />\n )\n }\n\n case 'textarea': {\n const value = unknown as string\n return (\n <>\n <span\n style={{\n whiteSpace: 'pre-line',\n }}\n >\n {value}\n </span>\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n }\n\n case 'date': {\n const value = unknown as string\n const text = format(new Date(value), shortDateFormat)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n\n case 'time': {\n const value = unknown as string\n const text = format(new Date(value), timeFormat)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n\n case 'datetime': {\n const value = unknown as string\n const text = format(new Date(value), shortDateTimeFormat)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n\n case 'number': {\n const value = unknown as number\n const text = localisationService.formatNumber(value)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n\n case 'radio':\n case 'autocomplete':\n case 'checkboxes':\n case 'select': {\n if (\n formElement.type === 'checkboxes' ||\n (formElement.type === 'select' && formElement.multi)\n ) {\n const value = unknown as string\n if (!Array.isArray(value) || !value.length) {\n break\n }\n const text = value\n .map((selection) => getSelectedOptionLabel(formElement, selection))\n .join(', ')\n return (\n <>\n <MultiSelectFormElementTableCellContent\n value={value}\n formElement={formElement}\n />\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n } else {\n const value = unknown as string\n const text = getSelectedOptionLabel(formElement, value)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n }\n\n case 'email': {\n const value = unknown as string\n return (\n <>\n <Link\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={`mailto:${value}`}\n >\n {value}\n </Link>\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n }\n case 'telephone': {\n const value = unknown as string\n return (\n <>\n <Link target=\"_blank\" rel=\"noopener noreferrer\" href={`tel:${value}`}>\n {value}\n </Link>\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n }\n case 'text':\n case 'bsb':\n case 'barcodeScanner': {\n const value = unknown as string\n return (\n <>\n {value}\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n }\n\n case 'files': {\n const value = unknown as React.ComponentProps<\n typeof FilesElementDataTableCellContent\n >['value']\n if (!Array.isArray(value) || !value.length) {\n break\n }\n return <FilesElementDataTableCellContent value={value} />\n }\n\n case 'calculation': {\n const value = unknown as number\n if (formElement.displayAsCurrency) {\n const text = localisationService.formatCurrency(value)\n return (\n <>\n {text}\n <TableCellCopyButton\n isHidden={!allowCopy}\n text={value.toString()}\n />\n </>\n )\n } else {\n const text = localisationService.formatNumber(value)\n return (\n <>\n {text}\n <TableCellCopyButton\n isHidden={!allowCopy}\n text={value.toString()}\n />\n </>\n )\n }\n }\n\n case 'civicaStreetName': {\n const value = unknown as {\n formattedStreet: string\n }\n return (\n <>\n {value.formattedStreet}\n <TableCellCopyButton\n isHidden={!allowCopy}\n text={value.formattedStreet}\n />\n </>\n )\n }\n\n case 'civicaNameRecord': {\n const value = unknown as {\n title?: string\n givenName1?: string\n familyName?: string\n emailAddress: string\n }\n const text =\n [value?.title, value?.givenName1, value?.familyName]\n .filter((t) => t)\n .join(' ') || value?.emailAddress\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n\n case 'geoscapeAddress': {\n const value = unknown as GeoscapeAddress\n const fullAddress = value?.addressDetails?.formattedAddress || (\n <>\n Geoscape Address ID: <i>{value.addressId}</i>\n </>\n )\n return (\n <>\n {fullAddress}\n <TableCellCopyButton\n isHidden={!allowCopy}\n text={fullAddress as string}\n />\n </>\n )\n }\n\n case 'pointAddress': {\n const value = unknown as PointAddress\n const fullAddress = value?.addressDetails?.formattedAddress || (\n <>\n NSW Point Address ID: <i>{value.addressId}</i>\n </>\n )\n return (\n <>\n {fullAddress}\n <TableCellCopyButton\n isHidden={!allowCopy}\n text={fullAddress as string}\n />\n </>\n )\n }\n\n case 'boolean': {\n const value = unknown as boolean\n const text = value ? 'Yes' : 'No'\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n\n case 'abn': {\n const value = unknown as ABNRecord\n const abnNumber = abnService.displayABNNumberFromABNRecord(value)\n return (\n <>\n <Link\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={`https://www.abr.business.gov.au/ABN/View/${abnNumber}`}\n >\n {abnNumber} |{' '}\n <i>{abnService.displayBusinessNameFromABNRecord(value)}</i>\n </Link>\n <TableCellCopyButton isHidden={!allowCopy} text={abnNumber} />\n </>\n )\n }\n\n case 'html':\n case 'form':\n case 'infoPage':\n case 'captcha':\n case 'image':\n case 'heading':\n case 'summary': {\n break\n }\n\n default: {\n console.warn(\n 'Unsupported element type in Submission Data rendering',\n formElement,\n )\n }\n }\n\n return null\n}\n\nexport default React.memo(FormElementTableCell)\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { HeaderGroup } from 'react-table';
|
3
|
+
import { FormStoreRecord } from '@oneblink/types/typescript/submissions';
|
4
|
+
declare function HeaderCellMoreButton({ headerGroup, onHide, }: {
|
5
|
+
headerGroup: HeaderGroup<FormStoreRecord>;
|
6
|
+
onHide: () => void;
|
7
|
+
}): JSX.Element;
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof HeaderCellMoreButton>;
|
9
|
+
export default _default;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Box, Button, Divider, Grid, IconButton, Popover, } from '@mui/material';
|
3
|
+
import { styled } from '@mui/material/styles';
|
4
|
+
import { FilterList as FilterListIcon, MoreVert as MoreVertIcon, VisibilityOff as VisibilityOffIcon, } from '@mui/icons-material';
|
5
|
+
import { useIsHovering } from '../../../hooks/useIsHovering';
|
6
|
+
import useNullableState from '../../../hooks/useNullableState';
|
7
|
+
import ColumnFilters from './ColumnFilters';
|
8
|
+
const StyledIconButton = styled(IconButton)(({ theme }) => ({
|
9
|
+
margin: theme.spacing(-1, -1, -1, 1),
|
10
|
+
}));
|
11
|
+
const paperStyles = {
|
12
|
+
maxWidth: 500,
|
13
|
+
};
|
14
|
+
function HeaderCellMoreButton({ headerGroup, onHide, }) {
|
15
|
+
const isHovering = useIsHovering();
|
16
|
+
const [anchorEl, setAnchorEl, clearAnchorEl] = useNullableState(null);
|
17
|
+
return (React.createElement("span", null,
|
18
|
+
React.createElement(StyledIconButton, { color: "inherit", onClick: (event) => {
|
19
|
+
event.stopPropagation();
|
20
|
+
setAnchorEl(event.currentTarget);
|
21
|
+
} },
|
22
|
+
React.createElement(MoreVertIcon, { fontSize: "small", color: isHovering ? 'action' : 'disabled' })),
|
23
|
+
React.createElement(Popover, { open: !!anchorEl, anchorEl: anchorEl, onClose: (event) => {
|
24
|
+
event.stopPropagation();
|
25
|
+
clearAnchorEl();
|
26
|
+
}, anchorOrigin: {
|
27
|
+
vertical: 'bottom',
|
28
|
+
horizontal: 'right',
|
29
|
+
}, transformOrigin: {
|
30
|
+
vertical: 'top',
|
31
|
+
horizontal: 'right',
|
32
|
+
}, PaperProps: {
|
33
|
+
sx: paperStyles,
|
34
|
+
}, onClick: (event) => {
|
35
|
+
event.stopPropagation();
|
36
|
+
} },
|
37
|
+
headerGroup.filter && (React.createElement(React.Fragment, null,
|
38
|
+
React.createElement(Box, { padding: 2 },
|
39
|
+
React.createElement(ColumnFilters, { filter: headerGroup.filter })),
|
40
|
+
React.createElement(Divider, null))),
|
41
|
+
React.createElement(Box, { paddingX: 2, paddingY: 1 },
|
42
|
+
React.createElement(Grid, { container: true, justifyContent: "flex-end", spacing: 1 },
|
43
|
+
headerGroup.filter && (React.createElement(Grid, { item: true },
|
44
|
+
React.createElement(Button, { variant: "outlined", disabled: headerGroup.filter.value === undefined, onClick: () => { var _a; return (_a = headerGroup.filter) === null || _a === void 0 ? void 0 : _a.onChange(undefined, false); }, size: "small", startIcon: React.createElement(FilterListIcon, null) }, "Clear"))),
|
45
|
+
React.createElement(Grid, { item: true },
|
46
|
+
React.createElement(Button, { variant: "outlined", onClick: onHide, size: "small", startIcon: React.createElement(VisibilityOffIcon, null) }, "Hide")))))));
|
47
|
+
}
|
48
|
+
export default React.memo(HeaderCellMoreButton);
|
49
|
+
//# sourceMappingURL=HeaderCellMoreButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HeaderCellMoreButton.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/HeaderCellMoreButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,OAAO,GAER,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,QAAQ,IAAI,YAAY,EACxB,aAAa,IAAI,iBAAiB,GACnC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,gBAAgB,MAAM,iCAAiC,CAAA;AAC9D,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAG3C,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EA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,WAAW,CAAC,MAAM,IAAI,CACrB;gBACE,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC;oBACb,oBAAC,aAAa,IAAC,MAAM,EAAE,WAAW,CAAC,MAAM,GAAI,CACzC;gBACN,oBAAC,OAAO,OAAG,CACV,CACJ;YACD,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;gBAC3B,oBAAC,IAAI,IAAC,SAAS,QAAC,cAAc,EAAC,UAAU,EAAC,OAAO,EAAE,CAAC;oBACjD,WAAW,CAAC,MAAM,IAAI,CACrB,oBAAC,IAAI,IAAC,IAAI;wBACR,oBAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,EAChD,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,WAAW,CAAC,MAAM,0CAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA,EAAA,EAC7D,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,oBAAC,cAAc,OAAG,YAGtB,CACJ,CACR;oBACD,oBAAC,IAAI,IAAC,IAAI;wBACR,oBAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,OAAO,EAAE,MAAM,EACf,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,oBAAC,iBAAiB,OAAG,WAGzB,CACJ,CACF,CACH,CACE,CACL,CACR,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { HeaderGroup } from 'react-table'\nimport {\n Box,\n Button,\n Divider,\n Grid,\n IconButton,\n Popover,\n SxProps,\n} from '@mui/material'\nimport { styled } from '@mui/material/styles'\nimport {\n FilterList as FilterListIcon,\n MoreVert as MoreVertIcon,\n VisibilityOff as VisibilityOffIcon,\n} from '@mui/icons-material'\nimport { useIsHovering } from '../../../hooks/useIsHovering'\nimport useNullableState from '../../../hooks/useNullableState'\nimport ColumnFilters from './ColumnFilters'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\n\nconst StyledIconButton = styled(IconButton)(({ theme }) => ({\n margin: theme.spacing(-1, -1, -1, 1),\n}))\n\nconst paperStyles: SxProps = {\n maxWidth: 500,\n}\n\nfunction HeaderCellMoreButton({\n headerGroup,\n onHide,\n}: {\n headerGroup: HeaderGroup<FormStoreRecord>\n onHide: () => void\n}) {\n const isHovering = useIsHovering()\n const [anchorEl, setAnchorEl, clearAnchorEl] =\n useNullableState<HTMLButtonElement>(null)\n\n return (\n <span>\n <StyledIconButton\n color=\"inherit\"\n onClick={(event) => {\n event.stopPropagation()\n setAnchorEl(event.currentTarget)\n }}\n >\n <MoreVertIcon\n fontSize=\"small\"\n color={isHovering ? 'action' : 'disabled'}\n />\n </StyledIconButton>\n <Popover\n open={!!anchorEl}\n anchorEl={anchorEl}\n onClose={(event: React.MouseEvent) => {\n event.stopPropagation()\n clearAnchorEl()\n }}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n PaperProps={{\n sx: paperStyles,\n }}\n onClick={(event) => {\n event.stopPropagation()\n }}\n >\n {headerGroup.filter && (\n <>\n <Box padding={2}>\n <ColumnFilters filter={headerGroup.filter} />\n </Box>\n <Divider />\n </>\n )}\n <Box paddingX={2} paddingY={1}>\n <Grid container justifyContent=\"flex-end\" spacing={1}>\n {headerGroup.filter && (\n <Grid item>\n <Button\n variant=\"outlined\"\n disabled={headerGroup.filter.value === undefined}\n onClick={() => headerGroup.filter?.onChange(undefined, false)}\n size=\"small\"\n startIcon={<FilterListIcon />}\n >\n Clear\n </Button>\n </Grid>\n )}\n <Grid item>\n <Button\n variant=\"outlined\"\n onClick={onHide}\n size=\"small\"\n startIcon={<VisibilityOffIcon />}\n >\n Hide\n </Button>\n </Grid>\n </Grid>\n </Box>\n </Popover>\n </span>\n )\n}\n\nexport default React.memo(HeaderCellMoreButton)\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes } from '@oneblink/types';
|
3
|
+
declare type Props = {
|
4
|
+
value: Array<Record<string, unknown>>;
|
5
|
+
formElement: FormTypes.RepeatableSetElement;
|
6
|
+
};
|
7
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
8
|
+
export default _default;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Typography, Divider as MuiDivider, styled } from '@mui/material';
|
3
|
+
import useBooleanState from '../../../hooks/useBooleanState';
|
4
|
+
import generateColumns from './generateColumns';
|
5
|
+
import { useTable } from 'react-table';
|
6
|
+
import RepeatableSetCellAccordion from './RepeatableSetCellAccordion';
|
7
|
+
const Wrapper = styled('div')({
|
8
|
+
width: '100%',
|
9
|
+
});
|
10
|
+
const CellRow = styled('div')(({ theme }) => ({
|
11
|
+
display: 'flex',
|
12
|
+
alignItems: 'center',
|
13
|
+
justifyContent: 'space-between',
|
14
|
+
paddingBottom: theme.spacing(),
|
15
|
+
width: '100%',
|
16
|
+
}));
|
17
|
+
const CellValue = styled('span')(({ theme }) => ({
|
18
|
+
flex: 2,
|
19
|
+
marginLeft: theme.spacing(),
|
20
|
+
textAlign: 'right',
|
21
|
+
width: '100%',
|
22
|
+
}));
|
23
|
+
const Divider = styled(MuiDivider)(({ theme }) => ({
|
24
|
+
margin: theme.spacing(1, -2),
|
25
|
+
}));
|
26
|
+
const RepeatableSetCell = ({ formElement, value }) => {
|
27
|
+
const [isVisible, , , toggleVisibility] = useBooleanState(false);
|
28
|
+
const hasMultipleEntries = value.length > 1;
|
29
|
+
const columns = React.useMemo(() => generateColumns({
|
30
|
+
onChangeFilters: () => { },
|
31
|
+
formElements: formElement.elements,
|
32
|
+
parentElementNames: [],
|
33
|
+
initialColumns: [],
|
34
|
+
allowCopy: false,
|
35
|
+
filters: {},
|
36
|
+
}), [formElement.elements]);
|
37
|
+
const { rows, prepareRow } = useTable({
|
38
|
+
columns,
|
39
|
+
data: value.map((entry) => ({ submission: entry })),
|
40
|
+
});
|
41
|
+
return (React.createElement(RepeatableSetCellAccordion, { title: `${value.length} Entr${hasMultipleEntries ? 'ies' : 'y'}`, isOpen: isVisible, onChange: toggleVisibility },
|
42
|
+
React.createElement(Wrapper, null, rows.map((row, i) => {
|
43
|
+
const isLast = i === rows.length - 1;
|
44
|
+
prepareRow(row);
|
45
|
+
return (React.createElement(React.Fragment, { key: row.id },
|
46
|
+
row.cells.map((cell) => {
|
47
|
+
const cellValue = cell.render('Cell');
|
48
|
+
if (!cellValue)
|
49
|
+
return null;
|
50
|
+
return (React.createElement(CellRow, { key: cell.column.id },
|
51
|
+
React.createElement("span", null,
|
52
|
+
React.createElement(Typography, { color: "textSecondary", variant: "body2" },
|
53
|
+
cell.column.headerText,
|
54
|
+
":")),
|
55
|
+
React.createElement(CellValue, null, cellValue)));
|
56
|
+
}),
|
57
|
+
!isLast && React.createElement(Divider, null)));
|
58
|
+
}))));
|
59
|
+
};
|
60
|
+
export default React.memo(RepeatableSetCell);
|
61
|
+
//# sourceMappingURL=RepeatableSetCell.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RepeatableSetCell.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/RepeatableSetCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEzE,OAAO,eAAe,MAAM,gCAAgC,CAAA;AAC5D,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,0BAA0B,MAAM,8BAA8B,CAAA;AAErE,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM;C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AAG,CACR,CAClB,CAAA;QACH,CAAC,CAAC,CACM,CACiB,CAC9B,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,iBAAiB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Typography, Divider as MuiDivider, styled } from '@mui/material'\nimport { FormTypes } from '@oneblink/types'\nimport useBooleanState from '../../../hooks/useBooleanState'\nimport generateColumns from './generateColumns'\nimport { useTable } from 'react-table'\nimport RepeatableSetCellAccordion from './RepeatableSetCellAccordion'\n\nconst Wrapper = styled('div')({\n width: '100%',\n})\nconst CellRow = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingBottom: theme.spacing(),\n width: '100%',\n}))\n\nconst CellValue = styled('span')(({ theme }) => ({\n flex: 2,\n marginLeft: theme.spacing(),\n textAlign: 'right',\n width: '100%',\n}))\n\nconst Divider = styled(MuiDivider)(({ theme }) => ({\n margin: theme.spacing(1, -2),\n}))\n\ntype Props = {\n value: Array<Record<string, unknown>>\n formElement: FormTypes.RepeatableSetElement\n}\n\nconst RepeatableSetCell = ({ formElement, value }: Props) => {\n const [isVisible, , , toggleVisibility] = useBooleanState(false)\n const hasMultipleEntries = value.length > 1\n const columns = React.useMemo(\n () =>\n generateColumns({\n onChangeFilters: () => {},\n formElements: formElement.elements,\n parentElementNames: [],\n initialColumns: [],\n allowCopy: false,\n filters: {},\n }),\n [formElement.elements],\n )\n const { rows, prepareRow } = useTable({\n columns,\n data: value.map((entry) => ({ submission: entry })),\n })\n\n return (\n <RepeatableSetCellAccordion\n title={`${value.length} Entr${hasMultipleEntries ? 'ies' : 'y'}`}\n isOpen={isVisible}\n onChange={toggleVisibility}\n >\n <Wrapper>\n {rows.map((row, i) => {\n const isLast = i === rows.length - 1\n prepareRow(row)\n return (\n <React.Fragment key={row.id}>\n {row.cells.map((cell) => {\n const cellValue = cell.render('Cell')\n if (!cellValue) return null\n return (\n <CellRow key={cell.column.id}>\n <span>\n <Typography color=\"textSecondary\" variant=\"body2\">\n {cell.column.headerText}:\n </Typography>\n </span>\n <CellValue>{cellValue}</CellValue>\n </CellRow>\n )\n })}\n {!isLast && <Divider />}\n </React.Fragment>\n )\n })}\n </Wrapper>\n </RepeatableSetCellAccordion>\n )\n}\n\nexport default React.memo<Props>(RepeatableSetCell)\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { CustomAccordion, CustomAccordionSummary, CustomAccordionDetails, } from '../../CustomAccordion';
|
3
|
+
import { Typography } from '@mui/material';
|
4
|
+
import { ExpandMore } from '@mui/icons-material';
|
5
|
+
const RepeatableSetCell = ({ isOpen, onChange, title, children }) => {
|
6
|
+
return (React.createElement(CustomAccordion, { expanded: isOpen, onChange: onChange, "data-cypress": "form-store-repeatable-set-cell-accordion" },
|
7
|
+
React.createElement(CustomAccordionSummary, { expandIcon: React.createElement(ExpandMore, null), "data-cypress": "form-store-repeatable-set-cell-accordion-summary" },
|
8
|
+
React.createElement(Typography, null, title)),
|
9
|
+
React.createElement(CustomAccordionDetails, null, children)));
|
10
|
+
};
|
11
|
+
export default React.memo(RepeatableSetCell);
|
12
|
+
//# sourceMappingURL=RepeatableSetCellAccordion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RepeatableSetCellAccordion.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/RepeatableSetCellAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAShD,MAAM,iBAAiB,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAS,EAAE,EAAE;IACzE,OAAO,CACL,oBAAC,eAAe,IACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,kBACL,0CAA0C;QAEvD,oBAAC,sBAAsB,IACrB,UAAU,EAAE,oBAAC,UAAU,OAAG,kBACb,kDAAkD;YAE/D,oBAAC,UAAU,QAAE,KAAK,CAAc,CACT;QACzB,oBAAC,sBAAsB,QAAE,QAAQ,CAA0B,CAC3C,CACnB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,iBAAiB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport {\n CustomAccordion,\n CustomAccordionSummary,\n CustomAccordionDetails,\n} from '../../CustomAccordion'\nimport { Typography } from '@mui/material'\nimport { ExpandMore } from '@mui/icons-material'\n\ntype Props = {\n isOpen: boolean\n onChange: () => void\n title: string\n children: React.ReactNode\n}\n\nconst RepeatableSetCell = ({ isOpen, onChange, title, children }: Props) => {\n return (\n <CustomAccordion\n expanded={isOpen}\n onChange={onChange}\n data-cypress=\"form-store-repeatable-set-cell-accordion\"\n >\n <CustomAccordionSummary\n expandIcon={<ExpandMore />}\n data-cypress=\"form-store-repeatable-set-cell-accordion-summary\"\n >\n <Typography>{title}</Typography>\n </CustomAccordionSummary>\n <CustomAccordionDetails>{children}</CustomAccordionDetails>\n </CustomAccordion>\n )\n}\n\nexport default React.memo<Props>(RepeatableSetCell)\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Zoom } from '@mui/material';
|
3
|
+
import CopyToClipboardIconButton from '../../CopyToClipboardIconButton';
|
4
|
+
import { useIsHovering } from '../../../hooks/useIsHovering';
|
5
|
+
import { styled } from '@mui/material/styles';
|
6
|
+
function TableCellCopyButton({ text, isHidden, }) {
|
7
|
+
const isHovering = useIsHovering();
|
8
|
+
if (isHidden) {
|
9
|
+
return null;
|
10
|
+
}
|
11
|
+
return (React.createElement(Zoom, { in: isHovering },
|
12
|
+
React.createElement(StyledSpan, null,
|
13
|
+
React.createElement(StyledCopyToClipbaordButton, { text: text }))));
|
14
|
+
}
|
15
|
+
const StyledSpan = styled('span')(() => ({
|
16
|
+
position: 'absolute',
|
17
|
+
top: 0,
|
18
|
+
right: 0,
|
19
|
+
}));
|
20
|
+
const StyledCopyToClipbaordButton = styled(CopyToClipboardIconButton)(({ theme }) => ({
|
21
|
+
backgroundColor: theme.palette.background.paper,
|
22
|
+
'&:hover': {
|
23
|
+
// Rough equivalent of the color created by transparency `rgba(0,0,0,0.04)` on white
|
24
|
+
backgroundColor: '#f3f3f3',
|
25
|
+
},
|
26
|
+
}));
|
27
|
+
export default React.memo(TableCellCopyButton);
|
28
|
+
//# sourceMappingURL=TableCellCopyButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TableCellCopyButton.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/TableCellCopyButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,yBAAyB,MAAM,iCAAiC,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,SAAS,mBAAmB,CAAC,EAC3B,IAAI,EACJ,QAAQ,GAIT;IACC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,CACL,oBAAC,IAAI,IAAC,EAAE,EAAE,UAAU;QAClB,oBAAC,UAAU;YACT,oBAAC,2BAA2B,IAAC,IAAI,EAAE,IAAI,GAAI,CAChC,CACR,CACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACvC,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;CACT,CAAC,CAAC,CAAA;AAEH,MAAM,2BAA2B,GAAG,MAAM,CAAC,yBAAyB,CAAC,CACnE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACd,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK;IAC/C,SAAS,EAAE;QACT,oFAAoF;QACpF,eAAe,EAAE,SAAS;KAC3B;CACF,CAAC,CACH,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Zoom } from '@mui/material'\nimport CopyToClipboardIconButton from '../../CopyToClipboardIconButton'\nimport { useIsHovering } from '../../../hooks/useIsHovering'\nimport { styled } from '@mui/material/styles'\n\nfunction TableCellCopyButton({\n text,\n isHidden,\n}: {\n text: string\n isHidden?: boolean\n}) {\n const isHovering = useIsHovering()\n if (isHidden) {\n return null\n }\n return (\n <Zoom in={isHovering}>\n <StyledSpan>\n <StyledCopyToClipbaordButton text={text} />\n </StyledSpan>\n </Zoom>\n )\n}\n\nconst StyledSpan = styled('span')(() => ({\n position: 'absolute',\n top: 0,\n right: 0,\n}))\n\nconst StyledCopyToClipbaordButton = styled(CopyToClipboardIconButton)(\n ({ theme }) => ({\n backgroundColor: theme.palette.background.paper,\n '&:hover': {\n // Rough equivalent of the color created by transparency `rgba(0,0,0,0.04)` on white\n backgroundColor: '#f3f3f3',\n },\n }),\n)\n\nexport default React.memo(TableCellCopyButton)\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { FormStoreRecord } from '@oneblink/types/typescript/submissions';
|
2
|
+
import { Column as ColumnWithCell } from 'react-table';
|
3
|
+
import { FormTypes } from '@oneblink/types';
|
4
|
+
import { formStoreService } from '@oneblink/apps';
|
5
|
+
import { OnChangeFilters } from '../../../hooks/useInfiniteScrollDataLoad';
|
6
|
+
declare const generateColumns: <T extends {
|
7
|
+
submission: FormStoreRecord['submission'];
|
8
|
+
}>({ formElements, onChangeFilters, filters, parentElementNames, initialColumns, allowCopy, }: {
|
9
|
+
formElements: (FormTypes.FormElement & {
|
10
|
+
tooltip?: string;
|
11
|
+
})[];
|
12
|
+
onChangeFilters: OnChangeFilters<formStoreService.FormStoreFilters>;
|
13
|
+
filters: formStoreService.FormStoreFilters;
|
14
|
+
parentElementNames: string[];
|
15
|
+
initialColumns: ColumnWithCell<T>[];
|
16
|
+
allowCopy: boolean;
|
17
|
+
}) => ColumnWithCell<T>[];
|
18
|
+
export default generateColumns;
|