@deix/rossini-identity-management 1.1.3 → 2.0.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 (40) hide show
  1. package/lib/app/[locale]/groups/{page.js → page.jsx} +1 -1
  2. package/lib/app/[locale]/{layout.js → layout.jsx} +4 -3
  3. package/lib/app/[locale]/users/{page.js → page.jsx} +1 -1
  4. package/lib/app/{layout.js → layout.jsx} +7 -3
  5. package/lib/components/AddItemDialog.jsx +50 -0
  6. package/lib/components/DeleteConfirmationDialog.jsx +44 -0
  7. package/lib/components/SearchField.jsx +18 -0
  8. package/lib/components/groups/{CreateGroupDialog.js → CreateGroupDialog.jsx} +6 -4
  9. package/lib/components/groups/{GroupDetails.js → GroupDetails.jsx} +3 -2
  10. package/lib/components/groups/GroupForm.d.ts.map +1 -1
  11. package/lib/components/groups/GroupForm.jsx +46 -0
  12. package/lib/components/groups/GroupTabs.jsx +33 -0
  13. package/lib/components/groups/GroupUsers.jsx +88 -0
  14. package/lib/components/groups/Groups.jsx +110 -0
  15. package/lib/components/groups/GroupsTable.jsx +55 -0
  16. package/lib/components/users/{CreateUserDialog.js → CreateUserDialog.jsx} +6 -4
  17. package/lib/components/users/{UserCredentials.js → UserCredentials.jsx} +5 -2
  18. package/lib/components/users/{UserDetails.js → UserDetails.jsx} +3 -2
  19. package/lib/components/users/UserForm.d.ts.map +1 -1
  20. package/lib/components/users/UserForm.jsx +79 -0
  21. package/lib/components/users/UserGroups.jsx +78 -0
  22. package/lib/components/users/{Users.js → Users.jsx} +54 -41
  23. package/lib/components/users/UsersTable.jsx +78 -0
  24. package/lib/components/users/UsersTabs.jsx +36 -0
  25. package/lib/config/{index.js → index.jsx} +3 -1
  26. package/lib/tsconfig.tsbuildinfo +1 -1
  27. package/lib/utils/hooks/{useAPIClient.js → useAPIClient.jsx} +4 -2
  28. package/package.json +17 -25
  29. package/lib/components/AddItemDialog.js +0 -45
  30. package/lib/components/DeleteConfirmationDialog.js +0 -35
  31. package/lib/components/SearchField.js +0 -16
  32. package/lib/components/groups/GroupForm.js +0 -38
  33. package/lib/components/groups/GroupTabs.js +0 -29
  34. package/lib/components/groups/GroupUsers.js +0 -73
  35. package/lib/components/groups/Groups.js +0 -97
  36. package/lib/components/groups/GroupsTable.js +0 -43
  37. package/lib/components/users/UserForm.js +0 -66
  38. package/lib/components/users/UserGroups.js +0 -63
  39. package/lib/components/users/UsersTable.js +0 -64
  40. package/lib/components/users/UsersTabs.js +0 -32
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import { isStringTranslation, useLocale } from '@deix/rossini-core';
3
- import CheckIcon from '@mui/icons-material/Check';
4
- import CloseIcon from '@mui/icons-material/Close';
5
- import DeleteIcon from '@mui/icons-material/Delete';
6
- import { IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, useTheme, } from '@mui/material';
7
- import { useState } from 'react';
8
- import DeleteConfirmationDialog from '../DeleteConfirmationDialog';
9
- const usersTableColumns = [
10
- {
11
- id: 'firstName',
12
- label: { en: 'First Name', it: 'Nome' },
13
- },
14
- {
15
- id: 'lastName',
16
- label: { en: 'Last Name', it: 'Cognome' },
17
- },
18
- {
19
- id: 'username',
20
- label: { en: 'Username', it: 'Username' },
21
- },
22
- { id: 'email', label: 'Email' },
23
- {
24
- id: 'enabled',
25
- label: { en: 'Enabled', it: 'Utente Abilitato' },
26
- },
27
- ];
28
- const UsersTable = ({ users = [], selectedUser, setSelectedUser, onDelete, emailAsUsername = false, disableDelete = false, }) => {
29
- const locale = useLocale();
30
- const muiTheme = useTheme();
31
- const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
32
- const [deleteUser, setDeleteUser] = useState();
33
- return (React.createElement(React.Fragment, null,
34
- React.createElement(TableContainer, null,
35
- React.createElement(Table, { size: 'small' },
36
- React.createElement(TableHead, null,
37
- React.createElement(TableRow, null,
38
- usersTableColumns
39
- .filter((c) => c.id !== 'username' || !emailAsUsername)
40
- .map((col) => (React.createElement(TableCell, { key: col.id, align: col.align || 'inherit' }, isStringTranslation(col.label)
41
- ? col.label[locale]
42
- : col.label))),
43
- React.createElement(TableCell, { padding: 'none' }, ''))),
44
- React.createElement(TableBody, null, users.map((user, rowIdx) => (React.createElement(TableRow, { key: rowIdx, onClick: () => setSelectedUser(user), sx: {
45
- cursor: 'pointer',
46
- background: selectedUser && user.id === selectedUser.id
47
- ? muiTheme.palette.primary.light
48
- : undefined,
49
- } },
50
- React.createElement(TableCell, null, user.firstName),
51
- React.createElement(TableCell, null, user.lastName),
52
- !emailAsUsername && React.createElement(TableCell, null, user.username),
53
- React.createElement(TableCell, null, user.email),
54
- React.createElement(TableCell, null, user.enabled ? React.createElement(CheckIcon, null) : React.createElement(CloseIcon, null)),
55
- !disableDelete && (React.createElement(TableCell, { padding: 'none', align: 'right' },
56
- React.createElement(IconButton, { size: 'small', onClick: (evt) => {
57
- evt.stopPropagation();
58
- setOpenConfirmationDialog(true);
59
- setDeleteUser(user);
60
- } },
61
- React.createElement(DeleteIcon, null)))))))))),
62
- React.createElement(DeleteConfirmationDialog, { open: openConfirmationDialog, onClose: () => setOpenConfirmationDialog(false), onConfirm: () => (deleteUser ? onDelete(deleteUser) : {}) })));
63
- };
64
- export default UsersTable;
@@ -1,32 +0,0 @@
1
- 'use client';
2
- import React, { useState } from 'react';
3
- import { Box, Tab, Tabs } from '@mui/material';
4
- import { useLocale } from '@deix/rossini-core';
5
- import usersTranslations from '../../lang/users';
6
- import UserDetails from './UserDetails';
7
- import UserGroups from './UserGroups';
8
- import UserCredentials from './UserCredentials';
9
- const UserTabs = ({ user, additionalTabs = [], onUserUpdate, editUsername, emailAsUsername = false, hideGroupsSelection = false, }) => {
10
- const locale = useLocale();
11
- const [selectedTab, setSelectedTab] = useState('DETAILS');
12
- return (React.createElement(Box, { sx: {
13
- flexGrow: 1,
14
- maxWidth: '100%',
15
- overflowX: 'hidden',
16
- alignSelf: 'stretch',
17
- } },
18
- React.createElement(Box, { sx: { borderBottom: 1, borderColor: 'divider' } },
19
- React.createElement(Tabs, { value: selectedTab, onChange: (_evt, newValue) => {
20
- setSelectedTab(newValue);
21
- }, "aria-label": 'basic tabs example' },
22
- React.createElement(Tab, { label: usersTranslations.details[locale], value: 'DETAILS' }),
23
- !hideGroupsSelection && (React.createElement(Tab, { label: usersTranslations.userGroups[locale], value: 'USER_GROUPS' })),
24
- React.createElement(Tab, { label: usersTranslations.credentials[locale], value: 'CREDENTIALS' }),
25
- additionalTabs.map((tab, index) => (React.createElement(Tab, { key: `tab${index}`, label: tab.title[locale], value: `ADDITIONAL_TAB_${index}` }))))),
26
- React.createElement(Box, { sx: { p: 1 } },
27
- selectedTab === 'DETAILS' && (React.createElement(UserDetails, { user: user, onUserUpdate: onUserUpdate, editUsername: editUsername, emailAsUsername: emailAsUsername })),
28
- selectedTab === 'USER_GROUPS' && !hideGroupsSelection && (React.createElement(UserGroups, { user: user })),
29
- selectedTab === 'CREDENTIALS' && React.createElement(UserCredentials, { user: user }),
30
- additionalTabs.map((tab, index) => selectedTab === `ADDITIONAL_TAB_${index}` && (React.createElement(tab.component, { key: `tab${index}`, user: user }))))));
31
- };
32
- export default UserTabs;