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,38 @@
1
+ # 标准列表页组合状态 (useLayoutStandardList)
2
+
3
+ 为 LayoutStandardList 组合分页、搜索、分组、排序、列设置和批量操作状态,适合标准列表页快速搭建。
4
+
5
+ **关键词**: useLayoutStandardList, LayoutStandardList, 标准列表页, 分页 搜索 排序, 批量操作, 表格组合状态
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useLayoutStandardList } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 返回值
13
+ ```typescript
14
+ { 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; ... }
15
+ ```
16
+
17
+ ## 常见错误与正确用法 (Anti-Hallucination)
18
+ ### 在 LayoutStandardList 外又重复手写 useSearch/usePagination/useTableSort,导致状态来源分裂
19
+ > **错误用法**: `const search = useSearch(); const pagination = usePagination(); const state = useLayoutStandardList();`
20
+ > **正确写法**: `const state = useLayoutStandardList();`
21
+ > **说明**: 如果页面主体就是 LayoutStandardList,优先复用这个组合 hook。
22
+
23
+ ## 使用示例
24
+ ### 标准列表页容器
25
+ 在 LayoutStandardList 外层持有组合状态和实例引用
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { LayoutStandardList, useLayoutStandardList } from '@ksyun-internal/versatile';
30
+
31
+ const { layoutStandardListRef, page, limit, searchItems, checkedKeys } = useLayoutStandardList();
32
+ </script>
33
+
34
+ <template>
35
+ <LayoutStandardList ref="layoutStandardListRef" :use-list="() => ({ loading: false, dataSource: [], total: 0 })" />
36
+ </template>
37
+ ```
38
+
@@ -0,0 +1,46 @@
1
+ # 变更消息反馈 (useMessage)
2
+
3
+ 为 Apollo mutation 封装统一的成功/失败消息处理逻辑,适合删除、编辑、创建等需要标准化提示文案的请求场景。
4
+
5
+ **关键词**: useMessage, mutation 提示, apollo, 成功失败消息, toast, 反馈
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useMessage } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | onError | `UseMutationReturn<TResult, TVariables>['onError']` | 是 | mutation 返回的错误监听函数 |
16
+ | onDone | `UseMutationReturn<TResult, TVariables>['onDone']` | 否 | mutation 返回的完成监听函数 |
17
+ | isSuccess | `(res: FetchResult<TResult>) => boolean` | 否 | 自定义成功判定逻辑 |
18
+ | action | `string | (() => string)` | 否 | 操作名称,用于生成成功/失败提示文案 |
19
+ | successCallback | `(res: FetchResult<TResult>) => any` | 否 | 成功后的额外回调 |
20
+ | failedCallback | `(e: Error) => any` | 否 | 失败后的额外回调 |
21
+
22
+ ## 返回值
23
+ ```typescript
24
+ void
25
+ ```
26
+
27
+ ## 常见错误与正确用法 (Anti-Hallucination)
28
+ ### 接口返回结构不是标准成功态,但没有传 isSuccess,自定义失败被当成成功
29
+ > **错误用法**: `useMessage(onError, onDone, undefined, '删除');`
30
+ > **正确写法**: `useMessage(onError, onDone, (res) => res.data?.delete?.code === 200, '删除');`
31
+ > **说明**: 如果后端不是默认成功结构,建议显式提供 isSuccess。
32
+
33
+ ## 使用示例
34
+ ### 统一处理 mutation 提示
35
+ 把创建、删除等 mutation 的消息提示收口到 hook
36
+
37
+ ```vue
38
+ <script setup lang="ts">
39
+ import { useMutation } from '@vue/apollo-composable';
40
+ import { useMessage } from '@ksyun-internal/versatile';
41
+
42
+ const { onError, onDone } = useMutation(CREATE_INSTANCE);
43
+ useMessage(onError, onDone, undefined, '创建实例');
44
+ </script>
45
+ ```
46
+
@@ -0,0 +1,37 @@
1
+ # Apollo 缓存修改 (useModifyCache)
2
+
3
+ 返回一个可复用的 Apollo cache.modify 封装函数,适合在 mutation 后局部更新缓存而不重新发请求。
4
+
5
+ **关键词**: useModifyCache, apollo cache, cache.modify, mutation, 局部更新缓存, graphql
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useModifyCache } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 返回值
13
+ ```typescript
14
+ (identify: StoreObject | Reference, fields: Cache.ModifyOptions['fields']) => void
15
+ ```
16
+
17
+ ## 常见错误与正确用法 (Anti-Hallucination)
18
+ ### identify 对象缺少 Apollo 可识别的标识字段
19
+ > **错误用法**: `modifyCache({ name: 'instance-1' }, { status: () => 'running' });`
20
+ > **正确写法**: `modifyCache({ __typename: 'Instance', id: 'ins-1' }, { status: () => 'running' });`
21
+ > **说明**: identify 需要能让 Apollo 唯一定位缓存实体。
22
+
23
+ ## 使用示例
24
+ ### 局部更新 Apollo 缓存
25
+ 在删除或编辑成功后直接修改缓存字段
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { useModifyCache } from '@ksyun-internal/versatile';
30
+
31
+ const modifyCache = useModifyCache();
32
+ modifyCache({ __typename: 'Instance', id: 'ins-1' }, {
33
+ name: () => 'new-name',
34
+ });
35
+ </script>
36
+ ```
37
+
@@ -0,0 +1,41 @@
1
+ # 表格操作弹窗 (useOpenDialog)
2
+
3
+ 针对表格单行操作和批量操作封装弹窗打开逻辑,统一维护当前操作项和批量操作项集合。
4
+
5
+ **关键词**: useOpenDialog, 批量操作, 表格操作, dialog, 单行操作, tableRef
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useOpenDialog } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | tableRef | `Ref<Table | undefined>` | 否 | 表格实例引用,批量操作时可从表格中读取选中项 |
16
+
17
+ ## 返回值
18
+ ```typescript
19
+ { isShowDialog: Ref<boolean>; dialogRef: Ref<any>; opCols: Ref<T[] | undefined>; opCol: Ref<T | undefined>; show: Function; hide: Function; handleClickOpBtn: Function; handleClickBatchOpBtn: Function; }
20
+ ```
21
+
22
+ ## 常见错误与正确用法 (Anti-Hallucination)
23
+ ### 批量操作场景未传入 tableRef,导致无法读取选中项
24
+ > **错误用法**: `const dialog = useOpenDialog();`
25
+ > **正确写法**: `const dialog = useOpenDialog(tableRef);`
26
+ > **说明**: 如果需要 handleClickBatchOpBtn 读取表格选中项,应传入 tableRef。
27
+
28
+ ## 使用示例
29
+ ### 表格操作弹窗
30
+ 点击单行操作按钮时打开弹窗并记录当前行数据
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import { ref } from 'vue';
35
+ import { useOpenDialog } from '@ksyun-internal/versatile';
36
+
37
+ const tableRef = ref();
38
+ const { isShowDialog, opCol, handleClickOpBtn } = useOpenDialog(tableRef);
39
+ </script>
40
+ ```
41
+
@@ -0,0 +1,60 @@
1
+ # 分页状态管理 (usePagination)
2
+
3
+ 管理列表页常用的 page、limit、limits 以及分页变更回调,适合和 ProTable、PaginationPlus、Search 组合使用。
4
+
5
+ **关键词**: usePagination, 分页, page, limit, PaginationPlus, 列表页
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { usePagination } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | options | `{ page?: number; limit?: number; limits?: number[]; callback?: (v: PaginationChangeData) => void }` | 否 | 分页初始化配置,可预设页码、每页条数、可选 limits 及翻页后的回调 |
16
+
17
+ ## 返回值
18
+ ```typescript
19
+ { page: Ref<number>; limit: Ref<number>; limits: Ref<number[]>; pageChange: (pageParams: PaginationChangeData) => void; }
20
+ ```
21
+
22
+ ## 常见错误与正确用法 (Anti-Hallucination)
23
+ ### 只绑定 page,没有同步维护 limit
24
+ > **错误用法**: `const { page } = usePagination();`
25
+ > **正确写法**: `const { page, limit } = usePagination();`
26
+ > **说明**: 如果页面支持切换每页条数,应同时使用 hook 返回的 limit。
27
+
28
+ ## 使用示例
29
+ ### 基础分页用法
30
+ 通过 hook 统一管理列表页码和每页条数
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import { PaginationPlus, usePagination } from '@ksyun-internal/versatile';
35
+
36
+ const { page, limit, pageChange } = usePagination({
37
+ page: 1,
38
+ limit: 20,
39
+ });
40
+ </script>
41
+
42
+ <template>
43
+ <PaginationPlus v-model="page" v-model:limit="limit" :total="200" @change="pageChange" />
44
+ </template>
45
+ ```
46
+
47
+ ### 带回调的分页
48
+ 在分页变化后触发数据刷新或埋点逻辑
49
+
50
+ ```vue
51
+ <script setup lang="ts">
52
+ import { usePagination } from '@ksyun-internal/versatile';
53
+
54
+ const fetchList = () => console.log('reload');
55
+ const { page, limit, pageChange } = usePagination({
56
+ callback: () => fetchList(),
57
+ });
58
+ </script>
59
+ ```
60
+
@@ -0,0 +1,54 @@
1
+ # 本地持久化 (usePersist)
2
+
3
+ 将响应式数据持久化到 localStorage 或 sessionStorage,适合保存列表筛选、用户偏好和表格配置。
4
+
5
+ **关键词**: usePersist, localStorage, sessionStorage, 持久化, 列表偏好, 缓存状态
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { usePersist } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | key | `string` | 是 | 存储键名 |
16
+ | defaultValue | `T` | 是 | 初始化默认值 |
17
+ | options | `PersistOptions<T>` | 否 | 持久化配置,可切换 storage、自定义序列化和 watch 行为 |
18
+
19
+ ## 返回值
20
+ ```typescript
21
+ Ref<T>
22
+ ```
23
+
24
+ ## 常见错误与正确用法 (Anti-Hallucination)
25
+ ### 使用会变化的 key,导致同一份状态被重复写入
26
+ > **错误用法**: `usePersist(`table-${Date.now()}`, []);`
27
+ > **正确写法**: `usePersist('instance-table-fields', []);`
28
+ > **说明**: key 应保持稳定,否则无法复用持久化结果。
29
+
30
+ ## 使用示例
31
+ ### 持久化表格配置
32
+ 保存用户的列显隐或筛选配置
33
+
34
+ ```vue
35
+ <script setup lang="ts">
36
+ import { usePersist } from '@ksyun-internal/versatile';
37
+
38
+ const tableFields = usePersist('table-fields', ['name', 'status']);
39
+ </script>
40
+ ```
41
+
42
+ ### 使用 sessionStorage
43
+ 仅在当前会话内保留搜索状态
44
+
45
+ ```vue
46
+ <script setup lang="ts">
47
+ import { usePersist } from '@ksyun-internal/versatile';
48
+
49
+ const searchState = usePersist('instance-search', { key: 'name', value: '' }, {
50
+ storage: sessionStorage,
51
+ });
52
+ </script>
53
+ ```
54
+
@@ -0,0 +1,41 @@
1
+ # 查询轮询 (usePoll)
2
+
3
+ 包装 Apollo 查询结果并启用轮询场景,适合在列表页、详情页中持续刷新接口数据。
4
+
5
+ **关键词**: usePoll, 轮询, apollo, useQuery, 自动刷新, 列表轮询
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { usePoll } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | result | `UseQueryReturn<any, any>` | 是 | Apollo useQuery 返回的查询对象 |
16
+
17
+ ## 返回值
18
+ ```typescript
19
+ UseQueryReturn<any, any>
20
+ ```
21
+
22
+ ## 常见错误与正确用法 (Anti-Hallucination)
23
+ ### 传入普通 Promise 或自定义对象而不是 Apollo 查询返回值
24
+ > **错误用法**: `const result = usePoll(fetchList());`
25
+ > **正确写法**: `const result = usePoll(useQuery(GET_LIST));`
26
+ > **说明**: usePoll 依赖 Apollo 的 UseQueryReturn 结构。
27
+
28
+ ## 使用示例
29
+ ### 轮询查询结果
30
+ 对 useQuery 返回值启用轮询式刷新
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import { useQuery } from '@vue/apollo-composable';
35
+ import { usePoll } from '@ksyun-internal/versatile';
36
+
37
+ const queryResult = useQuery(GET_INSTANCE_LIST);
38
+ const pollResult = usePoll(queryResult);
39
+ </script>
40
+ ```
41
+
@@ -0,0 +1,34 @@
1
+ # 增强路由读取 (useRoutePlus)
2
+
3
+ 对 vue-router 的 route 做包装,直接返回 params、query 及其 refs,便于在组合式函数中按字段响应式使用。
4
+
5
+ **关键词**: useRoutePlus, route params, query refs, vue-router, 详情页参数, 路由读取
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useRoutePlus } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 返回值
13
+ ```typescript
14
+ { $route: RouteLocationNormalizedLoadedGeneric; params: Record<string, string>; paramRefs: ToRefs<Record<string, string>>; query: LocationQuery; queryRefs: ToRefs<LocationQuery>; }
15
+ ```
16
+
17
+ ## 常见错误与正确用法 (Anti-Hallucination)
18
+ ### 直接修改 paramRefs/queryRefs,期望同步改写路由地址
19
+ > **错误用法**: `paramRefs.id.value = '2';`
20
+ > **正确写法**: `如需跳转,请配合 useRouterPlus 或 router.push。`
21
+ > **说明**: 这个 hook 主要用于读取路由状态,不负责写回 URL。
22
+
23
+ ## 使用示例
24
+ ### 读取详情页路由参数
25
+ 把详情页 id 和 query 参数拆成可直接使用的 refs
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { useRoutePlus } from '@ksyun-internal/versatile';
30
+
31
+ const { params, paramRefs, queryRefs } = useRoutePlus();
32
+ </script>
33
+ ```
34
+
@@ -0,0 +1,34 @@
1
+ # 增强路由跳转 (useRouterPlus)
2
+
3
+ 对 vue-router 的导航能力做统一封装,提供新开页签跳转和可回退的导航能力。
4
+
5
+ **关键词**: useRouterPlus, goNewPage, goBack, 路由跳转, 新开页签, vue-router
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useRouterPlus } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 返回值
13
+ ```typescript
14
+ { $router: Router; goNewPage: (to: string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric, currentLocation?: RouteLocationNormalizedLoadedGeneric) => void; goBack: (back?: string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric) => void; }
15
+ ```
16
+
17
+ ## 常见错误与正确用法 (Anti-Hallucination)
18
+ ### 调用 goBack 但没有提供兜底地址,历史栈不足时体验不稳定
19
+ > **错误用法**: `goBack();`
20
+ > **正确写法**: `goBack({ name: 'instance-list' });`
21
+ > **说明**: 在业务列表/详情页之间跳转时,建议提供明确回退目标。
22
+
23
+ ## 使用示例
24
+ ### 跳转详情页或新页签打开
25
+ 在列表页操作列中统一处理跳转行为
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { useRouterPlus } from '@ksyun-internal/versatile';
30
+
31
+ const { goNewPage, goBack } = useRouterPlus();
32
+ </script>
33
+ ```
34
+
@@ -0,0 +1,68 @@
1
+ # 搜索状态管理 (useSearch)
2
+
3
+ 管理 Search 和 SearchItems 常用的搜索状态,统一维护 searchKey、searchValue、searchItems 及其变更方法。配合列表页分页时可在筛选变化后重置页码。
4
+
5
+ **关键词**: useSearch, Search, SearchItems, 列表筛选, 搜索状态, 检索条件
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useSearch } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | options | `{ defaultSearchKey?: string; page?: Ref<number> }` | 否 | 初始化配置,可指定默认搜索字段,并传入分页页码以便搜索变化时联动重置 |
16
+
17
+ ## 返回值
18
+ ```typescript
19
+ { searchKey: Ref<string>; searchKeyRela: Ref<string>; searchValue: Ref<string>; searchItems: Ref<T | undefined>; searchItemsRef: Ref<any>; handleChangeSearchValue: Function; handleChangeSingleValue: Function; handleChangeSearchSingleValue: Function; }
20
+ ```
21
+
22
+ ## 常见错误与正确用法 (Anti-Hallucination)
23
+ ### 列表页搜索变化时没有传入 page,导致筛选后仍停留在旧页码
24
+ > **错误用法**: `const search = useSearch();`
25
+ > **正确写法**: `const search = useSearch({ page });`
26
+ > **说明**: 在分页列表中建议把 page 传给 useSearch,让搜索条件变化时同步回到第一页。
27
+
28
+ ### 重复自己维护 searchKey/searchValue,和 hook 返回值并存
29
+ > **错误用法**: `const searchKey = ref('name'); const searchValue = ref(''); const { searchItems } = useSearch();`
30
+ > **正确写法**: `const { searchKey, searchValue, searchItems } = useSearch({ defaultSearchKey: 'name' });`
31
+ > **说明**: 优先使用 useSearch 返回的整套状态,避免来源分裂。
32
+
33
+ ## 使用示例
34
+ ### 列表页搜索状态
35
+ 在列表页中统一维护搜索 key、搜索值和搜索项
36
+
37
+ ```vue
38
+ <script setup lang="ts">
39
+ import { Search, SearchItems, usePagination, useSearch } from '@ksyun-internal/versatile';
40
+
41
+ const { page } = usePagination();
42
+ const { searchKey, searchValue, searchItems } = useSearch({
43
+ defaultSearchKey: 'name',
44
+ page,
45
+ });
46
+ </script>
47
+
48
+ <template>
49
+ <Search v-model:search-key="searchKey" v-model:search-value="searchValue" :searches="[]" />
50
+ <SearchItems v-model="searchItems" />
51
+ </template>
52
+ ```
53
+
54
+ ### 手动处理搜索值变更
55
+ 通过返回的方法接管批量搜索或单值搜索的更新逻辑
56
+
57
+ ```vue
58
+ <script setup lang="ts">
59
+ import { useSearch } from '@ksyun-internal/versatile';
60
+
61
+ const { handleChangeSearchValue } = useSearch();
62
+
63
+ const onSearch = (value?: string) => {
64
+ handleChangeSearchValue(value, value);
65
+ };
66
+ </script>
67
+ ```
68
+
@@ -0,0 +1,43 @@
1
+ # Shell 内容挂载 (useShell)
2
+
3
+ 在弹窗显示时把 shell 或命令内容挂载到指定容器引用,适合命令预览、终端输出展示等场景。
4
+
5
+ **关键词**: useShell, shell, 命令预览, dialog content, 终端输出, shellRef
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useShell } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | content | `WatchSource<string | undefined | null>` | 是 | 需要展示的 shell 内容 |
16
+ | isShowDialog | `Ref<boolean>` | 是 | 弹窗显隐状态 |
17
+
18
+ ## 返回值
19
+ ```typescript
20
+ { shellRef: Ref<any> }
21
+ ```
22
+
23
+ ## 常见错误与正确用法 (Anti-Hallucination)
24
+ ### 传入一次性字符串字面量,后续更新不会同步
25
+ > **错误用法**: `useShell('kubectl get pods', isShowDialog);`
26
+ > **正确写法**: `const content = ref('kubectl get pods'); useShell(content, isShowDialog);`
27
+ > **说明**: 内容建议使用 Ref 或 getter,便于后续更新时同步渲染。
28
+
29
+ ## 使用示例
30
+ ### 命令预览弹窗
31
+ 在弹窗打开时渲染命令或脚本内容
32
+
33
+ ```vue
34
+ <script setup lang="ts">
35
+ import { ref } from 'vue';
36
+ import { useShell } from '@ksyun-internal/versatile';
37
+
38
+ const content = ref('kubectl get pods');
39
+ const isShowDialog = ref(false);
40
+ const { shellRef } = useShell(content, isShowDialog);
41
+ </script>
42
+ ```
43
+
@@ -0,0 +1,41 @@
1
+ # 头部返回跳转 (useSkip)
2
+
3
+ 从 Header 的 back 配置中提取统一跳转逻辑,适合详情页和购买链路页的返回按钮行为。
4
+
5
+ **关键词**: useSkip, Header back, 返回跳转, 详情页返回, goLink, layout header
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useSkip } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | back | `Ref<LayoutHeaderProps['back']>` | 是 | Header 的 back 配置项 |
16
+
17
+ ## 返回值
18
+ ```typescript
19
+ { goLink: () => any }
20
+ ```
21
+
22
+ ## 常见错误与正确用法 (Anti-Hallucination)
23
+ ### 直接传普通对象而不是 Ref,导致 back 配置变化无法联动
24
+ > **错误用法**: `useSkip({ to: { name: 'list' } });`
25
+ > **正确写法**: `const back = ref({ to: { name: 'list' } }); useSkip(back);`
26
+ > **说明**: hook 设计为消费 Header back 的响应式配置。
27
+
28
+ ## 使用示例
29
+ ### Header 返回按钮
30
+ 复用 Header back 配置实现统一返回跳转
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import { ref } from 'vue';
35
+ import { useSkip } from '@ksyun-internal/versatile';
36
+
37
+ const back = ref({ to: { name: 'instance-list' } });
38
+ const { goLink } = useSkip(back);
39
+ </script>
40
+ ```
41
+
@@ -0,0 +1,46 @@
1
+ # 带存储的 ID 实体映射 (useStorageIdEntity)
2
+
3
+ 在 useIdEntity 的基础上增加存储键能力,适合把当前选中的实体 ID 与本地缓存联动,支持刷新后恢复选择。
4
+
5
+ **关键词**: useStorageIdEntity, 本地记忆选择, storage, 实体映射, 刷新恢复, workspace
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useStorageIdEntity } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 参数 (Params)
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | id | `Ref<string | number | undefined | null>` | 是 | 当前选中的实体 ID |
16
+ | list | `Ref<Entity[] | undefined | null>` | 是 | 实体源列表 |
17
+ | key | `keyof Entity` | 是 | 实体主键字段 |
18
+ | storageName | `string` | 否 | 本地存储使用的键名 |
19
+ | emit | `(entity: Entity | undefined) => void` | 否 | 实体变化时的回调 |
20
+
21
+ ## 返回值
22
+ ```typescript
23
+ Ref<Entity | undefined>
24
+ ```
25
+
26
+ ## 常见错误与正确用法 (Anti-Hallucination)
27
+ ### 多个页面复用同一个 storageName,导致选择串数据
28
+ > **错误用法**: `useStorageIdEntity(id, list, 'id', 'selected-id');`
29
+ > **正确写法**: `useStorageIdEntity(id, list, 'id', 'instance-workspace-id');`
30
+ > **说明**: storageName 建议按业务域区分,避免不同页面互相覆盖。
31
+
32
+ ## 使用示例
33
+ ### 记住上次选择的实体
34
+ 页面刷新后仍恢复用户上次选择的对象
35
+
36
+ ```vue
37
+ <script setup lang="ts">
38
+ import { ref } from 'vue';
39
+ import { useStorageIdEntity } from '@ksyun-internal/versatile';
40
+
41
+ const selectedId = ref('ws-001');
42
+ const workspaceList = ref([{ WorkspaceId: 'ws-001', WorkspaceName: '工作空间1' }]);
43
+ const currentWorkspace = useStorageIdEntity(selectedId, workspaceList, 'WorkspaceId', 'workspace-id');
44
+ </script>
45
+ ```
46
+
@@ -0,0 +1,34 @@
1
+ # 轻量全局状态 (useStore)
2
+
3
+ 读取和写入 versatile 内部维护的轻量全局状态,当前暴露地域 key 和地域列表的读写能力。
4
+
5
+ **关键词**: useStore, regionKey, regionList, 全局状态, 地域缓存, 共享状态
6
+
7
+ ## 导入语句
8
+ ```typescript
9
+ import { useStore } from '@ksyun-internal/versatile';
10
+ ```
11
+
12
+ ## 返回值
13
+ ```typescript
14
+ { setRegionKey: (regionKey: string) => void; setRegionList: (regionList: any[]) => void; regionKey: ComputedRef<string>; regionList: ComputedRef<any[]>; }
15
+ ```
16
+
17
+ ## 常见错误与正确用法 (Anti-Hallucination)
18
+ ### 直接修改 regionList/regionKey,而不是走 setter
19
+ > **错误用法**: `regionKey.value = 'cn-beijing-6';`
20
+ > **正确写法**: `setRegionKey('cn-beijing-6');`
21
+ > **说明**: 返回的状态是 computed,只读修改应通过 setter 完成。
22
+
23
+ ## 使用示例
24
+ ### 共享地域状态
25
+ 在 Region、AZ 或购买页中共享当前地域选择
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { useStore } from '@ksyun-internal/versatile';
30
+
31
+ const { regionKey, regionList, setRegionKey, setRegionList } = useStore();
32
+ </script>
33
+ ```
34
+