vap1 0.0.1

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 (441) hide show
  1. package/basetype.d.ts +62 -0
  2. package/basetype.js +2 -0
  3. package/components/Box/Box.d.ts +118 -0
  4. package/components/Box/Box.js +150 -0
  5. package/components/Box/SelectBar.d.ts +90 -0
  6. package/components/Box/SelectBar.js +93 -0
  7. package/components/Box/_register.d.ts +49 -0
  8. package/components/Box/_register.js +29 -0
  9. package/components/Box/index.d.ts +9 -0
  10. package/components/Box/index.js +6 -0
  11. package/components/Lists/SList.d.ts +58 -0
  12. package/components/Lists/SList.js +167 -0
  13. package/components/SearchBar/ActionButtons.d.ts +49 -0
  14. package/components/SearchBar/ActionButtons.js +96 -0
  15. package/components/SearchBar/ByField.d.ts +3 -0
  16. package/components/SearchBar/ByField.js +193 -0
  17. package/components/SearchBar/ByKeyword.d.ts +3 -0
  18. package/components/SearchBar/ByKeyword.js +34 -0
  19. package/components/SearchBar/SearchField.d.ts +15 -0
  20. package/components/SearchBar/SearchField.js +25 -0
  21. package/components/SearchBar/SearchTags.d.ts +2 -0
  22. package/components/SearchBar/SearchTags.js +18 -0
  23. package/components/SearchBar/_FieldType.d.ts +8 -0
  24. package/components/SearchBar/_FieldType.js +45 -0
  25. package/components/SearchBar/_register.d.ts +65 -0
  26. package/components/SearchBar/_register.js +29 -0
  27. package/components/SearchBar/index.d.ts +134 -0
  28. package/components/SearchBar/index.js +33 -0
  29. package/components/Tables/ApiTable.d.ts +18 -0
  30. package/components/Tables/ApiTable.js +48 -0
  31. package/components/Tables/ApiTableModal.d.ts +22 -0
  32. package/components/Tables/ApiTableModal.js +73 -0
  33. package/components/Tables/Components/ActionBar.d.ts +56 -0
  34. package/components/Tables/Components/ActionBar.js +100 -0
  35. package/components/Tables/Components/Actions.d.ts +47 -0
  36. package/components/Tables/Components/Actions.js +91 -0
  37. package/components/Tables/Components/Summary.d.ts +11 -0
  38. package/components/Tables/Components/Summary.js +11 -0
  39. package/components/Tables/Components/index.d.ts +17 -0
  40. package/components/Tables/Components/index.js +19 -0
  41. package/components/Tables/STable.d.ts +5 -0
  42. package/components/Tables/STable.js +37 -0
  43. package/components/Tables/TopTable.d.ts +24 -0
  44. package/components/Tables/TopTable.js +157 -0
  45. package/components/Tables/TopTableModal.d.ts +5 -0
  46. package/components/Tables/TopTableModal.js +20 -0
  47. package/components/Tables/Util.d.ts +3 -0
  48. package/components/Tables/Util.js +41 -0
  49. package/components/Tables/VTable.d.ts +11 -0
  50. package/components/Tables/VTable.js +237 -0
  51. package/components/Tables/index.d.ts +81 -0
  52. package/components/Tables/index.js +20 -0
  53. package/components/TreeSelect/BaseTreeSelect.d.ts +33 -0
  54. package/components/TreeSelect/BaseTreeSelect.js +190 -0
  55. package/components/TreeSelect/DTreeSelect.d.ts +24 -0
  56. package/components/TreeSelect/DTreeSelect.js +66 -0
  57. package/components/TreeSelect/FTreeSelect.d.ts +11 -0
  58. package/components/TreeSelect/FTreeSelect.js +39 -0
  59. package/components/TreeSelect/STreeSelect.d.ts +14 -0
  60. package/components/TreeSelect/STreeSelect.js +52 -0
  61. package/components/TreeSelect/index.d.ts +94 -0
  62. package/components/TreeSelect/index.js +9 -0
  63. package/components/Trees/ActionTree.d.ts +54 -0
  64. package/components/Trees/ActionTree.js +657 -0
  65. package/components/Trees/BaseTree.d.ts +31 -0
  66. package/components/Trees/BaseTree.js +185 -0
  67. package/components/Trees/DTree.d.ts +48 -0
  68. package/components/Trees/DTree.js +142 -0
  69. package/components/Trees/FTree.d.ts +33 -0
  70. package/components/Trees/FTree.js +79 -0
  71. package/components/Trees/STree.d.ts +21 -0
  72. package/components/Trees/STree.js +92 -0
  73. package/components/Trees/index.d.ts +134 -0
  74. package/components/Trees/index.js +9 -0
  75. package/components/UForm/FormWrapper.d.ts +22 -0
  76. package/components/UForm/FormWrapper.js +270 -0
  77. package/components/UForm/UDescriptions.d.ts +5 -0
  78. package/components/UForm/UDescriptions.js +134 -0
  79. package/components/UForm/UForm.d.ts +33 -0
  80. package/components/UForm/UForm.js +484 -0
  81. package/components/UForm/UFormModal.d.ts +3 -0
  82. package/components/UForm/UFormModal.js +149 -0
  83. package/components/UForm/UInfo.d.ts +10 -0
  84. package/components/UForm/UInfo.js +75 -0
  85. package/components/UForm/UInfoModal.d.ts +3 -0
  86. package/components/UForm/UInfoModal.js +50 -0
  87. package/components/UForm/UModal.d.ts +3 -0
  88. package/components/UForm/UModal.js +24 -0
  89. package/components/UForm/_FieldType.d.ts +8 -0
  90. package/components/UForm/_FieldType.js +100 -0
  91. package/components/UForm/_FormUtils.d.ts +5 -0
  92. package/components/UForm/_FormUtils.js +75 -0
  93. package/components/UForm/_input.d.ts +59 -0
  94. package/components/UForm/_input.js +147 -0
  95. package/components/UForm/_register.d.ts +87 -0
  96. package/components/UForm/_register.js +44 -0
  97. package/components/UForm/index.d.ts +387 -0
  98. package/components/UForm/index.js +15 -0
  99. package/components/Upload/UploadFile.d.ts +3 -0
  100. package/components/Upload/UploadFile.js +40 -0
  101. package/components/Upload/UploadImage.d.ts +24 -0
  102. package/components/Upload/UploadImage.js +93 -0
  103. package/components/Upload/UploadModal.d.ts +50 -0
  104. package/components/Upload/UploadModal.js +140 -0
  105. package/components/Upload/index.d.ts +77 -0
  106. package/components/Upload/index.js +9 -0
  107. package/components/Upload/useUpload.d.ts +15 -0
  108. package/components/Upload/useUpload.js +93 -0
  109. package/components/_RegisterUtil.d.ts +1 -0
  110. package/components/_RegisterUtil.js +25 -0
  111. package/components/_adapt/Alert.d.ts +11 -0
  112. package/components/_adapt/Alert.js +43 -0
  113. package/components/_adapt/Button.d.ts +20 -0
  114. package/components/_adapt/Button.js +26 -0
  115. package/components/_adapt/Col.d.ts +53 -0
  116. package/components/_adapt/Col.js +90 -0
  117. package/components/_adapt/Collapse.d.ts +30 -0
  118. package/components/_adapt/Collapse.js +33 -0
  119. package/components/_adapt/Drawer.d.ts +12 -0
  120. package/components/_adapt/Drawer.js +11 -0
  121. package/components/_adapt/Dropdown.d.ts +15 -0
  122. package/components/_adapt/Dropdown.js +38 -0
  123. package/components/_adapt/Icon.d.ts +14 -0
  124. package/components/_adapt/Icon.js +34 -0
  125. package/components/_adapt/Image.d.ts +4 -0
  126. package/components/_adapt/Image.js +11 -0
  127. package/components/_adapt/Menu.d.ts +32 -0
  128. package/components/_adapt/Menu.js +25 -0
  129. package/components/_adapt/Modal.d.ts +23 -0
  130. package/components/_adapt/Modal.js +69 -0
  131. package/components/_adapt/Popconfirm.d.ts +5 -0
  132. package/components/_adapt/Popconfirm.js +34 -0
  133. package/components/_adapt/Popover.d.ts +5 -0
  134. package/components/_adapt/Popover.js +34 -0
  135. package/components/_adapt/Progress.d.ts +14 -0
  136. package/components/_adapt/Progress.js +56 -0
  137. package/components/_adapt/Row.d.ts +10 -0
  138. package/components/_adapt/Row.js +23 -0
  139. package/components/_adapt/Select.d.ts +14 -0
  140. package/components/_adapt/Select.js +47 -0
  141. package/components/_adapt/Tag.d.ts +7 -0
  142. package/components/_adapt/Tag.js +12 -0
  143. package/components/_adapt/Tooltip.d.ts +5 -0
  144. package/components/_adapt/Tooltip.js +11 -0
  145. package/components/_adapt/todo/ColorPicker.d.ts +3 -0
  146. package/components/_adapt/todo/ColorPicker.js +42 -0
  147. package/components/_adapt/todo/FloatButton.d.ts +2 -0
  148. package/components/_adapt/todo/FloatButton.js +6 -0
  149. package/components/_adapt/todo/Image.d.ts +2 -0
  150. package/components/_adapt/todo/Image.js +6 -0
  151. package/components/_adapt/todo/Segmented.d.ts +2 -0
  152. package/components/_adapt/todo/Segmented.js +6 -0
  153. package/components/_adapt/todo/Space.d.ts +2 -0
  154. package/components/_adapt/todo/Space.js +6 -0
  155. package/components/_adapt/utils.d.ts +12 -0
  156. package/components/_adapt/utils.js +93 -0
  157. package/components/_common/AutoComplete.d.ts +32 -0
  158. package/components/_common/AutoComplete.js +87 -0
  159. package/components/_common/CountUp.d.ts +38 -0
  160. package/components/_common/CountUp.js +60 -0
  161. package/components/_common/DateRange.d.ts +52 -0
  162. package/components/_common/DateRange.js +108 -0
  163. package/components/_common/HighLight.d.ts +15 -0
  164. package/components/_common/HighLight.js +37 -0
  165. package/components/_common/I18N.d.ts +7 -0
  166. package/components/_common/I18N.js +6 -0
  167. package/components/_common/Loading.d.ts +9 -0
  168. package/components/_common/Loading.js +52 -0
  169. package/components/_common/MonthRange.d.ts +46 -0
  170. package/components/_common/MonthRange.js +130 -0
  171. package/components/_common/PromiseLabel.d.ts +11 -0
  172. package/components/_common/PromiseLabel.js +34 -0
  173. package/components/_common/Role.d.ts +5 -0
  174. package/components/_common/Role.js +11 -0
  175. package/components/_common/Upagination.d.ts +21 -0
  176. package/components/_common/Upagination.js +106 -0
  177. package/components/_setup/Const.d.ts +205 -0
  178. package/components/_setup/Const.js +112 -0
  179. package/components/_setup/I18N/enUS.d.ts +1 -0
  180. package/components/_setup/I18N/enUS.js +106 -0
  181. package/components/_setup/I18N/index.d.ts +3 -0
  182. package/components/_setup/I18N/index.js +5 -0
  183. package/components/_setup/I18N/zhCN.d.ts +3 -0
  184. package/components/_setup/I18N/zhCN.js +109 -0
  185. package/components/_setup/I18N/zhHK.d.ts +1 -0
  186. package/components/_setup/I18N/zhHK.js +107 -0
  187. package/components/_setup/ICON/IconTypes.d.ts +1 -0
  188. package/components/_setup/ICON/IconTypes.js +10 -0
  189. package/components/_setup/SearchField/SearchFieldAdvance.d.ts +1 -0
  190. package/components/_setup/SearchField/SearchFieldAdvance.js +57 -0
  191. package/components/_setup/SearchField/SearchFieldDate.d.ts +1 -0
  192. package/components/_setup/SearchField/SearchFieldDate.js +186 -0
  193. package/components/_setup/SearchField/SearchFieldInput.d.ts +3 -0
  194. package/components/_setup/SearchField/SearchFieldInput.js +20 -0
  195. package/components/_setup/SearchField/SearchFieldSelect.d.ts +1 -0
  196. package/components/_setup/SearchField/SearchFieldSelect.js +106 -0
  197. package/components/_setup/SearchField/SearchFieldTree.d.ts +1 -0
  198. package/components/_setup/SearchField/SearchFieldTree.js +191 -0
  199. package/components/_setup/SelectBar/SelectList.d.ts +1 -0
  200. package/components/_setup/SelectBar/SelectList.js +21 -0
  201. package/components/_setup/SelectBar/SelectTree.d.ts +1 -0
  202. package/components/_setup/SelectBar/SelectTree.js +11 -0
  203. package/components/_setup/UForm/UFormAdvanceInput.d.ts +1 -0
  204. package/components/_setup/UForm/UFormAdvanceInput.js +300 -0
  205. package/components/_setup/UForm/UFormAdvanceSelect.d.ts +0 -0
  206. package/components/_setup/UForm/UFormAdvanceSelect.js +26 -0
  207. package/components/_setup/UForm/UFormCrontab.d.ts +1 -0
  208. package/components/_setup/UForm/UFormCrontab.js +199 -0
  209. package/components/_setup/UForm/UFormDate.d.ts +1 -0
  210. package/components/_setup/UForm/UFormDate.js +313 -0
  211. package/components/_setup/UForm/UFormInput.d.ts +1 -0
  212. package/components/_setup/UForm/UFormInput.js +159 -0
  213. package/components/_setup/UForm/UFormJSON.d.ts +1 -0
  214. package/components/_setup/UForm/UFormJSON.js +219 -0
  215. package/components/_setup/UForm/UFormOrg.d.ts +1 -0
  216. package/components/_setup/UForm/UFormOrg.js +121 -0
  217. package/components/_setup/UForm/UFormRole.d.ts +1 -0
  218. package/components/_setup/UForm/UFormRole.js +47 -0
  219. package/components/_setup/UForm/UFormSearch.d.ts +0 -0
  220. package/components/_setup/UForm/UFormSearch.js +35 -0
  221. package/components/_setup/UForm/UFormSelect.d.ts +1 -0
  222. package/components/_setup/UForm/UFormSelect.js +179 -0
  223. package/components/_setup/UForm/UFormTree.d.ts +0 -0
  224. package/components/_setup/UForm/UFormTree.js +134 -0
  225. package/components/_setup/UForm/UFormUpload.d.ts +1 -0
  226. package/components/_setup/UForm/UFormUpload.js +173 -0
  227. package/components/_setup/UForm/_utils.d.ts +11 -0
  228. package/components/_setup/UForm/_utils.js +41 -0
  229. package/components/_setup/index.d.ts +21 -0
  230. package/components/_setup/index.js +25 -0
  231. package/components/index.d.ts +7 -0
  232. package/components/index.js +16 -0
  233. package/deps/JsonView.d.ts +6 -0
  234. package/deps/JsonView.js +57 -0
  235. package/deps/SpringBoot.d.ts +4 -0
  236. package/deps/SpringBoot.js +18 -0
  237. package/deps/SpringCloud.d.ts +14 -0
  238. package/deps/SpringCloud.js +29 -0
  239. package/deps/_editor/advance/_Audio.d.ts +0 -0
  240. package/deps/_editor/advance/_Audio.js +1 -0
  241. package/deps/_editor/advance/_Image.d.ts +2 -0
  242. package/deps/_editor/advance/_Image.js +89 -0
  243. package/deps/_editor/advance/_Table.d.ts +0 -0
  244. package/deps/_editor/advance/_Table.js +1 -0
  245. package/deps/_editor/advance/_Video.d.ts +0 -0
  246. package/deps/_editor/advance/_Video.js +1 -0
  247. package/deps/_editor/base/Element.d.ts +5 -0
  248. package/deps/_editor/base/Element.js +43 -0
  249. package/deps/_editor/base/Leaf.d.ts +3 -0
  250. package/deps/_editor/base/Leaf.js +36 -0
  251. package/deps/_editor/base/Support.d.ts +2 -0
  252. package/deps/_editor/base/Support.js +78 -0
  253. package/deps/_editor/base/types.d.ts +156 -0
  254. package/deps/_editor/base/types.js +10 -0
  255. package/deps/_editor/i18n.d.ts +1 -0
  256. package/deps/_editor/i18n.js +31 -0
  257. package/deps/_editor/tools/Button.d.ts +6 -0
  258. package/deps/_editor/tools/Button.js +86 -0
  259. package/deps/_editor/tools/ToolBar.d.ts +8 -0
  260. package/deps/_editor/tools/ToolBar.js +10 -0
  261. package/deps/_editor/tools/_BlockButton.d.ts +4 -0
  262. package/deps/_editor/tools/_BlockButton.js +77 -0
  263. package/deps/_editor/tools/_InsertButton.d.ts +6 -0
  264. package/deps/_editor/tools/_InsertButton.js +65 -0
  265. package/deps/_editor/tools/_MarkButton.d.ts +6 -0
  266. package/deps/_editor/tools/_MarkButton.js +45 -0
  267. package/deps/_editor/tools/_TxtButton.d.ts +7 -0
  268. package/deps/_editor/tools/_TxtButton.js +187 -0
  269. package/deps/_editor/utils/ParseHtml.d.ts +0 -0
  270. package/deps/_editor/utils/ParseHtml.js +220 -0
  271. package/deps/api-audit.d.ts +1 -0
  272. package/deps/api-audit.js +6 -0
  273. package/deps/api-data.d.ts +0 -0
  274. package/deps/api-data.js +1 -0
  275. package/deps/apis/useSource.d.ts +0 -0
  276. package/deps/apis/useSource.js +152 -0
  277. package/deps/echarts.d.ts +26 -0
  278. package/deps/echarts.js +71 -0
  279. package/deps/editor.d.ts +34 -0
  280. package/deps/editor.js +111 -0
  281. package/deps/registerEditor.d.ts +1 -0
  282. package/deps/registerEditor.js +15 -0
  283. package/hooks/_list.d.ts +87 -0
  284. package/hooks/_list.js +13 -0
  285. package/hooks/index.d.ts +14 -0
  286. package/hooks/index.js +49 -0
  287. package/hooks/useAjax.d.ts +14 -0
  288. package/hooks/useAjax.js +43 -0
  289. package/hooks/useAjaxAction.d.ts +13 -0
  290. package/hooks/useAjaxAction.js +42 -0
  291. package/hooks/useAjaxQuery.d.ts +40 -0
  292. package/hooks/useAjaxQuery.js +81 -0
  293. package/hooks/useApi.d.ts +69 -0
  294. package/hooks/useApi.js +352 -0
  295. package/hooks/useApiGlobal.d.ts +0 -0
  296. package/hooks/useApiGlobal.js +5 -0
  297. package/hooks/useApp.d.ts +243 -0
  298. package/hooks/useApp.js +17 -0
  299. package/hooks/useArray.d.ts +21 -0
  300. package/hooks/useArray.js +182 -0
  301. package/hooks/useCounter.d.ts +0 -0
  302. package/hooks/useCounter.js +82 -0
  303. package/hooks/useDefault.d.ts +6 -0
  304. package/hooks/useDefault.js +16 -0
  305. package/hooks/useDoLoad.d.ts +17 -0
  306. package/hooks/useDoLoad.js +44 -0
  307. package/hooks/useEffectFunction.d.ts +8 -0
  308. package/hooks/useEffectFunction.js +16 -0
  309. package/hooks/useEffectOnce.d.ts +5 -0
  310. package/hooks/useEffectOnce.js +23 -0
  311. package/hooks/useError.d.ts +5 -0
  312. package/hooks/useError.js +21 -0
  313. package/hooks/useFirstMountState.d.ts +6 -0
  314. package/hooks/useFirstMountState.js +18 -0
  315. package/hooks/useGenkey.d.ts +2 -0
  316. package/hooks/useGenkey.js +16 -0
  317. package/hooks/useGetSet.d.ts +11 -0
  318. package/hooks/useGetSet.js +27 -0
  319. package/hooks/useGlobal.d.ts +19 -0
  320. package/hooks/useGlobal.js +62 -0
  321. package/hooks/useGlobal_back.d.ts +1 -0
  322. package/hooks/useGlobal_back.js +11 -0
  323. package/hooks/useHover.d.ts +8 -0
  324. package/hooks/useHover.js +49 -0
  325. package/hooks/useMemoPromise.d.ts +6 -0
  326. package/hooks/useMemoPromise.js +42 -0
  327. package/hooks/useModals.d.ts +40 -0
  328. package/hooks/useModals.js +98 -0
  329. package/hooks/useMountedState.d.ts +5 -0
  330. package/hooks/useMountedState.js +20 -0
  331. package/hooks/useOpenState.d.ts +28 -0
  332. package/hooks/useOpenState.js +23 -0
  333. package/hooks/usePromise.d.ts +7 -0
  334. package/hooks/usePromise.js +22 -0
  335. package/hooks/useQueue.d.ts +12 -0
  336. package/hooks/useQueue.js +34 -0
  337. package/hooks/useSetState.d.ts +9 -0
  338. package/hooks/useSetState.js +26 -0
  339. package/hooks/useStateList.d.ts +13 -0
  340. package/hooks/useStateList.js +59 -0
  341. package/hooks/useToggle.d.ts +6 -0
  342. package/hooks/useToggle.js +12 -0
  343. package/hooks/useUnmountPromise.d.ts +6 -0
  344. package/hooks/useUnmountPromise.js +36 -0
  345. package/hooks/useUpdate.d.ts +7 -0
  346. package/hooks/useUpdate.js +15 -0
  347. package/hooks/useUpdateEffect.d.ts +6 -0
  348. package/hooks/useUpdateEffect.js +18 -0
  349. package/index.d.ts +139 -0
  350. package/index.js +161 -0
  351. package/login/Base65.d.ts +8 -0
  352. package/login/Base65.js +65 -0
  353. package/login/Password.d.ts +61 -0
  354. package/login/Password.js +124 -0
  355. package/login/SM4.d.ts +20 -0
  356. package/login/SM4.js +193 -0
  357. package/login/cems/index.d.ts +10 -0
  358. package/login/cems/index.js +17 -0
  359. package/login/jit/index.d.ts +32 -0
  360. package/login/jit/index.js +180 -0
  361. package/login/jit/pnxclient.d.ts +54 -0
  362. package/login/jit/pnxclient.js +575 -0
  363. package/login/sso/index.d.ts +0 -0
  364. package/login/sso/index.js +0 -0
  365. package/login/vap/index.d.ts +1 -0
  366. package/login/vap/index.js +6 -0
  367. package/login/xrtx/index.d.ts +2 -0
  368. package/login/xrtx/index.js +33 -0
  369. package/package.json +1 -0
  370. package/screen/Comment.d.ts +31 -0
  371. package/screen/Comment.js +29 -0
  372. package/screen/EchartContent.d.ts +0 -0
  373. package/screen/EchartContent.js +63 -0
  374. package/screen/Page.d.ts +13 -0
  375. package/screen/Page.js +74 -0
  376. package/screen/index.d.ts +3 -0
  377. package/screen/index.js +9 -0
  378. package/screen/render.d.ts +5 -0
  379. package/screen/render.js +10 -0
  380. package/utils/Ajax.d.ts +85 -0
  381. package/utils/Ajax.js +147 -0
  382. package/utils/ArrayUtil.d.ts +22 -0
  383. package/utils/ArrayUtil.js +51 -0
  384. package/utils/CacheUtil.d.ts +20 -0
  385. package/utils/CacheUtil.js +86 -0
  386. package/utils/Const.d.ts +14 -0
  387. package/utils/Const.js +37 -0
  388. package/utils/CustomApp.d.ts +242 -0
  389. package/utils/CustomApp.js +18 -0
  390. package/utils/EventUtil.d.ts +22 -0
  391. package/utils/EventUtil.js +63 -0
  392. package/utils/Format.d.ts +28 -0
  393. package/utils/Format.js +206 -0
  394. package/utils/Global.d.ts +276 -0
  395. package/utils/Global.js +125 -0
  396. package/utils/Logger.d.ts +5 -0
  397. package/utils/Logger.js +32 -0
  398. package/utils/PageUtil.d.ts +24 -0
  399. package/utils/PageUtil.js +87 -0
  400. package/utils/Renders/ApiGetRender.d.ts +23 -0
  401. package/utils/Renders/ApiGetRender.js +192 -0
  402. package/utils/Renders/ApiPostRender.d.ts +17 -0
  403. package/utils/Renders/ApiPostRender.js +161 -0
  404. package/utils/Renders/DateRender.d.ts +8 -0
  405. package/utils/Renders/DateRender.js +35 -0
  406. package/utils/Renders/DictRender.d.ts +23 -0
  407. package/utils/Renders/DictRender.js +258 -0
  408. package/utils/Renders/FileRender.d.ts +3 -0
  409. package/utils/Renders/FileRender.js +46 -0
  410. package/utils/Renders/ListRender.d.ts +23 -0
  411. package/utils/Renders/ListRender.js +111 -0
  412. package/utils/Renders/NumberRender.d.ts +19 -0
  413. package/utils/Renders/NumberRender.js +65 -0
  414. package/utils/Renders/StatusRender.d.ts +12 -0
  415. package/utils/Renders/StatusRender.js +68 -0
  416. package/utils/Renders/StringRender.d.ts +14 -0
  417. package/utils/Renders/StringRender.js +194 -0
  418. package/utils/Renders/_define.d.ts +26 -0
  419. package/utils/Renders/_define.js +64 -0
  420. package/utils/Renders/index.d.ts +9 -0
  421. package/utils/Renders/index.js +42 -0
  422. package/utils/StringUtil.d.ts +124 -0
  423. package/utils/StringUtil.js +352 -0
  424. package/utils/TreeUtil.d.ts +42 -0
  425. package/utils/TreeUtil.js +69 -0
  426. package/utils/VAP.d.ts +16 -0
  427. package/utils/VAP.js +78 -0
  428. package/utils/XHR.d.ts +9 -0
  429. package/utils/XHR.js +53 -0
  430. package/utils/_AjaxUtil.d.ts +11 -0
  431. package/utils/_AjaxUtil.js +45 -0
  432. package/utils/_Support.d.ts +22 -0
  433. package/utils/_Support.js +106 -0
  434. package/utils/i18n.d.ts +60 -0
  435. package/utils/i18n.js +184 -0
  436. package/utils/index.d.ts +19 -0
  437. package/utils/index.js +54 -0
  438. package/utils/screenful.d.ts +15 -0
  439. package/utils/screenful.js +64 -0
  440. package/widget/index.d.ts +39 -0
  441. package/widget/index.js +21 -0
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.useAjaxAction = void 0;
16
+ const antd_1 = require("antd");
17
+ const lodash_1 = __importDefault(require("lodash"));
18
+ /**
19
+ * 封装一个Ajax接口调用操作
20
+ */
21
+ const useAjaxAction = (options) => {
22
+ const config = lodash_1.default.isFunction(options) ? { fn: options } : options;
23
+ const fetch = (data) => __awaiter(void 0, void 0, void 0, function* () {
24
+ try {
25
+ const param = lodash_1.default.merge(config.defaultParam, data);
26
+ const resp = yield config.fn(param);
27
+ if (lodash_1.default.has(resp, 'code') && resp.code != '0') {
28
+ antd_1.message.error(resp.message);
29
+ // setLoading(false);
30
+ return;
31
+ }
32
+ if (config.hander) {
33
+ config.hander(resp, param);
34
+ }
35
+ }
36
+ catch (err) {
37
+ console.error(err);
38
+ }
39
+ });
40
+ return fetch;
41
+ };
42
+ exports.useAjaxAction = useAjaxAction;
@@ -0,0 +1,40 @@
1
+ import { PlainObject } from '../basetype';
2
+ /**
3
+ * 查询方法,返回 Promise对象 即可
4
+ */
5
+ type QueryFunction = (...args: any[]) => Promise<any>;
6
+ /**
7
+ *
8
+ */
9
+ type UseAjaxQueryOptions<T> = {
10
+ /**
11
+ * 查询方法
12
+ */
13
+ fn: QueryFunction;
14
+ /**
15
+ * 值处理器
16
+ * 默认从 Response 中 检查 'data' 'list' 等字段并返回
17
+ * 也可以自定义 string : 路径,或 function 方法
18
+ */
19
+ valueHander?: string | ((response: any, ...args: any[]) => T);
20
+ /**
21
+ * 自动触发查询,默认为 true
22
+ */
23
+ autoLoad?: false;
24
+ /**
25
+ * 默认值
26
+ */
27
+ defaultValue?: T;
28
+ /**
29
+ * 默认参数
30
+ */
31
+ defaultParam?: PlainObject | PlainObject[];
32
+ };
33
+ export type UseAjaxQueryHook<T> = [boolean, T, Function, any];
34
+ type UseAjaxQuery = <T>(options: QueryFunction | UseAjaxQueryOptions<T>) => UseAjaxQueryHook<T>;
35
+ /**
36
+ * 封装一个Ajax接口查询操作
37
+ * 通过用于 Ajax 操作,实际上可以用于任何 Promise 方法
38
+ */
39
+ export declare const useAjaxQuery: UseAjaxQuery;
40
+ export {};
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.useAjaxQuery = void 0;
16
+ const react_1 = require("react");
17
+ const antd_1 = require("antd");
18
+ const lodash_1 = __importDefault(require("lodash"));
19
+ const useFirstMountState_1 = require("./useFirstMountState");
20
+ /**
21
+ * 封装一个Ajax接口查询操作
22
+ * 通过用于 Ajax 操作,实际上可以用于任何 Promise 方法
23
+ */
24
+ const useAjaxQuery = (options) => {
25
+ const config = lodash_1.default.isFunction(options) ? { fn: options } : options;
26
+ const [[data, param], setData] = (0, react_1.useState)([config.defaultValue, config.defaultParam]);
27
+ // const [] = useTransition()
28
+ const [loading, setLoading] = (0, react_1.useState)(config.autoLoad === false ? false : true);
29
+ const isFirstMount = (0, useFirstMountState_1.useFirstMountState)();
30
+ const fetch = (...args) => __awaiter(void 0, void 0, void 0, function* () {
31
+ let param = args.length > 0 ? args[0] : (config.defaultParam || null);
32
+ try {
33
+ setLoading(true);
34
+ const resp = yield config.fn(...args);
35
+ if (lodash_1.default.has(resp, 'code') && resp.code != '0') {
36
+ antd_1.message.error(resp.message);
37
+ setData([config.defaultValue, param]);
38
+ setLoading(false);
39
+ return;
40
+ }
41
+ if (config.valueHander) {
42
+ if (lodash_1.default.isString(config.valueHander)) {
43
+ setData([lodash_1.default.get(resp, config.valueHander), param]);
44
+ }
45
+ else {
46
+ setData([config.valueHander(resp, ...args), param]);
47
+ }
48
+ }
49
+ else {
50
+ if (lodash_1.default.has(resp, 'data')) {
51
+ setData([resp.data, param]);
52
+ }
53
+ else if (lodash_1.default.has(resp, 'list')) {
54
+ setData([resp.list, param]);
55
+ }
56
+ else {
57
+ setData([resp, param]);
58
+ }
59
+ }
60
+ setLoading(false);
61
+ }
62
+ catch (err) {
63
+ console.error(err);
64
+ setData([config.defaultValue, param]);
65
+ setLoading(false);
66
+ }
67
+ });
68
+ if (isFirstMount && config.autoLoad !== false) {
69
+ if (config.defaultParam == null) {
70
+ fetch({});
71
+ }
72
+ else if (lodash_1.default.isPlainObject(config.defaultParam)) {
73
+ fetch(config.defaultParam);
74
+ }
75
+ else if (lodash_1.default.isArray(config.defaultParam)) {
76
+ fetch(...config.defaultParam);
77
+ }
78
+ }
79
+ return [loading, data, fetch, param];
80
+ };
81
+ exports.useAjaxQuery = useAjaxQuery;
@@ -0,0 +1,69 @@
1
+ import type { Key, PlainObject } from '../basetype';
2
+ import type { ListInit, ApiListState } from './_list';
3
+ /**
4
+ * 自定义 单个 Api 的AOP行为
5
+ *
6
+ * before 行为 :
7
+ * 1. 用于转换数据,比如修改参数
8
+ * 2. 用于阻止行为:如果before方法返回 null 则不会执行
9
+ *
10
+ * after 行为 :
11
+ * 1. 用于自定义提示,需要配合 disableTip使用
12
+ * 2. 可用于成功后清除重建缓存
13
+ *
14
+ */
15
+ export type AOP = {
16
+ beforeQuery?: (queryParam: PlainObject) => PlainObject;
17
+ afterQuery?: (isSuccess: boolean, queryParam: PlainObject, response: PlainObject) => void;
18
+ beforeAdd?: (queryParam: PlainObject) => PlainObject;
19
+ afterAdd?: (isSuccess: boolean, data: PlainObject, response: PlainObject) => void;
20
+ beforeUpdate?: (queryParam: PlainObject) => PlainObject;
21
+ afterUpdate?: (isSuccess: boolean, data: PlainObject, response: PlainObject) => void;
22
+ beforeDelete?: (queryParam: PlainObject | PlainObject[] | Key | Key[]) => PlainObject | PlainObject[] | Key | Key[];
23
+ afterDelete?: (isSuccess: boolean, data: PlainObject | PlainObject[] | Key | Key[], response: PlainObject) => void;
24
+ beforeAll?: (queryParam: PlainObject) => PlainObject;
25
+ afterAll?: (action: 'ADD' | 'UPDATE' | 'DELETE', isSuccess: boolean, data: PlainObject, response: PlainObject) => void;
26
+ };
27
+ export type ApiOption = ListInit & {
28
+ /**
29
+ * 默认是GET,如果传了 PARAM 则为 POST,如果是POST显不需要传参数,则传一个 param:{}
30
+ * */
31
+ api: string;
32
+ /**
33
+ * 页面大小,默认为 VLIST 大小
34
+ */
35
+ pageSize?: number;
36
+ /**
37
+ * 默认为 ids
38
+ */
39
+ delKey?: string;
40
+ /**
41
+ * namefield
42
+ */
43
+ tipField?: string;
44
+ /**
45
+ * namefield
46
+ */
47
+ tipLabel?: string;
48
+ /**
49
+ * 说明:数据 添加/修改/删除 成功后,默认会填出提示
50
+ * 如果想自定义提示,则可通过 disableTip 阻止消息弹出,使用 aop 方法自行修改
51
+ * 可以定义为 true 禁用全部
52
+ * 也可以定义为 对象,禁用对应的操作
53
+ */
54
+ tipDisabled?: true | {
55
+ add?: true;
56
+ delete?: true;
57
+ update?: true;
58
+ };
59
+ /**
60
+ * 说明:AOP 方法
61
+ * before/after Action 是 add/update/delete 的集成方式,
62
+ */
63
+ aop?: AOP;
64
+ };
65
+ /**
66
+ * 一个标准接口的API模型,支持CRUD,支持符合VAP规范的接口
67
+ * 适用于 VTable 等组件
68
+ */
69
+ export declare const useApi: (options: string | ApiOption) => ApiListState;
@@ -0,0 +1,352 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.useApi = void 0;
16
+ const lodash_1 = __importDefault(require("lodash"));
17
+ ;
18
+ const react_1 = require("react");
19
+ const utils_1 = require("../utils");
20
+ const Const_1 = require("../components/_setup/Const");
21
+ const antd_1 = require("antd");
22
+ const useSetState_1 = require("./useSetState");
23
+ const _list_1 = require("./_list");
24
+ const chean = (param) => {
25
+ lodash_1.default.keys(param).map(key => {
26
+ if (param[key] === undefined || param[key] === '' || param[key] === null) {
27
+ lodash_1.default.unset(param, key);
28
+ }
29
+ });
30
+ return param;
31
+ };
32
+ const effectKey = (prevEffect, next, rowKey) => {
33
+ if (!lodash_1.default.has(next, rowKey))
34
+ return null;
35
+ if (next[rowKey] != prevEffect)
36
+ return next[rowKey];
37
+ return '_' + next[rowKey];
38
+ };
39
+ const SHOWTIP = (isSuccess, action, data, options) => {
40
+ let name = '';
41
+ if (options.tipLabel)
42
+ name = options.tipLabel;
43
+ if (options.tipField && lodash_1.default.has(data, options.tipField))
44
+ name += (' : ' + data[options.tipField]);
45
+ name = lodash_1.default.trim(name);
46
+ switch (action) {
47
+ case 'ADD':
48
+ if (isSuccess) {
49
+ antd_1.message.success(utils_1.i18n.txt(name ? Const_1.V.ACT_ADD_SUCCESS_NAMED : Const_1.V.ACT_ADD_SUCCESS, name));
50
+ }
51
+ else {
52
+ antd_1.message.error(utils_1.i18n.txt(name ? Const_1.V.ACT_ADD_FAIL_NAMED : Const_1.V.ACT_ADD_FAIL, name));
53
+ }
54
+ break;
55
+ case 'UPDATE':
56
+ if (isSuccess) {
57
+ antd_1.message.success(utils_1.i18n.txt(name ? Const_1.V.ACT_UPDATE_SUCCESS_NAMED : Const_1.V.ACT_UPDATE_SUCCESS, name));
58
+ }
59
+ else {
60
+ antd_1.message.error(utils_1.i18n.txt(name ? Const_1.V.ACT_UPDATE_FAIL_NAMED : Const_1.V.ACT_UPDATE_FAIL, name));
61
+ }
62
+ break;
63
+ case 'DELETE':
64
+ if (isSuccess) {
65
+ antd_1.message.success(utils_1.i18n.txt(name ? Const_1.V.ACT_DELETE_SUCCESS_NAMED : Const_1.V.ACT_DELETE_SUCCESS, name));
66
+ }
67
+ else {
68
+ antd_1.message.error(utils_1.i18n.txt(name ? Const_1.V.ACT_DELETE_FAIL_NAMED : Const_1.V.ACT_DELETE_FAIL, name));
69
+ }
70
+ break;
71
+ default:
72
+ break;
73
+ }
74
+ };
75
+ // export const proxyApi = (setState: Function, lastQuery: Ref<PlainObject>, rowKey: string, delKey: string, AOP: AOP) => {
76
+ // return {
77
+ // // query, pageTo, orderBy, doLoad,
78
+ // // add, doAdd,
79
+ // // update, doUpdate,
80
+ // // del, doDelete,
81
+ // }
82
+ // }
83
+ /**
84
+ * 一个标准接口的API模型,支持CRUD,支持符合VAP规范的接口
85
+ * 适用于 VTable 等组件
86
+ */
87
+ const useApi = (options) => {
88
+ const config = lodash_1.default.isString(options) ? { api: options } : options;
89
+ const rowKey = config.rowKey || 'id';
90
+ const delKey = config.delKey || 'ids';
91
+ let lastQuery = (0, react_1.useRef)(config.param || {});
92
+ const BASE = Object.assign(Object.assign({}, _list_1.DEFAULT_STATE), { effect: null });
93
+ BASE.rowKey = rowKey;
94
+ if (config.list)
95
+ BASE.list = config.list;
96
+ if (config.pageSize)
97
+ BASE.pageSize = config.pageSize;
98
+ const [{ list, effect, pageNo, pageSize, total, totalAcc, isQuerying, param, cost }, doLoad] = (0, useSetState_1.useSetState)(BASE);
99
+ var AOP = {};
100
+ if (config.aop)
101
+ AOP = config.aop;
102
+ var TIP = { ADD: true, UPDATE: true, DELETE: true };
103
+ if (config.tipDisabled) {
104
+ if (config.tipDisabled === true) {
105
+ TIP = { ADD: false, UPDATE: false, DELETE: false };
106
+ }
107
+ else {
108
+ if (config.tipDisabled.add)
109
+ TIP.ADD = false;
110
+ if (config.tipDisabled.update)
111
+ TIP.UPDATE = false;
112
+ if (config.tipDisabled.delete)
113
+ TIP.DELETE = false;
114
+ }
115
+ }
116
+ const queryHook = (0, react_1.useCallback)((_param, _page = null, _order = null) => {
117
+ if (_param) {
118
+ lastQuery.current = chean(lodash_1.default.merge(lastQuery.current, _param));
119
+ lastQuery.current.start_ = 0;
120
+ lastQuery.current.count_ = pageSize;
121
+ doLoad({ param: lastQuery.current, pageNo: 1, isQuerying: true });
122
+ _query(lastQuery.current);
123
+ }
124
+ else if (_page) {
125
+ lastQuery.current.start_ = _page.pageSize * (_page.pageNo - 1);
126
+ lastQuery.current.count_ = _page.pageSize;
127
+ doLoad({ param: lastQuery.current, pageNo: _page.pageNo, pageSize: _page.pageSize, isQuerying: true });
128
+ _query(lastQuery.current);
129
+ }
130
+ else if (_order) {
131
+ if (_order.order) {
132
+ lastQuery.current.order_ = _order.order;
133
+ lastQuery.current.by_ = _order.by == 'asc' ? 'asc' : 'desc';
134
+ }
135
+ else {
136
+ lodash_1.default.unset(lastQuery.current, 'order_');
137
+ lodash_1.default.unset(lastQuery.current, 'by_');
138
+ }
139
+ lastQuery.current.start_ = 0;
140
+ doLoad({ param: lastQuery.current, pageNo: 1, isQuerying: true });
141
+ _query(lastQuery.current);
142
+ }
143
+ }, [param, pageNo, pageSize]);
144
+ const _query = (param) => __awaiter(void 0, void 0, void 0, function* () {
145
+ let _start = Date.now();
146
+ const queryParam = lodash_1.default.isFunction(AOP.beforeQuery) ? AOP.beforeQuery(param) : param;
147
+ const response = yield utils_1.Ajax.POST(config.api, queryParam);
148
+ if (response.code != '0') {
149
+ doLoad({ isQuerying: false, cost: 0 }, () => {
150
+ if (lodash_1.default.isFunction(AOP.afterQuery)) {
151
+ AOP.afterQuery(false, queryParam, response);
152
+ }
153
+ });
154
+ throw response;
155
+ }
156
+ doLoad({
157
+ list: response.list, total: response.total, totalAcc: response.totalAcc || response.total,
158
+ cost: Date.now() - _start,
159
+ isQuerying: false
160
+ }, () => {
161
+ if (lodash_1.default.isFunction(AOP.afterQuery)) {
162
+ AOP.afterQuery(true, queryParam, response);
163
+ }
164
+ });
165
+ });
166
+ const query = (param, clean = false) => {
167
+ if (clean)
168
+ lastQuery.current = {};
169
+ queryHook(param);
170
+ };
171
+ const all = (loader = true) => __awaiter(void 0, void 0, void 0, function* () {
172
+ const resp = yield utils_1.Ajax.GET(config.api);
173
+ let list;
174
+ if (resp.code == '0') {
175
+ list = lodash_1.default.isArray(resp.data) ? resp.data : (lodash_1.default.isArray(resp.list) ? resp.list : []);
176
+ }
177
+ if (loader) {
178
+ doLoad({
179
+ total: list.length,
180
+ totalAcc: list.length,
181
+ list: list,
182
+ pageSize: list.length,
183
+ pageNo: 1,
184
+ param: {},
185
+ });
186
+ }
187
+ return list;
188
+ });
189
+ const pageTo = (pageNo, pageSize) => queryHook(null, { pageNo, pageSize });
190
+ const orderBy = (order, by) => queryHook(null, null, { order, by });
191
+ const doAdd = (data) => doLoad(prev => ({
192
+ effect: effectKey(prev.effect, data, rowKey),
193
+ total: prev.total + 1,
194
+ totalAcc: prev.totalAcc + 1,
195
+ list: utils_1.ArrayUtil.add(prev.list, data),
196
+ }));
197
+ const add = (data) => __awaiter(void 0, void 0, void 0, function* () {
198
+ const param = lodash_1.default.isFunction(AOP.beforeQuery) ? AOP.beforeQuery(data) : data;
199
+ const response = yield utils_1.Ajax.PUT(config.api, param);
200
+ if (TIP.ADD) {
201
+ SHOWTIP(response.code == '0', 'ADD', data, config);
202
+ }
203
+ const isSuccess = response.code == '0';
204
+ if (AOP.afterAdd) {
205
+ AOP.afterAdd(isSuccess, param, response);
206
+ }
207
+ else if (AOP.afterAll) {
208
+ AOP.afterAll('ADD', isSuccess, param, response);
209
+ }
210
+ if (!isSuccess)
211
+ throw response;
212
+ doAdd(response.data || param);
213
+ return response;
214
+ });
215
+ const doUpdate = (obj) => doLoad(prev => ({
216
+ effect: effectKey(prev.effect, obj, rowKey),
217
+ list: utils_1.ArrayUtil.update(prev.list, obj, rowKey)
218
+ }));
219
+ const update = (data) => __awaiter(void 0, void 0, void 0, function* () {
220
+ const param = lodash_1.default.isFunction(AOP.beforeUpdate) ? AOP.beforeUpdate(data) : data;
221
+ const response = yield utils_1.Ajax.PATCH(config.api, param);
222
+ if (TIP.UPDATE) {
223
+ SHOWTIP(response.code == '0', 'UPDATE', param, config);
224
+ }
225
+ const isSuccess = response.code == '0';
226
+ if (AOP.afterUpdate) {
227
+ AOP.afterUpdate(isSuccess, param, response);
228
+ }
229
+ else if (AOP.afterAll) {
230
+ AOP.afterAll('UPDATE', isSuccess, param, response);
231
+ }
232
+ if (!isSuccess)
233
+ throw response;
234
+ doUpdate(response.data || param);
235
+ return response;
236
+ });
237
+ const doDelete = (obj) => {
238
+ const keys = [];
239
+ if (lodash_1.default.isArray(obj)) {
240
+ obj.map(item => {
241
+ if (lodash_1.default.isPlainObject(item) && lodash_1.default.has(item, rowKey)) {
242
+ keys.push(item[rowKey]);
243
+ }
244
+ else if (lodash_1.default.isString(item) || lodash_1.default.isNumber(item)) {
245
+ keys.push(item);
246
+ }
247
+ });
248
+ }
249
+ else if (lodash_1.default.isString(obj) || lodash_1.default.isNumber(obj)) {
250
+ keys.push(obj);
251
+ }
252
+ else if (lodash_1.default.has(obj, rowKey)) {
253
+ keys.push(obj[rowKey]);
254
+ }
255
+ doLoad(prev => ({
256
+ list: utils_1.ArrayUtil.del(prev.list, keys, rowKey),
257
+ total: prev.total - keys.length,
258
+ totalAcc: prev.totalAcc - keys.length,
259
+ }));
260
+ };
261
+ const delArr = (arr) => __awaiter(void 0, void 0, void 0, function* () {
262
+ const keys = [];
263
+ arr.map(item => {
264
+ if (lodash_1.default.isPlainObject(item)) {
265
+ keys.push(item[rowKey]);
266
+ }
267
+ else if (lodash_1.default.isString(item) || lodash_1.default.isNumber(item)) {
268
+ keys.push(item);
269
+ }
270
+ });
271
+ if (keys.length == 0)
272
+ return;
273
+ let keyStr = keys.length == 1 ? keys[0] : keys.join(',');
274
+ const response = yield utils_1.Ajax.DELETE(config.api, { [delKey]: keyStr });
275
+ const isSuccess = response.code == '0';
276
+ if (TIP.DELETE) {
277
+ if (isSuccess) {
278
+ antd_1.message.success(utils_1.i18n.txt(Const_1.V.ACT_DELETE_SUCCESS_COUNT, keys.length + ''));
279
+ }
280
+ else {
281
+ antd_1.message.error(utils_1.i18n.txt(Const_1.V.ACT_DELETE_FAIL_COUNT, keys.length + ''));
282
+ }
283
+ }
284
+ if (isSuccess)
285
+ doDelete(arr);
286
+ return response;
287
+ });
288
+ const delSingle = (0, react_1.useCallback)((data) => __awaiter(void 0, void 0, void 0, function* () {
289
+ let key;
290
+ if (lodash_1.default.isString(data) || lodash_1.default.isNumber(data)) {
291
+ key = data;
292
+ }
293
+ else {
294
+ key = data[rowKey];
295
+ }
296
+ const response = yield utils_1.Ajax.DELETE(config.api, { [delKey]: key });
297
+ const isSuccess = response.code == '0';
298
+ if (TIP.DELETE) {
299
+ let obj = {};
300
+ if (lodash_1.default.isObject(data)) {
301
+ obj = data;
302
+ }
303
+ else {
304
+ obj = lodash_1.default.find(list, { [rowKey]: key }) || {};
305
+ }
306
+ SHOWTIP(isSuccess, 'DELETE', obj, config);
307
+ // let name;
308
+ // if (config.tipField) {
309
+ // if (_.isPlainObject(data)) {
310
+ // name = data[config.tipField]
311
+ // } else {
312
+ // let obj = _.find(list, { [rowKey]: key });
313
+ // if (obj && obj[config.tipField]) {
314
+ // name = obj[config.tipField];
315
+ // }
316
+ // }
317
+ // }
318
+ }
319
+ if (isSuccess)
320
+ doDelete(data);
321
+ return response;
322
+ }), [list]);
323
+ const del = (data) => __awaiter(void 0, void 0, void 0, function* () {
324
+ const param = lodash_1.default.isFunction(AOP.beforeDelete) ? AOP.beforeDelete(data) : data;
325
+ var response;
326
+ if (lodash_1.default.isArray(param)) {
327
+ response = yield delArr(param);
328
+ }
329
+ else {
330
+ response = yield delSingle(param);
331
+ }
332
+ const isSuccess = response.code == '0';
333
+ if (AOP.afterDelete) {
334
+ AOP.afterDelete(isSuccess, param, response);
335
+ }
336
+ else if (AOP.afterAll) {
337
+ AOP.afterAll('DELETE', isSuccess, param, response);
338
+ }
339
+ if (response.code != '0')
340
+ throw response;
341
+ return response;
342
+ });
343
+ return {
344
+ mode: 'api',
345
+ rowKey, cost, list, effect, pageNo, pageSize, total, totalAcc, isQuerying, param,
346
+ query, all, pageTo, orderBy, doLoad,
347
+ add, doAdd,
348
+ update, doUpdate,
349
+ del, doDelete,
350
+ };
351
+ };
352
+ exports.useApi = useApi;
File without changes
@@ -0,0 +1,5 @@
1
+ // import { useGlobal } from './useGlobal'
2
+ // import { proxyApi } from './useApi'
3
+ // export const useApiGlobal = (namespace: string, initValue?: {}) => {
4
+ // const [state, setState] = useGlobal(namespace, initValue);
5
+ // }