@oneblink/apps-react 1.0.0-beta.2 → 1.0.0-beta.3

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 (77) hide show
  1. package/dist/components/CopyToClipboardIconButton.js +6 -15
  2. package/dist/components/CopyToClipboardIconButton.js.map +1 -1
  3. package/dist/components/CustomAccordion.d.ts +4 -4
  4. package/dist/components/CustomAccordion.js +29 -34
  5. package/dist/components/CustomAccordion.js.map +1 -1
  6. package/dist/components/ErrorSnackbar.d.ts +3 -3
  7. package/dist/components/ErrorSnackbar.js +15 -44
  8. package/dist/components/ErrorSnackbar.js.map +1 -1
  9. package/dist/components/Lists.d.ts +19 -4
  10. package/dist/components/Lists.js +40 -38
  11. package/dist/components/Lists.js.map +1 -1
  12. package/dist/components/formStore/FormStoreTableProvider.d.ts +6 -0
  13. package/dist/components/formStore/FormStoreTableProvider.js +86 -0
  14. package/dist/components/formStore/FormStoreTableProvider.js.map +1 -0
  15. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.d.ts +5 -0
  16. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +16 -0
  17. package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -0
  18. package/dist/components/formStore/OneBlinkFormStoreColumnsButton.d.ts +5 -0
  19. package/dist/components/formStore/{ColumnsConfigurationButton.js → OneBlinkFormStoreColumnsButton.js} +8 -4
  20. package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -0
  21. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.d.ts +5 -0
  22. package/dist/components/formStore/{DownloadSubmissionDataButton.js → OneBlinkFormStoreDownloadButton.js} +8 -4
  23. package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -0
  24. package/dist/components/formStore/OneBlinkFormStoreProvider.d.ts +8 -0
  25. package/dist/components/formStore/OneBlinkFormStoreProvider.js +25 -0
  26. package/dist/components/formStore/OneBlinkFormStoreProvider.js.map +1 -0
  27. package/dist/components/formStore/OneBlinkFormStoreRefreshButton.d.ts +5 -0
  28. package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +12 -0
  29. package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -0
  30. package/dist/components/formStore/OneBlinkFormStoreTable.d.ts +4 -0
  31. package/dist/components/formStore/OneBlinkFormStoreTable.js +184 -0
  32. package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -0
  33. package/dist/components/formStore/table/FormElementTableCell.js +28 -8
  34. package/dist/components/formStore/table/FormElementTableCell.js.map +1 -1
  35. package/dist/components/formStore/table/RepeatableSetCell.d.ts +0 -1
  36. package/dist/components/formStore/table/RepeatableSetCell.js +23 -25
  37. package/dist/components/formStore/table/RepeatableSetCell.js.map +1 -1
  38. package/dist/components/formStore/table/TableCellCopyButton.js +15 -18
  39. package/dist/components/formStore/table/TableCellCopyButton.js.map +1 -1
  40. package/dist/components/formStore/table/generateColumns.js.map +1 -1
  41. package/dist/components/formStore/table/useFormStoreTable.d.ts +43 -3
  42. package/dist/components/formStore/table/useFormStoreTable.js +11 -2
  43. package/dist/components/formStore/table/useFormStoreTable.js.map +1 -1
  44. package/dist/components/formStore/useFormStoreTableContext.d.ts +44 -0
  45. package/dist/components/formStore/useFormStoreTableContext.js +10 -0
  46. package/dist/components/formStore/useFormStoreTableContext.js.map +1 -0
  47. package/dist/components/{ErrorMessage.d.ts → messages/ErrorMessage.d.ts} +2 -3
  48. package/dist/components/{ErrorMessage.js → messages/ErrorMessage.js} +1 -1
  49. package/dist/components/messages/ErrorMessage.js.map +1 -0
  50. package/dist/components/messages/LargeIconMessage.d.ts +4 -3
  51. package/dist/components/messages/LargeIconMessage.js +31 -61
  52. package/dist/components/messages/LargeIconMessage.js.map +1 -1
  53. package/dist/components/{NoResourcesYet.d.ts → messages/NoResourcesYet.d.ts} +2 -3
  54. package/dist/components/{NoResourcesYet.js → messages/NoResourcesYet.js} +1 -1
  55. package/dist/components/messages/NoResourcesYet.js.map +1 -0
  56. package/dist/index.d.ts +6 -1
  57. package/dist/index.js +6 -1
  58. package/dist/index.js.map +1 -1
  59. package/package.json +7 -5
  60. package/dist/OneBlinkFormStoreView.d.ts +0 -8
  61. package/dist/OneBlinkFormStoreView.js +0 -55
  62. package/dist/OneBlinkFormStoreView.js.map +0 -1
  63. package/dist/components/ErrorMessage.js.map +0 -1
  64. package/dist/components/NoResourcesYet.js.map +0 -1
  65. package/dist/components/formStore/ColumnsConfigurationButton.d.ts +0 -10
  66. package/dist/components/formStore/ColumnsConfigurationButton.js.map +0 -1
  67. package/dist/components/formStore/DownloadSubmissionDataButton.d.ts +0 -13
  68. package/dist/components/formStore/DownloadSubmissionDataButton.js.map +0 -1
  69. package/dist/components/formStore/FormStore.d.ts +0 -9
  70. package/dist/components/formStore/FormStore.js +0 -103
  71. package/dist/components/formStore/FormStore.js.map +0 -1
  72. package/dist/components/formStore/table/index.d.ts +0 -17
  73. package/dist/components/formStore/table/index.js +0 -194
  74. package/dist/components/formStore/table/index.js.map +0 -1
  75. package/dist/hooks/useLegacyElements.d.ts +0 -16
  76. package/dist/hooks/useLegacyElements.js +0 -55
  77. package/dist/hooks/useLegacyElements.js.map +0 -1
@@ -1,194 +0,0 @@
1
- import * as React from 'react';
2
- import clsx from 'clsx';
3
- import { Box, Paper, TableContainer, Tooltip } from '@mui/material';
4
- import makeStyles from '@mui/styles/makeStyles';
5
- import { FilterList as FilterListIcon, Warning as WarningIcon, ArrowDownward as SortingIcon, } from '@mui/icons-material';
6
- import { IsHoveringProvider } from '../../../hooks/useIsHovering';
7
- import { NoResourcesYet } from '../../NoResourcesYet';
8
- import FormStoreIcon from '../display/FormStoreIcon';
9
- import HeaderCellMoreButton from './HeaderCellMoreButton';
10
- const useStyles = makeStyles((theme) => ({
11
- tooltip: {
12
- zIndex: theme.zIndex.drawer,
13
- },
14
- sortingIcon: {
15
- transition: theme.transitions.create('transform'),
16
- },
17
- sortingIconDescending: {
18
- transform: 'rotate(180deg)',
19
- },
20
- table: {
21
- display: 'inline-block',
22
- '& .tbody .tr:last-child .tc': {
23
- borderBottom: 0,
24
- },
25
- '& .tc': {
26
- padding: theme.spacing(1),
27
- borderBottomColor: theme.palette.divider,
28
- borderBottom: '1px solid',
29
- display: 'flex',
30
- alignItems: 'center',
31
- '&.is-clickable': {
32
- cursor: 'pointer',
33
- transition: theme.transitions.create('transform'),
34
- '&:hover': {
35
- backgroundColor: theme.palette.action.hover,
36
- },
37
- },
38
- },
39
- '& .td': {
40
- position: 'relative',
41
- borderRight: '1px solid',
42
- borderRightColor: theme.palette.divider,
43
- overflowX: 'hidden',
44
- // minus 1 to cater for the border
45
- minHeight: `${parseInt(theme.spacing(5.5)) - 1}px`,
46
- '&.is-resizing': {
47
- borderRightStyle: 'dashed',
48
- },
49
- },
50
- '& .th': {
51
- position: 'relative',
52
- fontWeight: theme.typography.fontWeightBold,
53
- paddingRight: 0,
54
- '& .th-content': {
55
- flex: 1,
56
- display: 'flex',
57
- alignItems: 'center',
58
- justifyContent: 'space-between',
59
- borderRight: '1px solid',
60
- borderRightColor: theme.palette.divider,
61
- paddingRight: theme.spacing(),
62
- '& .th-label': {
63
- display: 'inline-flex',
64
- alignItems: 'center',
65
- '& .th-icon': {
66
- marginLeft: theme.spacing(),
67
- },
68
- },
69
- },
70
- '& .resizer': {
71
- display: 'inline-flex',
72
- alignItems: 'center',
73
- justifyContent: 'center',
74
- borderWidth: 0,
75
- borderLeftStyle: 'solid',
76
- borderRightStyle: 'solid',
77
- borderColor: theme.palette.divider,
78
- paddingTop: theme.spacing(),
79
- paddingBottom: theme.spacing(),
80
- paddingRight: `calc(${theme.spacing(1)} + 1px)`,
81
- position: 'absolute',
82
- right: 0,
83
- top: theme.spacing(0.5),
84
- bottom: theme.spacing(0.5),
85
- transform: `translateX(calc(${theme.spacing(0.5)} + 1px))`,
86
- zIndex: 1,
87
- // prevents from scrolling while dragging on touch devices
88
- touchAction: 'none',
89
- '&:hover': {
90
- borderWidth: '1px',
91
- },
92
- '&.is-resizing': {
93
- borderWidth: '1px',
94
- borderColor: theme.palette.grey[700],
95
- },
96
- },
97
- },
98
- },
99
- }));
100
- function FormStoreTable({ getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, isEmptyResults, onChangeFilters, }) {
101
- const classes = useStyles();
102
- return (React.createElement(React.Fragment, null,
103
- React.createElement(Paper, null,
104
- React.createElement(TableContainer, null,
105
- React.createElement("div", { className: classes.table, ...getTableProps() },
106
- React.createElement("div", { className: "thead" },
107
- // Loop over the header rows
108
- headerGroups.map((headerGroup) => (
109
- // Apply the header row props
110
- React.createElement("div", { ...headerGroup.getHeaderGroupProps(), className: "tr" },
111
- // Loop over the headers in each row
112
- headerGroup.headers.map((headerGroup) => {
113
- var _a, _b, _c, _d, _e;
114
- const sortingProperty = (_a = headerGroup.sorting) === null || _a === void 0 ? void 0 : _a.property;
115
- const sortingDirection = (_b = headerGroup.sorting) === null || _b === void 0 ? void 0 : _b.direction;
116
- return (React.createElement(Tooltip, { title: headerGroup.tooltip || '', arrow: true, key: headerGroup.id, classes: {
117
- popper: classes.tooltip,
118
- } },
119
- React.createElement("div", { className: clsx('th tc', {
120
- 'is-clickable': !!sortingProperty,
121
- }), onClick: sortingProperty
122
- ? () => {
123
- onChangeFilters((currentFilters) => {
124
- switch (sortingDirection) {
125
- case 'ascending': {
126
- return {
127
- ...currentFilters,
128
- sorting: [
129
- {
130
- property: sortingProperty,
131
- direction: 'descending',
132
- },
133
- ],
134
- };
135
- }
136
- case 'descending': {
137
- return {
138
- ...currentFilters,
139
- sorting: undefined,
140
- };
141
- }
142
- default: {
143
- return {
144
- ...currentFilters,
145
- sorting: [
146
- {
147
- property: sortingProperty,
148
- direction: 'ascending',
149
- },
150
- ],
151
- };
152
- }
153
- }
154
- }, false);
155
- }
156
- : undefined, ...headerGroup.getHeaderProps() },
157
- React.createElement(IsHoveringProvider, { className: "th-content" },
158
- React.createElement("div", { className: "th-label" },
159
- React.createElement("span", null, headerGroup.headerText),
160
- sortingDirection && (React.createElement(SortingIcon, { fontSize: "small", color: "primary", className: clsx('th-icon', classes.sortingIcon, {
161
- [classes.sortingIconDescending]: sortingDirection === 'descending',
162
- }) })),
163
- ((_c = headerGroup.filter) === null || _c === void 0 ? void 0 : _c.isInvalid) ? (React.createElement(Tooltip, { title: ((_d = headerGroup.filter) === null || _d === void 0 ? void 0 : _d.validationMessage) ||
164
- '' },
165
- React.createElement(WarningIcon, { fontSize: "small", color: "error", className: "th-icon" }))) : ((_e = headerGroup.filter) === null || _e === void 0 ? void 0 : _e.value) ? (React.createElement(FilterListIcon, { fontSize: "small", color: "primary", className: "th-icon" })) : null),
166
- React.createElement(HeaderCellMoreButton, { headerGroup: headerGroup, onHide: headerGroup.toggleHidden }),
167
- React.createElement("div", { ...headerGroup.getResizerProps(), className: clsx('resizer', {
168
- 'is-resizing': headerGroup.isResizing,
169
- }), onClick: (event) => {
170
- event.stopPropagation();
171
- } })))));
172
- }))))),
173
- !isEmptyResults ? (React.createElement("div", { ...getTableBodyProps(), className: "tbody" },
174
- // Loop over the table rows
175
- rows.map((row) => {
176
- // Prepare the row for display
177
- prepareRow(row);
178
- return (
179
- // Apply the row props
180
- React.createElement("div", { ...row.getRowProps(), className: "tr" },
181
- // Loop over the rows cells
182
- row.cells.map((cell) => {
183
- // Apply the cell props
184
- return (React.createElement(IsHoveringProvider, { ...cell.getCellProps(), className: clsx('td tc', {
185
- 'is-resizing': cell.column.isResizing,
186
- }) },
187
- // Render the cell contents
188
- cell.render('Cell')));
189
- })));
190
- }))) : (React.createElement(Box, { padding: 2 }))))),
191
- isEmptyResults && (React.createElement(NoResourcesYet, { IconComponent: FormStoreIcon, title: "No Records Found..." }, "There are no Submissions matching your filters."))));
192
- }
193
- export default React.memo(FormStoreTable);
194
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,K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,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;4BACrB,uBAAuB;4BACvB,OAAO,CACL,oBAAC,kBAAkB,OACb,IAAI,CAAC,YAAY,EAAE,EACvB,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE;oCACvB,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;iCACtC,CAAC;4BAGA,2BAA2B;4BAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAEF,CACtB,CAAA;wBACH,CAAC,CAAC,CAEA,CACP,CAAA;oBACH,CAAC,CAAC,CAEA,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC,GAAI,CACpB,CACG,CACS,CACX;QAEP,cAAc,IAAI,CACjB,oBAAC,cAAc,IACb,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAC,qBAAqB,sDAGZ,CAClB,CACA,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { TableInstance } from 'react-table'\nimport clsx from 'clsx'\nimport { Box, Paper, TableContainer, Tooltip } from '@mui/material'\nimport makeStyles from '@mui/styles/makeStyles'\nimport {\n FilterList as FilterListIcon,\n Warning as WarningIcon,\n ArrowDownward as SortingIcon,\n} from '@mui/icons-material'\nimport { SubmissionTypes } from '@oneblink/types'\nimport { IsHoveringProvider } from '../../../hooks/useIsHovering'\nimport { NoResourcesYet } from '../../NoResourcesYet'\nimport FormStoreIcon from '../display/FormStoreIcon'\nimport HeaderCellMoreButton from './HeaderCellMoreButton'\nimport { OnChangeFilters } from '../../../hooks/useInfiniteScrollDataLoad'\nimport { formStoreService } from '@oneblink/apps'\n\nconst useStyles = makeStyles((theme) => ({\n tooltip: {\n zIndex: theme.zIndex.drawer,\n },\n sortingIcon: {\n transition: theme.transitions.create('transform'),\n },\n sortingIconDescending: {\n transform: 'rotate(180deg)',\n },\n table: {\n display: 'inline-block',\n '& .tbody .tr:last-child .tc': {\n borderBottom: 0,\n },\n '& .tc': {\n padding: theme.spacing(1),\n borderBottomColor: theme.palette.divider,\n borderBottom: '1px solid',\n display: 'flex',\n alignItems: 'center',\n '&.is-clickable': {\n cursor: 'pointer',\n transition: theme.transitions.create('transform'),\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n },\n },\n '& .td': {\n position: 'relative',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n overflowX: 'hidden',\n // minus 1 to cater for the border\n minHeight: `${parseInt(theme.spacing(5.5)) - 1}px`,\n '&.is-resizing': {\n borderRightStyle: 'dashed',\n },\n },\n '& .th': {\n position: 'relative',\n fontWeight: theme.typography.fontWeightBold,\n paddingRight: 0,\n '& .th-content': {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n paddingRight: theme.spacing(),\n '& .th-label': {\n display: 'inline-flex',\n alignItems: 'center',\n '& .th-icon': {\n marginLeft: theme.spacing(),\n },\n },\n },\n '& .resizer': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderWidth: 0,\n borderLeftStyle: 'solid',\n borderRightStyle: 'solid',\n borderColor: theme.palette.divider,\n paddingTop: theme.spacing(),\n paddingBottom: theme.spacing(),\n paddingRight: `calc(${theme.spacing(1)} + 1px)`,\n position: 'absolute',\n right: 0,\n top: theme.spacing(0.5),\n bottom: theme.spacing(0.5),\n transform: `translateX(calc(${theme.spacing(0.5)} + 1px))`,\n zIndex: 1,\n // prevents from scrolling while dragging on touch devices\n touchAction: 'none',\n '&:hover': {\n borderWidth: '1px',\n },\n '&.is-resizing': {\n borderWidth: '1px',\n borderColor: theme.palette.grey[700],\n },\n },\n },\n },\n}))\n\ntype FormStoreTableInstance = TableInstance<SubmissionTypes.FormStoreRecord>\n\nfunction FormStoreTable({\n getTableProps,\n getTableBodyProps,\n headerGroups,\n rows,\n prepareRow,\n isEmptyResults,\n onChangeFilters,\n}: {\n getTableProps: FormStoreTableInstance['getTableProps']\n getTableBodyProps: FormStoreTableInstance['getTableBodyProps']\n headerGroups: FormStoreTableInstance['headerGroups']\n rows: FormStoreTableInstance['rows']\n prepareRow: FormStoreTableInstance['prepareRow']\n isEmptyResults: boolean\n onChangeFilters: OnChangeFilters<formStoreService.FormStoreFilters>\n}) {\n const classes = useStyles()\n\n return (\n <>\n <Paper>\n <TableContainer>\n <div className={classes.table} {...getTableProps()}>\n <div className=\"thead\">\n {\n // Loop over the header rows\n headerGroups.map((headerGroup) => (\n // Apply the header row props\n <div {...headerGroup.getHeaderGroupProps()} className=\"tr\">\n {\n // Loop over the headers in each row\n headerGroup.headers.map((headerGroup) => {\n const sortingProperty = headerGroup.sorting?.property\n const sortingDirection = headerGroup.sorting?.direction\n\n return (\n <Tooltip\n title={headerGroup.tooltip || ''}\n arrow\n key={headerGroup.id}\n classes={{\n popper: classes.tooltip,\n }}\n >\n <div\n className={clsx('th tc', {\n 'is-clickable': !!sortingProperty,\n })}\n onClick={\n sortingProperty\n ? () => {\n onChangeFilters((currentFilters) => {\n switch (sortingDirection) {\n case 'ascending': {\n return {\n ...currentFilters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'descending',\n },\n ],\n }\n }\n case 'descending': {\n return {\n ...currentFilters,\n sorting: undefined,\n }\n }\n default: {\n return {\n ...currentFilters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'ascending',\n },\n ],\n }\n }\n }\n }, false)\n }\n : undefined\n }\n // Apply the header cell props\n {...headerGroup.getHeaderProps()}\n >\n <IsHoveringProvider className=\"th-content\">\n <div className=\"th-label\">\n <span>{headerGroup.headerText}</span>\n {sortingDirection && (\n <SortingIcon\n fontSize=\"small\"\n color=\"primary\"\n className={clsx(\n 'th-icon',\n classes.sortingIcon,\n {\n [classes.sortingIconDescending]:\n sortingDirection === 'descending',\n },\n )}\n />\n )}\n {headerGroup.filter?.isInvalid ? (\n <Tooltip\n title={\n headerGroup.filter?.validationMessage ||\n ''\n }\n >\n <WarningIcon\n fontSize=\"small\"\n color=\"error\"\n className=\"th-icon\"\n />\n </Tooltip>\n ) : headerGroup.filter?.value ? (\n <FilterListIcon\n fontSize=\"small\"\n color=\"primary\"\n className=\"th-icon\"\n />\n ) : null}\n </div>\n <HeaderCellMoreButton\n headerGroup={headerGroup}\n onHide={headerGroup.toggleHidden}\n />\n <div\n {...headerGroup.getResizerProps()}\n className={clsx('resizer', {\n 'is-resizing': headerGroup.isResizing,\n })}\n onClick={(event) => {\n event.stopPropagation()\n }}\n />\n </IsHoveringProvider>\n </div>\n </Tooltip>\n )\n })\n }\n </div>\n ))\n }\n </div>\n {!isEmptyResults ? (\n <div {...getTableBodyProps()} className=\"tbody\">\n {\n // Loop over the table rows\n rows.map((row) => {\n // Prepare the row for display\n prepareRow(row)\n return (\n // Apply the row props\n <div {...row.getRowProps()} className=\"tr\">\n {\n // Loop over the rows cells\n row.cells.map((cell) => {\n // Apply the cell props\n return (\n <IsHoveringProvider\n {...cell.getCellProps()}\n className={clsx('td tc', {\n 'is-resizing': cell.column.isResizing,\n })}\n >\n {\n // Render the cell contents\n cell.render('Cell')\n }\n </IsHoveringProvider>\n )\n })\n }\n </div>\n )\n })\n }\n </div>\n ) : (\n <Box padding={2} />\n )}\n </div>\n </TableContainer>\n </Paper>\n\n {isEmptyResults && (\n <NoResourcesYet\n IconComponent={FormStoreIcon}\n title=\"No Records Found...\"\n >\n There are no Submissions matching your filters.\n </NoResourcesYet>\n )}\n </>\n )\n}\n\nexport default React.memo(FormStoreTable)\n"]}
@@ -1,16 +0,0 @@
1
- import { FormTypes } from '@oneblink/types';
2
- export declare const legacyNameRegex: RegExp;
3
- declare const useLegacyFormElements: (formElements: FormTypes.FormElement[]) => {
4
- formElementsUsingLegacyStorage: {
5
- name: string;
6
- label: string;
7
- id: string;
8
- }[];
9
- formElementsUsingLegacyNames: {
10
- name: string;
11
- label: string;
12
- id: string;
13
- }[];
14
- };
15
- export default useLegacyFormElements;
16
- export declare const useFormElementLegacyConfigMessage: (formElement: FormTypes.FormElement) => string | undefined;
@@ -1,55 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { formElementsService, typeCastService } from '@oneblink/sdk-core';
3
- export const legacyNameRegex = /[^a-zA-Z\d_-]/;
4
- const checkStorageType = (element) => {
5
- const storageElement = typeCastService.formElements.toStorageElement(element);
6
- if (storageElement &&
7
- (!storageElement.storageType || storageElement.storageType === 'legacy')) {
8
- return {
9
- label: storageElement.label,
10
- name: storageElement.name,
11
- id: storageElement.id,
12
- };
13
- }
14
- };
15
- const checkName = (element) => {
16
- const namedElement = typeCastService.formElements.toNamedElement(element);
17
- if (!!namedElement && legacyNameRegex.test(namedElement.name)) {
18
- const formElementWithoutForm = typeCastService.formElements.toFormElementWithoutForm(namedElement);
19
- return {
20
- name: namedElement.name,
21
- label: (formElementWithoutForm === null || formElementWithoutForm === void 0 ? void 0 : formElementWithoutForm.label) || 'Nested Form',
22
- id: namedElement.id,
23
- };
24
- }
25
- };
26
- const useLegacyFormElements = (formElements) => {
27
- return useMemo(() => {
28
- const formElementsUsingLegacyStorage = [];
29
- const formElementsUsingLegacyNames = [];
30
- formElementsService.forEachFormElement(formElements || [], (element) => {
31
- const legacyStorageType = checkStorageType(element);
32
- if (legacyStorageType) {
33
- formElementsUsingLegacyStorage.push(legacyStorageType);
34
- }
35
- const legacyName = checkName(element);
36
- if (legacyName) {
37
- formElementsUsingLegacyNames.push(legacyName);
38
- }
39
- });
40
- return {
41
- formElementsUsingLegacyStorage,
42
- formElementsUsingLegacyNames,
43
- };
44
- }, [formElements]);
45
- };
46
- export default useLegacyFormElements;
47
- const formElementLegacyConfigMessage = 'Element is using unsupported configuration';
48
- export const useFormElementLegacyConfigMessage = (formElement) => {
49
- return useMemo(() => {
50
- if (checkStorageType(formElement) || checkName(formElement)) {
51
- return formElementLegacyConfigMessage;
52
- }
53
- }, [formElement]);
54
- };
55
- //# sourceMappingURL=useLegacyElements.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLegacyElements.js","sourceRoot":"","sources":["../../src/hooks/useLegacyElements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGzE,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAA;AAE9C,MAAM,gBAAgB,GAAG,CAAC,OAA8B,EAAE,EAAE;IAC1D,MAAM,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAC7E,IACE,cAAc;QACd,CAAC,CAAC,cAAc,CAAC,WAAW,IAAI,cAAc,CAAC,WAAW,KAAK,QAAQ,CAAC,EACxE;QACA,OAAO;YACL,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,EAAE,EAAE,cAAc,CAAC,EAAE;SACtB,CAAA;KACF;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,OAA8B,EAAE,EAAE;IACnD,MAAM,YAAY,GAChB,eAAe,CAAC,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;IACtD,IAAI,CAAC,CAAC,YAAY,IAAI,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QAC7D,MAAM,sBAAsB,GAC1B,eAAe,CAAC,YAAY,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAA;QACrE,OAAO;YACL,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,KAAK,EAAE,CAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,KAAK,KAAI,aAAa;YACrD,EAAE,EAAE,YAAY,CAAC,EAAE;SACpB,CAAA;KACF;AACH,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,YAAqC,EAAE,EAAE;IACtE,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,8BAA8B,GAI/B,EAAE,CAAA;QACP,MAAM,4BAA4B,GAI7B,EAAE,CAAA;QACP,mBAAmB,CAAC,kBAAkB,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YACrE,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;YACnD,IAAI,iBAAiB,EAAE;gBACrB,8BAA8B,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;aACvD;YAED,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;YACrC,IAAI,UAAU,EAAE;gBACd,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;aAC9C;QACH,CAAC,CAAC,CAAA;QACF,OAAO;YACL,8BAA8B;YAC9B,4BAA4B;SAC7B,CAAA;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;AACpB,CAAC,CAAA;AAED,eAAe,qBAAqB,CAAA;AAEpC,MAAM,8BAA8B,GAClC,4CAA4C,CAAA;AAC9C,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,WAAkC,EAClC,EAAE;IACF,OAAO,OAAO,CAAqB,GAAG,EAAE;QACtC,IAAI,gBAAgB,CAAC,WAAW,CAAC,IAAI,SAAS,CAAC,WAAW,CAAC,EAAE;YAC3D,OAAO,8BAA8B,CAAA;SACtC;IACH,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;AACnB,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { formElementsService, typeCastService } from '@oneblink/sdk-core'\nimport { FormTypes } from '@oneblink/types'\n\nexport const legacyNameRegex = /[^a-zA-Z\\d_-]/\n\nconst checkStorageType = (element: FormTypes.FormElement) => {\n const storageElement = typeCastService.formElements.toStorageElement(element)\n if (\n storageElement &&\n (!storageElement.storageType || storageElement.storageType === 'legacy')\n ) {\n return {\n label: storageElement.label,\n name: storageElement.name,\n id: storageElement.id,\n }\n }\n}\n\nconst checkName = (element: FormTypes.FormElement) => {\n const namedElement: FormTypes.FormElementWithName | undefined =\n typeCastService.formElements.toNamedElement(element)\n if (!!namedElement && legacyNameRegex.test(namedElement.name)) {\n const formElementWithoutForm =\n typeCastService.formElements.toFormElementWithoutForm(namedElement)\n return {\n name: namedElement.name,\n label: formElementWithoutForm?.label || 'Nested Form',\n id: namedElement.id,\n }\n }\n}\n\nconst useLegacyFormElements = (formElements: FormTypes.FormElement[]) => {\n return useMemo(() => {\n const formElementsUsingLegacyStorage: Array<{\n name: string\n label: string\n id: string\n }> = []\n const formElementsUsingLegacyNames: Array<{\n name: string\n label: string\n id: string\n }> = []\n formElementsService.forEachFormElement(formElements || [], (element) => {\n const legacyStorageType = checkStorageType(element)\n if (legacyStorageType) {\n formElementsUsingLegacyStorage.push(legacyStorageType)\n }\n\n const legacyName = checkName(element)\n if (legacyName) {\n formElementsUsingLegacyNames.push(legacyName)\n }\n })\n return {\n formElementsUsingLegacyStorage,\n formElementsUsingLegacyNames,\n }\n }, [formElements])\n}\n\nexport default useLegacyFormElements\n\nconst formElementLegacyConfigMessage =\n 'Element is using unsupported configuration'\nexport const useFormElementLegacyConfigMessage = (\n formElement: FormTypes.FormElement,\n) => {\n return useMemo<string | undefined>(() => {\n if (checkStorageType(formElement) || checkName(formElement)) {\n return formElementLegacyConfigMessage\n }\n }, [formElement])\n}\n"]}