king-design-analyzer 2.2.0 → 2.2.2
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.
- package/components/actions.json +8 -0
- package/components/advancedset.json +1 -0
- package/components/affix.json +1 -0
- package/components/anchor.json +220 -0
- package/components/anchorlink.json +111 -0
- package/components/badge.json +1 -0
- package/components/breadcrumb.json +2 -1
- package/components/button.json +1 -0
- package/components/buttonlink.json +1 -0
- package/components/card.json +6 -3
- package/components/cardcontent.json +5 -0
- package/components/cascader.json +56 -0
- package/components/collapse.json +335 -348
- package/components/configprovider.json +96 -0
- package/components/copyrow.json +1 -0
- package/components/descriptions.json +10 -3
- package/components/diagram.json +295 -0
- package/components/dialog.json +4 -0
- package/components/divider.json +1 -0
- package/components/drawer.json +32 -0
- package/components/dropdown.json +13 -4
- package/components/flex.json +1 -0
- package/components/form.json +12 -3
- package/components/header.json +4 -0
- package/components/input.json +8 -4
- package/components/layoutcontent.json +9 -0
- package/components/layoutlistcontent.json +9 -0
- package/components/layoutpermissioncontent.json +1 -0
- package/components/layoutstandardlist.json +1 -0
- package/components/lazymount.json +1 -0
- package/components/lazyteleport.json +1 -0
- package/components/menu.json +4 -3
- package/components/notification.json +351 -0
- package/components/popover.json +23 -0
- package/components/protable.json +2 -0
- package/components/rate.json +1 -0
- package/components/scrollselect.json +140 -0
- package/components/select.json +72 -0
- package/components/skeleton.json +1 -0
- package/components/slider.json +12 -2
- package/components/spin.json +2 -1
- package/components/spinner.json +422 -428
- package/components/split.json +3 -0
- package/components/switch.json +4 -2
- package/components/table.json +6 -1
- package/components/tabs.json +2 -2
- package/components/tag.json +8 -5
- package/components/timeline.json +3 -1
- package/components/tip.json +20 -0
- package/components/tooltip.json +8 -0
- package/components/tour.json +16 -0
- package/components/transfer.json +52 -5
- package/components/tree.json +22 -1
- package/components/treeselect.json +56 -0
- package/components/upload.json +16 -0
- package/components/vdialog.json +1 -0
- package/components/vdrawer.json +4 -0
- package/components/virtuallist.json +9 -0
- package/dist/ast/index.d.mts +30 -1
- package/dist/ast/index.d.ts +30 -1
- package/dist/ast/index.js +3 -3
- package/dist/ast/index.mjs +1 -1
- package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
- package/dist/chunk-6HOIRUQB.mjs +409 -0
- package/dist/{chunk-XGPHQHLR.mjs → chunk-BSCASJTV.mjs} +27 -4
- package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
- package/dist/{chunk-CJGGFVQJ.js → chunk-HARQRI4F.js} +31 -8
- package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
- package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
- package/dist/chunk-V5N65MRP.js +411 -0
- package/dist/{chunk-SZYVGYKK.js → chunk-XPHDD6XR.js} +113 -35
- package/dist/{chunk-KMIDURUR.mjs → chunk-YRGYDK2I.mjs} +113 -35
- package/dist/full/index.d.mts +2 -0
- package/dist/full/index.d.ts +2 -0
- package/dist/full/index.js +6 -6
- package/dist/full/index.mjs +4 -4
- package/dist/index.js +13 -13
- package/dist/index.mjs +5 -5
- package/dist/metadata/index.d.mts +17 -2
- package/dist/metadata/index.d.ts +17 -2
- package/dist/runtime/index.d.mts +2 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/index.mjs +2 -2
- package/dist/static/index.js +5 -5
- package/dist/static/index.mjs +2 -2
- package/docs_for_llm/actions.doc.md +11 -1
- package/docs_for_llm/advancedset.doc.md +10 -1
- package/docs_for_llm/affix.doc.md +5 -0
- package/docs_for_llm/anchor.doc.md +155 -0
- package/docs_for_llm/anchorlink.doc.md +75 -0
- package/docs_for_llm/badge.doc.md +5 -0
- package/docs_for_llm/breadcrumb.doc.md +74 -1
- package/docs_for_llm/button.doc.md +57 -0
- package/docs_for_llm/buttonlink.doc.md +10 -1
- package/docs_for_llm/card.doc.md +50 -3
- package/docs_for_llm/cardcontent.doc.md +21 -0
- package/docs_for_llm/carousel.doc.md +71 -0
- package/docs_for_llm/cascader.doc.md +62 -0
- package/docs_for_llm/collapse.doc.md +138 -8
- package/docs_for_llm/configprovider.doc.md +77 -0
- package/docs_for_llm/copyrow.doc.md +10 -1
- package/docs_for_llm/datepicker.doc.md +19 -0
- package/docs_for_llm/descriptions.doc.md +113 -4
- package/docs_for_llm/diagram.doc.md +343 -0
- package/docs_for_llm/dialog.doc.md +49 -0
- package/docs_for_llm/divider.doc.md +5 -0
- package/docs_for_llm/drawer.doc.md +86 -0
- package/docs_for_llm/dropdown.doc.md +257 -3
- package/docs_for_llm/flex.doc.md +10 -1
- package/docs_for_llm/form.doc.md +163 -4
- package/docs_for_llm/formitemspinner.doc.md +1 -1
- package/docs_for_llm/grid.doc.md +71 -0
- package/docs_for_llm/header.doc.md +33 -4
- package/docs_for_llm/input.doc.md +109 -2
- package/docs_for_llm/layoutcontent.doc.md +37 -0
- package/docs_for_llm/layoutlistcontent.doc.md +82 -9
- package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
- package/docs_for_llm/layoutstandardlist.doc.md +10 -1
- package/docs_for_llm/lazymount.doc.md +10 -1
- package/docs_for_llm/lazyteleport.doc.md +10 -1
- package/docs_for_llm/menu.doc.md +125 -3
- package/docs_for_llm/message.doc.md +45 -0
- package/docs_for_llm/notification.doc.md +214 -0
- package/docs_for_llm/popover.doc.md +34 -0
- package/docs_for_llm/protable.doc.md +9 -0
- package/docs_for_llm/rate.doc.md +5 -0
- package/docs_for_llm/scrollselect.doc.md +90 -0
- package/docs_for_llm/select.doc.md +189 -0
- package/docs_for_llm/skeleton.doc.md +35 -0
- package/docs_for_llm/slider.doc.md +11 -1
- package/docs_for_llm/spin.doc.md +10 -1
- package/docs_for_llm/spinner.doc.md +1 -1
- package/docs_for_llm/split.doc.md +13 -0
- package/docs_for_llm/steps.doc.md +71 -0
- package/docs_for_llm/switch.doc.md +15 -2
- package/docs_for_llm/table.doc.md +199 -4
- package/docs_for_llm/tabs.doc.md +98 -2
- package/docs_for_llm/tag.doc.md +148 -5
- package/docs_for_llm/timeline.doc.md +80 -2
- package/docs_for_llm/timepicker.doc.md +19 -0
- package/docs_for_llm/tip.doc.md +30 -0
- package/docs_for_llm/tooltip.doc.md +46 -0
- package/docs_for_llm/tour.doc.md +102 -0
- package/docs_for_llm/transfer.doc.md +59 -4
- package/docs_for_llm/tree.doc.md +64 -1
- package/docs_for_llm/treeselect.doc.md +68 -0
- package/docs_for_llm/upload.doc.md +28 -0
- package/docs_for_llm/vdialog.doc.md +26 -1
- package/docs_for_llm/vdrawer.doc.md +33 -4
- package/docs_for_llm/virtuallist.doc.md +165 -0
- package/package.json +3 -3
- package/dist/chunk-D2SXGGTX.mjs +0 -162
- package/dist/chunk-EYKZY2F3.js +0 -164
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# 流程图 (Diagram)
|
|
2
|
+
|
|
3
|
+
流程图组件,用于在画布中组织图形、连线和布局。支持节点选中、标签编辑以及多种布局方式,适合流程建模、拓扑展示和审批链路可视化场景。
|
|
4
|
+
|
|
5
|
+
**关键词**: diagram, 流程图, 拓扑图, graph, DTreeLayout, DFlowLayout
|
|
6
|
+
|
|
7
|
+
**使用场景**: 审批流建模、拓扑结构展示、流程状态可视化
|
|
8
|
+
|
|
9
|
+
## 导入语句
|
|
10
|
+
```typescript
|
|
11
|
+
import { Diagram, DRectangle, DCircle, DLine, DTreeLayout } from '@king-design/vue/components/diagram';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 事件 (Events)
|
|
15
|
+
| 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| labelChanged | `@labelChanged` | 节点标签修改后触发 | `cell: any, newLabel: string, oldLabel: string` | `<Diagram @labelChanged="handleLabelChanged"></Diagram>` |
|
|
18
|
+
| selectionChanged | `@selectionChanged` | 画布选中元素变化时触发 | `cells: any[]` | `<Diagram @selectionChanged="handleSelectionChanged"></Diagram>` |
|
|
19
|
+
|
|
20
|
+
### 事件参数说明
|
|
21
|
+
**labelChanged**
|
|
22
|
+
|
|
23
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
| cell | `any` | 是 | - | 发生变化的图元实例 |
|
|
26
|
+
| newLabel | `string` | 是 | - | 修改后的标签内容 |
|
|
27
|
+
| oldLabel | `string` | 是 | - | 修改前的标签内容 |
|
|
28
|
+
|
|
29
|
+
事件处理示例:
|
|
30
|
+
```typescript
|
|
31
|
+
const handleLabelChanged = (cell: any, newLabel: string, oldLabel: string) => {
|
|
32
|
+
console.log('label changed', oldLabel, '=>', newLabel);
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**selectionChanged**
|
|
37
|
+
|
|
38
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
39
|
+
| --- | --- | --- | --- | --- |
|
|
40
|
+
| cells | `any[]` | 是 | - | 当前选中的图元列表 |
|
|
41
|
+
|
|
42
|
+
事件处理示例:
|
|
43
|
+
```typescript
|
|
44
|
+
const handleSelectionChanged = (cells: any[]) => {
|
|
45
|
+
console.log('selected cells', cells.length);
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 插槽 (Slots)
|
|
50
|
+
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| default | 流程图内容,通常放置布局组件、图形组件和连线组件 | `#default` | `<Diagram>
|
|
53
|
+
<DTreeLayout>
|
|
54
|
+
<DRectangle key="1" />
|
|
55
|
+
<DCircle key="2" />
|
|
56
|
+
<DLine from="1" to="2" />
|
|
57
|
+
</DTreeLayout>
|
|
58
|
+
</Diagram>` |
|
|
59
|
+
|
|
60
|
+
### 插槽参数说明
|
|
61
|
+
**default**
|
|
62
|
+
|
|
63
|
+
- 参数结构: 无参数
|
|
64
|
+
|
|
65
|
+
## 子组件 (Sub-Components)
|
|
66
|
+
### DRectangle
|
|
67
|
+
矩形节点,支持圆角、拖拽、选中和自定义内容。
|
|
68
|
+
|
|
69
|
+
#### 属性 (Props)
|
|
70
|
+
| 属性名 | 类型 | 说明 | 示例 |
|
|
71
|
+
| --- | --- | --- | --- |
|
|
72
|
+
| key | `string | number` | 节点唯一标识,供连线引用 | `<DRectangle key="1" />` |
|
|
73
|
+
| label | `string | number` | 节点标签 | `<DRectangle key="1" label="开始" />` |
|
|
74
|
+
| rounded | `number | string` | 圆角大小 | `<DRectangle key="1" :rounded="8" />` |
|
|
75
|
+
|
|
76
|
+
#### 组合示例
|
|
77
|
+
##### 可选中节点
|
|
78
|
+
**场景**: 在画布中选中节点并联动侧边配置面板。
|
|
79
|
+
|
|
80
|
+
监听选中变化,处理画布交互。
|
|
81
|
+
|
|
82
|
+
**命中的子组件 API**: 属性: key, label
|
|
83
|
+
|
|
84
|
+
```vue
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { Diagram, DRectangle, DLine, DFlowLayout } from '@king-design/vue/components/diagram';
|
|
87
|
+
|
|
88
|
+
const handleSelectionChanged = (cells: any[]) => {
|
|
89
|
+
console.log('当前选中数量', cells.length);
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
92
|
+
<template>
|
|
93
|
+
<Diagram @selectionChanged="handleSelectionChanged">
|
|
94
|
+
<DFlowLayout type="horizontal">
|
|
95
|
+
<DRectangle key="1" label="节点 A" selectable />
|
|
96
|
+
<DRectangle key="2" label="节点 B" selectable />
|
|
97
|
+
<DLine from="1" to="2" label="流转" />
|
|
98
|
+
</DFlowLayout>
|
|
99
|
+
</Diagram>
|
|
100
|
+
</template>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
##### 基础树形流程图
|
|
104
|
+
**场景**: 快速搭建审批流或状态流转图。
|
|
105
|
+
|
|
106
|
+
使用树形布局组织节点和连线。
|
|
107
|
+
|
|
108
|
+
**命中的子组件 API**: 属性: key, label
|
|
109
|
+
|
|
110
|
+
```vue
|
|
111
|
+
<script setup lang="ts">
|
|
112
|
+
import { Diagram, DRectangle, DCircle, DLine, DTreeLayout } from '@king-design/vue/components/diagram';
|
|
113
|
+
</script>
|
|
114
|
+
<template>
|
|
115
|
+
<Diagram>
|
|
116
|
+
<DTreeLayout>
|
|
117
|
+
<DRectangle key="1" label="开始" />
|
|
118
|
+
<DCircle key="2" label="审核" />
|
|
119
|
+
<DCircle key="3" label="结束" />
|
|
120
|
+
<DLine from="1" to="2" />
|
|
121
|
+
<DLine from="2" to="3" />
|
|
122
|
+
</DTreeLayout>
|
|
123
|
+
</Diagram>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### DCircle
|
|
128
|
+
圆形节点,适合展示起止节点或状态节点。
|
|
129
|
+
|
|
130
|
+
#### 属性 (Props)
|
|
131
|
+
| 属性名 | 类型 | 说明 | 示例 |
|
|
132
|
+
| --- | --- | --- | --- |
|
|
133
|
+
| key | `string | number` | 节点唯一标识 | `<DCircle key="2" />` |
|
|
134
|
+
| label | `string | number` | 节点标签 | `<DCircle key="2" label="结束" />` |
|
|
135
|
+
|
|
136
|
+
#### 组合示例
|
|
137
|
+
##### 基础树形流程图
|
|
138
|
+
**场景**: 快速搭建审批流或状态流转图。
|
|
139
|
+
|
|
140
|
+
使用树形布局组织节点和连线。
|
|
141
|
+
|
|
142
|
+
**命中的子组件 API**: 属性: key, label
|
|
143
|
+
|
|
144
|
+
```vue
|
|
145
|
+
<script setup lang="ts">
|
|
146
|
+
import { Diagram, DRectangle, DCircle, DLine, DTreeLayout } from '@king-design/vue/components/diagram';
|
|
147
|
+
</script>
|
|
148
|
+
<template>
|
|
149
|
+
<Diagram>
|
|
150
|
+
<DTreeLayout>
|
|
151
|
+
<DRectangle key="1" label="开始" />
|
|
152
|
+
<DCircle key="2" label="审核" />
|
|
153
|
+
<DCircle key="3" label="结束" />
|
|
154
|
+
<DLine from="1" to="2" />
|
|
155
|
+
<DLine from="2" to="3" />
|
|
156
|
+
</DTreeLayout>
|
|
157
|
+
</Diagram>
|
|
158
|
+
</template>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### DLine
|
|
162
|
+
节点之间的连线。
|
|
163
|
+
|
|
164
|
+
#### 属性 (Props)
|
|
165
|
+
| 属性名 | 类型 | 说明 | 示例 |
|
|
166
|
+
| --- | --- | --- | --- |
|
|
167
|
+
| from | `string | number` | 起始节点 key | `<DLine from="1" to="2" />` |
|
|
168
|
+
| to | `string | number` | 目标节点 key | `<DLine from="1" to="2" />` |
|
|
169
|
+
| label | `string` | 连线标签 | `<DLine from="1" to="2" label="通过" />` |
|
|
170
|
+
|
|
171
|
+
#### 组合示例
|
|
172
|
+
##### 可选中节点
|
|
173
|
+
**场景**: 在画布中选中节点并联动侧边配置面板。
|
|
174
|
+
|
|
175
|
+
监听选中变化,处理画布交互。
|
|
176
|
+
|
|
177
|
+
**命中的子组件 API**: 属性: from, to, label
|
|
178
|
+
|
|
179
|
+
```vue
|
|
180
|
+
<script setup lang="ts">
|
|
181
|
+
import { Diagram, DRectangle, DLine, DFlowLayout } from '@king-design/vue/components/diagram';
|
|
182
|
+
|
|
183
|
+
const handleSelectionChanged = (cells: any[]) => {
|
|
184
|
+
console.log('当前选中数量', cells.length);
|
|
185
|
+
};
|
|
186
|
+
</script>
|
|
187
|
+
<template>
|
|
188
|
+
<Diagram @selectionChanged="handleSelectionChanged">
|
|
189
|
+
<DFlowLayout type="horizontal">
|
|
190
|
+
<DRectangle key="1" label="节点 A" selectable />
|
|
191
|
+
<DRectangle key="2" label="节点 B" selectable />
|
|
192
|
+
<DLine from="1" to="2" label="流转" />
|
|
193
|
+
</DFlowLayout>
|
|
194
|
+
</Diagram>
|
|
195
|
+
</template>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
##### 基础树形流程图
|
|
199
|
+
**场景**: 快速搭建审批流或状态流转图。
|
|
200
|
+
|
|
201
|
+
使用树形布局组织节点和连线。
|
|
202
|
+
|
|
203
|
+
**命中的子组件 API**: 属性: from, to
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<script setup lang="ts">
|
|
207
|
+
import { Diagram, DRectangle, DCircle, DLine, DTreeLayout } from '@king-design/vue/components/diagram';
|
|
208
|
+
</script>
|
|
209
|
+
<template>
|
|
210
|
+
<Diagram>
|
|
211
|
+
<DTreeLayout>
|
|
212
|
+
<DRectangle key="1" label="开始" />
|
|
213
|
+
<DCircle key="2" label="审核" />
|
|
214
|
+
<DCircle key="3" label="结束" />
|
|
215
|
+
<DLine from="1" to="2" />
|
|
216
|
+
<DLine from="2" to="3" />
|
|
217
|
+
</DTreeLayout>
|
|
218
|
+
</Diagram>
|
|
219
|
+
</template>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### DTreeLayout
|
|
223
|
+
树形布局,适合组织审批流或层级关系图。
|
|
224
|
+
|
|
225
|
+
#### 属性 (Props)
|
|
226
|
+
| 属性名 | 类型 | 说明 | 示例 |
|
|
227
|
+
| --- | --- | --- | --- |
|
|
228
|
+
| type | `"horizontal" | "vertical"` | 布局方向 | `<DTreeLayout type="horizontal"></DTreeLayout>` |
|
|
229
|
+
| levelDistance | `number | string` | 层级之间的距离 | `<DTreeLayout :levelDistance="80"></DTreeLayout>` |
|
|
230
|
+
|
|
231
|
+
#### 组合示例
|
|
232
|
+
##### 基础树形流程图
|
|
233
|
+
**场景**: 快速搭建审批流或状态流转图。
|
|
234
|
+
|
|
235
|
+
使用树形布局组织节点和连线。
|
|
236
|
+
|
|
237
|
+
```vue
|
|
238
|
+
<script setup lang="ts">
|
|
239
|
+
import { Diagram, DRectangle, DCircle, DLine, DTreeLayout } from '@king-design/vue/components/diagram';
|
|
240
|
+
</script>
|
|
241
|
+
<template>
|
|
242
|
+
<Diagram>
|
|
243
|
+
<DTreeLayout>
|
|
244
|
+
<DRectangle key="1" label="开始" />
|
|
245
|
+
<DCircle key="2" label="审核" />
|
|
246
|
+
<DCircle key="3" label="结束" />
|
|
247
|
+
<DLine from="1" to="2" />
|
|
248
|
+
<DLine from="2" to="3" />
|
|
249
|
+
</DTreeLayout>
|
|
250
|
+
</Diagram>
|
|
251
|
+
</template>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### DFlowLayout
|
|
255
|
+
流式布局,适合横向或纵向流程图编排。
|
|
256
|
+
|
|
257
|
+
#### 属性 (Props)
|
|
258
|
+
| 属性名 | 类型 | 说明 | 示例 |
|
|
259
|
+
| --- | --- | --- | --- |
|
|
260
|
+
| type | `"horizontal" | "vertical"` | 布局方向 | `<DFlowLayout type="horizontal"></DFlowLayout>` |
|
|
261
|
+
| intraCellSpacing | `number | string` | 同层节点间距 | `<DFlowLayout :intraCellSpacing="40"></DFlowLayout>` |
|
|
262
|
+
|
|
263
|
+
#### 组合示例
|
|
264
|
+
##### 可选中节点
|
|
265
|
+
**场景**: 在画布中选中节点并联动侧边配置面板。
|
|
266
|
+
|
|
267
|
+
监听选中变化,处理画布交互。
|
|
268
|
+
|
|
269
|
+
**命中的子组件 API**: 属性: type
|
|
270
|
+
|
|
271
|
+
```vue
|
|
272
|
+
<script setup lang="ts">
|
|
273
|
+
import { Diagram, DRectangle, DLine, DFlowLayout } from '@king-design/vue/components/diagram';
|
|
274
|
+
|
|
275
|
+
const handleSelectionChanged = (cells: any[]) => {
|
|
276
|
+
console.log('当前选中数量', cells.length);
|
|
277
|
+
};
|
|
278
|
+
</script>
|
|
279
|
+
<template>
|
|
280
|
+
<Diagram @selectionChanged="handleSelectionChanged">
|
|
281
|
+
<DFlowLayout type="horizontal">
|
|
282
|
+
<DRectangle key="1" label="节点 A" selectable />
|
|
283
|
+
<DRectangle key="2" label="节点 B" selectable />
|
|
284
|
+
<DLine from="1" to="2" label="流转" />
|
|
285
|
+
</DFlowLayout>
|
|
286
|
+
</Diagram>
|
|
287
|
+
</template>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## 使用示例
|
|
291
|
+
### 基础树形流程图
|
|
292
|
+
**场景**: 快速搭建审批流或状态流转图。
|
|
293
|
+
|
|
294
|
+
使用树形布局组织节点和连线。
|
|
295
|
+
|
|
296
|
+
**使用的 API**: 插槽: default
|
|
297
|
+
|
|
298
|
+
```vue
|
|
299
|
+
<script setup lang="ts">
|
|
300
|
+
import { Diagram, DRectangle, DCircle, DLine, DTreeLayout } from '@king-design/vue/components/diagram';
|
|
301
|
+
</script>
|
|
302
|
+
<template>
|
|
303
|
+
<Diagram>
|
|
304
|
+
<DTreeLayout>
|
|
305
|
+
<DRectangle key="1" label="开始" />
|
|
306
|
+
<DCircle key="2" label="审核" />
|
|
307
|
+
<DCircle key="3" label="结束" />
|
|
308
|
+
<DLine from="1" to="2" />
|
|
309
|
+
<DLine from="2" to="3" />
|
|
310
|
+
</DTreeLayout>
|
|
311
|
+
</Diagram>
|
|
312
|
+
</template>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### 可选中节点
|
|
316
|
+
**场景**: 在画布中选中节点并联动侧边配置面板。
|
|
317
|
+
|
|
318
|
+
监听选中变化,处理画布交互。
|
|
319
|
+
|
|
320
|
+
**使用的 API**: 事件: selectionChanged | 插槽: default
|
|
321
|
+
|
|
322
|
+
```vue
|
|
323
|
+
<script setup lang="ts">
|
|
324
|
+
import { Diagram, DRectangle, DLine, DFlowLayout } from '@king-design/vue/components/diagram';
|
|
325
|
+
|
|
326
|
+
const handleSelectionChanged = (cells: any[]) => {
|
|
327
|
+
console.log('当前选中数量', cells.length);
|
|
328
|
+
};
|
|
329
|
+
</script>
|
|
330
|
+
<template>
|
|
331
|
+
<Diagram @selectionChanged="handleSelectionChanged">
|
|
332
|
+
<DFlowLayout type="horizontal">
|
|
333
|
+
<DRectangle key="1" label="节点 A" selectable />
|
|
334
|
+
<DRectangle key="2" label="节点 B" selectable />
|
|
335
|
+
<DLine from="1" to="2" label="流转" />
|
|
336
|
+
</DFlowLayout>
|
|
337
|
+
</Diagram>
|
|
338
|
+
</template>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## 相关组件
|
|
342
|
+
Anchor, Card
|
|
343
|
+
|
|
@@ -66,6 +66,23 @@ import { Dialog, Button } from '@king-design/vue';
|
|
|
66
66
|
</template>
|
|
67
67
|
</Dialog>` |
|
|
68
68
|
|
|
69
|
+
### 插槽参数说明
|
|
70
|
+
**default**
|
|
71
|
+
|
|
72
|
+
- 参数结构: 无参数
|
|
73
|
+
|
|
74
|
+
**header**
|
|
75
|
+
|
|
76
|
+
- 参数结构: 无参数
|
|
77
|
+
|
|
78
|
+
**footer**
|
|
79
|
+
|
|
80
|
+
- 参数结构: 无参数
|
|
81
|
+
|
|
82
|
+
**content**
|
|
83
|
+
|
|
84
|
+
- 参数结构: 无参数
|
|
85
|
+
|
|
69
86
|
## 方法 (Methods)
|
|
70
87
|
| 方法名 | 说明 | 参数 | 返回值 |
|
|
71
88
|
| --- | --- | --- | --- |
|
|
@@ -81,6 +98,38 @@ import { Dialog, Button } from '@king-design/vue';
|
|
|
81
98
|
| --- | --- | --- | --- | --- |
|
|
82
99
|
| props | `DialogProps` | 否 | - | 可选的临时弹窗配置,会在本次显示时覆盖标题、按钮文案或宽度等属性。 |
|
|
83
100
|
|
|
101
|
+
调用示例:
|
|
102
|
+
```typescript
|
|
103
|
+
const dialogRef = ref<InstanceType<typeof Dialog>>();
|
|
104
|
+
await dialogRef.value?.show();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 方法调用示例
|
|
108
|
+
**show**
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
const dialogRef = ref<InstanceType<typeof Dialog>>();
|
|
112
|
+
await dialogRef.value?.show();
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**close**
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
dialogRef.value?.close();
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**showLoading**
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
dialogRef.value?.showLoading();
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**hideLoading**
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
dialogRef.value?.hideLoading();
|
|
131
|
+
```
|
|
132
|
+
|
|
84
133
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
85
134
|
### 静态方法调用时未正确导入Dialog
|
|
86
135
|
> **错误用法**: `import { confirm } from '@king-design/vue';
|
|
@@ -25,6 +25,11 @@ import { Divider } from '@king-design/vue';
|
|
|
25
25
|
| --- | --- | --- | --- |
|
|
26
26
|
| default | 分割线中间的文字内容 | `#default` | `<Divider>文字内容</Divider>` |
|
|
27
27
|
|
|
28
|
+
### 插槽参数说明
|
|
29
|
+
**default**
|
|
30
|
+
|
|
31
|
+
- 参数结构: 无参数
|
|
32
|
+
|
|
28
33
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
29
34
|
### 混淆 vertical 和 horizontal 的含义
|
|
30
35
|
> **错误用法**: `<Divider type="vertical" /> <!-- 想创建垂直分割线 -->`
|
|
@@ -44,6 +44,50 @@ import { Drawer } from '@king-design/vue';
|
|
|
44
44
|
| terminate | `@terminate` | 用户强行关闭抽屉时触发(点击关闭按钮、遮罩层或按 ESC) | `-` | `<Drawer @terminate="handleTerminate">` |
|
|
45
45
|
| afterClose | `@afterClose` | 抽屉退出动画执行完成后触发 | `-` | `<Drawer @afterClose="handleAfterClose">` |
|
|
46
46
|
|
|
47
|
+
## 插槽 (Slots)
|
|
48
|
+
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
49
|
+
| --- | --- | --- | --- |
|
|
50
|
+
| content | 定义整个弹窗体,包括header,body,footer | `#content` | `<Drawer>
|
|
51
|
+
<template #content>自定义内容</template>
|
|
52
|
+
</Drawer>` |
|
|
53
|
+
| header | 扩展弹窗头部 | `#header` | `<Drawer>
|
|
54
|
+
<template #header>头部内容</template>
|
|
55
|
+
</Drawer>` |
|
|
56
|
+
| body | 扩展弹窗主体部分 | `#body` | `<Drawer>
|
|
57
|
+
<template #body>
|
|
58
|
+
自定义body内容
|
|
59
|
+
</template>
|
|
60
|
+
</Drawer>` |
|
|
61
|
+
| footer | 扩展弹窗底部 | `#footer` | `<Drawer>
|
|
62
|
+
<template #footer>底部内容</template>
|
|
63
|
+
</Drawer>` |
|
|
64
|
+
| footer-wrapper | 扩展弹窗整个底部,上述footer是它下面一个子扩展点 | `#footer-wrapper` | `<Drawer>
|
|
65
|
+
<template #footer-wrapper>
|
|
66
|
+
自定义footer-wrapper内容
|
|
67
|
+
</template>
|
|
68
|
+
</Drawer>` |
|
|
69
|
+
|
|
70
|
+
### 插槽参数说明
|
|
71
|
+
**content**
|
|
72
|
+
|
|
73
|
+
- 参数结构: 无参数
|
|
74
|
+
|
|
75
|
+
**header**
|
|
76
|
+
|
|
77
|
+
- 参数结构: 无参数
|
|
78
|
+
|
|
79
|
+
**body**
|
|
80
|
+
|
|
81
|
+
- 参数结构: 无参数
|
|
82
|
+
|
|
83
|
+
**footer**
|
|
84
|
+
|
|
85
|
+
- 参数结构: 无参数
|
|
86
|
+
|
|
87
|
+
**footer-wrapper**
|
|
88
|
+
|
|
89
|
+
- 参数结构: 无参数
|
|
90
|
+
|
|
47
91
|
## 方法 (Methods)
|
|
48
92
|
| 方法名 | 说明 | 参数 | 返回值 |
|
|
49
93
|
| --- | --- | --- | --- |
|
|
@@ -61,6 +105,48 @@ import { Drawer } from '@king-design/vue';
|
|
|
61
105
|
| --- | --- | --- | --- | --- |
|
|
62
106
|
| props | `DrawerProps` | 否 | - | 可选的临时抽屉配置,会在本次显示时覆盖标题、方向、宽度或按钮状态。 |
|
|
63
107
|
|
|
108
|
+
调用示例:
|
|
109
|
+
```typescript
|
|
110
|
+
drawerRef.value?.show();
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 方法调用示例
|
|
114
|
+
**show**
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
drawerRef.value?.show();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**close**
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
drawerRef.value?.close();
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**showLoading**
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
drawerRef.value?.showLoading();
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**hideLoading**
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
drawerRef.value?.hideLoading();
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**disableOk**
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
drawerRef.value?.disableOk();
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**enableOk**
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
drawerRef.value?.enableOk();
|
|
148
|
+
```
|
|
149
|
+
|
|
64
150
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
65
151
|
### placement 值拼写错误
|
|
66
152
|
> **错误用法**: `<Drawer placement="center">`
|