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,43 @@
1
+ {
2
+ "id": "useOpenDialog",
3
+ "name": "useOpenDialog",
4
+ "displayName": "表格操作弹窗",
5
+ "category": "dialog",
6
+ "description": "针对表格单行操作和批量操作封装弹窗打开逻辑,统一维护当前操作项和批量操作项集合。",
7
+ "importStatement": "import { useOpenDialog } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "tableRef",
12
+ "type": "Ref<Table | undefined>",
13
+ "required": false,
14
+ "description": "表格实例引用,批量操作时可从表格中读取选中项"
15
+ }
16
+ ],
17
+ "returnType": "{ isShowDialog: Ref<boolean>; dialogRef: Ref<any>; opCols: Ref<T[] | undefined>; opCol: Ref<T | undefined>; show: Function; hide: Function; handleClickOpBtn: Function; handleClickBatchOpBtn: Function; }",
18
+ "examples": [
19
+ {
20
+ "id": "table_op_dialog",
21
+ "title": "表格操作弹窗",
22
+ "description": "点击单行操作按钮时打开弹窗并记录当前行数据",
23
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useOpenDialog } from '@ksyun-internal/versatile';\n\nconst tableRef = ref();\nconst { isShowDialog, opCol, handleClickOpBtn } = useOpenDialog(tableRef);\n</script>"
24
+ }
25
+ ],
26
+ "commonMistakes": [
27
+ {
28
+ "id": "missing_table_ref",
29
+ "description": "批量操作场景未传入 tableRef,导致无法读取选中项",
30
+ "wrongCode": "const dialog = useOpenDialog();",
31
+ "correctCode": "const dialog = useOpenDialog(tableRef);",
32
+ "explanation": "如果需要 handleClickBatchOpBtn 读取表格选中项,应传入 tableRef。"
33
+ }
34
+ ],
35
+ "searchKeywords": [
36
+ "useOpenDialog",
37
+ "批量操作",
38
+ "表格操作",
39
+ "dialog",
40
+ "单行操作",
41
+ "tableRef"
42
+ ]
43
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "usePagination",
3
+ "name": "usePagination",
4
+ "displayName": "分页状态管理",
5
+ "category": "pagination",
6
+ "description": "管理列表页常用的 page、limit、limits 以及分页变更回调,适合和 ProTable、PaginationPlus、Search 组合使用。",
7
+ "importStatement": "import { usePagination } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "options",
12
+ "type": "{ page?: number; limit?: number; limits?: number[]; callback?: (v: PaginationChangeData) => void }",
13
+ "required": false,
14
+ "description": "分页初始化配置,可预设页码、每页条数、可选 limits 及翻页后的回调"
15
+ }
16
+ ],
17
+ "returnType": "{ page: Ref<number>; limit: Ref<number>; limits: Ref<number[]>; pageChange: (pageParams: PaginationChangeData) => void; }",
18
+ "examples": [
19
+ {
20
+ "id": "basic_pagination",
21
+ "title": "基础分页用法",
22
+ "description": "通过 hook 统一管理列表页码和每页条数",
23
+ "code": "<script setup lang=\"ts\">\nimport { PaginationPlus, usePagination } from '@ksyun-internal/versatile';\n\nconst { page, limit, pageChange } = usePagination({\n page: 1,\n limit: 20,\n});\n</script>\n\n<template>\n <PaginationPlus v-model=\"page\" v-model:limit=\"limit\" :total=\"200\" @change=\"pageChange\" />\n</template>"
24
+ },
25
+ {
26
+ "id": "with_callback",
27
+ "title": "带回调的分页",
28
+ "description": "在分页变化后触发数据刷新或埋点逻辑",
29
+ "code": "<script setup lang=\"ts\">\nimport { usePagination } from '@ksyun-internal/versatile';\n\nconst fetchList = () => console.log('reload');\nconst { page, limit, pageChange } = usePagination({\n callback: () => fetchList(),\n});\n</script>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "forget_limit_binding",
35
+ "description": "只绑定 page,没有同步维护 limit",
36
+ "wrongCode": "const { page } = usePagination();",
37
+ "correctCode": "const { page, limit } = usePagination();",
38
+ "explanation": "如果页面支持切换每页条数,应同时使用 hook 返回的 limit。"
39
+ }
40
+ ],
41
+ "searchKeywords": [
42
+ "usePagination",
43
+ "分页",
44
+ "page",
45
+ "limit",
46
+ "PaginationPlus",
47
+ "列表页"
48
+ ]
49
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "usePersist",
3
+ "name": "usePersist",
4
+ "displayName": "本地持久化",
5
+ "category": "state",
6
+ "description": "将响应式数据持久化到 localStorage 或 sessionStorage,适合保存列表筛选、用户偏好和表格配置。",
7
+ "importStatement": "import { usePersist } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "key",
12
+ "type": "string",
13
+ "required": true,
14
+ "description": "存储键名"
15
+ },
16
+ {
17
+ "name": "defaultValue",
18
+ "type": "T",
19
+ "required": true,
20
+ "description": "初始化默认值"
21
+ },
22
+ {
23
+ "name": "options",
24
+ "type": "PersistOptions<T>",
25
+ "required": false,
26
+ "description": "持久化配置,可切换 storage、自定义序列化和 watch 行为"
27
+ }
28
+ ],
29
+ "returnType": "Ref<T>",
30
+ "examples": [
31
+ {
32
+ "id": "persist_table_fields",
33
+ "title": "持久化表格配置",
34
+ "description": "保存用户的列显隐或筛选配置",
35
+ "code": "<script setup lang=\"ts\">\nimport { usePersist } from '@ksyun-internal/versatile';\n\nconst tableFields = usePersist('table-fields', ['name', 'status']);\n</script>"
36
+ },
37
+ {
38
+ "id": "session_storage",
39
+ "title": "使用 sessionStorage",
40
+ "description": "仅在当前会话内保留搜索状态",
41
+ "code": "<script setup lang=\"ts\">\nimport { usePersist } from '@ksyun-internal/versatile';\n\nconst searchState = usePersist('instance-search', { key: 'name', value: '' }, {\n storage: sessionStorage,\n});\n</script>"
42
+ }
43
+ ],
44
+ "commonMistakes": [
45
+ {
46
+ "id": "unstable_key",
47
+ "description": "使用会变化的 key,导致同一份状态被重复写入",
48
+ "wrongCode": "usePersist(`table-${Date.now()}`, []);",
49
+ "correctCode": "usePersist('instance-table-fields', []);",
50
+ "explanation": "key 应保持稳定,否则无法复用持久化结果。"
51
+ }
52
+ ],
53
+ "searchKeywords": [
54
+ "usePersist",
55
+ "localStorage",
56
+ "sessionStorage",
57
+ "持久化",
58
+ "列表偏好",
59
+ "缓存状态"
60
+ ]
61
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "id": "usePoll",
3
+ "name": "usePoll",
4
+ "displayName": "查询轮询",
5
+ "category": "data",
6
+ "description": "包装 Apollo 查询结果并启用轮询场景,适合在列表页、详情页中持续刷新接口数据。",
7
+ "importStatement": "import { usePoll } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "result",
12
+ "type": "UseQueryReturn<any, any>",
13
+ "required": true,
14
+ "description": "Apollo useQuery 返回的查询对象"
15
+ }
16
+ ],
17
+ "returnType": "UseQueryReturn<any, any>",
18
+ "examples": [
19
+ {
20
+ "id": "apollo_poll",
21
+ "title": "轮询查询结果",
22
+ "description": "对 useQuery 返回值启用轮询式刷新",
23
+ "code": "<script setup lang=\"ts\">\nimport { useQuery } from '@vue/apollo-composable';\nimport { usePoll } from '@ksyun-internal/versatile';\n\nconst queryResult = useQuery(GET_INSTANCE_LIST);\nconst pollResult = usePoll(queryResult);\n</script>"
24
+ }
25
+ ],
26
+ "commonMistakes": [
27
+ {
28
+ "id": "non_query_result",
29
+ "description": "传入普通 Promise 或自定义对象而不是 Apollo 查询返回值",
30
+ "wrongCode": "const result = usePoll(fetchList());",
31
+ "correctCode": "const result = usePoll(useQuery(GET_LIST));",
32
+ "explanation": "usePoll 依赖 Apollo 的 UseQueryReturn 结构。"
33
+ }
34
+ ],
35
+ "searchKeywords": [
36
+ "usePoll",
37
+ "轮询",
38
+ "apollo",
39
+ "useQuery",
40
+ "自动刷新",
41
+ "列表轮询"
42
+ ]
43
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "useRoutePlus",
3
+ "name": "useRoutePlus",
4
+ "displayName": "增强路由读取",
5
+ "category": "router",
6
+ "description": "对 vue-router 的 route 做包装,直接返回 params、query 及其 refs,便于在组合式函数中按字段响应式使用。",
7
+ "importStatement": "import { useRoutePlus } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [],
10
+ "returnType": "{ $route: RouteLocationNormalizedLoadedGeneric; params: Record<string, string>; paramRefs: ToRefs<Record<string, string>>; query: LocationQuery; queryRefs: ToRefs<LocationQuery>; }",
11
+ "examples": [
12
+ {
13
+ "id": "route_params",
14
+ "title": "读取详情页路由参数",
15
+ "description": "把详情页 id 和 query 参数拆成可直接使用的 refs",
16
+ "code": "<script setup lang=\"ts\">\nimport { useRoutePlus } from '@ksyun-internal/versatile';\n\nconst { params, paramRefs, queryRefs } = useRoutePlus();\n</script>"
17
+ }
18
+ ],
19
+ "commonMistakes": [
20
+ {
21
+ "id": "expect_writeback",
22
+ "description": "直接修改 paramRefs/queryRefs,期望同步改写路由地址",
23
+ "wrongCode": "paramRefs.id.value = '2';",
24
+ "correctCode": "如需跳转,请配合 useRouterPlus 或 router.push。",
25
+ "explanation": "这个 hook 主要用于读取路由状态,不负责写回 URL。"
26
+ }
27
+ ],
28
+ "searchKeywords": [
29
+ "useRoutePlus",
30
+ "route params",
31
+ "query refs",
32
+ "vue-router",
33
+ "详情页参数",
34
+ "路由读取"
35
+ ]
36
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "useRouterPlus",
3
+ "name": "useRouterPlus",
4
+ "displayName": "增强路由跳转",
5
+ "category": "router",
6
+ "description": "对 vue-router 的导航能力做统一封装,提供新开页签跳转和可回退的导航能力。",
7
+ "importStatement": "import { useRouterPlus } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [],
10
+ "returnType": "{ $router: Router; goNewPage: (to: string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric, currentLocation?: RouteLocationNormalizedLoadedGeneric) => void; goBack: (back?: string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric) => void; }",
11
+ "examples": [
12
+ {
13
+ "id": "go_detail_page",
14
+ "title": "跳转详情页或新页签打开",
15
+ "description": "在列表页操作列中统一处理跳转行为",
16
+ "code": "<script setup lang=\"ts\">\nimport { useRouterPlus } from '@ksyun-internal/versatile';\n\nconst { goNewPage, goBack } = useRouterPlus();\n</script>"
17
+ }
18
+ ],
19
+ "commonMistakes": [
20
+ {
21
+ "id": "missing_back_fallback",
22
+ "description": "调用 goBack 但没有提供兜底地址,历史栈不足时体验不稳定",
23
+ "wrongCode": "goBack();",
24
+ "correctCode": "goBack({ name: 'instance-list' });",
25
+ "explanation": "在业务列表/详情页之间跳转时,建议提供明确回退目标。"
26
+ }
27
+ ],
28
+ "searchKeywords": [
29
+ "useRouterPlus",
30
+ "goNewPage",
31
+ "goBack",
32
+ "路由跳转",
33
+ "新开页签",
34
+ "vue-router"
35
+ ]
36
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "id": "useSearch",
3
+ "name": "useSearch",
4
+ "displayName": "搜索状态管理",
5
+ "category": "search",
6
+ "description": "管理 Search 和 SearchItems 常用的搜索状态,统一维护 searchKey、searchValue、searchItems 及其变更方法。配合列表页分页时可在筛选变化后重置页码。",
7
+ "importStatement": "import { useSearch } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "options",
12
+ "type": "{ defaultSearchKey?: string; page?: Ref<number> }",
13
+ "required": false,
14
+ "description": "初始化配置,可指定默认搜索字段,并传入分页页码以便搜索变化时联动重置"
15
+ }
16
+ ],
17
+ "returnType": "{ searchKey: Ref<string>; searchKeyRela: Ref<string>; searchValue: Ref<string>; searchItems: Ref<T | undefined>; searchItemsRef: Ref<any>; handleChangeSearchValue: Function; handleChangeSingleValue: Function; handleChangeSearchSingleValue: Function; }",
18
+ "examples": [
19
+ {
20
+ "id": "list_search",
21
+ "title": "列表页搜索状态",
22
+ "description": "在列表页中统一维护搜索 key、搜索值和搜索项",
23
+ "code": "<script setup lang=\"ts\">\nimport { Search, SearchItems, usePagination, useSearch } from '@ksyun-internal/versatile';\n\nconst { page } = usePagination();\nconst { searchKey, searchValue, searchItems } = useSearch({\n defaultSearchKey: 'name',\n page,\n});\n</script>\n\n<template>\n <Search v-model:search-key=\"searchKey\" v-model:search-value=\"searchValue\" :searches=\"[]\" />\n <SearchItems v-model=\"searchItems\" />\n</template>"
24
+ },
25
+ {
26
+ "id": "search_callback",
27
+ "title": "手动处理搜索值变更",
28
+ "description": "通过返回的方法接管批量搜索或单值搜索的更新逻辑",
29
+ "code": "<script setup lang=\"ts\">\nimport { useSearch } from '@ksyun-internal/versatile';\n\nconst { handleChangeSearchValue } = useSearch();\n\nconst onSearch = (value?: string) => {\n handleChangeSearchValue(value, value);\n};\n</script>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "missing_page_link",
35
+ "description": "列表页搜索变化时没有传入 page,导致筛选后仍停留在旧页码",
36
+ "wrongCode": "const search = useSearch();",
37
+ "correctCode": "const search = useSearch({ page });",
38
+ "explanation": "在分页列表中建议把 page 传给 useSearch,让搜索条件变化时同步回到第一页。"
39
+ },
40
+ {
41
+ "id": "manual_duplicate_state",
42
+ "description": "重复自己维护 searchKey/searchValue,和 hook 返回值并存",
43
+ "wrongCode": "const searchKey = ref('name'); const searchValue = ref(''); const { searchItems } = useSearch();",
44
+ "correctCode": "const { searchKey, searchValue, searchItems } = useSearch({ defaultSearchKey: 'name' });",
45
+ "explanation": "优先使用 useSearch 返回的整套状态,避免来源分裂。"
46
+ }
47
+ ],
48
+ "searchKeywords": [
49
+ "useSearch",
50
+ "Search",
51
+ "SearchItems",
52
+ "列表筛选",
53
+ "搜索状态",
54
+ "检索条件"
55
+ ]
56
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "useShell",
3
+ "name": "useShell",
4
+ "displayName": "Shell 内容挂载",
5
+ "category": "dialog",
6
+ "description": "在弹窗显示时把 shell 或命令内容挂载到指定容器引用,适合命令预览、终端输出展示等场景。",
7
+ "importStatement": "import { useShell } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "content",
12
+ "type": "WatchSource<string | undefined | null>",
13
+ "required": true,
14
+ "description": "需要展示的 shell 内容"
15
+ },
16
+ {
17
+ "name": "isShowDialog",
18
+ "type": "Ref<boolean>",
19
+ "required": true,
20
+ "description": "弹窗显隐状态"
21
+ }
22
+ ],
23
+ "returnType": "{ shellRef: Ref<any> }",
24
+ "examples": [
25
+ {
26
+ "id": "shell_dialog",
27
+ "title": "命令预览弹窗",
28
+ "description": "在弹窗打开时渲染命令或脚本内容",
29
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useShell } from '@ksyun-internal/versatile';\n\nconst content = ref('kubectl get pods');\nconst isShowDialog = ref(false);\nconst { shellRef } = useShell(content, isShowDialog);\n</script>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "content_not_watch_source",
35
+ "description": "传入一次性字符串字面量,后续更新不会同步",
36
+ "wrongCode": "useShell('kubectl get pods', isShowDialog);",
37
+ "correctCode": "const content = ref('kubectl get pods'); useShell(content, isShowDialog);",
38
+ "explanation": "内容建议使用 Ref 或 getter,便于后续更新时同步渲染。"
39
+ }
40
+ ],
41
+ "searchKeywords": [
42
+ "useShell",
43
+ "shell",
44
+ "命令预览",
45
+ "dialog content",
46
+ "终端输出",
47
+ "shellRef"
48
+ ]
49
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "id": "useSkip",
3
+ "name": "useSkip",
4
+ "displayName": "头部返回跳转",
5
+ "category": "router",
6
+ "description": "从 Header 的 back 配置中提取统一跳转逻辑,适合详情页和购买链路页的返回按钮行为。",
7
+ "importStatement": "import { useSkip } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "back",
12
+ "type": "Ref<LayoutHeaderProps['back']>",
13
+ "required": true,
14
+ "description": "Header 的 back 配置项"
15
+ }
16
+ ],
17
+ "returnType": "{ goLink: () => any }",
18
+ "examples": [
19
+ {
20
+ "id": "header_back",
21
+ "title": "Header 返回按钮",
22
+ "description": "复用 Header back 配置实现统一返回跳转",
23
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useSkip } from '@ksyun-internal/versatile';\n\nconst back = ref({ to: { name: 'instance-list' } });\nconst { goLink } = useSkip(back);\n</script>"
24
+ }
25
+ ],
26
+ "commonMistakes": [
27
+ {
28
+ "id": "plain_object_back",
29
+ "description": "直接传普通对象而不是 Ref,导致 back 配置变化无法联动",
30
+ "wrongCode": "useSkip({ to: { name: 'list' } });",
31
+ "correctCode": "const back = ref({ to: { name: 'list' } }); useSkip(back);",
32
+ "explanation": "hook 设计为消费 Header back 的响应式配置。"
33
+ }
34
+ ],
35
+ "searchKeywords": [
36
+ "useSkip",
37
+ "Header back",
38
+ "返回跳转",
39
+ "详情页返回",
40
+ "goLink",
41
+ "layout header"
42
+ ]
43
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "id": "useStorageIdEntity",
3
+ "name": "useStorageIdEntity",
4
+ "displayName": "带存储的 ID 实体映射",
5
+ "category": "state",
6
+ "description": "在 useIdEntity 的基础上增加存储键能力,适合把当前选中的实体 ID 与本地缓存联动,支持刷新后恢复选择。",
7
+ "importStatement": "import { useStorageIdEntity } 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<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": "storageName",
30
+ "type": "string",
31
+ "required": false,
32
+ "description": "本地存储使用的键名"
33
+ },
34
+ {
35
+ "name": "emit",
36
+ "type": "(entity: Entity | undefined) => void",
37
+ "required": false,
38
+ "description": "实体变化时的回调"
39
+ }
40
+ ],
41
+ "returnType": "Ref<Entity | undefined>",
42
+ "examples": [
43
+ {
44
+ "id": "remember_selected_workspace",
45
+ "title": "记住上次选择的实体",
46
+ "description": "页面刷新后仍恢复用户上次选择的对象",
47
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useStorageIdEntity } from '@ksyun-internal/versatile';\n\nconst selectedId = ref('ws-001');\nconst workspaceList = ref([{ WorkspaceId: 'ws-001', WorkspaceName: '工作空间1' }]);\nconst currentWorkspace = useStorageIdEntity(selectedId, workspaceList, 'WorkspaceId', 'workspace-id');\n</script>"
48
+ }
49
+ ],
50
+ "commonMistakes": [
51
+ {
52
+ "id": "shared_storage_name",
53
+ "description": "多个页面复用同一个 storageName,导致选择串数据",
54
+ "wrongCode": "useStorageIdEntity(id, list, 'id', 'selected-id');",
55
+ "correctCode": "useStorageIdEntity(id, list, 'id', 'instance-workspace-id');",
56
+ "explanation": "storageName 建议按业务域区分,避免不同页面互相覆盖。"
57
+ }
58
+ ],
59
+ "searchKeywords": [
60
+ "useStorageIdEntity",
61
+ "本地记忆选择",
62
+ "storage",
63
+ "实体映射",
64
+ "刷新恢复",
65
+ "workspace"
66
+ ]
67
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "useStore",
3
+ "name": "useStore",
4
+ "displayName": "轻量全局状态",
5
+ "category": "state",
6
+ "description": "读取和写入 versatile 内部维护的轻量全局状态,当前暴露地域 key 和地域列表的读写能力。",
7
+ "importStatement": "import { useStore } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [],
10
+ "returnType": "{ setRegionKey: (regionKey: string) => void; setRegionList: (regionList: any[]) => void; regionKey: ComputedRef<string>; regionList: ComputedRef<any[]>; }",
11
+ "examples": [
12
+ {
13
+ "id": "shared_region_state",
14
+ "title": "共享地域状态",
15
+ "description": "在 Region、AZ 或购买页中共享当前地域选择",
16
+ "code": "<script setup lang=\"ts\">\nimport { useStore } from '@ksyun-internal/versatile';\n\nconst { regionKey, regionList, setRegionKey, setRegionList } = useStore();\n</script>"
17
+ }
18
+ ],
19
+ "commonMistakes": [
20
+ {
21
+ "id": "mutate_computed_directly",
22
+ "description": "直接修改 regionList/regionKey,而不是走 setter",
23
+ "wrongCode": "regionKey.value = 'cn-beijing-6';",
24
+ "correctCode": "setRegionKey('cn-beijing-6');",
25
+ "explanation": "返回的状态是 computed,只读修改应通过 setter 完成。"
26
+ }
27
+ ],
28
+ "searchKeywords": [
29
+ "useStore",
30
+ "regionKey",
31
+ "regionList",
32
+ "全局状态",
33
+ "地域缓存",
34
+ "共享状态"
35
+ ]
36
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "useTable",
3
+ "name": "useTable",
4
+ "displayName": "表格状态管理",
5
+ "category": "table",
6
+ "description": "集中管理表格勾选、展开、列显隐和导出相关状态,适合原子 Table 和业务表格容器共享同一套表格控制逻辑。",
7
+ "importStatement": "import { useTable } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "options",
12
+ "type": "{ rowKey?: string; notCheckTip?: string; tableFields?: TableFields }",
13
+ "required": false,
14
+ "description": "表格配置,可指定 rowKey、未勾选提示文案和列配置定义"
15
+ }
16
+ ],
17
+ "returnType": "{ checkedKeys: Ref<string[]>; expandedKeys: Ref<(string | number)[]>; isChecked: ComputedRef<number>; canCheck: ComputedRef<{ disabled: boolean; msg: string }>; tableRef: Ref<Table | undefined>; componentRef: Ref<any>; noCheckedColFields: Ref<string[]>; setRowKey: Function; exportTableData: Function; hideCol: Function; getTableColTitle: ((key: string) => string) | null; initTableColumnProps: Function; }",
18
+ "examples": [
19
+ {
20
+ "id": "table_selection",
21
+ "title": "管理表格勾选和列显隐",
22
+ "description": "在列表页中集中维护勾选状态和动态列配置",
23
+ "code": "<script setup lang=\"ts\">\nimport { useTable } from '@ksyun-internal/versatile';\n\nconst tableFields = [\n { key: 'name', label: '实例名称', checked: true },\n { key: 'status', label: '状态', checked: true },\n];\nconst { checkedKeys, tableRef, canCheck, initTableColumnProps } = useTable({\n rowKey: 'id',\n tableFields,\n});\n</script>"
24
+ },
25
+ {
26
+ "id": "table_export",
27
+ "title": "导出当前表格数据",
28
+ "description": "通过 hook 暴露的导出方法触发表格导出",
29
+ "code": "<script setup lang=\"ts\">\nimport { useTable } from '@ksyun-internal/versatile';\n\nconst { exportTableData } = useTable({ rowKey: 'id' });\n</script>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "missing_row_key",
35
+ "description": "多选或导出场景没有稳定 rowKey,导致勾选数据不稳定",
36
+ "wrongCode": "const table = useTable();",
37
+ "correctCode": "const table = useTable({ rowKey: 'id' });",
38
+ "explanation": "在业务表格中建议显式指定 rowKey,避免勾选项和导出数据映射错乱。"
39
+ }
40
+ ],
41
+ "searchKeywords": [
42
+ "useTable",
43
+ "Table",
44
+ "勾选状态",
45
+ "列显隐",
46
+ "导出表格",
47
+ "rowKey"
48
+ ]
49
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "id": "useTableGroup",
3
+ "name": "useTableGroup",
4
+ "displayName": "表格分组筛选状态",
5
+ "category": "table",
6
+ "description": "管理 Table 或 ProTable 的 group 筛选状态,并可与 SearchItems 联动生成可展示的筛选项。",
7
+ "importStatement": "import { useTableGroup } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "options",
12
+ "type": "{ page?: Ref<number>; key?: string; defalutValue?: any; searchItemsRef?: Ref<any>; labelMaps?: Record<string, string> | Ref<Record<string, string>>; groupLabel?: string | Record<string, string | { label: string }>; isShowSearchItem?: boolean }",
13
+ "required": false,
14
+ "description": "分组筛选配置,可联动分页、SearchItems 和字段标签映射"
15
+ }
16
+ ],
17
+ "returnType": "{ status: ComputedRef<any>; group: Ref<Record<string, any>>; resetGroup: Function; changeGroup: Function; }",
18
+ "examples": [
19
+ {
20
+ "id": "protable_group",
21
+ "title": "配合 ProTable 的 group 筛选",
22
+ "description": "将 group 状态和 SearchItems 联动,统一驱动表格筛选",
23
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { usePagination, useTableGroup } from '@ksyun-internal/versatile';\n\nconst { page } = usePagination();\nconst searchItemsRef = ref();\nconst { group, changeGroup, resetGroup } = useTableGroup({\n page,\n key: 'status',\n searchItemsRef,\n labelMaps: { using: '运行中', shutdown: '已关机' },\n});\n</script>"
24
+ }
25
+ ],
26
+ "commonMistakes": [
27
+ {
28
+ "id": "missing_label_maps",
29
+ "description": "SearchItems 展示 group 条件时没有提供 labelMaps 或 groupLabel",
30
+ "wrongCode": "useTableGroup({ searchItemsRef });",
31
+ "correctCode": "useTableGroup({ searchItemsRef, labelMaps, groupLabel: '状态' });",
32
+ "explanation": "如果要把 group 同步到 SearchItems,建议补齐展示文案映射。"
33
+ }
34
+ ],
35
+ "searchKeywords": [
36
+ "useTableGroup",
37
+ "group",
38
+ "ProTable",
39
+ "表格筛选",
40
+ "SearchItems",
41
+ "状态分组"
42
+ ]
43
+ }