@etsoo/react 1.6.53 → 1.6.55
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EntityStatus } from '@etsoo/appscript';
|
|
1
2
|
import { DataTypes } from '@etsoo/shared';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { GridLoaderStates } from './GridLoader';
|
|
@@ -16,6 +17,16 @@ export type GridAlign = 'center' | 'inherit' | 'justify' | 'left' | 'right';
|
|
|
16
17
|
* @param type Data type
|
|
17
18
|
*/
|
|
18
19
|
export declare const GridAlignGet: (align?: GridAlign, type?: GridDataType) => GridAlign | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Grid deleted cell box style
|
|
22
|
+
* @param data Data
|
|
23
|
+
* @returns Result
|
|
24
|
+
*/
|
|
25
|
+
export declare const GridDeletedCellBoxStyle: (data: undefined | {
|
|
26
|
+
status: EntityStatus;
|
|
27
|
+
} | {
|
|
28
|
+
entityStatus: EntityStatus;
|
|
29
|
+
}) => React.CSSProperties;
|
|
19
30
|
/**
|
|
20
31
|
* Grid cell value type
|
|
21
32
|
*/
|
|
@@ -161,6 +172,10 @@ export type GridColumn<T> = {
|
|
|
161
172
|
* Cell renderer
|
|
162
173
|
*/
|
|
163
174
|
cellRenderer?: (props: GridCellRendererProps<T>) => React.ReactNode;
|
|
175
|
+
/**
|
|
176
|
+
* Cell box style
|
|
177
|
+
*/
|
|
178
|
+
cellBoxStyle?: ((data: T | undefined) => React.CSSProperties) | React.CSSProperties;
|
|
164
179
|
/**
|
|
165
180
|
* Render props
|
|
166
181
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EntityStatus } from '@etsoo/appscript';
|
|
1
2
|
import { DataTypes } from '@etsoo/shared';
|
|
2
3
|
/**
|
|
3
4
|
* Grid data type
|
|
@@ -21,3 +22,20 @@ export const GridAlignGet = (align, type) => {
|
|
|
21
22
|
}
|
|
22
23
|
return align;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Grid deleted cell box style
|
|
27
|
+
* @param data Data
|
|
28
|
+
* @returns Result
|
|
29
|
+
*/
|
|
30
|
+
export const GridDeletedCellBoxStyle = (data) => {
|
|
31
|
+
if (data == null)
|
|
32
|
+
return {};
|
|
33
|
+
const status = 'status' in data
|
|
34
|
+
? data.status
|
|
35
|
+
: 'entityStatus' in data
|
|
36
|
+
? data.entityStatus
|
|
37
|
+
: EntityStatus.Normal;
|
|
38
|
+
if (status >= EntityStatus.Inactivated)
|
|
39
|
+
return { textDecoration: 'line-through', color: 'red' };
|
|
40
|
+
return {};
|
|
41
|
+
};
|
|
@@ -33,6 +33,7 @@ export const ScrollerList = (props) => {
|
|
|
33
33
|
updateRows(rows);
|
|
34
34
|
};
|
|
35
35
|
// States
|
|
36
|
+
const batchSize = GridSizeGet(loadBatchSize, height);
|
|
36
37
|
const stateRefs = React.useRef({
|
|
37
38
|
autoLoad,
|
|
38
39
|
currentPage: 0,
|
|
@@ -41,7 +42,7 @@ export const ScrollerList = (props) => {
|
|
|
41
42
|
isNextPageLoading: false,
|
|
42
43
|
orderBy: defaultOrderBy,
|
|
43
44
|
orderByAsc: defaultOrderByAsc,
|
|
44
|
-
batchSize:
|
|
45
|
+
batchSize: batchSize,
|
|
45
46
|
selectedItems: [],
|
|
46
47
|
idCache: {}
|
|
47
48
|
});
|
|
@@ -69,7 +70,7 @@ export const ScrollerList = (props) => {
|
|
|
69
70
|
state.isMounted = true;
|
|
70
71
|
const newItems = result.length;
|
|
71
72
|
state.lastLoadedItems = newItems;
|
|
72
|
-
state.hasNextPage = newItems >=
|
|
73
|
+
state.hasNextPage = newItems >= batchSize;
|
|
73
74
|
state.isNextPageLoading = false;
|
|
74
75
|
if (pageAdd === 0) {
|
|
75
76
|
// New items
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.55",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@etsoo/appscript": "^1.3.82",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.24",
|
|
55
55
|
"@etsoo/shared": "^1.1.92",
|
|
56
|
-
"@types/react": "^18.0.
|
|
56
|
+
"@types/react": "^18.0.29",
|
|
57
57
|
"@types/react-dom": "^18.0.11",
|
|
58
58
|
"@types/react-window": "^1.8.5",
|
|
59
59
|
"react": "^18.2.0",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"jest": "^29.5.0",
|
|
74
74
|
"jest-environment-jsdom": "^29.5.0",
|
|
75
75
|
"ts-jest": "^29.0.5",
|
|
76
|
-
"typescript": "^
|
|
76
|
+
"typescript": "^5.0.2"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EntityStatus } from '@etsoo/appscript';
|
|
1
2
|
import { DataTypes } from '@etsoo/shared';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { GridLoaderStates } from './GridLoader';
|
|
@@ -32,6 +33,29 @@ export const GridAlignGet = (align?: GridAlign, type?: GridDataType) => {
|
|
|
32
33
|
return align;
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Grid deleted cell box style
|
|
38
|
+
* @param data Data
|
|
39
|
+
* @returns Result
|
|
40
|
+
*/
|
|
41
|
+
export const GridDeletedCellBoxStyle = (
|
|
42
|
+
data: undefined | { status: EntityStatus } | { entityStatus: EntityStatus }
|
|
43
|
+
): React.CSSProperties => {
|
|
44
|
+
if (data == null) return {};
|
|
45
|
+
|
|
46
|
+
const status =
|
|
47
|
+
'status' in data
|
|
48
|
+
? data.status
|
|
49
|
+
: 'entityStatus' in data
|
|
50
|
+
? data.entityStatus
|
|
51
|
+
: EntityStatus.Normal;
|
|
52
|
+
|
|
53
|
+
if (status >= EntityStatus.Inactivated)
|
|
54
|
+
return { textDecoration: 'line-through', color: 'red' };
|
|
55
|
+
|
|
56
|
+
return {};
|
|
57
|
+
};
|
|
58
|
+
|
|
35
59
|
/**
|
|
36
60
|
* Grid cell value type
|
|
37
61
|
*/
|
|
@@ -207,6 +231,13 @@ export type GridColumn<T> = {
|
|
|
207
231
|
*/
|
|
208
232
|
cellRenderer?: (props: GridCellRendererProps<T>) => React.ReactNode;
|
|
209
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Cell box style
|
|
236
|
+
*/
|
|
237
|
+
cellBoxStyle?:
|
|
238
|
+
| ((data: T | undefined) => React.CSSProperties)
|
|
239
|
+
| React.CSSProperties;
|
|
240
|
+
|
|
210
241
|
/**
|
|
211
242
|
* Render props
|
|
212
243
|
*/
|
|
@@ -154,6 +154,7 @@ export const ScrollerList = <
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
// States
|
|
157
|
+
const batchSize = GridSizeGet(loadBatchSize, height);
|
|
157
158
|
const stateRefs = React.useRef<GridLoaderStates<T>>({
|
|
158
159
|
autoLoad,
|
|
159
160
|
currentPage: 0,
|
|
@@ -162,7 +163,7 @@ export const ScrollerList = <
|
|
|
162
163
|
isNextPageLoading: false,
|
|
163
164
|
orderBy: defaultOrderBy,
|
|
164
165
|
orderByAsc: defaultOrderByAsc,
|
|
165
|
-
batchSize:
|
|
166
|
+
batchSize: batchSize,
|
|
166
167
|
selectedItems: [],
|
|
167
168
|
idCache: {}
|
|
168
169
|
});
|
|
@@ -195,7 +196,7 @@ export const ScrollerList = <
|
|
|
195
196
|
|
|
196
197
|
const newItems = result.length;
|
|
197
198
|
state.lastLoadedItems = newItems;
|
|
198
|
-
state.hasNextPage = newItems >=
|
|
199
|
+
state.hasNextPage = newItems >= batchSize;
|
|
199
200
|
state.isNextPageLoading = false;
|
|
200
201
|
|
|
201
202
|
if (pageAdd === 0) {
|