@go-wind/admin-react 0.0.0-stage → 0.2.0

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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -2
  3. package/dist/access/access-control.d.ts +39 -0
  4. package/dist/access/field-permission.d.ts +11 -0
  5. package/dist/access/index.d.ts +4 -0
  6. package/dist/access/use-access.d.ts +50 -0
  7. package/dist/admin-react.css +2 -0
  8. package/dist/admin-react.js +36561 -0
  9. package/dist/admin-react.js.map +1 -0
  10. package/dist/auth-gateway.d.ts +54 -0
  11. package/dist/components/ListTable/ResizableHeaderCell.d.ts +31 -0
  12. package/dist/components/ListTable/TableSkeleton.d.ts +25 -0
  13. package/dist/components/ListTable/index.d.ts +20 -0
  14. package/dist/components/Loading/index.d.ts +22 -0
  15. package/dist/constants.d.ts +30 -0
  16. package/dist/env.d.ts +5 -0
  17. package/dist/hooks/useClipboard.d.ts +3 -0
  18. package/dist/hooks/useEcharts.d.ts +10 -0
  19. package/dist/hooks/useKeyStroke.d.ts +13 -0
  20. package/dist/hooks/usePageFullscreen.d.ts +9 -0
  21. package/dist/hooks/useProTableScrollY.d.ts +22 -0
  22. package/dist/hooks/useTime.d.ts +6 -0
  23. package/dist/hooks/useTitle.d.ts +1 -0
  24. package/dist/hooks/useTokenRefresh.d.ts +26 -0
  25. package/dist/hooks/useWatermark.d.ts +20 -0
  26. package/dist/i18n/components/LocaleSwitcher/index.d.ts +1 -0
  27. package/dist/i18n/components/index.d.ts +1 -0
  28. package/dist/i18n/config/i18n.d.ts +18 -0
  29. package/dist/i18n/hooks/index.d.ts +2 -0
  30. package/dist/i18n/hooks/useI18n.d.ts +96 -0
  31. package/dist/i18n/hooks/useLocaleSync.d.ts +4 -0
  32. package/dist/i18n/index.d.ts +3 -0
  33. package/dist/i18n/utils/detector.d.ts +26 -0
  34. package/dist/i18n/utils/formatter.d.ts +38 -0
  35. package/dist/i18n/utils/index.d.ts +3 -0
  36. package/dist/i18n/utils/sync.d.ts +27 -0
  37. package/dist/index.d.ts +41 -0
  38. package/dist/locales/en-US/index.d.ts +2 -0
  39. package/dist/locales/index.d.ts +10 -0
  40. package/dist/locales/zh-CN/index.d.ts +2 -0
  41. package/dist/nprogress-CwfUlis6.js +159 -0
  42. package/dist/nprogress-CwfUlis6.js.map +1 -0
  43. package/dist/preferences/components/PreferencesPanel/AppearancePanel.d.ts +3 -0
  44. package/dist/preferences/components/PreferencesPanel/GeneralPanel.d.ts +3 -0
  45. package/dist/preferences/components/PreferencesPanel/LayoutPanel.d.ts +3 -0
  46. package/dist/preferences/components/PreferencesPanel/ShortcutKeyPanel.d.ts +3 -0
  47. package/dist/preferences/components/PreferencesPanel/index.d.ts +8 -0
  48. package/dist/preferences/components/ThemeProvider/index.d.ts +9 -0
  49. package/dist/preferences/components/index.d.ts +2 -0
  50. package/dist/preferences/config/constants.d.ts +24 -0
  51. package/dist/preferences/config/darkTheme.d.ts +32 -0
  52. package/dist/preferences/config/default.d.ts +3 -0
  53. package/dist/preferences/config/index.d.ts +4 -0
  54. package/dist/preferences/config/lightTheme.d.ts +33 -0
  55. package/dist/preferences/hooks/index.d.ts +3 -0
  56. package/dist/preferences/hooks/useLocale.d.ts +23 -0
  57. package/dist/preferences/hooks/usePreferences.d.ts +31 -0
  58. package/dist/preferences/hooks/useThemeConfig.d.ts +2 -0
  59. package/dist/preferences/index.d.ts +5 -0
  60. package/dist/preferences/store/index.d.ts +24 -0
  61. package/dist/preferences/theme-transition.d.ts +17 -0
  62. package/dist/preferences/types/app.d.ts +238 -0
  63. package/dist/preferences/types/index.d.ts +4 -0
  64. package/dist/preferences/types/layout.d.ts +78 -0
  65. package/dist/preferences/types/preferences-root.d.ts +48 -0
  66. package/dist/preferences/types/theme.d.ts +29 -0
  67. package/dist/preferences/utils/diff.d.ts +7 -0
  68. package/dist/preferences/utils/merge.d.ts +9 -0
  69. package/dist/query-client.d.ts +9 -0
  70. package/dist/rolldown-runtime-BbCBk-LD.js +19 -0
  71. package/dist/router/factory.d.ts +7 -0
  72. package/dist/router/generators/generate-menus.d.ts +13 -0
  73. package/dist/router/generators/generate-routes-backend.d.ts +12 -0
  74. package/dist/router/generators/generate-routes-frontend.d.ts +17 -0
  75. package/dist/router/generators/index.d.ts +3 -0
  76. package/dist/router/index.d.ts +5 -0
  77. package/dist/router/routes-context.d.ts +8 -0
  78. package/dist/router/types/index.d.ts +207 -0
  79. package/dist/router/utils/index.d.ts +8 -0
  80. package/dist/router/utils/inject-redirect.d.ts +6 -0
  81. package/dist/router/utils/lazy.d.ts +11 -0
  82. package/dist/router/utils/loader.d.ts +14 -0
  83. package/dist/router/utils/menu.d.ts +5 -0
  84. package/dist/router/utils/merge-route-modules.d.ts +23 -0
  85. package/dist/router/utils/reset-routes.d.ts +18 -0
  86. package/dist/router/utils/sort-routes.d.ts +5 -0
  87. package/dist/router/utils/transform-meta-to-handle.d.ts +11 -0
  88. package/dist/storage/index.d.ts +2 -0
  89. package/dist/storage/storage.class.d.ts +125 -0
  90. package/dist/storage/storage.types.d.ts +199 -0
  91. package/dist/stores/auth.d.ts +56 -0
  92. package/dist/stores/index.d.ts +2 -0
  93. package/dist/stores/user.d.ts +32 -0
  94. package/dist/transport/rest/captcha-headers.d.ts +2 -0
  95. package/dist/transport/rest/index.d.ts +8 -0
  96. package/dist/transport/rest/modules/downloader.d.ts +9 -0
  97. package/dist/transport/rest/modules/interceptor.d.ts +9 -0
  98. package/dist/transport/rest/modules/uploader.d.ts +10 -0
  99. package/dist/transport/rest/pagination.d.ts +73 -0
  100. package/dist/transport/rest/preset-interceptors.d.ts +25 -0
  101. package/dist/transport/rest/request-api.d.ts +6 -0
  102. package/dist/transport/rest/request-client.d.ts +87 -0
  103. package/dist/transport/rest/types.d.ts +38 -0
  104. package/dist/transport/rest/utils.d.ts +16 -0
  105. package/dist/transport/sse/event.d.ts +44 -0
  106. package/dist/transport/sse/index.d.ts +5 -0
  107. package/dist/transport/sse/sse_client.d.ts +76 -0
  108. package/dist/transport/sse/types.d.ts +27 -0
  109. package/dist/types.d.ts +44 -0
  110. package/dist/utils/color.d.ts +27 -0
  111. package/dist/utils/date.d.ts +5 -0
  112. package/dist/utils/diff.d.ts +6 -0
  113. package/dist/utils/index.d.ts +9 -0
  114. package/dist/utils/inference.d.ts +111 -0
  115. package/dist/utils/merge.d.ts +17 -0
  116. package/dist/utils/nprogress.d.ts +11 -0
  117. package/dist/utils/tree.d.ts +27 -0
  118. package/dist/utils/url.d.ts +11 -0
  119. package/dist/utils/utils.d.ts +37 -0
  120. package/package.json +77 -3
@@ -0,0 +1,111 @@
1
+ /**
2
+ * 检查传入的值是否为函数。
3
+ *
4
+ * @param {unknown} value 要检查的值。
5
+ * @returns {boolean} 如果值是函数,返回 true,否则返回 false。
6
+ */
7
+ declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
8
+ /**
9
+ * 检查传入的值是否为对象(不包括 null 和数组)。
10
+ *
11
+ * @param {unknown} value 要检查的值。
12
+ * @returns {boolean} 如果值是对象,返回 true,否则返回 false。
13
+ */
14
+ declare function isObject(value: unknown): value is Record<string, unknown>;
15
+ /**
16
+ * 检查传入的值是否为字符串。
17
+ *
18
+ * @param {unknown} value 要检查的值。
19
+ * @returns {boolean} 如果值是字符串,返回 true,否则返回 false。
20
+ */
21
+ declare function isString(value: unknown): value is string;
22
+ /**
23
+ * 检查传入的值是否为undefined。
24
+ *
25
+ * @param {unknown} value 要检查的值。
26
+ * @returns {boolean} 如果值是undefined,返回true,否则返回false。
27
+ */
28
+ declare function isUndefined(value?: unknown): value is undefined;
29
+ /**
30
+ * 检查传入的值是否为boolean
31
+ * @param value
32
+ * @returns 如果值是布尔值,返回true,否则返回false。
33
+ */
34
+ declare function isBoolean(value: unknown): value is boolean;
35
+ /**
36
+ * 检查传入的值是否为空。
37
+ *
38
+ * 以下情况将被认为是空:
39
+ * - 值为null。
40
+ * - 值为undefined。
41
+ * - 值为一个空字符串。
42
+ * - 值为一个长度为0的数组。
43
+ * - 值为一个没有元素的Map或Set。
44
+ * - 值为一个没有属性的对象。
45
+ *
46
+ * @param {T} value 要检查的值。
47
+ * @returns {boolean} 如果值为空,返回true,否则返回false。
48
+ */
49
+ declare function isEmpty<T = unknown>(value?: T): value is T;
50
+ /**
51
+ * 检查传入的字符串是否为有效的HTTP或HTTPS URL。
52
+ *
53
+ * @param {string} url 要检查的字符串。
54
+ * @return {boolean} 如果字符串是有效的HTTP或HTTPS URL,返回true,否则返回false。
55
+ */
56
+ declare function isHttpUrl(url?: string): boolean;
57
+ /**
58
+ * 检查传入的值是否为window对象。
59
+ *
60
+ * @param {unknown} value 要检查的值。
61
+ * @returns {boolean} 如果值是window对象,返回true,否则返回false。
62
+ */
63
+ declare function isWindow(value: unknown): value is Window;
64
+ /**
65
+ * 检查当前运行环境是否为Mac OS。
66
+ *
67
+ * 这个函数通过检查navigator.userAgent字符串来判断当前运行环境。
68
+ * 如果userAgent字符串中包含"macintosh"或"mac os x"(不区分大小写),则认为当前环境是Mac OS。
69
+ *
70
+ * @returns {boolean} 如果当前环境是Mac OS,返回true,否则返回false。
71
+ */
72
+ declare function isMacOs(): boolean;
73
+ /**
74
+ * 检查当前运行环境是否为Windows OS。
75
+ *
76
+ * 这个函数通过检查navigator.userAgent字符串来判断当前运行环境。
77
+ * 如果userAgent字符串中包含"windows"或"win32"(不区分大小写),则认为当前环境是Windows OS。
78
+ *
79
+ * @returns {boolean} 如果当前环境是Windows OS,返回true,否则返回false。
80
+ */
81
+ declare function isWindowsOs(): boolean;
82
+ /**
83
+ * 检查传入的值是否为数字
84
+ * @param value
85
+ */
86
+ declare function isNumber(value: unknown): value is number;
87
+ /**
88
+ * Returns the first value in the provided list that is neither `null` nor `undefined`.
89
+ *
90
+ * This function iterates over the input values and returns the first one that is
91
+ * not strictly equal to `null` or `undefined`. If all values are either `null` or
92
+ * `undefined`, it returns `undefined`.
93
+ *
94
+ * @template T - The type of the input values.
95
+ * @param {...(T | null | undefined)[]} values - A list of values to evaluate.
96
+ * @returns {T | undefined} - The first value that is not `null` or `undefined`, or `undefined` if none are found.
97
+ *
98
+ * @example
99
+ * // Returns 42 because it is the first non-null, non-undefined value.
100
+ * getFirstNonNullOrUndefined(undefined, null, 42, 'hello'); // 42
101
+ *
102
+ * @example
103
+ * // Returns 'hello' because it is the first non-null, non-undefined value.
104
+ * getFirstNonNullOrUndefined(null, undefined, 'hello', 123); // 'hello'
105
+ *
106
+ * @example
107
+ * // Returns undefined because all values are either null or undefined.
108
+ * getFirstNonNullOrUndefined(undefined, null); // undefined
109
+ */
110
+ declare function getFirstNonNullOrUndefined<T>(...values: (null | T | undefined)[]): T | undefined;
111
+ export { getFirstNonNullOrUndefined, isBoolean, isEmpty, isFunction, isHttpUrl, isMacOs, isNumber, isObject, isString, isUndefined, isWindow, isWindowsOs, };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 深度合并对象
3
+ * @param target - 目标对象
4
+ * @param source - 源对象
5
+ * @returns 合并后的新对象
6
+ */
7
+ export declare function merge<T extends Record<string, any>, U extends Record<string, any>>(target: T, source: U): T & U;
8
+ /**
9
+ * 创建自定义合并函数
10
+ * @param customizer - 自定义处理函数
11
+ * @returns 合并函数
12
+ */
13
+ export declare function createMerge(customizer?: (obj: Record<string, any>, key: string, value: any) => boolean | void): <T extends Record<string, any>, U extends Record<string, any>>(target: T, source: U) => T & U;
14
+ /**
15
+ * 带数组覆盖功能的合并函数
16
+ */
17
+ export declare const mergeWithArrayOverride: <T extends Record<string, any>, U extends Record<string, any>>(target: T, source: U) => T & U;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 开始显示进度条。
3
+ * 此函数首先加载NProgress库,然后调用NProgress的start方法开始显示进度条。
4
+ */
5
+ declare function startProgress(): Promise<void>;
6
+ /**
7
+ * 停止显示进度条,并隐藏进度条。
8
+ * 此函数首先加载NProgress库,然后调用NProgress的done方法停止并隐藏进度条。
9
+ */
10
+ declare function stopProgress(): Promise<void>;
11
+ export { startProgress, stopProgress };
@@ -0,0 +1,27 @@
1
+ interface TreeConfigOptions {
2
+ childProps: string;
3
+ }
4
+ /**
5
+ * @zh_CN 遍历树形结构,并返回所有节点中指定的值。
6
+ * @param tree 树形结构数组
7
+ * @param getValue 获取节点值的函数
8
+ * @param options 作为子节点数组的可选属性名称。
9
+ * @returns 所有节点中指定的值的数组
10
+ */
11
+ declare function traverseTreeValues<T, V>(tree: T[], getValue: (node: T) => V, options?: TreeConfigOptions): V[];
12
+ /**
13
+ * 根据条件过滤给定树结构的节点,并以原有顺序返回所有匹配节点的数组。
14
+ * @param tree 要过滤的树结构的根节点数组。
15
+ * @param filter 用于匹配每个节点的条件。
16
+ * @param options 作为子节点数组的可选属性名称。
17
+ * @returns 包含所有匹配节点的数组。
18
+ */
19
+ declare function filterTree<T extends Record<string, any>>(tree: T[], filter: (node: T) => boolean, options?: TreeConfigOptions): T[];
20
+ /**
21
+ * 根据条件重新映射给定树结构的节
22
+ * @param tree 要过滤的树结构的根节点数组。
23
+ * @param mapper 用于map每个节点的条件。
24
+ * @param options 作为子节点数组的可选属性名称。
25
+ */
26
+ declare function mapTree<T, V extends Record<string, any>>(tree: T[], mapper: (node: T) => V, options?: TreeConfigOptions): V[];
27
+ export { filterTree, mapTree, traverseTreeValues };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 获取url中的全部参数
3
+ * @param search - url参数
4
+ */
5
+ export declare function getUrlAllParam(search: string): Record<string, string>;
6
+ /**
7
+ * 获取url中参数某个值
8
+ * @param search - url参数
9
+ * @param key - 搜索值
10
+ */
11
+ export declare function getUrlParam(search: string, key: string): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Sums the passed percentage to the R, G or B of a HEX color
3
+ * @param {string} color The color to change
4
+ * @param {number} amount The amount to change the color by
5
+ * @returns {string} The processed part of the color
6
+ */
7
+ export declare function addLight(color: string, amount: number): string;
8
+ /**
9
+ * Lightens a 6 char HEX color according to the passed percentage
10
+ * @param {string} color The color to change
11
+ * @param {number} amount The amount to change the color by
12
+ * @returns {string} The processed color represented as HEX
13
+ */
14
+ export declare function lighten(color: string, amount: number): string;
15
+ /**
16
+ * 绑定实例方法
17
+ * @param instance 实例
18
+ */
19
+ export declare function bindMethods<T extends object>(instance: T): void;
20
+ /**
21
+ * 滚动到顶部
22
+ */
23
+ export declare function scrollToTop(): void;
24
+ /**
25
+ * 滚动到底部
26
+ */
27
+ export declare function scrollToBottom(): void;
28
+ /**
29
+ * 滚动到指定元素
30
+ * @param element 目标元素
31
+ */
32
+ export declare function scrollTo(element: HTMLElement): void;
33
+ /**
34
+ * 金额格式化3000->3,000
35
+ * @param amount - 金额
36
+ */
37
+ export declare function amountFormatter(amount: number): string;
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
2
  "name": "@go-wind/admin-react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "React 19 admin shell mechanisms extracted from go-wind-admin: axios transport (token rotation/captcha headers), SSE client, auth store with injectable AuthGateway, route factory (frontend/backend access modes), access control, i18n engine, theme/preferences, query client, generic hooks & utils.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "react",
9
+ "admin",
10
+ "auth",
11
+ "router",
12
+ "i18n",
13
+ "theme",
14
+ "antd"
15
+ ],
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "module": "./dist/admin-react.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/admin-react.js"
25
+ },
26
+ "./style.css": "./dist/admin-react.css"
27
+ },
28
+ "peerDependencies": {
29
+ "@ant-design/icons": ">=5.6.0",
30
+ "@ant-design/pro-components": ">=2.8.0",
31
+ "@tanstack/react-query": ">=5.0.0",
32
+ "antd": ">=6.0.0",
33
+ "i18next": ">=25.0.0",
34
+ "react": ">=19.0.0",
35
+ "react-dom": ">=19.0.0",
36
+ "react-i18next": ">=17.0.0",
37
+ "react-router-dom": ">=6.26.0",
38
+ "zustand": ">=5.0.0"
39
+ },
40
+ "dependencies": {
41
+ "@microsoft/fetch-event-source": "^2.0.1",
42
+ "axios": "^1.16.1",
43
+ "dayjs": "^1.11.20",
44
+ "echarts": "^6.1.0",
45
+ "lodash": "^4.17.21",
46
+ "nprogress": "^0.2.0"
47
+ },
48
+ "devDependencies": {
49
+ "@ant-design/icons": "^5.6.1",
50
+ "@ant-design/pro-components": "^2.8.10",
51
+ "@tanstack/react-query": "^5.100.11",
52
+ "@testing-library/react": "^16.3.2",
53
+ "@types/lodash": "^4.17.21",
54
+ "@types/nprogress": "^0.2.3",
55
+ "@types/react": "^19.2.15",
56
+ "@types/react-dom": "^19.2.3",
57
+ "@vitejs/plugin-react": "^5.1.2",
58
+ "antd": "^6.4.3",
59
+ "i18next": "^26.2.0",
60
+ "jsdom": "^29.1.1",
61
+ "less": "^4.6.4",
62
+ "react": "^19.2.6",
63
+ "react-dom": "^19.2.6",
64
+ "react-i18next": "^17.0.8",
65
+ "react-router-dom": "^6.26.0",
66
+ "typescript": "^5.9.3",
67
+ "vite": "^8.0.0",
68
+ "vitest": "^4.1.6",
69
+ "zustand": "^5.0.13"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org/"
74
+ },
75
+ "scripts": {
76
+ "build": "vite build && tsc -p tsconfig.build.json && node ../../scripts/flatten-dts.mjs",
77
+ "typecheck": "tsc --noEmit",
78
+ "test": "vitest run"
79
+ }
6
80
  }