king-design-analyzer 2.1.7 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/components/actions.json +101 -0
  2. package/components/advancedset.json +127 -0
  3. package/components/affix.json +7 -0
  4. package/components/aksk.json +172 -0
  5. package/components/az.json +15 -2
  6. package/components/badge.json +7 -0
  7. package/components/billtypes.json +14 -2
  8. package/components/breadcrumb.json +7 -0
  9. package/components/button.json +191 -0
  10. package/components/buttonlink.json +73 -0
  11. package/components/card.json +8 -1
  12. package/components/cardcol.json +142 -0
  13. package/components/cardcols.json +121 -0
  14. package/components/cardcontent.json +15 -3
  15. package/components/cardtabs.json +172 -0
  16. package/components/carousel.json +7 -0
  17. package/components/cascader.json +520 -368
  18. package/components/checkbox.json +51 -4
  19. package/components/cidrinput.json +140 -0
  20. package/components/code.json +8 -1
  21. package/components/collapse.json +7 -0
  22. package/components/colorpicker.json +217 -0
  23. package/components/copy.json +7 -0
  24. package/components/copyhover.json +111 -0
  25. package/components/copyrow.json +124 -0
  26. package/components/datepicker.json +656 -524
  27. package/components/description.json +98 -0
  28. package/components/dialog.json +522 -455
  29. package/components/divider.json +8 -1
  30. package/components/drawer.json +571 -558
  31. package/components/dropdown.json +464 -384
  32. package/components/duration.json +125 -0
  33. package/components/editable.json +66 -0
  34. package/components/ellipsis.json +34 -1
  35. package/components/filtertablefieldsdialog.json +128 -0
  36. package/components/flex.json +151 -0
  37. package/components/form.json +131 -0
  38. package/components/formiteminput.json +214 -0
  39. package/components/formitemspinner.json +213 -0
  40. package/components/formitemswitch.json +185 -0
  41. package/components/formitemtableconfigs.json +210 -0
  42. package/components/grid.json +7 -0
  43. package/components/header.json +161 -0
  44. package/components/icon.json +13 -1
  45. package/components/icontooltip.json +19 -1
  46. package/components/input.json +188 -4
  47. package/components/instancelist.json +194 -0
  48. package/components/instancenum.json +196 -0
  49. package/components/ipinput.json +117 -0
  50. package/components/kspstatus.json +205 -0
  51. package/components/kvcode.json +120 -0
  52. package/components/layoutcontent.json +15 -3
  53. package/components/layoutlistcontent.json +148 -0
  54. package/components/layoutpermissioncontent.json +155 -0
  55. package/components/layoutstandardlist.json +275 -0
  56. package/components/layouttabs.json +168 -0
  57. package/components/lazymount.json +86 -0
  58. package/components/lazyteleport.json +118 -0
  59. package/components/menu.json +7 -0
  60. package/components/pagination.json +12 -0
  61. package/components/paginationplus.json +30 -3
  62. package/components/password.json +121 -0
  63. package/components/popover.json +457 -437
  64. package/components/projects.json +129 -0
  65. package/components/protable.json +97 -8
  66. package/components/queuevisualrange.json +110 -0
  67. package/components/radio.json +82 -2
  68. package/components/rate.json +199 -0
  69. package/components/region.json +14 -2
  70. package/components/search.json +221 -0
  71. package/components/searchinput.json +132 -0
  72. package/components/searchitems.json +215 -0
  73. package/components/searchselect.json +195 -0
  74. package/components/select.json +686 -666
  75. package/components/sidebar.json +198 -0
  76. package/components/skeleton.json +233 -0
  77. package/components/spin.json +8 -1
  78. package/components/split.json +260 -0
  79. package/components/sshkeys.json +138 -0
  80. package/components/status.json +60 -3
  81. package/components/steps.json +7 -0
  82. package/components/switch.json +8 -1
  83. package/components/table.json +18 -1
  84. package/components/tablecolumnid.json +14 -2
  85. package/components/tabs.json +12 -0
  86. package/components/timeline.json +213 -0
  87. package/components/timepicker.json +147 -3
  88. package/components/timerange.json +262 -0
  89. package/components/tip.json +7 -0
  90. package/components/tooltip.json +484 -395
  91. package/components/tour.json +418 -372
  92. package/components/transfer.json +27 -3
  93. package/components/tree.json +6 -4
  94. package/components/treeselect.json +556 -475
  95. package/components/upload.json +474 -473
  96. package/components/vdialog.json +308 -0
  97. package/components/vdrawer.json +331 -0
  98. package/components/virtuallist.json +7 -0
  99. package/dist/ast/index.d.mts +35 -1
  100. package/dist/ast/index.d.ts +35 -1
  101. package/dist/ast/index.js +5 -3
  102. package/dist/ast/index.mjs +3 -1
  103. package/dist/{chunk-DSWKLUIX.mjs → chunk-3LYQ5XFM.mjs} +1 -1
  104. package/dist/chunk-BI5TIQID.mjs +330 -0
  105. package/dist/{chunk-6QS5IGS6.js → chunk-CJGGFVQJ.js} +8 -8
  106. package/dist/chunk-CR3GC4H3.js +353 -0
  107. package/dist/{chunk-NZ6TLWMD.mjs → chunk-D2SXGGTX.mjs} +28 -17
  108. package/dist/{chunk-D3Y6FGWA.js → chunk-EYKZY2F3.js} +29 -18
  109. package/dist/chunk-JSBRDJBE.js +30 -0
  110. package/dist/chunk-KF5YBEM5.js +143 -0
  111. package/dist/chunk-KMIDURUR.mjs +33324 -0
  112. package/dist/chunk-QC6VTSA3.mjs +117 -0
  113. package/dist/chunk-SZYVGYKK.js +33350 -0
  114. package/dist/{chunk-WYSRJVX4.js → chunk-TA3SV4SP.js} +2 -2
  115. package/dist/chunk-UJCSKKID.mjs +27 -0
  116. package/dist/{chunk-FVSQ6BU6.mjs → chunk-XGPHQHLR.mjs} +4 -4
  117. package/dist/docs/index.js +1 -1
  118. package/dist/docs/index.mjs +1 -1
  119. package/dist/full/index.js +8 -6
  120. package/dist/full/index.mjs +6 -4
  121. package/dist/index.d.mts +1 -0
  122. package/dist/index.d.ts +1 -0
  123. package/dist/index.js +15 -13
  124. package/dist/index.mjs +7 -5
  125. package/dist/metadata/index.d.mts +22 -2
  126. package/dist/metadata/index.d.ts +22 -2
  127. package/dist/metadata/index.js +27 -17
  128. package/dist/metadata/index.mjs +27 -16
  129. package/dist/resolve-BsLBxlBi.d.mts +24 -0
  130. package/dist/resolve-BsLBxlBi.d.ts +24 -0
  131. package/dist/runtime/index.js +5 -4
  132. package/dist/runtime/index.mjs +3 -2
  133. package/dist/shared/index.d.mts +10 -0
  134. package/dist/shared/index.d.ts +10 -0
  135. package/dist/shared/index.js +23 -0
  136. package/dist/shared/index.mjs +2 -0
  137. package/dist/static/index.js +6 -5
  138. package/dist/static/index.mjs +3 -2
  139. package/docs_for_llm/actions.doc.md +77 -0
  140. package/docs_for_llm/advancedset.doc.md +89 -0
  141. package/docs_for_llm/affix.doc.md +15 -7
  142. package/docs_for_llm/aksk.doc.md +111 -0
  143. package/docs_for_llm/az.doc.md +17 -11
  144. package/docs_for_llm/badge.doc.md +6 -5
  145. package/docs_for_llm/billtypes.doc.md +17 -11
  146. package/docs_for_llm/breadcrumb.doc.md +6 -3
  147. package/docs_for_llm/button.doc.md +34 -18
  148. package/docs_for_llm/buttonlink.doc.md +55 -0
  149. package/docs_for_llm/card.doc.md +8 -5
  150. package/docs_for_llm/cardcol.doc.md +78 -0
  151. package/docs_for_llm/cardcols.doc.md +84 -0
  152. package/docs_for_llm/cardcontent.doc.md +10 -10
  153. package/docs_for_llm/cardtabs.doc.md +106 -0
  154. package/docs_for_llm/carousel.doc.md +8 -7
  155. package/docs_for_llm/cascader.doc.md +46 -25
  156. package/docs_for_llm/checkbox.doc.md +25 -13
  157. package/docs_for_llm/cidrinput.doc.md +83 -0
  158. package/docs_for_llm/code.doc.md +22 -11
  159. package/docs_for_llm/collapse.doc.md +9 -6
  160. package/docs_for_llm/colorpicker.doc.md +104 -0
  161. package/docs_for_llm/copy.doc.md +15 -13
  162. package/docs_for_llm/copyhover.doc.md +59 -0
  163. package/docs_for_llm/copyrow.doc.md +71 -0
  164. package/docs_for_llm/datepicker.doc.md +51 -39
  165. package/docs_for_llm/description.doc.md +75 -0
  166. package/docs_for_llm/descriptions.doc.md +9 -6
  167. package/docs_for_llm/dialog.doc.md +48 -77
  168. package/docs_for_llm/divider.doc.md +9 -7
  169. package/docs_for_llm/drawer.doc.md +43 -84
  170. package/docs_for_llm/dropdown.doc.md +52 -21
  171. package/docs_for_llm/duration.doc.md +76 -0
  172. package/docs_for_llm/editable.doc.md +36 -14
  173. package/docs_for_llm/ellipsis.doc.md +10 -5
  174. package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
  175. package/docs_for_llm/flex.doc.md +74 -0
  176. package/docs_for_llm/form.doc.md +33 -14
  177. package/docs_for_llm/formiteminput.doc.md +128 -0
  178. package/docs_for_llm/formitemspinner.doc.md +105 -0
  179. package/docs_for_llm/formitemswitch.doc.md +113 -0
  180. package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
  181. package/docs_for_llm/grid.doc.md +7 -5
  182. package/docs_for_llm/header.doc.md +85 -0
  183. package/docs_for_llm/icon.doc.md +12 -8
  184. package/docs_for_llm/icontooltip.doc.md +121 -0
  185. package/docs_for_llm/input.doc.md +90 -39
  186. package/docs_for_llm/instancelist.doc.md +113 -0
  187. package/docs_for_llm/instancenum.doc.md +95 -0
  188. package/docs_for_llm/ipinput.doc.md +77 -0
  189. package/docs_for_llm/kspstatus.doc.md +82 -0
  190. package/docs_for_llm/kvcode.doc.md +76 -0
  191. package/docs_for_llm/layoutcontent.doc.md +17 -17
  192. package/docs_for_llm/layoutlistcontent.doc.md +95 -0
  193. package/docs_for_llm/layoutpermissioncontent.doc.md +84 -0
  194. package/docs_for_llm/layoutstandardlist.doc.md +120 -0
  195. package/docs_for_llm/layouttabs.doc.md +101 -0
  196. package/docs_for_llm/lazymount.doc.md +73 -0
  197. package/docs_for_llm/lazyteleport.doc.md +76 -0
  198. package/docs_for_llm/menu.doc.md +14 -11
  199. package/docs_for_llm/message.doc.md +48 -10
  200. package/docs_for_llm/pagination.doc.md +30 -17
  201. package/docs_for_llm/paginationplus.doc.md +31 -10
  202. package/docs_for_llm/password.doc.md +86 -0
  203. package/docs_for_llm/popover.doc.md +24 -55
  204. package/docs_for_llm/progress.doc.md +13 -10
  205. package/docs_for_llm/projects.doc.md +91 -0
  206. package/docs_for_llm/protable.doc.md +89 -15
  207. package/docs_for_llm/queuevisualrange.doc.md +78 -0
  208. package/docs_for_llm/radio.doc.md +23 -8
  209. package/docs_for_llm/rate.doc.md +122 -0
  210. package/docs_for_llm/region.doc.md +25 -13
  211. package/docs_for_llm/search.doc.md +120 -0
  212. package/docs_for_llm/searchinput.doc.md +111 -0
  213. package/docs_for_llm/searchitems.doc.md +116 -0
  214. package/docs_for_llm/searchselect.doc.md +126 -0
  215. package/docs_for_llm/select.doc.md +40 -55
  216. package/docs_for_llm/sidebar.doc.md +133 -0
  217. package/docs_for_llm/skeleton.doc.md +117 -0
  218. package/docs_for_llm/slider.doc.md +31 -21
  219. package/docs_for_llm/spin.doc.md +8 -5
  220. package/docs_for_llm/spinner.doc.md +28 -18
  221. package/docs_for_llm/split.doc.md +157 -0
  222. package/docs_for_llm/sshkeys.doc.md +88 -0
  223. package/docs_for_llm/status.doc.md +14 -9
  224. package/docs_for_llm/steps.doc.md +10 -7
  225. package/docs_for_llm/switch.doc.md +17 -14
  226. package/docs_for_llm/table.doc.md +118 -51
  227. package/docs_for_llm/tablecolumnid.doc.md +36 -16
  228. package/docs_for_llm/tabs.doc.md +19 -10
  229. package/docs_for_llm/tag.doc.md +19 -10
  230. package/docs_for_llm/timeline.doc.md +109 -0
  231. package/docs_for_llm/timepicker.doc.md +57 -38
  232. package/docs_for_llm/timerange.doc.md +157 -0
  233. package/docs_for_llm/tip.doc.md +20 -11
  234. package/docs_for_llm/tooltip.doc.md +55 -29
  235. package/docs_for_llm/tour.doc.md +48 -29
  236. package/docs_for_llm/transfer.doc.md +40 -29
  237. package/docs_for_llm/tree.doc.md +65 -23
  238. package/docs_for_llm/treeselect.doc.md +37 -48
  239. package/docs_for_llm/upload.doc.md +56 -32
  240. package/docs_for_llm/useCRUD.doc.md +49 -0
  241. package/docs_for_llm/useCountdown.doc.md +43 -0
  242. package/docs_for_llm/useDetail.doc.md +48 -0
  243. package/docs_for_llm/useDialog.doc.md +46 -0
  244. package/docs_for_llm/useEntity.doc.md +45 -0
  245. package/docs_for_llm/useEventListener.doc.md +44 -0
  246. package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
  247. package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
  248. package/docs_for_llm/useGetUserPermission.doc.md +43 -0
  249. package/docs_for_llm/useGroup.doc.md +48 -0
  250. package/docs_for_llm/useIdEntities.doc.md +48 -0
  251. package/docs_for_llm/useIdEntity.doc.md +103 -0
  252. package/docs_for_llm/useInterval.doc.md +43 -0
  253. package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
  254. package/docs_for_llm/useMessage.doc.md +46 -0
  255. package/docs_for_llm/useModifyCache.doc.md +37 -0
  256. package/docs_for_llm/useOpenDialog.doc.md +41 -0
  257. package/docs_for_llm/usePagination.doc.md +60 -0
  258. package/docs_for_llm/usePersist.doc.md +54 -0
  259. package/docs_for_llm/usePoll.doc.md +41 -0
  260. package/docs_for_llm/useRoutePlus.doc.md +34 -0
  261. package/docs_for_llm/useRouterPlus.doc.md +34 -0
  262. package/docs_for_llm/useSearch.doc.md +68 -0
  263. package/docs_for_llm/useShell.doc.md +43 -0
  264. package/docs_for_llm/useSkip.doc.md +41 -0
  265. package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
  266. package/docs_for_llm/useStore.doc.md +34 -0
  267. package/docs_for_llm/useTable.doc.md +57 -0
  268. package/docs_for_llm/useTableGroup.doc.md +47 -0
  269. package/docs_for_llm/useTableSort.doc.md +40 -0
  270. package/docs_for_llm/useToState.doc.md +112 -0
  271. package/docs_for_llm/useUser.doc.md +38 -0
  272. package/docs_for_llm/useValidForm.doc.md +41 -0
  273. package/docs_for_llm/vdialog.doc.md +129 -0
  274. package/docs_for_llm/vdrawer.doc.md +119 -0
  275. package/docs_for_llm/virtuallist.doc.md +6 -3
  276. package/hooks/useCRUD.json +61 -0
  277. package/hooks/useCountdown.json +49 -0
  278. package/hooks/useDetail.json +67 -0
  279. package/hooks/useDialog.json +49 -0
  280. package/hooks/useEntity.json +61 -0
  281. package/hooks/useEventListener.json +61 -0
  282. package/hooks/useFalseUntilTruthy.json +43 -0
  283. package/hooks/useGetCopyAuthText.json +36 -0
  284. package/hooks/useGetUserPermission.json +55 -0
  285. package/hooks/useGroup.json +49 -0
  286. package/hooks/useIdEntities.json +61 -0
  287. package/hooks/useInterval.json +55 -0
  288. package/hooks/useLayoutStandardList.json +36 -0
  289. package/hooks/useMessage.json +73 -0
  290. package/hooks/useModifyCache.json +36 -0
  291. package/hooks/useOpenDialog.json +43 -0
  292. package/hooks/usePagination.json +49 -0
  293. package/hooks/usePersist.json +61 -0
  294. package/hooks/usePoll.json +43 -0
  295. package/hooks/useRoutePlus.json +36 -0
  296. package/hooks/useRouterPlus.json +36 -0
  297. package/hooks/useSearch.json +56 -0
  298. package/hooks/useShell.json +49 -0
  299. package/hooks/useSkip.json +43 -0
  300. package/hooks/useStorageIdEntity.json +67 -0
  301. package/hooks/useStore.json +36 -0
  302. package/hooks/useTable.json +49 -0
  303. package/hooks/useTableGroup.json +43 -0
  304. package/hooks/useTableSort.json +43 -0
  305. package/hooks/useUser.json +36 -0
  306. package/hooks/useValidForm.json +43 -0
  307. package/package.json +12 -6
  308. package/dist/chunk-HDV7ETXE.mjs +0 -1055
  309. package/dist/chunk-HPAUCD5I.js +0 -156
  310. package/dist/chunk-L4DS3EXI.mjs +0 -133
  311. package/dist/chunk-YWY3D4J7.js +0 -1082
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "useDialog",
3
+ "name": "useDialog",
4
+ "displayName": "弹窗状态管理",
5
+ "category": "dialog",
6
+ "description": "为 VDialog 或 Dialog 表单场景封装显隐、校验、重置和确认按钮行为,减少弹窗表单模板中的重复状态代码。",
7
+ "importStatement": "import { useDialog } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "emit",
12
+ "type": "() => any",
13
+ "required": false,
14
+ "description": "父组件传入的 emit,用于联动弹窗显隐或外部事件"
15
+ },
16
+ {
17
+ "name": "isShowParentDialog",
18
+ "type": "Ref<boolean | undefined>",
19
+ "required": false,
20
+ "description": "父级弹窗显隐状态,适合嵌套弹窗场景"
21
+ }
22
+ ],
23
+ "returnType": "{ dialogRef: Ref<Dialog | undefined>; isShowDialog: Ref<boolean>; formRef: Ref<Form | undefined>; validate: Function; validateByScroll: Function; reset: Function; handleClickOkBtn: Function; handleClickValidOkBtn: Function; show: Function; hide: Function; }",
24
+ "examples": [
25
+ {
26
+ "id": "dialog_form",
27
+ "title": "弹窗表单",
28
+ "description": "配合 VDialog 管理弹窗显隐和表单校验",
29
+ "code": "<script setup lang=\"ts\">\nimport { VDialog, useDialog } from '@ksyun-internal/versatile';\n\nconst { isShowDialog, formRef, show, hide, handleClickValidOkBtn } = useDialog();\n</script>\n\n<template>\n <VDialog v-model=\"isShowDialog\" :ok=\"handleClickValidOkBtn\">\n <Form ref=\"formRef\"></Form>\n </VDialog>\n</template>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "missing_form_ref",
35
+ "description": "调用 validate 或 handleClickValidOkBtn,但没有把 formRef 绑定到表单",
36
+ "wrongCode": "<Form></Form>",
37
+ "correctCode": "<Form ref=\"formRef\"></Form>",
38
+ "explanation": "校验相关方法依赖 formRef 指向真实表单实例。"
39
+ }
40
+ ],
41
+ "searchKeywords": [
42
+ "useDialog",
43
+ "VDialog",
44
+ "弹窗表单",
45
+ "dialog",
46
+ "validate",
47
+ "show hide"
48
+ ]
49
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "useEntity",
3
+ "name": "useEntity",
4
+ "displayName": "基础实体映射",
5
+ "category": "state",
6
+ "description": "根据单个 ID 和基础列表做实体同步回调,适合简单的字符串或数字值映射场景。",
7
+ "importStatement": "import { useEntity } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "id",
12
+ "type": "Ref<string | number | undefined | null>",
13
+ "required": true,
14
+ "description": "当前选中的 ID"
15
+ },
16
+ {
17
+ "name": "list",
18
+ "type": "Ref<string[] | number[] | undefined | null>",
19
+ "required": true,
20
+ "description": "基础值列表"
21
+ },
22
+ {
23
+ "name": "emit",
24
+ "type": "(entity: string | number | null | undefined) => void",
25
+ "required": false,
26
+ "description": "值变化时的回调"
27
+ },
28
+ {
29
+ "name": "isNeedDefaultValue",
30
+ "type": "boolean",
31
+ "required": false,
32
+ "description": "是否需要默认值处理"
33
+ }
34
+ ],
35
+ "returnType": "void",
36
+ "examples": [
37
+ {
38
+ "id": "simple_entity_mapping",
39
+ "title": "基础值映射",
40
+ "description": "根据当前值从列表里查找对应实体并回调给外层",
41
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useEntity } from '@ksyun-internal/versatile';\n\nconst id = ref('cn-beijing-6a');\nconst list = ref(['cn-beijing-6a', 'cn-shanghai-2a']);\nuseEntity(id, list, (entity) => console.log(entity));\n</script>"
42
+ }
43
+ ],
44
+ "commonMistakes": [
45
+ {
46
+ "id": "expect_return_value",
47
+ "description": "把 useEntity 当成返回实体 Ref 的 hook 使用",
48
+ "wrongCode": "const entity = useEntity(id, list);",
49
+ "correctCode": "useEntity(id, list, (entity) => { current.value = entity; });",
50
+ "explanation": "该 hook 主要通过副作用回调同步值,本身不返回实体 Ref。"
51
+ }
52
+ ],
53
+ "searchKeywords": [
54
+ "useEntity",
55
+ "简单实体映射",
56
+ "id value",
57
+ "回调同步",
58
+ "基础列表",
59
+ "单值"
60
+ ]
61
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "useEventListener",
3
+ "name": "useEventListener",
4
+ "displayName": "事件监听封装",
5
+ "category": "event",
6
+ "description": "为 HTMLElement、window、document 或 Ref 目标统一注册事件监听,并支持 throttle、debounce 与原生 addEventListener 配置。",
7
+ "importStatement": "import { useEventListener } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "target",
12
+ "type": "HTMLElement | Window | Document | Ref<HTMLElement | null> | (() => HTMLElement | null)",
13
+ "required": true,
14
+ "description": "监听目标"
15
+ },
16
+ {
17
+ "name": "event",
18
+ "type": "string",
19
+ "required": true,
20
+ "description": "事件名"
21
+ },
22
+ {
23
+ "name": "handler",
24
+ "type": "EventListenerOrEventListenerObject",
25
+ "required": true,
26
+ "description": "事件处理函数"
27
+ },
28
+ {
29
+ "name": "options",
30
+ "type": "{ throttle?: number; debounce?: number; nativeOptions?: boolean | AddEventListenerOptions }",
31
+ "required": false,
32
+ "description": "监听配置,支持节流、防抖和原生监听选项"
33
+ }
34
+ ],
35
+ "returnType": "void",
36
+ "examples": [
37
+ {
38
+ "id": "window_resize",
39
+ "title": "监听窗口尺寸变化",
40
+ "description": "在页面中节流监听 resize 事件",
41
+ "code": "<script setup lang=\"ts\">\nimport { useEventListener } from '@ksyun-internal/versatile';\n\nuseEventListener(window, 'resize', () => {\n console.log('resize');\n}, { throttle: 200 });\n</script>"
42
+ }
43
+ ],
44
+ "commonMistakes": [
45
+ {
46
+ "id": "throttle_and_debounce_conflict",
47
+ "description": "同时配置 throttle 和 debounce,但没有明确预期",
48
+ "wrongCode": "useEventListener(window, 'scroll', onScroll, { throttle: 100, debounce: 100 });",
49
+ "correctCode": "根据场景二选一:节流滚动用 throttle,输入联想用 debounce。",
50
+ "explanation": "两者语义不同,建议根据业务场景明确选一种。"
51
+ }
52
+ ],
53
+ "searchKeywords": [
54
+ "useEventListener",
55
+ "事件监听",
56
+ "window resize",
57
+ "debounce",
58
+ "throttle",
59
+ "addEventListener"
60
+ ]
61
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "id": "useFalseUntilTruthy",
3
+ "name": "useFalseUntilTruthy",
4
+ "displayName": "延迟转真布尔态",
5
+ "category": "state",
6
+ "description": "将任意响应式值映射成布尔值,并在首次变为 truthy 前始终保持 false,适合权限、异步加载完成态和懒渲染控制。",
7
+ "importStatement": "import { useFalseUntilTruthy } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "value",
12
+ "type": "MaybeRefOrGetter<any>",
13
+ "required": true,
14
+ "description": "任意响应式值、getter 或普通值"
15
+ }
16
+ ],
17
+ "returnType": "Readonly<Ref<boolean>>",
18
+ "examples": [
19
+ {
20
+ "id": "guard_render",
21
+ "title": "控制懒渲染",
22
+ "description": "在异步数据真正可用前保持 false,避免中间闪烁",
23
+ "code": "<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { useFalseUntilTruthy } from '@ksyun-internal/versatile';\n\nconst dataReady = computed(() => true);\nconst canRender = useFalseUntilTruthy(dataReady);\n</script>"
24
+ }
25
+ ],
26
+ "commonMistakes": [
27
+ {
28
+ "id": "expect_reset_false",
29
+ "description": "期望值在 truthy 之后再次回到 false",
30
+ "wrongCode": "const visible = useFalseUntilTruthy(flag); // 认为 flag 再次 false 时 visible 也会 false",
31
+ "correctCode": "如需双向切换,请直接使用 computed(() => !!flag.value)",
32
+ "explanation": "这个 hook 的语义是“在首次变为 truthy 前保持 false”,不是通用的布尔映射。"
33
+ }
34
+ ],
35
+ "searchKeywords": [
36
+ "useFalseUntilTruthy",
37
+ "false until truthy",
38
+ "懒渲染",
39
+ "加载完成",
40
+ "布尔态",
41
+ "权限准备"
42
+ ]
43
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "useGetCopyAuthText",
3
+ "name": "useGetCopyAuthText",
4
+ "displayName": "复制授权文案",
5
+ "category": "auth",
6
+ "description": "根据服务名和策略名生成复制授权相关文案,适合复制账号权限说明或 AK/SK 授权提示。",
7
+ "importStatement": "import { useGetCopyAuthText } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [],
10
+ "returnType": "(serviceNames: string | Record<string, string[]>, policyName: string) => string | undefined",
11
+ "examples": [
12
+ {
13
+ "id": "copy_auth_text",
14
+ "title": "生成复制授权提示",
15
+ "description": "根据服务和策略名输出授权说明文案",
16
+ "code": "<script setup lang=\"ts\">\nimport { useGetCopyAuthText } from '@ksyun-internal/versatile';\n\nconst getCopyAuthText = useGetCopyAuthText();\nconst text = getCopyAuthText('KEC', 'KecReadOnlyAccess');\n</script>"
17
+ }
18
+ ],
19
+ "commonMistakes": [
20
+ {
21
+ "id": "invalid_policy_name",
22
+ "description": "策略名传入页面展示文案而不是实际 policyName",
23
+ "wrongCode": "getCopyAuthText('KEC', '云服务器只读');",
24
+ "correctCode": "getCopyAuthText('KEC', 'KecReadOnlyAccess');",
25
+ "explanation": "第二个参数应使用真实策略标识,而不是中文标题。"
26
+ }
27
+ ],
28
+ "searchKeywords": [
29
+ "useGetCopyAuthText",
30
+ "复制授权文案",
31
+ "policyName",
32
+ "AKSK",
33
+ "权限说明",
34
+ "授权提示"
35
+ ]
36
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "id": "useGetUserPermission",
3
+ "name": "useGetUserPermission",
4
+ "displayName": "用户权限判断",
5
+ "category": "auth",
6
+ "description": "根据用户列表和目标权限集合计算当前数据是否具备权限,适合列表操作按钮、批量操作和详情页权限门禁判断。",
7
+ "importStatement": "import { useGetUserPermission } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "users",
12
+ "type": "Ref<User[] | null | undefined>",
13
+ "required": true,
14
+ "description": "用户或授权主体列表"
15
+ },
16
+ {
17
+ "name": "permissions",
18
+ "type": "string[]",
19
+ "required": true,
20
+ "description": "目标权限编码列表"
21
+ },
22
+ {
23
+ "name": "key",
24
+ "type": "keyof User",
25
+ "required": false,
26
+ "description": "权限字段所在的属性名,不传时使用默认字段"
27
+ }
28
+ ],
29
+ "returnType": "ComputedRef<boolean>",
30
+ "examples": [
31
+ {
32
+ "id": "permission_guard",
33
+ "title": "控制按钮是否可操作",
34
+ "description": "根据用户权限列表生成可直接用于模板的布尔值",
35
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useGetUserPermission } from '@ksyun-internal/versatile';\n\nconst users = ref([{ actions: ['instance:view', 'instance:delete'] }]);\nconst canDelete = useGetUserPermission(users, ['instance:delete'], 'actions');\n</script>"
36
+ }
37
+ ],
38
+ "commonMistakes": [
39
+ {
40
+ "id": "wrong_key_field",
41
+ "description": "传入的 key 不是权限字段,导致结果始终错误",
42
+ "wrongCode": "useGetUserPermission(users, ['instance:delete'], 'name');",
43
+ "correctCode": "useGetUserPermission(users, ['instance:delete'], 'actions');",
44
+ "explanation": "key 应指向用户对象中真正存放权限列表的字段。"
45
+ }
46
+ ],
47
+ "searchKeywords": [
48
+ "useGetUserPermission",
49
+ "权限判断",
50
+ "操作权限",
51
+ "按钮禁用",
52
+ "auth",
53
+ "permission"
54
+ ]
55
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "useGroup",
3
+ "name": "useGroup",
4
+ "displayName": "数据分组映射",
5
+ "category": "data",
6
+ "description": "根据输入数据源和分组函数生成实体列表与分组结果,适合把接口返回的数据整理成按键聚合的展示结构。",
7
+ "importStatement": "import { useGroup } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "packages",
12
+ "type": "(() => P[] | undefined) | Ref<P[] | undefined>",
13
+ "required": true,
14
+ "description": "原始数据源,可传 getter 或 Ref"
15
+ },
16
+ {
17
+ "name": "forEach",
18
+ "type": "(pkg: P, fn: (key: K, data: T) => void) => void",
19
+ "required": true,
20
+ "description": "遍历函数,用于从每个数据项中提取分组 key 和实体数据"
21
+ }
22
+ ],
23
+ "returnType": "{ entities: Ref<T[] | undefined>; grouped: Ref<Record<K, P[]> | undefined>; }",
24
+ "examples": [
25
+ {
26
+ "id": "group_instances",
27
+ "title": "按状态分组实例列表",
28
+ "description": "把列表数据转换成状态分组结构,便于生成统计和分段展示",
29
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useGroup } from '@ksyun-internal/versatile';\n\nconst packages = ref([\n { id: '1', status: 'running', name: '实例1' },\n { id: '2', status: 'stopped', name: '实例2' },\n]);\n\nconst { entities, grouped } = useGroup(packages, (pkg, push) => {\n push(pkg.status, pkg);\n});\n</script>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "forget_push",
35
+ "description": "forEach 中没有调用回调函数,导致 grouped 为空",
36
+ "wrongCode": "useGroup(packages, (pkg) => { console.log(pkg); });",
37
+ "correctCode": "useGroup(packages, (pkg, push) => { push(pkg.status, pkg); });",
38
+ "explanation": "hook 依赖回调函数收集 key 和 data,没有 push 就不会产生分组结果。"
39
+ }
40
+ ],
41
+ "searchKeywords": [
42
+ "useGroup",
43
+ "分组",
44
+ "grouped",
45
+ "entities",
46
+ "数据整理",
47
+ "聚合展示"
48
+ ]
49
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "useIdEntities",
3
+ "name": "useIdEntities",
4
+ "displayName": "ID 列表映射实体列表",
5
+ "category": "state",
6
+ "description": "根据多个 ID 从实体列表中映射出对应的实体数组,适合多选组件、批量操作和多实体回显场景。",
7
+ "importStatement": "import { useIdEntities } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "ids",
12
+ "type": "Ref<(string | number)[] | undefined | null>",
13
+ "required": true,
14
+ "description": "选中的 ID 列表"
15
+ },
16
+ {
17
+ "name": "list",
18
+ "type": "Ref<Entity[] | undefined | null>",
19
+ "required": true,
20
+ "description": "实体源列表"
21
+ },
22
+ {
23
+ "name": "key",
24
+ "type": "keyof Entity",
25
+ "required": true,
26
+ "description": "用于匹配的实体主键字段"
27
+ },
28
+ {
29
+ "name": "emit",
30
+ "type": "(entity: Entity[] | undefined) => void",
31
+ "required": false,
32
+ "description": "实体数组变化时的回调"
33
+ }
34
+ ],
35
+ "returnType": "Ref<Entity[] | undefined>",
36
+ "examples": [
37
+ {
38
+ "id": "multi_select_entities",
39
+ "title": "多选值回显实体数组",
40
+ "description": "根据选中的多个 ID 计算出完整对象列表",
41
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useIdEntities } from '@ksyun-internal/versatile';\n\nconst ids = ref(['ws-1', 'ws-2']);\nconst list = ref([\n { WorkspaceId: 'ws-1', WorkspaceName: '工作空间1' },\n { WorkspaceId: 'ws-2', WorkspaceName: '工作空间2' },\n]);\nconst entities = useIdEntities(ids, list, 'WorkspaceId');\n</script>"
42
+ }
43
+ ],
44
+ "commonMistakes": [
45
+ {
46
+ "id": "single_id_instead_of_array",
47
+ "description": "把单个 ID 当作 ids 传入",
48
+ "wrongCode": "useIdEntities(id, list, 'id');",
49
+ "correctCode": "useIdEntities(ids, list, 'id');",
50
+ "explanation": "这个 hook 面向多值场景,首参应是 ID 数组 Ref。"
51
+ }
52
+ ],
53
+ "searchKeywords": [
54
+ "useIdEntities",
55
+ "多选实体映射",
56
+ "ids",
57
+ "entity list",
58
+ "批量回显",
59
+ "多选"
60
+ ]
61
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "id": "useInterval",
3
+ "name": "useInterval",
4
+ "displayName": "可暂停定时器",
5
+ "category": "timer",
6
+ "description": "对 setInterval 做响应式封装,提供 pause、resume 和 isActive,适合轮询、时钟和自动刷新场景。",
7
+ "importStatement": "import { useInterval } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "cb",
12
+ "type": "() => void",
13
+ "required": true,
14
+ "description": "定时执行的回调"
15
+ },
16
+ {
17
+ "name": "interval",
18
+ "type": "MaybeRefOrGetter<number>",
19
+ "required": false,
20
+ "description": "时间间隔,默认值由上游实现决定"
21
+ },
22
+ {
23
+ "name": "options",
24
+ "type": "UseIntervalOptions",
25
+ "required": false,
26
+ "description": "定时器配置,可设置 immediate 和 immediateCallback"
27
+ }
28
+ ],
29
+ "returnType": "{ isActive: Readonly<ShallowRef<boolean>>; pause: () => void; resume: () => void; }",
30
+ "examples": [
31
+ {
32
+ "id": "auto_refresh",
33
+ "title": "自动刷新列表",
34
+ "description": "以固定间隔刷新列表数据,并可手动暂停",
35
+ "code": "<script setup lang=\"ts\">\nimport { useInterval } from '@ksyun-internal/versatile';\n\nconst { pause, resume, isActive } = useInterval(() => {\n console.log('refresh');\n}, 5000, { immediate: true });\n</script>"
36
+ }
37
+ ],
38
+ "commonMistakes": [
39
+ {
40
+ "id": "expect_resume_recreate",
41
+ "description": "暂停后修改了 interval,却以为 resume 会自动重建旧定时器逻辑",
42
+ "wrongCode": "pause(); interval.value = 1000; resume();",
43
+ "correctCode": "确认 interval 是响应式输入,或重新创建 useInterval。",
44
+ "explanation": "建议明确 interval 的响应式来源,避免把它当成一次性静态参数。"
45
+ }
46
+ ],
47
+ "searchKeywords": [
48
+ "useInterval",
49
+ "定时器",
50
+ "pause",
51
+ "resume",
52
+ "自动刷新",
53
+ "轮询"
54
+ ]
55
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "useLayoutStandardList",
3
+ "name": "useLayoutStandardList",
4
+ "displayName": "标准列表页组合状态",
5
+ "category": "table",
6
+ "description": "为 LayoutStandardList 组合分页、搜索、分组、排序、列设置和批量操作状态,适合标准列表页快速搭建。",
7
+ "importStatement": "import { useLayoutStandardList } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [],
10
+ "returnType": "{ layoutStandardListRef: Ref<any>; page: Ref<number>; limit: Ref<number>; searchValue: Ref<string>; searchItems: Ref<Record<string, any> | undefined>; group: Ref<Record<string, any>>; sort: Ref<TableSortValue>; checkedKeys: Ref<string[]>; tableRef: Ref<Table | undefined>; refetch: any; loading: any; isShowDialog: Ref<boolean>; showFilterTableFieldsDialog: Function; ... }",
11
+ "examples": [
12
+ {
13
+ "id": "standard_list_ref",
14
+ "title": "标准列表页容器",
15
+ "description": "在 LayoutStandardList 外层持有组合状态和实例引用",
16
+ "code": "<script setup lang=\"ts\">\nimport { LayoutStandardList, useLayoutStandardList } from '@ksyun-internal/versatile';\n\nconst { layoutStandardListRef, page, limit, searchItems, checkedKeys } = useLayoutStandardList();\n</script>\n\n<template>\n <LayoutStandardList ref=\"layoutStandardListRef\" :use-list=\"() => ({ loading: false, dataSource: [], total: 0 })\" />\n</template>"
17
+ }
18
+ ],
19
+ "commonMistakes": [
20
+ {
21
+ "id": "duplicate_inner_hooks",
22
+ "description": "在 LayoutStandardList 外又重复手写 useSearch/usePagination/useTableSort,导致状态来源分裂",
23
+ "wrongCode": "const search = useSearch(); const pagination = usePagination(); const state = useLayoutStandardList();",
24
+ "correctCode": "const state = useLayoutStandardList();",
25
+ "explanation": "如果页面主体就是 LayoutStandardList,优先复用这个组合 hook。"
26
+ }
27
+ ],
28
+ "searchKeywords": [
29
+ "useLayoutStandardList",
30
+ "LayoutStandardList",
31
+ "标准列表页",
32
+ "分页 搜索 排序",
33
+ "批量操作",
34
+ "表格组合状态"
35
+ ]
36
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "id": "useMessage",
3
+ "name": "useMessage",
4
+ "displayName": "变更消息反馈",
5
+ "category": "feedback",
6
+ "description": "为 Apollo mutation 封装统一的成功/失败消息处理逻辑,适合删除、编辑、创建等需要标准化提示文案的请求场景。",
7
+ "importStatement": "import { useMessage } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "onError",
12
+ "type": "UseMutationReturn<TResult, TVariables>['onError']",
13
+ "required": true,
14
+ "description": "mutation 返回的错误监听函数"
15
+ },
16
+ {
17
+ "name": "onDone",
18
+ "type": "UseMutationReturn<TResult, TVariables>['onDone']",
19
+ "required": false,
20
+ "description": "mutation 返回的完成监听函数"
21
+ },
22
+ {
23
+ "name": "isSuccess",
24
+ "type": "(res: FetchResult<TResult>) => boolean",
25
+ "required": false,
26
+ "description": "自定义成功判定逻辑"
27
+ },
28
+ {
29
+ "name": "action",
30
+ "type": "string | (() => string)",
31
+ "required": false,
32
+ "description": "操作名称,用于生成成功/失败提示文案"
33
+ },
34
+ {
35
+ "name": "successCallback",
36
+ "type": "(res: FetchResult<TResult>) => any",
37
+ "required": false,
38
+ "description": "成功后的额外回调"
39
+ },
40
+ {
41
+ "name": "failedCallback",
42
+ "type": "(e: Error) => any",
43
+ "required": false,
44
+ "description": "失败后的额外回调"
45
+ }
46
+ ],
47
+ "returnType": "void",
48
+ "examples": [
49
+ {
50
+ "id": "mutation_feedback",
51
+ "title": "统一处理 mutation 提示",
52
+ "description": "把创建、删除等 mutation 的消息提示收口到 hook",
53
+ "code": "<script setup lang=\"ts\">\nimport { useMutation } from '@vue/apollo-composable';\nimport { useMessage } from '@ksyun-internal/versatile';\n\nconst { onError, onDone } = useMutation(CREATE_INSTANCE);\nuseMessage(onError, onDone, undefined, '创建实例');\n</script>"
54
+ }
55
+ ],
56
+ "commonMistakes": [
57
+ {
58
+ "id": "no_success_judge",
59
+ "description": "接口返回结构不是标准成功态,但没有传 isSuccess,自定义失败被当成成功",
60
+ "wrongCode": "useMessage(onError, onDone, undefined, '删除');",
61
+ "correctCode": "useMessage(onError, onDone, (res) => res.data?.delete?.code === 200, '删除');",
62
+ "explanation": "如果后端不是默认成功结构,建议显式提供 isSuccess。"
63
+ }
64
+ ],
65
+ "searchKeywords": [
66
+ "useMessage",
67
+ "mutation 提示",
68
+ "apollo",
69
+ "成功失败消息",
70
+ "toast",
71
+ "反馈"
72
+ ]
73
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "useModifyCache",
3
+ "name": "useModifyCache",
4
+ "displayName": "Apollo 缓存修改",
5
+ "category": "data",
6
+ "description": "返回一个可复用的 Apollo cache.modify 封装函数,适合在 mutation 后局部更新缓存而不重新发请求。",
7
+ "importStatement": "import { useModifyCache } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [],
10
+ "returnType": "(identify: StoreObject | Reference, fields: Cache.ModifyOptions['fields']) => void",
11
+ "examples": [
12
+ {
13
+ "id": "apollo_modify_cache",
14
+ "title": "局部更新 Apollo 缓存",
15
+ "description": "在删除或编辑成功后直接修改缓存字段",
16
+ "code": "<script setup lang=\"ts\">\nimport { useModifyCache } from '@ksyun-internal/versatile';\n\nconst modifyCache = useModifyCache();\nmodifyCache({ __typename: 'Instance', id: 'ins-1' }, {\n name: () => 'new-name',\n});\n</script>"
17
+ }
18
+ ],
19
+ "commonMistakes": [
20
+ {
21
+ "id": "invalid_identify",
22
+ "description": "identify 对象缺少 Apollo 可识别的标识字段",
23
+ "wrongCode": "modifyCache({ name: 'instance-1' }, { status: () => 'running' });",
24
+ "correctCode": "modifyCache({ __typename: 'Instance', id: 'ins-1' }, { status: () => 'running' });",
25
+ "explanation": "identify 需要能让 Apollo 唯一定位缓存实体。"
26
+ }
27
+ ],
28
+ "searchKeywords": [
29
+ "useModifyCache",
30
+ "apollo cache",
31
+ "cache.modify",
32
+ "mutation",
33
+ "局部更新缓存",
34
+ "graphql"
35
+ ]
36
+ }