vap1 0.4.5 → 0.5.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 (368) hide show
  1. package/base.json +30 -0
  2. package/basetype.d.ts +4 -1
  3. package/cems/admin/AsyncSelect.d.ts +45 -0
  4. package/cems/admin/AsyncSelect.js +2 -0
  5. package/cems/admin/CardTable.d.ts +207 -0
  6. package/cems/admin/CardTable.js +2 -0
  7. package/cems/admin/EasyuiTree.d.ts +131 -0
  8. package/cems/admin/EasyuiTree.js +2 -0
  9. package/cems/admin/utils.d.ts +5 -0
  10. package/cems/admin/utils.js +3 -0
  11. package/cems/admin/validator.d.ts +137 -0
  12. package/cems/admin/validator.js +2 -0
  13. package/cems/assets/CUpload.d.ts +23 -0
  14. package/cems/assets/CUpload.js +2 -0
  15. package/cems/assets/Charts.d.ts +37 -0
  16. package/cems/assets/Charts.js +2 -0
  17. package/cems/assets/DInfo.d.ts +38 -0
  18. package/cems/assets/DInfo.js +2 -0
  19. package/cems/assets/DModal.d.ts +84 -0
  20. package/cems/assets/DModal.js +2 -0
  21. package/cems/assets/DTable.d.ts +128 -0
  22. package/cems/assets/DTable.js +2 -0
  23. package/cems/assets/DivWidth.d.ts +14 -0
  24. package/cems/assets/DivWidth.js +2 -0
  25. package/cems/assets/Patch.d.ts +9 -0
  26. package/cems/assets/Patch.js +2 -0
  27. package/cems/assets/Sensitive.d.ts +33 -0
  28. package/cems/assets/Sensitive.js +2 -0
  29. package/cems/assets/types.d.ts +200 -0
  30. package/cems/assets/types.js +2 -0
  31. package/cems/assets/utils.d.ts +61 -0
  32. package/cems/assets/utils.js +2 -0
  33. package/cems/define.d.ts +9 -0
  34. package/cems/define.js +18 -0
  35. package/cems/index.d.ts +228 -0
  36. package/cems/index.js +81 -0
  37. package/cems/policy/CForm.d.ts +133 -0
  38. package/cems/policy/CForm.js +2 -0
  39. package/cems/policy/DApiTable.d.ts +78 -0
  40. package/cems/policy/DApiTable.js +2 -0
  41. package/cems/policy/DButton.d.ts +17 -0
  42. package/cems/policy/DButton.js +2 -0
  43. package/cems/policy/DCheckbox.d.ts +50 -0
  44. package/cems/policy/DCheckbox.js +2 -0
  45. package/cems/policy/DCheckboxGroup.d.ts +34 -0
  46. package/cems/policy/DCheckboxGroup.js +2 -0
  47. package/cems/policy/DCol.d.ts +33 -0
  48. package/cems/policy/DCol.js +2 -0
  49. package/cems/policy/DColorPicker.d.ts +9 -0
  50. package/cems/policy/DColorPicker.js +2 -0
  51. package/cems/policy/DDatePicker.d.ts +41 -0
  52. package/cems/policy/DDatePicker.js +2 -0
  53. package/cems/policy/DDiv.d.ts +65 -0
  54. package/cems/policy/DDiv.js +2 -0
  55. package/cems/policy/DDrawer.d.ts +6 -0
  56. package/cems/policy/DDrawer.js +2 -0
  57. package/cems/policy/DDynamicSelect.d.ts +50 -0
  58. package/cems/policy/DDynamicSelect.js +2 -0
  59. package/cems/policy/DDynamicTreeSelect.d.ts +45 -0
  60. package/cems/policy/DDynamicTreeSelect.js +2 -0
  61. package/cems/policy/DForm.d.ts +248 -0
  62. package/cems/policy/DForm.js +2 -0
  63. package/cems/policy/DIcon.d.ts +33 -0
  64. package/cems/policy/DIcon.js +2 -0
  65. package/cems/policy/DInput.d.ts +41 -0
  66. package/cems/policy/DInput.js +2 -0
  67. package/cems/policy/DLabel.d.ts +17 -0
  68. package/cems/policy/DLabel.js +2 -0
  69. package/cems/policy/DPTable.d.ts +86 -0
  70. package/cems/policy/DPTable.js +2 -0
  71. package/cems/policy/DRadio.d.ts +34 -0
  72. package/cems/policy/DRadio.js +2 -0
  73. package/cems/policy/DSCTable.d.ts +33 -0
  74. package/cems/policy/DSCTable.js +2 -0
  75. package/cems/policy/DSelect.d.ts +42 -0
  76. package/cems/policy/DSelect.js +2 -0
  77. package/cems/policy/DSlider.d.ts +21 -0
  78. package/cems/policy/DSlider.js +2 -0
  79. package/cems/policy/DSwitch.d.ts +21 -0
  80. package/cems/policy/DSwitch.js +2 -0
  81. package/cems/policy/DTab.d.ts +30 -0
  82. package/cems/policy/DTab.js +2 -0
  83. package/cems/policy/DTimePicker.d.ts +37 -0
  84. package/cems/policy/DTimePicker.js +2 -0
  85. package/cems/policy/DTree.d.ts +98 -0
  86. package/cems/policy/DTree.js +2 -0
  87. package/cems/policy/DUpload.d.ts +33 -0
  88. package/cems/policy/DUpload.js +2 -0
  89. package/cems/policy/types.d.ts +200 -0
  90. package/cems/policy/types.js +2 -0
  91. package/cems/policy/utils.d.ts +13 -0
  92. package/cems/policy/utils.js +2 -0
  93. package/components/Box/Box.d.ts +43 -7
  94. package/components/Box/Box.js +67 -17
  95. package/components/Box/SelectBar.d.ts +1 -1
  96. package/components/Box/SelectBar.js +19 -9
  97. package/components/Lists/BaseList.d.ts +5 -0
  98. package/components/Lists/BaseList.js +111 -0
  99. package/components/Lists/Fields/IconRender.d.ts +53 -0
  100. package/components/Lists/Fields/IconRender.js +174 -0
  101. package/components/Lists/Fields/ItemRender.d.ts +2 -0
  102. package/components/Lists/Fields/ItemRender.js +127 -0
  103. package/components/Lists/Fields/_utils.d.ts +3 -0
  104. package/components/Lists/Fields/_utils.js +80 -0
  105. package/components/Lists/Fields/index.d.ts +3 -0
  106. package/components/Lists/Fields/index.js +47 -0
  107. package/components/Lists/Grid/grid.d.ts +7 -0
  108. package/components/Lists/Grid/grid.js +18 -0
  109. package/components/Lists/Grid/index.d.ts +3 -0
  110. package/components/Lists/Grid/index.js +50 -0
  111. package/components/Lists/Row/index.d.ts +3 -0
  112. package/components/Lists/Row/index.js +14 -0
  113. package/components/Lists/SList.js +17 -7
  114. package/components/Lists/Timeline/index.d.ts +3 -0
  115. package/components/Lists/Timeline/index.js +117 -0
  116. package/components/Lists/VList.d.ts +3 -0
  117. package/components/Lists/VList.js +92 -0
  118. package/components/Lists/components/LayoutSwitcher.d.ts +13 -0
  119. package/components/Lists/components/LayoutSwitcher.js +121 -0
  120. package/components/Lists/components/SearchTool.d.ts +13 -0
  121. package/components/Lists/components/SearchTool.js +34 -0
  122. package/components/Lists/index.d.ts +129 -0
  123. package/components/Lists/index.js +2 -0
  124. package/components/SearchTool/SearchBand/BandInput.d.ts +3 -0
  125. package/components/SearchTool/SearchBand/BandInput.js +54 -0
  126. package/components/SearchTool/SearchBand/BandTag.d.ts +7 -0
  127. package/components/SearchTool/SearchBand/BandTag.js +82 -0
  128. package/components/SearchTool/SearchBand/_SearchBandAction.d.ts +3 -0
  129. package/components/SearchTool/SearchBand/_SearchBandAction.js +23 -0
  130. package/components/SearchTool/SearchBand/_SearchBandFix.d.ts +3 -0
  131. package/components/SearchTool/SearchBand/_SearchBandFix.js +72 -0
  132. package/components/SearchTool/SearchBand/_SearchBandTag.d.ts +3 -0
  133. package/components/SearchTool/SearchBand/_SearchBandTag.js +75 -0
  134. package/components/SearchTool/SearchBand/_register.d.ts +47 -0
  135. package/components/SearchTool/SearchBand/_register.js +15 -0
  136. package/components/SearchTool/SearchBand/hooks.d.ts +12 -0
  137. package/components/SearchTool/SearchBand/hooks.js +181 -0
  138. package/components/SearchTool/SearchBand/index.d.ts +3 -0
  139. package/components/SearchTool/SearchBand/index.js +66 -0
  140. package/components/SearchTool/SearchBand/type.d.ts +71 -0
  141. package/components/SearchTool/SearchBand/type.js +3 -0
  142. package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.d.ts +2 -2
  143. package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.js +22 -12
  144. package/components/{SearchBar → SearchTool/SearchBar}/ByField.d.ts +1 -1
  145. package/components/{SearchBar → SearchTool/SearchBar}/ByField.js +21 -11
  146. package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.d.ts +1 -1
  147. package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.js +20 -10
  148. package/components/{SearchBar → SearchTool/SearchBar}/SearchField.d.ts +1 -1
  149. package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.js +1 -1
  150. package/components/{SearchBar → SearchTool/SearchBar}/_register.d.ts +1 -1
  151. package/components/{SearchBar → SearchTool/SearchBar}/_register.js +3 -3
  152. package/components/SearchTool/SearchBar/index.d.ts +7 -0
  153. package/components/{SearchBar → SearchTool/SearchBar}/index.js +1 -1
  154. package/components/{SearchBar/index.d.ts → SearchTool/SearchBar/type.d.ts} +68 -67
  155. package/components/SearchTool/SearchBar/type.js +35 -0
  156. package/components/SearchTool/index.d.ts +5 -0
  157. package/components/SearchTool/index.js +7 -0
  158. package/components/Tables/ApiTable.d.ts +5 -7
  159. package/components/Tables/ApiTable.js +17 -7
  160. package/components/Tables/ApiTableModal.d.ts +5 -7
  161. package/components/Tables/ApiTableModal.js +17 -7
  162. package/components/Tables/Components/ActionBar.d.ts +8 -11
  163. package/components/Tables/Components/ActionBar.js +74 -41
  164. package/components/Tables/Components/Actions.d.ts +3 -1
  165. package/components/Tables/Components/Actions.js +40 -3
  166. package/components/Tables/Components/index.d.ts +3 -1
  167. package/components/Tables/Components/useTableContext.d.ts +16 -0
  168. package/components/Tables/Components/useTableContext.js +116 -0
  169. package/components/Tables/STable.js +17 -7
  170. package/components/Tables/TopTable.js +17 -7
  171. package/components/Tables/Util.d.ts +2 -2
  172. package/components/Tables/Util.js +0 -1
  173. package/components/Tables/VTable.d.ts +9 -9
  174. package/components/Tables/VTable.js +119 -172
  175. package/components/Tables/VTableBack.d.ts +0 -0
  176. package/components/Tables/VTableBack.js +269 -0
  177. package/components/Tables/index.d.ts +11 -22
  178. package/components/TreeSelect/BaseTreeSelect.js +17 -7
  179. package/components/TreeSelect/DTreeSelect.js +19 -9
  180. package/components/TreeSelect/FTreeSelect.js +2 -2
  181. package/components/TreeSelect/STreeSelect.js +1 -1
  182. package/components/Trees/ActionTree.d.ts +3 -5
  183. package/components/Trees/ActionTree.js +19 -9
  184. package/components/Trees/BaseTree.js +17 -7
  185. package/components/Trees/COTree/COButton.js +17 -7
  186. package/components/Trees/COTree/COSelect.js +17 -7
  187. package/components/Trees/COTree/COTree.js +19 -9
  188. package/components/Trees/DTree.d.ts +0 -7
  189. package/components/Trees/DTree.js +19 -9
  190. package/components/Trees/FTree.js +19 -9
  191. package/components/Trees/STree.js +17 -7
  192. package/components/UForm/FormWrapper.js +17 -7
  193. package/components/UForm/UDescriptions.d.ts +2 -3
  194. package/components/UForm/UDescriptions.js +17 -7
  195. package/components/UForm/UForm.d.ts +1 -1
  196. package/components/UForm/UForm.js +24 -11
  197. package/components/UForm/UFormModal.js +19 -9
  198. package/components/UForm/_FieldType.d.ts +1 -1
  199. package/components/UForm/_FieldType.js +4 -0
  200. package/components/UForm/_input.d.ts +5 -1
  201. package/components/UForm/_input.js +25 -8
  202. package/components/Upload/UploadImage.js +17 -7
  203. package/components/Upload/UploadModal.js +19 -9
  204. package/components/Upload/useUpload.js +2 -2
  205. package/components/_adapt/Alert.js +17 -7
  206. package/components/_adapt/Col.d.ts +1 -1
  207. package/components/_adapt/ColorPicker.js +17 -7
  208. package/components/_adapt/Drawer.js +17 -7
  209. package/components/_adapt/Dropdown.js +17 -7
  210. package/components/_adapt/FloatButton.js +17 -7
  211. package/components/_adapt/Input.js +17 -7
  212. package/components/_adapt/InputNumber.js +17 -7
  213. package/components/_adapt/Layout.js +17 -7
  214. package/components/_adapt/Menu.js +17 -7
  215. package/components/_adapt/Modal.js +17 -7
  216. package/components/_adapt/Popconfirm.js +17 -7
  217. package/components/_adapt/Popover.js +17 -7
  218. package/components/_adapt/Progress.js +17 -7
  219. package/components/_adapt/Select.js +17 -7
  220. package/components/_adapt/Table.js +17 -7
  221. package/components/_adapt/Tabs.js +17 -7
  222. package/components/_adapt/Tag.js +17 -7
  223. package/components/_adapt/TreeSelect.js +17 -7
  224. package/components/_adapt/todo/Image.d.ts +0 -1
  225. package/components/_adapt/todo/Segmented.d.ts +0 -1
  226. package/components/_common/AutoComplete.js +35 -12
  227. package/components/_common/CountUp.js +17 -7
  228. package/components/_common/DateRange.d.ts +5 -2
  229. package/components/_common/DateRange.js +43 -40
  230. package/components/_common/HighLight.d.ts +1 -1
  231. package/components/_common/HighLight.js +26 -24
  232. package/components/_common/Loading.js +17 -7
  233. package/components/_common/MonthRange.js +17 -7
  234. package/components/_common/PromiseLabel.js +2 -2
  235. package/components/_common/UTitle.d.ts +1 -1
  236. package/components/_common/UTitle.js +18 -8
  237. package/components/_common/Upagination.d.ts +1 -0
  238. package/components/_common/Upagination.js +5 -1
  239. package/components/_i18n.d.ts +1 -102
  240. package/components/index.d.ts +2 -2
  241. package/components/index.js +5 -1
  242. package/deps/JsonView.js +17 -7
  243. package/deps/app-audit/LookUp.js +19 -9
  244. package/deps/app-data/Const.d.ts +68 -3
  245. package/deps/app-data/Const.js +47 -3
  246. package/deps/app-data/TimeConst.d.ts +0 -0
  247. package/deps/app-data/TimeConst.js +58 -0
  248. package/deps/app-data/useSource.d.ts +22 -0
  249. package/deps/app-data/useSource.js +253 -162
  250. package/deps/echarts.d.ts +3 -0
  251. package/deps/echarts.js +20 -10
  252. package/deps/editor/Article.js +17 -7
  253. package/deps/editor/Editor.js +17 -7
  254. package/deps/editor/EditorModal.js +17 -7
  255. package/deps/editor/support/buttons/ImageButton.js +17 -7
  256. package/deps/editor/tools/Button.js +0 -2
  257. package/deps/editor/tools/_TxtButton.js +17 -7
  258. package/deps/vapc/_basic.d.ts +1 -0
  259. package/deps/vapc/_basic.js +15 -0
  260. package/deps/vapc/index.d.ts +10 -0
  261. package/deps/vapc/index.js +70 -0
  262. package/hooks/useAjaxAction.js +2 -2
  263. package/hooks/useAjaxQuery.js +2 -2
  264. package/hooks/useApiBase.js +2 -2
  265. package/hooks/useApiGlobal.js +1 -1
  266. package/hooks/useArray.js +2 -2
  267. package/hooks/useDefault.d.ts +0 -1
  268. package/hooks/useDoLoad.d.ts +1 -1
  269. package/hooks/useError.d.ts +1 -1
  270. package/hooks/useMemoPromise.js +2 -2
  271. package/index.d.ts +2 -1
  272. package/index.js +1 -1
  273. package/login/Base65.d.ts +7 -1
  274. package/login/Base65.js +49 -22
  275. package/login/Password.d.ts +8 -5
  276. package/login/Password.js +68 -102
  277. package/package.json +1 -1
  278. package/screen/Page.js +17 -7
  279. package/screen/vapc-schema/dark.d.ts +1 -0
  280. package/screen/vapc-schema/dark.js +50 -0
  281. package/screen/vapc-schema/insight.d.ts +1 -0
  282. package/screen/vapc-schema/insight.js +49 -0
  283. package/uform/FormEditor.js +17 -7
  284. package/uform/FormViewer.js +17 -7
  285. package/uform/hooks/useEditor.d.ts +0 -1
  286. package/uform/hooks/useForm.d.ts +0 -1
  287. package/uform/inputs/index.d.ts +0 -1
  288. package/uform/panel/Editor/_GroupDefault.js +17 -7
  289. package/uform/panel/Editor/_GroupStep.js +17 -7
  290. package/uform/panel/Editor/_GroupTab.js +17 -7
  291. package/uform/panel/Editor/index.js +17 -7
  292. package/uform/panel/Items/Fields.js +17 -7
  293. package/uform/panel/Items/InputSelector.js +17 -7
  294. package/uform/panel/Items/Inputs.js +17 -7
  295. package/uform/panel/Items/index.d.ts +1 -1
  296. package/uform/panel/Propreties/CanvasProperties.js +17 -7
  297. package/uform/panel/Propreties/Component/FieldPlugin.js +17 -7
  298. package/uform/panel/Propreties/Component/LinkAsyncFunction.js +17 -7
  299. package/uform/panel/Propreties/Component/LinkSyncFunction.js +17 -7
  300. package/uform/panel/Propreties/Component/Links.js +17 -7
  301. package/uform/panel/Propreties/Component/OptionTable.js +17 -7
  302. package/uform/panel/Propreties/Component/RegexpModal.js +17 -7
  303. package/uform/panel/Propreties/Component/Validate.js +17 -7
  304. package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +17 -7
  305. package/uform/panel/Propreties/Component/ValidateSyncFunction.js +17 -7
  306. package/uform/panel/Propreties/FieldOptions.js +17 -7
  307. package/uform/panel/Propreties/FieldProperties.js +17 -7
  308. package/uform/panel/Propreties/_ItemAdvance.js +17 -7
  309. package/uform/panel/Propreties/_ItemBase.js +17 -7
  310. package/uform/panel/Propreties/_ItemLink.js +17 -7
  311. package/uform/panel/Propreties/_ItemValidate.js +17 -7
  312. package/uform/schema.d.ts +1 -1
  313. package/uform/utils/Convert.js +2 -2
  314. package/utils/Ajax.d.ts +3 -0
  315. package/utils/Ajax.js +22 -16
  316. package/utils/CacheUtil.d.ts +1 -1
  317. package/utils/Const.js +17 -7
  318. package/utils/Format.d.ts +138 -14
  319. package/utils/Format.js +132 -23
  320. package/utils/Global.d.ts +46 -2
  321. package/utils/Global.js +24 -2
  322. package/utils/PageUtil.d.ts +111 -23
  323. package/utils/PageUtil.js +163 -28
  324. package/utils/Renders/ApiGetRender.js +25 -12
  325. package/utils/Renders/ApiPostRender.js +3 -3
  326. package/utils/Renders/CondictionRender.js +17 -7
  327. package/utils/Renders/DateRender.js +20 -2
  328. package/utils/Renders/ListRender.js +1 -1
  329. package/utils/Renders/NumberRender.js +24 -5
  330. package/utils/Renders/StringRender.js +81 -11
  331. package/utils/Renders/_define.d.ts +8 -7
  332. package/utils/Renders/_define.js +76 -17
  333. package/utils/StringUtil.d.ts +292 -62
  334. package/utils/StringUtil.js +310 -63
  335. package/utils/TreeUtil.js +14 -12
  336. package/utils/VAP.d.ts +26 -1
  337. package/utils/VAP.js +57 -1
  338. package/utils/_AjaxUtil.d.ts +1 -0
  339. package/utils/_AjaxUtil.js +70 -3
  340. package/utils/_Support.d.ts +2 -2
  341. package/utils/_Support.js +4 -2
  342. package/utils/crontab/_en.d.ts +2 -0
  343. package/utils/crontab/_en.js +178 -0
  344. package/utils/crontab/_global.d.ts +11 -0
  345. package/utils/crontab/_global.js +23 -0
  346. package/utils/crontab/_zh_CN.d.ts +2 -0
  347. package/utils/crontab/_zh_CN.js +180 -0
  348. package/utils/crontab/_zh_TW.d.ts +2 -0
  349. package/utils/crontab/_zh_TW.js +170 -0
  350. package/utils/crontab/crontabParser.d.ts +1 -0
  351. package/utils/crontab/crontabParser.js +251 -0
  352. package/utils/crontab/crontabRender.d.ts +23 -0
  353. package/utils/crontab/crontabRender.js +502 -0
  354. package/utils/crontab/index.d.ts +3 -0
  355. package/utils/crontab/index.js +9 -0
  356. package/utils/crontab/type.d.ts +79 -0
  357. package/utils/crontab/type.js +2 -0
  358. package/utils/crontab/utils.d.ts +20 -0
  359. package/utils/crontab/utils.js +122 -0
  360. package/utils/i18n.d.ts +13 -2
  361. package/utils/i18n.js +13 -2
  362. package/utils/index.d.ts +4 -0
  363. package/utils/index.js +19 -9
  364. package/utils/py.js +2 -0
  365. package/components/SearchBar/_FieldType.d.ts +0 -8
  366. package/components/SearchBar/_FieldType.js +0 -51
  367. /package/components/{SearchBar → SearchTool/SearchBar}/SearchField.js +0 -0
  368. /package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.d.ts +0 -0
package/utils/Ajax.js CHANGED
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
@@ -105,16 +105,13 @@ exports.CATCH = CATCH;
105
105
  * 当满足不了需求时,可使用 `FETCH`,参考与标准 fetch 类似。
106
106
  */
107
107
  var FETCH = function (url, options) { return __awaiter(void 0, void 0, void 0, function () {
108
- var fetchOptions, response, result;
108
+ var fetchOptions, response, result_1, result;
109
109
  return __generator(this, function (_a) {
110
110
  switch (_a.label) {
111
111
  case 0:
112
112
  if (options.process !== false)
113
113
  start();
114
- fetchOptions = lodash_1.default.merge({
115
- method: 'GET',
116
- headers: Global_1.CONFIG.AJAX.headers,
117
- }, options);
114
+ fetchOptions = lodash_1.default.merge({ method: 'GET', headers: Global_1.CONFIG.AJAX.headers, }, options);
118
115
  if (fetchOptions.body && lodash_1.default.isPlainObject(fetchOptions.body)) {
119
116
  fetchOptions.body = JSON.stringify(fetchOptions.body);
120
117
  }
@@ -123,17 +120,23 @@ var FETCH = function (url, options) { return __awaiter(void 0, void 0, void 0, f
123
120
  response = _a.sent();
124
121
  if (options.process !== false)
125
122
  done();
123
+ if (!lodash_1.default.isFunction(Global_1.CONFIG.AJAX.beforeReceive)) return [3 /*break*/, 3];
124
+ return [4 /*yield*/, Global_1.CONFIG.AJAX.beforeReceive(response, url, fetchOptions)];
125
+ case 2:
126
+ result_1 = _a.sent();
127
+ return [2 /*return*/, result_1];
128
+ case 3:
126
129
  if (response.redirected && lodash_1.default.isString(response.url) && response.url.indexOf('login') >= 0) {
127
130
  if (window.location.href.indexOf('login') < 0) {
128
131
  window.location.href = response.url;
129
132
  return [2 /*return*/, new Promise(function (r) { return r({ code: '9999', message: '请先登录' }); })];
130
133
  }
131
134
  }
132
- if (!fetchOptions.text) return [3 /*break*/, 3];
135
+ if (!fetchOptions.text) return [3 /*break*/, 5];
133
136
  return [4 /*yield*/, response.text()];
134
- case 2: return [2 /*return*/, _a.sent()];
135
- case 3: return [4 /*yield*/, response.json()];
136
- case 4:
137
+ case 4: return [2 /*return*/, _a.sent()];
138
+ case 5: return [4 /*yield*/, response.json()];
139
+ case 6:
137
140
  result = _a.sent();
138
141
  return [2 /*return*/, result];
139
142
  }
@@ -155,6 +158,7 @@ var GET = function (url, options) { return __awaiter(void 0, void 0, void 0, fun
155
158
  switch (_b.label) {
156
159
  case 0:
157
160
  _a = __read([_AjaxUtil_1.CACHE_URL.has(url), _AjaxUtil_1.CACHE_TIMER.get(url)], 2), isCache = _a[0], timer = _a[1];
161
+ if (!!Global_1.CONFIG.AJAX.disableCache) return [3 /*break*/, 2];
158
162
  useCache = false;
159
163
  if (isCache && sessionStorage.getItem(url)) {
160
164
  useCache = true;
@@ -184,11 +188,13 @@ var GET = function (url, options) { return __awaiter(void 0, void 0, void 0, fun
184
188
  case 2: return [4 /*yield*/, _FETCH('GET', url, {}, options)];
185
189
  case 3:
186
190
  resp = _b.sent();
187
- if (_AjaxUtil_1.CACHE_URL.has(url)) {
188
- if (lodash_1.default.has(resp, 'code') && resp.code == '0') {
189
- sessionStorage.setItem(url, JSON.stringify(resp));
190
- if (timer) {
191
- sessionStorage.setItem(url + TIMER_SUFFIX, Date.now() + '');
191
+ if (!Global_1.CONFIG.AJAX.disableCache) {
192
+ if (_AjaxUtil_1.CACHE_URL.has(url)) {
193
+ if (lodash_1.default.has(resp, 'code') && resp.code == '0') {
194
+ sessionStorage.setItem(url, JSON.stringify(resp));
195
+ if (timer) {
196
+ sessionStorage.setItem(url + TIMER_SUFFIX, Date.now() + '');
197
+ }
192
198
  }
193
199
  }
194
200
  }
@@ -2,7 +2,7 @@ export declare const set: (key: string, value: any) => void;
2
2
  /**
3
3
  * 获取 Session 缓存, 并以 Object 返回 (JSON)
4
4
  */
5
- export declare const getData: <T extends object = any>(key: string, defaultValue?: T) => any;
5
+ export declare const getData: <T extends object = any>(key: string, defaultValue?: T) => T | any;
6
6
  /**
7
7
  * 获取 Session 缓存, 并以 String 返回
8
8
  */
package/utils/Const.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.DO_NOT_SHOW_PROCESS = exports.DATE_FORMAT = exports.NONE = void 0;
27
37
  var react_1 = __importStar(require("react"));
package/utils/Format.d.ts CHANGED
@@ -1,35 +1,159 @@
1
1
  /**
2
- * string representing a number in fixed-point notation.
3
- * Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
2
+ * 小数位数参数的类型定义,用于数字格式化函数
3
+ * 定义了小数点后有效位数,或者布尔标志
4
4
  */
5
5
  export type FractionDigits = boolean | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19;
6
+ /**
7
+ * getFormater函数使用的数字格式选项类型定义
8
+ */
6
9
  export type NumberFormat = 'int' | 'int-fixed' | 'number' | 'size' | 'usd' | 'chinese' | 'percent';
7
10
  /**
8
- * 123456 -> '123,456'
9
- * 1234567 -> '1,234,567'
10
- */
11
+ * 使用美元格式(逗号分隔符)格式化数字
12
+ *
13
+ * @param num - 要格式化的数字
14
+ * @param digital - 显示的小数位数(如果为false或0,则显示整数)
15
+ * @returns 带千位分隔符的格式化字符串
16
+ *
17
+ * @example
18
+ * formatUSD(123456) => '123,456'
19
+ * formatUSD(1234567, 2) => '1,234,567.00'
20
+ */
11
21
  export declare const formatUSD: (num: number, digital?: FractionDigits) => string;
12
22
  /**
13
- * num: 分子,需要格式化的数字
14
- * base: 分母,默认为 1
15
- * formatPercent(0.2, 1) = 20%
16
- * formatPercent(20, 100) = 20%
17
- * fractionDigits: 小数点位数,默认为2
18
- */
23
+ * 将数字格式化为百分比
24
+ *
25
+ * @param num - 分子(要格式化的数字)
26
+ * @param basic - 分母(默认为1)
27
+ * @param fractionDigits - 显示的小数位数(默认为2
28
+ * @returns 带%符号的格式化百分比字符串
29
+ *
30
+ * @example
31
+ * formatPercent(0.2, 1) => '20%'
32
+ * formatPercent(20, 100) => '20%'
33
+ * formatPercent(0.255, 1, 1) => '25.5%'
34
+ */
19
35
  export declare const formatPercent: (num: number, basic?: number, fractionDigits?: FractionDigits) => string;
36
+ /**
37
+ * 将字节大小格式化为人类可读的格式并附带适当的单位
38
+ *
39
+ * @param byteSize - 字节大小
40
+ * @returns 带有适当单位的格式化字符串(b, KB, MB, GB, TB, PB)
41
+ *
42
+ * @example
43
+ * formatSize(1500) => '1.46KB'
44
+ * formatSize(1500000) => '1.43MB'
45
+ */
20
46
  export declare const formatSize: (byteSize: number) => string;
21
47
  /**
22
- * pos : 小数点后面位数,最多20
23
- */
48
+ * 将数字格式化为指定小数位数
49
+ *
50
+ * @param num - 要格式化的数字
51
+ * @param fractionDigits - 小数位数(默认为2)
52
+ * @returns 格式化后的数字字符串
53
+ *
54
+ * @example
55
+ * formatNumber(123.456, 2) => '123.46'
56
+ * formatNumber(123.456, 0) => '123'
57
+ */
24
58
  export declare const formatNumber: (num: number, fractionDigits?: FractionDigits) => string;
59
+ /**
60
+ * 将数字格式化为整数(四舍五入)
61
+ *
62
+ * @param num - 要格式化的数字
63
+ * @param returnString - 是否将结果作为字符串返回(默认为false)
64
+ * @returns 根据returnString参数返回四舍五入的整数或字符串
65
+ *
66
+ * @example
67
+ * formatInt(123.6) => 124
68
+ * formatInt(123.6, true) => '124'
69
+ */
25
70
  export declare function formatInt(num: number): number;
26
71
  export declare function formatInt(num: number, returnString: false): number;
27
72
  export declare function formatInt(num: number, returnString: true): string;
73
+ /**
74
+ * 将数字格式化为固定长度的整数,前面补零
75
+ *
76
+ * @param num - 要格式化的数字
77
+ * @param fractionDigits - 期望的字符串长度(默认为5)
78
+ * @returns 带前导零的固定长度字符串
79
+ *
80
+ * @example
81
+ * formatIntFixed(123, 5) => '00123'
82
+ * formatIntFixed(1234, 3) => '1234' (超出限制,返回完整数字)
83
+ */
28
84
  export declare const formatIntFixed: (num: number, fractionDigits?: FractionDigits) => string;
85
+ /**
86
+ * 使用中文数字单位(万、亿)格式化数字
87
+ *
88
+ * @param num - 要格式化的数字
89
+ * @param digital - 小数位数(默认为2)
90
+ * @returns 带中文单位的格式化字符串
91
+ *
92
+ * @example
93
+ * formatChinese(12345) => '1.23万'
94
+ * formatChinese(123456789) => '1.23亿'
95
+ */
29
96
  export declare const formatChinese: (num: number, digital?: boolean | FractionDigits) => string;
30
- export declare const getFormater: (type: NumberFormat, fix?: FractionDigits) => (num: number) => string;
97
+ /**
98
+ * 根据指定的数字格式类型返回格式化函数
99
+ *
100
+ * @param type - 数字格式类型
101
+ * @param fix - 小数位数(可选)
102
+ * @returns 按照指定类型格式化数字的函数
103
+ *
104
+ * @example
105
+ * const formatter = getFormater('usd');
106
+ * formatter(12345) => '12,345'
107
+ */
108
+ export declare const getFormater: (type: NumberFormat, fix?: FractionDigits) => ((num: number) => string);
109
+ /**
110
+ * 将日期字符串或时间戳格式化为YYYY-MM-DD
111
+ *
112
+ * @param str - 日期字符串或时间戳
113
+ * @returns 格式化的日期字符串,无效则返回空字符串
114
+ *
115
+ * @example
116
+ * formatDate('2023-01-15T12:30:45') => '2023-01-15'
117
+ */
31
118
  export declare const formatDate: (str: string | number) => string;
119
+ /**
120
+ * 将日期字符串或时间戳格式化为YYYY-MM-DD HH:mm:ss
121
+ *
122
+ * @param str - 日期字符串或时间戳
123
+ * @returns 格式化的日期时间字符串,无效则返回空字符串
124
+ *
125
+ * @example
126
+ * formatDateTime('2023-01-15T12:30:45') => '2023-01-15 12:30:45'
127
+ */
32
128
  export declare const formatDateTime: (str: string | number) => string;
129
+ /**
130
+ * 对身份证号码进行隐私保护处理
131
+ *
132
+ * @param str - 身份证号码字符串
133
+ * @returns 中间部分被隐藏的身份证号码
134
+ *
135
+ * @example
136
+ * maskIdCard('123456789012345678') => '12345*******678'
137
+ */
33
138
  export declare const maskIdCard: (str: string) => string;
139
+ /**
140
+ * 对电话号码进行隐私保护处理
141
+ *
142
+ * @param str - 电话号码字符串
143
+ * @returns 中间部分被隐藏的电话号码
144
+ *
145
+ * @example
146
+ * maskPhone('1234567890') => '123****7890'
147
+ * maskPhone('123-4567890') => '123***890'
148
+ */
34
149
  export declare const maskPhone: (str: string) => string;
150
+ /**
151
+ * 对电子邮件地址进行隐私保护处理
152
+ *
153
+ * @param str - 电子邮件地址字符串
154
+ * @returns 账户部分和域名部分被部分隐藏的电子邮件
155
+ *
156
+ * @example
157
+ * maskEmail('user@example.com') => 'us*********@***********.com'
158
+ */
35
159
  export declare const maskEmail: (str: string) => string;
package/utils/Format.js CHANGED
@@ -19,11 +19,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  return (mod && mod.__esModule) ? mod : { "default": mod };
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.maskEmail = exports.maskPhone = exports.maskIdCard = exports.formatDateTime = exports.formatDate = exports.getFormater = exports.formatChinese = exports.formatIntFixed = exports.formatInt = exports.formatNumber = exports.formatSize = exports.formatPercent = exports.formatUSD = void 0;
22
+ exports.maskEmail = exports.maskPhone = exports.maskIdCard = exports.formatDateTime = exports.formatDate = exports.getFormater = exports.formatChinese = exports.formatIntFixed = exports.formatNumber = exports.formatSize = exports.formatPercent = exports.formatUSD = void 0;
23
+ exports.formatInt = formatInt;
23
24
  var lodash_1 = __importDefault(require("lodash"));
24
25
  var Const_1 = require("./Const");
25
26
  var StringUtil_1 = require("./StringUtil");
26
27
  var dayjs_1 = __importDefault(require("dayjs"));
28
+ /**
29
+ * 定点数格式化的最大值数组
30
+ * 用于限制formatIntFixed函数中数字的上限
31
+ */
27
32
  var MAX_FIX = [
28
33
  0,
29
34
  9,
@@ -43,9 +48,16 @@ var MAX_FIX = [
43
48
  999999999999999
44
49
  ];
45
50
  /**
46
- * 123456 -> '123,456'
47
- * 1234567 -> '1,234,567'
48
- */
51
+ * 使用美元格式(逗号分隔符)格式化数字
52
+ *
53
+ * @param num - 要格式化的数字
54
+ * @param digital - 显示的小数位数(如果为false或0,则显示整数)
55
+ * @returns 带千位分隔符的格式化字符串
56
+ *
57
+ * @example
58
+ * formatUSD(123456) => '123,456'
59
+ * formatUSD(1234567, 2) => '1,234,567.00'
60
+ */
49
61
  var formatUSD = function (num, digital) {
50
62
  if (digital === void 0) { digital = false; }
51
63
  if (digital == false || digital == 0)
@@ -55,45 +67,64 @@ var formatUSD = function (num, digital) {
55
67
  };
56
68
  exports.formatUSD = formatUSD;
57
69
  /**
58
- * num: 分子,需要格式化的数字
59
- * base: 分母,默认为 1
60
- * formatPercent(0.2, 1) = 20%
61
- * formatPercent(20, 100) = 20%
62
- * fractionDigits: 小数点位数,默认为2
63
- */
70
+ * 将数字格式化为百分比
71
+ *
72
+ * @param num - 分子(要格式化的数字)
73
+ * @param basic - 分母(默认为1)
74
+ * @param fractionDigits - 显示的小数位数(默认为2
75
+ * @returns 带%符号的格式化百分比字符串
76
+ *
77
+ * @example
78
+ * formatPercent(0.2, 1) => '20%'
79
+ * formatPercent(20, 100) => '20%'
80
+ * formatPercent(0.255, 1, 1) => '25.5%'
81
+ */
64
82
  var formatPercent = function (num, basic, fractionDigits) {
65
83
  if (basic === void 0) { basic = 1; }
66
84
  if (fractionDigits === void 0) { fractionDigits = 2; }
67
85
  return (0, exports.formatNumber)(num * 100 / basic, fractionDigits) + '%';
68
86
  };
69
87
  exports.formatPercent = formatPercent;
88
+ /**
89
+ * 将字节大小格式化为人类可读的格式并附带适当的单位
90
+ *
91
+ * @param byteSize - 字节大小
92
+ * @returns 带有适当单位的格式化字符串(b, KB, MB, GB, TB, PB)
93
+ *
94
+ * @example
95
+ * formatSize(1500) => '1.46KB'
96
+ * formatSize(1500000) => '1.43MB'
97
+ */
70
98
  var formatSize = function (byteSize) {
71
- if (byteSize < 1024) {
99
+ if (byteSize < 1024)
72
100
  return (0, exports.formatNumber)(byteSize) + 'b';
73
- }
74
101
  var kbSize = (byteSize / 1024);
75
- if (kbSize < 1024) {
102
+ if (kbSize < 1024)
76
103
  return (0, exports.formatNumber)(kbSize) + 'KB';
77
- }
78
104
  var mbSize = (kbSize / 1024);
79
- if (mbSize < 1024) {
105
+ if (mbSize < 1024)
80
106
  return (0, exports.formatNumber)(mbSize) + 'MB';
81
- }
82
107
  var gbSize = (mbSize / 1024);
83
- if (gbSize < 1024) {
108
+ if (gbSize < 1024)
84
109
  return (0, exports.formatNumber)(gbSize) + 'GB';
85
- }
86
110
  var tbSize = (gbSize / 1024);
87
- if (tbSize < 1024) {
111
+ if (tbSize < 1024)
88
112
  return (0, exports.formatNumber)(tbSize) + 'TB';
89
- }
90
113
  var pbSize = (tbSize / 1024);
91
114
  return (0, exports.formatNumber)(pbSize) + 'PB';
92
115
  };
93
116
  exports.formatSize = formatSize;
94
117
  /**
95
- * pos : 小数点后面位数,最多20
96
- */
118
+ * 将数字格式化为指定小数位数
119
+ *
120
+ * @param num - 要格式化的数字
121
+ * @param fractionDigits - 小数位数(默认为2)
122
+ * @returns 格式化后的数字字符串
123
+ *
124
+ * @example
125
+ * formatNumber(123.456, 2) => '123.46'
126
+ * formatNumber(123.456, 0) => '123'
127
+ */
97
128
  var formatNumber = function (num, fractionDigits) {
98
129
  if (fractionDigits === void 0) { fractionDigits = 2; }
99
130
  if (fractionDigits == false || fractionDigits == 0)
@@ -109,7 +140,17 @@ function formatInt(num, returnString) {
109
140
  }
110
141
  return result;
111
142
  }
112
- exports.formatInt = formatInt;
143
+ /**
144
+ * 将数字格式化为固定长度的整数,前面补零
145
+ *
146
+ * @param num - 要格式化的数字
147
+ * @param fractionDigits - 期望的字符串长度(默认为5)
148
+ * @returns 带前导零的固定长度字符串
149
+ *
150
+ * @example
151
+ * formatIntFixed(123, 5) => '00123'
152
+ * formatIntFixed(1234, 3) => '1234' (超出限制,返回完整数字)
153
+ */
113
154
  var formatIntFixed = function (num, fractionDigits) {
114
155
  if (fractionDigits === void 0) { fractionDigits = 5; }
115
156
  var pos = lodash_1.default.isNumber(fractionDigits) ? fractionDigits : 5;
@@ -125,6 +166,17 @@ var formatIntFixed = function (num, fractionDigits) {
125
166
  return prefix + val;
126
167
  };
127
168
  exports.formatIntFixed = formatIntFixed;
169
+ /**
170
+ * 使用中文数字单位(万、亿)格式化数字
171
+ *
172
+ * @param num - 要格式化的数字
173
+ * @param digital - 小数位数(默认为2)
174
+ * @returns 带中文单位的格式化字符串
175
+ *
176
+ * @example
177
+ * formatChinese(12345) => '1.23万'
178
+ * formatChinese(123456789) => '1.23亿'
179
+ */
128
180
  var formatChinese = function (num, digital) {
129
181
  if (digital === void 0) { digital = 2; }
130
182
  var result;
@@ -152,6 +204,17 @@ var formatChinese = function (num, digital) {
152
204
  return result + unit;
153
205
  };
154
206
  exports.formatChinese = formatChinese;
207
+ /**
208
+ * 根据指定的数字格式类型返回格式化函数
209
+ *
210
+ * @param type - 数字格式类型
211
+ * @param fix - 小数位数(可选)
212
+ * @returns 按照指定类型格式化数字的函数
213
+ *
214
+ * @example
215
+ * const formatter = getFormater('usd');
216
+ * formatter(12345) => '12,345'
217
+ */
155
218
  var getFormater = function (type, fix) {
156
219
  switch (type) {
157
220
  case 'number':
@@ -178,6 +241,15 @@ var getFormater = function (type, fix) {
178
241
  }
179
242
  };
180
243
  exports.getFormater = getFormater;
244
+ /**
245
+ * 将日期字符串或时间戳格式化为YYYY-MM-DD
246
+ *
247
+ * @param str - 日期字符串或时间戳
248
+ * @returns 格式化的日期字符串,无效则返回空字符串
249
+ *
250
+ * @example
251
+ * formatDate('2023-01-15T12:30:45') => '2023-01-15'
252
+ */
181
253
  var formatDate = function (str) {
182
254
  var date = (0, dayjs_1.default)(str);
183
255
  if (date.isValid())
@@ -185,6 +257,15 @@ var formatDate = function (str) {
185
257
  return '';
186
258
  };
187
259
  exports.formatDate = formatDate;
260
+ /**
261
+ * 将日期字符串或时间戳格式化为YYYY-MM-DD HH:mm:ss
262
+ *
263
+ * @param str - 日期字符串或时间戳
264
+ * @returns 格式化的日期时间字符串,无效则返回空字符串
265
+ *
266
+ * @example
267
+ * formatDateTime('2023-01-15T12:30:45') => '2023-01-15 12:30:45'
268
+ */
188
269
  var formatDateTime = function (str) {
189
270
  var date = (0, dayjs_1.default)(str);
190
271
  if (date.isValid())
@@ -192,6 +273,15 @@ var formatDateTime = function (str) {
192
273
  return '';
193
274
  };
194
275
  exports.formatDateTime = formatDateTime;
276
+ /**
277
+ * 对身份证号码进行隐私保护处理
278
+ *
279
+ * @param str - 身份证号码字符串
280
+ * @returns 中间部分被隐藏的身份证号码
281
+ *
282
+ * @example
283
+ * maskIdCard('123456789012345678') => '12345*******678'
284
+ */
195
285
  var maskIdCard = function (str) {
196
286
  if (!lodash_1.default.isString(str) || str == null)
197
287
  return '';
@@ -200,6 +290,16 @@ var maskIdCard = function (str) {
200
290
  return str.substring(0, 5) + '*******' + str.substring(str.length - 3);
201
291
  };
202
292
  exports.maskIdCard = maskIdCard;
293
+ /**
294
+ * 对电话号码进行隐私保护处理
295
+ *
296
+ * @param str - 电话号码字符串
297
+ * @returns 中间部分被隐藏的电话号码
298
+ *
299
+ * @example
300
+ * maskPhone('1234567890') => '123****7890'
301
+ * maskPhone('123-4567890') => '123***890'
302
+ */
203
303
  var maskPhone = function (str) {
204
304
  if (!lodash_1.default.isString(str) || str == null)
205
305
  return '';
@@ -211,6 +311,15 @@ var maskPhone = function (str) {
211
311
  return str.substring(0, 3) + '****' + str.substring(str.length - 4);
212
312
  };
213
313
  exports.maskPhone = maskPhone;
314
+ /**
315
+ * 对电子邮件地址进行隐私保护处理
316
+ *
317
+ * @param str - 电子邮件地址字符串
318
+ * @returns 账户部分和域名部分被部分隐藏的电子邮件
319
+ *
320
+ * @example
321
+ * maskEmail('user@example.com') => 'us*********@***********.com'
322
+ */
214
323
  var maskEmail = function (str) {
215
324
  if (!lodash_1.default.isString(str) || str == null)
216
325
  return '';
package/utils/Global.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Language } from './_Support';
2
- import type { PlainObject } from '../basetype';
2
+ import type { PlainObject, BaseOption } from '../basetype';
3
3
  import type { TableSize } from 'antd/es/table';
4
4
  /**
5
5
  * 全局定义
@@ -88,9 +88,30 @@ export type GlobalSetting = {
88
88
  data: string;
89
89
  };
90
90
  AJAX: {
91
+ /**
92
+ * 是否禁用缓存,默认false
93
+ * 设置为 true 后,Ajax.GET 将不进行缓存判断
94
+ * 说明: VAP 内置此功能,使用 /XX/?__DISABLE_CACHE=1 可禁用
95
+ */
96
+ disableCache: boolean;
97
+ /**
98
+ * Ajax 超时时间,单位:ms ,默认为 15000 = 15秒
99
+ */
91
100
  timeout: number;
101
+ /**
102
+ * 发送前拦截处理
103
+ */
92
104
  beforeSend: (url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', headers: HeadersInit, query: PlainObject) => [string, 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', HeadersInit, PlainObject];
93
- beforeReceive: () => [];
105
+ /**
106
+ * beforeReceive :
107
+ * 异步方法 (返回 Promise<结果>, 一般使用 async 方法)
108
+ * 例如 :
109
+ * beforeReceive: async (resp)=>{
110
+ * let result: Result = await response.json();
111
+ * return result;
112
+ * } ,
113
+ */
114
+ beforeReceive: (response: Response, requestUrl: string, requestOption: RequestInit) => Promise<any>;
94
115
  headers: Record<string, string>;
95
116
  };
96
117
  DATE: {
@@ -191,6 +212,23 @@ export type GlobalSetting = {
191
212
  */
192
213
  POPUP_CLEAR_ONOPEN: boolean;
193
214
  };
215
+ SEARCHBAND: {
216
+ /**
217
+ * 默认列个数
218
+ */
219
+ DEFALULT_COL: 1 | 2 | 3;
220
+ /**
221
+ * 默认使用 fix 模式 , 默认为true
222
+ * 设为flase ,默认使用 tag模式
223
+ */
224
+ FIX_MODE: boolean;
225
+ /**
226
+ * FIX 模式时, action 出现在左边还是右边
227
+ * 放左边(默认)时, 体验上可能会更符合人类直觉.
228
+ * 因vap内的 action 都出现在右边,所以放在右边有较好的一致性.
229
+ */
230
+ FIX_ACTION_POSTION: 'left' | 'right';
231
+ };
194
232
  GRID: {
195
233
  GUTTER: [number, number];
196
234
  };
@@ -267,6 +305,12 @@ export type GlobalSetting = {
267
305
  */
268
306
  UNSELECT_ON_QUERY: boolean;
269
307
  };
308
+ LIST: {
309
+ /**
310
+ * 说明 , 这个选项必须是 支持的list 字串的数组,如果没有,则会忽略
311
+ */
312
+ LAYOUT_ORDER: BaseOption[];
313
+ };
270
314
  PAGINATION: {
271
315
  SIZE: 'default' | 'small';
272
316
  /**
package/utils/Global.js CHANGED
@@ -60,14 +60,22 @@ var DEFAULT = {
60
60
  VLIST: { list: 'list', total: 'total', totalAcc: 'totalAcc', start: 'start_', count: 'count_', order: 'order_', by: 'by_' },
61
61
  VDATA: { data: 'data' },
62
62
  BOX: { SELECT_CLOSE: 2 },
63
- AJAX: { timeout: 30000, beforeSend: null, beforeReceive: null, headers: { 'Content-Type': 'application/json' } },
63
+ AJAX: {
64
+ timeout: 30000,
65
+ beforeSend: null,
66
+ beforeReceive: null,
67
+ headers: { 'Content-Type': 'application/json' },
68
+ disableCache: false,
69
+ },
64
70
  UPLOAD: {
65
71
  API: '/api-common/file/upload',
66
72
  PREVIEW: '/api-common/file/show/',
67
73
  UPLOAD_PARAM: true,
68
74
  },
69
75
  SEARCHBAR: {
70
- REVERSE: false, USE_MODAL: false, DISABLE_KEYWORD: false,
76
+ REVERSE: false,
77
+ USE_MODAL: false,
78
+ DISABLE_KEYWORD: false,
71
79
  FIELD_AWAYS_OUTSIDE: false,
72
80
  AWAYS_EXPAND: false,
73
81
  FIELD_LABEL_WIDTH: 80,
@@ -79,11 +87,25 @@ var DEFAULT = {
79
87
  POPUP_BUTTONS_POSITION: 'left',
80
88
  POPUP_CLEAR_ONOPEN: false,
81
89
  },
90
+ SEARCHBAND: {
91
+ DEFALULT_COL: 2,
92
+ FIX_MODE: true,
93
+ FIX_ACTION_POSTION: 'left',
94
+ },
82
95
  TABLE: {
83
96
  SIZE: 'small',
84
97
  REQUERY_ON_DELETE: false,
85
98
  UNSELECT_ON_QUERY: false,
86
99
  },
100
+ LIST: {
101
+ LAYOUT_ORDER: [
102
+ { label: '宫格', value: 'grids', icon: 'appstore' },
103
+ { label: '字段平铺', value: 'fields', icon: 'unordered-list' },
104
+ { label: '表格', value: 'columns', icon: 'table' },
105
+ { label: '行模式', value: 'row', icon: 'menu' },
106
+ { label: '时间轴', value: 'timeline', icon: 'history' },
107
+ ],
108
+ },
87
109
  DATE: {
88
110
  DATE_FORMAT: 'YYYY-MM-DD',
89
111
  DATE_TIME_FORMAT: 'YYYY-MM-DD HH:mm:ss',