@etsoo/react 1.7.94 → 1.7.95
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/README.md +2 -1
- package/__tests__/EventWatcher.tsx +21 -21
- package/__tests__/ReactUtils.ts +4 -4
- package/__tests__/tsconfig.json +17 -17
- package/babel.config.json +8 -8
- package/lib/app/CoreConstants.js +2 -2
- package/lib/app/EventWatcher.d.ts +1 -1
- package/lib/app/EventWatcher.js +3 -5
- package/lib/app/InputDialogProps.d.ts +2 -2
- package/lib/app/ReactUtils.d.ts +2 -2
- package/lib/app/ReactUtils.js +20 -19
- package/lib/components/DnDList.d.ts +3 -3
- package/lib/components/DnDList.js +4 -4
- package/lib/components/DynamicRouter.d.ts +2 -2
- package/lib/components/DynamicRouter.js +2 -2
- package/lib/components/GridColumn.d.ts +6 -6
- package/lib/components/GridColumn.js +7 -7
- package/lib/components/GridLoader.d.ts +4 -4
- package/lib/components/GridLoader.js +2 -2
- package/lib/components/GridMethodRef.d.ts +2 -2
- package/lib/components/ListItemReact.d.ts +2 -2
- package/lib/components/ScrollRestoration.js +3 -3
- package/lib/components/ScrollerGrid.d.ts +7 -12
- package/lib/components/ScrollerGrid.js +13 -17
- package/lib/components/ScrollerList.d.ts +6 -10
- package/lib/components/ScrollerList.js +15 -14
- package/lib/custom/CustomFieldReact.d.ts +1 -1
- package/lib/index.d.ts +32 -32
- package/lib/index.js +31 -31
- package/lib/notifier/Notifier.d.ts +5 -5
- package/lib/notifier/Notifier.js +7 -7
- package/lib/states/CultureState.d.ts +3 -3
- package/lib/states/CultureState.js +3 -3
- package/lib/states/IState.d.ts +2 -2
- package/lib/states/PageState.d.ts +2 -2
- package/lib/states/PageState.js +2 -3
- package/lib/states/State.d.ts +3 -3
- package/lib/states/State.js +2 -2
- package/lib/states/UserState.d.ts +2 -2
- package/lib/states/UserState.js +5 -5
- package/lib/uses/useAsyncState.d.ts +1 -1
- package/lib/uses/useAsyncState.js +1 -1
- package/lib/uses/useCombinedRefs.js +2 -2
- package/lib/uses/useDelayedExecutor.d.ts +1 -1
- package/lib/uses/useDelayedExecutor.js +2 -2
- package/lib/uses/useDimensions.d.ts +1 -1
- package/lib/uses/useDimensions.js +3 -3
- package/lib/uses/useParamsEx.d.ts +1 -1
- package/lib/uses/useParamsEx.js +2 -2
- package/lib/uses/useRefs.d.ts +2 -2
- package/lib/uses/useRefs.js +1 -1
- package/lib/uses/useSearchParamsEx.d.ts +1 -1
- package/lib/uses/useSearchParamsEx.js +3 -3
- package/lib/uses/useTimeout.js +2 -2
- package/lib/uses/useWindowScroll.js +3 -3
- package/lib/uses/useWindowSize.js +4 -5
- package/package.json +72 -74
- package/src/app/CoreConstants.ts +8 -8
- package/src/app/EventWatcher.ts +50 -52
- package/src/app/InputDialogProps.ts +16 -16
- package/src/app/ReactUtils.ts +206 -208
- package/src/components/DnDList.tsx +268 -283
- package/src/components/DynamicRouter.tsx +35 -35
- package/src/components/GridColumn.ts +201 -201
- package/src/components/GridLoader.ts +121 -121
- package/src/components/GridMethodRef.ts +26 -26
- package/src/components/ListItemReact.ts +2 -2
- package/src/components/ScrollRestoration.tsx +24 -24
- package/src/components/ScrollerGrid.tsx +428 -448
- package/src/components/ScrollerList.tsx +320 -332
- package/src/custom/CustomFieldReact.ts +12 -12
- package/src/index.ts +35 -35
- package/src/notifier/Notifier.ts +229 -240
- package/src/states/CultureState.ts +51 -52
- package/src/states/IState.ts +19 -19
- package/src/states/PageState.ts +63 -66
- package/src/states/State.tsx +47 -51
- package/src/states/UserState.ts +98 -98
- package/src/uses/useAsyncState.ts +37 -39
- package/src/uses/useCombinedRefs.ts +16 -16
- package/src/uses/useDelayedExecutor.ts +8 -8
- package/src/uses/useDimensions.ts +102 -103
- package/src/uses/useParamsEx.ts +6 -6
- package/src/uses/useRefs.ts +6 -6
- package/src/uses/useSearchParamsEx.ts +13 -13
- package/src/uses/useTimeout.ts +17 -17
- package/src/uses/useWindowScroll.ts +43 -43
- package/src/uses/useWindowSize.ts +46 -49
- package/tsconfig.json +17 -17
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -38
- package/.prettierignore +0 -5
- package/.prettierrc +0 -6
package/package.json
CHANGED
|
@@ -1,78 +1,76 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"testMatch": [
|
|
17
|
-
"<rootDir>/__tests__/**/*.{ts,tsx}"
|
|
18
|
-
],
|
|
19
|
-
"testEnvironment": "jsdom",
|
|
20
|
-
"transform": {
|
|
21
|
-
".+\\.jsx?$": "babel-jest",
|
|
22
|
-
".+\\.tsx?$": "ts-jest"
|
|
23
|
-
},
|
|
24
|
-
"transformIgnorePatterns": [
|
|
25
|
-
"/node_modules/(?!@etsoo/).+\\.js$"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/ETSOO/AppReact.git"
|
|
31
|
-
},
|
|
32
|
-
"keywords": [
|
|
33
|
-
"React",
|
|
34
|
-
"TypeScript",
|
|
35
|
-
"ETSOO",
|
|
36
|
-
"SmartERP",
|
|
37
|
-
"司友云平台",
|
|
38
|
-
"青岛亿速思维",
|
|
39
|
-
"上海亿商"
|
|
2
|
+
"name": "@etsoo/react",
|
|
3
|
+
"version": "1.7.95",
|
|
4
|
+
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"
|
|
11
|
+
},
|
|
12
|
+
"jest": {
|
|
13
|
+
"automock": false,
|
|
14
|
+
"testMatch": [
|
|
15
|
+
"<rootDir>/__tests__/**/*.{ts,tsx}"
|
|
40
16
|
],
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://github.com/ETSOO/AppReact#readme",
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"@dnd-kit/core": "^6.1.0",
|
|
49
|
-
"@dnd-kit/sortable": "^8.0.0",
|
|
50
|
-
"@emotion/css": "^11.13.4",
|
|
51
|
-
"@emotion/react": "^11.13.3",
|
|
52
|
-
"@emotion/styled": "^11.13.0",
|
|
53
|
-
"@etsoo/appscript": "^1.5.62",
|
|
54
|
-
"@etsoo/notificationbase": "^1.1.52",
|
|
55
|
-
"@etsoo/shared": "^1.2.51",
|
|
56
|
-
"react": "^18.3.1",
|
|
57
|
-
"react-dom": "^18.3.1",
|
|
58
|
-
"react-router-dom": "^6.27.0",
|
|
59
|
-
"react-window": "^1.8.10"
|
|
17
|
+
"testEnvironment": "jsdom",
|
|
18
|
+
"transform": {
|
|
19
|
+
".+\\.jsx?$": "babel-jest",
|
|
20
|
+
".+\\.tsx?$": "ts-jest"
|
|
60
21
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
22
|
+
"transformIgnorePatterns": [
|
|
23
|
+
"/node_modules/(?!@etsoo/).+\\.js$"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/ETSOO/AppReact.git"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"React",
|
|
32
|
+
"TypeScript",
|
|
33
|
+
"ETSOO",
|
|
34
|
+
"SmartERP",
|
|
35
|
+
"司友云平台",
|
|
36
|
+
"青岛亿速思维",
|
|
37
|
+
"上海亿商"
|
|
38
|
+
],
|
|
39
|
+
"author": "ETSOO",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/ETSOO/AppReact/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/ETSOO/AppReact#readme",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@dnd-kit/core": "^6.1.0",
|
|
47
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
48
|
+
"@emotion/css": "^11.13.5",
|
|
49
|
+
"@emotion/react": "^11.13.5",
|
|
50
|
+
"@emotion/styled": "^11.13.5",
|
|
51
|
+
"@etsoo/appscript": "^1.5.63",
|
|
52
|
+
"@etsoo/notificationbase": "^1.1.53",
|
|
53
|
+
"@etsoo/shared": "^1.2.54",
|
|
54
|
+
"react": "^18.3.1",
|
|
55
|
+
"react-dom": "^18.3.1",
|
|
56
|
+
"react-router-dom": "^6.28.0",
|
|
57
|
+
"react-window": "^1.8.10"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@babel/cli": "^7.25.9",
|
|
61
|
+
"@babel/core": "^7.26.0",
|
|
62
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
63
|
+
"@babel/preset-env": "^7.26.0",
|
|
64
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
65
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
66
|
+
"@testing-library/react": "^16.0.1",
|
|
67
|
+
"@types/jest": "^29.5.14",
|
|
68
|
+
"@types/react": "^18.3.12",
|
|
69
|
+
"@types/react-dom": "^18.3.1",
|
|
70
|
+
"@types/react-window": "^1.8.8",
|
|
71
|
+
"jest": "^29.7.0",
|
|
72
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
73
|
+
"ts-jest": "^29.2.5",
|
|
74
|
+
"typescript": "^5.6.3"
|
|
75
|
+
}
|
|
78
76
|
}
|
package/src/app/CoreConstants.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Core constants
|
|
3
3
|
*/
|
|
4
4
|
export namespace CoreConstants {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* User id saved field
|
|
7
|
+
*/
|
|
8
|
+
export const FieldUserIdSaved = "UserIdSaved";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Rresh token cache field
|
|
12
|
+
*/
|
|
13
|
+
export const FieldRefreshToken = "RefreshToken";
|
|
14
14
|
}
|
package/src/app/EventWatcher.ts
CHANGED
|
@@ -1,64 +1,62 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Event watcher action
|
|
5
5
|
*/
|
|
6
6
|
export interface EventWatcherAction {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Event type
|
|
9
|
+
*/
|
|
10
|
+
type?: string | string[];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Once action or not
|
|
14
|
+
*/
|
|
15
|
+
once?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Action
|
|
19
|
+
*/
|
|
20
|
+
action: (event: React.BaseSyntheticEvent | string) => any;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Event watcher
|
|
25
25
|
*/
|
|
26
26
|
export class EventWatcher {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return action.type.includes(type);
|
|
63
|
-
}
|
|
27
|
+
private actions: EventWatcherAction[] = [];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Add action
|
|
31
|
+
* @param action Action
|
|
32
|
+
*/
|
|
33
|
+
add(action: EventWatcherAction) {
|
|
34
|
+
this.actions.push(action);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Do the event
|
|
39
|
+
* @param event Event
|
|
40
|
+
*/
|
|
41
|
+
do(event: React.BaseSyntheticEvent | string) {
|
|
42
|
+
// Type
|
|
43
|
+
const type = typeof event === "string" ? event : event.type;
|
|
44
|
+
|
|
45
|
+
// Execute
|
|
46
|
+
const removeIndices: number[] = [];
|
|
47
|
+
this.actions.forEach((item, index) => {
|
|
48
|
+
if (!this.isMatch(item, type)) return;
|
|
49
|
+
item.action(event);
|
|
50
|
+
if (item.once) removeIndices.push(index);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Remove all once actions
|
|
54
|
+
removeIndices.reverse().forEach((index) => this.actions.splice(index, 1));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private isMatch(action: EventWatcherAction, type: string) {
|
|
58
|
+
if (action.type == null) return true;
|
|
59
|
+
if (typeof action.type === "string") return action.type === type;
|
|
60
|
+
return action.type.includes(type);
|
|
61
|
+
}
|
|
64
62
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from
|
|
5
|
-
import { NotificationReactCallProps } from
|
|
2
|
+
NotificationContent,
|
|
3
|
+
NotificationReturn
|
|
4
|
+
} from "@etsoo/notificationbase";
|
|
5
|
+
import { NotificationReactCallProps } from "../notifier/Notifier";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Input dialog props
|
|
9
9
|
*/
|
|
10
10
|
export type InputDialogProps = NotificationReactCallProps & {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Title
|
|
13
|
+
*/
|
|
14
|
+
title: NotificationContent<React.ReactNode>;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Message
|
|
18
|
+
*/
|
|
19
|
+
message: NotificationContent<React.ReactNode>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Callback
|
|
23
|
+
*/
|
|
24
|
+
callback: NotificationReturn<HTMLFormElement | undefined>;
|
|
25
25
|
};
|