king-design-analyzer 2.1.9 → 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 (305) 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 +4 -3
  102. package/dist/ast/index.mjs +2 -1
  103. package/dist/{chunk-DSWKLUIX.mjs → chunk-3LYQ5XFM.mjs} +1 -1
  104. package/dist/chunk-BI5TIQID.mjs +330 -0
  105. package/dist/{chunk-F26GUCGG.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-KF5YBEM5.js +143 -0
  110. package/dist/{chunk-H2ET6MMM.mjs → chunk-KMIDURUR.mjs} +42 -47
  111. package/dist/chunk-QC6VTSA3.mjs +117 -0
  112. package/dist/{chunk-2W6OCG2S.js → chunk-SZYVGYKK.js} +42 -48
  113. package/dist/{chunk-WYSRJVX4.js → chunk-TA3SV4SP.js} +2 -2
  114. package/dist/{chunk-OJOHB64C.mjs → chunk-XGPHQHLR.mjs} +4 -4
  115. package/dist/full/index.js +7 -6
  116. package/dist/full/index.mjs +5 -4
  117. package/dist/index.d.mts +1 -0
  118. package/dist/index.d.ts +1 -0
  119. package/dist/index.js +14 -13
  120. package/dist/index.mjs +6 -5
  121. package/dist/metadata/index.d.mts +22 -2
  122. package/dist/metadata/index.d.ts +22 -2
  123. package/dist/metadata/index.js +26 -16
  124. package/dist/metadata/index.mjs +26 -15
  125. package/dist/resolve-BsLBxlBi.d.mts +24 -0
  126. package/dist/resolve-BsLBxlBi.d.ts +24 -0
  127. package/dist/runtime/index.js +4 -4
  128. package/dist/runtime/index.mjs +2 -2
  129. package/dist/shared/index.d.mts +10 -0
  130. package/dist/shared/index.d.ts +10 -0
  131. package/dist/shared/index.js +23 -0
  132. package/dist/shared/index.mjs +2 -0
  133. package/dist/static/index.js +5 -5
  134. package/dist/static/index.mjs +2 -2
  135. package/docs_for_llm/actions.doc.md +77 -0
  136. package/docs_for_llm/advancedset.doc.md +89 -0
  137. package/docs_for_llm/affix.doc.md +15 -7
  138. package/docs_for_llm/aksk.doc.md +111 -0
  139. package/docs_for_llm/az.doc.md +17 -11
  140. package/docs_for_llm/badge.doc.md +6 -5
  141. package/docs_for_llm/billtypes.doc.md +17 -11
  142. package/docs_for_llm/breadcrumb.doc.md +6 -3
  143. package/docs_for_llm/button.doc.md +34 -18
  144. package/docs_for_llm/buttonlink.doc.md +55 -0
  145. package/docs_for_llm/card.doc.md +8 -5
  146. package/docs_for_llm/cardcol.doc.md +78 -0
  147. package/docs_for_llm/cardcols.doc.md +84 -0
  148. package/docs_for_llm/cardcontent.doc.md +10 -10
  149. package/docs_for_llm/cardtabs.doc.md +106 -0
  150. package/docs_for_llm/carousel.doc.md +8 -7
  151. package/docs_for_llm/cascader.doc.md +46 -25
  152. package/docs_for_llm/checkbox.doc.md +25 -13
  153. package/docs_for_llm/cidrinput.doc.md +83 -0
  154. package/docs_for_llm/code.doc.md +22 -11
  155. package/docs_for_llm/collapse.doc.md +9 -6
  156. package/docs_for_llm/colorpicker.doc.md +104 -0
  157. package/docs_for_llm/copy.doc.md +15 -13
  158. package/docs_for_llm/copyhover.doc.md +59 -0
  159. package/docs_for_llm/copyrow.doc.md +71 -0
  160. package/docs_for_llm/datepicker.doc.md +51 -39
  161. package/docs_for_llm/description.doc.md +75 -0
  162. package/docs_for_llm/descriptions.doc.md +9 -6
  163. package/docs_for_llm/dialog.doc.md +48 -77
  164. package/docs_for_llm/divider.doc.md +9 -7
  165. package/docs_for_llm/drawer.doc.md +43 -84
  166. package/docs_for_llm/dropdown.doc.md +52 -21
  167. package/docs_for_llm/duration.doc.md +76 -0
  168. package/docs_for_llm/editable.doc.md +36 -14
  169. package/docs_for_llm/ellipsis.doc.md +10 -5
  170. package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
  171. package/docs_for_llm/flex.doc.md +74 -0
  172. package/docs_for_llm/form.doc.md +33 -14
  173. package/docs_for_llm/formiteminput.doc.md +128 -0
  174. package/docs_for_llm/formitemspinner.doc.md +105 -0
  175. package/docs_for_llm/formitemswitch.doc.md +113 -0
  176. package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
  177. package/docs_for_llm/grid.doc.md +7 -5
  178. package/docs_for_llm/header.doc.md +85 -0
  179. package/docs_for_llm/icon.doc.md +12 -8
  180. package/docs_for_llm/icontooltip.doc.md +121 -0
  181. package/docs_for_llm/input.doc.md +90 -39
  182. package/docs_for_llm/instancelist.doc.md +113 -0
  183. package/docs_for_llm/instancenum.doc.md +95 -0
  184. package/docs_for_llm/ipinput.doc.md +77 -0
  185. package/docs_for_llm/kspstatus.doc.md +82 -0
  186. package/docs_for_llm/kvcode.doc.md +76 -0
  187. package/docs_for_llm/layoutcontent.doc.md +17 -17
  188. package/docs_for_llm/layoutlistcontent.doc.md +95 -0
  189. package/docs_for_llm/layoutpermissioncontent.doc.md +84 -0
  190. package/docs_for_llm/layoutstandardlist.doc.md +120 -0
  191. package/docs_for_llm/layouttabs.doc.md +101 -0
  192. package/docs_for_llm/lazymount.doc.md +73 -0
  193. package/docs_for_llm/lazyteleport.doc.md +76 -0
  194. package/docs_for_llm/menu.doc.md +14 -11
  195. package/docs_for_llm/message.doc.md +48 -10
  196. package/docs_for_llm/pagination.doc.md +30 -17
  197. package/docs_for_llm/paginationplus.doc.md +31 -10
  198. package/docs_for_llm/password.doc.md +86 -0
  199. package/docs_for_llm/popover.doc.md +24 -55
  200. package/docs_for_llm/progress.doc.md +13 -10
  201. package/docs_for_llm/projects.doc.md +91 -0
  202. package/docs_for_llm/protable.doc.md +89 -15
  203. package/docs_for_llm/queuevisualrange.doc.md +78 -0
  204. package/docs_for_llm/radio.doc.md +23 -8
  205. package/docs_for_llm/rate.doc.md +122 -0
  206. package/docs_for_llm/region.doc.md +25 -13
  207. package/docs_for_llm/search.doc.md +120 -0
  208. package/docs_for_llm/searchinput.doc.md +111 -0
  209. package/docs_for_llm/searchitems.doc.md +116 -0
  210. package/docs_for_llm/searchselect.doc.md +126 -0
  211. package/docs_for_llm/select.doc.md +40 -55
  212. package/docs_for_llm/sidebar.doc.md +133 -0
  213. package/docs_for_llm/skeleton.doc.md +117 -0
  214. package/docs_for_llm/slider.doc.md +31 -21
  215. package/docs_for_llm/spin.doc.md +8 -5
  216. package/docs_for_llm/spinner.doc.md +28 -18
  217. package/docs_for_llm/split.doc.md +157 -0
  218. package/docs_for_llm/sshkeys.doc.md +88 -0
  219. package/docs_for_llm/status.doc.md +14 -9
  220. package/docs_for_llm/steps.doc.md +10 -7
  221. package/docs_for_llm/switch.doc.md +17 -14
  222. package/docs_for_llm/table.doc.md +118 -51
  223. package/docs_for_llm/tablecolumnid.doc.md +36 -16
  224. package/docs_for_llm/tabs.doc.md +19 -10
  225. package/docs_for_llm/tag.doc.md +19 -10
  226. package/docs_for_llm/timeline.doc.md +109 -0
  227. package/docs_for_llm/timepicker.doc.md +57 -38
  228. package/docs_for_llm/timerange.doc.md +157 -0
  229. package/docs_for_llm/tip.doc.md +20 -11
  230. package/docs_for_llm/tooltip.doc.md +55 -29
  231. package/docs_for_llm/tour.doc.md +48 -29
  232. package/docs_for_llm/transfer.doc.md +40 -29
  233. package/docs_for_llm/tree.doc.md +65 -23
  234. package/docs_for_llm/treeselect.doc.md +37 -48
  235. package/docs_for_llm/upload.doc.md +56 -32
  236. package/docs_for_llm/useCRUD.doc.md +49 -0
  237. package/docs_for_llm/useCountdown.doc.md +43 -0
  238. package/docs_for_llm/useDetail.doc.md +48 -0
  239. package/docs_for_llm/useDialog.doc.md +46 -0
  240. package/docs_for_llm/useEntity.doc.md +45 -0
  241. package/docs_for_llm/useEventListener.doc.md +44 -0
  242. package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
  243. package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
  244. package/docs_for_llm/useGetUserPermission.doc.md +43 -0
  245. package/docs_for_llm/useGroup.doc.md +48 -0
  246. package/docs_for_llm/useIdEntities.doc.md +48 -0
  247. package/docs_for_llm/useIdEntity.doc.md +103 -0
  248. package/docs_for_llm/useInterval.doc.md +43 -0
  249. package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
  250. package/docs_for_llm/useMessage.doc.md +46 -0
  251. package/docs_for_llm/useModifyCache.doc.md +37 -0
  252. package/docs_for_llm/useOpenDialog.doc.md +41 -0
  253. package/docs_for_llm/usePagination.doc.md +60 -0
  254. package/docs_for_llm/usePersist.doc.md +54 -0
  255. package/docs_for_llm/usePoll.doc.md +41 -0
  256. package/docs_for_llm/useRoutePlus.doc.md +34 -0
  257. package/docs_for_llm/useRouterPlus.doc.md +34 -0
  258. package/docs_for_llm/useSearch.doc.md +68 -0
  259. package/docs_for_llm/useShell.doc.md +43 -0
  260. package/docs_for_llm/useSkip.doc.md +41 -0
  261. package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
  262. package/docs_for_llm/useStore.doc.md +34 -0
  263. package/docs_for_llm/useTable.doc.md +57 -0
  264. package/docs_for_llm/useTableGroup.doc.md +47 -0
  265. package/docs_for_llm/useTableSort.doc.md +40 -0
  266. package/docs_for_llm/useToState.doc.md +112 -0
  267. package/docs_for_llm/useUser.doc.md +38 -0
  268. package/docs_for_llm/useValidForm.doc.md +41 -0
  269. package/docs_for_llm/vdialog.doc.md +129 -0
  270. package/docs_for_llm/vdrawer.doc.md +119 -0
  271. package/docs_for_llm/virtuallist.doc.md +6 -3
  272. package/hooks/useCRUD.json +61 -0
  273. package/hooks/useCountdown.json +49 -0
  274. package/hooks/useDetail.json +67 -0
  275. package/hooks/useDialog.json +49 -0
  276. package/hooks/useEntity.json +61 -0
  277. package/hooks/useEventListener.json +61 -0
  278. package/hooks/useFalseUntilTruthy.json +43 -0
  279. package/hooks/useGetCopyAuthText.json +36 -0
  280. package/hooks/useGetUserPermission.json +55 -0
  281. package/hooks/useGroup.json +49 -0
  282. package/hooks/useIdEntities.json +61 -0
  283. package/hooks/useInterval.json +55 -0
  284. package/hooks/useLayoutStandardList.json +36 -0
  285. package/hooks/useMessage.json +73 -0
  286. package/hooks/useModifyCache.json +36 -0
  287. package/hooks/useOpenDialog.json +43 -0
  288. package/hooks/usePagination.json +49 -0
  289. package/hooks/usePersist.json +61 -0
  290. package/hooks/usePoll.json +43 -0
  291. package/hooks/useRoutePlus.json +36 -0
  292. package/hooks/useRouterPlus.json +36 -0
  293. package/hooks/useSearch.json +56 -0
  294. package/hooks/useShell.json +49 -0
  295. package/hooks/useSkip.json +43 -0
  296. package/hooks/useStorageIdEntity.json +67 -0
  297. package/hooks/useStore.json +36 -0
  298. package/hooks/useTable.json +49 -0
  299. package/hooks/useTableGroup.json +43 -0
  300. package/hooks/useTableSort.json +43 -0
  301. package/hooks/useUser.json +36 -0
  302. package/hooks/useValidForm.json +43 -0
  303. package/package.json +12 -6
  304. package/dist/chunk-HPAUCD5I.js +0 -156
  305. package/dist/chunk-L4DS3EXI.mjs +0 -133
@@ -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
+ }
@@ -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
+ }