@vtx/components 4.0.0-beta.9 → 4.0.0-beta.91

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 (190) hide show
  1. package/README.md +19 -19
  2. package/es/index.js +3 -0
  3. package/es/utils/components/LabelIconTip/index.js +7 -7
  4. package/es/utils/conversionMomentValue/index.js +25 -25
  5. package/es/utils/filterSpecialCharacters.js +6 -6
  6. package/es/utils/genCopyable/index.js +6 -6
  7. package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  8. package/es/utils/hooks/useDebounceFn/index.js +4 -4
  9. package/es/utils/hooks/useDebounceValue/index.js +6 -6
  10. package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
  11. package/es/utils/hooks/useLatest/index.js +2 -2
  12. package/es/utils/hooks/useRefCallback/index.js +5 -5
  13. package/es/utils/index.js +1 -2
  14. package/es/utils/isBrowser/index.js +7 -7
  15. package/es/utils/isUrl/index.js +4 -4
  16. package/es/utils/merge/index.js +4 -4
  17. package/es/utils/nanoid/index.js +4 -4
  18. package/es/utils/omitBoolean/index.js +4 -4
  19. package/es/utils/parseValueToMoment/index.js +4 -4
  20. package/es/utils/proFieldParsingText/index.js +10 -10
  21. package/es/utils/transformKeySubmitValue/index.js +57 -57
  22. package/es/utils/useEditableArray/index.js +46 -46
  23. package/es/utils/useEditableMap/index.js +22 -22
  24. package/es/utils/useMediaQuery/index.js +5 -5
  25. package/es/vtx-combogrid/Combogrid.js +5 -4
  26. package/es/vtx-combogrid/index.js +7 -4
  27. package/es/vtx-datagrid/Store/Provide.js +109 -140
  28. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
  29. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  30. package/es/vtx-datagrid/ToolBar/index.js +2 -1
  31. package/es/vtx-datagrid/ToolBar/style.js +6 -3
  32. package/es/vtx-datagrid/columnState.js +91 -0
  33. package/es/vtx-datagrid/index.js +134 -37
  34. package/es/vtx-datagrid/mergeComponents.js +15 -0
  35. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  36. package/es/vtx-datagrid/style/index.js +108 -18
  37. package/es/vtx-datagrid/style/index.less +242 -242
  38. package/es/vtx-date-picker/QdatePicker.js +1 -1
  39. package/es/vtx-date-picker/style/index.less +39 -39
  40. package/es/vtx-descriptions/Descriptions.js +29 -0
  41. package/es/vtx-descriptions/index.js +3 -0
  42. package/es/vtx-descriptions/style/index.js +19 -0
  43. package/es/vtx-ellipsis-text/index.js +2 -2
  44. package/es/vtx-ellipsis-text/style/index.js +3 -1
  45. package/es/vtx-export/index.js +33 -38
  46. package/es/vtx-export-async/History.js +15 -7
  47. package/es/vtx-export-async/index.js +18 -8
  48. package/es/vtx-export-async/util.js +16 -5
  49. package/es/vtx-form-layout/FormItem.js +16 -16
  50. package/es/vtx-form-layout/style/index.js +6 -4
  51. package/es/vtx-icon/index.js +54 -45
  52. package/es/vtx-icon/index.js1 +90 -0
  53. package/es/vtx-image/style/index.js +0 -1
  54. package/es/vtx-import/index.js +143 -42
  55. package/es/vtx-import/result.js +28 -26
  56. package/es/vtx-import/style/index.js +16 -1
  57. package/es/vtx-import2/Content.js +2 -1
  58. package/es/vtx-import2/index.js +29 -19
  59. package/es/vtx-import2/style/index.js +59 -8
  60. package/es/vtx-modal/index.js +11 -6
  61. package/es/vtx-modal/style/index.js +5 -2
  62. package/es/vtx-page-layout/Basic.js +2 -2
  63. package/es/vtx-page-layout/TabLayout.js +6 -6
  64. package/es/vtx-page-layout/TableLayout.js +10 -10
  65. package/es/vtx-page-layout/TreeLayout.js +6 -6
  66. package/es/vtx-page-layout/container.js +2 -2
  67. package/es/vtx-page-layout/style/index.js +4 -2
  68. package/es/vtx-provider/index.js +33 -31
  69. package/es/vtx-provider/intl.js +9 -9
  70. package/es/vtx-provider/locale/en_GB.js +1 -1
  71. package/es/vtx-provider/locale/en_US.js +58 -4
  72. package/es/vtx-provider/locale/zh_CN.js +57 -3
  73. package/es/vtx-provider/useStyle/index.js +17 -17
  74. package/es/vtx-search/index.js +30 -12
  75. package/es/vtx-search/style/index.js +6 -3
  76. package/es/vtx-select/index.js +123 -40
  77. package/es/vtx-select/style/index.js +11 -56
  78. package/es/vtx-split-pane/Resizer.js +0 -1
  79. package/es/vtx-split-pane/SplitPane.js +42 -34
  80. package/es/vtx-split-pane/style/index.js +8 -112
  81. package/es/vtx-statistics-column/style/index.js +1 -1
  82. package/es/vtx-time-picker/index.js +27 -1
  83. package/es/vtx-transfer/Transfer.js +29 -0
  84. package/es/vtx-transfer/index.js +3 -0
  85. package/es/vtx-transfer/style/index.js +19 -0
  86. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  87. package/es/vtx-transfer-select/index.js +3 -0
  88. package/es/vtx-transfer-select/style/index.js +19 -0
  89. package/es/vtx-tree/index.js +27 -9
  90. package/es/vtx-tree-select/index.js +81 -110
  91. package/es/vtx-tree-select/style/index.js +9 -3
  92. package/es/vtx-upload/FilePreview.js +2 -1
  93. package/es/vtx-wang-editor/index.js +41 -32
  94. package/es/vtx-wang-editor/style/index.less +12 -12
  95. package/lib/index.js +36 -0
  96. package/lib/utils/components/LabelIconTip/index.js +7 -7
  97. package/lib/utils/conversionMomentValue/index.js +25 -25
  98. package/lib/utils/filterSpecialCharacters.js +6 -6
  99. package/lib/utils/genCopyable/index.js +6 -6
  100. package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  101. package/lib/utils/hooks/useDebounceFn/index.js +4 -4
  102. package/lib/utils/hooks/useDebounceValue/index.js +6 -6
  103. package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
  104. package/lib/utils/hooks/useLatest/index.js +2 -2
  105. package/lib/utils/hooks/useRefCallback/index.js +5 -5
  106. package/lib/utils/index.js +0 -7
  107. package/lib/utils/isBrowser/index.js +7 -7
  108. package/lib/utils/isUrl/index.js +4 -4
  109. package/lib/utils/merge/index.js +4 -4
  110. package/lib/utils/nanoid/index.js +4 -4
  111. package/lib/utils/omitBoolean/index.js +4 -4
  112. package/lib/utils/parseValueToMoment/index.js +4 -4
  113. package/lib/utils/proFieldParsingText/index.js +10 -10
  114. package/lib/utils/transformKeySubmitValue/index.js +57 -57
  115. package/lib/utils/useEditableArray/index.js +46 -46
  116. package/lib/utils/useEditableMap/index.js +22 -22
  117. package/lib/utils/useMediaQuery/index.js +5 -5
  118. package/lib/vtx-combogrid/Combogrid.js +5 -4
  119. package/lib/vtx-combogrid/index.js +7 -4
  120. package/lib/vtx-datagrid/Store/Provide.js +112 -142
  121. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
  122. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  123. package/lib/vtx-datagrid/ToolBar/index.js +2 -1
  124. package/lib/vtx-datagrid/ToolBar/style.js +6 -3
  125. package/lib/vtx-datagrid/columnState.js +100 -0
  126. package/lib/vtx-datagrid/index.js +134 -37
  127. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  128. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  129. package/lib/vtx-datagrid/style/index.js +108 -18
  130. package/lib/vtx-datagrid/style/index.less +242 -242
  131. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  132. package/lib/vtx-date-picker/style/index.less +39 -39
  133. package/lib/vtx-descriptions/Descriptions.js +38 -0
  134. package/lib/vtx-descriptions/index.js +15 -0
  135. package/lib/vtx-descriptions/style/index.js +25 -0
  136. package/lib/vtx-ellipsis-text/index.js +2 -2
  137. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  138. package/lib/vtx-export/index.js +34 -39
  139. package/lib/vtx-export-async/History.js +14 -8
  140. package/lib/vtx-export-async/index.js +18 -8
  141. package/lib/vtx-export-async/util.js +16 -5
  142. package/lib/vtx-form-layout/FormItem.js +16 -16
  143. package/lib/vtx-form-layout/style/index.js +6 -4
  144. package/lib/vtx-icon/index.js +54 -52
  145. package/lib/vtx-icon/index.js1 +90 -0
  146. package/lib/vtx-image/style/index.js +0 -1
  147. package/lib/vtx-import/index.js +141 -43
  148. package/lib/vtx-import/result.js +29 -27
  149. package/lib/vtx-import/style/index.js +16 -1
  150. package/lib/vtx-import2/Content.js +2 -1
  151. package/lib/vtx-import2/index.js +29 -19
  152. package/lib/vtx-import2/style/index.js +59 -8
  153. package/lib/vtx-modal/index.js +11 -6
  154. package/lib/vtx-modal/style/index.js +5 -2
  155. package/lib/vtx-page-layout/Basic.js +2 -2
  156. package/lib/vtx-page-layout/TabLayout.js +6 -6
  157. package/lib/vtx-page-layout/TableLayout.js +10 -10
  158. package/lib/vtx-page-layout/TreeLayout.js +6 -6
  159. package/lib/vtx-page-layout/container.js +2 -2
  160. package/lib/vtx-page-layout/style/index.js +4 -2
  161. package/lib/vtx-provider/index.js +33 -31
  162. package/lib/vtx-provider/intl.js +9 -9
  163. package/lib/vtx-provider/locale/en_GB.js +1 -1
  164. package/lib/vtx-provider/locale/en_US.js +58 -4
  165. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  166. package/lib/vtx-provider/useStyle/index.js +17 -17
  167. package/lib/vtx-search/index.js +32 -12
  168. package/lib/vtx-search/style/index.js +6 -3
  169. package/lib/vtx-select/index.js +125 -42
  170. package/lib/vtx-select/style/index.js +11 -56
  171. package/lib/vtx-split-pane/Resizer.js +0 -1
  172. package/lib/vtx-split-pane/SplitPane.js +40 -31
  173. package/lib/vtx-split-pane/style/index.js +8 -112
  174. package/lib/vtx-statistics-column/style/index.js +1 -1
  175. package/lib/vtx-time-picker/index.js +27 -1
  176. package/lib/vtx-transfer/Transfer.js +38 -0
  177. package/lib/vtx-transfer/index.js +15 -0
  178. package/lib/vtx-transfer/style/index.js +25 -0
  179. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  180. package/lib/vtx-transfer-select/index.js +15 -0
  181. package/lib/vtx-transfer-select/style/index.js +25 -0
  182. package/lib/vtx-tree/index.js +27 -9
  183. package/lib/vtx-tree-select/index.js +81 -112
  184. package/lib/vtx-tree-select/style/index.js +9 -3
  185. package/lib/vtx-upload/FilePreview.js +2 -1
  186. package/lib/vtx-wang-editor/index.js +39 -30
  187. package/lib/vtx-wang-editor/style/index.less +12 -12
  188. package/package.json +239 -238
  189. package/es/utils/hooks/useFetchData/index.js +0 -82
  190. package/lib/utils/hooks/useFetchData/index.js +0 -89
package/package.json CHANGED
@@ -1,238 +1,239 @@
1
- {
2
- "name": "@vtx/components",
3
- "version": "4.0.0-beta.9",
4
- "description": "React components for Vortex",
5
- "keywords": [
6
- "react",
7
- "react-component"
8
- ],
9
- "files": [
10
- "dist",
11
- "lib",
12
- "es"
13
- ],
14
- "main": "lib/index.js",
15
- "scripts": {
16
- "start": "dumi dev",
17
- "compile": "father build",
18
- "build": "father build",
19
- "bootstrap": "node ./scripts/bootstrap.mjs",
20
- "changelog": "node ./scripts/changelogs.mjs",
21
- "checkPublish": "npm run sync:tnpm && node ./scripts/checkPublish.mjs && npm run sync:tnpm",
22
- "deploy": "cross-env SITE_DEPLOY='TRUE' npm run site && gh-pages -d ./dist",
23
- "dumi": "cross-env SITE_DEPLOY='TRUE' dumi build",
24
- "docs": "node ./scripts/docs.mjs",
25
- "docs:dev": "pnpm docs dev",
26
- "docs:build": "pnpm docs build",
27
- "docs:preview": "pnpm docs preview",
28
- "docs:create": "pnpm docs create",
29
- "docs:check": "pnpm docs check",
30
- "lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ && npm run tsc",
31
- "prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,yaml,json}\" --log-level warn",
32
- "createRelease": "node ./scripts/createRelease.mjs",
33
- "site": "npm run build && cross-env SITE_DEPLOY='TRUE' dumi build",
34
- "sync:tnpm": "node -e 'import(\"./scripts/syncTNPM.mjs\").then(m => m.default())'",
35
- "test": "cross-env TZ=UTC vitest run",
36
- "test:coverage": "cross-env TZ=UTC TEST_LOG=none vitest run --coverage",
37
- "test:ui": "cross-env TZ=UTC vitest --ui",
38
- "test:update": "cross-env TZ=UTC vitest -u",
39
- "tsc": "tsc --noEmit",
40
- "publish:beta": "npm publish --tag beta",
41
- "update:deps": "pnpm up --latest"
42
- },
43
- "homepage": "https://git.cloudhw.cn:3443/front-end/react-components.git",
44
- "bugs": "https://git.cloudhw.cn:3443/front-end/react-components/-/issues",
45
- "repository": {
46
- "type": "git",
47
- "url": "https://git.cloudhw.cn:3443/front-end/react-components.git"
48
- },
49
- "license": "ISC",
50
- "unpkg": "dist/vtx-components.min.js",
51
- "module": "es/index.js",
52
- "overrides": {
53
- "rimraf": "^5.0.5",
54
- "core-js": "^3.35.0",
55
- "@humanwhocodes/config-array": "^0.13.0",
56
- "source-map-resolve": "^0.6.0",
57
- "inflight": "^1.0.6",
58
- "abab": "^2.0.6",
59
- "react-easy-crop": "5.5.3"
60
- },
61
- "overridesName": "强制覆盖子依赖版本 npm (8.3+) / pnpm",
62
- "resolutions": {
63
- "rimraf": "^5.0.5",
64
- "core-js": "^3.35.0",
65
- "@humanwhocodes/config-array": "^0.13.0",
66
- "source-map-resolve": "^0.6.0",
67
- "inflight": "^1.0.6",
68
- "abab": "^2.0.6",
69
- "react-easy-crop": "5.5.3"
70
- },
71
- "resolutionsName": "强制覆盖子依赖版本 Yarn (classic/berry)",
72
- "browserslist": [
73
- "last 2 versions",
74
- "Firefox ESR",
75
- "> 1%",
76
- "ie >= 11"
77
- ],
78
- "dependencies": {
79
- "@ant-design/cssinjs": "^1.24.0",
80
- "@ctrl/tinycolor": "^4.2.0",
81
- "@dnd-kit/core": "^6.3.1",
82
- "@dnd-kit/modifiers": "^6.0.1",
83
- "@dnd-kit/sortable": "^7.0.2",
84
- "@dnd-kit/utilities": "^3.2.2",
85
- "@emotion/cache": "^11.14.0",
86
- "@emotion/css": "^11.13.5",
87
- "@emotion/serialize": "^1.3.3",
88
- "@rc-component/util": "1.3.0",
89
- "@types/react": "^18.0.0",
90
- "@vtx/utils": "^1.0.20",
91
- "@wangeditor/editor": "^5.1.23",
92
- "@wangeditor/editor-for-react": "^1.0.6",
93
- "@wangeditor/plugin-upload-attachment": "^1.1.0",
94
- "ahooks": "^3.9.6",
95
- "antd-img-crop": "4.25.0",
96
- "axios": "^1.13.2",
97
- "classnames": "^2.5.1",
98
- "dompurify": "^3.3.1",
99
- "md5": "^2.3.0",
100
- "path-to-regexp": "^6.3.0",
101
- "prop-types": "^15.8.1",
102
- "rc-color-picker": "^1.2.6",
103
- "rc-field-form": "^2.7.0",
104
- "rc-footer": "^0.6.8",
105
- "rc-resize-observer": "^1.4.3",
106
- "rc-steps": "^6.0.1",
107
- "rc-table": "^7.55.1",
108
- "react-antd-column-resize": "^1.0.3",
109
- "react-draggable": "^4.5.0",
110
- "react-layout-kit": "^1.9.2",
111
- "react-lazy-load": "^4.0.1",
112
- "react-markdown": "^8.0.7",
113
- "react-resizable": "^3.0.5",
114
- "react-resizable-panels": "^3.0.6",
115
- "react-syntax-highlighter": "^15.6.6",
116
- "safe-stable-stringify": "^2.5.0",
117
- "signature_pad": "3.0.0-beta.4",
118
- "swr": "^2.3.6",
119
- "uninstall": "^0.0.0",
120
- "use-deep-compare": "^1.3.0",
121
- "viewerjs": "1.3.3",
122
- "xgplayer": "^3.0.23"
123
- },
124
- "devDependencies": {
125
- "@ant-design/antd-theme-variable": "^1.0.0",
126
- "@ant-design/icons": "^6.0.0",
127
- "dayjs": "^1.11.18",
128
- "@babel/core": "^7.28.5",
129
- "@babel/eslint-plugin": "^7.27.1",
130
- "@babel/parser": "^7.28.5",
131
- "@babel/plugin-transform-object-rest-spread": "^7.28.6",
132
- "@babel/preset-env": "^7.28.5",
133
- "@babel/preset-react": "^7.28.5",
134
- "@babel/preset-typescript": "^7.28.5",
135
- "@babel/runtime": "^7.28.4",
136
- "@babel/traverse": "^7.28.5",
137
- "@emotion/babel-plugin": "^11.13.5",
138
- "@octokit/core": "^3.6.0",
139
- "@octokit/rest": "^18.12.0",
140
- "@testing-library/dom": "^10.4.1",
141
- "@testing-library/jest-dom": "^6.9.1",
142
- "@testing-library/react": "^16.3.0",
143
- "@testing-library/react-hooks": "^8.0.1",
144
- "@testing-library/user-event": "^14.6.1",
145
- "@types/webpack": ">=5.28.5 <6.0.0-0",
146
- "@umijs/babel-preset-umi": "^3.5.43",
147
- "@umijs/doctor": "^1.2.1",
148
- "@umijs/plugin-analytics": "^0.2.4",
149
- "@umijs/route-utils": "^4.0.3",
150
- "@umijs/test": "^3.5.43",
151
- "@umijs/test-utils": "^3.5.43",
152
- "@umijs/use-params": "^1.0.9",
153
- "@umijs/utils": "^4.5.3",
154
- "@vitejs/plugin-legacy": "^6.1.1",
155
- "@vitest/browser": "^3.2.4",
156
- "@vitest/coverage-istanbul": "^3.2.4",
157
- "@vitest/ui": "^3.2.4",
158
- "animated-scroll-to": "^2.3.2",
159
- "antd": "^6.0.0",
160
- "chalk": "^4.1.2",
161
- "copy-to-clipboard": "^3.3.3",
162
- "cross-env": "^7.0.3",
163
- "dumi": "^2.4.21",
164
- "dumi-theme-vortex-style": "^1.0.0",
165
- "esbuild": "^0.15.18",
166
- "eslint": "^8.57.1",
167
- "eslint-plugin-react": "^7.37.5",
168
- "eslint-plugin-react-hooks": "^4.6.2",
169
- "eslint-plugin-unicorn": "^47.0.0",
170
- "execa": "^5.1.1",
171
- "express": "^4.21.2",
172
- "fast-deep-equal": "^3.1.3",
173
- "father": "^4.6.7",
174
- "gh-pages": "^5.0.0",
175
- "glob": "^10.4.5",
176
- "happy-dom": "^14.12.3",
177
- "identity-obj-proxy": "^3.0.0",
178
- "inquirer": "^8.2.7",
179
- "jest-canvas-mock": "^2.5.2",
180
- "lint-staged": "^10.5.4",
181
- "lodash-es": "^4.17.21",
182
- "minimatch": "^10.0.3",
183
- "mockdate": "^3.0.5",
184
- "mockjs": "^1.1.0",
185
- "np": "^6.5.0",
186
- "nprogress": "^0.2.0",
187
- "nwsapi": "2.2.13",
188
- "octokit": "^3.2.2",
189
- "playwright": "^1.56.1",
190
- "polished": "^4.3.1",
191
- "prettier": "^3.6.2",
192
- "prettier-plugin-organize-imports": "^4.3.0",
193
- "prettier-plugin-packagejson": "^2.5.19",
194
- "pretty-quick": "^3.3.1",
195
- "query-string": "^6.14.1",
196
- "react": "^18.3.1",
197
- "react-dom": "^18.3.1",
198
- "remark": "^15.0.1",
199
- "remark-gfm": "^4.0.1",
200
- "remark-parse": "^11.0.0",
201
- "resolve-url-loader": "^5.0.0",
202
- "slash2": "^2.0.0",
203
- "style-loader": "^2.0.0",
204
- "styled-components": ">= 2",
205
- "stylelint": "^13.13.1",
206
- "timezone-mock": "^1.3.6",
207
- "ts-node": "^10.9.2",
208
- "tsx": "^4.20.6",
209
- "typescript": "^5.9.3",
210
- "umi-request": "^1.4.0",
211
- "unified": "^11.0.5",
212
- "unist-util-visit": "^5.0.0",
213
- "vite": "^6.4.1",
214
- "vitest": "^3.2.4",
215
- "webpack": ">=5.20.0 <6.0.0-0",
216
- "write-pkg": "^4.0.0",
217
- "xhr-mock": "^2.5.1",
218
- "yorkie": "^2.0.0",
219
- "zustand": "^4.5.7"
220
- },
221
- "peerDependencies": {
222
- "@ant-design/icons": "^6.0.0",
223
- "antd": "^6.0.0",
224
- "lodash-es": "^4.17.21",
225
- "react": ">=18.0.0",
226
- "react-dom": ">=18.0.0",
227
- "dayjs": "^1.11.18"
228
- },
229
- "peerDependenciesName":"声明宿主依赖",
230
- "packageManager": "pnpm@9.6.0",
231
- "publishConfig": {
232
- "access": "public"
233
- },
234
- "gitHooks": {
235
- "pre-commit": "pretty-quick --staged",
236
- "commit-msg": "fabric verify-commit"
237
- }
238
- }
1
+ {
2
+ "name": "@vtx/components",
3
+ "version": "4.0.0-beta.91",
4
+ "description": "React components for Vortex",
5
+ "keywords": [
6
+ "react",
7
+ "react-component"
8
+ ],
9
+ "files": [
10
+ "dist",
11
+ "lib",
12
+ "es"
13
+ ],
14
+ "main": "lib/index.js",
15
+ "scripts": {
16
+ "start": "dumi dev",
17
+ "compile": "father build",
18
+ "build": "father build",
19
+ "bootstrap": "node ./scripts/bootstrap.mjs",
20
+ "changelog": "node ./scripts/changelogs.mjs",
21
+ "checkPublish": "npm run sync:tnpm && node ./scripts/checkPublish.mjs && npm run sync:tnpm",
22
+ "deploy": "cross-env SITE_DEPLOY='TRUE' npm run site && gh-pages -d ./dist",
23
+ "dumi": "cross-env SITE_DEPLOY='TRUE' dumi build",
24
+ "docs": "node ./scripts/docs.mjs",
25
+ "docs:dev": "pnpm docs dev",
26
+ "docs:build": "pnpm docs build",
27
+ "docs:preview": "pnpm docs preview",
28
+ "docs:create": "pnpm docs create",
29
+ "docs:check": "pnpm docs check",
30
+ "lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ && npm run tsc",
31
+ "prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,yaml,json}\" --log-level warn",
32
+ "createRelease": "node ./scripts/createRelease.mjs",
33
+ "site": "npm run build && cross-env SITE_DEPLOY='TRUE' dumi build",
34
+ "sync:tnpm": "node -e 'import(\"./scripts/syncTNPM.mjs\").then(m => m.default())'",
35
+ "test": "cross-env TZ=UTC vitest run",
36
+ "test:coverage": "cross-env TZ=UTC TEST_LOG=none vitest run --coverage",
37
+ "test:ui": "cross-env TZ=UTC vitest --ui",
38
+ "test:update": "cross-env TZ=UTC vitest -u",
39
+ "tsc": "tsc --noEmit",
40
+ "publish:beta": "npm publish --tag beta",
41
+ "update:deps": "pnpm up --latest"
42
+ },
43
+ "homepage": "https://git.cloudhw.cn:3443/front-end/react-components.git",
44
+ "bugs": "https://git.cloudhw.cn:3443/front-end/react-components/-/issues",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://git.cloudhw.cn:3443/front-end/react-components.git"
48
+ },
49
+ "license": "ISC",
50
+ "unpkg": "dist/vtx-components.min.js",
51
+ "module": "es/index.js",
52
+ "overrides": {
53
+ "rimraf": "^5.0.5",
54
+ "core-js": "^3.35.0",
55
+ "@humanwhocodes/config-array": "^0.13.0",
56
+ "source-map-resolve": "^0.6.0",
57
+ "inflight": "^1.0.6",
58
+ "abab": "^2.0.6",
59
+ "react-easy-crop": "5.5.3"
60
+ },
61
+ "overridesName": "强制覆盖子依赖版本 npm (8.3+) / pnpm",
62
+ "resolutions": {
63
+ "rimraf": "^5.0.5",
64
+ "core-js": "^3.35.0",
65
+ "@humanwhocodes/config-array": "^0.13.0",
66
+ "source-map-resolve": "^0.6.0",
67
+ "inflight": "^1.0.6",
68
+ "abab": "^2.0.6",
69
+ "react-easy-crop": "5.5.3"
70
+ },
71
+ "resolutionsName": "强制覆盖子依赖版本 Yarn (classic/berry)",
72
+ "browserslist": [
73
+ "last 2 versions",
74
+ "Firefox ESR",
75
+ "> 1%",
76
+ "ie >= 11"
77
+ ],
78
+ "dependencies": {
79
+ "@ant-design/cssinjs": "^1.24.0",
80
+ "@ctrl/tinycolor": "^4.2.0",
81
+ "@dnd-kit/core": "^6.3.1",
82
+ "@dnd-kit/modifiers": "^6.0.1",
83
+ "@dnd-kit/sortable": "^7.0.2",
84
+ "@dnd-kit/utilities": "^3.2.2",
85
+ "@emotion/cache": "^11.14.0",
86
+ "@emotion/css": "^11.13.5",
87
+ "@emotion/serialize": "^1.3.3",
88
+ "@rc-component/util": "1.3.0",
89
+ "@types/react": "^18.0.0",
90
+ "@wangeditor/editor": "^5.1.23",
91
+ "@wangeditor/editor-for-react": "^1.0.6",
92
+ "@wangeditor/plugin-upload-attachment": "^1.1.0",
93
+ "ahooks": "^3.9.6",
94
+ "antd-img-crop": "4.25.0",
95
+ "axios": "^1.13.2",
96
+ "classnames": "^2.5.1",
97
+ "dompurify": "^3.3.1",
98
+ "md5": "^2.3.0",
99
+ "path-to-regexp": "^6.3.0",
100
+ "prop-types": "^15.8.1",
101
+ "rc-color-picker": "^1.2.6",
102
+ "rc-field-form": "^2.7.0",
103
+ "rc-footer": "^0.6.8",
104
+ "rc-resize-observer": "^1.4.3",
105
+ "rc-steps": "^6.0.1",
106
+ "rc-table": "^7.55.1",
107
+ "react-antd-column-resize": "^1.0.3",
108
+ "react-draggable": "^4.5.0",
109
+ "react-layout-kit": "^1.9.2",
110
+ "react-lazy-load": "^4.0.1",
111
+ "react-markdown": "^8.0.7",
112
+ "react-resizable": "^3.0.5",
113
+ "react-resizable-panels": "^3.0.6",
114
+ "react-syntax-highlighter": "^15.6.6",
115
+ "safe-stable-stringify": "^2.5.0",
116
+ "signature_pad": "3.0.0-beta.4",
117
+ "swr": "1.3.0",
118
+ "uninstall": "^0.0.0",
119
+ "use-deep-compare": "^1.3.0",
120
+ "viewerjs": "1.3.3",
121
+ "xgplayer": "^3.0.23"
122
+ },
123
+ "devDependencies": {
124
+ "@ant-design/antd-theme-variable": "^1.0.0",
125
+ "@ant-design/icons": "^6.0.0",
126
+ "@babel/core": "^7.28.5",
127
+ "@babel/eslint-plugin": "^7.27.1",
128
+ "@babel/parser": "^7.28.5",
129
+ "@babel/plugin-transform-object-rest-spread": "^7.28.6",
130
+ "@babel/preset-env": "^7.28.5",
131
+ "@babel/preset-react": "^7.28.5",
132
+ "@babel/preset-typescript": "^7.28.5",
133
+ "@babel/runtime": "^7.28.4",
134
+ "@babel/traverse": "^7.28.5",
135
+ "@emotion/babel-plugin": "^11.13.5",
136
+ "@octokit/core": "^3.6.0",
137
+ "@octokit/rest": "^18.12.0",
138
+ "@testing-library/dom": "^10.4.1",
139
+ "@testing-library/jest-dom": "^6.9.1",
140
+ "@testing-library/react": "^16.3.0",
141
+ "@testing-library/react-hooks": "^8.0.1",
142
+ "@testing-library/user-event": "^14.6.1",
143
+ "@types/webpack": ">=5.28.5 <6.0.0-0",
144
+ "@umijs/babel-preset-umi": "^3.5.43",
145
+ "@umijs/doctor": "^1.2.1",
146
+ "@umijs/plugin-analytics": "^0.2.4",
147
+ "@umijs/route-utils": "^4.0.3",
148
+ "@umijs/test": "^3.5.43",
149
+ "@umijs/test-utils": "^3.5.43",
150
+ "@umijs/use-params": "^1.0.9",
151
+ "@umijs/utils": "^4.5.3",
152
+ "@vitejs/plugin-legacy": "^6.1.1",
153
+ "@vitest/browser": "^3.2.4",
154
+ "@vitest/coverage-istanbul": "^3.2.4",
155
+ "@vitest/ui": "^3.2.4",
156
+ "@vtx/utils": "^1.0.25",
157
+ "animated-scroll-to": "^2.3.2",
158
+ "antd": "^6.6.4",
159
+ "chalk": "^4.1.2",
160
+ "copy-to-clipboard": "^3.3.3",
161
+ "cross-env": "^7.0.3",
162
+ "dayjs": "^1.11.18",
163
+ "dumi": "^2.4.21",
164
+ "dumi-theme-vortex-style": "^1.0.0",
165
+ "esbuild": "^0.15.18",
166
+ "eslint": "^8.57.1",
167
+ "eslint-plugin-react": "^7.37.5",
168
+ "eslint-plugin-react-hooks": "^4.6.2",
169
+ "eslint-plugin-unicorn": "^47.0.0",
170
+ "execa": "^5.1.1",
171
+ "express": "^4.21.2",
172
+ "fast-deep-equal": "^3.1.3",
173
+ "father": "^4.6.7",
174
+ "gh-pages": "^5.0.0",
175
+ "glob": "^10.4.5",
176
+ "happy-dom": "^14.12.3",
177
+ "identity-obj-proxy": "^3.0.0",
178
+ "inquirer": "^8.2.7",
179
+ "jest-canvas-mock": "^2.5.2",
180
+ "lint-staged": "^10.5.4",
181
+ "lodash-es": "^4.17.21",
182
+ "minimatch": "^10.0.3",
183
+ "mockdate": "^3.0.5",
184
+ "mockjs": "^1.1.0",
185
+ "np": "^6.5.0",
186
+ "nprogress": "^0.2.0",
187
+ "nwsapi": "2.2.13",
188
+ "octokit": "^3.2.2",
189
+ "playwright": "^1.56.1",
190
+ "polished": "^4.3.1",
191
+ "prettier": "^3.6.2",
192
+ "prettier-plugin-organize-imports": "^4.3.0",
193
+ "prettier-plugin-packagejson": "^2.5.19",
194
+ "pretty-quick": "^3.3.1",
195
+ "query-string": "^6.14.1",
196
+ "react": "^18.3.1",
197
+ "react-dom": "^18.3.1",
198
+ "remark": "^15.0.1",
199
+ "remark-gfm": "^4.0.1",
200
+ "remark-parse": "^11.0.0",
201
+ "resolve-url-loader": "^5.0.0",
202
+ "slash2": "^2.0.0",
203
+ "style-loader": "^2.0.0",
204
+ "styled-components": ">= 2",
205
+ "stylelint": "^13.13.1",
206
+ "timezone-mock": "^1.3.6",
207
+ "ts-node": "^10.9.2",
208
+ "tsx": "^4.20.6",
209
+ "typescript": "^5.9.3",
210
+ "umi-request": "^1.4.0",
211
+ "unified": "^11.0.5",
212
+ "unist-util-visit": "^5.0.0",
213
+ "vite": "^6.4.1",
214
+ "vitest": "^3.2.4",
215
+ "webpack": ">=5.20.0 <6.0.0-0",
216
+ "write-pkg": "^4.0.0",
217
+ "xhr-mock": "^2.5.1",
218
+ "yorkie": "^2.0.0",
219
+ "zustand": "^4.5.7"
220
+ },
221
+ "peerDependencies": {
222
+ "@ant-design/icons": "^6.0.0",
223
+ "@vtx/utils": "^1.0.25",
224
+ "antd": "^6.0.0",
225
+ "dayjs": "^1.11.18",
226
+ "lodash-es": "^4.17.21",
227
+ "react": "^18.3.1",
228
+ "react-dom": "^18.3.1"
229
+ },
230
+ "peerDependenciesName": "声明宿主依赖",
231
+ "packageManager": "pnpm@9.6.0",
232
+ "publishConfig": {
233
+ "access": "public"
234
+ },
235
+ "gitHooks": {
236
+ "pre-commit": "pretty-quick --staged",
237
+ "commit-msg": "fabric verify-commit"
238
+ }
239
+ }
@@ -1,82 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { useRef, useState } from 'react';
12
- import useSWR from 'swr';
13
- var testId = 0;
14
- export function useFetchData(props) {
15
- var abortRef = useRef(null);
16
- var _useState = useState(function () {
17
- if (props.proFieldKey) {
18
- return props.proFieldKey.toString();
19
- }
20
- testId += 1;
21
- return testId.toString();
22
- }),
23
- _useState2 = _slicedToArray(_useState, 1),
24
- cacheKey = _useState2[0];
25
- var proFieldKeyRef = useRef(cacheKey);
26
- var fetchData = /*#__PURE__*/function () {
27
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
28
- var _abortRef$current;
29
- var abort, response;
30
- return _regeneratorRuntime().wrap(function _callee$(_context) {
31
- while (1) switch (_context.prev = _context.next) {
32
- case 0:
33
- (_abortRef$current = abortRef.current) === null || _abortRef$current === void 0 || _abortRef$current.abort();
34
- abort = new AbortController();
35
- abortRef.current = abort;
36
- _context.prev = 3;
37
- if (props.request) {
38
- _context.next = 6;
39
- break;
40
- }
41
- return _context.abrupt("return", undefined);
42
- case 6:
43
- _context.next = 8;
44
- return props.request(props.params, abort.signal);
45
- case 8:
46
- response = _context.sent;
47
- return _context.abrupt("return", response);
48
- case 12:
49
- _context.prev = 12;
50
- _context.t0 = _context["catch"](3);
51
- if (!(_context.t0.name === 'AbortError')) {
52
- _context.next = 16;
53
- break;
54
- }
55
- return _context.abrupt("return", undefined);
56
- case 16:
57
- throw _context.t0;
58
- case 17:
59
- case "end":
60
- return _context.stop();
61
- }
62
- }, _callee, null, [[3, 12]]);
63
- }));
64
- return function fetchData() {
65
- return _ref.apply(this, arguments);
66
- };
67
- }();
68
- var _useSWR = useSWR(props.request ? [cacheKey, props.params] : null, fetchData, {
69
- revalidateOnFocus: false,
70
- shouldRetryOnError: false,
71
- onError: function onError() {
72
- // 错误处理逻辑
73
- }
74
- }),
75
- data = _useSWR.data,
76
- error = _useSWR.error,
77
- isValidating = _useSWR.isValidating;
78
- if (!props.request) {
79
- return [undefined, false];
80
- }
81
- return [data, isValidating];
82
- }