@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.
Files changed (255) hide show
  1. package/dist/OneBlinkAutoSaveForm.js +2 -2
  2. package/dist/OneBlinkAutoSaveForm.js.map +1 -1
  3. package/dist/OneBlinkFormBase.js +4 -4
  4. package/dist/OneBlinkFormBase.js.map +1 -1
  5. package/dist/components/CopyToClipboardIconButton.d.ts +10 -0
  6. package/dist/components/CopyToClipboardIconButton.js +33 -0
  7. package/dist/components/CopyToClipboardIconButton.js.map +1 -0
  8. package/dist/components/CustomAccordion.d.ts +27 -0
  9. package/dist/components/CustomAccordion.js +38 -0
  10. package/dist/components/CustomAccordion.js.map +1 -0
  11. package/dist/components/ErrorSnackbar.d.ts +8 -0
  12. package/dist/components/ErrorSnackbar.js +26 -0
  13. package/dist/components/ErrorSnackbar.js.map +1 -0
  14. package/dist/components/Lists.d.ts +25 -0
  15. package/dist/components/Lists.js +45 -0
  16. package/dist/components/Lists.js.map +1 -0
  17. package/dist/components/LoadingWithMessage.d.ts +6 -0
  18. package/dist/components/LoadingWithMessage.js +12 -0
  19. package/dist/components/LoadingWithMessage.js.map +1 -0
  20. package/dist/components/formStore/FormStoreTableProvider.d.ts +6 -0
  21. package/dist/components/formStore/FormStoreTableProvider.js +89 -0
  22. package/dist/components/formStore/FormStoreTableProvider.js.map +1 -0
  23. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -0
  24. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +19 -0
  25. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -0
  26. package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -0
  27. package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +33 -0
  28. package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -0
  29. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -0
  30. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +49 -0
  31. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -0
  32. package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -0
  33. package/dist/components/formStore/OneBlinkFormStoreProvider.js +25 -0
  34. package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -0
  35. package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -0
  36. package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +12 -0
  37. package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -0
  38. package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -0
  39. package/dist/components/formStore/OneBlinkFormStoreTable.js +184 -0
  40. package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -0
  41. package/dist/components/formStore/display/ElementDisplay.d.ts +23 -0
  42. package/dist/components/formStore/display/ElementDisplay.js +78 -0
  43. package/dist/components/formStore/display/ElementDisplay.js.map +1 -0
  44. package/dist/components/formStore/display/FormStoreIcon.d.ts +2 -0
  45. package/dist/components/formStore/display/FormStoreIcon.js +3 -0
  46. package/dist/components/formStore/display/FormStoreIcon.js.map +1 -0
  47. package/dist/components/formStore/table/ActionedByTableCell.d.ts +11 -0
  48. package/dist/components/formStore/table/ActionedByTableCell.js +44 -0
  49. package/dist/components/formStore/table/ActionedByTableCell.js.map +1 -0
  50. package/dist/components/formStore/table/ColumnFilters.d.ts +9 -0
  51. package/dist/components/formStore/table/ColumnFilters.js +180 -0
  52. package/dist/components/formStore/table/ColumnFilters.js.map +1 -0
  53. package/dist/components/formStore/table/FormElementTableCell.d.ts +10 -0
  54. package/dist/components/formStore/table/FormElementTableCell.js +215 -0
  55. package/dist/components/formStore/table/FormElementTableCell.js.map +1 -0
  56. package/dist/components/formStore/table/HeaderCellMoreButton.d.ts +9 -0
  57. package/dist/components/formStore/table/HeaderCellMoreButton.js +49 -0
  58. package/dist/components/formStore/table/HeaderCellMoreButton.js.map +1 -0
  59. package/dist/components/formStore/table/RepeatableSetCell.d.ts +8 -0
  60. package/dist/components/formStore/table/RepeatableSetCell.js +61 -0
  61. package/dist/components/formStore/table/RepeatableSetCell.js.map +1 -0
  62. package/dist/components/formStore/table/RepeatableSetCellAccordion.d.ts +9 -0
  63. package/dist/components/formStore/table/RepeatableSetCellAccordion.js +12 -0
  64. package/dist/components/formStore/table/RepeatableSetCellAccordion.js.map +1 -0
  65. package/dist/components/formStore/table/TableCellCopyButton.d.ts +7 -0
  66. package/dist/components/formStore/table/TableCellCopyButton.js +28 -0
  67. package/dist/components/formStore/table/TableCellCopyButton.js.map +1 -0
  68. package/dist/components/formStore/table/generateColumns.d.ts +18 -0
  69. package/dist/components/formStore/table/generateColumns.js +233 -0
  70. package/dist/components/formStore/table/generateColumns.js.map +1 -0
  71. package/dist/components/formStore/table/useFormStoreTable.d.ts +52 -0
  72. package/dist/components/formStore/table/useFormStoreTable.js +139 -0
  73. package/dist/components/formStore/table/useFormStoreTable.js.map +1 -0
  74. package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -0
  75. package/dist/components/formStore/useFormStoreTableContext.js +10 -0
  76. package/dist/components/formStore/useFormStoreTableContext.js.map +1 -0
  77. package/dist/components/messages/ErrorMessage.d.ts +12 -0
  78. package/dist/components/messages/ErrorMessage.js +13 -0
  79. package/dist/components/messages/ErrorMessage.js.map +1 -0
  80. package/dist/components/messages/LargeIconMessage.d.ts +17 -0
  81. package/dist/components/messages/LargeIconMessage.js +38 -0
  82. package/dist/components/messages/LargeIconMessage.js.map +1 -0
  83. package/dist/components/messages/NoResourcesYet.d.ts +11 -0
  84. package/dist/components/messages/NoResourcesYet.js +7 -0
  85. package/dist/components/messages/NoResourcesYet.js.map +1 -0
  86. package/dist/components/pickers/V4CompatibleDatePicker.d.ts +30 -0
  87. package/dist/components/pickers/V4CompatibleDatePicker.js +58 -0
  88. package/dist/components/pickers/V4CompatibleDatePicker.js.map +1 -0
  89. package/dist/components/pickers/V4CompatibleDateTimePicker.d.ts +29 -0
  90. package/dist/components/pickers/V4CompatibleDateTimePicker.js +58 -0
  91. package/dist/components/pickers/V4CompatibleDateTimePicker.js.map +1 -0
  92. package/dist/components/pickers/V4CompatibleTimePicker.d.ts +26 -0
  93. package/dist/components/pickers/V4CompatibleTimePicker.js +41 -0
  94. package/dist/components/pickers/V4CompatibleTimePicker.js.map +1 -0
  95. package/dist/components/{AnnotationModal.d.ts → renderer/AnnotationModal.d.ts} +0 -0
  96. package/dist/components/{AnnotationModal.js → renderer/AnnotationModal.js} +2 -2
  97. package/dist/components/renderer/AnnotationModal.js.map +1 -0
  98. package/dist/components/{AutocompleteDropdown.d.ts → renderer/AutocompleteDropdown.d.ts} +0 -0
  99. package/dist/components/{AutocompleteDropdown.js → renderer/AutocompleteDropdown.js} +1 -1
  100. package/dist/components/renderer/AutocompleteDropdown.js.map +1 -0
  101. package/dist/components/{CopyToClipboardButton.d.ts → renderer/CopyToClipboardButton.d.ts} +0 -0
  102. package/dist/components/{CopyToClipboardButton.js → renderer/CopyToClipboardButton.js} +1 -1
  103. package/dist/components/renderer/CopyToClipboardButton.js.map +1 -0
  104. package/dist/components/{CustomisableButtonInner.d.ts → renderer/CustomisableButtonInner.d.ts} +0 -0
  105. package/dist/components/{CustomisableButtonInner.js → renderer/CustomisableButtonInner.js} +0 -0
  106. package/dist/components/renderer/CustomisableButtonInner.js.map +1 -0
  107. package/dist/components/{FormElementLabelContainer.d.ts → renderer/FormElementLabelContainer.d.ts} +0 -0
  108. package/dist/components/{FormElementLabelContainer.js → renderer/FormElementLabelContainer.js} +0 -0
  109. package/dist/components/renderer/FormElementLabelContainer.js.map +1 -0
  110. package/dist/components/{FormElementOptions.d.ts → renderer/FormElementOptions.d.ts} +0 -0
  111. package/dist/components/{FormElementOptions.js → renderer/FormElementOptions.js} +0 -0
  112. package/dist/components/renderer/FormElementOptions.js.map +1 -0
  113. package/dist/components/{LookupButton.d.ts → renderer/LookupButton.d.ts} +0 -0
  114. package/dist/components/{LookupButton.js → renderer/LookupButton.js} +3 -3
  115. package/dist/components/renderer/LookupButton.js.map +1 -0
  116. package/dist/components/{LookupNotification.d.ts → renderer/LookupNotification.d.ts} +1 -1
  117. package/dist/components/{LookupNotification.js → renderer/LookupNotification.js} +9 -9
  118. package/dist/components/renderer/LookupNotification.js.map +1 -0
  119. package/dist/components/{Modal.d.ts → renderer/Modal.d.ts} +0 -0
  120. package/dist/components/{Modal.js → renderer/Modal.js} +0 -0
  121. package/dist/components/renderer/Modal.js.map +1 -0
  122. package/dist/components/{OnLoading.d.ts → renderer/OnLoading.d.ts} +0 -0
  123. package/dist/components/{OnLoading.js → renderer/OnLoading.js} +0 -0
  124. package/dist/components/renderer/OnLoading.js.map +1 -0
  125. package/dist/components/{OneBlinkAppsErrorOriginalMessage.d.ts → renderer/OneBlinkAppsErrorOriginalMessage.d.ts} +0 -0
  126. package/dist/components/{OneBlinkAppsErrorOriginalMessage.js → renderer/OneBlinkAppsErrorOriginalMessage.js} +0 -0
  127. package/dist/components/renderer/OneBlinkAppsErrorOriginalMessage.js.map +1 -0
  128. package/dist/components/{OneBlinkFormElements.d.ts → renderer/OneBlinkFormElements.d.ts} +1 -1
  129. package/dist/components/{OneBlinkFormElements.js → renderer/OneBlinkFormElements.js} +36 -36
  130. package/dist/components/renderer/OneBlinkFormElements.js.map +1 -0
  131. package/dist/components/{PageFormElements.d.ts → renderer/PageFormElements.d.ts} +1 -1
  132. package/dist/components/{PageFormElements.js → renderer/PageFormElements.js} +3 -3
  133. package/dist/components/renderer/PageFormElements.js.map +1 -0
  134. package/dist/components/{ToggleAllCheckbox.d.ts → renderer/ToggleAllCheckbox.d.ts} +1 -1
  135. package/dist/components/{ToggleAllCheckbox.js → renderer/ToggleAllCheckbox.js} +0 -0
  136. package/dist/components/renderer/ToggleAllCheckbox.js.map +1 -0
  137. package/dist/components/{attachments → renderer/attachments}/AttachmentStatus.d.ts +0 -0
  138. package/dist/components/{attachments → renderer/attachments}/AttachmentStatus.js +1 -1
  139. package/dist/components/renderer/attachments/AttachmentStatus.js.map +1 -0
  140. package/dist/components/{attachments → renderer/attachments}/FileCard.d.ts +0 -0
  141. package/dist/components/{attachments → renderer/attachments}/FileCard.js +4 -4
  142. package/dist/components/renderer/attachments/FileCard.js.map +1 -0
  143. package/dist/components/{attachments → renderer/attachments}/FileCardContent.d.ts +0 -0
  144. package/dist/components/{attachments → renderer/attachments}/FileCardContent.js +0 -0
  145. package/dist/components/renderer/attachments/FileCardContent.js.map +1 -0
  146. package/dist/components/{attachments → renderer/attachments}/Files.d.ts +0 -0
  147. package/dist/components/{attachments → renderer/attachments}/Files.js +0 -0
  148. package/dist/components/renderer/attachments/Files.js.map +1 -0
  149. package/dist/components/{attachments → renderer/attachments}/ImagePreviewUnavailable.d.ts +0 -0
  150. package/dist/components/{attachments → renderer/attachments}/ImagePreviewUnavailable.js +1 -1
  151. package/dist/components/renderer/attachments/ImagePreviewUnavailable.js.map +1 -0
  152. package/dist/components/{attachments → renderer/attachments}/UploadingAttachment.d.ts +0 -0
  153. package/dist/components/{attachments → renderer/attachments}/UploadingAttachment.js +1 -1
  154. package/dist/components/renderer/attachments/UploadingAttachment.js.map +1 -0
  155. package/dist/form-elements/FormElementABN.js +3 -3
  156. package/dist/form-elements/FormElementABN.js.map +1 -1
  157. package/dist/form-elements/FormElementAutocomplete.js +3 -3
  158. package/dist/form-elements/FormElementAutocomplete.js.map +1 -1
  159. package/dist/form-elements/FormElementBSB.js +3 -3
  160. package/dist/form-elements/FormElementBSB.js.map +1 -1
  161. package/dist/form-elements/FormElementBarcodeScanner.js +4 -4
  162. package/dist/form-elements/FormElementBarcodeScanner.js.map +1 -1
  163. package/dist/form-elements/FormElementBoolean.js +1 -1
  164. package/dist/form-elements/FormElementBoolean.js.map +1 -1
  165. package/dist/form-elements/FormElementCamera.js +6 -6
  166. package/dist/form-elements/FormElementCamera.js.map +1 -1
  167. package/dist/form-elements/FormElementCheckBoxes.js +4 -4
  168. package/dist/form-elements/FormElementCheckBoxes.js.map +1 -1
  169. package/dist/form-elements/FormElementCivicaStreetName.js +2 -2
  170. package/dist/form-elements/FormElementCivicaStreetName.js.map +1 -1
  171. package/dist/form-elements/FormElementCompliance.js +2 -2
  172. package/dist/form-elements/FormElementCompliance.js.map +1 -1
  173. package/dist/form-elements/FormElementDate.js +4 -4
  174. package/dist/form-elements/FormElementDate.js.map +1 -1
  175. package/dist/form-elements/FormElementDateTime.js +4 -4
  176. package/dist/form-elements/FormElementDateTime.js.map +1 -1
  177. package/dist/form-elements/FormElementEmail.js +3 -3
  178. package/dist/form-elements/FormElementEmail.js.map +1 -1
  179. package/dist/form-elements/FormElementFiles/FormElementFile.js +1 -1
  180. package/dist/form-elements/FormElementFiles/FormElementFile.js.map +1 -1
  181. package/dist/form-elements/FormElementFiles/FormElementFiles.js +1 -1
  182. package/dist/form-elements/FormElementFiles/FormElementFiles.js.map +1 -1
  183. package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js +2 -2
  184. package/dist/form-elements/FormElementFiles/legacy/FormElementFiles.js.map +1 -1
  185. package/dist/form-elements/FormElementForm.js +1 -1
  186. package/dist/form-elements/FormElementForm.js.map +1 -1
  187. package/dist/form-elements/FormElementGeoscapeAddress.js +2 -2
  188. package/dist/form-elements/FormElementGeoscapeAddress.js.map +1 -1
  189. package/dist/form-elements/FormElementLocation.js +2 -2
  190. package/dist/form-elements/FormElementLocation.js.map +1 -1
  191. package/dist/form-elements/FormElementNumber.js +3 -3
  192. package/dist/form-elements/FormElementNumber.js.map +1 -1
  193. package/dist/form-elements/FormElementPointAddress.js +2 -2
  194. package/dist/form-elements/FormElementPointAddress.js.map +1 -1
  195. package/dist/form-elements/FormElementRadio.js +2 -2
  196. package/dist/form-elements/FormElementRadio.js.map +1 -1
  197. package/dist/form-elements/FormElementRepeatableSet.js +3 -3
  198. package/dist/form-elements/FormElementRepeatableSet.js.map +1 -1
  199. package/dist/form-elements/FormElementSection.d.ts +1 -1
  200. package/dist/form-elements/FormElementSection.js +1 -1
  201. package/dist/form-elements/FormElementSection.js.map +1 -1
  202. package/dist/form-elements/FormElementSelect.js +4 -4
  203. package/dist/form-elements/FormElementSelect.js.map +1 -1
  204. package/dist/form-elements/FormElementSignature.js +4 -4
  205. package/dist/form-elements/FormElementSignature.js.map +1 -1
  206. package/dist/form-elements/FormElementTelephone.js +3 -3
  207. package/dist/form-elements/FormElementTelephone.js.map +1 -1
  208. package/dist/form-elements/FormElementText.js +3 -3
  209. package/dist/form-elements/FormElementText.js.map +1 -1
  210. package/dist/form-elements/FormElementTextarea.js +3 -3
  211. package/dist/form-elements/FormElementTextarea.js.map +1 -1
  212. package/dist/form-elements/FormElementTime.js +4 -4
  213. package/dist/form-elements/FormElementTime.js.map +1 -1
  214. package/dist/hooks/useConditionalLogic.js +1 -1
  215. package/dist/hooks/useConditionalLogic.js.map +1 -1
  216. package/dist/hooks/useInfiniteScrollDataLoad.d.ts +29 -0
  217. package/dist/hooks/useInfiniteScrollDataLoad.js +118 -0
  218. package/dist/hooks/useInfiniteScrollDataLoad.js.map +1 -0
  219. package/dist/hooks/useIsHovering.d.ts +5 -0
  220. package/dist/hooks/useIsHovering.js +13 -0
  221. package/dist/hooks/useIsHovering.js.map +1 -0
  222. package/dist/hooks/useQuery.d.ts +2 -0
  223. package/dist/hooks/useQuery.js +8 -0
  224. package/dist/hooks/useQuery.js.map +1 -0
  225. package/dist/hooks/useSubmissionIdIsValid.d.ts +3 -0
  226. package/dist/hooks/useSubmissionIdIsValid.js +20 -0
  227. package/dist/hooks/useSubmissionIdIsValid.js.map +1 -0
  228. package/dist/index.d.ts +9 -0
  229. package/dist/index.js +9 -0
  230. package/dist/index.js.map +1 -1
  231. package/dist/services/defaultCoordinates.js +1 -1
  232. package/dist/services/defaultCoordinates.js.map +1 -1
  233. package/dist/services/generate-default-data.js +1 -1
  234. package/dist/services/generate-default-data.js.map +1 -1
  235. package/package.json +14 -5
  236. package/dist/components/AnnotationModal.js.map +0 -1
  237. package/dist/components/AutocompleteDropdown.js.map +0 -1
  238. package/dist/components/CopyToClipboardButton.js.map +0 -1
  239. package/dist/components/CustomisableButtonInner.js.map +0 -1
  240. package/dist/components/FormElementLabelContainer.js.map +0 -1
  241. package/dist/components/FormElementOptions.js.map +0 -1
  242. package/dist/components/LookupButton.js.map +0 -1
  243. package/dist/components/LookupNotification.js.map +0 -1
  244. package/dist/components/Modal.js.map +0 -1
  245. package/dist/components/OnLoading.js.map +0 -1
  246. package/dist/components/OneBlinkAppsErrorOriginalMessage.js.map +0 -1
  247. package/dist/components/OneBlinkFormElements.js.map +0 -1
  248. package/dist/components/PageFormElements.js.map +0 -1
  249. package/dist/components/ToggleAllCheckbox.js.map +0 -1
  250. package/dist/components/attachments/AttachmentStatus.js.map +0 -1
  251. package/dist/components/attachments/FileCard.js.map +0 -1
  252. package/dist/components/attachments/FileCardContent.js.map +0 -1
  253. package/dist/components/attachments/Files.js.map +0 -1
  254. package/dist/components/attachments/ImagePreviewUnavailable.js.map +0 -1
  255. package/dist/components/attachments/UploadingAttachment.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ import * as React from 'react';
2
+ import { saveAs } from 'file-saver';
3
+ import { Chip, CircularProgress, Grid } from '@mui/material';
4
+ import { SaveAlt, AttachFile } from '@mui/icons-material';
5
+ import ErrorSnackbar from '../../ErrorSnackbar';
6
+ import { UnorderedList, ListItem } from '../../Lists';
7
+ import { getCognitoIdToken } from '@oneblink/apps/dist/services/cognito';
8
+ async function fetchFile(url) {
9
+ const idToken = await getCognitoIdToken();
10
+ const response = await fetch(url, {
11
+ headers: {
12
+ Authorization: `Bearer ${idToken}`,
13
+ },
14
+ });
15
+ if (!response.ok) {
16
+ throw new Error(`Unable to download file. HTTP Status Code: ${response.status}`);
17
+ }
18
+ return await response.blob();
19
+ }
20
+ export function FileChip({ file: { fileName, url, isPrivate, data }, }) {
21
+ const [{ isDownloading, error }, setState] = React.useState({
22
+ isDownloading: false,
23
+ });
24
+ const clearError = React.useCallback(() => {
25
+ setState({
26
+ isDownloading: false,
27
+ });
28
+ }, []);
29
+ const handleDownload = React.useCallback(async () => {
30
+ try {
31
+ setState({
32
+ isDownloading: true,
33
+ });
34
+ if (url) {
35
+ if (isPrivate) {
36
+ const blob = await fetchFile(url);
37
+ saveAs(blob, fileName);
38
+ }
39
+ else {
40
+ saveAs(url, fileName);
41
+ }
42
+ }
43
+ else if (data) {
44
+ saveAs(data, fileName);
45
+ }
46
+ setState({
47
+ isDownloading: false,
48
+ });
49
+ }
50
+ catch (error) {
51
+ setState({
52
+ isDownloading: false,
53
+ error: error,
54
+ });
55
+ }
56
+ }, [data, fileName, isPrivate, url]);
57
+ return (React.createElement(React.Fragment, null,
58
+ React.createElement(Chip, { label: fileName, deleteIcon: React.createElement(SaveAlt, null), onDelete: handleDownload, variant: "outlined", icon: isDownloading ? React.createElement(CircularProgress, { size: 16 }) : React.createElement(AttachFile, null) }),
59
+ React.createElement(ErrorSnackbar, { open: !!error, onClose: clearError },
60
+ React.createElement("span", { "data-cypress": "download-legacy-file-error-message" }, error && error.message))));
61
+ }
62
+ export function FilesElementDataTableCellContent({ value, }) {
63
+ return (React.createElement(Grid, { container: true, spacing: 1 }, value.map((file, index) => {
64
+ return (React.createElement(Grid, { item: true, key: index, xs: 12 },
65
+ React.createElement(FileChip, { file: file })));
66
+ })));
67
+ }
68
+ export function MultiSelectFormElementTableCellContent({ value, formElement, }) {
69
+ return (React.createElement(UnorderedList, { disablePadding: true }, value.map((selection, index) => {
70
+ const label = getSelectedOptionLabel(formElement, selection);
71
+ return React.createElement(ListItem, { key: index }, label);
72
+ })));
73
+ }
74
+ export function getSelectedOptionLabel(formElement, value) {
75
+ const selectedOption = (formElement.options || []).find((opt) => opt.value === value);
76
+ return selectedOption ? selectedOption.label : value;
77
+ }
78
+ //# sourceMappingURL=ElementDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ElementDisplay.js","sourceRoot":"","sources":["../../../../src/components/formStore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,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,CAAC,IACvB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACzB,OAAO,CACL,oBAAC,IAAI,IAAC,IAAI,QAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC3B,oBAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,GAAI,CACnB,CACR,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,EACrD,KAAK,EACL,WAAW,GAIZ;IACC,OAAO,CACL,oBAAC,aAAa,IAAC,cAAc,UAC1B,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;QAC9B,MAAM,KAAK,GAAG,sBAAsB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;QAC5D,OAAO,oBAAC,QAAQ,IAAC,GAAG,EAAE,KAAK,IAAG,KAAK,CAAY,CAAA;IACjD,CAAC,CAAC,CACY,CACjB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,WAAmC,EACnC,KAAa;IAEb,MAAM,cAAc,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CACrD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,CAC7B,CAAA;IACD,OAAO,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACtD,CAAC","sourcesContent":["import * as React from 'react'\nimport { saveAs } from 'file-saver'\nimport { Chip, CircularProgress, Grid } from '@mui/material'\nimport { SaveAlt, AttachFile } from '@mui/icons-material'\nimport ErrorSnackbar from '../../ErrorSnackbar'\nimport { UnorderedList, ListItem } from '../../Lists'\nimport { FormElementWithOptions } from '@oneblink/types/typescript/forms'\nimport { getCognitoIdToken } from '@oneblink/apps/dist/services/cognito'\n\nasync function fetchFile(url: string) {\n const idToken = await getCognitoIdToken()\n const response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${idToken}`,\n },\n })\n\n if (!response.ok) {\n throw new Error(\n `Unable to download file. HTTP Status Code: ${response.status}`,\n )\n }\n\n return await response.blob()\n}\n\nexport function FileChip({\n file: { fileName, url, isPrivate, data },\n}: {\n file: {\n fileName: string\n url?: string\n isPrivate?: boolean\n data?: string\n }\n}) {\n const [{ isDownloading, error }, setState] = React.useState<{\n error?: Error\n isDownloading: boolean\n }>({\n isDownloading: false,\n })\n const clearError = React.useCallback(() => {\n setState({\n isDownloading: false,\n })\n }, [])\n const handleDownload = React.useCallback(async () => {\n try {\n setState({\n isDownloading: true,\n })\n\n if (url) {\n if (isPrivate) {\n const blob = await fetchFile(url)\n saveAs(blob, fileName)\n } else {\n saveAs(url, fileName)\n }\n } else if (data) {\n saveAs(data, fileName)\n }\n\n setState({\n isDownloading: false,\n })\n } catch (error) {\n setState({\n isDownloading: false,\n error: error as Error,\n })\n }\n }, [data, fileName, isPrivate, url])\n return (\n <>\n <Chip\n label={fileName}\n deleteIcon={<SaveAlt />}\n onDelete={handleDownload}\n variant=\"outlined\"\n icon={isDownloading ? <CircularProgress size={16} /> : <AttachFile />}\n />\n <ErrorSnackbar open={!!error} onClose={clearError}>\n <span data-cypress=\"download-legacy-file-error-message\">\n {error && error.message}\n </span>\n </ErrorSnackbar>\n </>\n )\n}\n\nexport function FilesElementDataTableCellContent({\n value,\n}: {\n value: Array<{\n fileName: string\n url?: string | undefined\n isPrivate?: boolean | undefined\n data?: string | undefined\n }>\n}) {\n return (\n <Grid container spacing={1}>\n {value.map((file, index) => {\n return (\n <Grid item key={index} xs={12}>\n <FileChip file={file} />\n </Grid>\n )\n })}\n </Grid>\n )\n}\n\nexport function MultiSelectFormElementTableCellContent({\n value,\n formElement,\n}: {\n value: string[]\n formElement: FormElementWithOptions\n}) {\n return (\n <UnorderedList disablePadding>\n {value.map((selection, index) => {\n const label = getSelectedOptionLabel(formElement, selection)\n return <ListItem key={index}>{label}</ListItem>\n })}\n </UnorderedList>\n )\n}\n\nexport function getSelectedOptionLabel(\n formElement: FormElementWithOptions,\n value: string,\n) {\n const selectedOption = (formElement.options || []).find(\n (opt) => opt.value === value,\n )\n return selectedOption ? selectedOption.label : value\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import Work from '@mui/icons-material/Work';
2
+ export default Work;
@@ -0,0 +1,3 @@
1
+ import Work from '@mui/icons-material/Work';
2
+ export default Work;
3
+ //# sourceMappingURL=FormStoreIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormStoreIcon.js","sourceRoot":"","sources":["../../../../src/components/formStore/display/FormStoreIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,0BAA0B,CAAA;AAC3C,eAAe,IAAI,CAAA","sourcesContent":["import Work from '@mui/icons-material/Work'\nexport default Work\n"]}
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { UserProfile } from '@oneblink/types/typescript/misc';
3
+ import { Chip } from '@mui/material';
4
+ declare function ActionedByTableCell({ userProfile, developerKey, ...rest }: React.ComponentProps<typeof Chip> & {
5
+ userProfile?: UserProfile;
6
+ developerKey?: {
7
+ name: string;
8
+ };
9
+ }): JSX.Element;
10
+ declare const _default: React.MemoExoticComponent<typeof ActionedByTableCell>;
11
+ export default _default;
@@ -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,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","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;