@oneblink/apps-react 1.0.0-beta.2 → 1.0.0-beta.5
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/CopyToClipboardIconButton.js +6 -15
- package/dist/components/CopyToClipboardIconButton.js.map +1 -1
- package/dist/components/CustomAccordion.d.ts +4 -4
- package/dist/components/CustomAccordion.js +29 -34
- package/dist/components/CustomAccordion.js.map +1 -1
- package/dist/components/ErrorSnackbar.d.ts +3 -3
- package/dist/components/ErrorSnackbar.js +22 -45
- package/dist/components/ErrorSnackbar.js.map +1 -1
- package/dist/components/Lists.d.ts +19 -4
- package/dist/components/Lists.js +40 -38
- package/dist/components/Lists.js.map +1 -1
- package/dist/components/formStore/FormStoreTableProvider.d.ts +6 -0
- package/dist/components/formStore/FormStoreTableProvider.js +86 -0
- package/dist/components/formStore/FormStoreTableProvider.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +16 -0
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -0
- package/dist/components/formStore/{ColumnsConfigurationButton.js → OneBlinkFormStoreColumnsButton.js} +8 -4
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -0
- package/dist/components/formStore/{DownloadSubmissionDataButton.js → OneBlinkFormStoreDownloadButton.js} +8 -4
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.js +25 -0
- package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +12 -0
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.js +184 -0
- package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -0
- package/dist/components/formStore/table/FormElementTableCell.js +28 -8
- package/dist/components/formStore/table/FormElementTableCell.js.map +1 -1
- package/dist/components/formStore/table/RepeatableSetCell.d.ts +0 -1
- package/dist/components/formStore/table/RepeatableSetCell.js +23 -25
- package/dist/components/formStore/table/RepeatableSetCell.js.map +1 -1
- package/dist/components/formStore/table/TableCellCopyButton.js +15 -18
- package/dist/components/formStore/table/TableCellCopyButton.js.map +1 -1
- package/dist/components/formStore/table/generateColumns.js.map +1 -1
- package/dist/components/formStore/table/useFormStoreTable.d.ts +43 -3
- package/dist/components/formStore/table/useFormStoreTable.js +11 -2
- package/dist/components/formStore/table/useFormStoreTable.js.map +1 -1
- package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -0
- package/dist/components/formStore/useFormStoreTableContext.js +10 -0
- package/dist/components/formStore/useFormStoreTableContext.js.map +1 -0
- package/dist/components/{ErrorMessage.d.ts → messages/ErrorMessage.d.ts} +2 -3
- package/dist/components/{ErrorMessage.js → messages/ErrorMessage.js} +1 -1
- package/dist/components/messages/ErrorMessage.js.map +1 -0
- package/dist/components/messages/LargeIconMessage.d.ts +4 -3
- package/dist/components/messages/LargeIconMessage.js +31 -61
- package/dist/components/messages/LargeIconMessage.js.map +1 -1
- package/dist/components/{NoResourcesYet.d.ts → messages/NoResourcesYet.d.ts} +2 -3
- package/dist/components/{NoResourcesYet.js → messages/NoResourcesYet.js} +1 -1
- package/dist/components/messages/NoResourcesYet.js.map +1 -0
- package/dist/form-elements/FormElementDate.js +1 -1
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
- package/dist/OneBlinkFormStoreView.d.ts +0 -8
- package/dist/OneBlinkFormStoreView.js +0 -55
- package/dist/OneBlinkFormStoreView.js.map +0 -1
- package/dist/components/ErrorMessage.js.map +0 -1
- package/dist/components/NoResourcesYet.js.map +0 -1
- package/dist/components/formStore/ColumnsConfigurationButton.d.ts +0 -10
- package/dist/components/formStore/ColumnsConfigurationButton.js.map +0 -1
- package/dist/components/formStore/DownloadSubmissionDataButton.d.ts +0 -13
- package/dist/components/formStore/DownloadSubmissionDataButton.js.map +0 -1
- package/dist/components/formStore/FormStore.d.ts +0 -9
- package/dist/components/formStore/FormStore.js +0 -103
- package/dist/components/formStore/FormStore.js.map +0 -1
- package/dist/components/formStore/table/index.d.ts +0 -17
- package/dist/components/formStore/table/index.js +0 -194
- package/dist/components/formStore/table/index.js.map +0 -1
- package/dist/hooks/useLegacyElements.d.ts +0 -16
- package/dist/hooks/useLegacyElements.js +0 -55
- package/dist/hooks/useLegacyElements.js.map +0 -1
@@ -1,10 +1,11 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
declare type
|
2
|
+
declare type Variant = 'primary' | 'success' | 'error' | 'warning';
|
3
|
+
export declare type Props = {
|
3
4
|
IconComponent: React.ComponentType<{
|
4
|
-
|
5
|
+
color: Variant;
|
5
6
|
}>;
|
6
7
|
title: string;
|
7
|
-
variant:
|
8
|
+
variant: Variant;
|
8
9
|
gutterTop?: boolean;
|
9
10
|
gutterBottom?: boolean;
|
10
11
|
children?: React.ReactNode;
|
@@ -1,68 +1,38 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import clsx from 'clsx';
|
3
|
-
import makeStyles from '@mui/styles/makeStyles';
|
4
2
|
import { Typography, Grid, Container } from '@mui/material';
|
5
|
-
|
6
|
-
const useStyles = makeStyles((theme) => ({
|
7
|
-
gutterTop: {
|
8
|
-
paddingTop: theme.spacing(4),
|
9
|
-
},
|
10
|
-
gutterBottom: {
|
11
|
-
marginBottom: theme.spacing(4),
|
12
|
-
},
|
13
|
-
iconContainer: {
|
14
|
-
textAlign: 'center',
|
15
|
-
},
|
16
|
-
icon: {
|
17
|
-
fontSize: theme.spacing(16),
|
18
|
-
},
|
19
|
-
primaryText: {
|
20
|
-
color: theme.palette.primary.main,
|
21
|
-
},
|
22
|
-
successText: {
|
23
|
-
color: theme.palette.success.main,
|
24
|
-
},
|
25
|
-
errorText: {
|
26
|
-
color: theme.palette.error.main,
|
27
|
-
},
|
28
|
-
warningText: {
|
29
|
-
color: theme.palette.warning.main,
|
30
|
-
},
|
31
|
-
}));
|
32
|
-
// TODO: Come back to this
|
33
|
-
// interface StyledIconContainerProps {
|
34
|
-
// gutterTop?: boolean
|
35
|
-
// }
|
36
|
-
// const StyledIconContainer = styled('div', {
|
37
|
-
// shouldForwardProp: (prop) => prop !== 'gutterTop',
|
38
|
-
// })<StyledIconContainerProps>(({ theme, gutterTop }) => ({
|
39
|
-
// textAlign: 'center',
|
40
|
-
// ...(gutterTop
|
41
|
-
// ? {
|
42
|
-
// paddingTop: theme.spacing(4),
|
43
|
-
// }
|
44
|
-
// : {}),
|
45
|
-
// }))
|
3
|
+
import { styled } from '@mui/material/styles';
|
46
4
|
function LargeIconMessage({ IconComponent, title, variant, gutterTop, gutterBottom, children, action, }) {
|
47
|
-
const
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
[classes.warningText]: variant === 'warning',
|
53
|
-
});
|
5
|
+
const Icon = React.useMemo(() => {
|
6
|
+
return styled(IconComponent)(({ theme }) => ({
|
7
|
+
fontSize: theme.spacing(16),
|
8
|
+
}));
|
9
|
+
}, [IconComponent]);
|
54
10
|
return (React.createElement(Container, { maxWidth: "sm" },
|
55
|
-
React.createElement(
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
React.createElement(
|
60
|
-
children ? (React.createElement(Typography, { align: "center", variant: "body2", paragraph: !!action, className: clsx({
|
61
|
-
[classes.gutterBottom]: !action && gutterBottom,
|
62
|
-
}) }, children)) : null,
|
63
|
-
action && (React.createElement(Grid, { container: true, justifyContent: "center", className: clsx({
|
64
|
-
[classes.gutterBottom]: gutterBottom,
|
65
|
-
}) }, action))));
|
11
|
+
React.createElement(StyledIconContainer, { gutterTop: gutterTop },
|
12
|
+
React.createElement(Icon, { color: variant })),
|
13
|
+
React.createElement(Typography, { variant: "h5", align: "center", gutterBottom: true, color: variant }, title),
|
14
|
+
children ? (React.createElement(StyledTypography, { align: "center", variant: "body2", paragraph: !!action, gutterBottom: !action && gutterBottom }, children)) : null,
|
15
|
+
action && (React.createElement(StyledGrid, { container: true, justifyContent: "center", gutterBottom: gutterBottom }, action))));
|
66
16
|
}
|
67
17
|
export default React.memo(LargeIconMessage);
|
18
|
+
const StyledIconContainer = styled('div', {
|
19
|
+
shouldForwardProp: (prop) => prop !== 'gutterTop',
|
20
|
+
})(({ theme, gutterTop }) => ({
|
21
|
+
textAlign: 'center',
|
22
|
+
...(gutterTop
|
23
|
+
? {
|
24
|
+
paddingTop: theme.spacing(4),
|
25
|
+
}
|
26
|
+
: {}),
|
27
|
+
}));
|
28
|
+
const StyledTypography = styled(Typography, {
|
29
|
+
shouldForwardProp: (prop) => prop !== 'gutterBottom',
|
30
|
+
})(({ theme, gutterBottom }) => ({
|
31
|
+
...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),
|
32
|
+
}));
|
33
|
+
const StyledGrid = styled(Grid, {
|
34
|
+
shouldForwardProp: (prop) => prop !== 'gutterBottom',
|
35
|
+
})(({ theme, gutterBottom }) => ({
|
36
|
+
...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),
|
37
|
+
}));
|
68
38
|
//# sourceMappingURL=LargeIconMessage.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LargeIconMessage.js","sourceRoot":"","sources":["../../../src/components/messages/LargeIconMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,
|
1
|
+
{"version":3,"file":"LargeIconM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material'\nimport { styled } from '@mui/material/styles'\n\ntype Variant = 'primary' | 'success' | 'error' | 'warning'\nexport type Props = {\n IconComponent: React.ComponentType<{ color: Variant }>\n title: string\n variant: Variant\n gutterTop?: boolean\n gutterBottom?: boolean\n children?: React.ReactNode\n action?: React.ReactNode\n}\n\nfunction LargeIconMessage({\n IconComponent,\n title,\n variant,\n gutterTop,\n gutterBottom,\n children,\n action,\n}: Props) {\n const Icon = React.useMemo(() => {\n return styled(IconComponent)(({ theme }) => ({\n fontSize: theme.spacing(16),\n }))\n }, [IconComponent])\n\n return (\n <Container maxWidth=\"sm\">\n <StyledIconContainer gutterTop={gutterTop}>\n <Icon color={variant} />\n </StyledIconContainer>\n <Typography variant=\"h5\" align=\"center\" gutterBottom color={variant}>\n {title}\n </Typography>\n {children ? (\n <StyledTypography\n align=\"center\"\n variant=\"body2\"\n paragraph={!!action}\n gutterBottom={!action && gutterBottom}\n >\n {children}\n </StyledTypography>\n ) : null}\n {action && (\n <StyledGrid\n container\n justifyContent=\"center\"\n gutterBottom={gutterBottom}\n >\n {action}\n </StyledGrid>\n )}\n </Container>\n )\n}\n\nexport default React.memo<Props>(LargeIconMessage)\n\nconst StyledIconContainer = styled('div', {\n shouldForwardProp: (prop) => prop !== 'gutterTop',\n})<{\n gutterTop?: boolean\n}>(({ theme, gutterTop }) => ({\n textAlign: 'center',\n ...(gutterTop\n ? {\n paddingTop: theme.spacing(4),\n }\n : {}),\n}))\n\nconst StyledTypography = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'gutterBottom',\n})<React.ComponentProps<typeof Typography>>(({ theme, gutterBottom }) => ({\n ...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),\n}))\n\nconst StyledGrid = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'gutterBottom',\n})<{ gutterBottom?: boolean }>(({ theme, gutterBottom }) => ({\n ...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),\n}))\n"]}
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import { Props as LargeIconMessageProps } from './LargeIconMessage';
|
2
3
|
declare type Props = {
|
3
|
-
IconComponent:
|
4
|
-
className: string;
|
5
|
-
}>;
|
4
|
+
IconComponent: LargeIconMessageProps['IconComponent'];
|
6
5
|
title: string;
|
7
6
|
gutterBottom?: boolean;
|
8
7
|
children?: React.ReactNode;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import LargeIconMessage from './
|
2
|
+
import LargeIconMessage from './LargeIconMessage';
|
3
3
|
export function NoResourcesYet({ title, children, IconComponent, gutterBottom, }) {
|
4
4
|
return (React.createElement(LargeIconMessage, { IconComponent: IconComponent, title: title, variant: "primary", gutterBottom: gutterBottom, gutterTop: true }, children));
|
5
5
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NoResourcesYet.js","sourceRoot":"","sources":["../../../src/components/messages/NoResourcesYet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAEN,MAAM,oBAAoB,CAAA;AAO3B,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,YAAY,GACN;IACN,OAAO,CACL,oBAAC,gBAAgB,IACf,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAC,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,SAAS,UAER,QAAQ,CACQ,CACpB,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAQ,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport LargeIconMessage, {\n Props as LargeIconMessageProps,\n} from './LargeIconMessage'\ntype Props = {\n IconComponent: LargeIconMessageProps['IconComponent']\n title: string\n gutterBottom?: boolean\n children?: React.ReactNode\n}\nexport function NoResourcesYet({\n title,\n children,\n IconComponent,\n gutterBottom,\n}: Props) {\n return (\n <LargeIconMessage\n IconComponent={IconComponent}\n title={title}\n variant=\"primary\"\n gutterBottom={gutterBottom}\n gutterTop\n >\n {children}\n </LargeIconMessage>\n )\n}\nexport default React.memo<Props>(NoResourcesYet)\n"]}
|
@@ -13,7 +13,7 @@ function FormElementDate({ id, element, value, onChange, validationMessage, disp
|
|
13
13
|
const opts = {
|
14
14
|
altInput: true,
|
15
15
|
dateFormat: 'Y-m-d',
|
16
|
-
altFormat: localisationService.
|
16
|
+
altFormat: localisationService.getFlatpickrFormats().shortDate,
|
17
17
|
allowInput: true,
|
18
18
|
altInputClass: 'input ob-input cypress-date-control',
|
19
19
|
minDate: parseDateValue({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementDate.js","sourceRoot":"","sources":["../../src/form-elements/FormElementDate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,qBAAqB,MAAM,8CAA8C,CAAA;AAChF,OAAO,YAAkC,MAAM,uBAAuB,CAAA;AACtE,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,YAAY,MAAM,qCAAqC,CAAA;AAE9D,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAYhF,SAAS,eAAe,CAAC,EACvB,EAAE,EACF,OAAO,EACP,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,wBAAwB,GAClB;IACN,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAA;IAE5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAEpD,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,IAAI,GAAqB;YAC7B,QAAQ,EAAE,IAAI;Y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kB;gBAC/B,6BAAK,SAAS,EAAC,qCAAqC;oBAClD,+BACE,IAAI,EAAC,MAAM,EACX,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,WAAW,EAAE,OAAO,CAAC,gBAAgB,EACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,SAAS,EAAC,gBAAgB,GAC1B;oBACF,8BAAM,SAAS,EAAC,sCAAsC;wBACpD,2BAAG,SAAS,EAAC,0BAA0B,YAAU,CAC5C,CACH;gBACL,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,CAC/B,6BAAK,SAAS,EAAC,SAAS;oBACtB,oBAAC,qBAAqB,IACpB,SAAS,EAAC,wDAAwD,EAClE,aAAa,QACb,IAAI,EAAE,IAAI,GACV,CACE,CACP;gBACD,oBAAC,YAAY,IACX,aAAa,QACb,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,GACpC,CACE;YAEL,CAAC,OAAO,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC,iBAAiB,IAAI,CAC/D,6BAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,kBAAkB;gBAC5C,6BAAK,SAAS,EAAC,2DAA2D,IACvE,iBAAiB,CACd,CACF,CACP,CACyB,CACxB,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { localisationService } from '@oneblink/apps'\n\nimport CopyToClipboardButton from '../components/renderer/CopyToClipboardButton'\nimport useFlatpickr, { FlatpickrOptions } from '../hooks/useFlatpickr'\nimport useBooleanState from '../hooks/useBooleanState'\nimport LookupButton from '../components/renderer/LookupButton'\nimport { FormTypes } from '@oneblink/types'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { generateDate, parseDateValue } from '../services/generate-default-data'\nimport { FormElementValueChangeHandler } from '../types/form'\n\ntype Props = {\n id: string\n element: FormTypes.DateElement\n value: unknown | undefined\n onChange: FormElementValueChangeHandler<string>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\nfunction FormElementDate({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n}: Props) {\n const htmlDivElementRef = React.useRef<HTMLDivElement>(null)\n\n const [isDirty, setIsDirty] = useBooleanState(false)\n\n const flatpickrOptions = React.useMemo(() => {\n const opts: FlatpickrOptions = {\n altInput: true,\n dateFormat: 'Y-m-d',\n altFormat: localisationService.getFlatpickrFormats().shortDate,\n allowInput: true,\n altInputClass: 'input ob-input cypress-date-control',\n minDate: parseDateValue({\n dateOnly: false,\n daysOffset: element.fromDateDaysOffset,\n value: element.fromDate,\n }),\n maxDate: parseDateValue({\n dateOnly: false,\n daysOffset: element.toDateDaysOffset,\n value: element.toDate,\n }),\n defaultDate: undefined,\n allowInvalidPreload: true,\n onClose: setIsDirty,\n }\n\n return opts\n }, [\n element.fromDate,\n element.fromDateDaysOffset,\n element.toDate,\n element.toDateDaysOffset,\n setIsDirty,\n ])\n\n const handleChange = React.useCallback(\n (newValue) => onChange(element, newValue),\n [element, onChange],\n )\n\n useFlatpickr(\n {\n id,\n value,\n onChange: handleChange,\n dateOnly: true,\n },\n flatpickrOptions,\n htmlDivElementRef,\n )\n\n const text = React.useMemo(() => {\n if (typeof value === 'string') {\n const date = generateDate({\n daysOffset: undefined,\n value,\n dateOnly: true,\n })\n if (date) {\n return localisationService.formatDate(date)\n }\n }\n return null\n }, [value])\n\n return (\n <div className=\"cypress-date-element\" ref={htmlDivElementRef}>\n <FormElementLabelContainer\n className=\"ob-date\"\n id={id}\n element={element}\n required={element.required}\n >\n <div className=\"field has-addons\">\n <div className=\"control is-expanded has-icons-right\">\n <input\n type=\"date\"\n id={id}\n name={element.name}\n placeholder={element.placeholderValue}\n disabled={element.readOnly}\n className=\"input ob-input\"\n />\n <span className=\"ob-input-icon icon is-small is-right\">\n <i className=\"material-icons is-size-5\">event</i>\n </span>\n </div>\n {!!element.readOnly && !!text && (\n <div className=\"control\">\n <CopyToClipboardButton\n className=\"button is-input-addon cypress-copy-to-clipboard-button\"\n isInputButton\n text={text}\n />\n </div>\n )}\n <LookupButton\n isInputButton\n value={value}\n validationMessage={validationMessage}\n />\n </div>\n\n {(isDirty || displayValidationMessage) && !!validationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(FormElementDate)\n"]}
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
export { OneBlinkFormUncontrolled as OneBlinkForm, OneBlinkFormControlled, } from './OneBlinkForm';
|
2
2
|
export { default as OneBlinkAutoSaveForm } from './OneBlinkAutoSaveForm';
|
3
3
|
export { default as OneBlinkReadOnlyForm } from './OneBlinkReadOnlyForm';
|
4
|
-
export {
|
4
|
+
export { OneBlinkFormStoreProvider } from './components/formStore/OneBlinkFormStoreProvider';
|
5
|
+
export { default as OneBlinkFormStoreClearFiltersButton } from './components/formStore/OneBlinkFormStoreClearFiltersButton';
|
6
|
+
export { default as OneBlinkFormStoreColumnsButton } from './components/formStore/OneBlinkFormStoreColumnsButton';
|
7
|
+
export { default as OneBlinkFormStoreDownloadButton } from './components/formStore/OneBlinkFormStoreDownloadButton';
|
8
|
+
export { default as OneBlinkFormStoreRefreshButton } from './components/formStore/OneBlinkFormStoreRefreshButton';
|
9
|
+
export { default as OneBlinkFormStoreTable } from './components/formStore/OneBlinkFormStoreTable';
|
5
10
|
export { default as useIsMounted } from './hooks/useIsMounted';
|
6
11
|
export { default as useBooleanState } from './hooks/useBooleanState';
|
7
12
|
export { default as useNullableState } from './hooks/useNullableState';
|
package/dist/index.js
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
export { OneBlinkFormUncontrolled as OneBlinkForm, OneBlinkFormControlled, } from './OneBlinkForm';
|
2
2
|
export { default as OneBlinkAutoSaveForm } from './OneBlinkAutoSaveForm';
|
3
3
|
export { default as OneBlinkReadOnlyForm } from './OneBlinkReadOnlyForm';
|
4
|
-
export {
|
4
|
+
export { OneBlinkFormStoreProvider } from './components/formStore/OneBlinkFormStoreProvider';
|
5
|
+
export { default as OneBlinkFormStoreClearFiltersButton } from './components/formStore/OneBlinkFormStoreClearFiltersButton';
|
6
|
+
export { default as OneBlinkFormStoreColumnsButton } from './components/formStore/OneBlinkFormStoreColumnsButton';
|
7
|
+
export { default as OneBlinkFormStoreDownloadButton } from './components/formStore/OneBlinkFormStoreDownloadButton';
|
8
|
+
export { default as OneBlinkFormStoreRefreshButton } from './components/formStore/OneBlinkFormStoreRefreshButton';
|
9
|
+
export { default as OneBlinkFormStoreTable } from './components/formStore/OneBlinkFormStoreTable';
|
5
10
|
export { default as useIsMounted } from './hooks/useIsMounted';
|
6
11
|
export { default as useBooleanState } from './hooks/useBooleanState';
|
7
12
|
export { default as useNullableState } from './hooks/useNullableState';
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,IAAI,YAAY,EACxC,sBAAsB,GACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,IAAI,YAAY,EACxC,sBAAsB,GACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,oB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OAAO,IAAI,yBAAyB,EAAE,MAAM,6CAA6C,CAAA","sourcesContent":["export {\n OneBlinkFormUncontrolled as OneBlinkForm,\n OneBlinkFormControlled,\n} from './OneBlinkForm'\nexport { default as OneBlinkAutoSaveForm } from './OneBlinkAutoSaveForm'\nexport { default as OneBlinkReadOnlyForm } from './OneBlinkReadOnlyForm'\nexport { OneBlinkFormStoreProvider } from './components/formStore/OneBlinkFormStoreProvider'\nexport { default as OneBlinkFormStoreClearFiltersButton } from './components/formStore/OneBlinkFormStoreClearFiltersButton'\nexport { default as OneBlinkFormStoreColumnsButton } from './components/formStore/OneBlinkFormStoreColumnsButton'\nexport { default as OneBlinkFormStoreDownloadButton } from './components/formStore/OneBlinkFormStoreDownloadButton'\nexport { default as OneBlinkFormStoreRefreshButton } from './components/formStore/OneBlinkFormStoreRefreshButton'\nexport { default as OneBlinkFormStoreTable } from './components/formStore/OneBlinkFormStoreTable'\n\nexport { default as useIsMounted } from './hooks/useIsMounted'\nexport { default as useBooleanState } from './hooks/useBooleanState'\nexport { default as useNullableState } from './hooks/useNullableState'\nexport { default as useClickOutsideElement } from './hooks/useClickOutsideElement'\nexport {\n default as useIsOffline,\n IsOfflineContextProvider,\n} from './hooks/useIsOffline'\nexport { default as useLogin } from './hooks/useLogin'\nexport { default as useAuth, AuthContextProvider } from './hooks/useAuth'\nexport { default as useLoadDataState } from './hooks/useLoadDataState'\nexport { default as useFormSubmissionState } from './hooks/useFormSubmissionState'\nexport { default as useFormSubmissionAutoSaveState } from './hooks/useFormSubmissionAutoSaveState'\n\nexport { default as MuiV4CompatibleDatePicker } from './components/pickers/V4CompatibleDatePicker'\nexport { default as MuiV4CompatibleDateTimePicker } from './components/pickers/V4CompatibleDateTimePicker'\nexport { default as MuiV4CompatibleTimePicker } from './components/pickers/V4CompatibleTimePicker'\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.0.0-beta.
|
4
|
+
"version": "1.0.0-beta.5",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|
@@ -11,10 +11,6 @@
|
|
11
11
|
"@emotion/react": "^11.9.0",
|
12
12
|
"@emotion/styled": "^11.8.1",
|
13
13
|
"@mui/icons-material": "^5.6.2",
|
14
|
-
"@mui/lab": "^5.0.0-alpha.79",
|
15
|
-
"@mui/material": "^5.6.1",
|
16
|
-
"@mui/styles": "^5.6.2",
|
17
|
-
"@mui/x-date-pickers": "^5.0.0-alpha.1",
|
18
14
|
"@oneblink/sdk-core": "^0.4.0",
|
19
15
|
"@react-google-maps/api": "2.7.0",
|
20
16
|
"blueimp-load-image": "^5.16.0",
|
@@ -48,6 +44,9 @@
|
|
48
44
|
},
|
49
45
|
"devDependencies": {
|
50
46
|
"@babel/preset-env": "^7.16.11",
|
47
|
+
"@mui/lab": "^5.0.0-alpha.79",
|
48
|
+
"@mui/material": "^5.6.1",
|
49
|
+
"@mui/x-date-pickers": "^5.0.0-alpha.2",
|
51
50
|
"@oneblink/apps": "^1.0.0-beta.1",
|
52
51
|
"@oneblink/release-cli": "^1.0.0",
|
53
52
|
"@oneblink/types": "github:oneblink/types",
|
@@ -99,6 +98,9 @@
|
|
99
98
|
"main": "./dist/index.js",
|
100
99
|
"module": "./dist/index.js",
|
101
100
|
"peerDependencies": {
|
101
|
+
"@mui/lab": "^5.0.0 || ^5.0.0-alpha.79",
|
102
|
+
"@mui/material": "^5.6.1",
|
103
|
+
"@mui/x-date-pickers": "^5.0.0 || ^5.0.0-alpha.2",
|
102
104
|
"@oneblink/apps": "^1.0.0 || ^1.0.0-beta.1",
|
103
105
|
"react": "^17.0.0",
|
104
106
|
"react-dom": "^17.0.0",
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { FormTypes } from '@oneblink/types';
|
3
|
-
interface Props {
|
4
|
-
form: FormTypes.Form;
|
5
|
-
}
|
6
|
-
declare function FormStoreContainer({ form }: Props): JSX.Element;
|
7
|
-
declare const _default: React.MemoExoticComponent<typeof FormStoreContainer>;
|
8
|
-
export default _default;
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import LoadingWithMessage from './components/LoadingWithMessage';
|
3
|
-
import ErrorMessage from './components/ErrorMessage';
|
4
|
-
import FormStore from './components/formStore/FormStore';
|
5
|
-
import { formStoreService } from '@oneblink/apps';
|
6
|
-
import WarningIcon from '@mui/icons-material/Warning';
|
7
|
-
import useLoadDataState from './hooks/useLoadDataState';
|
8
|
-
import { Box, Button, Container, Grid, Typography } from '@mui/material';
|
9
|
-
import LargeIconMessage from './components/messages/LargeIconMessage';
|
10
|
-
import { ListItem, UnorderedList } from './components/Lists';
|
11
|
-
import useLegacyFormElements from './hooks/useLegacyElements';
|
12
|
-
function FormStoreContainer({ form }) {
|
13
|
-
const fetchFormStoreDefinition = React.useCallback((abortSignal) => {
|
14
|
-
return formStoreService.getFormStoreDefinition(form.id, abortSignal);
|
15
|
-
}, [form.id]);
|
16
|
-
const [formStoreDefinitionState, onTryAgain] = useLoadDataState(fetchFormStoreDefinition);
|
17
|
-
const { formElementsUsingLegacyStorage, formElementsUsingLegacyNames } = useLegacyFormElements((form === null || form === void 0 ? void 0 : form.elements) || []);
|
18
|
-
if (formStoreDefinitionState.status === 'LOADING') {
|
19
|
-
return React.createElement(LoadingWithMessage, null);
|
20
|
-
}
|
21
|
-
if (formStoreDefinitionState.status === 'ERROR') {
|
22
|
-
return (React.createElement(React.Fragment, null,
|
23
|
-
React.createElement(ErrorMessage, { title: "Error Retrieving Form Definition", gutterTop: true }, formStoreDefinitionState.error.message),
|
24
|
-
React.createElement(Grid, { container: true, justifyContent: "center" },
|
25
|
-
React.createElement(Button, { variant: "outlined", color: "primary", onClick: () => onTryAgain() }, "Try Again"))));
|
26
|
-
}
|
27
|
-
if (formElementsUsingLegacyStorage.length ||
|
28
|
-
formElementsUsingLegacyNames.length) {
|
29
|
-
return (React.createElement(React.Fragment, null,
|
30
|
-
React.createElement(LargeIconMessage, { IconComponent: WarningIcon, title: "Incompatible Form Elements", variant: "warning", gutterTop: true, gutterBottom: true }, "This Form has Element(s) that are incompatible with Data Manager. If you would like to be able to view submissions for this Form, please follow the instructions below to ensure your Form is compatible."),
|
31
|
-
React.createElement(Container, { maxWidth: "sm" },
|
32
|
-
!!formElementsUsingLegacyStorage.length && (React.createElement(React.Fragment, null,
|
33
|
-
React.createElement(Typography, { variant: "body2" },
|
34
|
-
"The following Element(s) are using the ",
|
35
|
-
React.createElement("b", null, "Embedded"),
|
36
|
-
" storage type. Please update them to use either the Private or Public storage type."),
|
37
|
-
React.createElement(Box, { marginBottom: 1 },
|
38
|
-
React.createElement(UnorderedList, null, formElementsUsingLegacyStorage.map(({ name, label }, index) => (React.createElement(ListItem, { key: index },
|
39
|
-
React.createElement("b", null, label),
|
40
|
-
' ',
|
41
|
-
React.createElement(Typography, { component: "span", variant: "body2", color: "textSecondary" }, name)))))))),
|
42
|
-
!!formElementsUsingLegacyNames.length && (React.createElement(React.Fragment, null,
|
43
|
-
React.createElement(Typography, { variant: "body2" },
|
44
|
-
"This following Element(s) have a ",
|
45
|
-
React.createElement("b", null, "Name"),
|
46
|
-
" property with unsupported characters. Please update them to have only letters, numbers, underscores and dashes."),
|
47
|
-
React.createElement(UnorderedList, null, formElementsUsingLegacyNames.map(({ name, label }, index) => (React.createElement(ListItem, { key: index },
|
48
|
-
React.createElement("b", null, label),
|
49
|
-
' ',
|
50
|
-
React.createElement(Typography, { component: "span", variant: "body2", color: "textSecondary" }, name))))))))));
|
51
|
-
}
|
52
|
-
return (React.createElement(FormStore, { form: form, formElements: formStoreDefinitionState.result.formElements }));
|
53
|
-
}
|
54
|
-
export default React.memo(FormStoreContainer);
|
55
|
-
//# sourceMappingURL=OneBlinkFormStoreView.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O,EAAC,OAAO;;wBACQ,sCAAW;2IAGjC;oBACb,oBAAC,aAAa,QACX,4BAA4B,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5D,oBAAC,QAAQ,IAAC,GAAG,EAAE,KAAK;wBAClB,+BAAI,KAAK,CAAK;wBAAC,GAAG;wBAClB,oBAAC,UAAU,IACT,SAAS,EAAC,MAAM,EAChB,OAAO,EAAC,OAAO,EACf,KAAK,EAAC,eAAe,IAEpB,IAAI,CACM,CACJ,CACZ,CAAC,CACY,CACf,CACJ,CACS,CACX,CACJ,CAAA;KACF;IAED,OAAO,CACL,oBAAC,SAAS,IACR,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,wBAAwB,CAAC,MAAM,CAAC,YAAY,GAC1D,CACH,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport LoadingWithMessage from './components/LoadingWithMessage'\nimport ErrorMessage from './components/ErrorMessage'\nimport FormStore from './components/formStore/FormStore'\nimport { formStoreService } from '@oneblink/apps'\nimport WarningIcon from '@mui/icons-material/Warning'\nimport useLoadDataState from './hooks/useLoadDataState'\nimport { Box, Button, Container, Grid, Typography } from '@mui/material'\nimport LargeIconMessage from './components/messages/LargeIconMessage'\nimport { ListItem, UnorderedList } from './components/Lists'\nimport useLegacyFormElements from './hooks/useLegacyElements'\nimport { FormTypes } from '@oneblink/types'\n\ninterface Props {\n form: FormTypes.Form\n}\nfunction FormStoreContainer({ form }: Props) {\n const fetchFormStoreDefinition = React.useCallback(\n (abortSignal?: AbortSignal) => {\n return formStoreService.getFormStoreDefinition(form.id, abortSignal)\n },\n [form.id],\n )\n const [formStoreDefinitionState, onTryAgain] = useLoadDataState(\n fetchFormStoreDefinition,\n )\n\n const { formElementsUsingLegacyStorage, formElementsUsingLegacyNames } =\n useLegacyFormElements(form?.elements || [])\n\n if (formStoreDefinitionState.status === 'LOADING') {\n return <LoadingWithMessage />\n }\n\n if (formStoreDefinitionState.status === 'ERROR') {\n return (\n <>\n <ErrorMessage title=\"Error Retrieving Form Definition\" gutterTop>\n {formStoreDefinitionState.error.message}\n </ErrorMessage>\n <Grid container justifyContent=\"center\">\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => onTryAgain()}\n >\n Try Again\n </Button>\n </Grid>\n </>\n )\n }\n\n if (\n formElementsUsingLegacyStorage.length ||\n formElementsUsingLegacyNames.length\n ) {\n return (\n <>\n <LargeIconMessage\n IconComponent={WarningIcon}\n title=\"Incompatible Form Elements\"\n variant=\"warning\"\n gutterTop\n gutterBottom\n >\n This Form has Element(s) that are incompatible with Data Manager. If\n you would like to be able to view submissions for this Form, please\n follow the instructions below to ensure your Form is compatible.\n </LargeIconMessage>\n <Container maxWidth=\"sm\">\n {!!formElementsUsingLegacyStorage.length && (\n <>\n <Typography variant=\"body2\">\n The following Element(s) are using the <b>Embedded</b> storage\n type. Please update them to use either the Private or Public\n storage type.\n </Typography>\n <Box marginBottom={1}>\n <UnorderedList>\n {formElementsUsingLegacyStorage.map(\n ({ name, label }, index) => (\n <ListItem key={index}>\n <b>{label}</b>{' '}\n <Typography\n component=\"span\"\n variant=\"body2\"\n color=\"textSecondary\"\n >\n {name}\n </Typography>\n </ListItem>\n ),\n )}\n </UnorderedList>\n </Box>\n </>\n )}\n {!!formElementsUsingLegacyNames.length && (\n <>\n <Typography variant=\"body2\">\n This following Element(s) have a <b>Name</b> property with\n unsupported characters. Please update them to have only letters,\n numbers, underscores and dashes.\n </Typography>\n <UnorderedList>\n {formElementsUsingLegacyNames.map(({ name, label }, index) => (\n <ListItem key={index}>\n <b>{label}</b>{' '}\n <Typography\n component=\"span\"\n variant=\"body2\"\n color=\"textSecondary\"\n >\n {name}\n </Typography>\n </ListItem>\n ))}\n </UnorderedList>\n </>\n )}\n </Container>\n </>\n )\n }\n\n return (\n <FormStore\n form={form}\n formElements={formStoreDefinitionState.result.formElements}\n />\n )\n}\n\nexport default React.memo(FormStoreContainer)\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ErrorMessage.js","sourceRoot":"","sources":["../../src/components/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,SAAS,MAAM,2BAA2B,CAAA;AACjD,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAYtC,SAAS,YAAY,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,GACJ;IACN,IAAI,CAAC,aAAa,EAAE;QAClB,aAAa,GAAG,SAAS,CAAA;KAC1B;IAED,OAAO,CACL;QACE,oBAAC,gBAAgB,IACf,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAC,OAAO,EACf,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,MAAM,EACJ,UAAU,IAAI,CACZ,oBAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,gBAGpB,CACV,IAGF,QAAQ,CACQ,CAClB,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,YAAY,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport ErrorIcon from '@mui/icons-material/Error'\nimport LargeIconMessage from './messages/LargeIconMessage'\nimport { Button } from '@mui/material'\ntype Props = {\n IconComponent?: React.ComponentType<{\n className: string\n }>\n title: string\n gutterTop?: boolean\n gutterBottom?: boolean\n children?: React.ReactNode\n onTryAgain?: () => void\n}\n\nfunction ErrorMessage({\n title,\n children,\n gutterTop,\n gutterBottom,\n IconComponent,\n onTryAgain,\n}: Props) {\n if (!IconComponent) {\n IconComponent = ErrorIcon\n }\n\n return (\n <>\n <LargeIconMessage\n IconComponent={IconComponent}\n title={title}\n variant=\"error\"\n gutterTop={gutterTop}\n gutterBottom={gutterBottom}\n action={\n onTryAgain && (\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => onTryAgain()}\n >\n Try Again\n </Button>\n )\n }\n >\n {children}\n </LargeIconMessage>\n </>\n )\n}\n\nexport default React.memo<Props>(ErrorMessage)\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"NoResourcesYet.js","sourceRoot":"","sources":["../../src/components/NoResourcesYet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAS1D,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,YAAY,GACN;IACN,OAAO,CACL,oBAAC,gBAAgB,IACf,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAC,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,SAAS,UAER,QAAQ,CACQ,CACpB,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAQ,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport LargeIconMessage from './messages/LargeIconMessage'\ntype Props = {\n IconComponent: React.ComponentType<{\n className: string\n }>\n title: string\n gutterBottom?: boolean\n children?: React.ReactNode\n}\nexport function NoResourcesYet({\n title,\n children,\n IconComponent,\n gutterBottom,\n}: Props) {\n return (\n <LargeIconMessage\n IconComponent={IconComponent}\n title={title}\n variant=\"primary\"\n gutterBottom={gutterBottom}\n gutterTop\n >\n {children}\n </LargeIconMessage>\n )\n}\nexport default React.memo<Props>(NoResourcesYet)\n"]}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { ColumnInstance } from 'react-table';
|
3
|
-
import { Checkbox } from '@mui/material';
|
4
|
-
import { SubmissionTypes } from '@oneblink/types';
|
5
|
-
declare function ColumnsConfigurationButton({ allColumns, getToggleHideAllColumnsProps, }: {
|
6
|
-
allColumns: ColumnInstance<SubmissionTypes.FormStoreRecord>[];
|
7
|
-
getToggleHideAllColumnsProps: () => React.ComponentProps<typeof Checkbox>;
|
8
|
-
}): JSX.Element;
|
9
|
-
declare const _default: React.MemoExoticComponent<typeof ColumnsConfigurationButton>;
|
10
|
-
export default _default;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ColumnsConfigurationButton.js","sourceRoot":"","sources":["../../../src/components/formStore/ColumnsConfigurationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,eAAe,MAAM,6BAA6B,CAAA;AAGzD,SAAS,0BAA0B,CAAC,EAClC,UAAU,EACV,4BAA4B,GAI7B;IACC,MAAM,CACJ,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACxB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAE1B,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,CAAA;IAEhE,OAAO,CACL;QACE,oBAAC,MAAM,IACL,SAAS,EAAE,oBAAC,YAAY,OAAG,EAC3B,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAC,UAAU,cAGX;QACT,oBAAC,MAAM,IACL,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAC,IAAI,EACb,SAAS,QACT,OAAO,EAAE,uBAAuB;YAEhC,oBAAC,WAAW,+BAAmC;YAC/C,oBAAC,aAAa,IAAC,QAAQ;gBACrB,oBAAC,SAAS;oBACR,oBAAC,gBAAgB,IACf,OAAO,EACL,oBAAC,QAAQ,OACH,yBAAyB,EAC7B,aAAa,EAAE,CAAC,CAAC,yBAAyB,CAAC,aAAa,GACxD,EAEJ,KAAK,EAAE,4CAAiB,GACxB;oBACD,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;wBACzB,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,MAAM,CAAC,EAAE;4BAC5B,oBAAC,gBAAgB,IACf,OAAO,EAAE,oBAAC,QAAQ,OAAK,MAAM,CAAC,oBAAoB,EAAE,GAAI,EACxD,KAAK,EACH;oCACG,MAAM,CAAC,UAAU;oCACjB,MAAM,CAAC,OAAO,IAAI,CACjB,oBAAC,UAAU,IAAC,SAAS,EAAC,MAAM,EAAC,KAAK,EAAC,eAAe;wCAC/C,GAAG;;wCACF,MAAM,CAAC,OAAO;4CACL,CACd,CACA,GAEL,CACa,CAClB,CAAA;oBACH,CAAC,CAAC,CACQ,CACE;YAChB,oBAAC,aAAa;gBACZ,oBAAC,MAAM,IACL,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,WAGZ,CACK,CACT,CACR,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { ColumnInstance } from 'react-table'\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n FormGroup,\n Typography,\n} from '@mui/material'\nimport { Settings as SettingsIcon } from '@mui/icons-material'\nimport useBooleanState from '../../hooks/useBooleanState'\nimport { SubmissionTypes } from '@oneblink/types'\n\nfunction ColumnsConfigurationButton({\n allColumns,\n getToggleHideAllColumnsProps,\n}: {\n allColumns: ColumnInstance<SubmissionTypes.FormStoreRecord>[]\n getToggleHideAllColumnsProps: () => React.ComponentProps<typeof Checkbox>\n}) {\n const [\n isConfiguringColumns,\n showColumnConfiguration,\n hideColumnConfiguration,\n ] = useBooleanState(false)\n\n const toggleHideAllColumnsProps = getToggleHideAllColumnsProps()\n\n return (\n <>\n <Button\n startIcon={<SettingsIcon />}\n onClick={showColumnConfiguration}\n variant=\"outlined\"\n >\n Columns\n </Button>\n <Dialog\n open={isConfiguringColumns}\n maxWidth=\"sm\"\n fullWidth\n onClose={hideColumnConfiguration}\n >\n <DialogTitle>Column Configuration</DialogTitle>\n <DialogContent dividers>\n <FormGroup>\n <FormControlLabel\n control={\n <Checkbox\n {...toggleHideAllColumnsProps}\n indeterminate={!!toggleHideAllColumnsProps.indeterminate}\n />\n }\n label={<b>Toggle All</b>}\n />\n {allColumns.map((column) => {\n return (\n <React.Fragment key={column.id}>\n <FormControlLabel\n control={<Checkbox {...column.getToggleHiddenProps()} />}\n label={\n <>\n {column.headerText}\n {column.tooltip && (\n <Typography component=\"span\" color=\"textSecondary\">\n {' '}\n ({column.tooltip})\n </Typography>\n )}\n </>\n }\n />\n </React.Fragment>\n )\n })}\n </FormGroup>\n </DialogContent>\n <DialogActions>\n <Button\n onClick={hideColumnConfiguration}\n color=\"primary\"\n variant=\"contained\"\n >\n Done\n </Button>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n\nexport default React.memo(ColumnsConfigurationButton)\n"]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Form } from '@oneblink/types/typescript/forms';
|
3
|
-
import { ColumnInstance } from 'react-table';
|
4
|
-
import { FormStoreRecord } from '@oneblink/types/typescript/submissions';
|
5
|
-
import { formStoreService } from '@oneblink/apps';
|
6
|
-
declare function DownloadSubmissionDataButton({ disabled, form, filters, visibleColumns, }: {
|
7
|
-
disabled: boolean;
|
8
|
-
form: Form;
|
9
|
-
filters?: formStoreService.FormStoreFilters;
|
10
|
-
visibleColumns: ColumnInstance<FormStoreRecord>[];
|
11
|
-
}): JSX.Element;
|
12
|
-
declare const _default: React.MemoExoticComponent<typeof DownloadSubmissionDataButton>;
|
13
|
-
export default _default;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DownloadSubmissionDataButton.js","sourceRoot":"","sources":["../../../src/components/formStore/DownloadSubmissionDataButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAElD,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,SAAS,4BAA4B,CAAC,EACpC,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,cAAc,GAMf;IACC,MAAM,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAGzE;QACD,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAA;IACF,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,QAAQ,CAAC;YACP,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,IAAI;SAC1B,CAAC,CAAA;IACJ,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;QAC/C,QAAQ,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAA;QAC/D,IAAI;YACF,MAAM,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE;gBACvD,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,OAAO;gBACP,cAAc,EAAE,cAAc,CAAC,GAAG,CAChC,CAAC,aAA8C,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CACrE;aACF,CAAC,CAAA;YACF,QAAQ,CAAC;gBACP,gBAAgB,EAAE,KAAK;gBACvB,mBAAmB,EAAE,IAAI;aAC1B,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,QAAQ,CAAC;gBACP,gBAAgB,EAAE,KAAK;gBACvB,mBAAmB,EAAE,KAAc;aACpC,CAAC,CAAA;SACH;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAA;IAEnC,OAAO,CACL;QACE,oBAAC,OAAO,IAAC,KAAK,EAAC,wCAAwC;YACrD,oBAAC,aAAa,IACZ,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAC,OAAO,EACvB,SAAS,EAAE,oBAAC,OAAO,OAAG,EACtB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,UAAU,EAClB,QAAQ,EAAE,QAAQ,eAGJ,CACR;QAEV,oBAAC,aAAa,IAAC,IAAI,EAAE,CAAC,CAAC,mBAAmB,EAAE,OAAO,EAAE,UAAU;YAC7D,8CAAmB,2BAA2B,IAC3C,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,CAC9C,CACO,CACf,CACJ,CAAA;AACH,CAAC;AACD,eAAe,KAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Tooltip } from '@mui/material'\nimport { LoadingButton } from '@mui/lab'\nimport CsvIcon from '@mui/icons-material/Download'\nimport { Form } from '@oneblink/types/typescript/forms'\nimport ErrorSnackbar from '../ErrorSnackbar'\nimport { ColumnInstance } from 'react-table'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\nimport { formStoreService } from '@oneblink/apps'\n\nfunction DownloadSubmissionDataButton({\n disabled,\n form,\n filters,\n visibleColumns,\n}: {\n disabled: boolean\n form: Form\n filters?: formStoreService.FormStoreFilters\n visibleColumns: ColumnInstance<FormStoreRecord>[]\n}) {\n const [{ isDownloadingCsv, downloadingCsvError }, setState] = React.useState<{\n isDownloadingCsv: boolean\n downloadingCsvError: Error | null\n }>({\n isDownloadingCsv: false,\n downloadingCsvError: null,\n })\n const clearError = React.useCallback(() => {\n setState({\n isDownloadingCsv: false,\n downloadingCsvError: null,\n })\n }, [])\n\n const downloadCsv = React.useCallback(async () => {\n setState({ isDownloadingCsv: true, downloadingCsvError: null })\n try {\n await formStoreService.exportFormStoreRecords(form.name, {\n formId: form.id,\n filters,\n includeColumns: visibleColumns.map(\n (visibleColumn: ColumnInstance<FormStoreRecord>) => visibleColumn.id,\n ),\n })\n setState({\n isDownloadingCsv: false,\n downloadingCsvError: null,\n })\n } catch (error) {\n setState({\n isDownloadingCsv: false,\n downloadingCsvError: error as Error,\n })\n }\n }, [form, filters, visibleColumns])\n\n return (\n <>\n <Tooltip title=\"Download submission data as a CSV file\">\n <LoadingButton\n type=\"button\"\n loading={isDownloadingCsv}\n loadingPosition=\"start\"\n startIcon={<CsvIcon />}\n onClick={downloadCsv}\n color=\"primary\"\n variant=\"outlined\"\n disabled={disabled}\n >\n Download\n </LoadingButton>\n </Tooltip>\n\n <ErrorSnackbar open={!!downloadingCsvError} onClose={clearError}>\n <span data-cypress=\"edit-dialog-error-message\">\n {downloadingCsvError && downloadingCsvError.message}\n </span>\n </ErrorSnackbar>\n </>\n )\n}\nexport default React.memo(DownloadSubmissionDataButton)\n"]}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { Form } from '@oneblink/types/typescript/forms';
|
3
|
-
import { FormTypes } from '@oneblink/types';
|
4
|
-
declare function FormStoreContainer({ form, formElements, }: {
|
5
|
-
form: Form;
|
6
|
-
formElements: FormTypes.FormElementWithName[];
|
7
|
-
}): JSX.Element;
|
8
|
-
declare const _default: React.MemoExoticComponent<typeof FormStoreContainer>;
|
9
|
-
export default _default;
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { useHistory } from 'react-router-dom';
|
3
|
-
import querystring from 'query-string';
|
4
|
-
import { formStoreService } from '@oneblink/apps';
|
5
|
-
import useInfiniteScrollDataLoad from '../../hooks/useInfiniteScrollDataLoad';
|
6
|
-
import FormStoreTable from './table';
|
7
|
-
import useFormStoreTable from './table/useFormStoreTable';
|
8
|
-
import { Box, Button, Grid, Typography } from '@mui/material';
|
9
|
-
import { FilterList as FilterIcon, Settings as SettingsIcon, Sync as SyncIcon, } from '@mui/icons-material';
|
10
|
-
import useSubmissionIdValidationMessage, { validateIsUUID, } from '../../hooks/useSubmissionIdIsValid';
|
11
|
-
import DownloadSubmissionDataButton from './DownloadSubmissionDataButton';
|
12
|
-
import ColumnsConfigurationButton from './ColumnsConfigurationButton';
|
13
|
-
import ErrorMessage from '../ErrorMessage';
|
14
|
-
import LoadingWithMessage from '../LoadingWithMessage';
|
15
|
-
import NoResourcesYet from '../NoResourcesYet';
|
16
|
-
function FormStoreContainer({ form, formElements, }) {
|
17
|
-
var _a;
|
18
|
-
const history = useHistory();
|
19
|
-
const { isLoading, loadError, records: formStoreRecords, onTryAgain, onRefresh, filters, onChangeFilters, } = useInfiniteScrollDataLoad({
|
20
|
-
limit: 50,
|
21
|
-
debounceSearchMs: 1000,
|
22
|
-
onDefaultFilters: React.useCallback((query) => {
|
23
|
-
let filters = {};
|
24
|
-
try {
|
25
|
-
if (typeof query.filters === 'string') {
|
26
|
-
filters = JSON.parse(query.filters);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
catch (error) {
|
30
|
-
console.warn('Could not parse filter as JSON', error);
|
31
|
-
}
|
32
|
-
if (!filters.sorting) {
|
33
|
-
filters.sorting = [
|
34
|
-
{ property: 'dateTimeSubmitted', direction: 'descending' },
|
35
|
-
];
|
36
|
-
}
|
37
|
-
return filters;
|
38
|
-
}, []),
|
39
|
-
onSearch: React.useCallback(async (filters, paging, abortSignal) => {
|
40
|
-
// Exclude all search parameters if searching
|
41
|
-
// for a specific submission using an identifier
|
42
|
-
const searchFilters = filters.submissionId
|
43
|
-
? {
|
44
|
-
submissionId: filters.submissionId,
|
45
|
-
}
|
46
|
-
: filters;
|
47
|
-
const result = await formStoreService.searchFormStoreRecords({
|
48
|
-
paging,
|
49
|
-
formId: form.id,
|
50
|
-
filters: searchFilters,
|
51
|
-
}, abortSignal);
|
52
|
-
return {
|
53
|
-
records: result.formStoreRecords,
|
54
|
-
meta: result.meta,
|
55
|
-
};
|
56
|
-
}, [form.id]),
|
57
|
-
onValidateFilters: React.useCallback((currentFilters) => {
|
58
|
-
var _a;
|
59
|
-
return validateIsUUID((_a = currentFilters.submissionId) === null || _a === void 0 ? void 0 : _a.$eq);
|
60
|
-
}, []),
|
61
|
-
});
|
62
|
-
React.useEffect(() => {
|
63
|
-
history.replace({
|
64
|
-
search: querystring.stringify({
|
65
|
-
filters: JSON.stringify(filters),
|
66
|
-
}),
|
67
|
-
});
|
68
|
-
}, [filters, history]);
|
69
|
-
const submissionIdValidationMessage = useSubmissionIdValidationMessage((_a = filters.submissionId) === null || _a === void 0 ? void 0 : _a.$eq);
|
70
|
-
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, allColumns, visibleColumns, getToggleHideAllColumnsProps, } = useFormStoreTable({
|
71
|
-
formStoreRecords,
|
72
|
-
filters,
|
73
|
-
onChangeFilters,
|
74
|
-
submissionIdValidationMessage,
|
75
|
-
form,
|
76
|
-
formElements,
|
77
|
-
});
|
78
|
-
return (React.createElement(Box, { padding: 2, paddingBottom: 16 },
|
79
|
-
React.createElement(Grid, { container: true, spacing: 2, alignItems: "center" },
|
80
|
-
React.createElement(Grid, { item: true, xs: true },
|
81
|
-
React.createElement(Typography, { variant: "h6" }, form === null || form === void 0 ? void 0 : form.name)),
|
82
|
-
React.createElement(Grid, { item: true, xs: false },
|
83
|
-
React.createElement(Button, { startIcon: React.createElement(FilterIcon, null), disabled: !Object.keys(filters).length, onClick: () => {
|
84
|
-
onChangeFilters((currentFilters) => ({
|
85
|
-
sorting: currentFilters.sorting,
|
86
|
-
}), false);
|
87
|
-
}, variant: "text" }, "Clear Filters")),
|
88
|
-
React.createElement(Grid, { item: true, xs: false },
|
89
|
-
React.createElement(ColumnsConfigurationButton, { allColumns: allColumns, getToggleHideAllColumnsProps: getToggleHideAllColumnsProps })),
|
90
|
-
React.createElement(Grid, { item: true, xs: false },
|
91
|
-
React.createElement(DownloadSubmissionDataButton, { disabled: false, form: form, filters: filters, visibleColumns: visibleColumns })),
|
92
|
-
React.createElement(Grid, { item: true, xs: false },
|
93
|
-
React.createElement(Button, { startIcon: React.createElement(SyncIcon, null), onClick: onRefresh, color: "primary", variant: "contained", disabled: !!submissionIdValidationMessage }, "Refresh")),
|
94
|
-
React.createElement(Grid, { item: true, xs: 12 },
|
95
|
-
visibleColumns.length ? (React.createElement(FormStoreTable, { isEmptyResults: !formStoreRecords.length && !isLoading && !loadError, getTableProps: getTableProps, getTableBodyProps: getTableBodyProps, headerGroups: headerGroups, rows: rows, prepareRow: prepareRow, onChangeFilters: onChangeFilters })) : (React.createElement(NoResourcesYet, { IconComponent: SettingsIcon, title: "No Columns Visible", gutterBottom: true }, "It looks like you have hidden all of the available columns. Please enable at least one column to view submissions.")),
|
96
|
-
isLoading && (React.createElement(LoadingWithMessage, { message: "Loading more records..." })),
|
97
|
-
loadError && (React.createElement(React.Fragment, null,
|
98
|
-
React.createElement(ErrorMessage, { title: "Error Retrieving Submissions", gutterBottom: true, gutterTop: true }, loadError.message),
|
99
|
-
React.createElement(Grid, { container: true, justifyContent: "center" },
|
100
|
-
React.createElement(Button, { variant: "outlined", color: "primary", onClick: () => onTryAgain() }, "Try Again"))))))));
|
101
|
-
}
|
102
|
-
export default React.memo(FormStoreContainer);
|
103
|
-
//# sourceMappingURL=FormStore.js.map
|