@oneblink/apps-react 0.6.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/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 +10 -3
- 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,44 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { userService } from '@oneblink/sdk-core';
|
3
|
+
import { Chip, Avatar } from '@mui/material';
|
4
|
+
import { AccountCircle, VpnKey as KeyIcon, Help as HelpIcon, } from '@mui/icons-material';
|
5
|
+
import TableCellCopyButton from './TableCellCopyButton';
|
6
|
+
function ActionedByTableCell({ userProfile, developerKey, ...rest }) {
|
7
|
+
const chipProps = useActionedByChipProps({
|
8
|
+
userProfile,
|
9
|
+
developerKey,
|
10
|
+
...rest,
|
11
|
+
});
|
12
|
+
return (React.createElement(React.Fragment, null,
|
13
|
+
React.createElement(Chip, { ...chipProps, ...rest }),
|
14
|
+
React.createElement(TableCellCopyButton, { text: chipProps.label })));
|
15
|
+
}
|
16
|
+
export default React.memo(ActionedByTableCell);
|
17
|
+
function useActionedByChipProps({ userProfile, developerKey, }) {
|
18
|
+
return React.useMemo(() => {
|
19
|
+
if (userProfile) {
|
20
|
+
const emptyChipProps = {
|
21
|
+
label: '',
|
22
|
+
};
|
23
|
+
if (userProfile.picture) {
|
24
|
+
emptyChipProps.avatar = (React.createElement(Avatar, { alt: userProfile.fullName, src: userProfile.picture }));
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
emptyChipProps.icon = React.createElement(AccountCircle, null);
|
28
|
+
}
|
29
|
+
emptyChipProps.label = userService.getUserFriendlyName(userProfile);
|
30
|
+
return emptyChipProps;
|
31
|
+
}
|
32
|
+
if (developerKey) {
|
33
|
+
return {
|
34
|
+
icon: React.createElement(KeyIcon, null),
|
35
|
+
label: developerKey.name,
|
36
|
+
};
|
37
|
+
}
|
38
|
+
return {
|
39
|
+
icon: React.createElement(HelpIcon, null),
|
40
|
+
label: 'Anonymous',
|
41
|
+
};
|
42
|
+
}, [developerKey, userProfile]);
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=ActionedByTableCell.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ActionedByTableCell.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/ActionedByTableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EACL,aAAa,EACb,MAAM,IAAI,OAAO,EACjB,IAAI,IAAI,QAAQ,GACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAEvD,SAAS,mBAAmB,CAAC,EAC3B,WAAW,EACX,YAAY,EACZ,GAAG,IAAI,EAIR;IACC,MAAM,SAAS,GAAG,sBAAsB,CAAC;QACvC,WAAW;QACX,YAAY;QACZ,GAAG,IAAI;KACR,CAAC,CAAA;IAEF,OAAO,CACL;QACE,oBAAC,IAAI,OAAK,SAAS,KAAM,IAAI,GAAI;QACjC,oBAAC,mBAAmB,IAAC,IAAI,EAAE,SAAS,CAAC,KAAK,GAAI,CAC7C,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAE9C,SAAS,sBAAsB,CAAC,EAC9B,WAAW,EACX,YAAY,GAIb;IAKC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,WAAW,EAAE;YACf,MAAM,cAAc,GAIhB;gBACF,KAAK,EAAE,EAAE;aACV,CAAA;YAED,IAAI,WAAW,CAAC,OAAO,EAAE;gBACvB,cAAc,CAAC,MAAM,GAAG,CACtB,oBAAC,MAAM,IAAC,GAAG,EAAE,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,OAAO,GAAI,CAChE,CAAA;aACF;iBAAM;gBACL,cAAc,CAAC,IAAI,GAAG,oBAAC,aAAa,OAAG,CAAA;aACxC;YAED,cAAc,CAAC,KAAK,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;YACnE,OAAO,cAAc,CAAA;SACtB;QAED,IAAI,YAAY,EAAE;YAChB,OAAO;gBACL,IAAI,EAAE,oBAAC,OAAO,OAAG;gBACjB,KAAK,EAAE,YAAY,CAAC,IAAI;aACzB,CAAA;SACF;QAED,OAAO;YACL,IAAI,EAAE,oBAAC,QAAQ,OAAG;YAClB,KAAK,EAAE,WAAW;SACnB,CAAA;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import * as React from 'react'\nimport { userService } from '@oneblink/sdk-core'\nimport { UserProfile } from '@oneblink/types/typescript/misc'\nimport { Chip, Avatar } from '@mui/material'\nimport {\n AccountCircle,\n VpnKey as KeyIcon,\n Help as HelpIcon,\n} from '@mui/icons-material'\nimport TableCellCopyButton from './TableCellCopyButton'\n\nfunction ActionedByTableCell({\n userProfile,\n developerKey,\n ...rest\n}: React.ComponentProps<typeof Chip> & {\n userProfile?: UserProfile\n developerKey?: { name: string }\n}) {\n const chipProps = useActionedByChipProps({\n userProfile,\n developerKey,\n ...rest,\n })\n\n return (\n <>\n <Chip {...chipProps} {...rest} />\n <TableCellCopyButton text={chipProps.label} />\n </>\n )\n}\n\nexport default React.memo(ActionedByTableCell)\n\nfunction useActionedByChipProps({\n userProfile,\n developerKey,\n}: React.ComponentProps<typeof Chip> & {\n userProfile?: UserProfile\n developerKey?: { name: string }\n}): {\n label: string\n icon?: React.ComponentProps<typeof Chip>['icon']\n avatar?: React.ComponentProps<typeof Chip>['avatar']\n} {\n return React.useMemo(() => {\n if (userProfile) {\n const emptyChipProps: {\n label: string\n icon?: React.ComponentProps<typeof Chip>['icon']\n avatar?: React.ComponentProps<typeof Chip>['avatar']\n } = {\n label: '',\n }\n\n if (userProfile.picture) {\n emptyChipProps.avatar = (\n <Avatar alt={userProfile.fullName} src={userProfile.picture} />\n )\n } else {\n emptyChipProps.icon = <AccountCircle />\n }\n\n emptyChipProps.label = userService.getUserFriendlyName(userProfile)\n return emptyChipProps\n }\n\n if (developerKey) {\n return {\n icon: <KeyIcon />,\n label: developerKey.name,\n }\n }\n\n return {\n icon: <HelpIcon />,\n label: 'Anonymous',\n }\n }, [developerKey, userProfile])\n}\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormStoreRecord } from '@oneblink/types/typescript/submissions';
|
3
|
+
import { HeaderGroup } from 'react-table';
|
4
|
+
declare type Props = {
|
5
|
+
filter: NonNullable<HeaderGroup<FormStoreRecord>['filter']>;
|
6
|
+
};
|
7
|
+
declare function ColumnFilters({ filter }: Props): JSX.Element | null;
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof ColumnFilters>;
|
9
|
+
export default _default;
|
@@ -0,0 +1,180 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Checkbox, FormControl, FormControlLabel, Grid, ListItemText, MenuItem, Radio, RadioGroup, TextField, } from '@mui/material';
|
3
|
+
import V4CompatibleDateTimePicker from '../../pickers/V4CompatibleDateTimePicker';
|
4
|
+
import V4CompatibleDatePicker from '../../pickers/V4CompatibleDatePicker';
|
5
|
+
import { styled } from '@mui/material/styles';
|
6
|
+
import { format } from 'date-fns';
|
7
|
+
import { localisationService } from '@oneblink/apps';
|
8
|
+
const StyledTextField = styled(TextField)(() => ({
|
9
|
+
width: '350px',
|
10
|
+
}));
|
11
|
+
const shortDateFormat = localisationService.getDateFnsFormats().shortDate;
|
12
|
+
function ColumnFilters({ filter }) {
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
14
|
+
switch (filter.type) {
|
15
|
+
case 'SUBMISSION_ID': {
|
16
|
+
return (React.createElement(StyledTextField, { autoFocus: true, variant: "outlined", margin: "dense", size: "small", label: "Filter", type: "text", fullWidth: true, value: ((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$eq) || '', onChange: (e) => {
|
17
|
+
filter.onChange(e.target.value
|
18
|
+
? {
|
19
|
+
$eq: e.target.value,
|
20
|
+
}
|
21
|
+
: undefined, true);
|
22
|
+
} }));
|
23
|
+
}
|
24
|
+
case 'TEXT': {
|
25
|
+
return (React.createElement(StyledTextField, { autoFocus: true, variant: "outlined", margin: "dense", size: "small", label: "Filter", type: "text", fullWidth: true, value: ((_b = filter.value) === null || _b === void 0 ? void 0 : _b.$regex) || '', onChange: (e) => {
|
26
|
+
filter.onChange(e.target.value
|
27
|
+
? {
|
28
|
+
$regex: e.target.value,
|
29
|
+
// hard code case in-sensitive and multi-line searching
|
30
|
+
$options: 'im',
|
31
|
+
}
|
32
|
+
: undefined, true);
|
33
|
+
} }));
|
34
|
+
}
|
35
|
+
case 'NUMBER': {
|
36
|
+
return (React.createElement(Grid, { container: true, spacing: 1 },
|
37
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
38
|
+
React.createElement(TextField, { autoFocus: true, variant: "outlined", margin: "dense", size: "small", label: "More Than Or Equal To", type: "number", fullWidth: true, value: ((_d = (_c = filter.value) === null || _c === void 0 ? void 0 : _c.$gte) === null || _d === void 0 ? void 0 : _d.toString()) || '', onChange: (e) => {
|
39
|
+
var _a;
|
40
|
+
const newValue = e.target.value
|
41
|
+
? parseInt(e.target.value)
|
42
|
+
: undefined;
|
43
|
+
filter.onChange(typeof ((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$lte) === 'number' ||
|
44
|
+
newValue !== undefined
|
45
|
+
? {
|
46
|
+
...filter.value,
|
47
|
+
$gte: newValue,
|
48
|
+
}
|
49
|
+
: undefined, true);
|
50
|
+
} })),
|
51
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
52
|
+
React.createElement(TextField, { variant: "outlined", margin: "dense", size: "small", label: "Less Than Or Equal To", type: "number", fullWidth: true, value: ((_f = (_e = filter.value) === null || _e === void 0 ? void 0 : _e.$lte) === null || _f === void 0 ? void 0 : _f.toString()) || '', onChange: (e) => {
|
53
|
+
var _a;
|
54
|
+
const newValue = e.target.value
|
55
|
+
? parseInt(e.target.value)
|
56
|
+
: undefined;
|
57
|
+
filter.onChange(typeof ((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$gte) === 'number' ||
|
58
|
+
newValue !== undefined
|
59
|
+
? {
|
60
|
+
...filter.value,
|
61
|
+
$lte: newValue,
|
62
|
+
}
|
63
|
+
: undefined, true);
|
64
|
+
} }))));
|
65
|
+
}
|
66
|
+
case 'DATE': {
|
67
|
+
return (React.createElement(Grid, { container: true, spacing: 1 },
|
68
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
69
|
+
React.createElement(V4CompatibleDatePicker, { label: "After", showTodayButton: true, clearable: true, margin: "dense", size: "small", inputVariant: "outlined", maxDate: (_g = filter.value) === null || _g === void 0 ? void 0 : _g.$lte, maxDateMessage: ((_h = filter.value) === null || _h === void 0 ? void 0 : _h.$lte) &&
|
70
|
+
`Must be before "${format(new Date((_j = filter.value) === null || _j === void 0 ? void 0 : _j.$lte), shortDateFormat)}"`, value: ((_k = filter.value) === null || _k === void 0 ? void 0 : _k.$gte) || null, onChange: (newDate) => {
|
71
|
+
var _a;
|
72
|
+
const newValue = newDate
|
73
|
+
? format(newDate, 'yyyy-MM-dd')
|
74
|
+
: undefined;
|
75
|
+
filter.onChange(((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$lte) || newValue !== undefined
|
76
|
+
? {
|
77
|
+
...filter.value,
|
78
|
+
$gte: newValue,
|
79
|
+
}
|
80
|
+
: undefined, false);
|
81
|
+
}, endIconButton: true, iconButtonEdge: "end" })),
|
82
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
83
|
+
React.createElement(V4CompatibleDatePicker, { label: "Before", showTodayButton: true, clearable: true, margin: "dense", size: "small", inputVariant: "outlined", minDate: (_l = filter.value) === null || _l === void 0 ? void 0 : _l.$gte, minDateMessage: ((_m = filter.value) === null || _m === void 0 ? void 0 : _m.$lte) &&
|
84
|
+
`Must be after "${format(new Date((_o = filter.value) === null || _o === void 0 ? void 0 : _o.$lte), shortDateFormat)}"`, value: ((_p = filter.value) === null || _p === void 0 ? void 0 : _p.$lte) || null, onChange: (newDate) => {
|
85
|
+
var _a;
|
86
|
+
const newValue = newDate
|
87
|
+
? format(newDate, 'yyyy-MM-dd')
|
88
|
+
: undefined;
|
89
|
+
filter.onChange(((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$gte) || newValue !== undefined
|
90
|
+
? {
|
91
|
+
...filter.value,
|
92
|
+
$lte: newValue,
|
93
|
+
}
|
94
|
+
: undefined, false);
|
95
|
+
}, endIconButton: true, iconButtonEdge: "end" }))));
|
96
|
+
}
|
97
|
+
case 'DATETIME': {
|
98
|
+
return (React.createElement(Grid, { container: true, spacing: 1 },
|
99
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
100
|
+
React.createElement(V4CompatibleDateTimePicker, { label: "After", showTodayButton: true, clearable: true, margin: "dense", size: "small", inputVariant: "outlined", maxDate: (_q = filter.value) === null || _q === void 0 ? void 0 : _q.$lte, maxDateMessage: ((_r = filter.value) === null || _r === void 0 ? void 0 : _r.$lte) &&
|
101
|
+
`Must be before "${format(new Date((_s = filter.value) === null || _s === void 0 ? void 0 : _s.$lte), shortDateFormat)}"`, value: ((_t = filter.value) === null || _t === void 0 ? void 0 : _t.$gte) || null, onChange: (momentDate) => {
|
102
|
+
var _a;
|
103
|
+
const newValue = momentDate === null || momentDate === void 0 ? void 0 : momentDate.toISOString();
|
104
|
+
filter.onChange(((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$lte) || newValue !== undefined
|
105
|
+
? {
|
106
|
+
...filter.value,
|
107
|
+
$gte: newValue,
|
108
|
+
}
|
109
|
+
: undefined, false);
|
110
|
+
}, endIconButton: true, iconButtonEdge: "end" })),
|
111
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
112
|
+
React.createElement(V4CompatibleDateTimePicker, { label: "Before", showTodayButton: true, clearable: true, margin: "dense", size: "small", inputVariant: "outlined", minDate: (_u = filter.value) === null || _u === void 0 ? void 0 : _u.$gte, minDateMessage: ((_v = filter.value) === null || _v === void 0 ? void 0 : _v.$lte) &&
|
113
|
+
`Must be after "${format(new Date((_w = filter.value) === null || _w === void 0 ? void 0 : _w.$lte), shortDateFormat)}"`, value: ((_x = filter.value) === null || _x === void 0 ? void 0 : _x.$lte) || null, onChange: (momentDate) => {
|
114
|
+
var _a;
|
115
|
+
const newValue = momentDate === null || momentDate === void 0 ? void 0 : momentDate.toISOString();
|
116
|
+
filter.onChange(((_a = filter.value) === null || _a === void 0 ? void 0 : _a.$gte) || newValue !== undefined
|
117
|
+
? {
|
118
|
+
...filter.value,
|
119
|
+
$lte: newValue,
|
120
|
+
}
|
121
|
+
: undefined, false);
|
122
|
+
}, endIconButton: true, iconButtonEdge: "end" }))));
|
123
|
+
}
|
124
|
+
case 'BOOLEAN': {
|
125
|
+
return (React.createElement(FormControl, { component: "fieldset" },
|
126
|
+
React.createElement(RadioGroup, { "aria-label": "gender", name: "gender1", value: ((_z = (_y = filter.value) === null || _y === void 0 ? void 0 : _y.$eq) === null || _z === void 0 ? void 0 : _z.toString()) || 'null', onChange: (e) => {
|
127
|
+
filter.onChange({
|
128
|
+
$eq: e.target.value === 'true',
|
129
|
+
}, false);
|
130
|
+
} },
|
131
|
+
React.createElement(FormControlLabel, { value: "true", control: React.createElement(Radio, null), label: "Yes" }),
|
132
|
+
React.createElement(FormControlLabel, { value: "false", control: React.createElement(Radio, null), label: "No" }))));
|
133
|
+
}
|
134
|
+
case 'OPTIONS_SINGLE': {
|
135
|
+
return (React.createElement(OptionsTextField, { options: filter.options, value: (_0 = filter.value) === null || _0 === void 0 ? void 0 : _0.$in, onChange: (newValue) => {
|
136
|
+
filter.onChange(newValue.length
|
137
|
+
? {
|
138
|
+
$in: newValue,
|
139
|
+
}
|
140
|
+
: undefined, false);
|
141
|
+
} }));
|
142
|
+
}
|
143
|
+
case 'OPTIONS_MULTIPLE': {
|
144
|
+
return (React.createElement(OptionsTextField, { options: filter.options, value: (_2 = (_1 = filter.value) === null || _1 === void 0 ? void 0 : _1.$elemMatch) === null || _2 === void 0 ? void 0 : _2.$in, onChange: (newValue) => {
|
145
|
+
filter.onChange(newValue.length
|
146
|
+
? {
|
147
|
+
$elemMatch: {
|
148
|
+
$in: newValue,
|
149
|
+
},
|
150
|
+
}
|
151
|
+
: undefined, false);
|
152
|
+
} }));
|
153
|
+
}
|
154
|
+
default: {
|
155
|
+
return null;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
export default React.memo(ColumnFilters);
|
160
|
+
function OptionsTextField({ options, value, onChange, }) {
|
161
|
+
return (React.createElement(StyledTextField, { variant: "outlined", margin: "dense", size: "small", label: "Filter", select: true, SelectProps: {
|
162
|
+
multiple: true,
|
163
|
+
renderValue: (selectedIds) => {
|
164
|
+
return options
|
165
|
+
.reduce((selectedLabels, option) => {
|
166
|
+
if (selectedIds.includes(option.value)) {
|
167
|
+
selectedLabels.push(option.label);
|
168
|
+
}
|
169
|
+
return selectedLabels;
|
170
|
+
}, [])
|
171
|
+
.join(', ');
|
172
|
+
},
|
173
|
+
}, fullWidth: true, value: value || [], onChange: (e) => {
|
174
|
+
const newValue = e.target.value;
|
175
|
+
onChange(newValue);
|
176
|
+
} }, options.map((option) => (React.createElement(MenuItem, { value: option.value, key: option.value },
|
177
|
+
React.createElement(Checkbox, { checked: !!(value === null || value === void 0 ? void 0 : value.some((v) => v === option.value)) }),
|
178
|
+
React.createElement(ListItemText, null, option.label))))));
|
179
|
+
}
|
180
|
+
//# sourceMappingURL=ColumnFilters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ColumnFilters.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/ColumnFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EACL,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,UAAU,EACV,SAAS,GACV,MAAM,eAAe,CAAA;AACtB,OAAO,0BAA0B,MAAM,0CAA0C,CAAA;AACjF,OAAO,sBAAsB,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,KAAK,EAAE,OAAO;CACf,CAAC,CAAC,CAAA;AAMH,MAAM,eAAe,GAAG,mBAAmB,CAAC,iBAAiB,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AAM,QACN,WAAW,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;gBAC3B,OAAO,OAAO;qBACX,MAAM,CAAW,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE;oBAC3C,IAAK,WAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;wBACpD,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;qBAClC;oBACD,OAAO,cAAc,CAAA;gBACvB,CAAC,EAAE,EAAE,CAAC;qBACL,IAAI,CAAC,IAAI,CAAC,CAAA;YACf,CAAC;SACF,EACD,SAAS,QACT,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,KAA4B,CAAA;YACtD,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACpB,CAAC,IAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,oBAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK;QAC9C,oBAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,CAAA,GAAI;QAC/D,oBAAC,YAAY,QAAE,MAAM,CAAC,KAAK,CAAgB,CAClC,CACZ,CAAC,CACc,CACnB,CAAA;AACH,CAAC","sourcesContent":["import * as React from 'react'\nimport { FormTypes } from '@oneblink/types'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\nimport { HeaderGroup } from 'react-table'\nimport {\n Checkbox,\n FormControl,\n FormControlLabel,\n Grid,\n ListItemText,\n MenuItem,\n Radio,\n RadioGroup,\n TextField,\n} from '@mui/material'\nimport V4CompatibleDateTimePicker from '../../pickers/V4CompatibleDateTimePicker'\nimport V4CompatibleDatePicker from '../../pickers/V4CompatibleDatePicker'\nimport { styled } from '@mui/material/styles'\nimport { format } from 'date-fns'\nimport { localisationService } from '@oneblink/apps'\n\nconst StyledTextField = styled(TextField)(() => ({\n width: '350px',\n}))\n\ntype Props = {\n filter: NonNullable<HeaderGroup<FormStoreRecord>['filter']>\n}\n\nconst shortDateFormat = localisationService.getDateFnsFormats().shortDate\n\nfunction ColumnFilters({ filter }: Props) {\n switch (filter.type) {\n case 'SUBMISSION_ID': {\n return (\n <StyledTextField\n autoFocus\n variant=\"outlined\"\n margin=\"dense\"\n size=\"small\"\n label=\"Filter\"\n type=\"text\"\n fullWidth\n value={filter.value?.$eq || ''}\n onChange={(e) => {\n filter.onChange(\n e.target.value\n ? {\n $eq: e.target.value,\n }\n : undefined,\n true,\n )\n }}\n />\n )\n }\n case 'TEXT': {\n return (\n <StyledTextField\n autoFocus\n variant=\"outlined\"\n margin=\"dense\"\n size=\"small\"\n label=\"Filter\"\n type=\"text\"\n fullWidth\n value={filter.value?.$regex || ''}\n onChange={(e) => {\n filter.onChange(\n e.target.value\n ? {\n $regex: e.target.value,\n // hard code case in-sensitive and multi-line searching\n $options: 'im',\n }\n : undefined,\n true,\n )\n }}\n />\n )\n }\n case 'NUMBER': {\n return (\n <Grid container spacing={1}>\n <Grid item xs={6}>\n <TextField\n autoFocus\n variant=\"outlined\"\n margin=\"dense\"\n size=\"small\"\n label=\"More Than Or Equal To\"\n type=\"number\"\n fullWidth\n value={filter.value?.$gte?.toString() || ''}\n onChange={(e) => {\n const newValue = e.target.value\n ? parseInt(e.target.value)\n : undefined\n filter.onChange(\n typeof filter.value?.$lte === 'number' ||\n newValue !== undefined\n ? {\n ...filter.value,\n $gte: newValue,\n }\n : undefined,\n true,\n )\n }}\n />\n </Grid>\n <Grid item xs={6}>\n <TextField\n variant=\"outlined\"\n margin=\"dense\"\n size=\"small\"\n label=\"Less Than Or Equal To\"\n type=\"number\"\n fullWidth\n value={filter.value?.$lte?.toString() || ''}\n onChange={(e) => {\n const newValue = e.target.value\n ? parseInt(e.target.value)\n : undefined\n filter.onChange(\n typeof filter.value?.$gte === 'number' ||\n newValue !== undefined\n ? {\n ...filter.value,\n $lte: newValue,\n }\n : undefined,\n true,\n )\n }}\n />\n </Grid>\n </Grid>\n )\n }\n case 'DATE': {\n return (\n <Grid container spacing={1}>\n <Grid item xs={6}>\n <V4CompatibleDatePicker\n label=\"After\"\n showTodayButton\n clearable\n margin=\"dense\"\n size=\"small\"\n inputVariant=\"outlined\"\n maxDate={filter.value?.$lte}\n maxDateMessage={\n filter.value?.$lte &&\n `Must be before \"${format(\n new Date(filter.value?.$lte),\n shortDateFormat,\n )}\"`\n }\n value={filter.value?.$gte || null}\n onChange={(newDate) => {\n const newValue = newDate\n ? format(newDate, 'yyyy-MM-dd')\n : undefined\n filter.onChange(\n filter.value?.$lte || newValue !== undefined\n ? {\n ...filter.value,\n $gte: newValue,\n }\n : undefined,\n false,\n )\n }}\n endIconButton\n iconButtonEdge=\"end\"\n />\n </Grid>\n <Grid item xs={6}>\n <V4CompatibleDatePicker\n label=\"Before\"\n showTodayButton\n clearable\n margin=\"dense\"\n size=\"small\"\n inputVariant=\"outlined\"\n minDate={filter.value?.$gte}\n minDateMessage={\n filter.value?.$lte &&\n `Must be after \"${format(\n new Date(filter.value?.$lte),\n shortDateFormat,\n )}\"`\n }\n value={filter.value?.$lte || null}\n onChange={(newDate) => {\n const newValue = newDate\n ? format(newDate, 'yyyy-MM-dd')\n : undefined\n filter.onChange(\n filter.value?.$gte || newValue !== undefined\n ? {\n ...filter.value,\n $lte: newValue,\n }\n : undefined,\n false,\n )\n }}\n endIconButton\n iconButtonEdge=\"end\"\n />\n </Grid>\n </Grid>\n )\n }\n case 'DATETIME': {\n return (\n <Grid container spacing={1}>\n <Grid item xs={6}>\n <V4CompatibleDateTimePicker\n label=\"After\"\n showTodayButton\n clearable\n margin=\"dense\"\n size=\"small\"\n inputVariant=\"outlined\"\n maxDate={filter.value?.$lte}\n maxDateMessage={\n filter.value?.$lte &&\n `Must be before \"${format(\n new Date(filter.value?.$lte),\n shortDateFormat,\n )}\"`\n }\n value={filter.value?.$gte || null}\n onChange={(momentDate) => {\n const newValue = momentDate?.toISOString()\n filter.onChange(\n filter.value?.$lte || newValue !== undefined\n ? {\n ...filter.value,\n $gte: newValue,\n }\n : undefined,\n false,\n )\n }}\n endIconButton\n iconButtonEdge=\"end\"\n />\n </Grid>\n <Grid item xs={6}>\n <V4CompatibleDateTimePicker\n label=\"Before\"\n showTodayButton\n clearable\n margin=\"dense\"\n size=\"small\"\n inputVariant=\"outlined\"\n minDate={filter.value?.$gte}\n minDateMessage={\n filter.value?.$lte &&\n `Must be after \"${format(\n new Date(filter.value?.$lte),\n shortDateFormat,\n )}\"`\n }\n value={filter.value?.$lte || null}\n onChange={(momentDate) => {\n const newValue = momentDate?.toISOString()\n filter.onChange(\n filter.value?.$gte || newValue !== undefined\n ? {\n ...filter.value,\n $lte: newValue,\n }\n : undefined,\n false,\n )\n }}\n endIconButton\n iconButtonEdge=\"end\"\n />\n </Grid>\n </Grid>\n )\n }\n case 'BOOLEAN': {\n return (\n <FormControl component=\"fieldset\">\n <RadioGroup\n aria-label=\"gender\"\n name=\"gender1\"\n value={filter.value?.$eq?.toString() || 'null'}\n onChange={(e) => {\n filter.onChange(\n {\n $eq: e.target.value === 'true',\n },\n false,\n )\n }}\n >\n <FormControlLabel value=\"true\" control={<Radio />} label=\"Yes\" />\n <FormControlLabel value=\"false\" control={<Radio />} label=\"No\" />\n </RadioGroup>\n </FormControl>\n )\n }\n case 'OPTIONS_SINGLE': {\n return (\n <OptionsTextField\n options={filter.options}\n value={filter.value?.$in}\n onChange={(newValue) => {\n filter.onChange(\n newValue.length\n ? {\n $in: newValue,\n }\n : undefined,\n false,\n )\n }}\n />\n )\n }\n case 'OPTIONS_MULTIPLE': {\n return (\n <OptionsTextField\n options={filter.options}\n value={filter.value?.$elemMatch?.$in}\n onChange={(newValue) => {\n filter.onChange(\n newValue.length\n ? {\n $elemMatch: {\n $in: newValue,\n },\n }\n : undefined,\n false,\n )\n }}\n />\n )\n }\n default: {\n return null\n }\n }\n}\n\nexport default React.memo(ColumnFilters)\n\nfunction OptionsTextField({\n options,\n value,\n onChange,\n}: {\n options: FormTypes.DynamicChoiceElementOption[]\n value: string[] | undefined\n onChange: (newValue: string[]) => void\n}) {\n return (\n <StyledTextField\n variant=\"outlined\"\n margin=\"dense\"\n size=\"small\"\n label=\"Filter\"\n select\n SelectProps={{\n multiple: true,\n renderValue: (selectedIds) => {\n return options\n .reduce<string[]>((selectedLabels, option) => {\n if ((selectedIds as string[]).includes(option.value)) {\n selectedLabels.push(option.label)\n }\n return selectedLabels\n }, [])\n .join(', ')\n },\n }}\n fullWidth\n value={value || []}\n onChange={(e) => {\n const newValue = e.target.value as unknown as string[]\n onChange(newValue)\n }}\n >\n {options.map((option) => (\n <MenuItem value={option.value} key={option.value}>\n <Checkbox checked={!!value?.some((v) => v === option.value)} />\n <ListItemText>{option.label}</ListItemText>\n </MenuItem>\n ))}\n </StyledTextField>\n )\n}\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { FormTypes, SubmissionTypes } from '@oneblink/types';
|
3
|
+
declare type Props = {
|
4
|
+
formElement: FormTypes.FormElement;
|
5
|
+
submission: SubmissionTypes.S3SubmissionData['submission'] | undefined;
|
6
|
+
allowCopy: boolean;
|
7
|
+
};
|
8
|
+
declare function FormElementTableCell({ formElement, submission, allowCopy }: Props): JSX.Element | null;
|
9
|
+
declare const _default: React.MemoExoticComponent<typeof FormElementTableCell>;
|
10
|
+
export default _default;
|
@@ -0,0 +1,195 @@
|
|
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
|
+
if (formElement.type === 'page' || formElement.type === 'section') {
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
const value = submission === null || submission === void 0 ? void 0 : submission[formElement.name];
|
15
|
+
if (value === undefined || value === null) {
|
16
|
+
return null;
|
17
|
+
}
|
18
|
+
switch (formElement.type) {
|
19
|
+
case 'repeatableSet': {
|
20
|
+
return React.createElement(RepeatableSetCell, { formElement: formElement, value: value });
|
21
|
+
}
|
22
|
+
case 'location': {
|
23
|
+
if (!value.latitude || !value.longitude) {
|
24
|
+
break;
|
25
|
+
}
|
26
|
+
const latLong = `${value.latitude},${value.longitude}`;
|
27
|
+
return (React.createElement(React.Fragment, null,
|
28
|
+
React.createElement("div", null,
|
29
|
+
React.createElement(Typography, { variant: "inherit", component: "p" },
|
30
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `https://maps.google.com/?q=${latLong}` }, "View in Google Maps")),
|
31
|
+
React.createElement(Typography, { variant: "inherit", component: "p", color: "textSecondary" },
|
32
|
+
"Latitude: ",
|
33
|
+
value.latitude),
|
34
|
+
React.createElement(Typography, { variant: "inherit", component: "p", color: "textSecondary" },
|
35
|
+
"Longitude: ",
|
36
|
+
value.longitude)),
|
37
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: latLong })));
|
38
|
+
}
|
39
|
+
case 'camera':
|
40
|
+
case 'draw': {
|
41
|
+
return React.createElement(FileChip, { file: value });
|
42
|
+
}
|
43
|
+
case 'textarea': {
|
44
|
+
return (React.createElement(React.Fragment, null,
|
45
|
+
React.createElement("span", { style: {
|
46
|
+
whiteSpace: 'pre-line',
|
47
|
+
} }, value),
|
48
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
49
|
+
}
|
50
|
+
case 'date': {
|
51
|
+
const text = format(new Date(value), shortDateFormat);
|
52
|
+
return (React.createElement(React.Fragment, null,
|
53
|
+
text,
|
54
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
55
|
+
}
|
56
|
+
case 'time': {
|
57
|
+
const text = format(new Date(value), timeFormat);
|
58
|
+
return (React.createElement(React.Fragment, null,
|
59
|
+
text,
|
60
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
61
|
+
}
|
62
|
+
case 'datetime': {
|
63
|
+
const text = format(new Date(value), shortDateTimeFormat);
|
64
|
+
return (React.createElement(React.Fragment, null,
|
65
|
+
text,
|
66
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
67
|
+
}
|
68
|
+
case 'number': {
|
69
|
+
const text = localisationService.formatNumber(value);
|
70
|
+
return (React.createElement(React.Fragment, null,
|
71
|
+
text,
|
72
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
73
|
+
}
|
74
|
+
case 'radio':
|
75
|
+
case 'autocomplete':
|
76
|
+
case 'checkboxes':
|
77
|
+
case 'select': {
|
78
|
+
if (formElement.type === 'checkboxes' ||
|
79
|
+
(formElement.type === 'select' && formElement.multi)) {
|
80
|
+
if (!Array.isArray(value) || !value.length) {
|
81
|
+
break;
|
82
|
+
}
|
83
|
+
const text = value
|
84
|
+
.map((selection) => getSelectedOptionLabel(formElement, selection))
|
85
|
+
.join(', ');
|
86
|
+
return (React.createElement(React.Fragment, null,
|
87
|
+
React.createElement(MultiSelectFormElementTableCellContent, { value: value, formElement: formElement }),
|
88
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
const text = getSelectedOptionLabel(formElement, value);
|
92
|
+
return (React.createElement(React.Fragment, null,
|
93
|
+
text,
|
94
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
95
|
+
}
|
96
|
+
}
|
97
|
+
case 'email': {
|
98
|
+
return (React.createElement(React.Fragment, null,
|
99
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `mailto:${value}` }, value),
|
100
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
101
|
+
}
|
102
|
+
case 'telephone': {
|
103
|
+
return (React.createElement(React.Fragment, null,
|
104
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `tel:${value}` }, value),
|
105
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
106
|
+
}
|
107
|
+
case 'text':
|
108
|
+
case 'bsb':
|
109
|
+
case 'barcodeScanner': {
|
110
|
+
return (React.createElement(React.Fragment, null,
|
111
|
+
value,
|
112
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
113
|
+
}
|
114
|
+
case 'files': {
|
115
|
+
if (!Array.isArray(value) || !value.length) {
|
116
|
+
break;
|
117
|
+
}
|
118
|
+
return React.createElement(FilesElementDataTableCellContent, { value: value });
|
119
|
+
}
|
120
|
+
case 'calculation': {
|
121
|
+
if (formElement.displayAsCurrency) {
|
122
|
+
const text = localisationService.formatCurrency(value);
|
123
|
+
return (React.createElement(React.Fragment, null,
|
124
|
+
text,
|
125
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
const text = localisationService.formatNumber(value);
|
129
|
+
return (React.createElement(React.Fragment, null,
|
130
|
+
text,
|
131
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value })));
|
132
|
+
}
|
133
|
+
}
|
134
|
+
case 'civicaStreetName': {
|
135
|
+
return (React.createElement(React.Fragment, null,
|
136
|
+
value.formattedStreet,
|
137
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: value.formattedStreet })));
|
138
|
+
}
|
139
|
+
case 'civicaNameRecord': {
|
140
|
+
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]
|
141
|
+
.filter((t) => t)
|
142
|
+
.join(' ') || (value === null || value === void 0 ? void 0 : value.emailAddress);
|
143
|
+
return (React.createElement(React.Fragment, null,
|
144
|
+
text,
|
145
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
146
|
+
}
|
147
|
+
case 'geoscapeAddress': {
|
148
|
+
const fullAddress = value.addressDetails && value.addressDetails.formattedAddress ? (value.addressDetails.formattedAddress) : (React.createElement(React.Fragment, null,
|
149
|
+
"Geoscape Address ID: ",
|
150
|
+
React.createElement("i", null, value.addressId)));
|
151
|
+
return (React.createElement(React.Fragment, null,
|
152
|
+
fullAddress,
|
153
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: fullAddress })));
|
154
|
+
}
|
155
|
+
case 'pointAddress': {
|
156
|
+
const fullAddress = value.addressDetails && value.addressDetails.formattedAddress ? (value.addressDetails.formattedAddress) : (React.createElement(React.Fragment, null,
|
157
|
+
"NSW Point Address ID: ",
|
158
|
+
React.createElement("i", null, value.addressId)));
|
159
|
+
return (React.createElement(React.Fragment, null,
|
160
|
+
fullAddress,
|
161
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: fullAddress })));
|
162
|
+
}
|
163
|
+
case 'boolean': {
|
164
|
+
const text = value ? 'Yes' : 'No';
|
165
|
+
return (React.createElement(React.Fragment, null,
|
166
|
+
text,
|
167
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: text })));
|
168
|
+
}
|
169
|
+
case 'abn': {
|
170
|
+
const abnNumber = abnService.displayABNNumberFromABNRecord(value);
|
171
|
+
return (React.createElement(React.Fragment, null,
|
172
|
+
React.createElement(Link, { target: "_blank", rel: "noopener noreferrer", href: `https://www.abr.business.gov.au/ABN/View/${abnNumber}` },
|
173
|
+
abnNumber,
|
174
|
+
" |",
|
175
|
+
' ',
|
176
|
+
React.createElement("i", null, abnService.displayBusinessNameFromABNRecord(value))),
|
177
|
+
React.createElement(TableCellCopyButton, { isHidden: !allowCopy, text: abnNumber })));
|
178
|
+
}
|
179
|
+
case 'html':
|
180
|
+
case 'form':
|
181
|
+
case 'infoPage':
|
182
|
+
case 'captcha':
|
183
|
+
case 'image':
|
184
|
+
case 'heading':
|
185
|
+
case 'summary': {
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
default: {
|
189
|
+
console.warn('Unsupported element type in Submission Data rendering', formElement);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
return null;
|
193
|
+
}
|
194
|
+
export default React.memo(FormElementTableCell);
|
195
|
+
//# 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;AAQjC,MAAM,EACJ,SAAS,EAAE,eAAe,EAC1B,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,mBAAmB,G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AC;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'\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 value = submission?.[formElement.name]\n if (value === undefined || value === null) {\n return null\n }\n\n switch (formElement.type) {\n case 'repeatableSet': {\n return <RepeatableSetCell formElement={formElement} value={value} />\n }\n\n case 'location': {\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 <FileChip file={value} />\n }\n\n case 'textarea': {\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 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 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 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 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 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 text = getSelectedOptionLabel(formElement, value)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={text} />\n </>\n )\n }\n }\n\n case 'email': {\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 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 return (\n <>\n {value}\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n }\n\n case 'files': {\n if (!Array.isArray(value) || !value.length) {\n break\n }\n return <FilesElementDataTableCellContent value={value} />\n }\n\n case 'calculation': {\n if (formElement.displayAsCurrency) {\n const text = localisationService.formatCurrency(value)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n } else {\n const text = localisationService.formatNumber(value)\n return (\n <>\n {text}\n <TableCellCopyButton isHidden={!allowCopy} text={value} />\n </>\n )\n }\n }\n\n case 'civicaStreetName': {\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 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 fullAddress =\n value.addressDetails && value.addressDetails.formattedAddress ? (\n value.addressDetails.formattedAddress\n ) : (\n <>\n Geoscape Address ID: <i>{value.addressId}</i>\n </>\n )\n return (\n <>\n {fullAddress}\n <TableCellCopyButton isHidden={!allowCopy} text={fullAddress} />\n </>\n )\n }\n\n case 'pointAddress': {\n const fullAddress =\n value.addressDetails && value.addressDetails.formattedAddress ? (\n value.addressDetails.formattedAddress\n ) : (\n <>\n NSW Point Address ID: <i>{value.addressId}</i>\n </>\n )\n return (\n <>\n {fullAddress}\n <TableCellCopyButton isHidden={!allowCopy} text={fullAddress} />\n </>\n )\n }\n\n case '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 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,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1D,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACrC,CAAC,CAAC,CAAA;AAEH,MAAM,WAAW,GAAY;IAC3B,QAAQ,EAAE,GAAG;CACd,CAAA;AAED,SAAS,oBAAoB,CAAC,EAC5B,WAAW,EACX,MAAM,GAIP;IACC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,GAC1C,gBAAgB,CAAoB,IAAI,CAAC,CAAA;IAE3C,OAAO,CACL;QACE,oBAAC,gBAAgB,IACf,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACjB,KAAK,CAAC,eAAe,EAAE,CAAA;gBACvB,WAAW,CAAC,KAAK,CAAC,aAAa,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,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"]}
|