@etsoo/react 1.5.83 → 1.5.86
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/lib/components/ScrollerList.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/uses/useCombinedRefs.d.ts +1 -1
- package/lib/uses/useCombinedRefs.js +1 -1
- package/lib/uses/useSearchParamsEx.d.ts +6 -0
- package/lib/uses/useSearchParamsEx.js +16 -0
- package/package.json +7 -7
- package/src/components/ScrollerList.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/uses/useCombinedRefs.ts +1 -3
- package/src/uses/useSearchParamsEx.ts +22 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Utils } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FixedSizeList, VariableSizeList } from 'react-window';
|
|
4
|
-
import useCombinedRefs from '../uses/useCombinedRefs';
|
|
4
|
+
import { useCombinedRefs } from '../uses/useCombinedRefs';
|
|
5
5
|
import { GridSizeGet } from './GridLoader';
|
|
6
6
|
// Calculate loadBatchSize
|
|
7
7
|
const calculateBatchSize = (height, itemSize) => {
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './app/RefreshTokenRQ';
|
|
|
5
5
|
export * from './components/DnDList';
|
|
6
6
|
export * from './components/GridColumn';
|
|
7
7
|
export * from './components/GridLoader';
|
|
8
|
+
export * from './components/GridMethodRef';
|
|
8
9
|
export * from './components/HRouter';
|
|
9
10
|
export * from './components/ListItemReact';
|
|
10
11
|
export * from './components/ScrollerGrid';
|
|
@@ -20,6 +21,7 @@ export * from './uses/useCombinedRefs';
|
|
|
20
21
|
export * from './uses/useDelayedExecutor';
|
|
21
22
|
export * from './uses/useDimensions';
|
|
22
23
|
export * from './uses/useParamsEx';
|
|
24
|
+
export * from './uses/useSearchParamsEx';
|
|
23
25
|
export * from './uses/useTimeout';
|
|
24
26
|
export * from './uses/useWindowScroll';
|
|
25
27
|
export * from './uses/useWindowSize';
|
package/lib/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './app/RefreshTokenRQ';
|
|
|
7
7
|
export * from './components/DnDList';
|
|
8
8
|
export * from './components/GridColumn';
|
|
9
9
|
export * from './components/GridLoader';
|
|
10
|
+
export * from './components/GridMethodRef';
|
|
10
11
|
export * from './components/HRouter';
|
|
11
12
|
export * from './components/ListItemReact';
|
|
12
13
|
export * from './components/ScrollerGrid';
|
|
@@ -25,6 +26,7 @@ export * from './uses/useCombinedRefs';
|
|
|
25
26
|
export * from './uses/useDelayedExecutor';
|
|
26
27
|
export * from './uses/useDimensions';
|
|
27
28
|
export * from './uses/useParamsEx';
|
|
29
|
+
export * from './uses/useSearchParamsEx';
|
|
28
30
|
export * from './uses/useTimeout';
|
|
29
31
|
export * from './uses/useWindowScroll';
|
|
30
32
|
export * from './uses/useWindowSize';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DomUtils } from '@etsoo/shared';
|
|
2
|
+
import { useSearchParams } from 'react-router-dom';
|
|
3
|
+
/**
|
|
4
|
+
* Extended useSearchParams of react-router-dom
|
|
5
|
+
* Provide exact type data
|
|
6
|
+
*/
|
|
7
|
+
export function useSearchParamsEx(template) {
|
|
8
|
+
// Get parameters
|
|
9
|
+
const [sp] = useSearchParams();
|
|
10
|
+
const paras = Object.fromEntries(Object.keys(template).map((key) => {
|
|
11
|
+
const type = template[key];
|
|
12
|
+
return [key, type.endsWith('[]') ? sp.getAll(key) : sp.get(key)];
|
|
13
|
+
}));
|
|
14
|
+
// Return
|
|
15
|
+
return DomUtils.dataAs(paras, template, false);
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.86",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@dnd-kit/core": "^6.0.5",
|
|
49
49
|
"@dnd-kit/sortable": "^7.0.1",
|
|
50
50
|
"@emotion/css": "^11.10.0",
|
|
51
|
-
"@emotion/react": "^11.10.
|
|
52
|
-
"@emotion/styled": "^11.10.
|
|
51
|
+
"@emotion/react": "^11.10.4",
|
|
52
|
+
"@emotion/styled": "^11.10.4",
|
|
53
53
|
"@etsoo/appscript": "^1.2.88",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.7",
|
|
55
55
|
"@etsoo/shared": "^1.1.51",
|
|
56
|
-
"@types/react": "^18.0.
|
|
56
|
+
"@types/react": "^18.0.18",
|
|
57
57
|
"@types/react-dom": "^18.0.6",
|
|
58
58
|
"@types/react-window": "^1.8.5",
|
|
59
59
|
"react": "^18.2.0",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"@babel/runtime-corejs3": "^7.18.9",
|
|
70
70
|
"@testing-library/jest-dom": "^5.16.5",
|
|
71
71
|
"@testing-library/react": "^13.3.0",
|
|
72
|
-
"@types/jest": "^
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
74
|
-
"@typescript-eslint/parser": "^5.
|
|
72
|
+
"@types/jest": "^29.0.0",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
|
74
|
+
"@typescript-eslint/parser": "^5.36.1",
|
|
75
75
|
"eslint": "^8.23.0",
|
|
76
76
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
77
77
|
"eslint-plugin-import": "^2.26.0",
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './app/RefreshTokenRQ';
|
|
|
8
8
|
export * from './components/DnDList';
|
|
9
9
|
export * from './components/GridColumn';
|
|
10
10
|
export * from './components/GridLoader';
|
|
11
|
+
export * from './components/GridMethodRef';
|
|
11
12
|
export * from './components/HRouter';
|
|
12
13
|
export * from './components/ListItemReact';
|
|
13
14
|
export * from './components/ScrollerGrid';
|
|
@@ -29,6 +30,7 @@ export * from './uses/useCombinedRefs';
|
|
|
29
30
|
export * from './uses/useDelayedExecutor';
|
|
30
31
|
export * from './uses/useDimensions';
|
|
31
32
|
export * from './uses/useParamsEx';
|
|
33
|
+
export * from './uses/useSearchParamsEx';
|
|
32
34
|
export * from './uses/useTimeout';
|
|
33
35
|
export * from './uses/useWindowScroll';
|
|
34
36
|
export * from './uses/useWindowSize';
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
* @param refs Refs
|
|
4
4
|
* @returns Callback
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
...refs: (React.Ref<T> | undefined)[]
|
|
8
|
-
) {
|
|
6
|
+
export function useCombinedRefs<T>(...refs: (React.Ref<T> | undefined)[]) {
|
|
9
7
|
return (target: T | null) => {
|
|
10
8
|
// Ignore null reference
|
|
11
9
|
if (target == null) return;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DataTypes, DomUtils } from '@etsoo/shared';
|
|
2
|
+
import { useSearchParams } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Extended useSearchParams of react-router-dom
|
|
6
|
+
* Provide exact type data
|
|
7
|
+
*/
|
|
8
|
+
export function useSearchParamsEx<T extends DataTypes.BasicTemplate>(
|
|
9
|
+
template: T
|
|
10
|
+
) {
|
|
11
|
+
// Get parameters
|
|
12
|
+
const [sp] = useSearchParams();
|
|
13
|
+
const paras = Object.fromEntries(
|
|
14
|
+
Object.keys(template).map((key) => {
|
|
15
|
+
const type = template[key];
|
|
16
|
+
return [key, type.endsWith('[]') ? sp.getAll(key) : sp.get(key)];
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
// Return
|
|
21
|
+
return DomUtils.dataAs(paras, template, false);
|
|
22
|
+
}
|