@addev-be/ui 0.2.2 → 0.2.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/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.js +2 -2
- package/dist/components/data/DataGrid/DataGridFooter.js +2 -2
- package/dist/components/data/DataGrid/DataGridHeader.js +62 -12
- package/dist/components/data/DataGrid/FilterModalContent/index.d.ts +1 -1
- package/dist/components/data/DataGrid/VirtualScroller.js +1 -6
- package/dist/components/data/DataGrid/helpers/columns.d.ts +12 -13
- package/dist/components/data/DataGrid/helpers/columns.js +17 -68
- package/dist/components/data/DataGrid/helpers/filters.d.ts +5 -5
- package/dist/components/data/DataGrid/helpers/filters.js +15 -18
- package/dist/components/data/DataGrid/helpers/index.d.ts +1 -2
- package/dist/components/data/DataGrid/helpers/index.js +1 -2
- package/dist/components/data/DataGrid/hooks/index.d.ts +2 -2
- package/dist/components/data/DataGrid/hooks/index.js +4 -4
- package/dist/components/data/DataGrid/hooks/useDataGrid.js +26 -4
- package/dist/components/data/DataGrid/index.js +12 -16
- package/dist/components/data/DataGrid/styles.d.ts +3 -1
- package/dist/components/data/DataGrid/styles.js +3 -3
- package/dist/components/data/DataGrid/types.d.ts +33 -45
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.d.ts +16 -0
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +114 -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 +2 -0
- package/dist/components/data/SqlRequestDataGrid/index.js +208 -0
- package/dist/components/data/SqlRequestDataGrid/types.d.ts +20 -0
- package/dist/components/data/SqlRequestDataGrid/types.js +2 -0
- package/dist/components/data/index.d.ts +5 -2
- package/dist/components/data/index.js +5 -2
- package/dist/components/forms/IconButton.js +1 -1
- package/dist/components/forms/IndeterminateCheckbox.js +1 -1
- package/dist/components/layout/Modal/index.js +1 -1
- package/dist/providers/PortalsProvider/index.d.ts +1 -1
- package/dist/providers/PortalsProvider/index.js +1 -1
- package/dist/services/HttpService.d.ts +10 -0
- package/dist/services/HttpService.js +117 -0
- package/dist/services/advancedRequests.d.ts +3 -3
- package/dist/services/advancedRequests.js +2 -2
- package/dist/services/hooks.d.ts +2 -1
- package/dist/services/hooks.js +10 -3
- package/dist/services/sqlRequests.d.ts +40 -0
- package/dist/services/sqlRequests.js +10 -0
- package/package.json +1 -1
- package/src/components/data/DataGrid/DataGridCell.tsx +3 -5
- package/src/components/data/DataGrid/DataGridHeader.tsx +3 -5
- package/src/components/data/DataGrid/DataGridHeaderCell.tsx +5 -4
- package/src/components/data/DataGrid/helpers/columns.tsx +1 -4
- package/src/components/data/DataGrid/hooks/useDataGrid.tsx +4 -1
- package/src/components/data/DataGrid/hooks/useDataGridCopy.ts +0 -1
- package/src/components/data/DataGrid/hooks/useDataGridSettings.ts +0 -1
- package/src/components/data/DataGrid/index.tsx +5 -6
- package/src/components/data/DataGrid/styles.ts +36 -9
- package/src/components/data/DataGrid/types.ts +10 -3
- package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +22 -4
- package/src/components/data/SqlRequestDataGrid/index.tsx +58 -27
- package/src/components/data/SqlRequestDataGrid/types.ts +1 -0
- package/src/components/data/index.ts +2 -0
- package/src/helpers/dates.ts +9 -0
- package/src/services/sqlRequests.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -12,10 +12,7 @@ import moment from 'moment';
|
|
|
12
12
|
|
|
13
13
|
export const isColumnVisible = <R,>(
|
|
14
14
|
obj: DataGridColumn<R> | DataGridSettings
|
|
15
|
-
): boolean =>
|
|
16
|
-
console.log('isColumnVisible obj=', obj);
|
|
17
|
-
return obj?.order !== -1;
|
|
18
|
-
};
|
|
15
|
+
): boolean => obj?.order !== -1;
|
|
19
16
|
|
|
20
17
|
export const textColumn = <R extends Record<string, any>>(
|
|
21
18
|
key: string,
|
|
@@ -37,6 +37,7 @@ export const useDataGrid = <R,>(
|
|
|
37
37
|
onVisibleRowsChange,
|
|
38
38
|
onSelectionChange,
|
|
39
39
|
selectable,
|
|
40
|
+
initialSorts,
|
|
40
41
|
} = props;
|
|
41
42
|
const [columns, setColumns] = useState<DataGridColumns<R>>(props.columns);
|
|
42
43
|
|
|
@@ -116,7 +117,9 @@ export const useDataGrid = <R,>(
|
|
|
116
117
|
|
|
117
118
|
/** ROWS SORTING **/
|
|
118
119
|
|
|
119
|
-
const [sorts, setSorts] = useState<Record<string, DataGridSort>>(
|
|
120
|
+
const [sorts, setSorts] = useState<Record<string, DataGridSort>>(
|
|
121
|
+
initialSorts ?? {}
|
|
122
|
+
);
|
|
120
123
|
const [sortedRows, setSortedRows] = useState<R[]>(rows);
|
|
121
124
|
|
|
122
125
|
useEffect(() => {
|
|
@@ -69,7 +69,6 @@ export const useDataGridCopy = <R>(
|
|
|
69
69
|
|
|
70
70
|
const generateCopyHtml = useCallback(
|
|
71
71
|
(rowsToCopy: R[], includeHeaders: boolean, includeFooters: boolean) => {
|
|
72
|
-
console.log('generateCopyHtml', rowsToCopy, columns);
|
|
73
72
|
return `
|
|
74
73
|
<table>
|
|
75
74
|
${includeHeaders ? generateHeadersHtml() : ''}
|
|
@@ -14,7 +14,6 @@ export const useDataGridSettings = (name?: string) => {
|
|
|
14
14
|
if (name) {
|
|
15
15
|
const settingName = `user.datagrid.settings.${name}`;
|
|
16
16
|
const gridSettingsJson = settings?.[settingName] || '{}';
|
|
17
|
-
console.log('read datagrid settings for', settingName, gridSettingsJson);
|
|
18
17
|
let gridSettings: DataGridSettings = {};
|
|
19
18
|
try {
|
|
20
19
|
gridSettings = JSON.parse(gridSettingsJson);
|
|
@@ -47,10 +47,6 @@ export const DataGrid = <R,>(props: DataGridProps<R>) => {
|
|
|
47
47
|
|
|
48
48
|
const rowTemplate = useCallback(
|
|
49
49
|
(row: R, rowIndex: number) => {
|
|
50
|
-
const { className, style } = props.rowClassNameGetter?.(row) ?? {
|
|
51
|
-
className: '',
|
|
52
|
-
style: undefined,
|
|
53
|
-
};
|
|
54
50
|
if (!row) {
|
|
55
51
|
return (
|
|
56
52
|
<styles.DataGridRow key={`loading-row-${rowIndex}`}>
|
|
@@ -71,6 +67,10 @@ export const DataGrid = <R,>(props: DataGridProps<R>) => {
|
|
|
71
67
|
);
|
|
72
68
|
}
|
|
73
69
|
const key = rowKeyGetter(row);
|
|
70
|
+
const { className, style } = props.rowClassNameGetter?.(row) ?? {
|
|
71
|
+
className: '',
|
|
72
|
+
style: undefined,
|
|
73
|
+
};
|
|
74
74
|
return (
|
|
75
75
|
<styles.DataGridRow key={key}>
|
|
76
76
|
{!!props.selectable && (
|
|
@@ -86,8 +86,7 @@ export const DataGrid = <R,>(props: DataGridProps<R>) => {
|
|
|
86
86
|
{visibleColumns.map(([key, col], index) => (
|
|
87
87
|
<DataGridCell
|
|
88
88
|
key={`loading-${rowIndex}-${index}`}
|
|
89
|
-
|
|
90
|
-
style={style}
|
|
89
|
+
{...(index === 0 ? { className, style } : {})}
|
|
91
90
|
row={row}
|
|
92
91
|
rowIndex={rowIndex}
|
|
93
92
|
column={col}
|
|
@@ -76,7 +76,7 @@ export const DataGridResizeGrip = styled.div<{ $headerColor?: ThemeColor }>`
|
|
|
76
76
|
`;
|
|
77
77
|
|
|
78
78
|
type DataGridHeaderCellContainerProps = {
|
|
79
|
-
$isResizing
|
|
79
|
+
$isResizing?: boolean;
|
|
80
80
|
$headerColor?: ThemeColor;
|
|
81
81
|
};
|
|
82
82
|
|
|
@@ -96,14 +96,31 @@ export const DataGridHeaderCellContainer = styled.div<DataGridHeaderCellContaine
|
|
|
96
96
|
$headerColor
|
|
97
97
|
? css`
|
|
98
98
|
background-color: var(--color-${$headerColor}-200);
|
|
99
|
-
color: var(--color-${$headerColor}-
|
|
99
|
+
color: var(--color-${$headerColor}-950);
|
|
100
100
|
&:hover {
|
|
101
101
|
background-color: var(--color-${$headerColor}-300);
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
& > button {
|
|
105
|
+
background-color: var(--color-${$headerColor}-400);
|
|
106
|
+
border-color: var(--color-${$headerColor}-500);
|
|
107
|
+
&:hover {
|
|
108
|
+
background-color: var(--color-${$headerColor}-500);
|
|
109
|
+
border-color: var(--color-${$headerColor}-600);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
& > button.danger {
|
|
113
|
+
background-color: var(--color-red-400);
|
|
114
|
+
border-color: var(--color-red-500);
|
|
115
|
+
&:hover {
|
|
116
|
+
background-color: var(--color-red-500);
|
|
117
|
+
border-color: var(--color-red-600);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
103
120
|
`
|
|
104
121
|
: css`
|
|
105
122
|
background-color: var(--color-neutral-200);
|
|
106
|
-
color: var(--color-neutral-
|
|
123
|
+
color: var(--color-neutral-950);
|
|
107
124
|
&:hover {
|
|
108
125
|
background-color: var(--color-neutral-300);
|
|
109
126
|
}
|
|
@@ -121,11 +138,13 @@ export const DataGridHeaderCellContainer = styled.div<DataGridHeaderCellContaine
|
|
|
121
138
|
overflow: hidden;
|
|
122
139
|
white-space: nowrap;
|
|
123
140
|
flex: 1;
|
|
141
|
+
font-weight: bold;
|
|
124
142
|
}
|
|
125
143
|
`;
|
|
126
144
|
DataGridHeaderCellContainer.displayName = 'DataGridHeaderCellContainer';
|
|
127
145
|
|
|
128
146
|
export const DataGridCell = styled.div`
|
|
147
|
+
position: relative;
|
|
129
148
|
padding: 0 var(--space-3);
|
|
130
149
|
overflow: hidden;
|
|
131
150
|
text-overflow: ellipsis;
|
|
@@ -237,24 +256,32 @@ export const LoadingCell = styled(DataGridCell)`
|
|
|
237
256
|
`;
|
|
238
257
|
LoadingCell.displayName = 'LoadingCell';
|
|
239
258
|
|
|
240
|
-
|
|
241
|
-
/* inline-flex items-center justify-center w-12 select-none text-center whitespace-nowrap */
|
|
259
|
+
const selectionCellStyle = css`
|
|
242
260
|
display: flex;
|
|
243
261
|
align-items: center;
|
|
244
262
|
justify-content: center;
|
|
245
|
-
width: var(--space-
|
|
263
|
+
width: var(--space-8);
|
|
246
264
|
padding: 0 var(--space-1);
|
|
247
265
|
|
|
248
266
|
& > input[type='checkbox'] {
|
|
249
|
-
height: var(--space-
|
|
250
|
-
width: var(--space-
|
|
267
|
+
height: var(--space-4);
|
|
268
|
+
width: var(--space-4);
|
|
251
269
|
border-radius: var(--rounded-sm);
|
|
252
270
|
border: 1px solid var(--color-neutral-300);
|
|
253
|
-
color: var(--color-
|
|
271
|
+
color: var(--color-primary-600);
|
|
254
272
|
}
|
|
255
273
|
`;
|
|
274
|
+
|
|
275
|
+
export const SelectionCell = styled(DataGridCell)`
|
|
276
|
+
${selectionCellStyle}
|
|
277
|
+
`;
|
|
256
278
|
SelectionCell.displayName = 'SelectionCell';
|
|
257
279
|
|
|
280
|
+
export const HeaderSelectionCell = styled(DataGridHeaderCellContainer)`
|
|
281
|
+
${selectionCellStyle}
|
|
282
|
+
`;
|
|
283
|
+
HeaderSelectionCell.displayName = 'HeaderSelectionCell';
|
|
284
|
+
|
|
258
285
|
export const ResizeBackdrop = styled.div.attrs({
|
|
259
286
|
className: 'ResizeBackdrop',
|
|
260
287
|
})`
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
CSSProperties,
|
|
7
7
|
Context,
|
|
8
8
|
Dispatch,
|
|
9
|
+
FC,
|
|
9
10
|
MouseEvent,
|
|
11
|
+
MouseEventHandler,
|
|
10
12
|
ReactNode,
|
|
11
13
|
SetStateAction,
|
|
12
14
|
} from 'react';
|
|
@@ -16,9 +18,13 @@ import { ThemeColor } from '../../../providers/ThemeProvider/types';
|
|
|
16
18
|
|
|
17
19
|
export type MysqlJsonObject = Record<string, string | number | null>;
|
|
18
20
|
|
|
21
|
+
export type DataGridCellFC = FC<{
|
|
22
|
+
onDoubleClick?: MouseEventHandler;
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
19
26
|
export type DataGridColumn<R> = {
|
|
20
|
-
|
|
21
|
-
className?: string;
|
|
27
|
+
component?: DataGridCellFC;
|
|
22
28
|
editable?: boolean;
|
|
23
29
|
excelFormatter?: (value: any) => string;
|
|
24
30
|
excelValue?: (value: any) => string;
|
|
@@ -68,6 +74,7 @@ export type DataGridProps<R> = {
|
|
|
68
74
|
rowHeight?: number;
|
|
69
75
|
filter?: boolean;
|
|
70
76
|
sort?: boolean;
|
|
77
|
+
initialSorts?: Record<string, DataGridSort>;
|
|
71
78
|
filterValuesLoader?: (
|
|
72
79
|
columnKey: string
|
|
73
80
|
) => Promise<(string | number | null | MysqlJsonObject)[]>;
|
|
@@ -202,7 +209,7 @@ export type DataGridFilterDataType<T extends DataGridFilterType> =
|
|
|
202
209
|
export type DataGridFilterGetter<T extends DataGridFilterType> = (
|
|
203
210
|
value: any
|
|
204
211
|
) => DataGridFilterDataType<T> | null;
|
|
205
|
-
export type DataGridFilterFormatter = (value: any) =>
|
|
212
|
+
export type DataGridFilterFormatter = (value: any) => ReactNode;
|
|
206
213
|
|
|
207
214
|
export type DataGridFilterOperator<T extends DataGridFilterType> =
|
|
208
215
|
DataGridFilterPredicates[T] extends DataGridFilterOperators<infer K, any>
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '../../../../helpers/numbers';
|
|
9
9
|
import { numberFilter, textFilter } from '../../DataGrid/helpers';
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import { formatDate } from '../../../../helpers/dates';
|
|
12
12
|
|
|
13
13
|
export const sqlTextColumn = <R extends Record<string, any>>(
|
|
14
14
|
key: string,
|
|
@@ -95,7 +95,7 @@ export const sqlDateColumn = <R extends Record<string, any>>(
|
|
|
95
95
|
): SqlRequestDataGridColumns<R> => ({
|
|
96
96
|
[key]: {
|
|
97
97
|
name: title,
|
|
98
|
-
render: (row) =>
|
|
98
|
+
render: (row) => formatDate(row[key]),
|
|
99
99
|
getter: (row) => row[key] ?? '',
|
|
100
100
|
sortGetter: (row) => row[key] ?? '',
|
|
101
101
|
filter: { ...textFilter(key), getter: (value) => value[key] ?? '' },
|
|
@@ -196,11 +196,29 @@ export const sqlColorColumn = <R extends Record<string, any>>(
|
|
|
196
196
|
[key]: {
|
|
197
197
|
name: title,
|
|
198
198
|
render: (row) => (
|
|
199
|
-
<div
|
|
199
|
+
<div
|
|
200
|
+
style={{ position: 'absolute', inset: 0, backgroundColor: row[key] }}
|
|
201
|
+
>
|
|
202
|
+
|
|
203
|
+
</div>
|
|
200
204
|
),
|
|
201
205
|
getter: (row) => row[key] ?? '',
|
|
202
206
|
sortGetter: (row) => row[key] ?? '',
|
|
203
|
-
filter: {
|
|
207
|
+
filter: {
|
|
208
|
+
...textFilter(key),
|
|
209
|
+
getter: (value) => value[key] ?? '',
|
|
210
|
+
formatter: (value) => (
|
|
211
|
+
<div
|
|
212
|
+
style={{
|
|
213
|
+
backgroundColor: value,
|
|
214
|
+
width: 'var(--space-16)',
|
|
215
|
+
height: '1em',
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
|
|
219
|
+
</div>
|
|
220
|
+
),
|
|
221
|
+
},
|
|
204
222
|
...options,
|
|
205
223
|
},
|
|
206
224
|
});
|
|
@@ -3,18 +3,13 @@ import {
|
|
|
3
3
|
OrderByDTO,
|
|
4
4
|
useSqlRequestHandler,
|
|
5
5
|
} from '../../../services/sqlRequests';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
DataGridSort,
|
|
10
|
-
} from '../DataGrid/types';
|
|
11
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { DataGridFilters, DataGridSort } from '../DataGrid/types';
|
|
7
|
+
import _, { debounce } from 'lodash';
|
|
8
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
9
|
|
|
13
10
|
import { DataGrid } from '../DataGrid';
|
|
14
11
|
import { SqlRequestDataGridProps } from './types';
|
|
15
|
-
import _ from 'lodash';
|
|
16
12
|
import { convertSqlFiltersToConditions } from './helpers';
|
|
17
|
-
import { debounce } from 'lodash';
|
|
18
13
|
import { isColumnVisible } from '../DataGrid/helpers';
|
|
19
14
|
|
|
20
15
|
export const SqlRequestDataGrid = <R,>({
|
|
@@ -31,7 +26,27 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
31
26
|
const [conditions, setConditions] = useState<Record<string, ConditionDTO>>(
|
|
32
27
|
{}
|
|
33
28
|
);
|
|
34
|
-
const [orderBy, setOrderBy] = useState<OrderByDTO[]>(
|
|
29
|
+
const [orderBy, setOrderBy] = useState<OrderByDTO[]>(
|
|
30
|
+
Object.entries(props.initialSorts ?? {}).map(
|
|
31
|
+
([columnKey, direction]): OrderByDTO => ({
|
|
32
|
+
field: props.columns[columnKey].field?.fieldAlias ?? columnKey,
|
|
33
|
+
direction: direction.toUpperCase() as 'ASC' | 'DESC',
|
|
34
|
+
})
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const [columnsKeys, visibleColumnsKeys] = useMemo(
|
|
39
|
+
() => [
|
|
40
|
+
[...Object.keys(props.columns), ...(props.hiddenColumns ?? [])],
|
|
41
|
+
[
|
|
42
|
+
...Object.keys(props.columns).filter((key) =>
|
|
43
|
+
isColumnVisible(props.columns[key])
|
|
44
|
+
),
|
|
45
|
+
...(props.hiddenColumns ?? []),
|
|
46
|
+
],
|
|
47
|
+
],
|
|
48
|
+
[props.columns, props.hiddenColumns]
|
|
49
|
+
);
|
|
35
50
|
|
|
36
51
|
const refresh = useCallback(() => {
|
|
37
52
|
setRows([]);
|
|
@@ -56,7 +71,6 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
56
71
|
direction: direction.toUpperCase(),
|
|
57
72
|
} as OrderByDTO)
|
|
58
73
|
);
|
|
59
|
-
console.log('newOrderBy=', newOrderBy);
|
|
60
74
|
setOrderBy(newOrderBy);
|
|
61
75
|
},
|
|
62
76
|
[refresh]
|
|
@@ -65,19 +79,19 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
65
79
|
const loadRows = useRef(
|
|
66
80
|
debounce(
|
|
67
81
|
(
|
|
68
|
-
columns:
|
|
82
|
+
columns: string[],
|
|
83
|
+
returnColumns: string[],
|
|
69
84
|
conditions: ConditionDTO[] = [],
|
|
70
85
|
orderBy: OrderByDTO[] = [],
|
|
71
86
|
start = 0,
|
|
72
87
|
length = 100,
|
|
73
88
|
getTotal = false
|
|
74
89
|
) => {
|
|
75
|
-
const columnsKeys = Object.keys(columns).filter((key) =>
|
|
76
|
-
isColumnVisible(columns[key])
|
|
77
|
-
);
|
|
78
|
-
if (!columnsKeys.includes('Id')) columnsKeys.push('Id');
|
|
79
90
|
sqlRequest({
|
|
80
|
-
columns:
|
|
91
|
+
columns: columns.includes('Id') ? columns : [...columns, 'Id'],
|
|
92
|
+
returnColumns: returnColumns.includes('Id')
|
|
93
|
+
? returnColumns
|
|
94
|
+
: [...returnColumns, 'Id'],
|
|
81
95
|
conditions,
|
|
82
96
|
orderBy,
|
|
83
97
|
start,
|
|
@@ -95,14 +109,19 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
95
109
|
setRows([...currentRows.current]);
|
|
96
110
|
});
|
|
97
111
|
},
|
|
98
|
-
100
|
|
112
|
+
100,
|
|
113
|
+
{
|
|
114
|
+
leading: true,
|
|
115
|
+
trailing: true,
|
|
116
|
+
}
|
|
99
117
|
)
|
|
100
118
|
);
|
|
101
119
|
|
|
102
120
|
const loadFilterValues = useCallback(
|
|
103
121
|
(columnKey: string) => {
|
|
104
122
|
return sqlRequest({
|
|
105
|
-
columns:
|
|
123
|
+
columns: columnsKeys,
|
|
124
|
+
returnColumns: [columnKey],
|
|
106
125
|
conditions: [
|
|
107
126
|
...(props.conditions ?? []),
|
|
108
127
|
...Object.values(
|
|
@@ -127,28 +146,38 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
127
146
|
)
|
|
128
147
|
);
|
|
129
148
|
},
|
|
130
|
-
[conditions, props.columns, props.conditions, sqlRequest]
|
|
149
|
+
[columnsKeys, conditions, props.columns, props.conditions, sqlRequest]
|
|
131
150
|
);
|
|
132
151
|
|
|
133
152
|
useEffect(
|
|
134
153
|
() =>
|
|
135
154
|
loadRows.current(
|
|
136
|
-
|
|
155
|
+
columnsKeys,
|
|
156
|
+
visibleColumnsKeys,
|
|
137
157
|
[...(props.conditions ?? []), ...(Object.values(conditions) ?? [])],
|
|
138
158
|
orderBy,
|
|
139
159
|
start,
|
|
140
160
|
length,
|
|
141
161
|
total < 0
|
|
142
162
|
),
|
|
143
|
-
[
|
|
163
|
+
[
|
|
164
|
+
props.columns,
|
|
165
|
+
conditions,
|
|
166
|
+
orderBy,
|
|
167
|
+
start,
|
|
168
|
+
length,
|
|
169
|
+
total,
|
|
170
|
+
props.conditions,
|
|
171
|
+
columnsKeys,
|
|
172
|
+
visibleColumnsKeys,
|
|
173
|
+
]
|
|
144
174
|
);
|
|
145
175
|
|
|
146
176
|
const loadCopyRows = useCallback(
|
|
147
177
|
() =>
|
|
148
178
|
sqlRequest({
|
|
149
|
-
columns:
|
|
150
|
-
|
|
151
|
-
),
|
|
179
|
+
columns: columnsKeys,
|
|
180
|
+
returnColumns: visibleColumnsKeys,
|
|
152
181
|
conditions: [
|
|
153
182
|
...(props.conditions ?? []),
|
|
154
183
|
...(Object.values(conditions) ?? []),
|
|
@@ -161,7 +190,8 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
161
190
|
),
|
|
162
191
|
[
|
|
163
192
|
sqlRequest,
|
|
164
|
-
|
|
193
|
+
columnsKeys,
|
|
194
|
+
visibleColumnsKeys,
|
|
165
195
|
props.conditions,
|
|
166
196
|
props.parser,
|
|
167
197
|
conditions,
|
|
@@ -173,7 +203,8 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
173
203
|
const loadAllIds = useCallback(
|
|
174
204
|
() =>
|
|
175
205
|
sqlIdRequest({
|
|
176
|
-
columns:
|
|
206
|
+
columns: columnsKeys,
|
|
207
|
+
returnColumns: ['Id'],
|
|
177
208
|
conditions: [
|
|
178
209
|
...(props.conditions ?? []),
|
|
179
210
|
...(Object.values(conditions) ?? []),
|
|
@@ -182,7 +213,7 @@ export const SqlRequestDataGrid = <R,>({
|
|
|
182
213
|
start: 0,
|
|
183
214
|
length: total,
|
|
184
215
|
}).then((response) => response.data.map((row) => row['Id'])),
|
|
185
|
-
[conditions, orderBy, props.conditions, sqlIdRequest, total]
|
|
216
|
+
[columnsKeys, conditions, orderBy, props.conditions, sqlIdRequest, total]
|
|
186
217
|
);
|
|
187
218
|
|
|
188
219
|
const onVisibleRowsChanged = useCallback(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './DataGrid';
|
|
2
2
|
export * from './DataGrid/helpers';
|
|
3
|
+
export * from './DataGrid/styles';
|
|
3
4
|
export * from './AdvancedRequestDataGrid';
|
|
4
5
|
export * from './SqlRequestDataGrid';
|
|
5
6
|
export * from './SqlRequestDataGrid/helpers';
|
|
7
|
+
export * from './SqlRequestDataGrid/types';
|
|
6
8
|
export * from './AdvancedRequestDataGrid/helpers';
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/icons.tsx","./src/index.ts","./src/typings.d.ts","./src/components/index.ts","./src/components/data/index.ts","./src/components/data/
|
|
1
|
+
{"root":["./src/icons.tsx","./src/index.ts","./src/typings.d.ts","./src/components/index.ts","./src/components/data/index.ts","./src/components/data/advancedrequestdatagrid/index.tsx","./src/components/data/advancedrequestdatagrid/types.ts","./src/components/data/advancedrequestdatagrid/helpers/advancedrequests.ts","./src/components/data/advancedrequestdatagrid/helpers/columns.tsx","./src/components/data/advancedrequestdatagrid/helpers/index.ts","./src/components/data/datagrid/datagridcell.tsx","./src/components/data/datagrid/datagrideditablecell.tsx","./src/components/data/datagrid/datagridfooter.tsx","./src/components/data/datagrid/datagridheader.tsx","./src/components/data/datagrid/datagridheadercell.tsx","./src/components/data/datagrid/filtervaluesscroller.tsx","./src/components/data/datagrid/virtualscroller.tsx","./src/components/data/datagrid/index.tsx","./src/components/data/datagrid/styles.ts","./src/components/data/datagrid/types.ts","./src/components/data/datagrid/datagridcolumnsmodal/helpers.ts","./src/components/data/datagrid/datagridcolumnsmodal/hooks.tsx","./src/components/data/datagrid/datagridcolumnsmodal/index.tsx","./src/components/data/datagrid/datagridcolumnsmodal/styles.ts","./src/components/data/datagrid/datagridfiltermenu/hooks.tsx","./src/components/data/datagrid/datagridfiltermenu/index.tsx","./src/components/data/datagrid/datagridfiltermenu/styles.ts","./src/components/data/datagrid/filtermodalcontent/index.tsx","./src/components/data/datagrid/filtermodalcontent/styles.ts","./src/components/data/datagrid/helpers/columns.tsx","./src/components/data/datagrid/helpers/filters.ts","./src/components/data/datagrid/helpers/index.ts","./src/components/data/datagrid/hooks/index.ts","./src/components/data/datagrid/hooks/usedatagrid.tsx","./src/components/data/datagrid/hooks/usedatagridcopy.ts","./src/components/data/datagrid/hooks/usedatagridsettings.ts","./src/components/data/sqlrequestdatagrid/index.tsx","./src/components/data/sqlrequestdatagrid/types.ts","./src/components/data/sqlrequestdatagrid/helpers/columns.tsx","./src/components/data/sqlrequestdatagrid/helpers/index.ts","./src/components/data/sqlrequestdatagrid/helpers/sqlrequests.ts","./src/components/forms/button.tsx","./src/components/forms/iconbutton.tsx","./src/components/forms/indeterminatecheckbox.tsx","./src/components/forms/select.tsx","./src/components/forms/index.ts","./src/components/forms/styles.ts","./src/components/layout/index.ts","./src/components/layout/dropdown/index.tsx","./src/components/layout/dropdown/styles.ts","./src/components/layout/loading/index.tsx","./src/components/layout/loading/styles.ts","./src/components/layout/modal/index.tsx","./src/components/layout/modal/styles.ts","./src/config/index.ts","./src/helpers/getscrollbarsize.ts","./src/helpers/numbers.ts","./src/hooks/index.ts","./src/hooks/useelementsize.ts","./src/hooks/usewindowsize.ts","./src/providers/hooks.ts","./src/providers/index.ts","./src/providers/portalsprovider/index.tsx","./src/providers/portalsprovider/styles.ts","./src/providers/settingsprovider/index.tsx","./src/providers/themeprovider/themeprovider.ts","./src/providers/themeprovider/defaulttheme.ts","./src/providers/themeprovider/index.ts","./src/providers/themeprovider/types.ts","./src/providers/uiproviders/index.tsx","./src/providers/uiproviders/styles.ts","./src/services/httpservice.ts","./src/services/websocketservice.ts","./src/services/advancedrequests.ts","./src/services/base.ts","./src/services/hooks.ts","./src/services/index.ts","./src/services/sqlrequests.ts"],"errors":true,"version":"5.6.2"}
|