@aventoapp/framework 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/index.js +6 -0
  2. package/dist/index.js.map +7 -0
  3. package/dist/native/index.js +2522 -0
  4. package/dist/native/index.js.map +7 -0
  5. package/dist/server/index.js +2776 -0
  6. package/dist/server/index.js.map +7 -0
  7. package/dist/server/workflow/index.js +537 -0
  8. package/dist/server/workflow/index.js.map +7 -0
  9. package/dist/shared/index.js +62 -0
  10. package/dist/shared/index.js.map +7 -0
  11. package/dist/web/index.js +7323 -0
  12. package/dist/web/index.js.map +7 -0
  13. package/package.json +81 -0
  14. package/schemas/Workflow.json +14 -0
  15. package/schemas/WorkflowHistory.json +22 -0
  16. package/schemas/WorkflowInstance.json +16 -0
  17. package/schemas/WorkflowState.json +18 -0
  18. package/schemas/WorkflowTransition.json +27 -0
  19. package/src/index.js +8 -0
  20. package/src/native/components/NativeAuthProvider.jsx +249 -0
  21. package/src/native/components/NativeDetail.jsx +270 -0
  22. package/src/native/components/NativeForm.jsx +543 -0
  23. package/src/native/components/NativeGrid.jsx +90 -0
  24. package/src/native/components/NativeJsonGrid.jsx +213 -0
  25. package/src/native/components/NativeJsonView.jsx +454 -0
  26. package/src/native/components/NativeJsonViewContext.js +17 -0
  27. package/src/native/components/NativeShell.jsx +68 -0
  28. package/src/native/components/NativeViewComponent.jsx +351 -0
  29. package/src/native/extensions/NativeExtensionRegistry.js +81 -0
  30. package/src/native/hooks/useNativeStore.js +72 -0
  31. package/src/native/index.js +15 -0
  32. package/src/native/layouts/NativeStackLayout.jsx +30 -0
  33. package/src/native/layouts/NativeTabLayout.jsx +96 -0
  34. package/src/native/storage.js +13 -0
  35. package/src/native/stores/NativeBaseStore.js +348 -0
  36. package/src/native/stores/NativeStoreContext.jsx +53 -0
  37. package/src/server/ai/capabilities-routes.js +106 -0
  38. package/src/server/ai/index.js +1 -0
  39. package/src/server/cache/MemoryCache.js +153 -0
  40. package/src/server/cache/index.js +2 -0
  41. package/src/server/cache/middleware.js +12 -0
  42. package/src/server/db/index.js +14 -0
  43. package/src/server/db/mongo.js +137 -0
  44. package/src/server/db/postgres.js +144 -0
  45. package/src/server/index.js +38 -0
  46. package/src/server/middleware/auth.js +682 -0
  47. package/src/server/middleware/can-flags.js +132 -0
  48. package/src/server/middleware/entityRoles.js +105 -0
  49. package/src/server/middleware/index.js +58 -0
  50. package/src/server/middleware/permissions.js +240 -0
  51. package/src/server/middleware/tenant.js +203 -0
  52. package/src/server/realtime/EventBus.js +45 -0
  53. package/src/server/realtime/WebSocketServer.js +105 -0
  54. package/src/server/realtime/index.js +3 -0
  55. package/src/server/realtime/middleware.js +18 -0
  56. package/src/server/services/email-templates.js +157 -0
  57. package/src/server/services/email.js +78 -0
  58. package/src/server/services/index.js +15 -0
  59. package/src/server/services/storage.js +119 -0
  60. package/src/server/utils/index.js +16 -0
  61. package/src/server/utils/paginate.js +65 -0
  62. package/src/server/utils/query-builder.js +293 -0
  63. package/src/server/utils/route-loader.js +61 -0
  64. package/src/server/workflow/WorkflowEngine.js +494 -0
  65. package/src/server/workflow/index.js +2 -0
  66. package/src/server/workflow/workflow-routes.js +174 -0
  67. package/src/shared/index.js +10 -0
  68. package/src/shared/utils/field-accessor.js +108 -0
  69. package/src/shared/utils/index.js +7 -0
  70. package/src/shared/utils/validation-utils.js +83 -0
  71. package/src/web/components/AppRouter/AppRouter.jsx +130 -0
  72. package/src/web/components/AppRouter/index.js +1 -0
  73. package/src/web/components/AppShell/AppShell.jsx +101 -0
  74. package/src/web/components/AppShell/DefaultUserMenu.jsx +54 -0
  75. package/src/web/components/AppShell/ShellConfig.js +53 -0
  76. package/src/web/components/AppShell/index.js +3 -0
  77. package/src/web/components/AuthProvider.jsx +426 -0
  78. package/src/web/components/CardList/CardList.jsx +272 -0
  79. package/src/web/components/CardList/index.js +2 -0
  80. package/src/web/components/DetailView/DetailView.jsx +281 -0
  81. package/src/web/components/DetailView/index.js +2 -0
  82. package/src/web/components/Form/Form.jsx +300 -0
  83. package/src/web/components/Form/FormField.jsx +226 -0
  84. package/src/web/components/Form/index.js +3 -0
  85. package/src/web/components/Grid/Grid.jsx +304 -0
  86. package/src/web/components/Grid/index.js +2 -0
  87. package/src/web/components/IconRegistry/IconRegistry.jsx +127 -0
  88. package/src/web/components/IconRegistry/index.js +1 -0
  89. package/src/web/components/JsonView/JsonView.jsx +647 -0
  90. package/src/web/components/JsonView/ViewComponent.jsx +1045 -0
  91. package/src/web/components/JsonView/ViewToolbar.jsx +141 -0
  92. package/src/web/components/JsonView/index.js +14 -0
  93. package/src/web/components/JsonView/layouts/SingleLayout.jsx +41 -0
  94. package/src/web/components/JsonView/layouts/SplitLayout.jsx +122 -0
  95. package/src/web/components/JsonView/layouts/TabLayout.jsx +112 -0
  96. package/src/web/components/JsonView/layouts/index.js +8 -0
  97. package/src/web/components/Layout.jsx +265 -0
  98. package/src/web/components/MobileLayout/MobileLayout.jsx +385 -0
  99. package/src/web/components/MobileLayout/index.js +1 -0
  100. package/src/web/components/Navigation/Navigation.jsx +248 -0
  101. package/src/web/components/Navigation/index.js +1 -0
  102. package/src/web/components/NotificationProvider.jsx +55 -0
  103. package/src/web/components/Pagination/InfiniteScroll.jsx +82 -0
  104. package/src/web/components/Pagination/Pagination.jsx +73 -0
  105. package/src/web/components/Pagination/index.js +8 -0
  106. package/src/web/components/SimpleList/SimpleList.jsx +177 -0
  107. package/src/web/components/SimpleList/index.js +2 -0
  108. package/src/web/components/TenantProvider.jsx +121 -0
  109. package/src/web/components/WorkflowActions/WorkflowActions.jsx +71 -0
  110. package/src/web/components/WorkflowActions/index.js +1 -0
  111. package/src/web/components/WorkflowField/WorkflowField.jsx +176 -0
  112. package/src/web/components/WorkflowField/index.js +2 -0
  113. package/src/web/components/WorkflowField/workflowColors.js +32 -0
  114. package/src/web/components/auth/DevTenantSelector.jsx +90 -0
  115. package/src/web/components/auth/ForgotPasswordForm.jsx +94 -0
  116. package/src/web/components/auth/RegisterForm.jsx +168 -0
  117. package/src/web/components/auth/ResetPasswordForm.jsx +121 -0
  118. package/src/web/components/auth/VerifyEmailView.jsx +85 -0
  119. package/src/web/components/auth/index.js +5 -0
  120. package/src/web/components/index.js +39 -0
  121. package/src/web/components/layouts/CardListLayout.jsx +68 -0
  122. package/src/web/components/layouts/FullscreenLayout.jsx +30 -0
  123. package/src/web/components/layouts/MobileStackLayout.jsx +28 -0
  124. package/src/web/components/layouts/WizardLayout.jsx +86 -0
  125. package/src/web/components/layouts/index.js +4 -0
  126. package/src/web/components/mobile/Badge.jsx +105 -0
  127. package/src/web/components/mobile/BadgeThemeEditor.jsx +104 -0
  128. package/src/web/components/mobile/EmptyState.jsx +30 -0
  129. package/src/web/components/mobile/QuickActionButton.jsx +77 -0
  130. package/src/web/components/mobile/ServerAutocomplete.jsx +123 -0
  131. package/src/web/components/mobile/StarRating.jsx +42 -0
  132. package/src/web/components/mobile/StatCard.jsx +65 -0
  133. package/src/web/components/mobile/index.js +7 -0
  134. package/src/web/extensions/ExtensionRegistry.js +79 -0
  135. package/src/web/extensions/index.js +7 -0
  136. package/src/web/hooks/index.js +15 -0
  137. package/src/web/hooks/useApi.js +76 -0
  138. package/src/web/hooks/useAuth.js +37 -0
  139. package/src/web/hooks/useDebouncedSave.js +158 -0
  140. package/src/web/hooks/useIsMobile.js +14 -0
  141. package/src/web/hooks/useOfflineQueue.js +99 -0
  142. package/src/web/hooks/useSelectionModel.js +143 -0
  143. package/src/web/hooks/useServerAutocomplete.js +146 -0
  144. package/src/web/hooks/useStore.js +107 -0
  145. package/src/web/hooks/useSubscription.js +130 -0
  146. package/src/web/hooks/useTenant.js +39 -0
  147. package/src/web/hooks/useTenantResolver.js +65 -0
  148. package/src/web/hooks/useUndoRedo.js +77 -0
  149. package/src/web/hooks/useViews.js +113 -0
  150. package/src/web/hooks/useWorkflow.js +190 -0
  151. package/src/web/index.js +117 -0
  152. package/src/web/stores/BaseStore.js +439 -0
  153. package/src/web/stores/StoreContext.jsx +93 -0
  154. package/src/web/stores/index.js +3 -0
  155. package/src/web/theme/index.js +3 -0
  156. package/src/web/theme/mui-theme.js +228 -0
  157. package/src/web/utils/formatTimeAgo.js +22 -0
  158. package/src/web/utils/index.js +1 -0
  159. package/src/web/views/ViewRegistry.js +235 -0
  160. package/src/web/views/index.js +2 -0
@@ -0,0 +1,226 @@
1
+ /**
2
+ * FormField Component
3
+ *
4
+ * Renders form fields based on field type configuration.
5
+ */
6
+ import React from 'react';
7
+ import {
8
+ TextField,
9
+ FormControl,
10
+ InputLabel,
11
+ Select,
12
+ MenuItem,
13
+ FormControlLabel,
14
+ Checkbox,
15
+ FormHelperText
16
+ } from '@mui/material';
17
+
18
+ /**
19
+ * FormField Component
20
+ *
21
+ * @param {Object} field - Field configuration
22
+ * @param {any} value - Current field value
23
+ * @param {Function} onChange - Called when value changes
24
+ * @param {string} error - Error message to display
25
+ * @param {boolean} disabled - Whether field is disabled
26
+ */
27
+ export function FormField({ field, value, onChange, error, disabled = false }) {
28
+ const {
29
+ name,
30
+ label,
31
+ type,
32
+ required = false,
33
+ enumOptions,
34
+ placeholder,
35
+ helperText,
36
+ multiline = false,
37
+ rows = 3,
38
+ min,
39
+ max,
40
+ step,
41
+ autoFocus = false
42
+ } = field;
43
+
44
+ const handleChange = (e) => {
45
+ let newValue = e.target.value;
46
+
47
+ // Type coercion
48
+ if (type === 'number' || type === 'decimal') {
49
+ newValue = newValue === '' ? null : Number(newValue);
50
+ } else if (type === 'boolean') {
51
+ newValue = e.target.checked;
52
+ }
53
+
54
+ onChange(name, newValue);
55
+ };
56
+
57
+ // Props for TextField (supports helperText)
58
+ const textFieldProps = {
59
+ fullWidth: true,
60
+ margin: 'normal',
61
+ disabled,
62
+ error: !!error,
63
+ helperText: error || helperText
64
+ };
65
+
66
+ // Props for FormControl (does NOT support helperText - it's added separately)
67
+ const formControlProps = {
68
+ fullWidth: true,
69
+ margin: 'normal',
70
+ disabled,
71
+ error: !!error
72
+ };
73
+
74
+ switch (type) {
75
+ case 'text':
76
+ return (
77
+ <TextField
78
+ {...textFieldProps}
79
+ label={label}
80
+ value={value ?? ''}
81
+ onChange={handleChange}
82
+ required={required}
83
+ placeholder={placeholder}
84
+ multiline
85
+ rows={rows}
86
+ autoFocus={autoFocus}
87
+ />
88
+ );
89
+
90
+ case 'enum':
91
+ return (
92
+ <FormControl {...formControlProps} required={required}>
93
+ <InputLabel>{label}</InputLabel>
94
+ <Select
95
+ value={value ?? ''}
96
+ onChange={handleChange}
97
+ label={label}
98
+ >
99
+ {enumOptions?.values?.map((option) => {
100
+ const optionValue = typeof option === 'object' ? option.value : option;
101
+ const optionLabel = typeof option === 'object' ? option.label : option;
102
+ return (
103
+ <MenuItem key={optionValue} value={optionValue}>
104
+ {optionLabel}
105
+ </MenuItem>
106
+ );
107
+ })}
108
+ </Select>
109
+ {(error || helperText) && (
110
+ <FormHelperText error={!!error}>{error || helperText}</FormHelperText>
111
+ )}
112
+ </FormControl>
113
+ );
114
+
115
+ case 'boolean':
116
+ return (
117
+ <FormControl {...formControlProps} error={!!error}>
118
+ <FormControlLabel
119
+ control={
120
+ <Checkbox
121
+ checked={!!value}
122
+ onChange={handleChange}
123
+ disabled={disabled}
124
+ />
125
+ }
126
+ label={label}
127
+ />
128
+ {(error || helperText) && (
129
+ <FormHelperText error={!!error}>{error || helperText}</FormHelperText>
130
+ )}
131
+ </FormControl>
132
+ );
133
+
134
+ case 'number':
135
+ case 'decimal':
136
+ return (
137
+ <TextField
138
+ {...textFieldProps}
139
+ label={label}
140
+ type="number"
141
+ value={value ?? ''}
142
+ onChange={handleChange}
143
+ required={required}
144
+ placeholder={placeholder}
145
+ autoFocus={autoFocus}
146
+ inputProps={{
147
+ min,
148
+ max,
149
+ step: type === 'decimal' ? step || 0.01 : step || 1
150
+ }}
151
+ />
152
+ );
153
+
154
+ case 'datetime':
155
+ return (
156
+ <TextField
157
+ {...textFieldProps}
158
+ label={label}
159
+ type="datetime-local"
160
+ value={value ? formatDateTimeLocal(value) : ''}
161
+ onChange={handleChange}
162
+ required={required}
163
+ autoFocus={autoFocus}
164
+ InputLabelProps={{ shrink: true }}
165
+ />
166
+ );
167
+
168
+ case 'date':
169
+ return (
170
+ <TextField
171
+ {...textFieldProps}
172
+ label={label}
173
+ type="date"
174
+ value={value ? formatDateLocal(value) : ''}
175
+ onChange={handleChange}
176
+ required={required}
177
+ autoFocus={autoFocus}
178
+ InputLabelProps={{ shrink: true }}
179
+ />
180
+ );
181
+
182
+ case 'string':
183
+ default:
184
+ return (
185
+ <TextField
186
+ {...textFieldProps}
187
+ label={label}
188
+ value={value ?? ''}
189
+ onChange={handleChange}
190
+ required={required}
191
+ placeholder={placeholder}
192
+ multiline={multiline}
193
+ rows={multiline ? rows : undefined}
194
+ autoFocus={autoFocus}
195
+ />
196
+ );
197
+ }
198
+ }
199
+
200
+ /**
201
+ * Format a date value for datetime-local input
202
+ */
203
+ function formatDateTimeLocal(value) {
204
+ if (!value) return '';
205
+ try {
206
+ const date = new Date(value);
207
+ return date.toISOString().slice(0, 16);
208
+ } catch {
209
+ return '';
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Format a date value for date input
215
+ */
216
+ function formatDateLocal(value) {
217
+ if (!value) return '';
218
+ try {
219
+ const date = new Date(value);
220
+ return date.toISOString().slice(0, 10);
221
+ } catch {
222
+ return '';
223
+ }
224
+ }
225
+
226
+ export default FormField;
@@ -0,0 +1,3 @@
1
+ export { Form } from './Form.jsx';
2
+ export { FormField } from './FormField.jsx';
3
+ export { default } from './Form.jsx';
@@ -0,0 +1,304 @@
1
+ /**
2
+ * Universal Grid Component
3
+ *
4
+ * Config-driven data grid with sorting, pagination, and row actions.
5
+ */
6
+ import React from 'react';
7
+ import {
8
+ Table,
9
+ TableBody,
10
+ TableCell,
11
+ TableContainer,
12
+ TableHead,
13
+ TableRow,
14
+ TableSortLabel,
15
+ TablePagination,
16
+ Paper,
17
+ IconButton,
18
+ Chip,
19
+ Typography,
20
+ CircularProgress,
21
+ Box,
22
+ Checkbox
23
+ } from '@mui/material';
24
+ import EditIcon from '@mui/icons-material/Edit';
25
+ import DeleteIcon from '@mui/icons-material/Delete';
26
+ import VisibilityIcon from '@mui/icons-material/Visibility';
27
+ import { getFieldValue } from '../../../shared/utils/field-accessor.js';
28
+ import { WorkflowField } from '../WorkflowField/index.js';
29
+
30
+ const ACTION_ICONS = {
31
+ edit: EditIcon,
32
+ delete: DeleteIcon,
33
+ view: VisibilityIcon
34
+ };
35
+
36
+ const styles = {
37
+ loading: { display: 'flex', justifyContent: 'center', py: 4 },
38
+ empty: { textAlign: 'center', py: 4 },
39
+ row: { cursor: 'pointer' },
40
+ textCell: { maxWidth: 300 }
41
+ };
42
+
43
+ /**
44
+ * Render cell content based on column type
45
+ */
46
+ function renderCell(value, column) {
47
+ if (value === null || value === undefined) {
48
+ return <Typography variant="body2" color="text.secondary">-</Typography>;
49
+ }
50
+
51
+ switch (column.type) {
52
+ case 'boolean':
53
+ return value ? 'Yes' : 'No';
54
+
55
+ case 'datetime':
56
+ case 'date':
57
+ try {
58
+ const date = new Date(value);
59
+ return column.type === 'date'
60
+ ? date.toLocaleDateString()
61
+ : date.toLocaleString();
62
+ } catch {
63
+ return String(value);
64
+ }
65
+
66
+ case 'enum':
67
+ const colorMap = column.enumConfig?.colors || {};
68
+ const color = colorMap[value] || 'default';
69
+ return <Chip label={value} color={color} size="small" />;
70
+
71
+ case 'text':
72
+ return (
73
+ <Typography variant="body2" color="text.secondary" noWrap sx={styles.textCell}>
74
+ {value}
75
+ </Typography>
76
+ );
77
+
78
+ case 'number':
79
+ case 'decimal':
80
+ return String(value);
81
+
82
+ case 'string':
83
+ default:
84
+ if (column.primary) {
85
+ return <Typography fontWeight={500}>{value}</Typography>;
86
+ }
87
+ return String(value);
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Universal Grid Component
93
+ *
94
+ * @param {Object} config - Grid configuration object
95
+ * @param {Array} data - Array of row data
96
+ * @param {boolean} loading - Whether data is loading
97
+ * @param {string} selectedId - Currently selected row ID
98
+ * @param {Array} selectedIds - Array of selected row IDs (for multi-select)
99
+ * @param {Function} onRowClick - Called when row is clicked (id, row)
100
+ * @param {Function} onAction - Called when action button clicked (actionId, row)
101
+ * @param {Function} onSelectionChange - Called when selection changes (selectedIds)
102
+ * @param {Object} sorting - Current sorting state { field, direction }
103
+ * @param {Function} onSortChange - Called when sort changes (field, direction)
104
+ * @param {Object} pagination - Current pagination state { page, pageSize, total }
105
+ * @param {Function} onPageChange - Called when page changes (page)
106
+ * @param {Function} onPageSizeChange - Called when page size changes (pageSize)
107
+ * @param {string} paginationPosition - Where to show pagination: 'bottom' (default) | 'none'
108
+ */
109
+ export function Grid({
110
+ config,
111
+ data = [],
112
+ loading = false,
113
+ selectedId,
114
+ selectedIds = [],
115
+ onRowClick,
116
+ onAction,
117
+ onSelectionChange,
118
+ onWorkflowTransition,
119
+ sorting,
120
+ onSortChange,
121
+ pagination,
122
+ onPageChange,
123
+ onPageSizeChange,
124
+ paginationPosition = 'bottom'
125
+ }) {
126
+ const {
127
+ entityName = 'Item',
128
+ entityNamePlural = 'Items',
129
+ rowKey = 'id',
130
+ selectable = false,
131
+ columns = [],
132
+ actions = [],
133
+ pagination: paginationConfig = { enabled: false },
134
+ sorting: sortingConfig = {}
135
+ } = config || {};
136
+
137
+ // Handle sort click
138
+ const handleSort = (field) => {
139
+ if (!onSortChange) return;
140
+ const isAsc = sorting?.field === field && sorting?.direction === 'asc';
141
+ onSortChange(field, isAsc ? 'desc' : 'asc');
142
+ };
143
+
144
+ // Handle select all
145
+ const handleSelectAll = (event) => {
146
+ if (!onSelectionChange) return;
147
+ if (event.target.checked) {
148
+ onSelectionChange(data.map(row => row[rowKey]));
149
+ } else {
150
+ onSelectionChange([]);
151
+ }
152
+ };
153
+
154
+ // Handle row select
155
+ const handleSelectRow = (id, event) => {
156
+ if (!onSelectionChange) return;
157
+ event.stopPropagation();
158
+ const selectedSet = new Set(selectedIds);
159
+ if (selectedSet.has(id)) {
160
+ selectedSet.delete(id);
161
+ } else {
162
+ selectedSet.add(id);
163
+ }
164
+ onSelectionChange(Array.from(selectedSet));
165
+ };
166
+
167
+ // Loading state
168
+ if (loading && data.length === 0) {
169
+ return (
170
+ <Box sx={styles.loading}>
171
+ <CircularProgress />
172
+ </Box>
173
+ );
174
+ }
175
+
176
+ // Empty state
177
+ if (!loading && data.length === 0) {
178
+ return (
179
+ <Box sx={styles.empty}>
180
+ <Typography color="text.secondary">
181
+ No {entityNamePlural.toLowerCase()} yet. Create one!
182
+ </Typography>
183
+ </Box>
184
+ );
185
+ }
186
+
187
+ const numSelected = selectedIds.length;
188
+ const rowCount = data.length;
189
+
190
+ return (
191
+ <Box>
192
+ <TableContainer component={Paper} elevation={0}>
193
+ <Table>
194
+ <TableHead>
195
+ <TableRow>
196
+ {selectable && (
197
+ <TableCell padding="checkbox">
198
+ <Checkbox
199
+ indeterminate={numSelected > 0 && numSelected < rowCount}
200
+ checked={rowCount > 0 && numSelected === rowCount}
201
+ onChange={handleSelectAll}
202
+ />
203
+ </TableCell>
204
+ )}
205
+ {columns.map((column) => (
206
+ <TableCell key={column.field}>
207
+ {column.sortable && onSortChange ? (
208
+ <TableSortLabel
209
+ active={sorting?.field === column.field}
210
+ direction={sorting?.field === column.field ? sorting.direction : 'asc'}
211
+ onClick={() => handleSort(column.field)}
212
+ >
213
+ {column.header}
214
+ </TableSortLabel>
215
+ ) : (
216
+ column.header
217
+ )}
218
+ </TableCell>
219
+ ))}
220
+ {actions.length > 0 && (
221
+ <TableCell align="right">Actions</TableCell>
222
+ )}
223
+ </TableRow>
224
+ </TableHead>
225
+ <TableBody>
226
+ {data.map((row) => {
227
+ const rowId = row[rowKey];
228
+ const isSelected = selectedIds.includes(rowId) || selectedId === rowId;
229
+
230
+ return (
231
+ <TableRow
232
+ key={rowId}
233
+ hover
234
+ selected={isSelected}
235
+ onClick={() => onRowClick?.(rowId, row)}
236
+ sx={onRowClick ? styles.row : undefined}
237
+ >
238
+ {selectable && (
239
+ <TableCell padding="checkbox">
240
+ <Checkbox
241
+ checked={selectedIds.includes(rowId)}
242
+ onClick={(e) => handleSelectRow(rowId, e)}
243
+ />
244
+ </TableCell>
245
+ )}
246
+ {columns.map((column) => (
247
+ <TableCell key={column.field}>
248
+ {column.type === 'workflow' ? (
249
+ <WorkflowField
250
+ mode="compact"
251
+ workflowState={getFieldValue(row, column.field)}
252
+ workflowInstanceId={getFieldValue(row, column.workflowInstanceField || 'workflow_instance_id')}
253
+ stateColors={column.workflowConfig?.colors}
254
+ onTransitionComplete={onWorkflowTransition}
255
+ />
256
+ ) : (
257
+ renderCell(getFieldValue(row, column.field), column)
258
+ )}
259
+ </TableCell>
260
+ ))}
261
+ {actions.length > 0 && (
262
+ <TableCell align="right">
263
+ {actions.map((action) => {
264
+ const Icon = ACTION_ICONS[action.id] || ACTION_ICONS.view;
265
+ return (
266
+ <IconButton
267
+ key={action.id}
268
+ size="small"
269
+ color={action.color || 'default'}
270
+ title={action.label}
271
+ onClick={(e) => {
272
+ e.stopPropagation();
273
+ onAction?.(action.id, row);
274
+ }}
275
+ >
276
+ <Icon fontSize="small" />
277
+ </IconButton>
278
+ );
279
+ })}
280
+ </TableCell>
281
+ )}
282
+ </TableRow>
283
+ );
284
+ })}
285
+ </TableBody>
286
+ </Table>
287
+ </TableContainer>
288
+
289
+ {paginationConfig.enabled && pagination && paginationPosition !== 'none' && (
290
+ <TablePagination
291
+ component="div"
292
+ count={pagination.total || 0}
293
+ page={(pagination.page || 1) - 1}
294
+ rowsPerPage={pagination.pageSize || 25}
295
+ onPageChange={(e, newPage) => onPageChange?.(newPage + 1)}
296
+ onRowsPerPageChange={(e) => onPageSizeChange?.(parseInt(e.target.value, 10))}
297
+ rowsPerPageOptions={paginationConfig.pageSizeOptions || [10, 25, 50, 100]}
298
+ />
299
+ )}
300
+ </Box>
301
+ );
302
+ }
303
+
304
+ export default Grid;
@@ -0,0 +1,2 @@
1
+ export { Grid } from './Grid.jsx';
2
+ export { default } from './Grid.jsx';
@@ -0,0 +1,127 @@
1
+ /**
2
+ * IconRegistry
3
+ *
4
+ * Shared icon resolution for navigation, shells, and layout components.
5
+ * Provides a map of default MUI icons plus register/resolve API.
6
+ */
7
+ import React from 'react';
8
+
9
+ // Default MUI icons
10
+ import HomeIcon from '@mui/icons-material/Home';
11
+ import PlaceIcon from '@mui/icons-material/Place';
12
+ import BarChartIcon from '@mui/icons-material/BarChart';
13
+ import SportsGolfIcon from '@mui/icons-material/SportsGolf';
14
+ import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
15
+ import DashboardIcon from '@mui/icons-material/Dashboard';
16
+ import SettingsIcon from '@mui/icons-material/Settings';
17
+ import PersonIcon from '@mui/icons-material/Person';
18
+ import GroupIcon from '@mui/icons-material/Group';
19
+ import AddIcon from '@mui/icons-material/Add';
20
+ import EditIcon from '@mui/icons-material/Edit';
21
+ import DeleteIcon from '@mui/icons-material/Delete';
22
+ import SearchIcon from '@mui/icons-material/Search';
23
+ import StarIcon from '@mui/icons-material/Star';
24
+ import InfoIcon from '@mui/icons-material/Info';
25
+ import WarningIcon from '@mui/icons-material/Warning';
26
+ import ListAltIcon from '@mui/icons-material/ListAlt';
27
+ import FolderIcon from '@mui/icons-material/Folder';
28
+ import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
29
+ import CalendarTodayIcon from '@mui/icons-material/CalendarToday';
30
+ import EmailIcon from '@mui/icons-material/Email';
31
+ import NotificationsIcon from '@mui/icons-material/Notifications';
32
+ import BuildIcon from '@mui/icons-material/Build';
33
+ import HelpIcon from '@mui/icons-material/Help';
34
+ import InventoryIcon from '@mui/icons-material/Inventory';
35
+ import AssessmentIcon from '@mui/icons-material/Assessment';
36
+ import AccountBalanceIcon from '@mui/icons-material/AccountBalance';
37
+
38
+ class IconRegistry {
39
+ constructor() {
40
+ this.icons = new Map([
41
+ ['home', HomeIcon],
42
+ ['place', PlaceIcon],
43
+ ['bar_chart', BarChartIcon],
44
+ ['sports_golf', SportsGolfIcon],
45
+ ['more_horiz', MoreHorizIcon],
46
+ ['dashboard', DashboardIcon],
47
+ ['settings', SettingsIcon],
48
+ ['person', PersonIcon],
49
+ ['group', GroupIcon],
50
+ ['add', AddIcon],
51
+ ['edit', EditIcon],
52
+ ['delete', DeleteIcon],
53
+ ['search', SearchIcon],
54
+ ['star', StarIcon],
55
+ ['info', InfoIcon],
56
+ ['warning', WarningIcon],
57
+ ['list', ListAltIcon],
58
+ ['folder', FolderIcon],
59
+ ['shopping_cart', ShoppingCartIcon],
60
+ ['calendar', CalendarTodayIcon],
61
+ ['email', EmailIcon],
62
+ ['notifications', NotificationsIcon],
63
+ ['build', BuildIcon],
64
+ ['help', HelpIcon],
65
+ ['inventory', InventoryIcon],
66
+ ['assessment', AssessmentIcon],
67
+ ['account_balance', AccountBalanceIcon],
68
+ ]);
69
+ }
70
+
71
+ /**
72
+ * Register a custom icon
73
+ * @param {string} name - Icon name
74
+ * @param {React.Component} component - MUI icon component or any React component
75
+ */
76
+ register(name, component) {
77
+ this.icons.set(name.toLowerCase(), component);
78
+ return this;
79
+ }
80
+
81
+ /**
82
+ * Resolve an icon prop to a React element.
83
+ * Handles: React elements (passthrough), component functions (instantiate),
84
+ * strings (map lookup), null (return null).
85
+ * @param {string|React.Component|React.Element|null} icon
86
+ * @returns {React.Element|null}
87
+ */
88
+ resolve(icon) {
89
+ if (!icon) return null;
90
+
91
+ // Already a React element
92
+ if (React.isValidElement(icon)) {
93
+ return icon;
94
+ }
95
+
96
+ // Component class or function
97
+ if (typeof icon === 'function') {
98
+ const IconComponent = icon;
99
+ return <IconComponent />;
100
+ }
101
+
102
+ // String lookup
103
+ if (typeof icon === 'string') {
104
+ const IconComponent = this.icons.get(icon.toLowerCase());
105
+ if (IconComponent) {
106
+ return <IconComponent />;
107
+ }
108
+ }
109
+
110
+ return null;
111
+ }
112
+ }
113
+
114
+ // Singleton instance
115
+ export const iconRegistry = new IconRegistry();
116
+
117
+ /**
118
+ * Convenience function for resolving icons
119
+ * @param {string|React.Component|React.Element|null} icon
120
+ * @returns {React.Element|null}
121
+ */
122
+ export function resolveIcon(icon) {
123
+ return iconRegistry.resolve(icon);
124
+ }
125
+
126
+ export { IconRegistry };
127
+ export default iconRegistry;
@@ -0,0 +1 @@
1
+ export { IconRegistry, iconRegistry, resolveIcon } from './IconRegistry.jsx';