king-design-analyzer 2.1.9 → 2.2.1

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 (327) hide show
  1. package/components/actions.json +109 -0
  2. package/components/advancedset.json +128 -0
  3. package/components/affix.json +8 -0
  4. package/components/aksk.json +172 -0
  5. package/components/anchor.json +220 -0
  6. package/components/anchorlink.json +111 -0
  7. package/components/az.json +15 -2
  8. package/components/badge.json +8 -0
  9. package/components/billtypes.json +14 -2
  10. package/components/breadcrumb.json +9 -1
  11. package/components/button.json +192 -0
  12. package/components/buttonlink.json +74 -0
  13. package/components/card.json +14 -4
  14. package/components/cardcol.json +142 -0
  15. package/components/cardcols.json +121 -0
  16. package/components/cardcontent.json +20 -3
  17. package/components/cardtabs.json +172 -0
  18. package/components/carousel.json +7 -0
  19. package/components/cascader.json +576 -368
  20. package/components/checkbox.json +51 -4
  21. package/components/cidrinput.json +140 -0
  22. package/components/code.json +8 -1
  23. package/components/collapse.json +335 -341
  24. package/components/colorpicker.json +217 -0
  25. package/components/configprovider.json +96 -0
  26. package/components/copy.json +7 -0
  27. package/components/copyhover.json +111 -0
  28. package/components/copyrow.json +125 -0
  29. package/components/datepicker.json +656 -524
  30. package/components/description.json +98 -0
  31. package/components/descriptions.json +10 -3
  32. package/components/diagram.json +295 -0
  33. package/components/dialog.json +526 -455
  34. package/components/divider.json +9 -1
  35. package/components/drawer.json +603 -558
  36. package/components/dropdown.json +464 -384
  37. package/components/duration.json +125 -0
  38. package/components/editable.json +66 -0
  39. package/components/ellipsis.json +34 -1
  40. package/components/filtertablefieldsdialog.json +128 -0
  41. package/components/flex.json +152 -0
  42. package/components/form.json +143 -3
  43. package/components/formiteminput.json +214 -0
  44. package/components/formitemspinner.json +213 -0
  45. package/components/formitemswitch.json +185 -0
  46. package/components/formitemtableconfigs.json +210 -0
  47. package/components/grid.json +7 -0
  48. package/components/header.json +165 -0
  49. package/components/icon.json +13 -1
  50. package/components/icontooltip.json +19 -1
  51. package/components/input.json +196 -8
  52. package/components/instancelist.json +194 -0
  53. package/components/instancenum.json +196 -0
  54. package/components/ipinput.json +117 -0
  55. package/components/kspstatus.json +205 -0
  56. package/components/kvcode.json +120 -0
  57. package/components/layoutcontent.json +24 -3
  58. package/components/layoutlistcontent.json +157 -0
  59. package/components/layoutpermissioncontent.json +156 -0
  60. package/components/layoutstandardlist.json +276 -0
  61. package/components/layouttabs.json +168 -0
  62. package/components/lazymount.json +87 -0
  63. package/components/lazyteleport.json +119 -0
  64. package/components/menu.json +11 -3
  65. package/components/notification.json +351 -0
  66. package/components/pagination.json +12 -0
  67. package/components/paginationplus.json +30 -3
  68. package/components/password.json +121 -0
  69. package/components/popover.json +457 -437
  70. package/components/projects.json +129 -0
  71. package/components/protable.json +99 -8
  72. package/components/queuevisualrange.json +110 -0
  73. package/components/radio.json +82 -2
  74. package/components/rate.json +200 -0
  75. package/components/region.json +14 -2
  76. package/components/scrollselect.json +140 -0
  77. package/components/search.json +221 -0
  78. package/components/searchinput.json +132 -0
  79. package/components/searchitems.json +215 -0
  80. package/components/searchselect.json +195 -0
  81. package/components/select.json +749 -666
  82. package/components/sidebar.json +198 -0
  83. package/components/skeleton.json +234 -0
  84. package/components/slider.json +12 -2
  85. package/components/spin.json +10 -2
  86. package/components/spinner.json +419 -429
  87. package/components/split.json +263 -0
  88. package/components/sshkeys.json +138 -0
  89. package/components/status.json +60 -3
  90. package/components/steps.json +7 -0
  91. package/components/switch.json +12 -3
  92. package/components/table.json +24 -2
  93. package/components/tablecolumnid.json +14 -2
  94. package/components/tabs.json +14 -2
  95. package/components/tag.json +8 -5
  96. package/components/timeline.json +215 -0
  97. package/components/timepicker.json +147 -3
  98. package/components/timerange.json +262 -0
  99. package/components/tip.json +27 -0
  100. package/components/tooltip.json +492 -395
  101. package/components/tour.json +418 -372
  102. package/components/transfer.json +79 -8
  103. package/components/tree.json +28 -5
  104. package/components/treeselect.json +612 -475
  105. package/components/upload.json +474 -473
  106. package/components/vdialog.json +309 -0
  107. package/components/vdrawer.json +335 -0
  108. package/components/virtuallist.json +7 -0
  109. package/dist/ast/index.d.mts +65 -2
  110. package/dist/ast/index.d.ts +65 -2
  111. package/dist/ast/index.js +4 -3
  112. package/dist/ast/index.mjs +2 -1
  113. package/dist/chunk-4OTQAQ6J.mjs +341 -0
  114. package/dist/{chunk-F26GUCGG.js → chunk-4WXOYU2N.js} +32 -9
  115. package/dist/chunk-6HOIRUQB.mjs +409 -0
  116. package/dist/chunk-DHLWNT53.js +364 -0
  117. package/dist/{chunk-H2ET6MMM.mjs → chunk-IPJJMPOO.mjs} +155 -66
  118. package/dist/{chunk-WYSRJVX4.js → chunk-JJ6AB4ZH.js} +2 -2
  119. package/dist/{chunk-2W6OCG2S.js → chunk-JNRGUR3O.js} +155 -67
  120. package/dist/chunk-KF5YBEM5.js +143 -0
  121. package/dist/{chunk-OJOHB64C.mjs → chunk-LRTDTFFQ.mjs} +28 -5
  122. package/dist/{chunk-DSWKLUIX.mjs → chunk-NZL6T22V.mjs} +1 -1
  123. package/dist/chunk-QC6VTSA3.mjs +117 -0
  124. package/dist/chunk-V5N65MRP.js +411 -0
  125. package/dist/full/index.d.mts +2 -0
  126. package/dist/full/index.d.ts +2 -0
  127. package/dist/full/index.js +7 -6
  128. package/dist/full/index.mjs +5 -4
  129. package/dist/index.d.mts +1 -0
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.js +14 -13
  132. package/dist/index.mjs +6 -5
  133. package/dist/metadata/index.d.mts +38 -3
  134. package/dist/metadata/index.d.ts +38 -3
  135. package/dist/metadata/index.js +26 -16
  136. package/dist/metadata/index.mjs +26 -15
  137. package/dist/resolve-BsLBxlBi.d.mts +24 -0
  138. package/dist/resolve-BsLBxlBi.d.ts +24 -0
  139. package/dist/runtime/index.d.mts +2 -0
  140. package/dist/runtime/index.d.ts +2 -0
  141. package/dist/runtime/index.js +4 -4
  142. package/dist/runtime/index.mjs +2 -2
  143. package/dist/shared/index.d.mts +10 -0
  144. package/dist/shared/index.d.ts +10 -0
  145. package/dist/shared/index.js +23 -0
  146. package/dist/shared/index.mjs +2 -0
  147. package/dist/static/index.js +5 -5
  148. package/dist/static/index.mjs +2 -2
  149. package/docs_for_llm/actions.doc.md +87 -0
  150. package/docs_for_llm/advancedset.doc.md +98 -0
  151. package/docs_for_llm/affix.doc.md +20 -7
  152. package/docs_for_llm/aksk.doc.md +111 -0
  153. package/docs_for_llm/anchor.doc.md +155 -0
  154. package/docs_for_llm/anchorlink.doc.md +75 -0
  155. package/docs_for_llm/az.doc.md +17 -11
  156. package/docs_for_llm/badge.doc.md +11 -5
  157. package/docs_for_llm/billtypes.doc.md +17 -11
  158. package/docs_for_llm/breadcrumb.doc.md +80 -4
  159. package/docs_for_llm/button.doc.md +91 -18
  160. package/docs_for_llm/buttonlink.doc.md +64 -0
  161. package/docs_for_llm/card.doc.md +58 -8
  162. package/docs_for_llm/cardcol.doc.md +78 -0
  163. package/docs_for_llm/cardcols.doc.md +84 -0
  164. package/docs_for_llm/cardcontent.doc.md +31 -10
  165. package/docs_for_llm/cardtabs.doc.md +106 -0
  166. package/docs_for_llm/carousel.doc.md +79 -7
  167. package/docs_for_llm/cascader.doc.md +106 -23
  168. package/docs_for_llm/checkbox.doc.md +25 -13
  169. package/docs_for_llm/cidrinput.doc.md +83 -0
  170. package/docs_for_llm/code.doc.md +22 -11
  171. package/docs_for_llm/collapse.doc.md +147 -14
  172. package/docs_for_llm/colorpicker.doc.md +104 -0
  173. package/docs_for_llm/configprovider.doc.md +77 -0
  174. package/docs_for_llm/copy.doc.md +15 -13
  175. package/docs_for_llm/copyhover.doc.md +59 -0
  176. package/docs_for_llm/copyrow.doc.md +80 -0
  177. package/docs_for_llm/datepicker.doc.md +66 -35
  178. package/docs_for_llm/description.doc.md +75 -0
  179. package/docs_for_llm/descriptions.doc.md +122 -10
  180. package/docs_for_llm/diagram.doc.md +343 -0
  181. package/docs_for_llm/dialog.doc.md +97 -77
  182. package/docs_for_llm/divider.doc.md +14 -7
  183. package/docs_for_llm/drawer.doc.md +114 -69
  184. package/docs_for_llm/dropdown.doc.md +290 -22
  185. package/docs_for_llm/duration.doc.md +76 -0
  186. package/docs_for_llm/editable.doc.md +36 -14
  187. package/docs_for_llm/ellipsis.doc.md +10 -5
  188. package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
  189. package/docs_for_llm/flex.doc.md +83 -0
  190. package/docs_for_llm/form.doc.md +196 -18
  191. package/docs_for_llm/formiteminput.doc.md +128 -0
  192. package/docs_for_llm/formitemspinner.doc.md +105 -0
  193. package/docs_for_llm/formitemswitch.doc.md +113 -0
  194. package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
  195. package/docs_for_llm/grid.doc.md +78 -5
  196. package/docs_for_llm/header.doc.md +114 -0
  197. package/docs_for_llm/icon.doc.md +12 -8
  198. package/docs_for_llm/icontooltip.doc.md +121 -0
  199. package/docs_for_llm/input.doc.md +199 -41
  200. package/docs_for_llm/instancelist.doc.md +113 -0
  201. package/docs_for_llm/instancenum.doc.md +95 -0
  202. package/docs_for_llm/ipinput.doc.md +77 -0
  203. package/docs_for_llm/kspstatus.doc.md +82 -0
  204. package/docs_for_llm/kvcode.doc.md +76 -0
  205. package/docs_for_llm/layoutcontent.doc.md +54 -17
  206. package/docs_for_llm/layoutlistcontent.doc.md +168 -0
  207. package/docs_for_llm/layoutpermissioncontent.doc.md +93 -0
  208. package/docs_for_llm/layoutstandardlist.doc.md +129 -0
  209. package/docs_for_llm/layouttabs.doc.md +101 -0
  210. package/docs_for_llm/lazymount.doc.md +82 -0
  211. package/docs_for_llm/lazyteleport.doc.md +85 -0
  212. package/docs_for_llm/menu.doc.md +139 -14
  213. package/docs_for_llm/message.doc.md +93 -10
  214. package/docs_for_llm/notification.doc.md +214 -0
  215. package/docs_for_llm/pagination.doc.md +30 -17
  216. package/docs_for_llm/paginationplus.doc.md +31 -10
  217. package/docs_for_llm/password.doc.md +86 -0
  218. package/docs_for_llm/popover.doc.md +24 -55
  219. package/docs_for_llm/progress.doc.md +13 -10
  220. package/docs_for_llm/projects.doc.md +91 -0
  221. package/docs_for_llm/protable.doc.md +98 -15
  222. package/docs_for_llm/queuevisualrange.doc.md +78 -0
  223. package/docs_for_llm/radio.doc.md +23 -8
  224. package/docs_for_llm/rate.doc.md +127 -0
  225. package/docs_for_llm/region.doc.md +25 -13
  226. package/docs_for_llm/scrollselect.doc.md +90 -0
  227. package/docs_for_llm/search.doc.md +120 -0
  228. package/docs_for_llm/searchinput.doc.md +111 -0
  229. package/docs_for_llm/searchitems.doc.md +116 -0
  230. package/docs_for_llm/searchselect.doc.md +126 -0
  231. package/docs_for_llm/select.doc.md +208 -49
  232. package/docs_for_llm/sidebar.doc.md +133 -0
  233. package/docs_for_llm/skeleton.doc.md +152 -0
  234. package/docs_for_llm/slider.doc.md +42 -22
  235. package/docs_for_llm/spin.doc.md +18 -6
  236. package/docs_for_llm/spinner.doc.md +28 -18
  237. package/docs_for_llm/split.doc.md +170 -0
  238. package/docs_for_llm/sshkeys.doc.md +88 -0
  239. package/docs_for_llm/status.doc.md +14 -9
  240. package/docs_for_llm/steps.doc.md +81 -7
  241. package/docs_for_llm/switch.doc.md +32 -16
  242. package/docs_for_llm/table.doc.md +317 -55
  243. package/docs_for_llm/tablecolumnid.doc.md +36 -16
  244. package/docs_for_llm/tabs.doc.md +117 -12
  245. package/docs_for_llm/tag.doc.md +167 -15
  246. package/docs_for_llm/timeline.doc.md +187 -0
  247. package/docs_for_llm/timepicker.doc.md +74 -36
  248. package/docs_for_llm/timerange.doc.md +157 -0
  249. package/docs_for_llm/tip.doc.md +50 -11
  250. package/docs_for_llm/tooltip.doc.md +99 -27
  251. package/docs_for_llm/tour.doc.md +125 -28
  252. package/docs_for_llm/transfer.doc.md +99 -33
  253. package/docs_for_llm/tree.doc.md +129 -24
  254. package/docs_for_llm/treeselect.doc.md +101 -44
  255. package/docs_for_llm/upload.doc.md +63 -32
  256. package/docs_for_llm/useCRUD.doc.md +49 -0
  257. package/docs_for_llm/useCountdown.doc.md +43 -0
  258. package/docs_for_llm/useDetail.doc.md +48 -0
  259. package/docs_for_llm/useDialog.doc.md +46 -0
  260. package/docs_for_llm/useEntity.doc.md +45 -0
  261. package/docs_for_llm/useEventListener.doc.md +44 -0
  262. package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
  263. package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
  264. package/docs_for_llm/useGetUserPermission.doc.md +43 -0
  265. package/docs_for_llm/useGroup.doc.md +48 -0
  266. package/docs_for_llm/useIdEntities.doc.md +48 -0
  267. package/docs_for_llm/useIdEntity.doc.md +103 -0
  268. package/docs_for_llm/useInterval.doc.md +43 -0
  269. package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
  270. package/docs_for_llm/useMessage.doc.md +46 -0
  271. package/docs_for_llm/useModifyCache.doc.md +37 -0
  272. package/docs_for_llm/useOpenDialog.doc.md +41 -0
  273. package/docs_for_llm/usePagination.doc.md +60 -0
  274. package/docs_for_llm/usePersist.doc.md +54 -0
  275. package/docs_for_llm/usePoll.doc.md +41 -0
  276. package/docs_for_llm/useRoutePlus.doc.md +34 -0
  277. package/docs_for_llm/useRouterPlus.doc.md +34 -0
  278. package/docs_for_llm/useSearch.doc.md +68 -0
  279. package/docs_for_llm/useShell.doc.md +43 -0
  280. package/docs_for_llm/useSkip.doc.md +41 -0
  281. package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
  282. package/docs_for_llm/useStore.doc.md +34 -0
  283. package/docs_for_llm/useTable.doc.md +57 -0
  284. package/docs_for_llm/useTableGroup.doc.md +47 -0
  285. package/docs_for_llm/useTableSort.doc.md +40 -0
  286. package/docs_for_llm/useToState.doc.md +112 -0
  287. package/docs_for_llm/useUser.doc.md +38 -0
  288. package/docs_for_llm/useValidForm.doc.md +41 -0
  289. package/docs_for_llm/vdialog.doc.md +154 -0
  290. package/docs_for_llm/vdrawer.doc.md +148 -0
  291. package/docs_for_llm/virtuallist.doc.md +157 -3
  292. package/hooks/useCRUD.json +61 -0
  293. package/hooks/useCountdown.json +49 -0
  294. package/hooks/useDetail.json +67 -0
  295. package/hooks/useDialog.json +49 -0
  296. package/hooks/useEntity.json +61 -0
  297. package/hooks/useEventListener.json +61 -0
  298. package/hooks/useFalseUntilTruthy.json +43 -0
  299. package/hooks/useGetCopyAuthText.json +36 -0
  300. package/hooks/useGetUserPermission.json +55 -0
  301. package/hooks/useGroup.json +49 -0
  302. package/hooks/useIdEntities.json +61 -0
  303. package/hooks/useInterval.json +55 -0
  304. package/hooks/useLayoutStandardList.json +36 -0
  305. package/hooks/useMessage.json +73 -0
  306. package/hooks/useModifyCache.json +36 -0
  307. package/hooks/useOpenDialog.json +43 -0
  308. package/hooks/usePagination.json +49 -0
  309. package/hooks/usePersist.json +61 -0
  310. package/hooks/usePoll.json +43 -0
  311. package/hooks/useRoutePlus.json +36 -0
  312. package/hooks/useRouterPlus.json +36 -0
  313. package/hooks/useSearch.json +56 -0
  314. package/hooks/useShell.json +49 -0
  315. package/hooks/useSkip.json +43 -0
  316. package/hooks/useStorageIdEntity.json +67 -0
  317. package/hooks/useStore.json +36 -0
  318. package/hooks/useTable.json +49 -0
  319. package/hooks/useTableGroup.json +43 -0
  320. package/hooks/useTableSort.json +43 -0
  321. package/hooks/useUser.json +36 -0
  322. package/hooks/useValidForm.json +43 -0
  323. package/package.json +14 -8
  324. package/dist/chunk-D3Y6FGWA.js +0 -153
  325. package/dist/chunk-HPAUCD5I.js +0 -156
  326. package/dist/chunk-L4DS3EXI.mjs +0 -133
  327. package/dist/chunk-NZ6TLWMD.mjs +0 -151
@@ -0,0 +1,127 @@
1
+ # 评分 (Rate)
2
+
3
+ 评分组件,用于展示和选择星级评分。支持半星、禁用态、自定义总数以及再次点击清空评分。
4
+
5
+ **关键词**: rate, 评分, 星级, 打分, 半星, clearable
6
+
7
+ **使用场景**: 商品评价、服务满意度评分、内容点赞等级、后台数据展示只读评分
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { Rate } from '@king-design/vue';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | value | `number` | `0` | 否 | 当前评分值,可用 v-model 双向绑定。 | - | `<Rate v-model="score" />` |
18
+ | count | `number` | `5` | 否 | 总星数。 | - | `<Rate v-model="score" :count="10" />` |
19
+ | disabled | `boolean` | `false` | 否 | 是否禁用。禁用后只展示当前值,不响应 hover 和点击。 | - | `<Rate :value="4" disabled />` |
20
+ | half | `boolean` | `false` | 否 | 是否允许半星评分。 | - | `<Rate v-model="score" half />` |
21
+ | clearable | `boolean` | `false` | 否 | 是否允许点击当前值后清空评分。 | - | `<Rate v-model="score" clearable />` |
22
+
23
+ ## 事件 (Events)
24
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
25
+ | --- | --- | --- | --- | --- |
26
+ | mouseleave | `@mouseleave` | 鼠标离开评分区域时触发,通常用于结束悬停预览。 | `e: MouseEvent` | `<Rate @mouseleave="handleMouseLeave" />` |
27
+
28
+ ### 事件参数说明
29
+ **mouseleave**
30
+
31
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
32
+ | --- | --- | --- | --- | --- |
33
+ | e | `MouseEvent` | 是 | - | 原生鼠标事件 |
34
+
35
+ 事件处理示例:
36
+ ```typescript
37
+ const handleMouseLeave = (e: MouseEvent) => {
38
+ console.log('离开评分区域');
39
+ };
40
+ ```
41
+
42
+ ## 插槽 (Slots)
43
+ | 插槽名 | 说明 | 模板写法 | 示例 |
44
+ | --- | --- | --- | --- |
45
+ | icon | 自定义每一项评分图标,默认使用星形图标。 | `<template #icon>...</template>` | `<Rate v-model="score"><template #icon><Icon class="k-icon-favorite" /></template></Rate>` |
46
+
47
+ ### 插槽参数说明
48
+ **icon**
49
+
50
+ - 参数结构: 无参数
51
+
52
+ ## 常见错误与正确用法 (Anti-Hallucination)
53
+ ### 传入小数评分但未开启 half
54
+ > **错误用法**: `<Rate :value="3.5" />`
55
+ > **正确写法**: `<Rate :value="3.5" half />`
56
+ > **说明**: 如果需要展示或选择半星评分,应显式开启 half,否则组件按整星交互处理。
57
+
58
+ ### 期望再次点击清空评分但未开启 clearable
59
+ > **错误用法**: `<Rate v-model="score" />`
60
+ > **正确写法**: `<Rate v-model="score" clearable />`
61
+ > **说明**: 默认再次点击当前星级不会清空值,如需允许取消评分,应开启 clearable。
62
+
63
+ ## 使用示例
64
+ ### 基础用法
65
+ **场景**: 收集用户星级评分
66
+
67
+ 用户评分输入。
68
+
69
+ **使用的 API**: 属性: value
70
+
71
+ ```vue
72
+ <script setup lang="ts">
73
+ import { ref } from 'vue';
74
+ import { Rate } from '@king-design/vue';
75
+
76
+ const score = ref(3);
77
+ </script>
78
+ <template>
79
+ <Rate v-model="score" />
80
+ </template>
81
+ ```
82
+
83
+ ### 半星和可清空
84
+ **场景**: 允许半星和取消评分
85
+
86
+ 适合更细粒度的打分场景。
87
+
88
+ **使用的 API**: 属性: value, half, clearable
89
+
90
+ ```vue
91
+ <script setup lang="ts">
92
+ import { ref } from 'vue';
93
+ import { Rate } from '@king-design/vue';
94
+
95
+ const score = ref(3.5);
96
+ </script>
97
+ <template>
98
+ <Rate v-model="score" half clearable />
99
+ </template>
100
+ ```
101
+
102
+ ### 自定义图标
103
+ **场景**: 在点赞或喜爱度场景中使用心形评分
104
+
105
+ 使用心形图标替代默认星形。
106
+
107
+ **使用的 API**: 属性: value | 插槽: icon
108
+
109
+ ```vue
110
+ <script setup lang="ts">
111
+ import { ref } from 'vue';
112
+ import { Icon, Rate } from '@king-design/vue';
113
+
114
+ const score = ref(4);
115
+ </script>
116
+ <template>
117
+ <Rate v-model="score">
118
+ <template #icon>
119
+ <Icon class="k-icon-heart" />
120
+ </template>
121
+ </Rate>
122
+ </template>
123
+ ```
124
+
125
+ ## 相关组件
126
+ Icon, Tag, Tooltip
127
+
@@ -2,9 +2,9 @@
2
2
 
3
3
  地域(Region)选择组件,支持多区域和多地域的展示与切换。
4
4
 
5
- **关键词**: region, area, location, 地域, 区域
5
+ **关键词**: region, area, location, 地域, 区域, 大区, region select, 地域选择
6
6
 
7
- **使用场景**: 购买页选择地域、列表页筛选地域
7
+ **使用场景**: 购买页选择地域、列表页筛选地域、资源创建时切换可售卖地域、和 AZ 联动选择地域与可用区
8
8
 
9
9
  ## 导入语句
10
10
  ```typescript
@@ -12,14 +12,14 @@ import { Region } from '@ksyun-internal/versatile';
12
12
  ```
13
13
 
14
14
  ## 属性 (Props)
15
- | 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
16
- | --- | --- | --- | --- | --- | --- |
17
- | modelValue | `string` | `undefined` | 否 | 选中的地域编码(RegionCode) | `<Region v-model="regionCode" />` |
18
- | areaCode | `string` | `undefined` | 否 | 当前选中的大区编码 | `<Region v-model:areaCode="areaCode" />` |
19
- | packages | `Region[]` | `undefined` | 否 | 地域配置列表 | `<Region :packages="packages" />` |
20
- | supportEmptyAz | `boolean` | `false` | 否 | 是否支持空可用区 | `<Region supportEmptyAz />` |
21
- | showLearnMore | `boolean` | `true` | 否 | 是否显示了解更多 | `<Region showLearnMore />` |
22
- | learnMoreUrl | `number` | `undefined` | 否 | 了解更多链接ID | `<Region :learnMoreUrl="123" />` |
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | modelValue | `string` | `undefined` | 否 | 选中的地域编码(RegionCode) | - | `<Region v-model="regionCode" />` |
18
+ | areaCode | `string` | `undefined` | 否 | 当前选中的大区编码 | - | `<Region v-model:areaCode="areaCode" />` |
19
+ | packages | `Region[]` | `undefined` | 否 | 地域配置列表 | - | `<Region :packages="packages" />` |
20
+ | supportEmptyAz | `boolean` | `false` | 否 | 是否支持空可用区 | - | `<Region supportEmptyAz />` |
21
+ | showLearnMore | `boolean` | `true` | 否 | 是否显示了解更多 | - | `<Region showLearnMore />` |
22
+ | learnMoreUrl | `number` | `undefined` | 否 | 了解更多链接ID | - | `<Region :learnMoreUrl="123" />` |
23
23
 
24
24
  ## 事件 (Events)
25
25
  | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
@@ -27,13 +27,25 @@ import { Region } from '@ksyun-internal/versatile';
27
27
  | change | `update:modelValue` | 地域改变时触发 | `value: string` | `<Region @update:modelValue="v => console.log(v)" /></Region>` |
28
28
  | areaChange | `update:areaCode` | 大区改变时触发 | `value: string` | `<Region @update:areaCode="v => console.log(v)" /></Region>` |
29
29
 
30
- ### 事件处理函数示例
31
- **change**:
30
+ ### 事件参数说明
31
+ **change**
32
+
33
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
34
+ | --- | --- | --- | --- | --- |
35
+ | value | `string` | 是 | - | 新的RegionCode |
36
+
37
+ 事件处理示例:
32
38
  ```typescript
33
39
  (val) => { console.log(val); }
34
40
  ```
35
41
 
36
- **areaChange**:
42
+ **areaChange**
43
+
44
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
45
+ | --- | --- | --- | --- | --- |
46
+ | value | `string` | 是 | - | 新的AreaCode |
47
+
48
+ 事件处理示例:
37
49
  ```typescript
38
50
  (val) => { console.log(val); }
39
51
  ```
@@ -0,0 +1,90 @@
1
+ # 滚动选择器 (ScrollSelect)
2
+
3
+ 滚动选择器组件,通过滚轮、拖拽或点击来选择值。适合时间、年份、数值区间等连续选项场景,也可以通过函数动态生成可选数据。
4
+
5
+ **关键词**: scrollselect, 滚动选择器, 时间滚轮, year picker
6
+
7
+ **使用场景**: 年份或月份选择、时间滚轮、连续数值选择
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { ScrollSelect } from '@king-design/vue';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | value | `T` | `undefined` | 否 | 当前选中值,可用 v-model 双向绑定 | - | `<ScrollSelect v-model="year" :data="years" />` |
18
+ | count | `number` | `5` | 否 | 可视区域中渲染的数据个数 | - | `<ScrollSelect :count="10" />` |
19
+ | data | `Data<T> = DataItem<T>[] | ((v: T) => DataItem<T>[])` | `[]` | 否 | 可选数据列表,或根据当前值动态生成数据的方法 | - | `<ScrollSelect :data="[{ value: 1, label: '一月' }]" />` |
20
+ | disabled | `boolean` | `false` | 否 | 是否禁用整个选择器 | - | `<ScrollSelect disabled :data="years" />` |
21
+ | disable | `(v: T) => boolean` | `undefined` | 否 | 按值控制单项是否禁用 | - | `<ScrollSelect :disable="(v) => v < 2020" />` |
22
+
23
+ ## 插槽 (Slots)
24
+ | 插槽名 | 说明 | 模板写法 | 示例 |
25
+ | --- | --- | --- | --- |
26
+ | append | 在滚动选择器后追加额外内容,例如单位说明 | `#append` | `<ScrollSelect v-model="hour" :data="hours"><template #append>时</template></ScrollSelect>` |
27
+
28
+ ### 插槽参数说明
29
+ **append**
30
+
31
+ - 参数结构: 无参数
32
+
33
+ ## 使用示例
34
+ ### 基础用法
35
+ **场景**: 在时间和数值选择场景中提供滚动选择交互。
36
+
37
+ 使用静态数据创建一个年份选择器。
38
+
39
+ **使用的 API**: 属性: value, data
40
+
41
+ ```vue
42
+ <script setup lang="ts">
43
+ import { ref } from 'vue';
44
+ import { ScrollSelect } from '@king-design/vue';
45
+
46
+ const year = ref(2024);
47
+ const years = Array.from({ length: 7 }, (_, index) => ({
48
+ value: 2021 + index,
49
+ label: `${2021 + index} 年`,
50
+ }));
51
+ </script>
52
+ <template>
53
+ <ScrollSelect v-model="year" :data="years" />
54
+ </template>
55
+ ```
56
+
57
+ ### 动态生成数据
58
+ **场景**: 在时间滚轮或区间选择中按需生成可见窗口数据。
59
+
60
+ 根据当前选中值动态生成附近的年份选项。
61
+
62
+ **使用的 API**: 属性: value, count, data | 插槽: append
63
+
64
+ ```vue
65
+ <script setup lang="ts">
66
+ import { ref } from 'vue';
67
+ import { ScrollSelect } from '@king-design/vue';
68
+
69
+ const currentYear = ref(2025);
70
+ const generateYears = (value: number) => {
71
+ const start = value - 3;
72
+ return Array.from({ length: 7 }, (_, index) => {
73
+ const year = start + index;
74
+ return {
75
+ value: year,
76
+ label: `${year} 年`,
77
+ };
78
+ });
79
+ };
80
+ </script>
81
+ <template>
82
+ <ScrollSelect v-model="currentYear" :count="7" :data="generateYears">
83
+ <template #append>年份</template>
84
+ </ScrollSelect>
85
+ </template>
86
+ ```
87
+
88
+ ## 相关组件
89
+ Datepicker, Timepicker
90
+
@@ -0,0 +1,120 @@
1
+ # 组合搜索框 (Search)
2
+
3
+ 由搜索类型选择器和输入区域组合而成的业务搜索组件,适合列表页按名称、ID、状态等不同维度快速检索。
4
+
5
+ **关键词**: search, filter, search bar, search by field, 组合搜索, 搜索框, 多条件搜索, 字段筛选
6
+
7
+ **使用场景**: 列表页关键字搜索、按类型切换搜索条件、和 SearchItems 联动的高级检索、控制台资源列表顶部搜索区
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { Search } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | searchKey | `string` | `""` | 否 | 当前选中的搜索类型 key | - | - |
18
+ | searchValue | `string` | `""` | 否 | 当前输入或选择的搜索值 | - | - |
19
+ | searches | `SearchType[] | Record<string, SearchType>` | `undefined` | 是 | 搜索配置集合,支持数组或 key-value 对象 | - | - |
20
+ | searchGroups | `SearchGroupItem[]` | `undefined` | 否 | 搜索类型分组配置 | - | - |
21
+ | clearable | `boolean` | `false` | 否 | 是否允许清空搜索值 | - | - |
22
+ | leftWidth | `string | number` | `120` | 否 | 左侧搜索类型选择区域宽度 | - | - |
23
+ | rightWidth | `string | number` | `240` | 否 | 右侧搜索输入区域宽度 | - | - |
24
+
25
+ ## 事件 (Events)
26
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
27
+ | --- | --- | --- | --- | --- |
28
+ | clear | `@clear` | 用户点击清空按钮后触发,通常用于重置搜索值并刷新列表。 | `-` | - |
29
+ | change:searchKey | `@change:searchKey` | 搜索维度切换时触发,可据此切换占位提示或请求参数。 | `value: string, current?: SearchType` | - |
30
+ | change:searchValue | `@change:searchValue` | 搜索值变化时触发,适合实时记录当前检索条件。 | `value: string, label?: string, current?: SearchType, obj?: Record<string, any> | null` | - |
31
+
32
+ ### 事件参数说明
33
+ **change:searchKey**
34
+
35
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
36
+ | --- | --- | --- | --- | --- |
37
+ | value | `string` | 是 | - | 当前选中的搜索字段 key,例如 `name`、`project`、`privateIp`。 |
38
+ | current | `SearchType` | 否 | - | 当前激活的搜索项配置对象,包含 label、type、placeholder 等信息。 |
39
+
40
+ **change:searchValue**
41
+
42
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
43
+ | --- | --- | --- | --- | --- |
44
+ | value | `string` | 是 | - | 当前输入框或选择器中的搜索值。 |
45
+ | label | `string` | 否 | - | 当前搜索值对应的展示文案,选择型搜索时常用于回显标签。 |
46
+ | current | `SearchType` | 否 | - | 当前正在使用的搜索项配置对象。 |
47
+ | obj | `Record<string, any> | null` | 否 | - | 选择型搜索命中的原始选项对象;输入型搜索通常为 `null`。 |
48
+
49
+ ## 使用示例
50
+ ### 实例列表组合搜索
51
+ **场景**: 在列表页顶部提供按不同字段切换的统一搜索入口。
52
+
53
+ 在一个搜索框内切换按名称、实例 ID 或 IP 搜索。
54
+
55
+ **使用的 API**: 属性: searchKey, searchValue, searches, clearable | 事件: change:searchKey, change:searchValue, clear
56
+
57
+ ```vue
58
+ <script setup lang="ts">
59
+ import { ref } from 'vue';
60
+ import { Search } from '@ksyun-internal/versatile';
61
+
62
+ const searchKey = ref('name');
63
+ const searchValue = ref('web-prod');
64
+ const searches = [
65
+ { key: 'name', label: '实例名称', type: 'input', placeholder: '请输入实例名称' },
66
+ { key: 'id', label: '实例 ID', type: 'input', placeholder: '请输入实例 ID' },
67
+ { key: 'ip', label: '内网 IP', type: 'input', placeholder: '请输入内网 IP' },
68
+ ];
69
+ </script>
70
+
71
+ <template>
72
+ <Search
73
+ v-model:search-key="searchKey"
74
+ v-model:search-value="searchValue"
75
+ :searches="searches"
76
+ :clearable="true"
77
+ />
78
+ </template>
79
+ ```
80
+
81
+ ### 按分组组织搜索条件
82
+ **场景**: 在复杂列表页中把搜索条件按业务域分组,降低用户选择成本。
83
+
84
+ 通过 searchGroups 将资源类和网络类搜索条件分组展示。
85
+
86
+ **使用的 API**: 属性: searchKey, searchValue, searches, searchGroups, leftWidth, rightWidth | 事件: change:searchKey, change:searchValue
87
+
88
+ ```vue
89
+ <script setup lang="ts">
90
+ import { ref } from 'vue';
91
+ import { Search } from '@ksyun-internal/versatile';
92
+
93
+ const searchKey = ref('project');
94
+ const searchValue = ref('core');
95
+ const searches = {
96
+ name: { key: 'name', label: '实例名称', type: 'input', placeholder: '请输入实例名称' },
97
+ project: { key: 'project', label: '项目名称', type: 'input', placeholder: '请输入项目名称' },
98
+ privateIp: { key: 'privateIp', label: '内网 IP', type: 'input', placeholder: '请输入内网 IP' },
99
+ };
100
+ const searchGroups = [
101
+ { label: '资源信息', keys: ['name', 'project'] },
102
+ { label: '网络信息', keys: ['privateIp'] },
103
+ ];
104
+ </script>
105
+
106
+ <template>
107
+ <Search
108
+ v-model:search-key="searchKey"
109
+ v-model:search-value="searchValue"
110
+ :searches="searches"
111
+ :search-groups="searchGroups"
112
+ :left-width="140"
113
+ :right-width="280"
114
+ />
115
+ </template>
116
+ ```
117
+
118
+ ## 相关组件
119
+ SearchInput, SearchSelect, SearchItems, ProTable
120
+
@@ -0,0 +1,111 @@
1
+ # 搜索输入框 (SearchInput)
2
+
3
+ 轻量搜索输入框组件,适合工具栏关键词过滤、输入即搜或与列表查询按钮配套使用。
4
+
5
+ **关键词**: search input, keyword search, 输入搜索, 搜索输入框, 关键字过滤, 单字段搜索
6
+
7
+ **使用场景**: 列表页关键字输入、工具栏快捷搜索、确认输入后发起查询
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { SearchInput } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | type | `string` | `"text"` | 否 | 在原生 input 标签的 type 取值的基础上扩展了 textarea 值,当取该值时渲染成 <textarea> | `inherited:Input` | `<Input type="textarea" :rows="4" placeholder="请输入内容" />` |
18
+ | name | `string` | `undefined` | 否 | 原生 input 标签的 name 属性 | `native`, `inherited:Input` | `<Input name="username" />` |
19
+ | placeholder | `string` | `undefined` | 否 | 占位文案 | `native`, `inherited:Input` | `<Input placeholder="请输入内容" />` |
20
+ | readonly | `boolean` | `false` | 否 | 是否只读 | `native`, `inherited:Input` | `<Input v-model="value" readonly />` |
21
+ | autocomplete | `string` | `undefined` | 否 | 原生 autocomplete 属性,指定浏览器自动补全行为 | `native`, `inherited:Input` | `<Input autocomplete="username" />` |
22
+ | autofocus | `boolean` | `undefined` | 否 | 原生 autofocus 属性,页面加载后自动聚焦输入框 | `native`, `inherited:Input` | `<Input autofocus />` |
23
+ | form | `string` | `undefined` | 否 | 原生 form 属性,指定输入框关联的表单 id | `native`, `inherited:Input` | `<Input form="searchForm" />` |
24
+ | maxlength | `number | string` | `undefined` | 否 | 原生 maxlength 属性,限制最大输入长度 | `native`, `inherited:Input` | `<Input :maxlength="50" showCount />` |
25
+ | pattern | `string` | `undefined` | 否 | 原生 pattern 属性,指定输入值需要匹配的正则模式 | `native`, `inherited:Input` | `<Input pattern="[0-9]{6}" placeholder="请输入6位数字" />` |
26
+ | required | `boolean` | `undefined` | 否 | 原生 required 属性,标记为必填输入项 | `native`, `inherited:Input` | `<Input required placeholder="必填项" />` |
27
+ | clearable | `boolean` | `false` | 否 | 是否显示清空按钮 | - | - |
28
+ | disabled | `boolean` | `false` | 否 | 是否禁用 | `inherited:Input` | `<Input disabled placeholder="禁用状态" />` |
29
+ | size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 组件尺寸 | `inherited:Input` | `<Input size="large" placeholder="大尺寸输入框" />` |
30
+ | rows | `number | string` | `2` | 否 | 当 type="textarea" 时,默认展示文本行数 | `native`, `inherited:Input` | `<Input type="textarea" :rows="6" />` |
31
+ | cols | `number` | `undefined` | 否 | 原生 cols 属性,当 type="textarea" 时指定可见宽度 | `native`, `inherited:Input` | `<Input type="textarea" :cols="40" />` |
32
+ | datalist | `string` | `undefined` | 否 | 原生 datalist 属性,关联 datalist 元素 id | `native`, `inherited:Input` | `<Input datalist="city-list" />` |
33
+ | dirname | `string` | `undefined` | 否 | 原生 dirname 属性,提交时附带输入方向信息 | `native`, `inherited:Input` | `<Input dirname="comment.dir" />` |
34
+ | wrap | `"hard" | "soft"` | `undefined` | 否 | 原生 wrap 属性,当 type="textarea" 时指定换行提交方式 | `native`, `inherited:Input` | `<Input type="textarea" wrap="hard" />` |
35
+ | autoWidth | `boolean` | `false` | 否 | 是否宽度随输入的文本的长度变化而变化 | `inherited:Input` | `<Input autoWidth placeholder="宽度自适应" />` |
36
+ | fluid | `boolean` | `false` | 否 | 是否宽度 100% | `inherited:Input` | `<Input fluid placeholder="宽度100%" />` |
37
+ | width | `string | number` | `undefined` | 否 | 指定宽度,组件会加上单位 px | `inherited:Input` | `<Input :width="300" placeholder="宽度300px" />` |
38
+ | stackClearIcon | `boolean` | `false` | 否 | 是否将清空按钮覆盖在 suffix 按钮上展示来节省空间 | `inherited:Input` | `<Input clearable stackClearIcon />` |
39
+ | frozenOnInput | `boolean` | `false` | 否 | 是否在输入的过程中冻结 value 更新到视图 | `inherited:Input` | `<Input frozenOnInput />` |
40
+ | inline | `boolean` | `false` | 否 | 是否展示内联模式 | `inherited:Input` | `<Input inline />` |
41
+ | waveDisabled | `boolean` | `false` | 否 | 是否禁用点击波纹效果 | `inherited:Input` | `<Input waveDisabled />` |
42
+ | resize | `"none" | "vertical" | "horizontal" | "both"` | `"vertical"` | 否 | 指定 textarea 输入框拖动调整大小的方向,默认只能垂直方向调整 | `inherited:Input` | `<Input type="textarea" resize="both" />` |
43
+ | flat | `boolean` | `false` | 否 | 是否展示扁平样式 | `inherited:Input` | `<Input flat placeholder="扁平样式" />` |
44
+ | showCount | `boolean` | `false` | 否 | 是否展示字符长度提示数字 | `inherited:Input` | `<Input showCount maxlength="50" />` |
45
+ | showPassword | `boolean` | `false` | 否 | 当 type="password" 时,是否展示显隐密码按钮 | `inherited:Input` | `<Input type="password" showPassword />` |
46
+ | modelValue | `string` | `""` | 否 | 输入框当前值 | - | - |
47
+
48
+ ## 事件 (Events)
49
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
50
+ | --- | --- | --- | --- | --- |
51
+ | clear | `@clear` | 用户清空关键词时触发,通常用于恢复默认列表数据。 | `-` | - |
52
+ | change:value | `@change:value` | 搜索关键词完成一次确认输入时触发,适合发起查询请求。 | `value?: string` | - |
53
+
54
+ ### 事件参数说明
55
+ **change:value**
56
+
57
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
58
+ | --- | --- | --- | --- | --- |
59
+ | value | `string` | 否 | - | 本次确认提交的关键词。 |
60
+
61
+ ## 使用示例
62
+ ### 工具栏关键字过滤
63
+ **场景**: 在工具栏中提供单关键字快速搜索。
64
+
65
+ 在列表工具栏放置一个轻量搜索框,按名称快速过滤资源。
66
+
67
+ **使用的 API**: 属性: modelValue, clearable, placeholder | 事件: change:value, clear
68
+
69
+ ```vue
70
+ <script setup lang="ts">
71
+ import { ref } from 'vue';
72
+ import { SearchInput } from '@ksyun-internal/versatile';
73
+
74
+ const keyword = ref('');
75
+ </script>
76
+
77
+ <template>
78
+ <SearchInput v-model="keyword" :clearable="true" placeholder="搜索实例名称" />
79
+ </template>
80
+ ```
81
+
82
+ ### 监听确认输入发起搜索
83
+ **场景**: 在用户回车或确认输入时再发起一次正式查询。
84
+
85
+ 通过 change:value 在用户确认输入后发起查询。
86
+
87
+ **使用的 API**: 属性: modelValue, placeholder | 事件: change:value
88
+
89
+ ```vue
90
+ <script setup lang="ts">
91
+ import { ref } from 'vue';
92
+ import { SearchInput } from '@ksyun-internal/versatile';
93
+
94
+ const keyword = ref('');
95
+ const handleChange = (value: string) => {
96
+ console.log('query keyword:', value);
97
+ };
98
+ </script>
99
+
100
+ <template>
101
+ <SearchInput
102
+ v-model="keyword"
103
+ placeholder="请输入镜像名称"
104
+ @change:value="handleChange"
105
+ />
106
+ </template>
107
+ ```
108
+
109
+ ## 相关组件
110
+ Search, Input
111
+
@@ -0,0 +1,116 @@
1
+ # 检索项 (SearchItems)
2
+
3
+ 用于展示和管理当前检索条件标签的组件,适合复杂筛选场景中回显用户已选条件,并支持快速删除和清空。
4
+
5
+ **关键词**: search items, filters, filter tags, 检索项, 筛选条件, 条件回显, 搜索标签, 已选条件
6
+
7
+ **使用场景**: 复杂检索条件回显、列表页多条件筛选、已选条件快速删除、列表页筛选状态持久化
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { SearchItems } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | modelValue | `Record<string, string | number>` | `{}` | 否 | 检索项数据对象 | - | - |
18
+ | searchKey | `string` | `""` | 否 | 持久化存储时使用的 key | - | - |
19
+ | title | `string` | `"检索项"` | 否 | 检索项区域标题 | - | - |
20
+ | separator | `string` | `"|"` | 否 | 多值拼接分隔符 | - | - |
21
+ | placeholderSeparator | `string | RegExp` | `/,+|\|+/g` | 否 | 占位分隔符匹配规则 | - | - |
22
+
23
+ ## 事件 (Events)
24
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
25
+ | --- | --- | --- | --- | --- |
26
+ | delete:item | `@delete:item` | 删除单个检索条件时触发,可用于同步列表查询参数。 | `key?: string, value?: SearchItem` | - |
27
+ | delete:all | `@delete:all` | 清空全部检索条件时触发,通常配合重置分页和重新拉取数据。 | `-` | - |
28
+
29
+ ### 事件参数说明
30
+ **delete:item**
31
+
32
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
33
+ | --- | --- | --- | --- | --- |
34
+ | key | `string` | 否 | - | 被删除检索项所属的分组 key,通常对应当前列表或筛选区的唯一标识。 |
35
+ | value | `SearchItem` | 否 | - | 被删除的检索项对象,包含 label、key、text、value 等字段。 |
36
+
37
+ ## 方法 (Methods)
38
+ | 方法名 | 说明 | 参数 | 返回值 |
39
+ | --- | --- | --- | --- |
40
+ | get | 获取当前组件维护的全部检索项,用于外部读取当前筛选状态。 | `-` | `SearchItem[]` |
41
+ | add | 追加一个新的检索条件,并立即同步到当前检索项列表中。 | `searchItem: SearchItem` | `void` |
42
+ | del | 按照给定条件删除一个已存在的检索项。 | `item: Partial<SearchItem>, unique?: boolean, isTriggerEmit?: boolean` | `void` |
43
+ | clear | 清空当前 searchKey 下保存的检索项,常用于重置单个列表视图的筛选状态。 | `-` | `void` |
44
+ | clearAll | 清空组件维护的全部检索项,通常用于一键重置筛选条件。 | `-` | `void` |
45
+
46
+ ### 方法参数说明
47
+ **add**
48
+
49
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
50
+ | --- | --- | --- | --- | --- |
51
+ | searchItem | `SearchItem` | 是 | - | 待追加的检索项对象,通常包含 key、label 和 value。 |
52
+
53
+ **del**
54
+
55
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
56
+ | --- | --- | --- | --- | --- |
57
+ | item | `Partial<SearchItem>` | 是 | - | 用于匹配删除目标的条件对象,可传 key、label 或 value。 |
58
+ | unique | `boolean` | 否 | `false` | 是否按唯一条件精确删除匹配项,适合区分同 key 下的多个候选值。 |
59
+ | isTriggerEmit | `boolean` | 否 | `true` | 删除后是否继续触发组件事件,批量同步内部状态时可按需关闭。 |
60
+
61
+ ## 使用示例
62
+ ### 复杂筛选条件回显
63
+ **场景**: 在复杂列表页中回显并管理用户已选择的过滤条件。
64
+
65
+ 把当前列表的多个过滤条件展示为可删除的检索项。
66
+
67
+ **使用的 API**: 属性: modelValue, searchKey, title | 事件: delete:item, delete:all
68
+
69
+ ```vue
70
+ <script setup lang="ts">
71
+ import { ref } from 'vue';
72
+ import { SearchItems } from '@ksyun-internal/versatile';
73
+
74
+ const filters = ref({
75
+ name: 'web-prod',
76
+ status: 'running',
77
+ project: '核心项目',
78
+ });
79
+ </script>
80
+
81
+ <template>
82
+ <SearchItems v-model="filters" search-key="instance-list" title="当前筛选" />
83
+ </template>
84
+ ```
85
+
86
+ ### 通过组件方法清空检索项
87
+ **场景**: 在切换页签或重置查询条件时,从外部统一清空当前检索项。
88
+
89
+ 使用 ref 调用 clearAll,在切换列表视图时统一重置筛选条件。
90
+
91
+ **使用的 API**: 属性: modelValue, searchKey | 事件: delete:all | 方法: clearAll
92
+
93
+ ```vue
94
+ <script setup lang="ts">
95
+ import { ref } from 'vue';
96
+ import { SearchItems } from '@ksyun-internal/versatile';
97
+
98
+ const searchItemsRef = ref<InstanceType<typeof SearchItems>>();
99
+ const filters = ref({
100
+ name: 'web-prod',
101
+ project: '核心项目',
102
+ });
103
+ const resetFilters = () => {
104
+ searchItemsRef.value?.clearAll();
105
+ };
106
+ </script>
107
+
108
+ <template>
109
+ <button @click="resetFilters">重置全部筛选</button>
110
+ <SearchItems ref="searchItemsRef" v-model="filters" search-key="instance-list" />
111
+ </template>
112
+ ```
113
+
114
+ ## 相关组件
115
+ Search, ProTable
116
+