@deix/rossini-identity-management 4.1.1 → 5.0.1
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/lib/src/app/[locale]/groups/page.d.ts.map +1 -0
- package/lib/{app → src/app}/[locale]/layout.d.ts +1 -1
- package/lib/src/app/[locale]/layout.d.ts.map +1 -0
- package/lib/src/app/[locale]/users/page.d.ts +4 -0
- package/lib/src/app/[locale]/users/page.d.ts.map +1 -0
- package/lib/{app → src/app}/layout.d.ts +1 -1
- package/lib/src/app/layout.d.ts.map +1 -0
- package/lib/{components → src/components}/AddItemDialog.d.ts +2 -1
- package/lib/src/components/AddItemDialog.d.ts.map +1 -0
- package/lib/{components → src/components}/AddItemDialog.js +7 -20
- package/lib/{components → src/components}/DeleteConfirmationDialog.d.ts +2 -1
- package/lib/src/components/DeleteConfirmationDialog.d.ts.map +1 -0
- package/lib/src/components/DeleteConfirmationDialog.js +12 -0
- package/lib/{components → src/components}/SearchField.d.ts +2 -1
- package/lib/src/components/SearchField.d.ts.map +1 -0
- package/lib/{components → src/components}/SearchField.js +5 -3
- package/lib/{components → src/components}/groups/CreateGroupDialog.d.ts +2 -1
- package/lib/src/components/groups/CreateGroupDialog.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/CreateGroupDialog.js +3 -3
- package/lib/{components → src/components}/groups/GroupDetails.d.ts +2 -1
- package/lib/src/components/groups/GroupDetails.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupDetails.js +1 -1
- package/lib/{components → src/components}/groups/GroupForm.d.ts +2 -1
- package/lib/src/components/groups/GroupForm.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupForm.js +4 -4
- package/lib/{components → src/components}/groups/GroupTabs.d.ts +1 -1
- package/lib/src/components/groups/GroupTabs.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupTabs.js +3 -3
- package/lib/src/components/groups/GroupUsers.d.ts +8 -0
- package/lib/src/components/groups/GroupUsers.d.ts.map +1 -0
- package/lib/src/components/groups/GroupUsers.js +46 -0
- package/lib/{components → src/components}/groups/Groups.d.ts +2 -1
- package/lib/src/components/groups/Groups.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/Groups.js +8 -6
- package/lib/{components → src/components}/groups/GroupsTable.d.ts +2 -1
- package/lib/src/components/groups/GroupsTable.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupsTable.js +6 -7
- package/lib/src/components/index.d.ts.map +1 -0
- package/lib/src/components/tables/Table.d.ts +29 -0
- package/lib/src/components/tables/Table.d.ts.map +1 -0
- package/lib/src/components/tables/Table.js +96 -0
- package/lib/{components → src/components}/users/CreateUserDialog.d.ts +2 -1
- package/lib/src/components/users/CreateUserDialog.d.ts.map +1 -0
- package/lib/{components → src/components}/users/CreateUserDialog.js +3 -3
- package/lib/{components → src/components}/users/UserCredentials.d.ts +2 -1
- package/lib/src/components/users/UserCredentials.d.ts.map +1 -0
- package/lib/{components → src/components}/users/UserCredentials.js +3 -3
- package/lib/{components → src/components}/users/UserDetails.d.ts +2 -1
- package/lib/src/components/users/UserDetails.d.ts.map +1 -0
- package/lib/{components → src/components}/users/UserDetails.js +1 -1
- package/lib/{components → src/components}/users/UserForm.d.ts +2 -1
- package/lib/src/components/users/UserForm.d.ts.map +1 -0
- package/lib/src/components/users/UserForm.js +48 -0
- package/lib/src/components/users/UserGroups.d.ts +8 -0
- package/lib/src/components/users/UserGroups.d.ts.map +1 -0
- package/lib/{components → src/components}/users/UserGroups.js +6 -8
- package/lib/{components → src/components}/users/Users.d.ts +2 -1
- package/lib/src/components/users/Users.d.ts.map +1 -0
- package/lib/{components → src/components}/users/Users.js +17 -7
- package/lib/{components → src/components}/users/UsersTable.d.ts +5 -1
- package/lib/src/components/users/UsersTable.d.ts.map +1 -0
- package/lib/src/components/users/UsersTable.js +25 -0
- package/lib/{components → src/components}/users/UsersTabs.d.ts +1 -1
- package/lib/src/components/users/UsersTabs.d.ts.map +1 -0
- package/lib/src/components/users/UsersTabs.js +22 -0
- package/lib/src/config/i18n.d.ts.map +1 -0
- package/lib/{config → src/config}/index.d.ts +1 -1
- package/lib/src/config/index.d.ts.map +1 -0
- package/lib/src/config/palette.d.ts.map +1 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/lang/common.d.ts +6 -0
- package/lib/src/lang/common.d.ts.map +1 -0
- package/lib/src/lang/common.js +35 -0
- package/lib/src/lang/groups.d.ts.map +1 -0
- package/lib/{lang → src/lang}/groups.js +4 -0
- package/lib/src/lang/home.d.ts.map +1 -0
- package/lib/src/lang/tables.d.ts +6 -0
- package/lib/src/lang/tables.d.ts.map +1 -0
- package/lib/src/lang/tables.js +11 -0
- package/lib/src/lang/users.d.ts.map +1 -0
- package/lib/{lang → src/lang}/users.js +16 -0
- package/lib/src/proxy.d.ts.map +1 -0
- package/lib/src/types/config.d.ts.map +1 -0
- package/lib/src/types/groups.d.ts.map +1 -0
- package/lib/{utils → src/types}/index.d.ts.map +1 -1
- package/lib/src/types/tables.d.ts.map +1 -0
- package/lib/src/types/users.d.ts.map +1 -0
- package/lib/{utils/hooks → src/utils/helpers}/index.d.ts.map +1 -1
- package/lib/src/utils/hooks/groups.d.ts.map +1 -0
- package/lib/{utils → src/utils}/hooks/groups.js +10 -10
- package/lib/{utils/helpers → src/utils/hooks}/index.d.ts.map +1 -1
- package/lib/{utils → src/utils}/hooks/useAPIClient.d.ts +1 -1
- package/lib/src/utils/hooks/useAPIClient.d.ts.map +1 -0
- package/lib/src/utils/hooks/useTranslate.d.ts +6 -0
- package/lib/src/utils/hooks/useTranslate.d.ts.map +1 -0
- package/lib/src/utils/hooks/useTranslate.js +16 -0
- package/lib/src/utils/hooks/users.d.ts.map +1 -0
- package/lib/{utils → src/utils}/hooks/users.js +19 -19
- package/lib/{types → src/utils}/index.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -41
- package/lib/app/[locale]/groups/page.d.ts.map +0 -1
- package/lib/app/[locale]/layout.d.ts.map +0 -1
- package/lib/app/[locale]/users/page.d.ts +0 -3
- package/lib/app/[locale]/users/page.d.ts.map +0 -1
- package/lib/app/layout.d.ts.map +0 -1
- package/lib/components/AddItemDialog.d.ts.map +0 -1
- package/lib/components/DeleteConfirmationDialog.d.ts.map +0 -1
- package/lib/components/DeleteConfirmationDialog.js +0 -29
- package/lib/components/SearchField.d.ts.map +0 -1
- package/lib/components/groups/CreateGroupDialog.d.ts.map +0 -1
- package/lib/components/groups/GroupDetails.d.ts.map +0 -1
- package/lib/components/groups/GroupForm.d.ts.map +0 -1
- package/lib/components/groups/GroupTabs.d.ts.map +0 -1
- package/lib/components/groups/GroupUsers.d.ts +0 -7
- package/lib/components/groups/GroupUsers.d.ts.map +0 -1
- package/lib/components/groups/GroupUsers.js +0 -56
- package/lib/components/groups/Groups.d.ts.map +0 -1
- package/lib/components/groups/GroupsTable.d.ts.map +0 -1
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/users/CreateUserDialog.d.ts.map +0 -1
- package/lib/components/users/UserCredentials.d.ts.map +0 -1
- package/lib/components/users/UserDetails.d.ts.map +0 -1
- package/lib/components/users/UserForm.d.ts.map +0 -1
- package/lib/components/users/UserForm.js +0 -50
- package/lib/components/users/UserGroups.d.ts +0 -7
- package/lib/components/users/UserGroups.d.ts.map +0 -1
- package/lib/components/users/Users.d.ts.map +0 -1
- package/lib/components/users/UsersTable.d.ts.map +0 -1
- package/lib/components/users/UsersTable.js +0 -48
- package/lib/components/users/UsersTabs.d.ts.map +0 -1
- package/lib/components/users/UsersTabs.js +0 -22
- package/lib/config/i18n.d.ts.map +0 -1
- package/lib/config/index.d.ts.map +0 -1
- package/lib/config/palette.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/lang/groups.d.ts.map +0 -1
- package/lib/lang/home.d.ts.map +0 -1
- package/lib/lang/users.d.ts.map +0 -1
- package/lib/proxy.d.ts.map +0 -1
- package/lib/types/config.d.ts.map +0 -1
- package/lib/types/groups.d.ts.map +0 -1
- package/lib/types/tables.d.ts.map +0 -1
- package/lib/types/users.d.ts.map +0 -1
- package/lib/utils/hooks/groups.d.ts.map +0 -1
- package/lib/utils/hooks/useAPIClient.d.ts.map +0 -1
- package/lib/utils/hooks/users.d.ts.map +0 -1
- /package/lib/{app → src/app}/[locale]/groups/page.d.ts +0 -0
- /package/lib/{app → src/app}/[locale]/groups/page.js +0 -0
- /package/lib/{app → src/app}/[locale]/layout.js +0 -0
- /package/lib/{app → src/app}/[locale]/users/page.js +0 -0
- /package/lib/{app → src/app}/layout.js +0 -0
- /package/lib/{components → src/components}/index.d.ts +0 -0
- /package/lib/{components → src/components}/index.js +0 -0
- /package/lib/{config → src/config}/i18n.d.ts +0 -0
- /package/lib/{config → src/config}/i18n.js +0 -0
- /package/lib/{config → src/config}/index.js +0 -0
- /package/lib/{config → src/config}/palette.d.ts +0 -0
- /package/lib/{config → src/config}/palette.js +0 -0
- /package/lib/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/{index.js → src/index.js} +0 -0
- /package/lib/{lang → src/lang}/groups.d.ts +0 -0
- /package/lib/{lang → src/lang}/home.d.ts +0 -0
- /package/lib/{lang → src/lang}/home.js +0 -0
- /package/lib/{lang → src/lang}/users.d.ts +0 -0
- /package/lib/{proxy.d.ts → src/proxy.d.ts} +0 -0
- /package/lib/{proxy.js → src/proxy.js} +0 -0
- /package/lib/{types → src/types}/config.d.ts +0 -0
- /package/lib/{types → src/types}/config.js +0 -0
- /package/lib/{types → src/types}/groups.d.ts +0 -0
- /package/lib/{types → src/types}/groups.js +0 -0
- /package/lib/{types → src/types}/index.d.ts +0 -0
- /package/lib/{types → src/types}/index.js +0 -0
- /package/lib/{types → src/types}/tables.d.ts +0 -0
- /package/lib/{types → src/types}/tables.js +0 -0
- /package/lib/{types → src/types}/users.d.ts +0 -0
- /package/lib/{types → src/types}/users.js +0 -0
- /package/lib/{utils → src/utils}/helpers/index.d.ts +0 -0
- /package/lib/{utils → src/utils}/helpers/index.js +0 -0
- /package/lib/{utils → src/utils}/hooks/groups.d.ts +0 -0
- /package/lib/{utils → src/utils}/hooks/index.d.ts +0 -0
- /package/lib/{utils → src/utils}/hooks/index.js +0 -0
- /package/lib/{utils → src/utils}/hooks/useAPIClient.js +0 -0
- /package/lib/{utils → src/utils}/hooks/users.d.ts +0 -0
- /package/lib/{utils → src/utils}/index.d.ts +0 -0
- /package/lib/{utils → src/utils}/index.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app/[locale]/groups/page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAGvB,CAAC;eAEa,UAAU"}
|
|
@@ -6,5 +6,5 @@ import '@fontsource/raleway/600.css';
|
|
|
6
6
|
import '@fontsource/raleway/700.css';
|
|
7
7
|
export default function RootLayout({ children, }: {
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
-
}):
|
|
9
|
+
}): React.JSX.Element;
|
|
10
10
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app/[locale]/layout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAiBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app/[locale]/users/page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,SAAS,yBAGd,CAAC;eAEa,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/app/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AAGrC,eAAO,MAAM,QAAQ;IACnB,KAAK;CACN,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAeA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { StringTranslation } from '@deix/rossini-core';
|
|
2
3
|
interface Option {
|
|
3
4
|
value: string;
|
|
@@ -10,6 +11,6 @@ interface AddItemDialogProps {
|
|
|
10
11
|
onClose: () => void;
|
|
11
12
|
onConfirm: (value: Option | null) => void;
|
|
12
13
|
}
|
|
13
|
-
declare const AddItemDialog: ({ title, options, open, onClose, onConfirm, }: AddItemDialogProps) =>
|
|
14
|
+
declare const AddItemDialog: ({ title, options, open, onClose, onConfirm, }: AddItemDialogProps) => React.JSX.Element;
|
|
14
15
|
export default AddItemDialog;
|
|
15
16
|
//# sourceMappingURL=AddItemDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddItemDialog.d.ts","sourceRoot":"","sources":["../../../src/components/AddItemDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKvD,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C;AAED,QAAA,MAAM,aAAa,kDAMhB,kBAAkB,sBAkDpB,CAAC;eAEa,aAAa"}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Autocomplete, Button, Dialog, DialogActions, DialogContent, DialogTitle, TextField, } from '@mui/material';
|
|
3
|
-
import { useLocale } from '@deix/rossini-core';
|
|
4
3
|
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
en: 'Add',
|
|
8
|
-
it: 'Aggiungi',
|
|
9
|
-
},
|
|
10
|
-
cancel: {
|
|
11
|
-
en: 'Cancel',
|
|
12
|
-
it: 'Annulla',
|
|
13
|
-
},
|
|
14
|
-
search: {
|
|
15
|
-
en: 'Search...',
|
|
16
|
-
it: 'Cerca...',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
4
|
+
import useTranslate from '../utils/hooks/useTranslate';
|
|
5
|
+
import commonTranslations from '../lang/common';
|
|
19
6
|
const AddItemDialog = ({ title, options, open, onClose, onConfirm, }) => {
|
|
20
|
-
const
|
|
7
|
+
const t = useTranslate();
|
|
21
8
|
const [value, setValue] = useState(null);
|
|
22
9
|
// Reset the value when the dialog is closed
|
|
23
10
|
useEffect(() => {
|
|
@@ -25,15 +12,15 @@ const AddItemDialog = ({ title, options, open, onClose, onConfirm, }) => {
|
|
|
25
12
|
setValue(null);
|
|
26
13
|
}
|
|
27
14
|
}, [open]);
|
|
28
|
-
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: title
|
|
15
|
+
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: t(title) }), _jsx(DialogContent, { children: _jsx(Autocomplete
|
|
29
16
|
// multiple
|
|
30
17
|
, {
|
|
31
18
|
// multiple
|
|
32
|
-
options: options ?? [], getOptionLabel: (option) => option.label, getOptionKey: (option) => option.value, isOptionEqualToValue: (option, value) => option.value === value.value, renderInput: (params) => (_jsx(TextField, { ...params, label:
|
|
19
|
+
options: options ?? [], getOptionLabel: (option) => option.label, getOptionKey: (option) => option.value, isOptionEqualToValue: (option, value) => option.value === value.value, renderInput: (params) => (_jsx(TextField, { ...params, label: t(commonTranslations.search), placeholder: '' })), onChange: (event, newValue) => {
|
|
33
20
|
setValue(newValue);
|
|
34
|
-
}, value: value }) }), _jsxs(DialogActions, { children: [_jsx(Button, { size: 'small', variant: 'outlined', onClick: onClose, children:
|
|
21
|
+
}, value: value }) }), _jsxs(DialogActions, { children: [_jsx(Button, { size: 'small', variant: 'outlined', onClick: onClose, children: t(commonTranslations.cancel) }), _jsx(Button, { variant: 'contained', onClick: () => {
|
|
35
22
|
onConfirm(value);
|
|
36
23
|
onClose();
|
|
37
|
-
}, children:
|
|
24
|
+
}, children: t(commonTranslations.add) })] })] }));
|
|
38
25
|
};
|
|
39
26
|
export default AddItemDialog;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export interface DeleteConfirmationDialogProps {
|
|
2
3
|
open: boolean;
|
|
3
4
|
onClose: () => void;
|
|
4
5
|
onConfirm: () => void;
|
|
5
6
|
}
|
|
6
|
-
declare const DeleteConfirmationDialog: ({ open, onClose, onConfirm, }: DeleteConfirmationDialogProps) =>
|
|
7
|
+
declare const DeleteConfirmationDialog: ({ open, onClose, onConfirm, }: DeleteConfirmationDialogProps) => React.JSX.Element;
|
|
7
8
|
export default DeleteConfirmationDialog;
|
|
8
9
|
//# sourceMappingURL=DeleteConfirmationDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteConfirmationDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeleteConfirmationDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,wBAAwB,kCAI3B,6BAA6B,sBA2B/B,CAAC;eAEa,wBAAwB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography, } from '@mui/material';
|
|
3
|
+
import useTranslate from '../utils/hooks/useTranslate';
|
|
4
|
+
import commonTranslations from '../lang/common';
|
|
5
|
+
const DeleteConfirmationDialog = ({ open, onClose, onConfirm, }) => {
|
|
6
|
+
const t = useTranslate();
|
|
7
|
+
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: t(commonTranslations.deleteTitle) }), _jsx(DialogContent, { children: _jsx(Typography, { variant: 'caption', children: t(commonTranslations.deleteMessage) }) }), _jsxs(DialogActions, { children: [_jsx(Button, { size: 'small', variant: 'outlined', onClick: onClose, children: t(commonTranslations.no) }), _jsx(Button, { size: 'small', variant: 'contained', onClick: () => {
|
|
8
|
+
onConfirm();
|
|
9
|
+
onClose();
|
|
10
|
+
}, children: t(commonTranslations.yes) })] })] }));
|
|
11
|
+
};
|
|
12
|
+
export default DeleteConfirmationDialog;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { TextFieldProps as MuiTextFieldProps } from '@mui/material';
|
|
2
3
|
type SearchFieldProps = MuiTextFieldProps & {
|
|
3
4
|
onSearch: (val: string) => void;
|
|
4
5
|
};
|
|
5
|
-
declare const SearchField: ({ placeholder, onSearch, ...props }: SearchFieldProps) =>
|
|
6
|
+
declare const SearchField: ({ placeholder, onSearch, ...props }: SearchFieldProps) => React.JSX.Element;
|
|
6
7
|
export default SearchField;
|
|
7
8
|
//# sourceMappingURL=SearchField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../../src/components/SearchField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,cAAc,IAAI,iBAAiB,EAEpC,MAAM,eAAe,CAAC;AAIvB,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC1C,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,QAAA,MAAM,WAAW,wCAId,gBAAgB,sBA0BlB,CAAC;eAEa,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import SearchIcon from '@mui/icons-material/Search';
|
|
3
3
|
import { IconButton, TextField, } from '@mui/material';
|
|
4
4
|
import { useState } from 'react';
|
|
@@ -7,8 +7,10 @@ const SearchField = ({ placeholder = 'Search...', onSearch, ...props }) => {
|
|
|
7
7
|
return (_jsx(_Fragment, { children: _jsx(TextField, { size: 'small', placeholder: placeholder, value: value, onChange: (evt) => {
|
|
8
8
|
setValue(evt.target.value);
|
|
9
9
|
onSearch(evt.target.value);
|
|
10
|
-
}, ...props,
|
|
11
|
-
|
|
10
|
+
}, ...props, slotProps: {
|
|
11
|
+
input: {
|
|
12
|
+
endAdornment: (_jsx(IconButton, { size: 'small', onClick: () => onSearch(value), children: _jsx(SearchIcon, {}) })),
|
|
13
|
+
},
|
|
12
14
|
} }) }));
|
|
13
15
|
};
|
|
14
16
|
export default SearchField;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Group } from '../../types/groups';
|
|
2
3
|
export interface CreateGroupDialogProps {
|
|
3
4
|
open: boolean;
|
|
4
5
|
onClose: () => void;
|
|
5
6
|
onGroupCreate?: (newGroup: Group) => void;
|
|
6
7
|
}
|
|
7
|
-
declare const CreateGroupDialog: ({ open, onClose, onGroupCreate, }: CreateGroupDialogProps) =>
|
|
8
|
+
declare const CreateGroupDialog: ({ open, onClose, onGroupCreate, }: CreateGroupDialogProps) => React.JSX.Element;
|
|
8
9
|
export default CreateGroupDialog;
|
|
9
10
|
//# sourceMappingURL=CreateGroupDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateGroupDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/CreateGroupDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAM3C,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C;AAED,QAAA,MAAM,iBAAiB,sCAIpB,sBAAsB,sBAuBxB,CAAC;eAEa,iBAAiB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLocale } from '@deix/rossini-core';
|
|
3
2
|
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
|
|
4
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
5
4
|
import groupsTranslations from '../../lang/groups';
|
|
6
5
|
import { useAddGroup } from '../../utils/hooks/groups';
|
|
7
6
|
import GroupForm from './GroupForm';
|
|
8
7
|
import { useAPIClient } from '../../utils/hooks/useAPIClient';
|
|
8
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
9
9
|
const CreateGroupDialog = ({ open, onClose, onGroupCreate, }) => {
|
|
10
|
-
const
|
|
10
|
+
const t = useTranslate();
|
|
11
11
|
const apiClient = useAPIClient();
|
|
12
12
|
const queryClient = useQueryClient();
|
|
13
13
|
const { mutate: addGroup } = useAddGroup(queryClient, apiClient);
|
|
@@ -18,6 +18,6 @@ const CreateGroupDialog = ({ open, onClose, onGroupCreate, }) => {
|
|
|
18
18
|
}
|
|
19
19
|
onClose();
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: groupsTranslations.create
|
|
21
|
+
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: t(groupsTranslations.create) }), _jsx(DialogContent, { children: _jsx(GroupForm, { mode: 'create', onSave: handleSave, onCancel: onClose }) })] }));
|
|
22
22
|
};
|
|
23
23
|
export default CreateGroupDialog;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Group } from '../../types/groups';
|
|
2
3
|
export interface GroupDetailsProps {
|
|
3
4
|
group: Group;
|
|
4
5
|
onGroupUpdate?: (newGroup: Group, oldGroup: Group) => void;
|
|
5
6
|
editName?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const GroupDetails: ({ group, onGroupUpdate, editName, }: GroupDetailsProps) =>
|
|
8
|
+
declare const GroupDetails: ({ group, onGroupUpdate, editName, }: GroupDetailsProps) => React.JSX.Element;
|
|
8
9
|
export default GroupDetails;
|
|
9
10
|
//# sourceMappingURL=GroupDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/GroupDetails.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAK3C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,YAAY,wCAIf,iBAAiB,sBAuBnB,CAAC;eAEa,YAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { useUpdateGroup } from '../../utils/hooks/groups';
|
|
4
4
|
import GroupForm from './GroupForm';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Group } from '../../types/groups';
|
|
2
3
|
export interface GroupFormProps {
|
|
3
4
|
onCancel?: () => void;
|
|
@@ -6,6 +7,6 @@ export interface GroupFormProps {
|
|
|
6
7
|
mode: 'create' | 'modify';
|
|
7
8
|
editName?: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare const GroupForm: ({ group, onCancel, onSave, mode, editName, }: GroupFormProps) =>
|
|
10
|
+
declare const GroupForm: ({ group, onCancel, onSave, mode, editName, }: GroupFormProps) => React.JSX.Element;
|
|
10
11
|
export default GroupForm;
|
|
11
12
|
//# sourceMappingURL=GroupForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupForm.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/GroupForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,iDAMZ,cAAc,sBAiEhB,CAAC;eAEa,SAAS"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLocale } from '@deix/rossini-core';
|
|
3
2
|
import { Button, Grid, TextField } from '@mui/material';
|
|
4
3
|
import { Controller, useForm } from 'react-hook-form';
|
|
5
4
|
import { useEffect } from 'react';
|
|
6
5
|
import groupsTranslations from '../../lang/groups';
|
|
6
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
7
7
|
const GroupForm = ({ group, onCancel, onSave, mode, editName, }) => {
|
|
8
|
-
const
|
|
8
|
+
const t = useTranslate();
|
|
9
9
|
const { control, handleSubmit, setValue } = useForm({
|
|
10
10
|
defaultValues: {
|
|
11
11
|
id: group?.id,
|
|
@@ -21,12 +21,12 @@ const GroupForm = ({ group, onCancel, onSave, mode, editName, }) => {
|
|
|
21
21
|
const onSubmit = (data) => {
|
|
22
22
|
onSave(data);
|
|
23
23
|
};
|
|
24
|
-
return (_jsx("form", { onSubmit: (event) => void handleSubmit(onSubmit)(event), children: _jsxs(Grid, { container: true, spacing: 2, sx: { mt: 2, maxWidth: 'sm'
|
|
24
|
+
return (_jsx("form", { onSubmit: (event) => void handleSubmit(onSubmit)(event), children: _jsxs(Grid, { container: true, spacing: 2, sx: { mt: 2, maxWidth: 'sm', justifyContent: 'stretch' }, children: [_jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'name', control: control, render: ({ field }) => (_jsx(TextField, { size: 'small', fullWidth: true, label: t(groupsTranslations.name), disabled: mode === 'modify' && !editName, sx: { flexShrink: 0 }, ...field })) }) }), _jsxs(Grid, { sx: {
|
|
25
25
|
mt: 2,
|
|
26
26
|
display: 'flex',
|
|
27
27
|
justifyContent: 'flex-end',
|
|
28
28
|
gap: 2,
|
|
29
29
|
width: '100%',
|
|
30
|
-
}, children: [mode === 'create' && (_jsx(Button, { variant: 'outlined', onClick: onCancel, children: groupsTranslations.cancel
|
|
30
|
+
}, children: [mode === 'create' && (_jsx(Button, { variant: 'outlined', onClick: onCancel, children: t(groupsTranslations.cancel) })), _jsx(Button, { variant: 'contained', type: 'submit', children: t(groupsTranslations.save) })] })] }) }));
|
|
31
31
|
};
|
|
32
32
|
export default GroupForm;
|
|
@@ -13,6 +13,6 @@ export interface GroupTabsProps {
|
|
|
13
13
|
onGroupUpdate?: (newGroup: Group, oldGroup: Group) => void;
|
|
14
14
|
editName?: boolean;
|
|
15
15
|
}
|
|
16
|
-
declare const GroupTabs: ({ group, additionalTabs, onGroupUpdate, editName, }: GroupTabsProps) =>
|
|
16
|
+
declare const GroupTabs: ({ group, additionalTabs, onGroupUpdate, editName, }: GroupTabsProps) => React.JSX.Element;
|
|
17
17
|
export default GroupTabs;
|
|
18
18
|
//# sourceMappingURL=GroupTabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupTabs.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/GroupTabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAM3C,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,iBAAiB,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,wDAKZ,cAAc,sBAkDhB,CAAC;eAEa,SAAS"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Box, Tab, Tabs } from '@mui/material';
|
|
5
|
-
import { useLocale } from '@deix/rossini-core';
|
|
6
5
|
import GroupDetails from './GroupDetails';
|
|
7
6
|
import groupsTranslations from '../../lang/groups';
|
|
8
7
|
import GroupUsers from './GroupUsers';
|
|
8
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
9
9
|
const GroupTabs = ({ group, additionalTabs = [], onGroupUpdate, editName, }) => {
|
|
10
|
-
const
|
|
10
|
+
const t = useTranslate();
|
|
11
11
|
const [selectedTab, setSelectedTab] = useState('DETAILS');
|
|
12
12
|
return (_jsxs(Box, { sx: {
|
|
13
13
|
flexGrow: 1,
|
|
@@ -16,6 +16,6 @@ const GroupTabs = ({ group, additionalTabs = [], onGroupUpdate, editName, }) =>
|
|
|
16
16
|
alignSelf: 'stretch',
|
|
17
17
|
}, children: [_jsx(Box, { sx: { borderBottom: 1, borderColor: 'divider' }, children: _jsxs(Tabs, { value: selectedTab, onChange: (_evt, newValue) => {
|
|
18
18
|
setSelectedTab(newValue);
|
|
19
|
-
}, "aria-label":
|
|
19
|
+
}, "aria-label": t(groupsTranslations.details), children: [_jsx(Tab, { label: t(groupsTranslations.details), value: 'DETAILS' }), _jsx(Tab, { label: t(groupsTranslations.users), value: 'USERS' }), additionalTabs.map((tab, index) => (_jsx(Tab, { label: t(tab.title), value: `ADDITIONAL_TAB_${index}` }, `tab${index}`)))] }) }), _jsxs(Box, { sx: { p: 1 }, children: [selectedTab === 'DETAILS' && (_jsx(GroupDetails, { group: group, onGroupUpdate: onGroupUpdate, editName: editName })), selectedTab === 'USERS' && _jsx(GroupUsers, { group: group }), additionalTabs.map((tab, index) => selectedTab === `ADDITIONAL_TAB_${index}` && (_jsx(tab.component, { group: group }, `tab${index}`)))] })] }));
|
|
20
20
|
};
|
|
21
21
|
export default GroupTabs;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Group } from '../../types/groups';
|
|
3
|
+
interface GroupUsersProps {
|
|
4
|
+
group: Group;
|
|
5
|
+
}
|
|
6
|
+
declare const GroupUsers: ({ group }: GroupUsersProps) => React.JSX.Element;
|
|
7
|
+
export default GroupUsers;
|
|
8
|
+
//# sourceMappingURL=GroupUsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupUsers.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/GroupUsers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAgC3C,UAAU,eAAe;IACvB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,QAAA,MAAM,UAAU,cAAe,eAAe,sBAoD7C,CAAC;eAEa,UAAU"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Button } from '@mui/material';
|
|
3
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
4
|
+
import { useAddUserToGroup, useRemoveUserFromGroup, useUsers, } from '../../utils/hooks/users';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
7
|
+
import AddItemDialog from '../AddItemDialog';
|
|
8
|
+
import Table from '../tables/Table';
|
|
9
|
+
import { useGroupUsers } from '../../utils/hooks/groups';
|
|
10
|
+
import groupsTranslations from '../../lang/groups';
|
|
11
|
+
import usersTranslations from '../../lang/users';
|
|
12
|
+
import { useAPIClient } from '../../utils/hooks/useAPIClient';
|
|
13
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
14
|
+
const groupUsersTableColumns = [
|
|
15
|
+
{
|
|
16
|
+
field: 'username',
|
|
17
|
+
label: usersTranslations.username,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
field: 'firstName',
|
|
21
|
+
label: usersTranslations.firstName,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
field: 'lastName',
|
|
25
|
+
label: usersTranslations.lastName,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
const GroupUsers = ({ group }) => {
|
|
29
|
+
const t = useTranslate();
|
|
30
|
+
const apiClient = useAPIClient();
|
|
31
|
+
const queryClient = useQueryClient();
|
|
32
|
+
const { data: users } = useUsers(apiClient);
|
|
33
|
+
const { data: groupUsers } = useGroupUsers(group?.id, apiClient);
|
|
34
|
+
const { mutate: addUserToGroup } = useAddUserToGroup(queryClient, apiClient);
|
|
35
|
+
const { mutate: removeUserFromGroup } = useRemoveUserFromGroup(queryClient, apiClient);
|
|
36
|
+
const [openAddUserDialog, setOpenAddUserDialog] = useState(false);
|
|
37
|
+
return (_jsxs(_Fragment, { children: [groupUsers && groupUsers.length > 0 && (_jsx(Box, { sx: { maxWidth: 'md' }, children: _jsx(Table, { rows: groupUsers, columns: groupUsersTableColumns, onDelete: (user) => removeUserFromGroup({ userId: user.id, groupId: group.id }) }) })), _jsx(Button, { variant: 'outlined', startIcon: _jsx(AddIcon, {}), onClick: () => setOpenAddUserDialog(true), sx: { marginTop: 2 }, children: t(groupsTranslations.addUser) }), _jsx(AddItemDialog, { open: openAddUserDialog, onClose: () => setOpenAddUserDialog(false), onConfirm: (value) => {
|
|
38
|
+
if (value) {
|
|
39
|
+
addUserToGroup({ userId: value?.value, groupId: group.id });
|
|
40
|
+
}
|
|
41
|
+
}, title: groupsTranslations.addUser, options: users?.map((user) => ({
|
|
42
|
+
value: user.id,
|
|
43
|
+
label: user.username || '',
|
|
44
|
+
})) })] }));
|
|
45
|
+
};
|
|
46
|
+
export default GroupUsers;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Group } from '../../types/groups';
|
|
2
3
|
import { GroupTab } from './GroupTabs';
|
|
3
4
|
interface GroupsProps {
|
|
@@ -8,6 +9,6 @@ interface GroupsProps {
|
|
|
8
9
|
onGroupDelete?: (group: Group) => void;
|
|
9
10
|
editName?: boolean;
|
|
10
11
|
}
|
|
11
|
-
declare const Groups: ({ apiUrl, additionalTabs, onGroupUpdate, onGroupCreate, onGroupDelete, editName, }: GroupsProps) =>
|
|
12
|
+
declare const Groups: ({ apiUrl, additionalTabs, onGroupUpdate, onGroupCreate, onGroupDelete, editName, }: GroupsProps) => React.JSX.Element;
|
|
12
13
|
export default Groups;
|
|
13
14
|
//# sourceMappingURL=Groups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Groups.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/Groups.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAWnD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAkB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMlD,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAE5B,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IAE3D,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IAE1C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEvC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,uFAOT,WAAW,sBAgJb,CAAC;eAEa,MAAM"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import GroupAddIcon from '@mui/icons-material/GroupAdd';
|
|
5
5
|
import { Box, Button, Grid, IconButton, Link } from '@mui/material';
|
|
6
6
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
7
7
|
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
|
8
|
-
import { useAPI
|
|
8
|
+
import { useAPI } from '@deix/rossini-core';
|
|
9
9
|
import { SearchField } from '..';
|
|
10
10
|
import CreateGroupDialog from './CreateGroupDialog';
|
|
11
11
|
import GroupsTable from './GroupsTable';
|
|
@@ -14,8 +14,10 @@ import { useDeleteGroup, useGroups } from '../../utils/hooks/groups';
|
|
|
14
14
|
import GroupTabs from './GroupTabs';
|
|
15
15
|
import { useQueryClient } from '@tanstack/react-query';
|
|
16
16
|
import { APIClientProvider } from '../../utils/hooks/useAPIClient';
|
|
17
|
+
import commonTranslations from '../../lang/common';
|
|
18
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
17
19
|
const Groups = ({ apiUrl, additionalTabs = [], onGroupUpdate, onGroupCreate, onGroupDelete, editName, }) => {
|
|
18
|
-
const
|
|
20
|
+
const t = useTranslate();
|
|
19
21
|
const apiClient = useAPI(apiUrl);
|
|
20
22
|
const queryClient = useQueryClient();
|
|
21
23
|
const { data: groups } = useGroups(apiClient);
|
|
@@ -60,10 +62,10 @@ const Groups = ({ apiUrl, additionalTabs = [], onGroupUpdate, onGroupCreate, onG
|
|
|
60
62
|
paddingTop: 3,
|
|
61
63
|
paddingLeft: 3,
|
|
62
64
|
paddingRight: 3,
|
|
63
|
-
}, children: [!selectedGroup && (_jsxs(_Fragment, { children: [_jsxs(Grid, { container: true, spacing: 2, sx: { marginBottom: 2 }, children: [_jsx(Grid, { children: _jsx(SearchField, { placeholder: groupsTranslations.search
|
|
65
|
+
}, children: [!selectedGroup && (_jsxs(_Fragment, { children: [_jsxs(Grid, { container: true, spacing: 2, sx: { marginBottom: 2 }, children: [_jsx(Grid, { children: _jsx(SearchField, { placeholder: t(groupsTranslations.search), onSearch: (value) => setSearchString(value) }) }), _jsx(Grid, { children: _jsx(Button, { variant: 'contained', startIcon: _jsx(GroupAddIcon, {}), onClick: () => {
|
|
64
66
|
setOpenGroupDialog(true);
|
|
65
67
|
setSelectedGroup(undefined);
|
|
66
|
-
}, children: groupsTranslations.new
|
|
68
|
+
}, children: t(groupsTranslations.new) }) })] }), _jsx(GroupsTable, { groups: filteredGroups, selectedGroup: selectedGroup, setSelectedGroup: (group) => {
|
|
67
69
|
setSelectedGroup(group);
|
|
68
70
|
}, onDelete: handleDelete })] })), selectedGroup && (_jsxs(Box, { sx: {
|
|
69
71
|
display: 'flex',
|
|
@@ -74,7 +76,7 @@ const Groups = ({ apiUrl, additionalTabs = [], onGroupUpdate, onGroupCreate, onG
|
|
|
74
76
|
display: 'flex',
|
|
75
77
|
flexDirection: 'row',
|
|
76
78
|
alignItems: 'center',
|
|
77
|
-
}, children: [_jsx(IconButton, { "aria-label":
|
|
79
|
+
}, children: [_jsx(IconButton, { "aria-label": t(commonTranslations.back), color: 'primary', onClick: () => setSelectedGroup(undefined), sx: { mr: 2 }, children: _jsx(ArrowBackIcon, {}) }), _jsx(Link, { underline: 'none', href: '#', onClick: () => setSelectedGroup(undefined), children: t(groupsTranslations.title) }), _jsx(KeyboardArrowRightIcon, {}), selectedGroup.name] }), _jsx(GroupTabs, { group: selectedGroup, additionalTabs: additionalTabs, onGroupUpdate: onGroupUpdate, editName: editName })] })), _jsx(CreateGroupDialog, { open: openGroupDialog, onClose: () => {
|
|
78
80
|
setOpenGroupDialog(false);
|
|
79
81
|
}, onGroupCreate: onGroupCreate })] }) }));
|
|
80
82
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Group } from '../../types/groups';
|
|
2
3
|
export interface TableProps {
|
|
3
4
|
groups?: Group[];
|
|
@@ -5,6 +6,6 @@ export interface TableProps {
|
|
|
5
6
|
setSelectedGroup: (group: Group) => void;
|
|
6
7
|
onDelete: (group: Group) => void;
|
|
7
8
|
}
|
|
8
|
-
declare const GroupsTable: ({ groups, selectedGroup, setSelectedGroup, onDelete, }: TableProps) =>
|
|
9
|
+
declare const GroupsTable: ({ groups, selectedGroup, setSelectedGroup, onDelete, }: TableProps) => React.JSX.Element;
|
|
9
10
|
export default GroupsTable;
|
|
10
11
|
//# sourceMappingURL=GroupsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupsTable.d.ts","sourceRoot":"","sources":["../../../../src/components/groups/GroupsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAa3C,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,QAAA,MAAM,WAAW,2DAKd,UAAU,sBA4DZ,CAAC;eAEa,WAAW"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isStringTranslation, useLocale } from '@deix/rossini-core';
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
4
3
|
import { IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, useTheme, } from '@mui/material';
|
|
5
4
|
import { useState } from 'react';
|
|
6
5
|
import DeleteConfirmationDialog from '../DeleteConfirmationDialog';
|
|
6
|
+
import groupsTranslations from '../../lang/groups';
|
|
7
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
7
8
|
const groupsTableColumns = [
|
|
8
9
|
{
|
|
9
10
|
id: 'name',
|
|
10
|
-
label:
|
|
11
|
+
label: groupsTranslations.nameColumn,
|
|
11
12
|
},
|
|
12
13
|
];
|
|
13
14
|
const GroupsTable = ({ groups = [], selectedGroup, setSelectedGroup, onDelete, }) => {
|
|
14
|
-
const
|
|
15
|
+
const t = useTranslate();
|
|
15
16
|
const muiTheme = useTheme();
|
|
16
17
|
const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
|
|
17
18
|
const [deleteGroup, setDeleteGroup] = useState();
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx(TableContainer, { children: _jsxs(Table, { size: 'small', children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [groupsTableColumns.map((col) => (_jsx(TableCell, { align: col.align || 'inherit', children:
|
|
19
|
-
? col.label[locale]
|
|
20
|
-
: col.label }, col.id))), _jsx(TableCell, { padding: 'none', children: '' })] }) }), _jsx(TableBody, { children: groups.map((group, rowIdx) => (_jsxs(TableRow, { onClick: () => setSelectedGroup(group), sx: {
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(TableContainer, { children: _jsxs(Table, { size: 'small', children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [groupsTableColumns.map((col) => (_jsx(TableCell, { align: col.align || 'inherit', children: t(col.label) }, col.id))), _jsx(TableCell, { padding: 'none', children: '' })] }) }), _jsx(TableBody, { children: groups.map((group, rowIdx) => (_jsxs(TableRow, { onClick: () => setSelectedGroup(group), sx: {
|
|
21
20
|
cursor: 'pointer',
|
|
22
21
|
background: selectedGroup && group.id === selectedGroup.id
|
|
23
22
|
? muiTheme.palette.primary.light
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { StringTranslation } from '@deix/rossini-core';
|
|
3
|
+
import { DataGridProps, GridRowId, GridValidRowModel } from '@mui/x-data-grid';
|
|
4
|
+
export interface TableColumn<T extends GridValidRowModel> {
|
|
5
|
+
field: string;
|
|
6
|
+
label: string | StringTranslation;
|
|
7
|
+
type?: 'string' | 'number' | 'boolean' | 'date' | 'dateTime';
|
|
8
|
+
align?: 'left' | 'right' | 'center';
|
|
9
|
+
width?: number;
|
|
10
|
+
minWidth?: number;
|
|
11
|
+
flex?: number;
|
|
12
|
+
sortable?: boolean;
|
|
13
|
+
valueGetter?: (row: T) => unknown;
|
|
14
|
+
renderCell?: (row: T) => ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export interface TableProps<T extends GridValidRowModel> extends Omit<DataGridProps<T>, 'rows' | 'columns' | 'onRowClick'> {
|
|
17
|
+
rows?: T[];
|
|
18
|
+
columns: TableColumn<T>[];
|
|
19
|
+
rowIdColumn?: string;
|
|
20
|
+
pageSizeOptions?: number[];
|
|
21
|
+
onRowClick?: (row: T) => void;
|
|
22
|
+
selectedRowId?: GridRowId;
|
|
23
|
+
onDelete?: (row: T) => void;
|
|
24
|
+
additionalActions?: (row: T) => ReactElement[];
|
|
25
|
+
noDataLabel?: string | StringTranslation;
|
|
26
|
+
}
|
|
27
|
+
declare const Table: <T extends GridValidRowModel>({ rows, columns, rowIdColumn, pageSizeOptions, onRowClick, selectedRowId, onDelete, additionalActions, noDataLabel, initialState, localeText, sx, ...props }: TableProps<T>) => React.JSX.Element;
|
|
28
|
+
export default Table;
|
|
29
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/tables/Table.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACjE,OAAO,EAAU,iBAAiB,EAAa,MAAM,oBAAoB,CAAC;AAK1E,OAAO,EAEL,aAAa,EAMb,SAAS,EACT,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAY1B,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,iBAAiB;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC;IAClC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAElC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,iBAAiB,CAAE,SAAQ,IAAI,CACnE,aAAa,CAAC,CAAC,CAAC,EAChB,MAAM,GAAG,SAAS,GAAG,YAAY,CAClC;IACC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACX,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAE9B,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,YAAY,EAAE,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC1C;AAED,QAAA,MAAM,KAAK,GAAI,CAAC,SAAS,iBAAiB,gKAcvC,UAAU,CAAC,CAAC,CAAC,sBAwHf,CAAC;eAEa,KAAK"}
|