@etsoo/react 1.7.52 → 1.7.54
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/app/ReactUtils.d.ts +2 -2
- package/lib/uses/useRefs.d.ts +1 -1
- package/lib/uses/useRefs.js +1 -1
- package/package.json +4 -4
- package/src/app/ReactUtils.ts +2 -2
- package/src/uses/useRefs.ts +3 -3
package/lib/app/ReactUtils.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare namespace ReactUtils {
|
|
|
29
29
|
* @param data Data
|
|
30
30
|
* @param callback Callback to update refs' value, return false continue to process
|
|
31
31
|
*/
|
|
32
|
-
function updateRefs<D extends object, T = HTMLInputElement>(refs: Partial<DataTypes.DI<ReadonlyArray<keyof D & string>, React.MutableRefObject<T |
|
|
32
|
+
function updateRefs<D extends object, T = HTMLInputElement>(refs: Partial<DataTypes.DI<ReadonlyArray<keyof D & string>, React.MutableRefObject<T | null>>>, data: D, callback?: ((item: T, value: D[keyof D & string]) => void | boolean) | keyof T): void;
|
|
33
33
|
/**
|
|
34
34
|
* Update data with refs
|
|
35
35
|
* @param refs Refs
|
|
@@ -37,5 +37,5 @@ export declare namespace ReactUtils {
|
|
|
37
37
|
* @param callback Callback to return new value
|
|
38
38
|
* @param ignoreEmpty Ignore empty string or not, default true
|
|
39
39
|
*/
|
|
40
|
-
function updateRefValues<D extends object, T = HTMLInputElement>(refs: Partial<DataTypes.DI<ReadonlyArray<keyof D & string>, React.MutableRefObject<T |
|
|
40
|
+
function updateRefValues<D extends object, T = HTMLInputElement>(refs: Partial<DataTypes.DI<ReadonlyArray<keyof D & string>, React.MutableRefObject<T | null>>>, data: D, callback?: ((item: T) => any) | keyof T, ignoreEmpty?: boolean): void;
|
|
41
41
|
}
|
package/lib/uses/useRefs.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import React from 'react';
|
|
|
5
5
|
* @param fields Fields
|
|
6
6
|
* @returns Result
|
|
7
7
|
*/
|
|
8
|
-
export declare function useRefs<F extends ReadonlyArray<string>, T = HTMLInputElement>(fields: F): DataTypes.DI<F, React.MutableRefObject<T |
|
|
8
|
+
export declare function useRefs<F extends ReadonlyArray<string>, T = HTMLInputElement>(fields: F): DataTypes.DI<F, React.MutableRefObject<T | null>>;
|
package/lib/uses/useRefs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.54",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@emotion/css": "^11.11.2",
|
|
51
51
|
"@emotion/react": "^11.11.4",
|
|
52
52
|
"@emotion/styled": "^11.11.5",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
53
|
+
"@etsoo/appscript": "^1.4.96",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.42",
|
|
55
|
-
"@etsoo/shared": "^1.2.
|
|
55
|
+
"@etsoo/shared": "^1.2.41",
|
|
56
56
|
"react": "^18.3.1",
|
|
57
57
|
"react-dom": "^18.3.1",
|
|
58
58
|
"react-router-dom": "^6.23.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@types/react-window": "^1.8.8",
|
|
73
73
|
"jest": "^29.7.0",
|
|
74
74
|
"jest-environment-jsdom": "^29.7.0",
|
|
75
|
-
"ts-jest": "^29.1.
|
|
75
|
+
"ts-jest": "^29.1.4",
|
|
76
76
|
"typescript": "^5.4.5"
|
|
77
77
|
}
|
|
78
78
|
}
|
package/src/app/ReactUtils.ts
CHANGED
|
@@ -110,7 +110,7 @@ export namespace ReactUtils {
|
|
|
110
110
|
refs: Partial<
|
|
111
111
|
DataTypes.DI<
|
|
112
112
|
ReadonlyArray<keyof D & string>,
|
|
113
|
-
React.MutableRefObject<T |
|
|
113
|
+
React.MutableRefObject<T | null>
|
|
114
114
|
>
|
|
115
115
|
>,
|
|
116
116
|
data: D,
|
|
@@ -169,7 +169,7 @@ export namespace ReactUtils {
|
|
|
169
169
|
refs: Partial<
|
|
170
170
|
DataTypes.DI<
|
|
171
171
|
ReadonlyArray<keyof D & string>,
|
|
172
|
-
React.MutableRefObject<T |
|
|
172
|
+
React.MutableRefObject<T | null>
|
|
173
173
|
>
|
|
174
174
|
>,
|
|
175
175
|
data: D,
|
package/src/uses/useRefs.ts
CHANGED
|
@@ -8,8 +8,8 @@ import React from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
export function useRefs<F extends ReadonlyArray<string>, T = HTMLInputElement>(
|
|
10
10
|
fields: F
|
|
11
|
-
): DataTypes.DI<F, React.MutableRefObject<T |
|
|
12
|
-
const refs: Record<string, React.MutableRefObject<T |
|
|
13
|
-
fields.forEach((field) => (refs[field] = React.useRef<T>()));
|
|
11
|
+
): DataTypes.DI<F, React.MutableRefObject<T | null>> {
|
|
12
|
+
const refs: Record<string, React.MutableRefObject<T | null>> = {};
|
|
13
|
+
fields.forEach((field) => (refs[field] = React.useRef<T>(null)));
|
|
14
14
|
return refs as any;
|
|
15
15
|
}
|