@dashadmin/dash-components 1.3.25 → 1.3.28
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/README.md +35 -0
- package/dist/components/AuditLog/AuditLog.js +345 -1
- package/dist/components/AuditLog/index.js +4 -1
- package/dist/components/AutoCompleteArrayInput/AutoCompleteCheckBoxInput.js +630 -3
- package/dist/components/AutoCompleteArrayInput/AutocompleteCheckBoxArrayInput.js +53 -1
- package/dist/components/AutoCompleteArrayInputAutoSearch/AutoCompleteCheckBoxInput.js +647 -3
- package/dist/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayInput.js +53 -1
- package/dist/components/Json/Json.js +235 -1
- package/dist/components/JsonColorSelector/JsonColorSelector.js +1172 -1
- package/dist/components/JsonColorSelector/JsonColorSelectorEnhanced.js +863 -2
- package/dist/components/JsonColorSelector/JsonCssVarValues.js +738 -1
- package/dist/components/JsonColorSelector/components/ColorEditDialog.js +426 -1
- package/dist/components/JsonColorSelector/components/ColorPaletteItem.js +75 -1
- package/dist/components/JsonColorSelector/components/ImageColorExtractor.js +283 -1
- package/dist/components/JsonColorSelector/helpers/functions.js +101 -1
- package/dist/components/JsonColorSelector/useAsyncColorThief.js +105 -1
- package/dist/components/ListActive/ListActive.js +126 -1
- package/dist/components/ListActive/ListBoolean.js +124 -1
- package/dist/components/NotificationPreferences/NotificationPreferences.js +317 -1
- package/dist/components/NotificationPreferences/index.js +7 -1
- package/dist/components/SearchableSelects/RASearchableSelect.js +236 -1
- package/dist/components/SearchableSelects/RASearchableSelectCheckboxes.js +479 -1
- package/dist/components/SearchableSelects/RASearchableSelectChips.js +465 -1
- package/dist/components/SearchableSelects/RASearchableSelectChipsRecordContext.js +295 -1
- package/dist/components/SearchableSelects/SearchableSelect.js +202 -1
- package/dist/components/SearchableSelects/SearchableSelectCheckboxes.js +290 -1
- package/dist/components/SortableDataGrid/SortableDataGrid.js +72 -1
- package/dist/components/SortableDataGrid/SortableDataGridBody.js +167 -1
- package/dist/components/SortableDataGrid/SortableDataGridHeader.js +109 -1
- package/dist/components/SortableDataGrid/SortableDataGridRow.js +283 -1
- package/dist/components/Upload/SingleImageUploader.js +40 -1
- package/dist/components/custom/PackageCopyMethod.js +78 -1
- package/dist/components/custom/PackageRadioButtonGroup.js +45 -1
- package/dist/components/dialog/Basic.js +8 -1
- package/dist/components/dialog/Correct.js +14 -1
- package/dist/components/dialog/Error.js +14 -1
- package/dist/components/dialog/Info.js +14 -1
- package/dist/components/dialog/InfoV2.js +21 -1
- package/dist/components/dialog/NotFound.js +14 -1
- package/dist/components/dialog/QuickSearch.js +117 -1
- package/dist/components/notifications/NotificationsCenter.js +597 -1
- package/dist/components/notifications/index.js +24 -1
- package/dist/components/tables/PaginationComponent.js +36 -1
- package/dist/components/theme/AppLoadingFallback.js +38 -2
- package/dist/components/theme/ErrorBoundary.js +52 -1
- package/dist/components/theme/InitialLoader.js +13 -1
- package/dist/components/theme/NotFound.js +136 -1
- package/dist/components/theme/NotResults.js +38 -1
- package/dist/hooks/useDraggable.js +6 -1
- package/dist/hooks/useNotifications.js +8 -1
- package/dist/hooks/useQuickSearch.js +26 -1
- package/dist/index.js +66 -5567
- package/dist/utils/setNativeValue.js +17 -1
- package/package.json +148 -132
- package/src/components/AuditLog/AuditLog.tsx +476 -0
- package/src/components/AuditLog/index.ts +2 -0
- package/src/components/AutoCompleteArrayInput/AutoCompleteCheckBoxInput.tsx +917 -0
- package/src/components/AutoCompleteArrayInput/AutocompleteCheckBoxArrayInput.tsx +39 -0
- package/src/components/AutoCompleteArrayInputAutoSearch/AutoCompleteCheckBoxInput.tsx +916 -0
- package/src/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayInput.tsx +44 -0
- package/src/components/Json/Json.tsx +312 -0
- package/src/components/JsonColorSelector/JsonColorSelector.tsx +1435 -0
- package/src/components/JsonColorSelector/JsonColorSelectorEnhanced.tsx +1029 -0
- package/src/components/JsonColorSelector/JsonCssVarValues.tsx +863 -0
- package/src/components/JsonColorSelector/components/ColorEditDialog.tsx +491 -0
- package/src/components/JsonColorSelector/components/ColorPaletteItem.tsx +80 -0
- package/src/components/JsonColorSelector/components/ImageColorExtractor.tsx +328 -0
- package/src/components/JsonColorSelector/helpers/functions.tsx +123 -0
- package/src/components/JsonColorSelector/interfaces/interfaces.tsx +22 -0
- package/src/components/JsonColorSelector/useAsyncColorThief.tsx +97 -0
- package/src/components/ListActive/ListActive.tsx +106 -0
- package/src/components/ListActive/ListBoolean.tsx +96 -0
- package/src/components/NotificationPreferences/NotificationPreferences.tsx +463 -0
- package/src/components/NotificationPreferences/index.tsx +2 -0
- package/src/components/SearchableSelects/RASearchableSelect.tsx +300 -0
- package/src/components/SearchableSelects/RASearchableSelectCheckboxes.tsx +604 -0
- package/src/components/SearchableSelects/RASearchableSelectChips.tsx +558 -0
- package/src/components/SearchableSelects/RASearchableSelectChipsRecordContext.tsx +362 -0
- package/src/components/SearchableSelects/SearchableSelect.tsx +321 -0
- package/src/components/SearchableSelects/SearchableSelectCheckboxes.tsx +355 -0
- package/src/components/SortableDataGrid/SortableDataGrid.tsx +56 -0
- package/src/components/SortableDataGrid/SortableDataGridBody.tsx +175 -0
- package/src/components/SortableDataGrid/SortableDataGridHeader.tsx +171 -0
- package/src/components/SortableDataGrid/SortableDataGridRow.tsx +247 -0
- package/src/components/Upload/SingleImageUploader.tsx +55 -0
- package/src/components/custom/PackageCopyMethod.tsx +109 -0
- package/src/components/custom/PackageRadioButtonGroup.tsx +47 -0
- package/src/components/dialog/Basic.tsx +11 -0
- package/src/components/dialog/Correct.tsx +16 -0
- package/src/components/dialog/Error.tsx +15 -0
- package/src/components/dialog/Info.tsx +15 -0
- package/src/components/dialog/InfoV2.tsx +35 -0
- package/src/components/dialog/NotFound.tsx +18 -0
- package/src/components/dialog/QuickSearch.tsx +115 -0
- package/src/components/notifications/NotificationsCenter.tsx +792 -0
- package/src/components/notifications/index.ts +42 -0
- package/src/components/tables/PaginationComponent.tsx +17 -0
- package/src/components/theme/AppLoadingFallback.tsx +42 -0
- package/src/components/theme/ErrorBoundary.tsx +57 -0
- package/src/components/theme/InitialLoader.tsx +16 -0
- package/src/components/theme/NotFound.tsx +124 -0
- package/src/components/theme/NotResults.tsx +54 -0
- package/src/hooks/useDraggable.ts +11 -0
- package/src/hooks/useNotifications.ts +14 -0
- package/src/hooks/useQuickSearch.tsx +29 -0
- package/src/index.tsx +77 -0
- package/src/utils/setNativeValue.tsx +23 -0
- package/dist/color-thief-CTwGFhOB.js +0 -272
- /package/{dist → src}/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayAutoSearch.tsx.wip +0 -0
- /package/{dist → src}/components/JsonColorSelector/JsonColorSelector.tsx.bkup +0 -0
- /package/{dist → src}/components/SortableDataGrid/README.md +0 -0
- /package/{dist → src}/styles/index.less +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AutocompleteInputProps, RaRecord } from 'react-admin';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const AutocompleteCheckBoxArrayInput = <
|
|
6
|
+
OptionType extends RaRecord = RaRecord,
|
|
7
|
+
DisableClearable extends boolean | undefined = boolean | undefined,
|
|
8
|
+
SupportCreate extends boolean | undefined = false,
|
|
9
|
+
>({
|
|
10
|
+
defaultValue,
|
|
11
|
+
...props
|
|
12
|
+
}: AutocompleteArrayInputProps<
|
|
13
|
+
OptionType,
|
|
14
|
+
DisableClearable,
|
|
15
|
+
SupportCreate
|
|
16
|
+
>) => {
|
|
17
|
+
return (
|
|
18
|
+
/* @ts-ignore Expected */
|
|
19
|
+
<AutocompleteCheckBoxInput<
|
|
20
|
+
OptionType,
|
|
21
|
+
true,
|
|
22
|
+
DisableClearable,
|
|
23
|
+
SupportCreate
|
|
24
|
+
>
|
|
25
|
+
{...props}
|
|
26
|
+
multiple
|
|
27
|
+
defaultValue={defaultValue ?? []}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type AutocompleteArrayInputProps<
|
|
33
|
+
OptionType = RaRecord,
|
|
34
|
+
DisableClearable extends boolean | undefined = false,
|
|
35
|
+
SupportCreate extends boolean | undefined = false,
|
|
36
|
+
> = Omit<
|
|
37
|
+
AutocompleteInputProps<OptionType, true, DisableClearable, SupportCreate>,
|
|
38
|
+
'defaultValue'
|
|
39
|
+
> & {
|
|
40
|
+
defaultValue?: any[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export default AutocompleteCheckBoxArrayInput;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { IDashAutoAdminCustomFieldComponent } from 'dash-auto-admin';
|
|
2
|
+
import { useRecordContext } from 'react-admin';
|
|
3
|
+
import { useFormContext } from 'react-hook-form';
|
|
4
|
+
import {
|
|
5
|
+
Box,
|
|
6
|
+
Button,
|
|
7
|
+
IconButton,
|
|
8
|
+
TextField,
|
|
9
|
+
Typography,
|
|
10
|
+
Table,
|
|
11
|
+
TableBody,
|
|
12
|
+
TableCell,
|
|
13
|
+
TableContainer,
|
|
14
|
+
TableHead,
|
|
15
|
+
TableRow,
|
|
16
|
+
Paper
|
|
17
|
+
} from '@mui/material';
|
|
18
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
19
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
20
|
+
import { useState, useEffect } from 'react';
|
|
21
|
+
|
|
22
|
+
interface KeyValuePair {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
id: string; // For React key prop
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const JsonEdit: React.FC<IDashAutoAdminCustomFieldComponent> = (props) => {
|
|
29
|
+
const { method, attribute, resourceConfig } = props;
|
|
30
|
+
const record = useRecordContext();
|
|
31
|
+
const { setValue, getValues } = useFormContext();
|
|
32
|
+
|
|
33
|
+
// Extract the nested path from the attribute
|
|
34
|
+
const attributePath = attribute.attribute;
|
|
35
|
+
const isNestedSetting = attributePath.startsWith('settings.');
|
|
36
|
+
const settingsPath = isNestedSetting ? attributePath.split('.').slice(1).join('.') : attributePath;
|
|
37
|
+
|
|
38
|
+
// State for key-value pairs
|
|
39
|
+
const [pairs, setPairs] = useState<KeyValuePair[]>([]);
|
|
40
|
+
const [keyError, setKeyError] = useState<{[key: string]: string}>({});
|
|
41
|
+
|
|
42
|
+
// Initialize the component with the current value
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
let initialValue: Record<string, any> = {};
|
|
45
|
+
|
|
46
|
+
if (isNestedSetting && record?.settings) {
|
|
47
|
+
// For nested settings, get from record.settings
|
|
48
|
+
const settings = record.settings || {};
|
|
49
|
+
initialValue = getNestedValue(settings, settingsPath) || {};
|
|
50
|
+
} else if (record?.[attributePath]) {
|
|
51
|
+
// For direct attributes
|
|
52
|
+
initialValue = record[attributePath] || {};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Convert object to array of key-value pairs
|
|
56
|
+
const initialPairs = Object.entries(initialValue).map(([key, value]) => ({
|
|
57
|
+
key,
|
|
58
|
+
value: typeof value === 'object' ? JSON.stringify(value) : String(value),
|
|
59
|
+
id: generateId()
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
setPairs(initialPairs);
|
|
63
|
+
}, [record, attributePath]);
|
|
64
|
+
|
|
65
|
+
// Helper function to get a nested value from an object
|
|
66
|
+
const getNestedValue = (obj: any, path: string): any => {
|
|
67
|
+
if (!path) return obj;
|
|
68
|
+
const keys = path.split('.');
|
|
69
|
+
return keys.reduce((o, key) => (o && o[key] !== undefined ? o[key] : {}), obj);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Helper function to set a nested value in an object
|
|
73
|
+
const setNestedValue = (obj: any, path: string, value: any): any => {
|
|
74
|
+
if (!path) return value;
|
|
75
|
+
|
|
76
|
+
const keys = path.split('.');
|
|
77
|
+
const lastKey = keys.pop();
|
|
78
|
+
const lastObj = keys.reduce((o, key) => {
|
|
79
|
+
if (o[key] === undefined) o[key] = {};
|
|
80
|
+
return o[key];
|
|
81
|
+
}, obj);
|
|
82
|
+
|
|
83
|
+
if (lastKey) {
|
|
84
|
+
lastObj[lastKey] = value;
|
|
85
|
+
}
|
|
86
|
+
return obj;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Generate a unique ID for React keys
|
|
90
|
+
const generateId = (): string => {
|
|
91
|
+
return Math.random().toString(36).substring(2, 11);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Add a new empty key-value pair
|
|
95
|
+
const addPair = () => {
|
|
96
|
+
setPairs([...pairs, { key: '', value: '', id: generateId() }]);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// Remove a key-value pair
|
|
100
|
+
const removePair = (id: string) => {
|
|
101
|
+
setPairs(pairs.filter(pair => pair.id !== id));
|
|
102
|
+
updateFormValue(pairs.filter(pair => pair.id !== id));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Handle key change
|
|
106
|
+
const handleKeyChange = (id: string, newKey: string) => {
|
|
107
|
+
// Check for duplicate keys
|
|
108
|
+
const isDuplicate = pairs.some(pair => pair.id !== id && pair.key === newKey);
|
|
109
|
+
|
|
110
|
+
if (isDuplicate) {
|
|
111
|
+
setKeyError({...keyError, [id]: 'Duplicate key'});
|
|
112
|
+
} else {
|
|
113
|
+
setKeyError({...keyError, [id]: ''});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const updatedPairs = pairs.map(pair =>
|
|
117
|
+
pair.id === id ? { ...pair, key: newKey } : pair
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
setPairs(updatedPairs);
|
|
121
|
+
updateFormValue(updatedPairs);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Handle value change
|
|
125
|
+
const handleValueChange = (id: string, newValue: string) => {
|
|
126
|
+
const updatedPairs = pairs.map(pair =>
|
|
127
|
+
pair.id === id ? { ...pair, value: newValue } : pair
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
setPairs(updatedPairs);
|
|
131
|
+
updateFormValue(updatedPairs);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Update the form value
|
|
135
|
+
const updateFormValue = (currentPairs: KeyValuePair[]) => {
|
|
136
|
+
// Convert array of pairs to object
|
|
137
|
+
const obj = currentPairs.reduce((acc, pair) => {
|
|
138
|
+
if (pair.key.trim()) {
|
|
139
|
+
let parsedValue: any = pair.value;
|
|
140
|
+
|
|
141
|
+
// Try to parse JSON values
|
|
142
|
+
try {
|
|
143
|
+
if (pair.value.trim().startsWith('{') ||
|
|
144
|
+
pair.value.trim().startsWith('[') ||
|
|
145
|
+
pair.value.trim() === 'true' ||
|
|
146
|
+
pair.value.trim() === 'false' ||
|
|
147
|
+
!isNaN(Number(pair.value.trim()))) {
|
|
148
|
+
parsedValue = JSON.parse(pair.value);
|
|
149
|
+
}
|
|
150
|
+
} catch (e) {
|
|
151
|
+
// If parsing fails, use the string value
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
acc[pair.key] = parsedValue;
|
|
155
|
+
}
|
|
156
|
+
return acc;
|
|
157
|
+
}, {} as Record<string, any>);
|
|
158
|
+
|
|
159
|
+
// Update the form
|
|
160
|
+
if (isNestedSetting) {
|
|
161
|
+
const currentSettings = getValues('settings') || {};
|
|
162
|
+
const updatedSettings = setNestedValue({...currentSettings}, settingsPath, obj);
|
|
163
|
+
setValue('settings', updatedSettings, { shouldDirty: true });
|
|
164
|
+
} else {
|
|
165
|
+
setValue(attributePath, obj, { shouldDirty: true });
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<Box sx={{ mt: 1, mb: 2 }}>
|
|
171
|
+
<Typography variant="subtitle1" gutterBottom>
|
|
172
|
+
{attribute.label || 'Settings Editor'}
|
|
173
|
+
</Typography>
|
|
174
|
+
|
|
175
|
+
<TableContainer component={Paper} sx={{ mb: 2 }}>
|
|
176
|
+
<Table size="small">
|
|
177
|
+
<TableHead>
|
|
178
|
+
<TableRow>
|
|
179
|
+
<TableCell width="40%">Key</TableCell>
|
|
180
|
+
<TableCell width="50%">Value</TableCell>
|
|
181
|
+
<TableCell width="10%" align="center">Actions</TableCell>
|
|
182
|
+
</TableRow>
|
|
183
|
+
</TableHead>
|
|
184
|
+
<TableBody>
|
|
185
|
+
{pairs.map((pair) => (
|
|
186
|
+
<TableRow key={pair.id}>
|
|
187
|
+
<TableCell>
|
|
188
|
+
<TextField
|
|
189
|
+
fullWidth
|
|
190
|
+
size="small"
|
|
191
|
+
value={pair.key}
|
|
192
|
+
onChange={(e) => handleKeyChange(pair.id, e.target.value)}
|
|
193
|
+
error={!!keyError[pair.id]}
|
|
194
|
+
helperText={keyError[pair.id]}
|
|
195
|
+
/>
|
|
196
|
+
</TableCell>
|
|
197
|
+
<TableCell>
|
|
198
|
+
<TextField
|
|
199
|
+
fullWidth
|
|
200
|
+
size="small"
|
|
201
|
+
value={pair.value}
|
|
202
|
+
onChange={(e) => handleValueChange(pair.id, e.target.value)}
|
|
203
|
+
/>
|
|
204
|
+
</TableCell>
|
|
205
|
+
<TableCell align="center">
|
|
206
|
+
<IconButton
|
|
207
|
+
size="small"
|
|
208
|
+
onClick={() => removePair(pair.id)}
|
|
209
|
+
color="error"
|
|
210
|
+
>
|
|
211
|
+
<DeleteIcon fontSize="small" />
|
|
212
|
+
</IconButton>
|
|
213
|
+
</TableCell>
|
|
214
|
+
</TableRow>
|
|
215
|
+
))}
|
|
216
|
+
</TableBody>
|
|
217
|
+
</Table>
|
|
218
|
+
</TableContainer>
|
|
219
|
+
|
|
220
|
+
<Button
|
|
221
|
+
startIcon={<AddIcon />}
|
|
222
|
+
variant="outlined"
|
|
223
|
+
size="small"
|
|
224
|
+
onClick={addPair}
|
|
225
|
+
>
|
|
226
|
+
+
|
|
227
|
+
</Button>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
</Box>
|
|
231
|
+
);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export const JsonView: React.FC<IDashAutoAdminCustomFieldComponent> = (props) => {
|
|
235
|
+
const { attribute } = props;
|
|
236
|
+
const record = useRecordContext();
|
|
237
|
+
|
|
238
|
+
// Extract the nested path from the attribute
|
|
239
|
+
const attributePath = attribute.attribute;
|
|
240
|
+
const isNestedSetting = attributePath.startsWith('settings.');
|
|
241
|
+
const settingsPath = isNestedSetting ? attributePath.split('.').slice(1).join('.') : attributePath;
|
|
242
|
+
|
|
243
|
+
// Get the value to display
|
|
244
|
+
let displayValue: Record<string, any> = {};
|
|
245
|
+
|
|
246
|
+
if (isNestedSetting && record?.settings) {
|
|
247
|
+
// For nested settings
|
|
248
|
+
const settings = record.settings || {};
|
|
249
|
+
if (settingsPath) {
|
|
250
|
+
const keys = settingsPath.split('.');
|
|
251
|
+
displayValue = keys.reduce((o, key) => (o && o[key] !== undefined ? o[key] : {}), settings);
|
|
252
|
+
} else {
|
|
253
|
+
displayValue = settings;
|
|
254
|
+
}
|
|
255
|
+
} else if (record?.[attributePath]) {
|
|
256
|
+
// For direct attributes
|
|
257
|
+
displayValue = record[attributePath];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<Box sx={{ mt: 1, mb: 2 }}>
|
|
262
|
+
<Typography variant="subtitle1" gutterBottom>
|
|
263
|
+
{attribute.label || 'Settings'}
|
|
264
|
+
</Typography>
|
|
265
|
+
|
|
266
|
+
{Object.keys(displayValue).length > 0 ? (
|
|
267
|
+
<TableContainer component={Paper}>
|
|
268
|
+
<Table size="small">
|
|
269
|
+
<TableHead>
|
|
270
|
+
<TableRow>
|
|
271
|
+
<TableCell width="40%">Key</TableCell>
|
|
272
|
+
<TableCell width="60%">Value</TableCell>
|
|
273
|
+
</TableRow>
|
|
274
|
+
</TableHead>
|
|
275
|
+
<TableBody>
|
|
276
|
+
{Object.entries(displayValue).map(([key, value]) => (
|
|
277
|
+
<TableRow key={key}>
|
|
278
|
+
<TableCell>{key}</TableCell>
|
|
279
|
+
<TableCell>
|
|
280
|
+
{typeof value === 'object'
|
|
281
|
+
? JSON.stringify(value)
|
|
282
|
+
: String(value)
|
|
283
|
+
}
|
|
284
|
+
</TableCell>
|
|
285
|
+
</TableRow>
|
|
286
|
+
))}
|
|
287
|
+
</TableBody>
|
|
288
|
+
</Table>
|
|
289
|
+
</TableContainer>
|
|
290
|
+
) : (
|
|
291
|
+
<Typography variant="body2" color="textSecondary">
|
|
292
|
+
No settings configured
|
|
293
|
+
</Typography>
|
|
294
|
+
)}
|
|
295
|
+
</Box>
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const Json = ({ method, attribute, resourceConfig }: IDashAutoAdminCustomFieldComponent) => {
|
|
300
|
+
switch (method) {
|
|
301
|
+
case 'edit':
|
|
302
|
+
return <JsonEdit attribute={attribute} method={method} resourceConfig={resourceConfig} />;
|
|
303
|
+
case 'create':
|
|
304
|
+
return <JsonEdit attribute={attribute} method={method} resourceConfig={resourceConfig} />;
|
|
305
|
+
case 'view':
|
|
306
|
+
return <JsonView attribute={attribute} method={method} resourceConfig={resourceConfig} />;
|
|
307
|
+
default:
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export default Json;
|