@addev-be/ui 0.14.4 → 0.14.5
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/assets/icons/table.svg +1 -1
- package/dist/Icons.d.ts +49 -0
- package/dist/Icons.js +128 -0
- package/dist/components/auth/LoginForm.d.ts +2 -0
- package/dist/components/auth/LoginForm.js +48 -0
- package/dist/components/auth/LoginPage.d.ts +2 -0
- package/dist/components/auth/LoginPage.js +9 -0
- package/dist/components/auth/PasswordRecoveryForm.d.ts +2 -0
- package/dist/components/auth/PasswordRecoveryForm.js +24 -0
- package/dist/components/auth/PasswordResetForm.d.ts +2 -0
- package/dist/components/auth/PasswordResetForm.js +56 -0
- package/dist/components/auth/index.d.ts +4 -0
- package/dist/components/auth/index.js +20 -0
- package/dist/components/auth/styles.d.ts +3 -0
- package/dist/components/auth/styles.js +16 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.d.ts +14 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.js +76 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.d.ts +22 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.js +156 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.d.ts +2 -0
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.js +18 -0
- package/dist/components/data/AdvancedRequestDataGrid/index.d.ts +2 -0
- package/dist/components/data/AdvancedRequestDataGrid/index.js +215 -0
- package/dist/components/data/AdvancedRequestDataGrid/types.d.ts +21 -0
- package/dist/components/data/AdvancedRequestDataGrid/types.js +2 -0
- package/dist/components/data/DataGrid/DataGridCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridCell.js +59 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/helpers.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/helpers.js +24 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/hooks.d.ts +6 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/hooks.js +38 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/index.d.ts +15 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/index.js +111 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/styles.d.ts +22 -0
- package/dist/components/data/DataGrid/DataGridColumnsModal/styles.js +54 -0
- package/dist/components/data/DataGrid/DataGridEditableCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridEditableCell.js +27 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.d.ts +13 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.js +71 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/hooks.d.ts +9 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/hooks.js +52 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/index.d.ts +9 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/index.js +221 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/styles.d.ts +18 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/styles.js +31 -0
- package/dist/components/data/DataGrid/DataGridFooter.d.ts +4 -0
- package/dist/components/data/DataGrid/DataGridFooter.js +44 -0
- package/dist/components/data/DataGrid/DataGridHeader.d.ts +4 -0
- package/dist/components/data/DataGrid/DataGridHeader.js +119 -0
- package/dist/components/data/DataGrid/DataGridHeaderCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridHeaderCell.js +84 -0
- package/dist/components/data/DataGrid/DataGridRowTemplate.d.ts +3 -0
- package/dist/components/data/DataGrid/DataGridRowTemplate.js +71 -0
- package/dist/components/data/DataGrid/FilterModalContent/index.d.ts +7 -0
- package/dist/components/data/DataGrid/FilterModalContent/index.js +117 -0
- package/dist/components/data/DataGrid/FilterModalContent/styles.d.ts +3 -0
- package/dist/components/data/DataGrid/FilterModalContent/styles.js +15 -0
- package/dist/components/data/DataGrid/helpers/columns.d.ts +14 -0
- package/dist/components/data/DataGrid/helpers/columns.js +176 -0
- package/dist/components/data/DataGrid/helpers/filters.d.ts +18 -0
- package/dist/components/data/DataGrid/helpers/filters.js +334 -0
- package/dist/components/data/DataGrid/helpers/index.d.ts +2 -0
- package/dist/components/data/DataGrid/helpers/index.js +18 -0
- package/dist/components/data/DataGrid/hooks/index.d.ts +7 -0
- package/dist/components/data/DataGrid/hooks/index.js +34 -0
- package/dist/components/data/DataGrid/hooks/useDataGrid.d.ts +2 -0
- package/dist/components/data/DataGrid/hooks/useDataGrid.js +241 -0
- package/dist/components/data/DataGrid/hooks/useDataGridCopy.d.ts +4 -0
- package/dist/components/data/DataGrid/hooks/useDataGridCopy.js +163 -0
- package/dist/components/data/DataGrid/hooks/useDataGridSettings.d.ts +16 -0
- package/dist/components/data/DataGrid/hooks/useDataGridSettings.js +43 -0
- package/dist/components/data/DataGrid/index.d.ts +8 -0
- package/dist/components/data/DataGrid/index.js +63 -0
- package/dist/components/data/DataGrid/styles.d.ts +47 -0
- package/dist/components/data/DataGrid/styles.js +111 -0
- package/dist/components/data/DataGrid/types.d.ts +172 -0
- package/dist/components/data/DataGrid/types.js +34 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.d.ts +17 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +136 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/index.d.ts +2 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/index.js +18 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/sqlRequests.d.ts +3 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/sqlRequests.js +18 -0
- package/dist/components/data/SqlRequestDataGrid/index.d.ts +13 -0
- package/dist/components/data/SqlRequestDataGrid/index.js +309 -0
- package/dist/components/data/SqlRequestDataGrid/types.d.ts +21 -0
- package/dist/components/data/SqlRequestDataGrid/types.js +2 -0
- package/dist/components/data/SqlRequestGrid/helpers/index.d.ts +1 -0
- package/dist/components/data/SqlRequestGrid/helpers/index.js +17 -0
- package/dist/components/data/SqlRequestGrid/helpers/sqlRequests.d.ts +3 -0
- package/dist/components/data/SqlRequestGrid/helpers/sqlRequests.js +18 -0
- package/dist/components/data/SqlRequestGrid/index.d.ts +4 -0
- package/dist/components/data/SqlRequestGrid/index.js +145 -0
- package/dist/components/data/SqlRequestGrid/styles.d.ts +16 -0
- package/dist/components/data/SqlRequestGrid/styles.js +33 -0
- package/dist/components/data/SqlRequestGrid/types.d.ts +30 -0
- package/dist/components/data/SqlRequestGrid/types.js +3 -0
- package/dist/components/data/VirtualScroller/hooks.d.ts +18 -0
- package/dist/components/data/VirtualScroller/hooks.js +50 -0
- package/dist/components/data/VirtualScroller/index.d.ts +14 -0
- package/dist/components/data/VirtualScroller/index.js +58 -0
- package/dist/components/data/VirtualScroller/styles.d.ts +16 -0
- package/dist/components/data/VirtualScroller/styles.js +39 -0
- package/dist/components/data/VirtualScroller/types.d.ts +6 -0
- package/dist/components/data/VirtualScroller/types.js +3 -0
- package/dist/components/data/index.d.ts +13 -0
- package/dist/components/data/index.js +29 -0
- package/dist/components/forms/Button.d.ts +10 -0
- package/dist/components/forms/Button.js +70 -0
- package/dist/components/forms/IconButton.d.ts +7 -0
- package/dist/components/forms/IconButton.js +64 -0
- package/dist/components/forms/IndeterminateCheckbox.d.ts +8 -0
- package/dist/components/forms/IndeterminateCheckbox.js +41 -0
- package/dist/components/forms/Select.d.ts +10 -0
- package/dist/components/forms/Select.js +49 -0
- package/dist/components/forms/VerticalLabel.d.ts +6 -0
- package/dist/components/forms/VerticalLabel.js +32 -0
- package/dist/components/forms/index.d.ts +5 -0
- package/dist/components/forms/index.js +21 -0
- package/dist/components/forms/styles.d.ts +7 -0
- package/dist/components/forms/styles.js +39 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +22 -0
- package/dist/components/layout/Dropdown/index.d.ts +11 -0
- package/dist/components/layout/Dropdown/index.js +85 -0
- package/dist/components/layout/Dropdown/styles.d.ts +14 -0
- package/dist/components/layout/Dropdown/styles.js +48 -0
- package/dist/components/layout/Loading/index.d.ts +6 -0
- package/dist/components/layout/Loading/index.js +42 -0
- package/dist/components/layout/Loading/styles.d.ts +6 -0
- package/dist/components/layout/Loading/styles.js +18 -0
- package/dist/components/layout/Modal/index.d.ts +16 -0
- package/dist/components/layout/Modal/index.js +67 -0
- package/dist/components/layout/Modal/styles.d.ts +34 -0
- package/dist/components/layout/Modal/styles.js +56 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +19 -0
- package/dist/components/search/HighlightedText.d.ts +5 -0
- package/dist/components/search/HighlightedText.js +43 -0
- package/dist/components/search/QuickSearchBar.d.ts +6 -0
- package/dist/components/search/QuickSearchBar.js +69 -0
- package/dist/components/search/QuickSearchResults.d.ts +8 -0
- package/dist/components/search/QuickSearchResults.js +70 -0
- package/dist/components/search/index.d.ts +5 -0
- package/dist/components/search/index.js +25 -0
- package/dist/components/search/styles.d.ts +28 -0
- package/dist/components/search/styles.js +40 -0
- package/dist/components/search/types.d.ts +21 -0
- package/dist/components/search/types.js +2 -0
- package/dist/components/ui/Card/index.d.ts +8 -0
- package/dist/components/ui/Card/index.js +34 -0
- package/dist/components/ui/Card/styles.d.ts +9 -0
- package/dist/components/ui/Card/styles.js +21 -0
- package/dist/components/ui/ContextMenu/index.d.ts +11 -0
- package/dist/components/ui/ContextMenu/index.js +63 -0
- package/dist/components/ui/ContextMenu/styles.d.ts +18 -0
- package/dist/components/ui/ContextMenu/styles.js +56 -0
- package/dist/components/ui/Message/index.d.ts +9 -0
- package/dist/components/ui/Message/index.js +53 -0
- package/dist/components/ui/Message/styles.d.ts +9 -0
- package/dist/components/ui/Message/styles.js +41 -0
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.js +19 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +2 -0
- package/dist/helpers/dates.d.ts +3 -0
- package/dist/helpers/dates.js +19 -0
- package/dist/helpers/getScrollbarSize.d.ts +1 -0
- package/dist/helpers/getScrollbarSize.js +17 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +19 -0
- package/dist/helpers/numbers.d.ts +4 -0
- package/dist/helpers/numbers.js +39 -0
- package/dist/helpers/text.d.ts +2 -0
- package/dist/helpers/text.js +18 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +18 -0
- package/dist/hooks/useElementSize.d.ts +4 -0
- package/dist/hooks/useElementSize.js +23 -0
- package/dist/hooks/useWindowSize.d.ts +4 -0
- package/dist/hooks/useWindowSize.js +19 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +22 -0
- package/dist/providers/AuthenticationProvider/helpers.d.ts +1 -0
- package/dist/providers/AuthenticationProvider/helpers.js +6 -0
- package/dist/providers/AuthenticationProvider/index.d.ts +23 -0
- package/dist/providers/AuthenticationProvider/index.js +221 -0
- package/dist/providers/LoadingProvider/index.d.ts +7 -0
- package/dist/providers/LoadingProvider/index.js +26 -0
- package/dist/providers/PortalsProvider/index.d.ts +10 -0
- package/dist/providers/PortalsProvider/index.js +46 -0
- package/dist/providers/PortalsProvider/styles.d.ts +9 -0
- package/dist/providers/PortalsProvider/styles.js +21 -0
- package/dist/providers/SettingsProvider/index.d.ts +8 -0
- package/dist/providers/SettingsProvider/index.js +54 -0
- package/dist/providers/ThemeProvider/ThemeProvider.d.ts +7 -0
- package/dist/providers/ThemeProvider/ThemeProvider.js +51 -0
- package/dist/providers/ThemeProvider/defaultTheme.d.ts +2 -0
- package/dist/providers/ThemeProvider/defaultTheme.js +417 -0
- package/dist/providers/ThemeProvider/index.d.ts +3 -0
- package/dist/providers/ThemeProvider/index.js +22 -0
- package/dist/providers/ThemeProvider/types.d.ts +24 -0
- package/dist/providers/ThemeProvider/types.js +2 -0
- package/dist/providers/UiProviders/index.d.ts +12 -0
- package/dist/providers/UiProviders/index.js +62 -0
- package/dist/providers/UiProviders/styles.d.ts +3 -0
- package/dist/providers/UiProviders/styles.js +13 -0
- package/dist/providers/hooks.d.ts +5 -0
- package/dist/providers/hooks.js +19 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +21 -0
- package/dist/services/HttpService.d.ts +10 -0
- package/dist/services/HttpService.js +125 -0
- package/dist/services/WebSocketService.d.ts +23 -0
- package/dist/services/WebSocketService.js +125 -0
- package/dist/services/advancedRequests.d.ts +41 -0
- package/dist/services/advancedRequests.js +13 -0
- package/dist/services/base.d.ts +14 -0
- package/dist/services/base.js +7 -0
- package/dist/services/globalSearch.d.ts +13 -0
- package/dist/services/globalSearch.js +8 -0
- package/dist/services/hooks.d.ts +3 -0
- package/dist/services/hooks.js +29 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.js +27 -0
- package/dist/services/requests/auth.d.ts +63 -0
- package/dist/services/requests/auth.js +28 -0
- package/dist/services/requests/userProfiles.d.ts +40 -0
- package/dist/services/requests/userProfiles.js +20 -0
- package/dist/services/requests/users.d.ts +84 -0
- package/dist/services/requests/users.js +20 -0
- package/dist/services/sqlRequests.d.ts +45 -0
- package/dist/services/sqlRequests.js +11 -0
- package/dist/services/types/auth.d.ts +87 -0
- package/dist/services/types/auth.js +72 -0
- package/dist/services/types/base.d.ts +6 -0
- package/dist/services/types/base.js +31 -0
- package/dist/services/types/userProfiles.d.ts +64 -0
- package/dist/services/types/userProfiles.js +68 -0
- package/dist/services/types/users.d.ts +118 -0
- package/dist/services/types/users.js +83 -0
- package/package.json +1 -1
- package/src/components/data/DataGrid/helpers/columns.tsx +201 -139
- package/src/components/data/DataGrid/types.ts +20 -7
- package/src/components/data/SqlRequestGrid/filters/FiltersSidebar.tsx +3 -3
- package/src/components/forms/Form/Select.tsx +32 -16
- package/src/components/forms/Select.tsx +20 -25
- package/src/components/ui/Avatar/styles.ts +61 -61
- package/src/components/ui/Label.tsx +90 -90
- package/src/providers/TrackingProvider/hooks.ts +14 -14
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export declare const userDtoCodec: t.IntersectionC<[t.TypeC<{
|
|
3
|
+
username: t.StringC;
|
|
4
|
+
permissions: t.ArrayC<t.StringC>;
|
|
5
|
+
isAdmin: t.BooleanC;
|
|
6
|
+
profile: t.UnionC<[t.TypeC<{
|
|
7
|
+
name: t.StringC;
|
|
8
|
+
permissions: t.ArrayC<t.StringC>;
|
|
9
|
+
isAdmin: t.BooleanC;
|
|
10
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
11
|
+
}>, t.NullC]>;
|
|
12
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
13
|
+
}>, t.PartialC<{
|
|
14
|
+
name: t.StringC;
|
|
15
|
+
email: t.StringC;
|
|
16
|
+
lastLogin: t.UnionC<[t.StringC, t.NullC]>;
|
|
17
|
+
}>]>;
|
|
18
|
+
export type UserDTO = t.TypeOf<typeof userDtoCodec>;
|
|
19
|
+
/*****/
|
|
20
|
+
export declare const getUserRequestDtoCodec: t.TypeC<{
|
|
21
|
+
id: t.StringC;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const getUserResponseDtoCodec: t.TypeC<{
|
|
24
|
+
status: t.NumberC;
|
|
25
|
+
data: t.IntersectionC<[t.TypeC<{
|
|
26
|
+
username: t.StringC;
|
|
27
|
+
permissions: t.ArrayC<t.StringC>;
|
|
28
|
+
isAdmin: t.BooleanC;
|
|
29
|
+
profile: t.UnionC<[t.TypeC<{
|
|
30
|
+
name: t.StringC;
|
|
31
|
+
permissions: t.ArrayC<t.StringC>;
|
|
32
|
+
isAdmin: t.BooleanC;
|
|
33
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
34
|
+
}>, t.NullC]>;
|
|
35
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
36
|
+
}>, t.PartialC<{
|
|
37
|
+
name: t.StringC;
|
|
38
|
+
email: t.StringC;
|
|
39
|
+
lastLogin: t.UnionC<[t.StringC, t.NullC]>;
|
|
40
|
+
}>]>;
|
|
41
|
+
}>;
|
|
42
|
+
export type GetUserRequestDTO = t.TypeOf<typeof getUserRequestDtoCodec>;
|
|
43
|
+
export type GetUserResponseDTO = t.TypeOf<typeof getUserResponseDtoCodec>;
|
|
44
|
+
/*****/
|
|
45
|
+
export declare const getAllUsersRequestDtoCodec: t.TypeC<{}>;
|
|
46
|
+
export declare const getAllUsersResponseDtoCodec: t.TypeC<{
|
|
47
|
+
status: t.NumberC;
|
|
48
|
+
data: t.ArrayC<t.IntersectionC<[t.TypeC<{
|
|
49
|
+
username: t.StringC;
|
|
50
|
+
permissions: t.ArrayC<t.StringC>;
|
|
51
|
+
isAdmin: t.BooleanC;
|
|
52
|
+
profile: t.UnionC<[t.TypeC<{
|
|
53
|
+
name: t.StringC;
|
|
54
|
+
permissions: t.ArrayC<t.StringC>;
|
|
55
|
+
isAdmin: t.BooleanC;
|
|
56
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
57
|
+
}>, t.NullC]>;
|
|
58
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
59
|
+
}>, t.PartialC<{
|
|
60
|
+
name: t.StringC;
|
|
61
|
+
email: t.StringC;
|
|
62
|
+
lastLogin: t.UnionC<[t.StringC, t.NullC]>;
|
|
63
|
+
}>]>>;
|
|
64
|
+
}>;
|
|
65
|
+
export type GetAllUsersRequestDTO = t.TypeOf<typeof getAllUsersRequestDtoCodec>;
|
|
66
|
+
export type GetAllUsersResponseDTO = t.TypeOf<typeof getAllUsersResponseDtoCodec>;
|
|
67
|
+
/*****/
|
|
68
|
+
export declare const saveUserRequestDtoCodec: t.TypeC<{
|
|
69
|
+
data: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
70
|
+
username: t.StringC;
|
|
71
|
+
permissions: t.ArrayC<t.StringC>;
|
|
72
|
+
isAdmin: t.BooleanC;
|
|
73
|
+
profile: t.UnionC<[t.TypeC<{
|
|
74
|
+
name: t.StringC;
|
|
75
|
+
permissions: t.ArrayC<t.StringC>;
|
|
76
|
+
isAdmin: t.BooleanC;
|
|
77
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
78
|
+
}>, t.NullC]>;
|
|
79
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
80
|
+
}>, t.PartialC<{
|
|
81
|
+
name: t.StringC;
|
|
82
|
+
email: t.StringC;
|
|
83
|
+
lastLogin: t.UnionC<[t.StringC, t.NullC]>;
|
|
84
|
+
}>]>, t.PartialC<{
|
|
85
|
+
password: t.StringC;
|
|
86
|
+
}>]>;
|
|
87
|
+
password: t.StringC;
|
|
88
|
+
}>;
|
|
89
|
+
export declare const saveUserResponseDtoCodec: t.TypeC<{
|
|
90
|
+
status: t.NumberC;
|
|
91
|
+
data: t.IntersectionC<[t.TypeC<{
|
|
92
|
+
username: t.StringC;
|
|
93
|
+
permissions: t.ArrayC<t.StringC>;
|
|
94
|
+
isAdmin: t.BooleanC;
|
|
95
|
+
profile: t.UnionC<[t.TypeC<{
|
|
96
|
+
name: t.StringC;
|
|
97
|
+
permissions: t.ArrayC<t.StringC>;
|
|
98
|
+
isAdmin: t.BooleanC;
|
|
99
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
100
|
+
}>, t.NullC]>;
|
|
101
|
+
id: t.UnionC<[t.StringC, t.NullC]>;
|
|
102
|
+
}>, t.PartialC<{
|
|
103
|
+
name: t.StringC;
|
|
104
|
+
email: t.StringC;
|
|
105
|
+
lastLogin: t.UnionC<[t.StringC, t.NullC]>;
|
|
106
|
+
}>]>;
|
|
107
|
+
}>;
|
|
108
|
+
export type SaveUserRequestDTO = t.TypeOf<typeof saveUserRequestDtoCodec>;
|
|
109
|
+
export type SaveUserResponseDTO = t.TypeOf<typeof saveUserResponseDtoCodec>;
|
|
110
|
+
/*****/
|
|
111
|
+
export declare const deleteUserRequestDtoCodec: t.TypeC<{
|
|
112
|
+
id: t.StringC;
|
|
113
|
+
}>;
|
|
114
|
+
export declare const deleteUserResponseDtoCodec: t.TypeC<{
|
|
115
|
+
status: t.NumberC;
|
|
116
|
+
}>;
|
|
117
|
+
export type DeleteUserRequestDTO = t.TypeOf<typeof deleteUserRequestDtoCodec>;
|
|
118
|
+
export type DeleteUserResponseDTO = t.TypeOf<typeof deleteUserResponseDtoCodec>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.deleteUserResponseDtoCodec = exports.deleteUserRequestDtoCodec = exports.saveUserResponseDtoCodec = exports.saveUserRequestDtoCodec = exports.getAllUsersResponseDtoCodec = exports.getAllUsersRequestDtoCodec = exports.getUserResponseDtoCodec = exports.getUserRequestDtoCodec = exports.userDtoCodec = void 0;
|
|
38
|
+
var t = __importStar(require("io-ts"));
|
|
39
|
+
var base_1 = require("./base");
|
|
40
|
+
var userProfiles_1 = require("./userProfiles");
|
|
41
|
+
exports.userDtoCodec = t.intersection([
|
|
42
|
+
t.type(__assign(__assign({}, base_1.baseModelDtoCodec.props), { username: t.string, permissions: t.array(t.string), isAdmin: t.boolean, profile: t.union([userProfiles_1.userProfileDtoCodec, t.null]) })),
|
|
43
|
+
t.partial({
|
|
44
|
+
name: t.string,
|
|
45
|
+
email: t.string,
|
|
46
|
+
lastLogin: t.union([t.string, t.null]),
|
|
47
|
+
}),
|
|
48
|
+
], 'UserDTO');
|
|
49
|
+
/*****/
|
|
50
|
+
exports.getUserRequestDtoCodec = t.type({
|
|
51
|
+
id: t.string,
|
|
52
|
+
}, 'GetUserRequestDTO');
|
|
53
|
+
exports.getUserResponseDtoCodec = t.type({
|
|
54
|
+
status: t.number,
|
|
55
|
+
data: exports.userDtoCodec,
|
|
56
|
+
}, 'GetUserResponseDTO');
|
|
57
|
+
/*****/
|
|
58
|
+
exports.getAllUsersRequestDtoCodec = t.type({}, 'GetAllUsersRequestDTO');
|
|
59
|
+
exports.getAllUsersResponseDtoCodec = t.type({
|
|
60
|
+
status: t.number,
|
|
61
|
+
data: t.array(exports.userDtoCodec),
|
|
62
|
+
}, 'GetAllUsersResponseDTO');
|
|
63
|
+
/*****/
|
|
64
|
+
exports.saveUserRequestDtoCodec = t.type({
|
|
65
|
+
data: t.intersection([
|
|
66
|
+
exports.userDtoCodec,
|
|
67
|
+
t.partial({
|
|
68
|
+
password: t.string,
|
|
69
|
+
}),
|
|
70
|
+
]),
|
|
71
|
+
password: t.string,
|
|
72
|
+
}, 'SaveUserRequestDTO');
|
|
73
|
+
exports.saveUserResponseDtoCodec = t.type({
|
|
74
|
+
status: t.number,
|
|
75
|
+
data: exports.userDtoCodec,
|
|
76
|
+
}, 'SaveUserResponseDTO');
|
|
77
|
+
/*****/
|
|
78
|
+
exports.deleteUserRequestDtoCodec = t.type({
|
|
79
|
+
id: t.string,
|
|
80
|
+
}, 'DeleteUserRequestDTO');
|
|
81
|
+
exports.deleteUserResponseDtoCodec = t.type({
|
|
82
|
+
status: t.number,
|
|
83
|
+
}, 'DeleteUserResponseDTO');
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DataGridColumn,
|
|
7
7
|
DataGridDateColumn,
|
|
8
8
|
DataGridNumberColumn,
|
|
9
|
+
DataGridSelectColumn,
|
|
9
10
|
DataGridSettings,
|
|
10
11
|
DataGridTextColumn,
|
|
11
12
|
} from '../types';
|
|
@@ -17,6 +18,12 @@ import {
|
|
|
17
18
|
formatPercentage,
|
|
18
19
|
} from '../../../../helpers/numbers';
|
|
19
20
|
|
|
21
|
+
import { CheckboxEditableCell } from '../DataGridEditableCell/CheckboxEditableCell';
|
|
22
|
+
import { DateEditableCell } from '../DataGridEditableCell/DateEditableCell';
|
|
23
|
+
import { NumberEditableCell } from '../DataGridEditableCell/NumberEditableCell';
|
|
24
|
+
import { Select } from '../../../forms/Form/Select';
|
|
25
|
+
import { TextEditableCell } from '../DataGridEditableCell/TextEditableCell';
|
|
26
|
+
import { forwardRef } from 'react';
|
|
20
27
|
import moment from 'moment';
|
|
21
28
|
import { repeat } from 'lodash';
|
|
22
29
|
|
|
@@ -30,7 +37,7 @@ export const buildExcelFormat = (decimals = 2, suffix = '') =>
|
|
|
30
37
|
export const textColumn = <R extends Record<string, any>>(
|
|
31
38
|
key: string,
|
|
32
39
|
title: string,
|
|
33
|
-
|
|
40
|
+
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
34
41
|
): DataGridTextColumn<R> => ({
|
|
35
42
|
key,
|
|
36
43
|
type: 'text',
|
|
@@ -40,13 +47,14 @@ export const textColumn = <R extends Record<string, any>>(
|
|
|
40
47
|
sortGetter: (row) => row[key] ?? '',
|
|
41
48
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
42
49
|
filter: textFilter(key),
|
|
43
|
-
|
|
50
|
+
editComponent: TextEditableCell,
|
|
51
|
+
...otherOptions,
|
|
44
52
|
});
|
|
45
53
|
|
|
46
54
|
export const mailColumn = <R extends Record<string, any>>(
|
|
47
55
|
key: string,
|
|
48
56
|
title: string,
|
|
49
|
-
|
|
57
|
+
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
50
58
|
): DataGridTextColumn<R> => ({
|
|
51
59
|
key,
|
|
52
60
|
type: 'text',
|
|
@@ -56,13 +64,14 @@ export const mailColumn = <R extends Record<string, any>>(
|
|
|
56
64
|
sortGetter: (row) => row[key] ?? '',
|
|
57
65
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
58
66
|
filter: textFilter(key),
|
|
59
|
-
|
|
67
|
+
editComponent: TextEditableCell,
|
|
68
|
+
...otherOptions,
|
|
60
69
|
});
|
|
61
70
|
|
|
62
71
|
export const phoneColumn = <R extends Record<string, any>>(
|
|
63
72
|
key: string,
|
|
64
73
|
title: string,
|
|
65
|
-
|
|
74
|
+
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
66
75
|
): DataGridTextColumn<R> => ({
|
|
67
76
|
key,
|
|
68
77
|
type: 'text',
|
|
@@ -72,13 +81,14 @@ export const phoneColumn = <R extends Record<string, any>>(
|
|
|
72
81
|
sortGetter: (row) => row[key] ?? '',
|
|
73
82
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
74
83
|
filter: textFilter(key),
|
|
75
|
-
|
|
84
|
+
editComponent: TextEditableCell,
|
|
85
|
+
...otherOptions,
|
|
76
86
|
});
|
|
77
87
|
|
|
78
88
|
export const dateColumn = <R extends Record<string, any>>(
|
|
79
89
|
key: string,
|
|
80
90
|
title: string,
|
|
81
|
-
|
|
91
|
+
otherOptions?: Partial<DataGridDateColumn<R>>
|
|
82
92
|
): DataGridDateColumn<R> => ({
|
|
83
93
|
key,
|
|
84
94
|
type: 'date',
|
|
@@ -95,13 +105,14 @@ export const dateColumn = <R extends Record<string, any>>(
|
|
|
95
105
|
...dateFilter(key),
|
|
96
106
|
renderer: (value) => moment(value).format('DD/MM/YYYY') ?? '',
|
|
97
107
|
},
|
|
98
|
-
|
|
108
|
+
editComponent: DateEditableCell,
|
|
109
|
+
...otherOptions,
|
|
99
110
|
});
|
|
100
111
|
|
|
101
112
|
export const dateTimeColumn = <R extends Record<string, any>>(
|
|
102
113
|
key: string,
|
|
103
114
|
title: string,
|
|
104
|
-
|
|
115
|
+
otherOptions?: Partial<DataGridDateColumn<R>>
|
|
105
116
|
): DataGridDateColumn<R> => ({
|
|
106
117
|
key,
|
|
107
118
|
type: 'date',
|
|
@@ -118,13 +129,14 @@ export const dateTimeColumn = <R extends Record<string, any>>(
|
|
|
118
129
|
...dateFilter(key),
|
|
119
130
|
renderer: (value) => moment(value).format('DD/MM/YYYY HH:mm:ss') ?? '',
|
|
120
131
|
},
|
|
121
|
-
|
|
132
|
+
editComponent: DateEditableCell,
|
|
133
|
+
...otherOptions,
|
|
122
134
|
});
|
|
123
135
|
|
|
124
136
|
export const monthColumn = <R extends Record<string, any>>(
|
|
125
137
|
key: string,
|
|
126
138
|
title: string,
|
|
127
|
-
|
|
139
|
+
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
128
140
|
): DataGridTextColumn<R> => ({
|
|
129
141
|
key,
|
|
130
142
|
type: 'text',
|
|
@@ -134,151 +146,168 @@ export const monthColumn = <R extends Record<string, any>>(
|
|
|
134
146
|
sortGetter: (row) => row[key] ?? '',
|
|
135
147
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
136
148
|
filter: textFilter(key),
|
|
137
|
-
...
|
|
149
|
+
...otherOptions,
|
|
138
150
|
});
|
|
139
151
|
|
|
140
152
|
export const numberColumn = <R extends Record<string, any>>(
|
|
141
153
|
key: string,
|
|
142
154
|
title: string,
|
|
143
155
|
decimals = 2,
|
|
144
|
-
|
|
145
|
-
): DataGridNumberColumn<R> =>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
156
|
+
otherOptions?: Partial<DataGridNumberColumn<R>>
|
|
157
|
+
): DataGridNumberColumn<R> => {
|
|
158
|
+
const column: DataGridNumberColumn<R> = {
|
|
159
|
+
key,
|
|
160
|
+
type: 'number',
|
|
161
|
+
name: title,
|
|
162
|
+
render: (row) => formatNumber(row[key], decimals) ?? '',
|
|
163
|
+
excelOptions: {
|
|
164
|
+
formatter: () => buildExcelFormat(decimals),
|
|
165
|
+
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
166
|
+
},
|
|
167
|
+
getter: (row) => row[key] ?? '',
|
|
168
|
+
sortGetter: (row) => row[key] ?? '',
|
|
169
|
+
footer: {
|
|
170
|
+
sum: (_, filteredRows) =>
|
|
171
|
+
formatNumber(
|
|
172
|
+
filteredRows.reduce((acc, row) => acc + (row[key] ?? 0), 0),
|
|
173
|
+
decimals
|
|
174
|
+
),
|
|
175
|
+
average: (_, filteredRows) =>
|
|
176
|
+
formatNumber(
|
|
177
|
+
filteredRows.reduce((acc, row) => acc + (row[key] ?? 0), 0) /
|
|
178
|
+
(filteredRows.length || 1),
|
|
179
|
+
decimals
|
|
180
|
+
),
|
|
181
|
+
count: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
182
|
+
max: (_, filteredRows) =>
|
|
183
|
+
formatNumber(
|
|
184
|
+
Math.max(...filteredRows.map((row) => row[key] ?? 0)),
|
|
185
|
+
decimals
|
|
186
|
+
),
|
|
187
|
+
min: (_, filteredRows) =>
|
|
188
|
+
formatNumber(
|
|
189
|
+
Math.min(...filteredRows.map((row) => row[key] ?? 0)),
|
|
190
|
+
decimals
|
|
191
|
+
),
|
|
192
|
+
},
|
|
193
|
+
filter: {
|
|
194
|
+
...numberFilter(key),
|
|
195
|
+
renderer: (value) => formatNumber(value, decimals) ?? '',
|
|
196
|
+
},
|
|
197
|
+
editComponent: forwardRef((props, ref) => (
|
|
198
|
+
<NumberEditableCell<R>
|
|
199
|
+
ref={ref}
|
|
200
|
+
decimals={column.decimals}
|
|
201
|
+
currency={column.currency}
|
|
202
|
+
{...props}
|
|
203
|
+
/>
|
|
204
|
+
)),
|
|
205
|
+
...otherOptions,
|
|
206
|
+
};
|
|
207
|
+
return column;
|
|
208
|
+
};
|
|
186
209
|
|
|
187
210
|
export const moneyColumn = <R extends Record<string, any>>(
|
|
188
211
|
key: string,
|
|
189
212
|
title: string,
|
|
190
213
|
decimals = 2,
|
|
191
|
-
|
|
192
|
-
): DataGridNumberColumn<R> =>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
214
|
+
otherOptions?: Partial<DataGridNumberColumn<R>>
|
|
215
|
+
): DataGridNumberColumn<R> => {
|
|
216
|
+
const column: DataGridNumberColumn<R> = {
|
|
217
|
+
key,
|
|
218
|
+
type: 'number',
|
|
219
|
+
name: title,
|
|
220
|
+
render: (row) => formatMoney(row[key], decimals) ?? '',
|
|
221
|
+
excelOptions: {
|
|
222
|
+
formatter: () => buildExcelFormat(decimals, ' €'),
|
|
223
|
+
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
224
|
+
},
|
|
225
|
+
getter: (row) => row[key] ?? '',
|
|
226
|
+
sortGetter: (row) => row[key] ?? '',
|
|
227
|
+
filter: {
|
|
228
|
+
...numberFilter(key),
|
|
229
|
+
renderer: (value) => formatMoney(value, decimals) ?? '',
|
|
230
|
+
},
|
|
231
|
+
footer: {
|
|
232
|
+
sum: (_, filteredRows) =>
|
|
233
|
+
formatMoney(
|
|
234
|
+
filteredRows.reduce((acc, row) => acc + (row[key] ?? 0), 0),
|
|
235
|
+
decimals
|
|
236
|
+
),
|
|
237
|
+
average: (_, filteredRows) =>
|
|
238
|
+
formatMoney(
|
|
239
|
+
filteredRows.reduce((acc, row) => acc + (row[key] ?? 0), 0) /
|
|
240
|
+
(filteredRows.length || 1),
|
|
241
|
+
decimals
|
|
242
|
+
),
|
|
243
|
+
count: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
244
|
+
max: (_, filteredRows) =>
|
|
245
|
+
formatMoney(
|
|
246
|
+
Math.max(...filteredRows.map((row) => row[key] ?? 0)),
|
|
247
|
+
decimals
|
|
248
|
+
),
|
|
249
|
+
min: (_, filteredRows) =>
|
|
250
|
+
formatMoney(
|
|
251
|
+
Math.min(...filteredRows.map((row) => row[key] ?? 0)),
|
|
252
|
+
decimals
|
|
253
|
+
),
|
|
254
|
+
},
|
|
255
|
+
...otherOptions,
|
|
256
|
+
};
|
|
257
|
+
return column;
|
|
258
|
+
};
|
|
233
259
|
|
|
234
260
|
export const percentageColumn = <R extends Record<string, any>>(
|
|
235
261
|
key: string,
|
|
236
262
|
title: string,
|
|
237
263
|
decimals = 2,
|
|
238
|
-
|
|
239
|
-
): DataGridNumberColumn<R> =>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
264
|
+
otherOptions?: Partial<DataGridNumberColumn<R>>
|
|
265
|
+
): DataGridNumberColumn<R> => {
|
|
266
|
+
const column: DataGridNumberColumn<R> = {
|
|
267
|
+
key,
|
|
268
|
+
type: 'number',
|
|
269
|
+
name: title,
|
|
270
|
+
render: (row) => formatPercentage(row[key]) ?? '',
|
|
271
|
+
excelOptions: {
|
|
272
|
+
formatter: () => buildExcelFormat(decimals, '%'),
|
|
273
|
+
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
274
|
+
},
|
|
275
|
+
getter: (row) => row[key] ?? '',
|
|
276
|
+
sortGetter: (row) => row[key] ?? '',
|
|
277
|
+
filter: numberFilter(key),
|
|
278
|
+
footer: {
|
|
279
|
+
average: (_, filteredRows) =>
|
|
280
|
+
formatNumber(
|
|
281
|
+
filteredRows.reduce((acc, row) => acc + (row[key] ?? 0), 0) /
|
|
282
|
+
(filteredRows.length || 1),
|
|
283
|
+
decimals
|
|
284
|
+
),
|
|
285
|
+
count: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
286
|
+
max: (_, filteredRows) =>
|
|
287
|
+
formatNumber(
|
|
288
|
+
Math.max(...filteredRows.map((row) => row[key] ?? 0)),
|
|
289
|
+
decimals
|
|
290
|
+
),
|
|
291
|
+
min: (_, filteredRows) =>
|
|
292
|
+
formatNumber(
|
|
293
|
+
Math.min(...filteredRows.map((row) => row[key] ?? 0)),
|
|
294
|
+
decimals
|
|
295
|
+
),
|
|
296
|
+
sum: (_, filteredRows) =>
|
|
297
|
+
formatNumber(
|
|
298
|
+
filteredRows.reduce((acc, row) => acc + (row[key] ?? 0), 0),
|
|
299
|
+
decimals
|
|
300
|
+
),
|
|
301
|
+
},
|
|
302
|
+
...otherOptions,
|
|
303
|
+
};
|
|
304
|
+
return column;
|
|
305
|
+
};
|
|
277
306
|
|
|
278
307
|
export const checkboxColumn = <R extends Record<string, any>>(
|
|
279
308
|
key: string,
|
|
280
309
|
title: string,
|
|
281
|
-
|
|
310
|
+
otherOptions?: Partial<DataGridCheckboxColumn<R>>
|
|
282
311
|
): DataGridCheckboxColumn<R> => ({
|
|
283
312
|
key,
|
|
284
313
|
type: 'checkbox',
|
|
@@ -299,13 +328,46 @@ export const checkboxColumn = <R extends Record<string, any>>(
|
|
|
299
328
|
unchecked: (_, filteredRows) =>
|
|
300
329
|
`${filteredRows.filter((row) => !row[key]).length} décochés`,
|
|
301
330
|
},
|
|
302
|
-
|
|
331
|
+
editComponent: CheckboxEditableCell,
|
|
332
|
+
...otherOptions,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
export const selectColumn = <R extends Record<string, any>, T>(
|
|
336
|
+
key: string,
|
|
337
|
+
title: string,
|
|
338
|
+
items: T[],
|
|
339
|
+
itemKey: (item: T | null) => string,
|
|
340
|
+
itemLabel: (item: T | null) => string,
|
|
341
|
+
otherOptions?: Partial<DataGridSelectColumn<R, T>>
|
|
342
|
+
): DataGridSelectColumn<R, T> => ({
|
|
343
|
+
key,
|
|
344
|
+
type: 'select',
|
|
345
|
+
name: title,
|
|
346
|
+
render: (row) => itemLabel(row[key]) ?? '',
|
|
347
|
+
getter: (row) => row[key] ?? null,
|
|
348
|
+
sortGetter: (row) => itemLabel(row[key]) ?? '',
|
|
349
|
+
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
350
|
+
filter: textFilter(key),
|
|
351
|
+
items,
|
|
352
|
+
itemKey,
|
|
353
|
+
itemLabel,
|
|
354
|
+
editComponent: ({ value, onChange, onClose }) => (
|
|
355
|
+
<Select
|
|
356
|
+
items={items}
|
|
357
|
+
itemKey={itemKey}
|
|
358
|
+
itemLabel={itemLabel}
|
|
359
|
+
value={value}
|
|
360
|
+
onChange={onChange}
|
|
361
|
+
onBlur={() => onClose(true)}
|
|
362
|
+
/>
|
|
363
|
+
),
|
|
364
|
+
...otherOptions,
|
|
303
365
|
});
|
|
304
366
|
|
|
305
367
|
export const colorColumn = <R extends Record<string, any>>(
|
|
306
368
|
key: string,
|
|
307
369
|
title: string,
|
|
308
|
-
|
|
370
|
+
otherOptions?: Partial<DataGridColorColumn<R>>
|
|
309
371
|
): DataGridColorColumn<R> => ({
|
|
310
372
|
key,
|
|
311
373
|
type: 'color',
|
|
@@ -317,5 +379,5 @@ export const colorColumn = <R extends Record<string, any>>(
|
|
|
317
379
|
sortGetter: (row) => row[key] ?? '',
|
|
318
380
|
filter: textFilter(key),
|
|
319
381
|
footer: (rows) => `${rows.length} éléments`,
|
|
320
|
-
...
|
|
382
|
+
...otherOptions,
|
|
321
383
|
});
|