@etsoo/react 1.7.28 → 1.7.30

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.
@@ -57,7 +57,7 @@ export type GridLoadDataProps = {
57
57
  /**
58
58
  * Grid data loader
59
59
  */
60
- export type GridLoader<T extends object> = {
60
+ export interface GridLoader<T extends object> {
61
61
  /**
62
62
  * Auto load data, otherwise call reset
63
63
  * @default true
@@ -91,7 +91,7 @@ export type GridLoader<T extends object> = {
91
91
  * Threshold at which to pre-fetch data; default is half of loadBatchSize
92
92
  */
93
93
  threshold?: number | undefined;
94
- };
94
+ }
95
95
  /**
96
96
  * Grid loader states
97
97
  */
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from '@etsoo/shared';
1
+ import { DataTypes } from '@etsoo/shared';
2
2
  import React from 'react';
3
3
  import { Align, GridChildComponentProps, VariableSizeGridProps } from 'react-window';
4
4
  import { GridLoader, GridLoaderStates } from './GridLoader';
@@ -21,7 +21,7 @@ export type ScrollerGridItemRendererProps<T> = Omit<GridChildComponentProps<T>,
21
21
  /**
22
22
  * Scroller vertical grid props
23
23
  */
24
- export type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T>> = GridLoader<T> & Omit<VariableSizeGridProps<T>, 'children' | 'rowCount' | 'rowHeight' | 'ref'> & {
24
+ export interface ScrollerGridProps<T extends object> extends GridLoader<T>, Omit<VariableSizeGridProps<T>, 'children' | 'rowCount' | 'rowHeight' | 'ref'> {
25
25
  /**
26
26
  * Default order by asc
27
27
  * @default true
@@ -38,7 +38,7 @@ export type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T>> = G
38
38
  /**
39
39
  * Id field
40
40
  */
41
- idField?: D;
41
+ idField?: DataTypes.Keys<T>;
42
42
  /**
43
43
  * Item renderer
44
44
  */
@@ -55,7 +55,7 @@ export type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T>> = G
55
55
  * Returns the height of the specified row.
56
56
  */
57
57
  rowHeight?: ((index: number) => number) | number;
58
- };
58
+ }
59
59
  /**
60
60
  * Scroller grid forward ref
61
61
  */
@@ -114,4 +114,4 @@ export interface ScrollerGridForwardRef<T> extends GridMethodRef<T> {
114
114
  * @param props Props
115
115
  * @returns Component
116
116
  */
117
- export declare const ScrollerGrid: <T extends object, D extends DataTypes.Keys<T, import("@etsoo/shared").IdType> = IdDefaultType<T>>(props: ScrollerGridProps<T, D>) => React.JSX.Element;
117
+ export declare const ScrollerGrid: <T extends object>(props: ScrollerGridProps<T>) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from '@etsoo/shared';
1
+ import { DataTypes } from '@etsoo/shared';
2
2
  import React from 'react';
3
3
  import { Align, ListChildComponentProps, ListProps } from 'react-window';
4
4
  import { GridLoader } from './GridLoader';
@@ -6,7 +6,7 @@ import { GridMethodRef } from './GridMethodRef';
6
6
  /**
7
7
  * Scroller vertical list props
8
8
  */
9
- export interface ScrollerListProps<T extends object, D extends DataTypes.Keys<T>> extends GridLoader<T>, Omit<ListProps<T>, 'ref' | 'outerRef' | 'height' | 'width' | 'children' | 'itemCount'> {
9
+ export interface ScrollerListProps<T extends object> extends GridLoader<T>, Omit<ListProps<T>, 'ref' | 'outerRef' | 'height' | 'width' | 'children' | 'itemCount'> {
10
10
  /**
11
11
  * Default order by asc/desc
12
12
  */
@@ -30,7 +30,7 @@ export interface ScrollerListProps<T extends object, D extends DataTypes.Keys<T>
30
30
  /**
31
31
  * Id field
32
32
  */
33
- idField?: D;
33
+ idField?: DataTypes.Keys<T>;
34
34
  /**
35
35
  * Item renderer
36
36
  */
@@ -67,4 +67,4 @@ export interface ScrollerListForwardRef<T> extends GridMethodRef<T> {
67
67
  * @param props Props
68
68
  * @returns Component
69
69
  */
70
- export declare const ScrollerList: <T extends object, D extends DataTypes.Keys<T, import("@etsoo/shared").IdType> = IdDefaultType<T>>(props: ScrollerListProps<T, D>) => React.JSX.Element;
70
+ export declare const ScrollerList: <T extends object>(props: ScrollerListProps<T>) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.7.28",
3
+ "version": "1.7.30",
4
4
  "description": "TypeScript ReactJs UI Independent Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -95,7 +95,7 @@ export type GridLoadDataProps = {
95
95
  /**
96
96
  * Grid data loader
97
97
  */
98
- export type GridLoader<T extends object> = {
98
+ export interface GridLoader<T extends object> {
99
99
  /**
100
100
  * Auto load data, otherwise call reset
101
101
  * @default true
@@ -137,7 +137,7 @@ export type GridLoader<T extends object> = {
137
137
  * Threshold at which to pre-fetch data; default is half of loadBatchSize
138
138
  */
139
139
  threshold?: number | undefined;
140
- };
140
+ }
141
141
 
142
142
  /**
143
143
  * Grid loader states
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from '@etsoo/shared';
1
+ import { DataTypes } from '@etsoo/shared';
2
2
  import React from 'react';
3
3
  import {
4
4
  Align,
@@ -39,60 +39,58 @@ export type ScrollerGridItemRendererProps<T> = Omit<
39
39
  /**
40
40
  * Scroller vertical grid props
41
41
  */
42
- export type ScrollerGridProps<
43
- T extends object,
44
- D extends DataTypes.Keys<T>
45
- > = GridLoader<T> &
46
- Omit<
47
- VariableSizeGridProps<T>,
48
- 'children' | 'rowCount' | 'rowHeight' | 'ref'
49
- > & {
50
- /**
51
- * Default order by asc
52
- * @default true
53
- */
54
- defaultOrderByAsc?: boolean;
55
-
56
- /**
57
- * Footer renderer
58
- */
59
- footerRenderer?: (
60
- rows: T[],
61
- states: GridLoaderStates<T>
62
- ) => React.ReactNode;
63
-
64
- /**
65
- * Header renderer
66
- */
67
- headerRenderer?: (states: GridLoaderStates<T>) => React.ReactNode;
68
-
69
- /**
70
- * Id field
71
- */
72
- idField?: D;
73
-
74
- /**
75
- * Item renderer
76
- */
77
- itemRenderer: (
78
- props: ScrollerGridItemRendererProps<T>
79
- ) => React.ReactElement;
80
-
81
- /**
82
- * Methods
83
- */
84
- mRef?: React.Ref<ScrollerGridForwardRef<T>>;
85
-
86
- /**
87
- * On items select change
88
- */
89
- onSelectChange?: (selectedItems: T[]) => void;
90
-
91
- /**
92
- * Returns the height of the specified row.
93
- */
94
- rowHeight?: ((index: number) => number) | number;
95
- };
42
+ export interface ScrollerGridProps<T extends object>
43
+ extends GridLoader<T>,
44
+ Omit<
45
+ VariableSizeGridProps<T>,
46
+ 'children' | 'rowCount' | 'rowHeight' | 'ref'
47
+ > {
48
+ /**
49
+ * Default order by asc
50
+ * @default true
51
+ */
52
+ defaultOrderByAsc?: boolean;
53
+
54
+ /**
55
+ * Footer renderer
56
+ */
57
+ footerRenderer?: (
58
+ rows: T[],
59
+ states: GridLoaderStates<T>
60
+ ) => React.ReactNode;
61
+
62
+ /**
63
+ * Header renderer
64
+ */
65
+ headerRenderer?: (states: GridLoaderStates<T>) => React.ReactNode;
66
+
67
+ /**
68
+ * Id field
69
+ */
70
+ idField?: DataTypes.Keys<T>;
71
+
72
+ /**
73
+ * Item renderer
74
+ */
75
+ itemRenderer: (
76
+ props: ScrollerGridItemRendererProps<T>
77
+ ) => React.ReactElement;
78
+
79
+ /**
80
+ * Methods
81
+ */
82
+ mRef?: React.Ref<ScrollerGridForwardRef<T>>;
83
+
84
+ /**
85
+ * On items select change
86
+ */
87
+ onSelectChange?: (selectedItems: T[]) => void;
88
+
89
+ /**
90
+ * Returns the height of the specified row.
91
+ */
92
+ rowHeight?: ((index: number) => number) | number;
93
+ }
96
94
 
97
95
  /**
98
96
  * Scroller grid forward ref
@@ -158,12 +156,7 @@ export interface ScrollerGridForwardRef<T> extends GridMethodRef<T> {
158
156
  * @param props Props
159
157
  * @returns Component
160
158
  */
161
- export const ScrollerGrid = <
162
- T extends object,
163
- D extends DataTypes.Keys<T> = IdDefaultType<T>
164
- >(
165
- props: ScrollerGridProps<T, D>
166
- ) => {
159
+ export const ScrollerGrid = <T extends object>(props: ScrollerGridProps<T>) => {
167
160
  // Destruct
168
161
  const {
169
162
  autoLoad = true,
@@ -172,7 +165,7 @@ export const ScrollerGrid = <
172
165
  footerRenderer,
173
166
  headerRenderer,
174
167
  itemRenderer,
175
- idField = 'id' as D,
168
+ idField = 'id' as DataTypes.Keys<T>,
176
169
  loadBatchSize,
177
170
  loadData,
178
171
  mRef,
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType, Utils } from '@etsoo/shared';
1
+ import { DataTypes, Utils } from '@etsoo/shared';
2
2
  import React from 'react';
3
3
  import {
4
4
  Align,
@@ -20,10 +20,8 @@ import { GridMethodRef } from './GridMethodRef';
20
20
  /**
21
21
  * Scroller vertical list props
22
22
  */
23
- export interface ScrollerListProps<
24
- T extends object,
25
- D extends DataTypes.Keys<T>
26
- > extends GridLoader<T>,
23
+ export interface ScrollerListProps<T extends object>
24
+ extends GridLoader<T>,
27
25
  Omit<
28
26
  ListProps<T>,
29
27
  'ref' | 'outerRef' | 'height' | 'width' | 'children' | 'itemCount'
@@ -56,7 +54,7 @@ export interface ScrollerListProps<
56
54
  /**
57
55
  * Id field
58
56
  */
59
- idField?: D;
57
+ idField?: DataTypes.Keys<T>;
60
58
 
61
59
  /**
62
60
  * Item renderer
@@ -108,12 +106,7 @@ const calculateBatchSize = (
108
106
  * @param props Props
109
107
  * @returns Component
110
108
  */
111
- export const ScrollerList = <
112
- T extends object,
113
- D extends DataTypes.Keys<T> = IdDefaultType<T>
114
- >(
115
- props: ScrollerListProps<T, D>
116
- ) => {
109
+ export const ScrollerList = <T extends object>(props: ScrollerListProps<T>) => {
117
110
  // Destruct
118
111
  const {
119
112
  autoLoad = true,
@@ -124,7 +117,7 @@ export const ScrollerList = <
124
117
  mRef,
125
118
  oRef,
126
119
  style = {},
127
- idField = 'id' as D,
120
+ idField = 'id' as DataTypes.Keys<T>,
128
121
  itemRenderer,
129
122
  itemSize,
130
123
  loadBatchSize = calculateBatchSize(height, itemSize),