@addev-be/ui 0.20.5 → 0.20.8
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 +11 -1
- package/dist/Icons.js +22 -1
- package/dist/components/auth/LoginForm.js +1 -1
- package/dist/components/auth/PasswordRecoveryForm.js +1 -1
- package/dist/components/auth/PasswordResetForm.js +1 -1
- package/dist/components/data/DataGrid/DataGridCell.js +5 -5
- package/dist/components/data/DataGrid/DataGridColumnsModal/helpers.d.ts +2 -2
- package/dist/components/data/DataGrid/DataGridColumnsModal/helpers.js +1 -7
- package/dist/components/data/DataGrid/DataGridColumnsModal/hooks.js +3 -3
- package/dist/components/data/DataGrid/DataGridColumnsModal/index.js +16 -21
- package/dist/components/data/DataGrid/DataGridEditableCell/CheckboxEditableCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/CheckboxEditableCell.js +23 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/DateEditableCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/DateEditableCell.js +27 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.d.ts +7 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.js +34 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/TextEditableCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/TextEditableCell.js +23 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/index.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/index.js +91 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/styles.d.ts +3 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/styles.js +17 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/types.d.ts +11 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/types.js +3 -0
- package/dist/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.js +17 -1
- package/dist/components/data/DataGrid/DataGridFilterMenu/hooks.d.ts +4 -3
- package/dist/components/data/DataGrid/DataGridFilterMenu/hooks.js +11 -12
- package/dist/components/data/DataGrid/DataGridFilterMenu/index.d.ts +5 -4
- package/dist/components/data/DataGrid/DataGridFilterMenu/index.js +44 -40
- package/dist/components/data/DataGrid/DataGridFilterMenu/styles.js +1 -1
- package/dist/components/data/DataGrid/DataGridFooter.js +5 -5
- package/dist/components/data/DataGrid/DataGridHeader.js +52 -8
- package/dist/components/data/DataGrid/DataGridHeaderCell.d.ts +1 -1
- package/dist/components/data/DataGrid/DataGridHeaderCell.js +11 -24
- package/dist/components/data/DataGrid/DataGridRowTemplate.d.ts +1 -1
- package/dist/components/data/DataGrid/DataGridRowTemplate.js +8 -9
- package/dist/components/data/DataGrid/FilterModalContent/index.js +1 -1
- package/dist/components/data/DataGrid/constants.d.ts +6 -0
- package/dist/components/data/DataGrid/constants.js +9 -0
- package/dist/components/data/DataGrid/helpers/columns.d.ts +13 -12
- package/dist/components/data/DataGrid/helpers/columns.js +100 -130
- package/dist/components/data/DataGrid/hooks/index.d.ts +3 -3
- package/dist/components/data/DataGrid/hooks/index.js +8 -12
- package/dist/components/data/DataGrid/hooks/useDataGrid.js +73 -24
- package/dist/components/data/DataGrid/hooks/useDataGridChangedRows.d.ts +9 -0
- package/dist/components/data/DataGrid/hooks/useDataGridChangedRows.js +91 -0
- package/dist/components/data/DataGrid/hooks/useDataGridCopy.js +25 -30
- package/dist/components/data/DataGrid/hooks/useRefreshModal.d.ts +5 -0
- package/dist/components/data/DataGrid/hooks/useRefreshModal.js +25 -0
- package/dist/components/data/DataGrid/index.d.ts +2 -2
- package/dist/components/data/DataGrid/index.js +17 -3
- package/dist/components/data/DataGrid/styles.d.ts +13 -8
- package/dist/components/data/DataGrid/styles.js +58 -30
- package/dist/components/data/DataGrid/types.d.ts +87 -17
- package/dist/components/data/SqlRequestDataGrid/SqlRequestForeignListEditableCell.d.ts +2 -0
- package/dist/components/data/SqlRequestDataGrid/SqlRequestForeignListEditableCell.js +19 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.d.ts +16 -17
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +237 -84
- package/dist/components/data/SqlRequestDataGrid/index.d.ts +2 -2
- package/dist/components/data/SqlRequestDataGrid/index.js +92 -68
- package/dist/components/data/SqlRequestDataGrid/styles.d.ts +2 -0
- package/dist/components/data/SqlRequestDataGrid/styles.js +14 -0
- package/dist/components/data/SqlRequestDataGrid/types.d.ts +13 -3
- package/dist/components/data/SqlRequestDataGrid/types.js +1 -0
- package/dist/components/data/SqlRequestForeignList/index.d.ts +4 -0
- package/dist/components/data/SqlRequestForeignList/index.js +131 -0
- package/dist/components/data/SqlRequestForeignList/styles.d.ts +9 -0
- package/dist/components/data/SqlRequestForeignList/styles.js +22 -0
- package/dist/components/data/SqlRequestForeignList/types.d.ts +22 -0
- package/dist/components/data/SqlRequestForeignList/types.js +3 -0
- package/dist/components/data/SqlRequestGrid/filters/FiltersSidebar.d.ts +10 -0
- package/dist/components/data/SqlRequestGrid/filters/FiltersSidebar.js +51 -0
- package/dist/components/data/SqlRequestGrid/filters/styles.d.ts +4 -0
- package/dist/components/data/SqlRequestGrid/filters/styles.js +17 -0
- package/dist/components/data/SqlRequestGrid/index.d.ts +1 -1
- package/dist/components/data/SqlRequestGrid/index.js +139 -50
- package/dist/components/data/SqlRequestGrid/styles.d.ts +0 -12
- package/dist/components/data/SqlRequestGrid/styles.js +4 -20
- package/dist/components/data/SqlRequestGrid/types.d.ts +14 -4
- package/dist/components/data/VirtualScroller/index.d.ts +4 -3
- package/dist/components/data/VirtualScroller/index.js +15 -5
- package/dist/components/data/VirtualScroller/styles.d.ts +4 -2
- package/dist/components/data/VirtualScroller/styles.js +9 -6
- package/dist/components/data/index.d.ts +1 -2
- package/dist/components/data/index.js +1 -2
- package/dist/components/forms/AutoTextArea.d.ts +10 -0
- package/dist/components/forms/AutoTextArea.js +41 -0
- package/dist/components/forms/Button.d.ts +11 -4
- package/dist/components/forms/Button.js +15 -9
- package/dist/components/forms/Form/Checkbox.d.ts +3 -0
- package/dist/components/forms/Form/Checkbox.js +33 -0
- package/dist/components/forms/Form/FormGroup.d.ts +11 -0
- package/dist/components/forms/Form/FormGroup.js +10 -0
- package/dist/components/forms/Form/Input.d.ts +3 -0
- package/dist/components/forms/Form/Input.js +33 -0
- package/dist/components/forms/Form/Row.d.ts +9 -0
- package/dist/components/forms/Form/Row.js +10 -0
- package/dist/components/forms/Form/Select.d.ts +18 -0
- package/dist/components/forms/Form/Select.js +51 -0
- package/dist/components/forms/Form/TextArea.d.ts +4 -0
- package/dist/components/forms/Form/TextArea.js +34 -0
- package/dist/components/forms/Form/index.d.ts +81 -0
- package/dist/components/forms/Form/index.js +29 -0
- package/dist/components/forms/Form/styles.d.ts +19 -0
- package/dist/components/forms/Form/styles.js +49 -0
- package/dist/components/forms/IconButton.d.ts +2 -1
- package/dist/components/forms/IconButton.js +12 -12
- package/dist/components/forms/NumberInput.d.ts +9 -0
- package/dist/components/forms/NumberInput.js +40 -0
- package/dist/components/forms/Select.d.ts +5 -6
- package/dist/components/forms/Select.js +2 -5
- package/dist/components/forms/index.d.ts +4 -0
- package/dist/components/forms/index.js +4 -0
- package/dist/components/forms/styles.d.ts +17 -3
- package/dist/components/forms/styles.js +8 -7
- package/dist/components/layout/Columns.d.ts +6 -0
- package/dist/components/layout/Columns.js +23 -0
- package/dist/components/layout/Dropdown/index.d.ts +1 -0
- package/dist/components/layout/Dropdown/index.js +24 -3
- package/dist/components/layout/Flexbox.d.ts +11 -0
- package/dist/components/layout/Flexbox.js +26 -0
- package/dist/components/layout/Grid/index.d.ts +6 -0
- package/dist/components/layout/Grid/index.js +6 -0
- package/dist/components/layout/Grid/styles.d.ts +14 -0
- package/dist/components/layout/Grid/styles.js +29 -0
- package/dist/components/layout/Masonry/index.d.ts +3 -0
- package/dist/components/layout/Masonry/index.js +20 -0
- package/dist/components/layout/Masonry/styles.d.ts +5 -0
- package/dist/components/layout/Masonry/styles.js +17 -0
- package/dist/components/layout/Modal/styles.js +1 -1
- package/dist/components/layout/index.d.ts +5 -1
- package/dist/components/layout/index.js +5 -1
- package/dist/components/search/HighlightedText.js +9 -7
- package/dist/components/search/QuickSearchBar.d.ts +6 -2
- package/dist/components/search/QuickSearchBar.js +7 -7
- package/dist/components/search/styles.js +1 -1
- package/dist/components/search/types.d.ts +3 -0
- package/dist/components/ui/Avatar/index.d.ts +10 -0
- package/dist/components/ui/Avatar/index.js +52 -0
- package/dist/components/ui/Avatar/styles.d.ts +4 -0
- package/dist/components/ui/Avatar/styles.js +43 -0
- package/dist/components/ui/Card/styles.js +1 -1
- package/dist/components/ui/Ellipsis.d.ts +13 -0
- package/dist/components/ui/Ellipsis.js +28 -0
- package/dist/components/ui/Label.d.ts +9 -0
- package/dist/components/ui/Label.js +74 -0
- package/dist/components/ui/Tab/index.d.ts +3 -0
- package/dist/components/ui/Tab/index.js +12 -0
- package/dist/components/ui/Tab/styles.d.ts +6 -0
- package/dist/components/ui/Tab/styles.js +41 -0
- package/dist/components/ui/Tab/types.d.ts +13 -0
- package/dist/components/ui/Tabs/index.d.ts +2 -0
- package/dist/components/ui/Tabs/index.js +10 -0
- package/dist/components/ui/Tabs/styles.d.ts +0 -0
- package/dist/components/ui/Tabs/styles.js +1 -0
- package/dist/components/ui/Tabs/types.d.ts +8 -0
- package/dist/components/ui/Tabs/types.js +2 -0
- package/dist/components/ui/Tab/302/265/index.d.ts +2 -0
- package/dist/components/ui/Tab/302/265/index.js +10 -0
- package/dist/components/ui/Tab/302/265/styles.d.ts +0 -0
- package/dist/components/ui/Tab/302/265/styles.js +1 -0
- package/dist/components/ui/Tab/302/265/types.d.ts +8 -0
- package/dist/components/ui/Tab/302/265/types.js +2 -0
- package/dist/components/ui/ToastNotification.d.ts +14 -0
- package/dist/components/ui/ToastNotification.js +78 -0
- package/dist/components/ui/index.d.ts +4 -0
- package/dist/components/ui/index.js +4 -0
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.js +2 -0
- package/dist/helpers/numbers.d.ts +3 -0
- package/dist/helpers/numbers.js +33 -1
- package/dist/helpers/responsive.d.ts +37 -0
- package/dist/helpers/responsive.js +57 -0
- package/dist/helpers/styled/index.d.ts +1 -0
- package/dist/{components/data/AdvancedRequestDataGrid/helpers → helpers/styled}/index.js +1 -2
- package/dist/helpers/styled/space.d.ts +23 -0
- package/dist/helpers/styled/space.js +56 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/useContainerMediaQuery.d.ts +17 -0
- package/dist/hooks/useContainerMediaQuery.js +10 -0
- package/dist/hooks/useMediaQuery.d.ts +17 -0
- package/dist/hooks/useMediaQuery.js +11 -0
- package/dist/hooks/useMediaQueryForWidth.d.ts +17 -0
- package/dist/hooks/useMediaQueryForWidth.js +26 -0
- package/dist/hooks/useMutableState.d.ts +2 -0
- package/dist/hooks/useMutableState.js +16 -0
- package/dist/hooks/useShowArchived.d.ts +6 -0
- package/dist/hooks/useShowArchived.js +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/poppins-700.woff2 +0 -0
- package/dist/providers/AuthenticationProvider/index.d.ts +1 -0
- package/dist/providers/AuthenticationProvider/index.js +57 -15
- package/dist/providers/PortalsProvider/styles.js +1 -1
- package/dist/providers/ThemeProvider/defaultTheme.js +13 -0
- package/dist/providers/ThemeProvider/helpers.d.ts +8 -0
- package/dist/providers/ThemeProvider/helpers.js +53 -0
- package/dist/providers/ThemeProvider/types.d.ts +2 -1
- package/dist/providers/TrackingProvider/hooks.d.ts +1 -0
- package/dist/providers/TrackingProvider/hooks.js +15 -0
- package/dist/providers/TrackingProvider/index.d.ts +8 -0
- package/dist/providers/TrackingProvider/index.js +41 -0
- package/dist/providers/UiProviders/index.js +2 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +2 -0
- package/dist/services/WebSocketService.d.ts +8 -0
- package/dist/services/WebSocketService.js +34 -2
- package/dist/services/globalSearch.d.ts +6 -2
- package/dist/services/hooks.d.ts +10 -0
- package/dist/services/hooks.js +89 -2
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.js +20 -0
- package/dist/services/requests/generic.d.ts +29 -0
- package/dist/services/requests/generic.js +29 -0
- package/dist/services/requests/tracking.d.ts +18 -0
- package/dist/services/requests/tracking.js +8 -0
- package/dist/services/smartQueries.d.ts +51 -0
- package/dist/services/smartQueries.js +10 -0
- package/dist/services/smartRequests.d.ts +0 -0
- package/dist/services/smartRequests.js +1 -0
- package/dist/services/types/generic.d.ts +44 -0
- package/dist/services/types/generic.js +79 -0
- package/dist/services/types/tracking.d.ts +24 -0
- package/dist/services/types/tracking.js +47 -0
- package/dist/services/updateSqlRequests.d.ts +24 -0
- package/dist/services/updateSqlRequests.js +7 -0
- package/package.json +2 -2
- package/src/components/data/DataGrid/styles.ts +1 -0
- package/src/components/ui/Avatar/styles.ts +61 -61
- package/src/components/ui/Label.tsx +90 -90
- package/src/components/ui/TabsView/TabsList.tsx +44 -44
- package/src/components/ui/TabsView/TabsView.tsx +11 -2
- package/src/components/ui/TabsView/index.ts +3 -3
- package/src/helpers/styled/index.ts +1 -1
- package/src/helpers/styled/space.ts +111 -111
- package/src/hooks/useMutableState.ts +9 -11
- package/src/providers/TrackingProvider/hooks.ts +14 -14
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.d.ts +0 -14
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.js +0 -76
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.d.ts +0 -22
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.js +0 -156
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.d.ts +0 -2
- package/dist/components/data/AdvancedRequestDataGrid/index.d.ts +0 -2
- package/dist/components/data/AdvancedRequestDataGrid/index.js +0 -215
- package/dist/components/data/AdvancedRequestDataGrid/types.d.ts +0 -21
- package/dist/components/data/DataGrid/DataGridEditableCell.d.ts +0 -2
- package/dist/components/data/DataGrid/DataGridEditableCell.js +0 -27
- /package/dist/components/{data/AdvancedRequestDataGrid → ui/Tab}/types.js +0 -0
|
@@ -1,41 +1,86 @@
|
|
|
1
1
|
import * as t from 'io-ts';
|
|
2
2
|
import { CSSProperties, Context, Dispatch, FC, MouseEvent, MouseEventHandler, ReactNode, SetStateAction } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { DataGridEditableCellFC } from './DataGridEditableCell/types';
|
|
4
4
|
import { ThemeColor } from '../../../providers/ThemeProvider/types';
|
|
5
|
-
export type
|
|
5
|
+
export type DataGridCellFCProps = {
|
|
6
6
|
onDoubleClick?: MouseEventHandler;
|
|
7
7
|
style?: CSSProperties;
|
|
8
|
-
|
|
8
|
+
$color?: ThemeColor;
|
|
9
|
+
$textAlign?: 'left' | 'right' | 'center';
|
|
10
|
+
$userSelect?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type DataGridCellFC = FC<DataGridCellFCProps>;
|
|
9
13
|
export type DataGridFooterPredefinedFunction = 'average' | 'avg' | 'count' | 'max' | 'min' | 'sum';
|
|
10
14
|
export type DataGridFooterFunction<R> = (allRows: R[], filteredRows: R[], selectedRows: R[]) => ReactNode;
|
|
11
|
-
|
|
15
|
+
type ExcelOptions = {
|
|
16
|
+
formatter?: (value: any) => string;
|
|
17
|
+
colorGetter?: (value: any) => string;
|
|
18
|
+
valueGetter?: (value: any) => string;
|
|
19
|
+
};
|
|
20
|
+
type CommonGridColumnProps<R, T> = {
|
|
21
|
+
key: string;
|
|
12
22
|
component?: DataGridCellFC;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
excelValue?: (value: any) => string;
|
|
23
|
+
color?: ThemeColor;
|
|
24
|
+
excelOptions?: ExcelOptions;
|
|
25
|
+
textAlign?: 'left' | 'right' | 'center';
|
|
17
26
|
filter?: DataGridFilter;
|
|
18
27
|
footer?: DataGridFooterFunction<R> | Record<string, DataGridFooterFunction<R> | null>;
|
|
19
|
-
|
|
20
|
-
name: string;
|
|
28
|
+
name: ReactNode;
|
|
21
29
|
order?: number;
|
|
22
|
-
|
|
30
|
+
getter: (row: R) => T;
|
|
23
31
|
render?: (row: R, column: DataGridColumn<R>) => ReactNode | string;
|
|
24
32
|
resizable?: boolean;
|
|
25
33
|
sortGetter?: (row: R) => string | number;
|
|
26
|
-
type?: 'text' | 'number' | 'date';
|
|
27
34
|
width?: number;
|
|
28
|
-
settingsContext?: Context<SettingsContextProps>;
|
|
29
35
|
};
|
|
30
|
-
export type
|
|
36
|
+
export type EditableDataGridColumn<R, T> = CommonGridColumnProps<R, T> & {
|
|
37
|
+
editable?: boolean;
|
|
38
|
+
editComponent?: DataGridEditableCellFC<R, T>;
|
|
39
|
+
itemToPartialRow?: (key: string, row: R, value: T) => Partial<R>;
|
|
40
|
+
};
|
|
41
|
+
export type DataGridTextColumn<R> = EditableDataGridColumn<R, string> & {
|
|
42
|
+
type: 'text';
|
|
43
|
+
};
|
|
44
|
+
export type DataGridNumberColumn<R> = EditableDataGridColumn<R, number> & {
|
|
45
|
+
type: 'number';
|
|
46
|
+
decimals?: number;
|
|
47
|
+
currency?: string | ((row: R) => string);
|
|
48
|
+
prefix?: string;
|
|
49
|
+
suffix?: string;
|
|
50
|
+
};
|
|
51
|
+
export type DataGridDateColumn<R> = EditableDataGridColumn<R, string> & {
|
|
52
|
+
type: 'date';
|
|
53
|
+
};
|
|
54
|
+
export type DataGridCheckboxColumn<R> = EditableDataGridColumn<R, boolean> & {
|
|
55
|
+
type: 'checkbox';
|
|
56
|
+
};
|
|
57
|
+
export type DataGridSelectColumn<R, T = any> = EditableDataGridColumn<R, T | null> & {
|
|
58
|
+
type: 'select';
|
|
59
|
+
items: T[];
|
|
60
|
+
itemKey: (item: T) => string;
|
|
61
|
+
itemLabel: (item: T) => string;
|
|
62
|
+
};
|
|
63
|
+
export type DataGridForeignListColumn<R> = EditableDataGridColumn<R, string | null> & {
|
|
64
|
+
type: 'foreignList';
|
|
65
|
+
};
|
|
66
|
+
export type DataGridColorColumn<R> = EditableDataGridColumn<R, string> & {
|
|
67
|
+
type: 'color';
|
|
68
|
+
};
|
|
69
|
+
export type DataGridColumn<R> = DataGridTextColumn<R> | DataGridNumberColumn<R> | DataGridDateColumn<R> | DataGridCheckboxColumn<R> | DataGridSelectColumn<R> | DataGridForeignListColumn<R> | DataGridColorColumn<R>;
|
|
70
|
+
export type DataGridColumnWithFilter<R> = DataGridColumn<R> & {
|
|
71
|
+
filter: DataGridFilter;
|
|
72
|
+
};
|
|
73
|
+
export type DataGridColumns<R> = DataGridColumn<R>[];
|
|
31
74
|
export type DataGridFilters = Record<string, DataGridFilter<DataGridFilterType>>;
|
|
32
75
|
export type DataGridProps<R> = {
|
|
33
76
|
name?: string;
|
|
34
77
|
className?: string;
|
|
35
78
|
rows: R[];
|
|
79
|
+
setRows?: Dispatch<SetStateAction<R[]>>;
|
|
36
80
|
columns: DataGridColumns<R>;
|
|
37
|
-
rowKey:
|
|
81
|
+
rowKey: string;
|
|
38
82
|
selectable?: boolean;
|
|
83
|
+
userSelect?: boolean;
|
|
39
84
|
editable?: boolean;
|
|
40
85
|
onRowDoubleClick?: (row: R, e: MouseEvent) => void;
|
|
41
86
|
onSelectionChange?: (keys: string[]) => void;
|
|
@@ -60,8 +105,13 @@ export type DataGridProps<R> = {
|
|
|
60
105
|
loadCopyRows?: () => Promise<R[]>;
|
|
61
106
|
refresh?: () => void;
|
|
62
107
|
headerColor?: ThemeColor;
|
|
108
|
+
fixedColumnsCount?: number;
|
|
109
|
+
onRowEdited?: (row: R, columnKey: keyof R, value: any) => void;
|
|
110
|
+
onSaveClicked?: (addedRows: DataGridEditedRows<R>, editedRows: DataGridEditedRows<R>) => Promise<string[]>;
|
|
111
|
+
onAddClicked?: () => Promise<R>;
|
|
63
112
|
};
|
|
64
113
|
export type DataGridContextProps<R> = DataGridProps<R> & {
|
|
114
|
+
setRows: Dispatch<SetStateAction<R[]>>;
|
|
65
115
|
editingCell?: [number, number];
|
|
66
116
|
setEditingCell: Dispatch<SetStateAction<[number, number]>>;
|
|
67
117
|
sortedRows: R[];
|
|
@@ -75,7 +125,7 @@ export type DataGridContextProps<R> = DataGridProps<R> & {
|
|
|
75
125
|
footers?: Record<string, string>;
|
|
76
126
|
setFooters: Dispatch<SetStateAction<Record<string, string>>>;
|
|
77
127
|
footerFunctions?: Record<string, DataGridFooterFunction<R>>;
|
|
78
|
-
visibleColumns:
|
|
128
|
+
visibleColumns: DataGridColumns<R>;
|
|
79
129
|
copyTable: (includeHeaders?: boolean, includeFooters?: boolean) => Promise<void>;
|
|
80
130
|
setColumnWidth: (key: string, width: number) => void;
|
|
81
131
|
saveSettings: (newSettings?: DataGridSettings) => void;
|
|
@@ -84,7 +134,18 @@ export type DataGridContextProps<R> = DataGridProps<R> & {
|
|
|
84
134
|
length: number;
|
|
85
135
|
rowKeyGetter: (row: R) => string;
|
|
86
136
|
gridTemplateColumns: string;
|
|
137
|
+
resizingColumnKey: string | null;
|
|
138
|
+
startResizing: (e: MouseEvent, columnKey: string) => void;
|
|
139
|
+
moveResizing: (e: MouseEvent) => void;
|
|
140
|
+
endResizing: () => void;
|
|
87
141
|
toggleSelection: (key: string) => void;
|
|
142
|
+
addedRows: DataGridEditedRows<R>;
|
|
143
|
+
updatedRows: DataGridEditedRows<R>;
|
|
144
|
+
editRow: (row: Partial<R>) => void;
|
|
145
|
+
addRow: (row: R) => void;
|
|
146
|
+
addRows: (rows: R[]) => void;
|
|
147
|
+
updateRow: (row: Partial<R>) => void;
|
|
148
|
+
clearChangedRows: (keys?: string[]) => void;
|
|
88
149
|
};
|
|
89
150
|
export type DataGridContext<R> = Context<DataGridContextProps<R>>;
|
|
90
151
|
export declare const dataGridSettingCodec: t.PartialC<{
|
|
@@ -114,6 +175,11 @@ export type DataGridCellProps<R> = {
|
|
|
114
175
|
context: DataGridContext<R>;
|
|
115
176
|
className?: string;
|
|
116
177
|
style?: CSSProperties;
|
|
178
|
+
userSelect?: boolean;
|
|
179
|
+
color?: ThemeColor;
|
|
180
|
+
};
|
|
181
|
+
export type EditableDataGridCellProps<R, T> = DataGridCellProps<R> & {
|
|
182
|
+
column: EditableDataGridColumn<R, T>;
|
|
117
183
|
};
|
|
118
184
|
export type DataGridHeaderCellProps<R> = {
|
|
119
185
|
columnKey: string;
|
|
@@ -122,6 +188,7 @@ export type DataGridHeaderCellProps<R> = {
|
|
|
122
188
|
context: DataGridContext<R>;
|
|
123
189
|
onFilterButtonClicked?: (columnKey: string) => void;
|
|
124
190
|
isFilterOpen?: boolean;
|
|
191
|
+
color?: ThemeColor;
|
|
125
192
|
};
|
|
126
193
|
export type DataGridSort = 'asc' | 'desc';
|
|
127
194
|
export type DataGridFilterPredicate<T> = (valueToVerify: T) => boolean;
|
|
@@ -166,7 +233,10 @@ export type DataGridRowTemplateProps<R> = {
|
|
|
166
233
|
toggleSelection?: () => void;
|
|
167
234
|
context: DataGridContext<R>;
|
|
168
235
|
};
|
|
169
|
-
export type DataGridRefProps = {
|
|
236
|
+
export type DataGridRefProps<R> = {
|
|
170
237
|
refresh: () => void;
|
|
171
238
|
setSelectedKeys: (keys: string[]) => void;
|
|
239
|
+
addRows: (rows: R[]) => void;
|
|
172
240
|
};
|
|
241
|
+
export type DataGridEditedRows<R> = Partial<R>[];
|
|
242
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SqlRequestForeignListProps } from '../SqlRequestForeignList/types';
|
|
2
|
+
export declare const SqlRequestForeignListEditableCell: <R extends Record<string, any>>(props: SqlRequestForeignListProps<R> & import("react").RefAttributes<HTMLDivElement>) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SqlRequestForeignListEditableCell = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
17
|
+
var SqlRequestForeignList_1 = require("../SqlRequestForeignList");
|
|
18
|
+
var SqlRequestForeignListEditableCellInner = function (props, ref) { return (0, jsx_runtime_1.jsx)(SqlRequestForeignList_1.SqlRequestForeignList, __assign({}, props, { ref: ref })); };
|
|
19
|
+
exports.SqlRequestForeignListEditableCell = (0, react_1.forwardRef)(SqlRequestForeignListEditableCellInner);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const sqlColorColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<SqlRequestDataGridColumn<R>>) => SqlRequestDataGridColumns<R>;
|
|
1
|
+
import { SqlRequestDataGridCheckboxColumn, SqlRequestDataGridDateColumn, SqlRequestDataGridForeignListColumn, SqlRequestDataGridNumberColumn, SqlRequestDataGridTextColumn } from '../types';
|
|
2
|
+
import { DeepPartial } from '../../../../typings';
|
|
3
|
+
import { SqlRequestForeignListItemFC } from '../../SqlRequestForeignList/types';
|
|
4
|
+
export declare const sqlTextColumn: <R extends Record<string, any>>(key: string, title: React.ReactNode, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>) => SqlRequestDataGridTextColumn<R>;
|
|
5
|
+
export declare const sqlMailColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>) => SqlRequestDataGridTextColumn<R>;
|
|
6
|
+
export declare const sqlPhoneColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>) => SqlRequestDataGridTextColumn<R>;
|
|
7
|
+
export declare const sqlDateColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridDateColumn<R>>) => SqlRequestDataGridDateColumn<R>;
|
|
8
|
+
export declare const sqlDateTimeColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridDateColumn<R>>) => SqlRequestDataGridDateColumn<R>;
|
|
9
|
+
export declare const sqlMonthColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>) => SqlRequestDataGridTextColumn<R>;
|
|
10
|
+
export declare const sqlNumberColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?: DeepPartial<SqlRequestDataGridNumberColumn<R>>) => SqlRequestDataGridNumberColumn<R>;
|
|
11
|
+
export declare const sqlMoneyColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, currency?: string | ((row: R) => string), options?: DeepPartial<SqlRequestDataGridNumberColumn<R>>) => SqlRequestDataGridNumberColumn<R>;
|
|
12
|
+
export declare const sqlPercentageColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?: DeepPartial<SqlRequestDataGridNumberColumn<R>>) => SqlRequestDataGridNumberColumn<R>;
|
|
13
|
+
export declare const sqlCheckboxColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridCheckboxColumn<R>>) => SqlRequestDataGridCheckboxColumn<R>;
|
|
14
|
+
export declare const sqlImageColumn: <R extends Record<string, any>>(key: string, title: string, urlPrefix: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>) => SqlRequestDataGridTextColumn<R>;
|
|
15
|
+
export declare const sqlColorColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>) => SqlRequestDataGridTextColumn<R>;
|
|
16
|
+
export declare const sqlForeignListColumn: <R extends Record<string, any>, T extends Record<string, any>, C extends string>(key: string, columnMapping: Record<keyof R, C>, title: string, requestName: string, ItemTemplate: SqlRequestForeignListItemFC<T>, options?: DeepPartial<SqlRequestDataGridForeignListColumn<R, T | null>>) => SqlRequestDataGridForeignListColumn<R, T | null>;
|
|
@@ -11,126 +11,279 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.sqlColorColumn = exports.sqlCheckboxColumn = exports.sqlPercentageColumn = exports.sqlMoneyColumn = exports.sqlNumberColumn = exports.sqlMonthColumn = exports.sqlDateTimeColumn = exports.sqlDateColumn = exports.sqlPhoneColumn = exports.sqlMailColumn = exports.
|
|
14
|
+
exports.sqlForeignListColumn = exports.sqlColorColumn = exports.sqlImageColumn = exports.sqlCheckboxColumn = exports.sqlPercentageColumn = exports.sqlMoneyColumn = exports.sqlNumberColumn = exports.sqlMonthColumn = exports.sqlDateTimeColumn = exports.sqlDateColumn = exports.sqlPhoneColumn = exports.sqlMailColumn = exports.sqlTextColumn = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
/* eslint-disable react/display-name */
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
|
+
var react_1 = require("react");
|
|
19
|
+
var styles_1 = require("../styles");
|
|
16
20
|
var helpers_1 = require("../../DataGrid/helpers");
|
|
17
21
|
var dates_1 = require("../../../../helpers/dates");
|
|
18
22
|
var numbers_1 = require("../../../../helpers/numbers");
|
|
23
|
+
var lodash_1 = require("lodash");
|
|
24
|
+
var CheckboxEditableCell_1 = require("../../DataGrid/DataGridEditableCell/CheckboxEditableCell");
|
|
25
|
+
var constants_1 = require("../../DataGrid/constants");
|
|
26
|
+
var DateEditableCell_1 = require("../../DataGrid/DataGridEditableCell/DateEditableCell");
|
|
27
|
+
var NumberEditableCell_1 = require("../../DataGrid/DataGridEditableCell/NumberEditableCell");
|
|
28
|
+
var SqlRequestForeignList_1 = require("../../SqlRequestForeignList");
|
|
29
|
+
var TextEditableCell_1 = require("../../DataGrid/DataGridEditableCell/TextEditableCell");
|
|
19
30
|
var sqlTextColumn = function (key, title, options) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
return (0, lodash_1.merge)({
|
|
32
|
+
key: key,
|
|
33
|
+
type: 'text',
|
|
34
|
+
name: title,
|
|
35
|
+
render: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
36
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
37
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
38
|
+
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
39
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
40
|
+
editComponent: TextEditableCell_1.TextEditableCell,
|
|
41
|
+
}, options);
|
|
24
42
|
};
|
|
25
43
|
exports.sqlTextColumn = sqlTextColumn;
|
|
26
|
-
/**
|
|
27
|
-
* Creates a column with a composed value from multiple fields,
|
|
28
|
-
* and filtered by a text filter on the first field
|
|
29
|
-
*/
|
|
30
|
-
var sqlComposedColumn = function (key, title, fields, options) {
|
|
31
|
-
var _a;
|
|
32
|
-
return (_a = {},
|
|
33
|
-
_a[key] = __assign({ field: {
|
|
34
|
-
fieldAlias: key,
|
|
35
|
-
operator: 'jsonObject',
|
|
36
|
-
operands: fields.flatMap(function (field) { return [
|
|
37
|
-
{ constantValue: field },
|
|
38
|
-
{ fieldName: field },
|
|
39
|
-
]; }),
|
|
40
|
-
}, name: title, render: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, filter: __assign(__assign({}, (0, helpers_1.textFilter)(fields[0])), { getter: function (value) { var _a; return (_a = value[fields[0]]) !== null && _a !== void 0 ? _a : 0; } }), filterField: fields[0], sortField: fields[0], footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); } }, options),
|
|
41
|
-
_a);
|
|
42
|
-
};
|
|
43
|
-
exports.sqlComposedColumn = sqlComposedColumn;
|
|
44
44
|
var sqlMailColumn = function (key, title, options) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
return (0, lodash_1.merge)({
|
|
46
|
+
key: key,
|
|
47
|
+
type: 'text',
|
|
48
|
+
name: title,
|
|
49
|
+
render: function (row) { var _a; return (0, jsx_runtime_1.jsx)("a", { href: "mailto:".concat(row[key]), children: (_a = row[key]) !== null && _a !== void 0 ? _a : '' }); },
|
|
50
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
51
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
52
|
+
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
53
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
54
|
+
editComponent: TextEditableCell_1.TextEditableCell,
|
|
55
|
+
}, options);
|
|
49
56
|
};
|
|
50
57
|
exports.sqlMailColumn = sqlMailColumn;
|
|
51
58
|
var sqlPhoneColumn = function (key, title, options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
return (0, lodash_1.merge)({
|
|
60
|
+
key: key,
|
|
61
|
+
type: 'text',
|
|
62
|
+
name: title,
|
|
63
|
+
render: function (row) { var _a; return (0, jsx_runtime_1.jsx)("a", { href: "tel:".concat(row[key]), children: (_a = row[key]) !== null && _a !== void 0 ? _a : '' }); },
|
|
64
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
65
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
66
|
+
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
67
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
68
|
+
editComponent: TextEditableCell_1.TextEditableCell,
|
|
69
|
+
}, options);
|
|
56
70
|
};
|
|
57
71
|
exports.sqlPhoneColumn = sqlPhoneColumn;
|
|
58
72
|
var sqlDateColumn = function (key, title, options) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
return (0, lodash_1.merge)({
|
|
74
|
+
key: key,
|
|
75
|
+
name: title,
|
|
76
|
+
type: 'date',
|
|
77
|
+
render: function (row) { return (0, dates_1.formatDate)(row[key]); },
|
|
78
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
79
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
80
|
+
excelOptions: {
|
|
81
|
+
formatter: function () { return 'dd/mm/yyyy'; },
|
|
82
|
+
valueGetter: function (value) { return (0, dates_1.formatDate)(value, 'YYYY-MM-DD'); },
|
|
83
|
+
},
|
|
84
|
+
filter: __assign(__assign({}, (0, helpers_1.dateFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; }, formatter: function (value) { return (0, dates_1.formatDate)(value); }, renderer: function (value) { return (0, dates_1.formatDate)(value); } }),
|
|
85
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
86
|
+
editComponent: DateEditableCell_1.DateEditableCell,
|
|
87
|
+
}, options);
|
|
63
88
|
};
|
|
64
89
|
exports.sqlDateColumn = sqlDateColumn;
|
|
65
90
|
var sqlDateTimeColumn = function (key, title, options) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
91
|
+
return (0, lodash_1.merge)({
|
|
92
|
+
key: key,
|
|
93
|
+
name: title,
|
|
94
|
+
type: 'date',
|
|
95
|
+
render: function (row) { return (0, dates_1.formatDateTime)(row[key]); },
|
|
96
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
97
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
98
|
+
excelOptions: {
|
|
99
|
+
formatter: function () { return 'dd/mm/yyyy hh:mm:ss'; },
|
|
100
|
+
valueGetter: function (value) { return (0, dates_1.formatDateTime)(value, 'YYYY-MM-DD HH:mm:ss'); },
|
|
101
|
+
},
|
|
102
|
+
filter: __assign(__assign({}, (0, helpers_1.dateFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; }, formatter: function (value) { return (0, dates_1.formatDateTime)(value); }, renderer: function (value) { return (0, dates_1.formatDateTime)(value); } }),
|
|
103
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
104
|
+
editComponent: DateEditableCell_1.DateEditableCell,
|
|
105
|
+
}, options);
|
|
70
106
|
};
|
|
71
107
|
exports.sqlDateTimeColumn = sqlDateTimeColumn;
|
|
72
108
|
var sqlMonthColumn = function (key, title, options) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
109
|
+
return (0, lodash_1.merge)({
|
|
110
|
+
key: key,
|
|
111
|
+
type: 'text',
|
|
112
|
+
name: title,
|
|
113
|
+
render: function (row) { return (row[key] ? "".concat(row[key], " mois ") : ''); },
|
|
114
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
115
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
116
|
+
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
117
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
118
|
+
}, options);
|
|
77
119
|
};
|
|
78
120
|
exports.sqlMonthColumn = sqlMonthColumn;
|
|
79
121
|
var sqlNumberColumn = function (key, title, decimals, options) {
|
|
80
|
-
var _a;
|
|
81
122
|
if (decimals === void 0) { decimals = 2; }
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
123
|
+
var column = {
|
|
124
|
+
key: key,
|
|
125
|
+
name: title,
|
|
126
|
+
type: 'number',
|
|
127
|
+
decimals: decimals,
|
|
128
|
+
textAlign: 'right',
|
|
129
|
+
render: function (row) { var _a; return (_a = (0, numbers_1.formatNumber)(row[key], decimals)) !== null && _a !== void 0 ? _a : ''; },
|
|
130
|
+
excelOptions: {
|
|
131
|
+
formatter: function () { return (0, helpers_1.buildExcelFormat)(decimals); },
|
|
132
|
+
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
133
|
+
},
|
|
134
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
135
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : 0; },
|
|
136
|
+
filter: __assign(__assign({}, (0, helpers_1.numberFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : 0; }, renderer: function (value) { var _a; return (_a = (0, numbers_1.formatNumber)(value, decimals)) !== null && _a !== void 0 ? _a : ''; } }),
|
|
137
|
+
footer: {
|
|
138
|
+
sum: null,
|
|
139
|
+
avg: null,
|
|
140
|
+
count: null,
|
|
141
|
+
max: null,
|
|
142
|
+
min: null,
|
|
143
|
+
},
|
|
144
|
+
editComponent: (0, react_1.forwardRef)(function (props, ref) { return ((0, jsx_runtime_1.jsx)(NumberEditableCell_1.NumberEditableCell, __assign({ ref: ref, decimals: column.decimals, currency: column.currency, prefix: column.prefix, suffix: column.suffix }, props))); }),
|
|
145
|
+
};
|
|
146
|
+
return (0, lodash_1.merge)(column, options);
|
|
91
147
|
};
|
|
92
148
|
exports.sqlNumberColumn = sqlNumberColumn;
|
|
93
|
-
var sqlMoneyColumn = function (key, title, decimals, options) {
|
|
94
|
-
var _a;
|
|
149
|
+
var sqlMoneyColumn = function (key, title, decimals, currency, options) {
|
|
95
150
|
if (decimals === void 0) { decimals = 2; }
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
151
|
+
if (currency === void 0) { currency = 'EUR'; }
|
|
152
|
+
var column = {
|
|
153
|
+
key: key,
|
|
154
|
+
name: title,
|
|
155
|
+
type: 'number',
|
|
156
|
+
decimals: decimals,
|
|
157
|
+
currency: currency,
|
|
158
|
+
textAlign: 'right',
|
|
159
|
+
render: typeof currency === 'function'
|
|
160
|
+
? function (row) { var _a; return (_a = (0, numbers_1.formatMoney)(row[key], decimals, currency(row))) !== null && _a !== void 0 ? _a : ''; }
|
|
161
|
+
: function (row) { var _a; return (_a = (0, numbers_1.formatMoney)(row[key], decimals, currency)) !== null && _a !== void 0 ? _a : ''; },
|
|
162
|
+
excelOptions: {
|
|
163
|
+
formatter: typeof currency === 'function'
|
|
164
|
+
? function (row) { return (0, helpers_1.buildExcelFormat)(decimals, currency(row)); }
|
|
165
|
+
: function () { return (0, helpers_1.buildExcelFormat)(decimals, currency); },
|
|
166
|
+
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
167
|
+
},
|
|
168
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
169
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : 0; },
|
|
170
|
+
filter: __assign(__assign({}, (0, helpers_1.numberFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : 0; }, renderer: typeof currency === 'function'
|
|
171
|
+
? function (value) { var _a; return (_a = (0, numbers_1.formatMoney)(value, decimals, currency(value))) !== null && _a !== void 0 ? _a : ''; }
|
|
172
|
+
: function (value) { var _a; return (_a = (0, numbers_1.formatMoney)(value, decimals, currency)) !== null && _a !== void 0 ? _a : ''; } }),
|
|
173
|
+
footer: {
|
|
174
|
+
sum: null,
|
|
175
|
+
avg: null,
|
|
176
|
+
count: null,
|
|
177
|
+
max: null,
|
|
178
|
+
min: null,
|
|
179
|
+
},
|
|
180
|
+
editComponent: (0, react_1.forwardRef)(function (props, ref) { return ((0, jsx_runtime_1.jsx)(NumberEditableCell_1.NumberEditableCell, __assign({ ref: ref, decimals: column.decimals, currency: column.currency }, props))); }),
|
|
181
|
+
};
|
|
182
|
+
return (0, lodash_1.merge)(column, options);
|
|
105
183
|
};
|
|
106
184
|
exports.sqlMoneyColumn = sqlMoneyColumn;
|
|
107
185
|
var sqlPercentageColumn = function (key, title, decimals, options) {
|
|
108
|
-
var _a;
|
|
109
186
|
if (decimals === void 0) { decimals = 2; }
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
187
|
+
var column = {
|
|
188
|
+
key: key,
|
|
189
|
+
name: title,
|
|
190
|
+
type: 'number',
|
|
191
|
+
render: function (row) { var _a; return (_a = (0, numbers_1.formatPercentage)(row[key])) !== null && _a !== void 0 ? _a : ''; },
|
|
192
|
+
excelOptions: {
|
|
193
|
+
formatter: function () { return (0, helpers_1.buildExcelFormat)(decimals, '%'); },
|
|
194
|
+
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
195
|
+
},
|
|
196
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
197
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : 0; },
|
|
198
|
+
filter: __assign(__assign({}, (0, helpers_1.numberFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : 0; }, renderer: function (value) { var _a; return (_a = (0, numbers_1.formatPercentage)(value, decimals)) !== null && _a !== void 0 ? _a : ''; } }),
|
|
199
|
+
editComponent: (0, react_1.forwardRef)(function (props, ref) { return ((0, jsx_runtime_1.jsx)(NumberEditableCell_1.NumberEditableCell, __assign({ ref: ref, decimals: column.decimals, currency: column.currency }, props))); }),
|
|
200
|
+
};
|
|
201
|
+
return (0, lodash_1.merge)(column, options);
|
|
113
202
|
};
|
|
114
203
|
exports.sqlPercentageColumn = sqlPercentageColumn;
|
|
115
204
|
var sqlCheckboxColumn = function (key, title, options) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
205
|
+
return (0, lodash_1.merge)({
|
|
206
|
+
key: key,
|
|
207
|
+
name: title,
|
|
208
|
+
type: 'checkbox',
|
|
209
|
+
render: function (row) {
|
|
210
|
+
var _a;
|
|
211
|
+
var value = !!+((_a = row[key]) !== null && _a !== void 0 ? _a : 0);
|
|
212
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: value, readOnly: true }), (0, jsx_runtime_1.jsx)("span", { children: value ? ' Oui' : ' Non' })] }));
|
|
213
|
+
},
|
|
214
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
215
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
216
|
+
filter: __assign(__assign({}, (0, helpers_1.numberFilter)(key)), { getter: function (value) { var _a; return +((_a = value[key]) !== null && _a !== void 0 ? _a : 0); } }),
|
|
217
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
218
|
+
editComponent: CheckboxEditableCell_1.CheckboxEditableCell,
|
|
219
|
+
}, options);
|
|
124
220
|
};
|
|
125
221
|
exports.sqlCheckboxColumn = sqlCheckboxColumn;
|
|
222
|
+
var sqlImageColumn = function (key, title, urlPrefix, options) {
|
|
223
|
+
return (0, lodash_1.merge)({
|
|
224
|
+
key: key,
|
|
225
|
+
type: 'text',
|
|
226
|
+
name: title,
|
|
227
|
+
render: function (row) { return ((0, jsx_runtime_1.jsx)(styles_1.SqlImageWrapper, { children: (0, jsx_runtime_1.jsx)(styles_1.SqlImage, { src: row[key] ? "".concat(urlPrefix).concat(row[key]) : "".concat(urlPrefix, "no-image.png"), alt: title }) })); },
|
|
228
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
229
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
230
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
231
|
+
}, options);
|
|
232
|
+
};
|
|
233
|
+
exports.sqlImageColumn = sqlImageColumn;
|
|
126
234
|
var sqlColorColumn = function (key, title, options) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
235
|
+
return (0, lodash_1.merge)({
|
|
236
|
+
key: key,
|
|
237
|
+
type: 'text',
|
|
238
|
+
name: title,
|
|
239
|
+
render: function (row) { return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', inset: 0, backgroundColor: row[key] }, children: "\u00A0" })); },
|
|
240
|
+
excelOptions: {
|
|
241
|
+
valueGetter: function () { return ''; },
|
|
242
|
+
colorGetter: function (value) { return value; },
|
|
243
|
+
},
|
|
244
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
245
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
246
|
+
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; }, renderer: function (value) { return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
247
|
+
backgroundColor: value,
|
|
248
|
+
width: 'var(--space-16)',
|
|
249
|
+
height: '1em',
|
|
250
|
+
}, children: "\u00A0" })); } }),
|
|
251
|
+
}, options);
|
|
135
252
|
};
|
|
136
253
|
exports.sqlColorColumn = sqlColorColumn;
|
|
254
|
+
var convertRowToItem = function (row, columnMapping) { return (0, lodash_1.mapKeys)(row, function (_, key) { return columnMapping[key]; }); };
|
|
255
|
+
var convertItemToPartialRow = function (key, row, item, columnMapping) {
|
|
256
|
+
var partialRow = { Id: key };
|
|
257
|
+
Object.entries(columnMapping).forEach(function (_a) {
|
|
258
|
+
var _b;
|
|
259
|
+
var key = _a[0], value = _a[1];
|
|
260
|
+
partialRow[key] = ((_b = item === null || item === void 0 ? void 0 : item[value]) !== null && _b !== void 0 ? _b : null);
|
|
261
|
+
});
|
|
262
|
+
return partialRow;
|
|
263
|
+
};
|
|
264
|
+
var sqlForeignListColumn = function (key, columnMapping, title, requestName, ItemTemplate, options) {
|
|
265
|
+
var column = {
|
|
266
|
+
key: key,
|
|
267
|
+
name: title,
|
|
268
|
+
type: 'foreignList',
|
|
269
|
+
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
270
|
+
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
271
|
+
render: function (row) { return ((0, jsx_runtime_1.jsx)(ItemTemplate, { item: convertRowToItem(row, columnMapping), index: 0 })); },
|
|
272
|
+
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; }, renderer: function (value) { return value; } }),
|
|
273
|
+
footer: function (rows) { return "".concat(rows[0][key], " \u00E9l\u00E9ments"); },
|
|
274
|
+
requestName: requestName,
|
|
275
|
+
idColumn: 'Id',
|
|
276
|
+
itemTemplate: ItemTemplate,
|
|
277
|
+
columns: Object.values(columnMapping),
|
|
278
|
+
editComponent: (0, react_1.forwardRef)(function (_a, ref) {
|
|
279
|
+
var row = _a.row, onChange = _a.onChange, onClose = _a.onClose, context = _a.context;
|
|
280
|
+
var _b = (0, react_1.useContext)(context).rowHeight, rowHeight = _b === void 0 ? constants_1.DEFAULT_ROW_HEIGHT : _b;
|
|
281
|
+
return ((0, jsx_runtime_1.jsx)(SqlRequestForeignList_1.SqlRequestForeignList, { initialValue: convertRowToItem(row, columnMapping), maxRows: 10, rowHeight: rowHeight - 2, onItemChanged: onChange, onBlur: function () { return onClose(true); }, ref: ref, requestName: column.requestName, idColumn: column.idColumn, columns: column.columns, itemTemplate: column.itemTemplate, valueTemplate: column.valueTemplate }));
|
|
282
|
+
}),
|
|
283
|
+
itemToPartialRow: function (key, row, value) {
|
|
284
|
+
return convertItemToPartialRow(key, row, value, columnMapping);
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
return (0, lodash_1.merge)(column, options);
|
|
288
|
+
};
|
|
289
|
+
exports.sqlForeignListColumn = sqlForeignListColumn;
|