king-design-analyzer 1.0.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 (92) hide show
  1. package/README.md +151 -0
  2. package/components/affix.json +178 -0
  3. package/components/az.json +86 -0
  4. package/components/badge.json +162 -0
  5. package/components/billtypes.json +90 -0
  6. package/components/breadcrumb.json +220 -0
  7. package/components/button.json +511 -0
  8. package/components/card.json +334 -0
  9. package/components/cardcontent.json +144 -0
  10. package/components/carousel.json +207 -0
  11. package/components/cascader.json +373 -0
  12. package/components/checkbox.json +298 -0
  13. package/components/code.json +318 -0
  14. package/components/collapse.json +358 -0
  15. package/components/copy.json +220 -0
  16. package/components/datepicker.json +529 -0
  17. package/components/descriptions.json +309 -0
  18. package/components/dialog.json +460 -0
  19. package/components/divider.json +287 -0
  20. package/components/drawer.json +563 -0
  21. package/components/dropdown.json +407 -0
  22. package/components/editable.json +331 -0
  23. package/components/ellipsis.json +218 -0
  24. package/components/form.json +638 -0
  25. package/components/grid.json +377 -0
  26. package/components/icon.json +442 -0
  27. package/components/input.json +821 -0
  28. package/components/layoutcontent.json +210 -0
  29. package/components/menu.json +482 -0
  30. package/components/message.json +345 -0
  31. package/components/pagination.json +444 -0
  32. package/components/paginationplus.json +74 -0
  33. package/components/popover.json +456 -0
  34. package/components/progress.json +354 -0
  35. package/components/protable.json +132 -0
  36. package/components/radio.json +246 -0
  37. package/components/region.json +115 -0
  38. package/components/select.json +676 -0
  39. package/components/slider.json +422 -0
  40. package/components/spin.json +232 -0
  41. package/components/spinner.json +441 -0
  42. package/components/status.json +75 -0
  43. package/components/steps.json +292 -0
  44. package/components/switch.json +357 -0
  45. package/components/table.json +1057 -0
  46. package/components/tablecolumnid.json +217 -0
  47. package/components/tabs.json +363 -0
  48. package/components/tag.json +504 -0
  49. package/components/timepicker.json +447 -0
  50. package/components/tip.json +322 -0
  51. package/components/tooltip.json +416 -0
  52. package/components/tour.json +395 -0
  53. package/components/transfer.json +414 -0
  54. package/components/tree.json +480 -0
  55. package/components/treeselect.json +478 -0
  56. package/components/upload.json +499 -0
  57. package/components/virtuallist.json +178 -0
  58. package/dist/ast/index.d.mts +71 -0
  59. package/dist/ast/index.d.ts +71 -0
  60. package/dist/ast/index.js +15 -0
  61. package/dist/ast/index.mjs +2 -0
  62. package/dist/chunk-4BUGNH4F.mjs +62 -0
  63. package/dist/chunk-5H7N2A5X.mjs +1 -0
  64. package/dist/chunk-5IF32MBB.js +603 -0
  65. package/dist/chunk-ARWRNWDW.js +219 -0
  66. package/dist/chunk-C3L4IXJC.mjs +577 -0
  67. package/dist/chunk-GNVCC37B.js +102 -0
  68. package/dist/chunk-N4UIA6DN.js +68 -0
  69. package/dist/chunk-RAMIBZAU.mjs +216 -0
  70. package/dist/chunk-RNQHI7YG.js +64 -0
  71. package/dist/chunk-TB6BF5TJ.mjs +99 -0
  72. package/dist/chunk-UX7KGX45.mjs +66 -0
  73. package/dist/chunk-YTEYDSDW.js +2 -0
  74. package/dist/full/index.d.mts +29 -0
  75. package/dist/full/index.d.ts +29 -0
  76. package/dist/full/index.js +16 -0
  77. package/dist/full/index.mjs +3 -0
  78. package/dist/index.d.mts +5 -0
  79. package/dist/index.d.ts +5 -0
  80. package/dist/index.js +43 -0
  81. package/dist/index.mjs +6 -0
  82. package/dist/runtime/index.d.mts +14 -0
  83. package/dist/runtime/index.d.ts +14 -0
  84. package/dist/runtime/index.js +15 -0
  85. package/dist/runtime/index.mjs +2 -0
  86. package/dist/sfcCompiler-m51JOfWs.d.mts +22 -0
  87. package/dist/sfcCompiler-m51JOfWs.d.ts +22 -0
  88. package/dist/static/index.d.mts +14 -0
  89. package/dist/static/index.d.ts +14 -0
  90. package/dist/static/index.js +19 -0
  91. package/dist/static/index.mjs +2 -0
  92. package/package.json +88 -0
@@ -0,0 +1,499 @@
1
+ {
2
+ "id": "upload",
3
+ "name": "Upload",
4
+ "displayName": "上传",
5
+ "category": "form",
6
+ "description": "文件上传组件,支持点击、拖拽、照片墙等多种风格。支持文件大小/数量限制、上传前验证、自定义请求头和数据等功能。",
7
+ "importStatement": "import { Upload } from '@king-design/vue';",
8
+ "props": [
9
+ {
10
+ "name": "action",
11
+ "description": "上传地址",
12
+ "type": {
13
+ "raw": "string",
14
+ "kind": "string"
15
+ },
16
+ "required": true,
17
+ "usageExample": "<Upload action=\"/api/upload\" />"
18
+ },
19
+ {
20
+ "name": "files",
21
+ "description": "已上传和待上传的文件列表,可用 v-model:files 双向绑定",
22
+ "type": {
23
+ "raw": "UploadFile[]",
24
+ "kind": "array"
25
+ },
26
+ "required": false,
27
+ "default": "[]",
28
+ "usageExample": "<Upload v-model:files=\"fileList\" />"
29
+ },
30
+ {
31
+ "name": "type",
32
+ "description": "组件风格",
33
+ "type": {
34
+ "raw": "\"select\" | \"drag\" | \"gallery\"",
35
+ "kind": "union",
36
+ "unionTypes": [
37
+ "select",
38
+ "drag",
39
+ "gallery"
40
+ ]
41
+ },
42
+ "required": false,
43
+ "default": "\"select\"",
44
+ "allowedValues": [
45
+ {
46
+ "value": "select",
47
+ "label": "点击选择",
48
+ "isDefault": true
49
+ },
50
+ {
51
+ "value": "drag",
52
+ "label": "拖拽上传"
53
+ },
54
+ {
55
+ "value": "gallery",
56
+ "label": "照片墙风格"
57
+ }
58
+ ],
59
+ "usageExample": "<Upload type=\"drag\" />"
60
+ },
61
+ {
62
+ "name": "accept",
63
+ "description": "支持上传的文件类型",
64
+ "type": {
65
+ "raw": "string",
66
+ "kind": "string"
67
+ },
68
+ "required": false,
69
+ "default": "undefined",
70
+ "usageExample": "<Upload accept=\".jpg, .png, .gif\" />"
71
+ },
72
+ {
73
+ "name": "multiple",
74
+ "description": "是否支持多选文件",
75
+ "type": {
76
+ "raw": "boolean",
77
+ "kind": "boolean"
78
+ },
79
+ "required": false,
80
+ "default": "false",
81
+ "usageExample": "<Upload multiple />"
82
+ },
83
+ {
84
+ "name": "maxSize",
85
+ "description": "最大上传文件大小限制(kb)",
86
+ "type": {
87
+ "raw": "number",
88
+ "kind": "number"
89
+ },
90
+ "required": false,
91
+ "default": "undefined",
92
+ "usageExample": "<Upload :maxSize=\"500\" />"
93
+ },
94
+ {
95
+ "name": "limit",
96
+ "description": "最大上传文件数量限制",
97
+ "type": {
98
+ "raw": "number",
99
+ "kind": "number"
100
+ },
101
+ "required": false,
102
+ "default": "undefined",
103
+ "usageExample": "<Upload :limit=\"5\" />"
104
+ },
105
+ {
106
+ "name": "autoUpload",
107
+ "description": "是否选择文件后自动上传",
108
+ "type": {
109
+ "raw": "boolean",
110
+ "kind": "boolean"
111
+ },
112
+ "required": false,
113
+ "default": "true",
114
+ "usageExample": "<Upload :autoUpload=\"false\" />"
115
+ },
116
+ {
117
+ "name": "beforeUpload",
118
+ "description": "上传前的回调函数,返回 false 取消上传,支持异步",
119
+ "type": {
120
+ "raw": "(file: UploadFile, files: UploadFile[]) => boolean | Promise<boolean>",
121
+ "kind": "function",
122
+ "functionSignature": "(file: UploadFile, files: UploadFile[]) => boolean | Promise<boolean>"
123
+ },
124
+ "required": false,
125
+ "default": "undefined",
126
+ "usageExample": "<Upload :beforeUpload=\"handleBeforeUpload\" />"
127
+ },
128
+ {
129
+ "name": "beforeRemove",
130
+ "description": "删除前的回调函数,返回 false 取消删除,支持异步",
131
+ "type": {
132
+ "raw": "(file: UploadFile, files: UploadFile[]) => boolean | Promise<boolean>",
133
+ "kind": "function",
134
+ "functionSignature": "(file: UploadFile, files: UploadFile[]) => boolean | Promise<boolean>"
135
+ },
136
+ "required": false,
137
+ "default": "undefined",
138
+ "usageExample": "<Upload :beforeRemove=\"handleBeforeRemove\" />"
139
+ },
140
+ {
141
+ "name": "data",
142
+ "description": "上传附加的请求数据,可以是对象或函数",
143
+ "type": {
144
+ "raw": "object | ((file: UploadFile) => object)",
145
+ "kind": "union"
146
+ },
147
+ "required": false,
148
+ "default": "undefined",
149
+ "usageExample": "<Upload :data=\"{userId: '123'}\" />"
150
+ },
151
+ {
152
+ "name": "headers",
153
+ "description": "上传的请求头",
154
+ "type": {
155
+ "raw": "Record<string, string>",
156
+ "kind": "object"
157
+ },
158
+ "required": false,
159
+ "default": "undefined",
160
+ "usageExample": "<Upload :headers=\"{Authorization: 'Bearer token'}\" />"
161
+ },
162
+ {
163
+ "name": "name",
164
+ "description": "上传文件字段名",
165
+ "type": {
166
+ "raw": "string",
167
+ "kind": "string"
168
+ },
169
+ "required": false,
170
+ "default": "undefined",
171
+ "usageExample": "<Upload name=\"file\" />"
172
+ },
173
+ {
174
+ "name": "withCredentials",
175
+ "description": "跨域请求是否允许传送 cookie",
176
+ "type": {
177
+ "raw": "boolean",
178
+ "kind": "boolean"
179
+ },
180
+ "required": false,
181
+ "default": "false",
182
+ "usageExample": "<Upload withCredentials />"
183
+ },
184
+ {
185
+ "name": "directory",
186
+ "description": "是否支持上传文件夹",
187
+ "type": {
188
+ "raw": "boolean",
189
+ "kind": "boolean"
190
+ },
191
+ "required": false,
192
+ "default": "false",
193
+ "usageExample": "<Upload directory />"
194
+ },
195
+ {
196
+ "name": "disabled",
197
+ "description": "是否禁用上传",
198
+ "type": {
199
+ "raw": "boolean",
200
+ "kind": "boolean"
201
+ },
202
+ "required": false,
203
+ "default": "false",
204
+ "usageExample": "<Upload disabled />"
205
+ }
206
+ ],
207
+ "events": [
208
+ {
209
+ "name": "progress",
210
+ "vueEventName": "@progress",
211
+ "description": "文件上传过程中触发",
212
+ "payload": [
213
+ {
214
+ "name": "event",
215
+ "type": "ProgressEvent",
216
+ "description": "进度事件"
217
+ },
218
+ {
219
+ "name": "xhr",
220
+ "type": "XMLHttpRequest",
221
+ "description": "请求对象"
222
+ },
223
+ {
224
+ "name": "file",
225
+ "type": "UploadFile",
226
+ "description": "当前文件"
227
+ },
228
+ {
229
+ "name": "files",
230
+ "type": "UploadFile[]",
231
+ "description": "所有文件列表"
232
+ }
233
+ ],
234
+ "usageExample": "<Upload @progress=\"handleProgress\">",
235
+ "handlerExample": "const handleProgress = (e, xhr, file, files) => {\n console.log('进度:', file.percent);\n};"
236
+ },
237
+ {
238
+ "name": "success",
239
+ "vueEventName": "@success",
240
+ "description": "文件上传成功时触发",
241
+ "payload": [
242
+ {
243
+ "name": "res",
244
+ "type": "any",
245
+ "description": "服务器响应"
246
+ },
247
+ {
248
+ "name": "xhr",
249
+ "type": "XMLHttpRequest",
250
+ "description": "请求对象"
251
+ },
252
+ {
253
+ "name": "file",
254
+ "type": "UploadFile",
255
+ "description": "当前文件"
256
+ },
257
+ {
258
+ "name": "files",
259
+ "type": "UploadFile[]",
260
+ "description": "所有文件列表"
261
+ }
262
+ ],
263
+ "usageExample": "<Upload @success=\"handleSuccess\">",
264
+ "handlerExample": "const handleSuccess = (res, xhr, file, files) => {\n console.log('上传成功:', res);\n};"
265
+ },
266
+ {
267
+ "name": "error",
268
+ "vueEventName": "@error",
269
+ "description": "文件超出限制或上传失败时触发",
270
+ "payload": [
271
+ {
272
+ "name": "err",
273
+ "type": "Error | RequestError",
274
+ "description": "错误信息"
275
+ },
276
+ {
277
+ "name": "file",
278
+ "type": "File | File[] | UploadFile",
279
+ "description": "相关文件"
280
+ },
281
+ {
282
+ "name": "files",
283
+ "type": "UploadFile[]",
284
+ "description": "所有文件列表"
285
+ }
286
+ ],
287
+ "usageExample": "<Upload @error=\"handleError\">",
288
+ "handlerExample": "const handleError = (err, file, files) => {\n Message.error(err.message);\n};"
289
+ }
290
+ ],
291
+ "methods": [
292
+ {
293
+ "name": "submit",
294
+ "description": "手动上传时,调用该方法开始上传",
295
+ "returnType": "void",
296
+ "usageExample": "uploadRef.value?.submit();"
297
+ }
298
+ ],
299
+ "slots": [
300
+ {
301
+ "name": "content",
302
+ "description": "组件展示的内容,当没有子元素时,默认会根据type展示不同的内容"
303
+ },
304
+ {
305
+ "name": "tip",
306
+ "description": "组件展示的提示信息"
307
+ }
308
+ ],
309
+ "typeDefinitions": [
310
+ {
311
+ "name": "UploadFile",
312
+ "definition": "type UploadFile = {\n name: string\n url?: string\n status?: UploadFileStatus\n type?: string\n size?: number\n percent?: number\n uid?: number\n raw?: File\n}",
313
+ "description": "上传文件对象类型"
314
+ },
315
+ {
316
+ "name": "UploadFileStatus",
317
+ "definition": "enum UploadFileStatus {\n Done,\n Ready,\n NotReady,\n Uploading,\n Error\n}",
318
+ "description": "文件上传状态"
319
+ }
320
+ ],
321
+ "examples": [
322
+ {
323
+ "id": "upload_basic",
324
+ "title": "基础用法",
325
+ "description": "基本的文件上传",
326
+ "difficulty": "easy",
327
+ "code": "<script setup lang=\"ts\">\nimport { Upload, Message } from '@king-design/vue';\n\nconst handleError = (err: any) => {\n Message.error(err.message);\n};\n\nconst handleSuccess = (res: any) => {\n Message.success('上传成功');\n};\n</script>\n<template>\n <Upload \n action=\"/api/upload\"\n @error=\"handleError\"\n @success=\"handleSuccess\"\n />\n</template>",
328
+ "tags": [
329
+ "basic"
330
+ ],
331
+ "usedProps": [
332
+ "action"
333
+ ],
334
+ "usedEvents": [
335
+ "success",
336
+ "error"
337
+ ],
338
+ "usedMethods": [],
339
+ "scenario": "创建一个基本的文件上传"
340
+ },
341
+ {
342
+ "id": "upload_drag",
343
+ "title": "拖拽上传",
344
+ "description": "拖拽风格的上传区域",
345
+ "difficulty": "easy",
346
+ "code": "<script setup lang=\"ts\">\nimport { Upload } from '@king-design/vue';\n</script>\n<template>\n <Upload \n type=\"drag\"\n action=\"/api/upload\"\n multiple\n />\n</template>",
347
+ "tags": [
348
+ "drag",
349
+ "type"
350
+ ],
351
+ "usedProps": [
352
+ "action",
353
+ "type",
354
+ "multiple"
355
+ ],
356
+ "usedEvents": [],
357
+ "usedMethods": [],
358
+ "scenario": "创建拖拽上传区域"
359
+ },
360
+ {
361
+ "id": "upload_gallery",
362
+ "title": "照片墙风格",
363
+ "description": "照片墙风格的图片上传",
364
+ "difficulty": "easy",
365
+ "code": "<script setup lang=\"ts\">\nimport { Upload, Message } from '@king-design/vue';\n\nconst handleError = (err: any) => {\n Message.error(err.message);\n};\n</script>\n<template>\n <Upload \n type=\"gallery\"\n action=\"/api/upload\"\n multiple\n accept=\".jpg, .png, .gif\"\n :limit=\"5\"\n @error=\"handleError\"\n />\n</template>",
366
+ "tags": [
367
+ "gallery",
368
+ "image"
369
+ ],
370
+ "usedProps": [
371
+ "action",
372
+ "type",
373
+ "multiple",
374
+ "accept",
375
+ "limit"
376
+ ],
377
+ "usedEvents": [
378
+ "error"
379
+ ],
380
+ "usedMethods": [],
381
+ "scenario": "创建照片墙风格的图片上传"
382
+ },
383
+ {
384
+ "id": "upload_limit",
385
+ "title": "限制文件",
386
+ "description": "限制文件类型、大小和数量",
387
+ "difficulty": "easy",
388
+ "code": "<script setup lang=\"ts\">\nimport { Upload, Message } from '@king-design/vue';\n\nconst handleError = (err: any) => {\n Message.error(err.message);\n};\n</script>\n<template>\n <Upload \n action=\"/api/upload\"\n accept=\".jpg, .png\"\n :maxSize=\"500\"\n :limit=\"3\"\n multiple\n @error=\"handleError\"\n >\n <template #tip>只能上传 JPG/PNG 格式,不超过 500KB,最多 3 个文件</template>\n </Upload>\n</template>",
389
+ "tags": [
390
+ "limit",
391
+ "maxSize",
392
+ "accept"
393
+ ],
394
+ "usedProps": [
395
+ "action",
396
+ "accept",
397
+ "maxSize",
398
+ "limit",
399
+ "multiple"
400
+ ],
401
+ "usedEvents": [
402
+ "error"
403
+ ],
404
+ "usedMethods": [],
405
+ "scenario": "限制文件类型、大小和数量"
406
+ },
407
+ {
408
+ "id": "upload_manual",
409
+ "title": "手动上传",
410
+ "description": "手动控制上传时机",
411
+ "difficulty": "medium",
412
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Upload, Button } from '@king-design/vue';\n\nconst upload = ref<InstanceType<typeof Upload>>();\n\nconst handleUpload = () => {\n upload.value?.submit();\n};\n</script>\n<template>\n <div>\n <Upload \n ref=\"upload\"\n action=\"/api/upload\"\n :autoUpload=\"false\"\n multiple\n >\n <Button type=\"primary\">选择文件</Button>\n </Upload>\n <Button @click=\"handleUpload\">开始上传</Button>\n </div>\n</template>",
413
+ "tags": [
414
+ "manual",
415
+ "autoUpload",
416
+ "submit"
417
+ ],
418
+ "usedProps": [
419
+ "action",
420
+ "autoUpload",
421
+ "multiple"
422
+ ],
423
+ "usedEvents": [],
424
+ "usedMethods": [
425
+ "submit"
426
+ ],
427
+ "scenario": "手动控制上传时机"
428
+ },
429
+ {
430
+ "id": "upload_before",
431
+ "title": "上传前验证",
432
+ "description": "上传前进行文件验证",
433
+ "difficulty": "medium",
434
+ "code": "<script setup lang=\"ts\">\nimport { Upload, Message } from '@king-design/vue';\nimport type { UploadFile } from '@king-design/vue';\n\nconst beforeUpload = (file: UploadFile): boolean => {\n if (!file.name.endsWith('.jpg') && !file.name.endsWith('.png')) {\n Message.error('只能上传 JPG/PNG 格式的文件');\n return false;\n }\n if (file.size && file.size > 1024 * 1024) {\n Message.error('文件大小不能超过 1MB');\n return false;\n }\n return true;\n};\n</script>\n<template>\n <Upload \n action=\"/api/upload\"\n :beforeUpload=\"beforeUpload\"\n />\n</template>",
435
+ "tags": [
436
+ "beforeUpload",
437
+ "validate"
438
+ ],
439
+ "usedProps": [
440
+ "action",
441
+ "beforeUpload"
442
+ ],
443
+ "usedEvents": [],
444
+ "usedMethods": [],
445
+ "scenario": "上传前进行文件验证"
446
+ }
447
+ ],
448
+ "commonMistakes": [
449
+ {
450
+ "id": "upload_missing_action",
451
+ "description": "未设置 action 属性",
452
+ "wrongCode": "<Upload /> <!-- 缺少上传地址 -->",
453
+ "correctCode": "<Upload action=\"/api/upload\" />",
454
+ "explanation": "必须设置 action 属性指定上传地址",
455
+ "relatedProps": [
456
+ "action"
457
+ ]
458
+ },
459
+ {
460
+ "id": "upload_max_size_unit",
461
+ "description": "maxSize 单位理解错误",
462
+ "wrongCode": "<Upload :maxSize=\"1024 * 1024\" /> <!-- 期望 1MB,实际是 1GB -->",
463
+ "correctCode": "<Upload :maxSize=\"1024\" /> <!-- 1MB = 1024KB -->",
464
+ "explanation": "maxSize 单位是 KB,1MB = 1024KB",
465
+ "relatedProps": [
466
+ "maxSize"
467
+ ]
468
+ },
469
+ {
470
+ "id": "upload_auto_upload_submit",
471
+ "description": "设置 autoUpload 为 false 但忘记调用 submit",
472
+ "wrongCode": "<Upload :autoUpload=\"false\" /> <!-- 文件不会自动上传 -->",
473
+ "correctCode": "<Upload ref=\"upload\" :autoUpload=\"false\" />\n// 需要手动调用 upload.value?.submit()",
474
+ "explanation": "设置 autoUpload 为 false 后需要手动调用 submit 方法上传",
475
+ "relatedProps": [
476
+ "autoUpload"
477
+ ]
478
+ }
479
+ ],
480
+ "searchKeywords": [
481
+ "上传",
482
+ "upload",
483
+ "文件上传",
484
+ "拖拽上传",
485
+ "图片上传",
486
+ "附件"
487
+ ],
488
+ "useCases": [
489
+ "图片上传",
490
+ "文档上传",
491
+ "头像上传",
492
+ "附件上传",
493
+ "批量文件上传"
494
+ ],
495
+ "relatedComponents": [
496
+ "Button",
497
+ "Progress"
498
+ ]
499
+ }