@addev-be/ui 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/data/SqlRequestGrid/index.tsx +5 -2
- package/src/components/data/SqlRequestGrid/types.ts +5 -2
- package/src/components/data/VirtualScroller/index.tsx +6 -6
- package/src/components/data/VirtualScroller/types.ts +6 -2
- package/src/components/data/index.ts +2 -0
package/package.json
CHANGED
|
@@ -12,13 +12,15 @@ import { VirtualScroller } from '../VirtualScroller';
|
|
|
12
12
|
import { debounce } from 'lodash';
|
|
13
13
|
import { isColumnVisible } from '../DataGrid/helpers';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
16
|
+
export const SqlRequestGrid = <R, P extends object = {}>({
|
|
16
17
|
rowHeight = styles.DEFAULT_ROW_HEIGHT,
|
|
17
18
|
itemsPerRow,
|
|
18
19
|
itemTemplate,
|
|
20
|
+
itemProps,
|
|
19
21
|
gap,
|
|
20
22
|
...props
|
|
21
|
-
}: SqlRequestGridProps<R>) => {
|
|
23
|
+
}: SqlRequestGridProps<R, P>) => {
|
|
22
24
|
const currentRows = useRef<R[]>([]);
|
|
23
25
|
const [rows, setRows] = useState<R[]>([]);
|
|
24
26
|
const [start, setStart] = useState(0);
|
|
@@ -129,6 +131,7 @@ export const SqlRequestGrid = <R,>({
|
|
|
129
131
|
items={rows}
|
|
130
132
|
itemTemplate={itemTemplate}
|
|
131
133
|
itemsPerRow={itemsPerRow}
|
|
134
|
+
itemProps={itemProps}
|
|
132
135
|
rowHeightInPx={rowHeight}
|
|
133
136
|
onRangeChanged={onVisibleRowsChanged}
|
|
134
137
|
gap={gap}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
ConditionDTO,
|
|
3
5
|
FieldDTO,
|
|
@@ -29,8 +31,8 @@ export type SqlRequestGridColumn<R> = DataGridColumn<R> & {
|
|
|
29
31
|
|
|
30
32
|
export type SqlRequestGridColumns<R> = Record<string, SqlRequestGridColumn<R>>;
|
|
31
33
|
|
|
32
|
-
export type SqlRequestGridProps<R> = {
|
|
33
|
-
itemTemplate: VirtualScrollerTemplateFC<R>;
|
|
34
|
+
export type SqlRequestGridProps<R, P extends object = {}> = {
|
|
35
|
+
itemTemplate: VirtualScrollerTemplateFC<R, P>;
|
|
34
36
|
itemsPerRow?: number;
|
|
35
37
|
rowHeight?: number;
|
|
36
38
|
gap?: string;
|
|
@@ -40,4 +42,5 @@ export type SqlRequestGridProps<R> = {
|
|
|
40
42
|
orderBy?: OrderByDTO[];
|
|
41
43
|
conditions?: ConditionDTO[];
|
|
42
44
|
parser?: (row: SqlRequestRow<R>) => R;
|
|
45
|
+
itemProps: P;
|
|
43
46
|
};
|
|
@@ -7,29 +7,29 @@ import { useEffect, useState } from 'react';
|
|
|
7
7
|
import { VirtualScrollerTemplateFC } from './types';
|
|
8
8
|
import { useVirtualScrolling } from './hooks';
|
|
9
9
|
|
|
10
|
-
type VirtualScrollerProps<R> = {
|
|
10
|
+
type VirtualScrollerProps<R, P extends object> = {
|
|
11
11
|
gridTemplateColumns: string;
|
|
12
12
|
items: R[];
|
|
13
|
-
itemTemplate: VirtualScrollerTemplateFC<R>;
|
|
13
|
+
itemTemplate: VirtualScrollerTemplateFC<R, P>;
|
|
14
14
|
rowHeightInPx?: number;
|
|
15
15
|
gap?: string;
|
|
16
16
|
itemsPerRow?: number;
|
|
17
17
|
tolerance?: number;
|
|
18
|
-
itemProps
|
|
18
|
+
itemProps: P;
|
|
19
19
|
onRangeChanged?: (index: number, length: number) => void;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const VirtualScroller = <R
|
|
22
|
+
export const VirtualScroller = <R, P extends object>({
|
|
23
23
|
gridTemplateColumns,
|
|
24
24
|
items,
|
|
25
25
|
rowHeightInPx = styles.DEFAULT_ROW_HEIGHT,
|
|
26
26
|
itemTemplate: ItemTemplate,
|
|
27
|
-
itemProps
|
|
27
|
+
itemProps,
|
|
28
28
|
onRangeChanged,
|
|
29
29
|
gap,
|
|
30
30
|
itemsPerRow,
|
|
31
31
|
tolerance,
|
|
32
|
-
}: VirtualScrollerProps<R>) => {
|
|
32
|
+
}: VirtualScrollerProps<R, P>) => {
|
|
33
33
|
const [scrollableElement, setScrollableElement] =
|
|
34
34
|
useState<HTMLElement | null>(null);
|
|
35
35
|
const {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
|
+
|
|
1
3
|
import { FC } from 'react';
|
|
2
4
|
|
|
3
|
-
export type VirtualScrollerTemplateProps<R> = {
|
|
5
|
+
export type VirtualScrollerTemplateProps<R, P extends object = {}> = P & {
|
|
4
6
|
item: R | null;
|
|
5
7
|
index: number;
|
|
6
8
|
};
|
|
7
9
|
|
|
8
|
-
export type VirtualScrollerTemplateFC<R> = FC<
|
|
10
|
+
export type VirtualScrollerTemplateFC<R, P extends object = {}> = FC<
|
|
11
|
+
VirtualScrollerTemplateProps<R, P>
|
|
12
|
+
>;
|
|
@@ -7,4 +7,6 @@ export * from './SqlRequestDataGrid/helpers';
|
|
|
7
7
|
export * from './SqlRequestDataGrid/types';
|
|
8
8
|
export * from './SqlRequestGrid';
|
|
9
9
|
export * from './SqlRequestGrid/types';
|
|
10
|
+
export * from './VirtualScroller';
|
|
11
|
+
export * from './VirtualScroller/types';
|
|
10
12
|
export * from './AdvancedRequestDataGrid/helpers';
|