@oneblink/apps-react 1.2.0-beta.4 → 1.2.0
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/components/formStore/OneBlinkFormStoreColumnsButton.js +32 -29
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +7 -3
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -1
- package/package.json +1 -1
@@ -9,6 +9,8 @@ function OneBlinkFormStoreColumnsButton(props) {
|
|
9
9
|
const [isConfiguringColumns, showColumnConfiguration, hideColumnConfiguration,] = useBooleanState(false);
|
10
10
|
const [isHelpOpen, , , toggleHelp] = useBooleanState(false);
|
11
11
|
const toggleHideAllColumnsProps = getToggleHideAllColumnsProps();
|
12
|
+
const hasRepeatableSets = React.useMemo(() => parameters.unwindRepeatableSets ||
|
13
|
+
allColumns.some((c) => c.formElementType === 'repeatableSet'), [allColumns, parameters.unwindRepeatableSets]);
|
12
14
|
return (React.createElement(React.Fragment, null,
|
13
15
|
React.createElement(Button, { className: "ob-form-store-columns-button", startIcon: React.createElement(SettingsIcon, null), onClick: showColumnConfiguration,
|
14
16
|
// eslint-disable-next-line react/no-children-prop
|
@@ -16,35 +18,36 @@ function OneBlinkFormStoreColumnsButton(props) {
|
|
16
18
|
React.createElement(Dialog, { open: isConfiguringColumns, maxWidth: "sm", fullWidth: true, onClose: hideColumnConfiguration },
|
17
19
|
React.createElement(DialogTitle, null, "Column Configuration"),
|
18
20
|
React.createElement(DialogContent, { dividers: true },
|
19
|
-
React.createElement(
|
20
|
-
React.createElement(Grid, {
|
21
|
-
React.createElement(
|
22
|
-
React.createElement(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
React.createElement(
|
38
|
-
React.createElement(
|
39
|
-
|
40
|
-
React.createElement(
|
41
|
-
React.createElement(
|
42
|
-
|
43
|
-
React.createElement(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
React.createElement(
|
21
|
+
hasRepeatableSets && (React.createElement(React.Fragment, null,
|
22
|
+
React.createElement(Grid, { container: true },
|
23
|
+
React.createElement(Grid, { item: true },
|
24
|
+
React.createElement(FormGroup, null,
|
25
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: !!parameters.unwindRepeatableSets }), onChange: (e, checked) => {
|
26
|
+
onChangeParameters((currentParameters) => ({
|
27
|
+
...currentParameters,
|
28
|
+
sorting: checked
|
29
|
+
? currentParameters.sorting
|
30
|
+
: [
|
31
|
+
{
|
32
|
+
property: 'dateTimeSubmitted',
|
33
|
+
direction: 'descending',
|
34
|
+
},
|
35
|
+
],
|
36
|
+
unwindRepeatableSets: checked,
|
37
|
+
}), false);
|
38
|
+
}, label: "Output a row per repeatable set entry" }))),
|
39
|
+
React.createElement(Grid, { item: true },
|
40
|
+
React.createElement(IconButton, { onClick: toggleHelp },
|
41
|
+
React.createElement(Help, null)))),
|
42
|
+
React.createElement(Collapse, { in: isHelpOpen },
|
43
|
+
React.createElement(Alert, { severity: "info" },
|
44
|
+
React.createElement(AlertTitle, null, "When this setting is enabled:"),
|
45
|
+
React.createElement(UnorderedList, null,
|
46
|
+
React.createElement(ListItem, null, "Repeatable set columns will be expanded and create duplicate rows per entry"),
|
47
|
+
React.createElement(ListItem, null, "Columns inside repeatable set entries can be sorted and filtered"),
|
48
|
+
React.createElement(ListItem, null, "Columns inside repeatable set entries will be included in the CSV download")))),
|
49
|
+
React.createElement(Box, { marginY: 2 },
|
50
|
+
React.createElement(Divider, null)))),
|
48
51
|
React.createElement(FormGroup, null,
|
49
52
|
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { ...toggleHideAllColumnsProps, indeterminate: !!toggleHideAllColumnsProps.indeterminate }), label: React.createElement("b", null, "Toggle All") }),
|
50
53
|
allColumns.map((column) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OneBlinkFormStoreColumnsButton.js","sourceRoot":"","sources":["../../../src/components/formStore/OneBlinkFormStoreColumnsButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,KAAK,EACL,UAAU,EACV,GAAG,EACH,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,eAAe,MAAM,6BAA6B,CAAA;AACzD,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAElD,SAAS,8BAA8B,CACrC,KAA0C;IAE1C,MAAM,EACJ,4BAA4B,EAC5B,UAAU,EACV,UAAU,EACV,kBAAkB,GACnB,GAAG,wBAAwB,EAAE,CAAA;IAC9B,MAAM,CACJ,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACxB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,CAAC,UAAU,EAAE,AAAD,EAAG,AAAD,EAAG,UAAU,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAE3D,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,CAAA;IAEhE,OAAO,CACL;QACE,oBAAC,MAAM,IACL,SAAS,EAAC,8BAA8B,EACxC,SAAS,EAAE,oBAAC,YAAY,OAAG,EAC3B,OAAO,EAAE,uBAAuB;YAChC,kDAAkD;YAClD,QAAQ,EAAE,oDAAY,KAClB,KAAK,GACT;QACF,oBAAC,MAAM,IACL,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAC,IAAI,EACb,SAAS,QACT,OAAO,EAAE,uBAAuB;YAEhC,oBAAC,WAAW,+BAAmC;YAC/C,oBAAC,aAAa,IAAC,QAAQ;
|
1
|
+
{"version":3,"file":"OneBlinkFormStoreColumnsButton.js","sourceRoot":"","sources":["../../../src/components/formStore/OneBlinkFormStoreColumnsButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,KAAK,EACL,UAAU,EACV,GAAG,EACH,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,eAAe,MAAM,6BAA6B,CAAA;AACzD,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAElD,SAAS,8BAA8B,CACrC,KAA0C;IAE1C,MAAM,EACJ,4BAA4B,EAC5B,UAAU,EACV,UAAU,EACV,kBAAkB,GACnB,GAAG,wBAAwB,EAAE,CAAA;IAC9B,MAAM,CACJ,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACxB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,CAAC,UAAU,EAAE,AAAD,EAAG,AAAD,EAAG,UAAU,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAE3D,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,CAAA;IAEhE,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CACrC,GAAG,EAAE,CACH,UAAU,CAAC,oBAAoB;QAC/B,UAAU,CAAC,IAAI,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,\n Box,\n Button,\n Checkbox,\n Collapse,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Divider,\n FormControlLabel,\n FormGroup,\n Grid,\n IconButton,\n Typography,\n} from '@mui/material'\nimport { Help, Settings as SettingsIcon } from '@mui/icons-material'\nimport useBooleanState from '../../hooks/useBooleanState'\nimport useFormStoreTableContext from './useFormStoreTableContext'\nimport { ListItem, UnorderedList } from '../Lists'\n\nfunction OneBlinkFormStoreColumnsButton(\n props: React.ComponentProps<typeof Button>,\n) {\n const {\n getToggleHideAllColumnsProps,\n allColumns,\n parameters,\n onChangeParameters,\n } = useFormStoreTableContext()\n const [\n isConfiguringColumns,\n showColumnConfiguration,\n hideColumnConfiguration,\n ] = useBooleanState(false)\n const [isHelpOpen, , , toggleHelp] = useBooleanState(false)\n\n const toggleHideAllColumnsProps = getToggleHideAllColumnsProps()\n\n const hasRepeatableSets = React.useMemo(\n () =>\n parameters.unwindRepeatableSets ||\n allColumns.some((c) => c.formElementType === 'repeatableSet'),\n [allColumns, parameters.unwindRepeatableSets],\n )\n\n return (\n <>\n <Button\n className=\"ob-form-store-columns-button\"\n startIcon={<SettingsIcon />}\n onClick={showColumnConfiguration}\n // eslint-disable-next-line react/no-children-prop\n children={<>Columns</>}\n {...props}\n />\n <Dialog\n open={isConfiguringColumns}\n maxWidth=\"sm\"\n fullWidth\n onClose={hideColumnConfiguration}\n >\n <DialogTitle>Column Configuration</DialogTitle>\n <DialogContent dividers>\n {hasRepeatableSets && (\n <>\n <Grid container>\n <Grid item>\n <FormGroup>\n <FormControlLabel\n control={\n <Checkbox checked={!!parameters.unwindRepeatableSets} />\n }\n onChange={(e, checked) => {\n onChangeParameters(\n (currentParameters) => ({\n ...currentParameters,\n sorting: checked\n ? currentParameters.sorting\n : [\n {\n property: 'dateTimeSubmitted',\n direction: 'descending',\n },\n ],\n unwindRepeatableSets: checked,\n }),\n false,\n )\n }}\n label=\"Output a row per repeatable set entry\"\n />\n </FormGroup>\n </Grid>\n <Grid item>\n <IconButton onClick={toggleHelp}>\n <Help />\n </IconButton>\n </Grid>\n </Grid>\n <Collapse in={isHelpOpen}>\n <Alert severity=\"info\">\n <AlertTitle>When this setting is enabled:</AlertTitle>\n <UnorderedList>\n <ListItem>\n Repeatable set columns will be expanded and create\n duplicate rows per entry\n </ListItem>\n <ListItem>\n Columns inside repeatable set entries can be sorted and\n filtered\n </ListItem>\n <ListItem>\n Columns inside repeatable set entries will be included in\n the CSV download\n </ListItem>\n </UnorderedList>\n </Alert>\n </Collapse>\n <Box marginY={2}>\n <Divider />\n </Box>\n </>\n )}\n <FormGroup>\n <FormControlLabel\n control={\n <Checkbox\n {...toggleHideAllColumnsProps}\n indeterminate={!!toggleHideAllColumnsProps.indeterminate}\n />\n }\n label={<b>Toggle All</b>}\n />\n {allColumns.map((column) => {\n return (\n <React.Fragment key={column.id}>\n <FormControlLabel\n control={<Checkbox {...column.getToggleHiddenProps()} />}\n label={\n <>\n {column.headerText}\n {column.tooltip && (\n <Typography component=\"span\" color=\"textSecondary\">\n {' '}\n ({column.tooltip})\n </Typography>\n )}\n </>\n }\n />\n </React.Fragment>\n )\n })}\n </FormGroup>\n </DialogContent>\n <DialogActions>\n <Button\n onClick={hideColumnConfiguration}\n color=\"primary\"\n variant=\"contained\"\n >\n Done\n </Button>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n\nexport default React.memo(OneBlinkFormStoreColumnsButton)\n"]}
|
@@ -72,9 +72,13 @@ function OneBlinkFormStoreDownloadButton(props) {
|
|
72
72
|
React.createElement(Dialog, { open: isPromptingDownloadCsv, maxWidth: "sm", fullWidth: true, onClose: cancelPromptDownloadCsv },
|
73
73
|
React.createElement(DialogTitle, null, "Column Configuration"),
|
74
74
|
React.createElement(DialogContent, null,
|
75
|
-
React.createElement(DialogContentText, null,
|
76
|
-
|
77
|
-
|
75
|
+
React.createElement(DialogContentText, null,
|
76
|
+
"Repeatable set columns will not be included in the export unless the",
|
77
|
+
' ',
|
78
|
+
React.createElement("b", null, "Output a row per repeatable set entry"),
|
79
|
+
" option is turned on under ",
|
80
|
+
React.createElement("b", null, "Column Configuration"),
|
81
|
+
".")),
|
78
82
|
React.createElement(DialogActions, null,
|
79
83
|
React.createElement(Button, { onClick: cancelPromptDownloadCsv, variant: "text" }, "Cancel"),
|
80
84
|
React.createElement(Button, { onClick: downloadCsv, startIcon: React.createElement(CsvIcon, null), color: "primary", variant: "contained" }, "Download")))));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OneBlinkFormStoreDownloadButton.js","sourceRoot":"","sources":["../../../src/components/formStore/OneBlinkFormStoreDownloadButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,OAAO,EACP,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AAEjE,SAAS,+BAA+B,CACtC,KAAiD;IAEjD,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,wBAAwB,EAAE,CAAA;IACvE,MAAM,CACJ,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,EACjE,QAAQ,EACT,GAAG,KAAK,CAAC,QAAQ,CAIf;QACD,gBAAgB,EAAE,KAAK;QACvB,sBAAsB,EAAE,KAAK;QAC7B,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,QAAQ,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YA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BAAmB,EAAE,IAAI;gBACzB,sBAAsB,EAAE,IAAI;aAC7B,CAAC,CAAC,CAAA;YACH,OAAM;SACP;QACD,WAAW,EAAE,CAAA;IACf,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC,CAAA;IAElE,MAAM,uBAAuB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACrD,QAAQ,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YAC1B,GAAG,YAAY;YACf,sBAAsB,EAAE,KAAK;SAC9B,CAAC,CAAC,CAAA;IACL,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL;QACE,oBAAC,OAAO,IAAC,KAAK,EAAC,wCAAwC;YACrD,oBAAC,aAAa,IACZ,SAAS,EAAC,mCAAmC,EAC7C,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAC,OAAO,EACvB,SAAS,EAAE,oBAAC,OAAO,OAAG,EACtB,OAAO,EAAE,iBAAiB;gBAC1B,kDAAkD;gBAClD,QAAQ,EAAE,qDAAa,KACnB,KAAK,GACT,CACM;QAEV,oBAAC,aAAa,IAAC,IAAI,EAAE,CAAC,CAAC,mBAAmB,EAAE,OAAO,EAAE,UAAU;YAC7D,8CAAmB,2BAA2B,IAC3C,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,CAC9C,CACO;QAEhB,oBAAC,MAAM,IACL,IAAI,EAAE,sBAAsB,EAC5B,QAAQ,EAAC,IAAI,EACb,SAAS,QACT,OAAO,EAAE,uBAAuB;YAEhC,oBAAC,WAAW,+BAAmC;YAC/C,oBAAC,aAAa;gBACZ,oBAAC,iBAAiB,
|
1
|
+
{"version":3,"file":"OneBlinkFormStoreDownloadButton.js","sourceRoot":"","sources":["../../../src/components/formStore/OneBlinkFormStoreDownloadButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;A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OAAO,IAAC,KAAK,EAAC,wCAAwC;YACrD,oBAAC,aAAa,IACZ,SAAS,EAAC,mCAAmC,EAC7C,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAC,OAAO,EACvB,SAAS,EAAE,oBAAC,OAAO,OAAG,EACtB,OAAO,EAAE,iBAAiB;gBAC1B,kDAAkD;gBAClD,QAAQ,EAAE,qDAAa,KACnB,KAAK,GACT,CACM;QAEV,oBAAC,aAAa,IAAC,IAAI,EAAE,CAAC,CAAC,mBAAmB,EAAE,OAAO,EAAE,UAAU;YAC7D,8CAAmB,2BAA2B,IAC3C,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,CAC9C,CACO;QAEhB,oBAAC,MAAM,IACL,IAAI,EAAE,sBAAsB,EAC5B,QAAQ,EAAC,IAAI,EACb,SAAS,QACT,OAAO,EAAE,uBAAuB;YAEhC,oBAAC,WAAW,+BAAmC;YAC/C,oBAAC,aAAa;gBACZ,oBAAC,iBAAiB;;oBACqD,GAAG;oBACxE,uEAA4C;;oBACtC,sDAA2B;wBACf,CACN;YAChB,oBAAC,aAAa;gBACZ,oBAAC,MAAM,IAAC,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAC,MAAM,aAE/C;gBACT,oBAAC,MAAM,IACL,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,oBAAC,OAAO,OAAG,EACtB,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,eAGZ,CACK,CACT,CACR,CACJ,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport {\n Tooltip,\n Dialog,\n DialogTitle,\n DialogContent,\n DialogContentText,\n DialogActions,\n Button,\n} from '@mui/material'\nimport { LoadingButton } from '@mui/lab'\nimport CsvIcon from '@mui/icons-material/Download'\nimport ErrorSnackbar from '../ErrorSnackbar'\nimport { ColumnInstance } from 'react-table'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\nimport { formStoreService } from '@oneblink/apps'\nimport useFormStoreTableContext from './useFormStoreTableContext'\n\nfunction OneBlinkFormStoreDownloadButton(\n props: React.ComponentProps<typeof LoadingButton>,\n) {\n const { visibleColumns, parameters, form } = useFormStoreTableContext()\n const [\n { isDownloadingCsv, isPromptingDownloadCsv, downloadingCsvError },\n setState,\n ] = React.useState<{\n isDownloadingCsv: boolean\n isPromptingDownloadCsv: boolean\n downloadingCsvError: Error | null\n }>({\n isDownloadingCsv: false,\n isPromptingDownloadCsv: false,\n downloadingCsvError: null,\n })\n\n const clearError = React.useCallback(() => {\n setState((currentState) => ({\n ...currentState,\n downloadingCsvError: null,\n }))\n }, [])\n\n const downloadCsv = React.useCallback(async () => {\n setState({\n isPromptingDownloadCsv: false,\n isDownloadingCsv: true,\n downloadingCsvError: null,\n })\n try {\n await formStoreService.exportFormStoreRecords(form.name, {\n formId: form.id,\n includeColumns: visibleColumns.map(\n (visibleColumn: ColumnInstance<FormStoreRecord>) => visibleColumn.id,\n ),\n ...parameters,\n })\n setState((currentState) => ({\n ...currentState,\n isDownloadingCsv: false,\n downloadingCsvError: null,\n }))\n } catch (error) {\n setState((currentState) => ({\n ...currentState,\n isDownloadingCsv: false,\n downloadingCsvError: error as Error,\n }))\n }\n }, [form, parameters, visibleColumns])\n\n const promptDownloadCsv = React.useCallback(() => {\n if (\n !parameters.unwindRepeatableSets &&\n visibleColumns.some((c) => c.formElementType === 'repeatableSet')\n ) {\n setState((currentState) => ({\n ...currentState,\n downloadingCsvError: null,\n isPromptingDownloadCsv: true,\n }))\n return\n }\n downloadCsv()\n }, [downloadCsv, parameters.unwindRepeatableSets, visibleColumns])\n\n const cancelPromptDownloadCsv = React.useCallback(() => {\n setState((currentState) => ({\n ...currentState,\n isPromptingDownloadCsv: false,\n }))\n }, [])\n\n return (\n <>\n <Tooltip title=\"Download submission data as a CSV file\">\n <LoadingButton\n className=\"ob-form-store-download-csv-button\"\n type=\"button\"\n loading={isDownloadingCsv}\n loadingPosition=\"start\"\n startIcon={<CsvIcon />}\n onClick={promptDownloadCsv}\n // eslint-disable-next-line react/no-children-prop\n children={<>Download</>}\n {...props}\n />\n </Tooltip>\n\n <ErrorSnackbar open={!!downloadingCsvError} onClose={clearError}>\n <span data-cypress=\"edit-dialog-error-message\">\n {downloadingCsvError && downloadingCsvError.message}\n </span>\n </ErrorSnackbar>\n\n <Dialog\n open={isPromptingDownloadCsv}\n maxWidth=\"sm\"\n fullWidth\n onClose={cancelPromptDownloadCsv}\n >\n <DialogTitle>Column Configuration</DialogTitle>\n <DialogContent>\n <DialogContentText>\n Repeatable set columns will not be included in the export unless the{' '}\n <b>Output a row per repeatable set entry</b> option is turned on\n under <b>Column Configuration</b>.\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button onClick={cancelPromptDownloadCsv} variant=\"text\">\n Cancel\n </Button>\n <Button\n onClick={downloadCsv}\n startIcon={<CsvIcon />}\n color=\"primary\"\n variant=\"contained\"\n >\n Download\n </Button>\n </DialogActions>\n </Dialog>\n </>\n )\n}\nexport default React.memo(OneBlinkFormStoreDownloadButton)\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oneblink/apps-react",
|
3
3
|
"description": "Helper functions for OneBlink apps in ReactJS.",
|
4
|
-
"version": "1.2.0
|
4
|
+
"version": "1.2.0",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|