vap1 0.4.7 → 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 (332) hide show
  1. package/base.json +30 -0
  2. package/basetype.d.ts +0 -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 +42 -6
  94. package/components/Box/Box.js +66 -16
  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/SearchTool/SearchBar/ActionButtons.js +17 -7
  143. package/components/SearchTool/SearchBar/ByField.d.ts +1 -1
  144. package/components/SearchTool/SearchBar/ByField.js +17 -7
  145. package/components/SearchTool/SearchBar/ByKeyword.d.ts +1 -1
  146. package/components/SearchTool/SearchBar/ByKeyword.js +17 -7
  147. package/components/SearchTool/SearchBar/SearchField.d.ts +1 -1
  148. package/components/SearchTool/SearchBar/_register.d.ts +1 -1
  149. package/components/SearchTool/SearchBar/index.d.ts +1 -65
  150. package/components/SearchTool/SearchBar/type.d.ts +133 -0
  151. package/components/SearchTool/SearchBar/type.js +35 -0
  152. package/components/SearchTool/index.d.ts +5 -63
  153. package/components/SearchTool/index.js +5 -0
  154. package/components/Tables/ApiTable.d.ts +5 -7
  155. package/components/Tables/ApiTable.js +17 -7
  156. package/components/Tables/ApiTableModal.d.ts +5 -7
  157. package/components/Tables/ApiTableModal.js +17 -7
  158. package/components/Tables/Components/ActionBar.d.ts +7 -10
  159. package/components/Tables/Components/ActionBar.js +73 -40
  160. package/components/Tables/Components/Actions.d.ts +3 -1
  161. package/components/Tables/Components/Actions.js +40 -3
  162. package/components/Tables/Components/index.d.ts +3 -1
  163. package/components/Tables/Components/useTableContext.d.ts +16 -0
  164. package/components/Tables/Components/useTableContext.js +116 -0
  165. package/components/Tables/STable.js +17 -7
  166. package/components/Tables/TopTable.js +17 -7
  167. package/components/Tables/Util.d.ts +2 -2
  168. package/components/Tables/Util.js +0 -1
  169. package/components/Tables/VTable.d.ts +9 -11
  170. package/components/Tables/VTable.js +119 -172
  171. package/components/Tables/VTableBack.d.ts +0 -0
  172. package/components/Tables/VTableBack.js +269 -0
  173. package/components/Tables/index.d.ts +11 -22
  174. package/components/TreeSelect/BaseTreeSelect.js +17 -7
  175. package/components/TreeSelect/DTreeSelect.js +19 -9
  176. package/components/TreeSelect/FTreeSelect.js +2 -2
  177. package/components/Trees/ActionTree.d.ts +3 -5
  178. package/components/Trees/ActionTree.js +19 -9
  179. package/components/Trees/BaseTree.js +17 -7
  180. package/components/Trees/COTree/COButton.js +17 -7
  181. package/components/Trees/COTree/COSelect.js +17 -7
  182. package/components/Trees/COTree/COTree.js +19 -9
  183. package/components/Trees/DTree.d.ts +0 -7
  184. package/components/Trees/DTree.js +19 -9
  185. package/components/Trees/FTree.js +19 -9
  186. package/components/Trees/STree.js +17 -7
  187. package/components/UForm/FormWrapper.js +17 -7
  188. package/components/UForm/UDescriptions.d.ts +2 -3
  189. package/components/UForm/UDescriptions.js +17 -7
  190. package/components/UForm/UForm.d.ts +1 -1
  191. package/components/UForm/UForm.js +24 -11
  192. package/components/UForm/UFormModal.js +19 -9
  193. package/components/UForm/_input.d.ts +5 -1
  194. package/components/UForm/_input.js +25 -8
  195. package/components/Upload/UploadImage.js +17 -7
  196. package/components/Upload/UploadModal.js +19 -9
  197. package/components/Upload/useUpload.js +2 -2
  198. package/components/_adapt/Alert.js +17 -7
  199. package/components/_adapt/ColorPicker.js +17 -7
  200. package/components/_adapt/Drawer.js +17 -7
  201. package/components/_adapt/Dropdown.js +17 -7
  202. package/components/_adapt/FloatButton.js +17 -7
  203. package/components/_adapt/Input.js +17 -7
  204. package/components/_adapt/InputNumber.js +17 -7
  205. package/components/_adapt/Layout.js +17 -7
  206. package/components/_adapt/Menu.js +17 -7
  207. package/components/_adapt/Modal.js +17 -7
  208. package/components/_adapt/Popconfirm.js +17 -7
  209. package/components/_adapt/Popover.js +17 -7
  210. package/components/_adapt/Progress.js +17 -7
  211. package/components/_adapt/Select.js +17 -7
  212. package/components/_adapt/Table.js +17 -7
  213. package/components/_adapt/Tabs.js +17 -7
  214. package/components/_adapt/Tag.js +17 -7
  215. package/components/_adapt/TreeSelect.js +17 -7
  216. package/components/_adapt/todo/Image.d.ts +0 -1
  217. package/components/_adapt/todo/Segmented.d.ts +0 -1
  218. package/components/_common/AutoComplete.js +35 -12
  219. package/components/_common/CountUp.js +17 -7
  220. package/components/_common/DateRange.d.ts +5 -2
  221. package/components/_common/DateRange.js +43 -40
  222. package/components/_common/HighLight.d.ts +1 -1
  223. package/components/_common/HighLight.js +26 -24
  224. package/components/_common/Loading.js +17 -7
  225. package/components/_common/MonthRange.js +17 -7
  226. package/components/_common/PromiseLabel.js +2 -2
  227. package/components/_common/UTitle.js +17 -7
  228. package/components/_common/Upagination.d.ts +1 -0
  229. package/components/_common/Upagination.js +5 -1
  230. package/components/_i18n.d.ts +1 -102
  231. package/components/index.js +4 -0
  232. package/deps/JsonView.js +17 -7
  233. package/deps/app-audit/LookUp.js +19 -9
  234. package/deps/app-data/useSource.js +19 -9
  235. package/deps/echarts.d.ts +3 -0
  236. package/deps/echarts.js +20 -10
  237. package/deps/editor/Article.js +17 -7
  238. package/deps/editor/Editor.js +17 -7
  239. package/deps/editor/EditorModal.js +17 -7
  240. package/deps/editor/support/buttons/ImageButton.js +17 -7
  241. package/deps/editor/tools/Button.js +0 -2
  242. package/deps/editor/tools/_TxtButton.js +17 -7
  243. package/deps/vapc/_basic.d.ts +1 -0
  244. package/deps/vapc/_basic.js +15 -0
  245. package/deps/vapc/index.d.ts +10 -0
  246. package/deps/vapc/index.js +70 -0
  247. package/hooks/useAjaxAction.js +2 -2
  248. package/hooks/useAjaxQuery.js +2 -2
  249. package/hooks/useApiBase.js +2 -2
  250. package/hooks/useApiGlobal.js +1 -1
  251. package/hooks/useArray.js +2 -2
  252. package/hooks/useDefault.d.ts +0 -1
  253. package/hooks/useDoLoad.d.ts +1 -1
  254. package/hooks/useError.d.ts +1 -1
  255. package/hooks/useMemoPromise.js +2 -2
  256. package/index.d.ts +2 -1
  257. package/login/Base65.d.ts +7 -1
  258. package/login/Base65.js +49 -22
  259. package/login/Password.d.ts +8 -5
  260. package/login/Password.js +68 -102
  261. package/package.json +1 -1
  262. package/screen/Page.js +17 -7
  263. package/screen/vapc-schema/dark.d.ts +1 -0
  264. package/screen/vapc-schema/dark.js +50 -0
  265. package/screen/vapc-schema/insight.d.ts +1 -0
  266. package/screen/vapc-schema/insight.js +49 -0
  267. package/uform/FormEditor.js +17 -7
  268. package/uform/FormViewer.js +17 -7
  269. package/uform/hooks/useEditor.d.ts +0 -1
  270. package/uform/hooks/useForm.d.ts +0 -1
  271. package/uform/inputs/index.d.ts +0 -1
  272. package/uform/panel/Editor/_GroupDefault.js +17 -7
  273. package/uform/panel/Editor/_GroupStep.js +17 -7
  274. package/uform/panel/Editor/_GroupTab.js +17 -7
  275. package/uform/panel/Editor/index.js +17 -7
  276. package/uform/panel/Items/Fields.js +17 -7
  277. package/uform/panel/Items/InputSelector.js +17 -7
  278. package/uform/panel/Items/Inputs.js +17 -7
  279. package/uform/panel/Items/index.d.ts +1 -1
  280. package/uform/panel/Propreties/CanvasProperties.js +17 -7
  281. package/uform/panel/Propreties/Component/FieldPlugin.js +17 -7
  282. package/uform/panel/Propreties/Component/LinkAsyncFunction.js +17 -7
  283. package/uform/panel/Propreties/Component/LinkSyncFunction.js +17 -7
  284. package/uform/panel/Propreties/Component/Links.js +17 -7
  285. package/uform/panel/Propreties/Component/OptionTable.js +17 -7
  286. package/uform/panel/Propreties/Component/RegexpModal.js +17 -7
  287. package/uform/panel/Propreties/Component/Validate.js +17 -7
  288. package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +17 -7
  289. package/uform/panel/Propreties/Component/ValidateSyncFunction.js +17 -7
  290. package/uform/panel/Propreties/FieldOptions.js +17 -7
  291. package/uform/panel/Propreties/FieldProperties.js +17 -7
  292. package/uform/panel/Propreties/_ItemAdvance.js +17 -7
  293. package/uform/panel/Propreties/_ItemBase.js +17 -7
  294. package/uform/panel/Propreties/_ItemLink.js +17 -7
  295. package/uform/panel/Propreties/_ItemValidate.js +17 -7
  296. package/uform/schema.d.ts +1 -1
  297. package/uform/utils/Convert.js +2 -2
  298. package/utils/Ajax.d.ts +3 -0
  299. package/utils/Ajax.js +10 -7
  300. package/utils/CacheUtil.d.ts +1 -1
  301. package/utils/Const.js +17 -7
  302. package/utils/Format.d.ts +138 -14
  303. package/utils/Format.js +127 -13
  304. package/utils/Global.d.ts +12 -0
  305. package/utils/Global.js +7 -1
  306. package/utils/PageUtil.d.ts +111 -23
  307. package/utils/PageUtil.js +163 -28
  308. package/utils/Renders/ApiGetRender.js +20 -10
  309. package/utils/Renders/ApiPostRender.js +3 -3
  310. package/utils/Renders/CondictionRender.js +17 -7
  311. package/utils/Renders/DateRender.js +20 -2
  312. package/utils/Renders/ListRender.js +1 -1
  313. package/utils/Renders/NumberRender.js +24 -5
  314. package/utils/Renders/StringRender.js +81 -11
  315. package/utils/Renders/_define.d.ts +8 -7
  316. package/utils/Renders/_define.js +76 -17
  317. package/utils/StringUtil.d.ts +292 -62
  318. package/utils/StringUtil.js +310 -63
  319. package/utils/TreeUtil.js +14 -10
  320. package/utils/VAP.d.ts +26 -1
  321. package/utils/VAP.js +57 -0
  322. package/utils/_AjaxUtil.d.ts +1 -0
  323. package/utils/_AjaxUtil.js +70 -3
  324. package/utils/_Support.d.ts +2 -2
  325. package/utils/_Support.js +4 -2
  326. package/utils/crontab/crontabRender.js +0 -1
  327. package/utils/i18n.d.ts +13 -2
  328. package/utils/i18n.js +13 -2
  329. package/utils/index.d.ts +4 -0
  330. package/utils/index.js +19 -9
  331. package/components/SearchTool/_FieldType.d.ts +0 -8
  332. package/components/SearchTool/_FieldType.js +0 -51
@@ -28,21 +28,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  return (mod && mod.__esModule) ? mod : { "default": mod };
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.getFileType = exports.getSuffix = exports.getFileName = exports.getFloat = exports.getInteger = exports.getBoolean = exports.getString = exports.copy = exports.px = exports.replaceAll = exports.className = exports.searchText = exports.spellMatch = exports.trimLower = exports.isBoolean = exports.isBTCAddress = exports.uuid = exports.genKey = exports.isId = exports.isId15 = exports.isId18 = exports.REG_ID_15 = exports.REG_ID_18 = exports.isIP = exports.isIP6 = exports.isIP4 = exports.isPhone = exports.isMAC = exports.isURL = exports.isEmail = exports.isTelePhone = exports.isMobilePhone = exports.REG_PORT = exports.REG_URL = exports.REG_IPV6 = exports.REG_IPV4 = exports.LETTERS = exports.REG_TELEPHONE = exports.REG_PHONE = exports.REG_EMAIL = void 0;
31
+ exports.rise = exports.ratio = exports.getFileType = exports.getSuffix = exports.getFileName = exports.getFloat = exports.getInteger = exports.getBoolean = exports.getString = exports.copy = exports.px = exports.replaceAll = exports.className = exports.searchText = exports.spellMatch = exports.trimLower = exports.isBoolean = exports.isBTCAddress = exports.uuid = exports.genKey = exports.isId = exports.isId15 = exports.isId18 = exports.REG_ID_15 = exports.REG_ID_18 = exports.isIP = exports.isIP6 = exports.isIP4 = exports.isPhone = exports.isMAC = exports.isURL = exports.isEmail = exports.isTelePhone = exports.isMobilePhone = exports.REG_PORT = exports.REG_URL = exports.REG_IPV6 = exports.REG_IPV4 = exports.LETTERS = exports.REG_TELEPHONE = exports.REG_PHONE = exports.REG_EMAIL = void 0;
32
32
  var lodash_1 = __importDefault(require("lodash"));
33
33
  var dayjs_1 = __importDefault(require("dayjs"));
34
34
  var _Support_1 = require("./_Support");
35
35
  var py_1 = require("./py");
36
36
  Object.defineProperty(exports, "spellMatch", { enumerable: true, get: function () { return py_1.spellMatch; } });
37
37
  // import type { MatchPatterns } from './_Support';
38
+ /**
39
+ * 邮箱地址正则表达式
40
+ */
38
41
  exports.REG_EMAIL = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
42
+ /**
43
+ * 手机号码正则表达式
44
+ */
39
45
  exports.REG_PHONE = /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/; // https://github.com/validatorjs/validator.js/blob/master/src/lib/isMobilePhone.js
46
+ /**
47
+ * 固定电话正则表达式
48
+ */
40
49
  exports.REG_TELEPHONE = /^0\d{2,3}-[1-9]\d{6,7}$/;
50
+ /**
51
+ * 英文字母集合
52
+ */
41
53
  exports.LETTERS = new Set(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']);
42
54
  var IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
43
55
  var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
56
+ /**
57
+ * IPv4地址正则表达式
58
+ */
44
59
  exports.REG_IPV4 = new RegExp("^".concat(IPv4AddressFormat, "$"));
45
60
  var IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})';
61
+ /**
62
+ * IPv6地址正则表达式
63
+ */
46
64
  exports.REG_IPV6 = new RegExp('^(' +
47
65
  "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") +
48
66
  "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") +
@@ -53,7 +71,13 @@ exports.REG_IPV6 = new RegExp('^(' +
53
71
  "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") +
54
72
  "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") +
55
73
  ')(%[0-9a-zA-Z-.:]{1,})?$');
74
+ /**
75
+ * URL地址正则表达式
76
+ */
56
77
  exports.REG_URL = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/;
78
+ /**
79
+ * 端口号正则表达式
80
+ */
57
81
  exports.REG_PORT = /TODO/;
58
82
  var macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
59
83
  var macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/;
@@ -63,46 +87,109 @@ var macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/;
63
87
  var macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;
64
88
  var s4 = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); };
65
89
  /**
66
- * 是否为一个手机号码
67
- */
90
+ * 判断是否为手机号码
91
+ * @param txt - 待验证的字符串
92
+ * @returns 是否为有效的手机号码
93
+ *
94
+ * @example
95
+ * isMobilePhone('13812345678') // => true
96
+ * isMobilePhone('1381234567') // => false
97
+ */
68
98
  var isMobilePhone = function (txt) { return exports.REG_PHONE.test(txt); };
69
99
  exports.isMobilePhone = isMobilePhone;
70
100
  /**
71
- * 是否为一个固话号码
72
- */
101
+ * 判断是否为固定电话号码
102
+ * @param txt - 待验证的字符串
103
+ * @returns 是否为有效的固定电话号码
104
+ *
105
+ * @example
106
+ * isTelePhone('010-12345678') // => true
107
+ * isTelePhone('010123456789') // => false
108
+ */
73
109
  var isTelePhone = function (txt) { return exports.REG_TELEPHONE.test(txt); };
74
110
  exports.isTelePhone = isTelePhone;
75
111
  /**
76
- * 是否为一个Email地址
77
- */
112
+ * 判断是否为Email地址
113
+ * @param txt - 待验证的字符串
114
+ * @returns 是否为有效的Email地址
115
+ *
116
+ * @example
117
+ * isEmail('user@example.com') // => true
118
+ * isEmail('invalid.email') // => false
119
+ */
78
120
  var isEmail = function (txt) { return exports.REG_EMAIL.test(txt); };
79
121
  exports.isEmail = isEmail;
80
122
  /**
81
- * 是否为一个URL地址
82
- */
123
+ * 判断是否为URL地址
124
+ * @param txt - 待验证的字符串
125
+ * @returns 是否为有效的URL地址
126
+ *
127
+ * @example
128
+ * isURL('https://www.example.com') // => true
129
+ * isURL('invalid-url') // => false
130
+ */
83
131
  var isURL = function (txt) { return exports.REG_URL.test(txt); };
84
132
  exports.isURL = isURL;
85
133
  /**
86
- * 是否为一个Mac地址
87
- */
134
+ * 判断是否为MAC地址
135
+ * @param txt - 待验证的字符串
136
+ * @returns 是否为有效的MAC地址
137
+ *
138
+ * @example
139
+ * isMAC('00:11:22:33:44:55') // => true
140
+ * isMAC('00-11-22-33-44-55') // => true
141
+ * isMAC('001122334455') // => true
142
+ * isMAC('invalid-mac') // => false
143
+ */
88
144
  var isMAC = function (txt) { return macAddress48.test(txt) || macAddress48WithDots.test(txt)
89
145
  || macAddress64.test(txt) || macAddress64WithDots.test(txt)
90
146
  || macAddress48NoSeparators.test(txt) || macAddress64NoSeparators.test(txt); };
91
147
  exports.isMAC = isMAC;
92
148
  /**
93
- * 是否为一个电话号码,支持固定电话和手机
94
- */
149
+ * 判断是否为电话号码(支持固定电话和手机)
150
+ * @param txt - 待验证的字符串
151
+ * @returns 是否为有效的电话号码
152
+ *
153
+ * @example
154
+ * isPhone('13812345678') // => true
155
+ * isPhone('010-12345678') // => true
156
+ * isPhone('invalid-phone') // => false
157
+ */
95
158
  var isPhone = function (txt) { return (0, exports.isMobilePhone)(txt) || (0, exports.isTelePhone)(txt); };
96
159
  exports.isPhone = isPhone;
160
+ /**
161
+ * 判断是否为IPv4地址
162
+ * @param str - 待验证的字符串
163
+ * @returns 是否为有效的IPv4地址
164
+ *
165
+ * @example
166
+ * isIP4('192.168.1.1') // => true
167
+ * isIP4('256.1.2.3') // => false
168
+ */
97
169
  var isIP4 = function (str) { return exports.REG_IPV4.test(str); };
98
170
  exports.isIP4 = isIP4;
171
+ /**
172
+ * 判断是否为IPv6地址
173
+ * @param str - 待验证的字符串
174
+ * @returns 是否为有效的IPv6地址
175
+ *
176
+ * @example
177
+ * isIP6('2001:0db8:85a3:0000:0000:8a2e:0370:7334') // => true
178
+ * isIP6('invalid-ipv6') // => false
179
+ */
99
180
  var isIP6 = function (str) { return exports.REG_IPV6.test(str); };
100
181
  exports.isIP6 = isIP6;
101
182
  /**
102
- * 判断是否是一个 IP 地址,默认
103
- * @param str : 要判断的字符串
104
- * @param version : IP版本,默认为 IP4, 如果要同时 46, 传 空字串 :''
105
- */
183
+ * 判断是否为IP地址
184
+ * @param str - 待验证的字符串
185
+ * @param version - IP版本('4'|'6'|''),默认为'4'。空字符串表示同时支持IPv4和IPv6
186
+ * @returns 是否为有效的IP地址
187
+ *
188
+ * @example
189
+ * isIP('192.168.1.1', '4') // => true
190
+ * isIP('2001:0db8:85a3:0000:0000:8a2e:0370:7334', '6') // => true
191
+ * isIP('192.168.1.1', '') // => true
192
+ */
106
193
  var isIP = function (str, version) {
107
194
  if (version === void 0) { version = ''; }
108
195
  switch (version) {
@@ -129,10 +216,16 @@ var ID_FACTORS = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
129
216
  // 校验码对应值
130
217
  var ID_CODES = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", '2'];
131
218
  /**
132
- * 判断是否是一个18位身份证号
133
- * @param txt : 要判断的字符串
134
- * @param strict : 是否开启严格校验,默认开启
135
- */
219
+ * 判断是否为18位身份证号
220
+ * @param txt - 待验证的字符串
221
+ * @param strict - 是否开启严格校验,默认为true
222
+ * @returns 是否为有效的18位身份证号
223
+ *
224
+ * @example
225
+ * isId18('110101199001011234') // => true
226
+ * isId18('11010119900101123X') // => true
227
+ * isId18('invalid-id', false) // => false
228
+ */
136
229
  var isId18 = function (txt, strict) {
137
230
  if (strict === void 0) { strict = true; }
138
231
  var isFormat = exports.REG_ID_18.test(txt);
@@ -156,12 +249,15 @@ var isId18 = function (txt, strict) {
156
249
  };
157
250
  exports.isId18 = isId18;
158
251
  /**
159
- * 判断是否是一个15位身份证号
160
- * @param txt : 要判断的字符串
161
- * @param strict : 是否开启严格校验,默认开启,
162
- * 15位身份证号,只会判定省份与年份,不检验哈希,性别
252
+ * 判断是否为15位身份证号
253
+ * @param txt - 待验证的字符串
254
+ * @param strict - 是否开启严格校验,默认为true
255
+ * @returns 是否为有效的15位身份证号
163
256
  *
164
- */
257
+ * @example
258
+ * isId15('110101900101123') // => true
259
+ * isId15('invalid-id', false) // => false
260
+ */
165
261
  var isId15 = function (txt, strict) {
166
262
  if (strict === void 0) { strict = true; }
167
263
  var isFormat = exports.REG_ID_15.test(txt);
@@ -179,10 +275,16 @@ var isId15 = function (txt, strict) {
179
275
  };
180
276
  exports.isId15 = isId15;
181
277
  /**
182
- * 判断是否是一个身份证号,支持18位和15
183
- * @param txt : 要判断的字符串
184
- * @param strict : 是否开启严格校验,默认开启
185
- */
278
+ * 判断是否为身份证号(支持15位和18位)
279
+ * @param txt - 待验证的字符串
280
+ * @param strict - 是否开启严格校验,默认为true
281
+ * @returns 是否为有效的身份证号
282
+ *
283
+ * @example
284
+ * isId('110101199001011234') // => true
285
+ * isId('110101900101123') // => true
286
+ * isId('invalid-id', false) // => false
287
+ */
186
288
  var isId = function (txt, strict) {
187
289
  if (strict === void 0) { strict = true; }
188
290
  return (0, exports.isId18)(txt, strict) || (0, exports.isId15)(txt, strict);
@@ -191,8 +293,12 @@ exports.isId = isId;
191
293
  var MULTIPLIER = Math.pow(2, 20);
192
294
  var seenKeys = {};
193
295
  /**
194
- * 生成一个唯一 ID 标识
195
- */
296
+ * 生成唯一ID标识
297
+ * @returns 生成的唯一ID字符串
298
+ *
299
+ * @example
300
+ * genKey() // => "1a2b3c"
301
+ */
196
302
  var genKey = function () {
197
303
  var key = void 0;
198
304
  while (key === undefined || seenKeys.hasOwnProperty(key) || !isNaN(+key)) {
@@ -203,32 +309,59 @@ var genKey = function () {
203
309
  };
204
310
  exports.genKey = genKey;
205
311
  /**
206
- * 生成uuid
207
- */
312
+ * 生成UUID
313
+ * @returns 生成的UUID字符串
314
+ *
315
+ * @example
316
+ * uuid() // => "550e8400-e29b-41d4-a716-446655440000"
317
+ */
208
318
  var uuid = function () { return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4(); };
209
319
  exports.uuid = uuid;
210
320
  var REG_BTC32 = /^(bc1)[a-z0-9]{25,39}$/;
211
321
  var REG_BTC58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;
212
322
  /**
213
- * 是否是一个 BTC 地址
214
- */
323
+ * 判断是否为BTC地址
324
+ * @param str - 待验证的字符串
325
+ * @returns 是否为有效的BTC地址
326
+ *
327
+ * @example
328
+ * isBTCAddress('1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2') // => true
329
+ * isBTCAddress('invalid-address') // => false
330
+ */
215
331
  var isBTCAddress = function (str) { return REG_BTC32.test(str) || REG_BTC58.test(str); };
216
332
  exports.isBTCAddress = isBTCAddress;
217
333
  /**
218
- * 说明:不能判断 变量类型,为 vap 内置识别方法
219
- * 可为 Boolean 的有字符串有 0 / 1 / true / false / yes / no
220
- * 通过 getBoolean 可获取到对应的 bool 值
221
- */
334
+ * 判断字符串是否可以转换为布尔值
335
+ * @param str - 待验证的字符串
336
+ * @returns 是否可以转换为布尔值
337
+ *
338
+ * @example
339
+ * isBoolean('true') // => true
340
+ * isBoolean('yes') // => true
341
+ * isBoolean('0') // => true
342
+ * isBoolean('invalid') // => false
343
+ */
222
344
  var isBoolean = function (str) { return _Support_1.TRUE_SET.has(str) || _Support_1.FALSE_SET.has(str); };
223
345
  exports.isBoolean = isBoolean;
224
346
  /**
225
- * 清空首尾空格,并小写
226
- */
347
+ * 清空字符串首尾空格并转换为小写
348
+ * @param str - 输入字符串
349
+ * @returns 处理后的字符串
350
+ *
351
+ * @example
352
+ * trimLower(' Hello World ') // => "hello world"
353
+ */
227
354
  var trimLower = function (str) { return lodash_1.default.toLower(lodash_1.default.trim(str)); };
228
355
  exports.trimLower = trimLower;
229
356
  /**
230
- * 搜索,用于高亮,通常与 HighLight 结合使用,或只使用 HighLight 组件
231
- */
357
+ * 搜索文本并返回匹配结果,用于高亮显示
358
+ * @param sentence - 待搜索的文本
359
+ * @param keyword - 搜索关键词
360
+ * @returns 匹配结果数组
361
+ *
362
+ * @example
363
+ * searchText('Hello World', 'world') // => [{hit: false, text: 'Hello '}, {hit: true, text: 'World'}]
364
+ */
232
365
  var searchText = function (sentence, keyword) {
233
366
  var result = (0, py_1.spellMatch)(sentence, keyword);
234
367
  if (result.hit)
@@ -237,14 +370,30 @@ var searchText = function (sentence, keyword) {
237
370
  };
238
371
  exports.searchText = searchText;
239
372
  /**
240
- * 拼 className
241
- */
373
+ * 合并CSS类名
374
+ * @param base - 基础类名数组
375
+ * @param classNameProps - 额外的类名
376
+ * @returns 合并后的类名字符串
377
+ *
378
+ * @example
379
+ * className(['btn', 'primary'], 'large') // => "btn primary large"
380
+ */
242
381
  var className = function (base, classNameProps) {
243
382
  if (classNameProps)
244
383
  return __spreadArray(__spreadArray([], __read(base), false), [classNameProps], false).join(' ');
245
384
  return base.join(' ');
246
385
  };
247
386
  exports.className = className;
387
+ /**
388
+ * 替换字符串中所有匹配的内容
389
+ * @param text - 原始字符串
390
+ * @param keyword - 要替换的关键词或正则表达式
391
+ * @param replaceText - 替换后的文本
392
+ * @returns 替换后的字符串
393
+ *
394
+ * @example
395
+ * replaceAll('hello world', 'o', '0') // => "hell0 w0rld"
396
+ */
248
397
  var replaceAll = function (text, keyword, replaceText) {
249
398
  var reg = lodash_1.default.isRegExp(keyword) ? new RegExp(keyword, 'g') : new RegExp(keyword, "g");
250
399
  return lodash_1.default.replace(text, reg, replaceText);
@@ -252,9 +401,15 @@ var replaceAll = function (text, keyword, replaceText) {
252
401
  };
253
402
  exports.replaceAll = replaceAll;
254
403
  /**
255
- * 试图转px的值
256
- * 300px -> 300
257
- */
404
+ * 将字符串转换为像素值
405
+ * @param str - 输入的数字或字符串
406
+ * @returns 转换后的像素值数字
407
+ *
408
+ * @example
409
+ * px('300px') // => 300
410
+ * px(300) // => 300
411
+ * px('invalid') // => 0
412
+ */
258
413
  var px = function (str) {
259
414
  if (lodash_1.default.isNumber(str)) {
260
415
  return str;
@@ -271,11 +426,15 @@ var px = function (str) {
271
426
  };
272
427
  exports.px = px;
273
428
  /**
274
- * 复制字符串
275
- */
429
+ * 复制文本到剪贴板
430
+ * @param text - 要复制的文本
431
+ * @param onCopied - 复制成功后的回调函数
432
+ *
433
+ * @example
434
+ * copy('Hello World', (text) => console.log(`Copied: ${text}`))
435
+ */
276
436
  var copy = function (text, onCopied) {
277
437
  var input = document.createElement('textarea');
278
- // input.setAttribute('readonly', 'readonly'); // 防止手机上弹出软键盘
279
438
  input.value = text;
280
439
  input.setAttribute('value', text);
281
440
  document.body.appendChild(input);
@@ -289,8 +448,15 @@ var copy = function (text, onCopied) {
289
448
  };
290
449
  exports.copy = copy;
291
450
  /**
292
- * 获取字符串
293
- */
451
+ * 获取字符串值,空字符串返回默认值
452
+ * @param txt - 输入字符串
453
+ * @param defaultValue - 默认值
454
+ * @returns 处理后的字符串
455
+ *
456
+ * @example
457
+ * getString(' hello ') // => "hello"
458
+ * getString('', 'default') // => "default"
459
+ */
294
460
  var getString = function (txt, defaultValue) {
295
461
  var result = lodash_1.default.trim(txt);
296
462
  if (result.length)
@@ -300,7 +466,15 @@ var getString = function (txt, defaultValue) {
300
466
  exports.getString = getString;
301
467
  /**
302
468
  * 获取布尔值
303
- */
469
+ * @param key - 输入字符串
470
+ * @param defaultValue - 默认值
471
+ * @returns 转换后的布尔值
472
+ *
473
+ * @example
474
+ * getBoolean('true') // => true
475
+ * getBoolean('yes') // => true
476
+ * getBoolean('invalid', true) // => true
477
+ */
304
478
  var getBoolean = function (key, defaultValue) {
305
479
  if (key === null || key === undefined)
306
480
  return defaultValue || false;
@@ -315,8 +489,15 @@ var getBoolean = function (key, defaultValue) {
315
489
  };
316
490
  exports.getBoolean = getBoolean;
317
491
  /**
318
- * 获取数字
319
- */
492
+ * 获取整数值
493
+ * @param txt - 输入字符串
494
+ * @param defaultValue - 默认值
495
+ * @returns 转换后的整数
496
+ *
497
+ * @example
498
+ * getInteger('123') // => 123
499
+ * getInteger('invalid', 0) // => 0
500
+ */
320
501
  var getInteger = function (txt, defaultValue) {
321
502
  if (txt === null || txt === undefined)
322
503
  return defaultValue || 0;
@@ -329,8 +510,15 @@ var getInteger = function (txt, defaultValue) {
329
510
  };
330
511
  exports.getInteger = getInteger;
331
512
  /**
332
- * 获取浮点数
333
- */
513
+ * 获取浮点数值
514
+ * @param txt - 输入字符串
515
+ * @param defaultValue - 默认值
516
+ * @returns 转换后的浮点数
517
+ *
518
+ * @example
519
+ * getFloat('123.45') // => 123.45
520
+ * getFloat('invalid', 0) // => 0
521
+ */
334
522
  var getFloat = function (txt, defaultValue) {
335
523
  if (txt === null || txt === undefined)
336
524
  return defaultValue || 0;
@@ -342,6 +530,14 @@ var getFloat = function (txt, defaultValue) {
342
530
  }
343
531
  };
344
532
  exports.getFloat = getFloat;
533
+ /**
534
+ * 获取文件名
535
+ * @param uri - 文件路径
536
+ * @returns 文件名
537
+ *
538
+ * @example
539
+ * getFileName('/path/to/file.txt') // => "file.txt"
540
+ */
345
541
  var getFileName = function (uri) {
346
542
  var idx = lodash_1.default.lastIndexOf(uri, '/');
347
543
  if (idx >= 0)
@@ -350,8 +546,13 @@ var getFileName = function (uri) {
350
546
  };
351
547
  exports.getFileName = getFileName;
352
548
  /**
353
- * 获取文件后缀名,并以小写的形式返回
354
- */
549
+ * 获取文件后缀名
550
+ * @param fileName - 文件名
551
+ * @returns 小写的文件后缀名
552
+ *
553
+ * @example
554
+ * getSuffix('image.JPG') // => "jpg"
555
+ */
355
556
  var getSuffix = function (fileName) {
356
557
  if (fileName == '' || fileName == null)
357
558
  return '';
@@ -360,8 +561,14 @@ var getSuffix = function (fileName) {
360
561
  };
361
562
  exports.getSuffix = getSuffix;
362
563
  /**
363
- * 获取文件类及 icon
364
- */
564
+ * 获取文件类型和对应的图标
565
+ * @param fileName - 文件名
566
+ * @returns [文件类型, 图标名称]
567
+ *
568
+ * @example
569
+ * getFileType('document.pdf') // => ['pdf', 'file-pdf']
570
+ * getFileType('image.jpg') // => ['image', 'file-image']
571
+ */
365
572
  var getFileType = function (fileName) {
366
573
  var type = (0, exports.getSuffix)(fileName);
367
574
  if (type == '')
@@ -387,6 +594,8 @@ var getFileType = function (fileName) {
387
594
  case 'ppt':
388
595
  case 'pptx':
389
596
  return ['ppt', 'file-ppt'];
597
+ case 'xml':
598
+ return ['xml', 'file-text'];
390
599
  case 'zip':
391
600
  case 'rar':
392
601
  case '7z':
@@ -413,3 +622,41 @@ var getFileType = function (fileName) {
413
622
  }
414
623
  };
415
624
  exports.getFileType = getFileType;
625
+ /**
626
+ * 计算占比
627
+ * @param count - 分子
628
+ * @param total - 分母
629
+ * @returns 比率(0-1之间的小数)
630
+ *
631
+ * @example
632
+ * ratio(4, 10) // => 0.4
633
+ * ratio(0, 10) // => 0
634
+ */
635
+ var ratio = function (count, total) {
636
+ if (count == 0)
637
+ return 0;
638
+ if (total == 0)
639
+ return 1;
640
+ return count / total;
641
+ };
642
+ exports.ratio = ratio;
643
+ /**
644
+ * 计算增长率
645
+ * @param current - 当前值
646
+ * @param prev - 上一个值
647
+ * @returns 增长率(-1到1之间的小数)
648
+ *
649
+ * @example
650
+ * rise(120, 100) // => 0.2
651
+ * rise(80, 100) // => -0.2
652
+ */
653
+ var rise = function (current, prev) {
654
+ if (current == prev)
655
+ return 0;
656
+ if (prev == 0)
657
+ return 1;
658
+ if (current == 0)
659
+ return -1;
660
+ return (current - prev) / prev;
661
+ };
662
+ exports.rise = rise;
package/utils/TreeUtil.js CHANGED
@@ -80,7 +80,7 @@ var buildFlatTree = function (props, data) {
80
80
  return data;
81
81
  }
82
82
  var parentField = props.parentField, sortField = props.sortField, keyField = props.keyField;
83
- var root = data.filter(function (item) { return item[parentField] == (props.rootCode || '0'); });
83
+ var root = data.filter(function (item) { return item[parentField] == (lodash_1.default.has(props, 'rootCode') ? props.rootCode : '0'); });
84
84
  if (sortField) {
85
85
  root = lodash_1.default.orderBy(root, sortField, 'asc');
86
86
  }
@@ -88,13 +88,25 @@ var buildFlatTree = function (props, data) {
88
88
  return root;
89
89
  };
90
90
  exports.buildFlatTree = buildFlatTree;
91
+ var loopTree = function (tree, callback, position) {
92
+ if (position === void 0) { position = []; }
93
+ tree.map(function (node, idx) {
94
+ callback(node, __spreadArray(__spreadArray([], __read(position), false), [idx], false));
95
+ if (node.children && node.children.length)
96
+ loopTree(node.children, callback, __spreadArray(__spreadArray([], __read(position), false), [idx], false));
97
+ });
98
+ };
91
99
  // 高性能树递归搜索
92
100
  var search = function (tree, word, titleField) {
93
101
  var keyword = (0, StringUtil_1.trimLower)(word);
94
102
  if (keyword == '' || keyword.length == 0)
95
103
  return { word: null, keyword: null, match: null };
96
104
  var searchPos = [];
97
- tree.map(function (node, idx) { return searchNode(node, [idx], keyword, searchPos, titleField); });
105
+ loopTree(tree, function (node, pos) {
106
+ var hited = (0, py_1.spellHit)(node[titleField], keyword);
107
+ if (hited.length > 0)
108
+ searchPos.push(pos.join('-'));
109
+ });
98
110
  var match = new Set();
99
111
  searchPos.map(function (pos) {
100
112
  var key = pos;
@@ -109,11 +121,3 @@ var search = function (tree, word, titleField) {
109
121
  return { word: word, keyword: keyword, match: match };
110
122
  };
111
123
  exports.search = search;
112
- var searchNode = function (node, pos, keyword, result, titleField) {
113
- var hited = (0, py_1.spellHit)(node[titleField], keyword);
114
- if (hited.length >= 0)
115
- result.push(pos.join('-'));
116
- if (node.children && node.children.length)
117
- searchNodes(node.children, pos, keyword, result, titleField);
118
- };
119
- var searchNodes = function (data, pos, keyword, result, titleField) { return data.map(function (item, idx) { return searchNode(item, __spreadArray(__spreadArray([], __read(pos), false), [idx], false), keyword, result, titleField); }); };
package/utils/VAP.d.ts CHANGED
@@ -1,11 +1,36 @@
1
+ /**
2
+ * VAP 是系统配置工具类,用于读取 xxx_conf 表的配置
3
+ */
1
4
  export type VAP = {
2
5
  KEYMAP: Map<string, string>;
3
6
  system_version: string;
7
+ /**
8
+ * 判断是否存在某个配置
9
+ */
4
10
  has: (key: string) => boolean;
5
- getConfig: (key: string) => string;
11
+ /**
12
+ * 更新配置
13
+ */
14
+ update: (key: string, value: string) => Promise<boolean>;
15
+ /**
16
+ * 获取配置 ,不存在时返回 null
17
+ */
18
+ getConfig: (key: string) => string | null;
19
+ /**
20
+ * 获取字符串配置, 不存在时返回默认值(默认空字符串)
21
+ */
6
22
  getString: (key: string, defaultValue?: string) => string;
23
+ /**
24
+ * 获取布尔配置
25
+ */
7
26
  getBoolean: (key: string, defaultValue?: boolean) => boolean;
27
+ /**
28
+ * 获取整数配置
29
+ */
8
30
  getInteger: (key: string, defaultValue?: number) => number;
31
+ /**
32
+ * 获取浮点数配置
33
+ */
9
34
  getFloat: (key: string, defaultValue?: number) => number;
10
35
  };
11
36
  declare const _VAP: VAP;