@etsoo/react 1.7.93 → 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.
Files changed (93) hide show
  1. package/README.md +2 -1
  2. package/__tests__/EventWatcher.tsx +21 -21
  3. package/__tests__/ReactUtils.ts +4 -4
  4. package/__tests__/tsconfig.json +17 -17
  5. package/babel.config.json +8 -8
  6. package/lib/app/CoreConstants.js +2 -2
  7. package/lib/app/EventWatcher.d.ts +1 -1
  8. package/lib/app/EventWatcher.js +3 -5
  9. package/lib/app/InputDialogProps.d.ts +2 -2
  10. package/lib/app/ReactUtils.d.ts +2 -2
  11. package/lib/app/ReactUtils.js +20 -19
  12. package/lib/components/DnDList.d.ts +3 -3
  13. package/lib/components/DnDList.js +4 -4
  14. package/lib/components/DynamicRouter.d.ts +9 -1
  15. package/lib/components/DynamicRouter.js +18 -2
  16. package/lib/components/GridColumn.d.ts +6 -6
  17. package/lib/components/GridColumn.js +7 -7
  18. package/lib/components/GridLoader.d.ts +4 -4
  19. package/lib/components/GridLoader.js +2 -2
  20. package/lib/components/GridMethodRef.d.ts +2 -2
  21. package/lib/components/ListItemReact.d.ts +2 -2
  22. package/lib/components/ScrollRestoration.js +3 -3
  23. package/lib/components/ScrollerGrid.d.ts +7 -12
  24. package/lib/components/ScrollerGrid.js +13 -17
  25. package/lib/components/ScrollerList.d.ts +6 -10
  26. package/lib/components/ScrollerList.js +15 -14
  27. package/lib/custom/CustomFieldReact.d.ts +1 -1
  28. package/lib/index.d.ts +32 -32
  29. package/lib/index.js +31 -31
  30. package/lib/notifier/Notifier.d.ts +5 -5
  31. package/lib/notifier/Notifier.js +7 -7
  32. package/lib/states/CultureState.d.ts +3 -3
  33. package/lib/states/CultureState.js +3 -3
  34. package/lib/states/IState.d.ts +2 -2
  35. package/lib/states/PageState.d.ts +2 -2
  36. package/lib/states/PageState.js +2 -3
  37. package/lib/states/State.d.ts +3 -3
  38. package/lib/states/State.js +2 -2
  39. package/lib/states/UserState.d.ts +2 -2
  40. package/lib/states/UserState.js +5 -5
  41. package/lib/uses/useAsyncState.d.ts +1 -1
  42. package/lib/uses/useAsyncState.js +1 -1
  43. package/lib/uses/useCombinedRefs.js +2 -2
  44. package/lib/uses/useDelayedExecutor.d.ts +1 -1
  45. package/lib/uses/useDelayedExecutor.js +2 -2
  46. package/lib/uses/useDimensions.d.ts +1 -1
  47. package/lib/uses/useDimensions.js +3 -3
  48. package/lib/uses/useParamsEx.d.ts +1 -1
  49. package/lib/uses/useParamsEx.js +2 -2
  50. package/lib/uses/useRefs.d.ts +2 -2
  51. package/lib/uses/useRefs.js +1 -1
  52. package/lib/uses/useSearchParamsEx.d.ts +1 -1
  53. package/lib/uses/useSearchParamsEx.js +3 -3
  54. package/lib/uses/useTimeout.js +2 -2
  55. package/lib/uses/useWindowScroll.js +3 -3
  56. package/lib/uses/useWindowSize.js +4 -5
  57. package/package.json +72 -74
  58. package/src/app/CoreConstants.ts +8 -8
  59. package/src/app/EventWatcher.ts +50 -52
  60. package/src/app/InputDialogProps.ts +16 -16
  61. package/src/app/ReactUtils.ts +206 -208
  62. package/src/components/DnDList.tsx +268 -283
  63. package/src/components/DynamicRouter.tsx +46 -21
  64. package/src/components/GridColumn.ts +201 -201
  65. package/src/components/GridLoader.ts +121 -121
  66. package/src/components/GridMethodRef.ts +26 -26
  67. package/src/components/ListItemReact.ts +2 -2
  68. package/src/components/ScrollRestoration.tsx +24 -24
  69. package/src/components/ScrollerGrid.tsx +428 -448
  70. package/src/components/ScrollerList.tsx +320 -332
  71. package/src/custom/CustomFieldReact.ts +12 -12
  72. package/src/index.ts +35 -35
  73. package/src/notifier/Notifier.ts +229 -240
  74. package/src/states/CultureState.ts +51 -52
  75. package/src/states/IState.ts +19 -19
  76. package/src/states/PageState.ts +63 -66
  77. package/src/states/State.tsx +47 -51
  78. package/src/states/UserState.ts +98 -98
  79. package/src/uses/useAsyncState.ts +37 -39
  80. package/src/uses/useCombinedRefs.ts +16 -16
  81. package/src/uses/useDelayedExecutor.ts +8 -8
  82. package/src/uses/useDimensions.ts +102 -103
  83. package/src/uses/useParamsEx.ts +6 -6
  84. package/src/uses/useRefs.ts +6 -6
  85. package/src/uses/useSearchParamsEx.ts +13 -13
  86. package/src/uses/useTimeout.ts +17 -17
  87. package/src/uses/useWindowScroll.ts +43 -43
  88. package/src/uses/useWindowSize.ts +46 -49
  89. package/tsconfig.json +17 -17
  90. package/.eslintignore +0 -3
  91. package/.eslintrc.json +0 -38
  92. package/.prettierignore +0 -5
  93. package/.prettierrc +0 -6
package/package.json CHANGED
@@ -1,78 +1,76 @@
1
1
  {
2
- "name": "@etsoo/react",
3
- "version": "1.7.93",
4
- "description": "TypeScript ReactJs UI Independent Framework",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "scripts": {
8
- "build": "tsc",
9
- "format": "prettier --write src/**/*.{ts,tsx}",
10
- "lint": "eslint --ext .ts,.tsx src/",
11
- "test": "jest",
12
- "test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"
13
- },
14
- "jest": {
15
- "automock": false,
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
- "author": "ETSOO",
42
- "license": "MIT",
43
- "bugs": {
44
- "url": "https://github.com/ETSOO/AppReact/issues"
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
- "devDependencies": {
62
- "@babel/cli": "^7.25.9",
63
- "@babel/core": "^7.25.9",
64
- "@babel/plugin-transform-runtime": "^7.25.9",
65
- "@babel/preset-env": "^7.25.9",
66
- "@babel/runtime-corejs3": "^7.25.9",
67
- "@testing-library/jest-dom": "^6.6.2",
68
- "@testing-library/react": "^16.0.1",
69
- "@types/jest": "^29.5.14",
70
- "@types/react": "^18.3.12",
71
- "@types/react-dom": "^18.3.1",
72
- "@types/react-window": "^1.8.8",
73
- "jest": "^29.7.0",
74
- "jest-environment-jsdom": "^29.7.0",
75
- "ts-jest": "^29.2.5",
76
- "typescript": "^5.6.3"
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
  }
@@ -2,13 +2,13 @@
2
2
  * Core constants
3
3
  */
4
4
  export namespace CoreConstants {
5
- /**
6
- * User id saved field
7
- */
8
- export const FieldUserIdSaved = 'UserIdSaved';
5
+ /**
6
+ * User id saved field
7
+ */
8
+ export const FieldUserIdSaved = "UserIdSaved";
9
9
 
10
- /**
11
- * Rresh token cache field
12
- */
13
- export const FieldRefreshToken = 'RefreshToken';
10
+ /**
11
+ * Rresh token cache field
12
+ */
13
+ export const FieldRefreshToken = "RefreshToken";
14
14
  }
@@ -1,64 +1,62 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
 
3
3
  /**
4
4
  * Event watcher action
5
5
  */
6
6
  export interface EventWatcherAction {
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;
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
- 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
55
- .reverse()
56
- .forEach((index) => this.actions.splice(index, 1));
57
- }
58
-
59
- private isMatch(action: EventWatcherAction, type: string) {
60
- if (action.type == null) return true;
61
- if (typeof action.type === 'string') return action.type === type;
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
- NotificationContent,
3
- NotificationReturn
4
- } from '@etsoo/notificationbase';
5
- import { NotificationReactCallProps } from '../notifier/Notifier';
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
- * Title
13
- */
14
- title: NotificationContent<React.ReactNode>;
11
+ /**
12
+ * Title
13
+ */
14
+ title: NotificationContent<React.ReactNode>;
15
15
 
16
- /**
17
- * Message
18
- */
19
- message: NotificationContent<React.ReactNode>;
16
+ /**
17
+ * Message
18
+ */
19
+ message: NotificationContent<React.ReactNode>;
20
20
 
21
- /**
22
- * Callback
23
- */
24
- callback: NotificationReturn<HTMLFormElement | undefined>;
21
+ /**
22
+ * Callback
23
+ */
24
+ callback: NotificationReturn<HTMLFormElement | undefined>;
25
25
  };