x-next 1.13.0 → 1.14.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.
- package/AI_CODING.md +6 -5
- package/AI_USAGE/catalog.md +106 -105
- package/AI_USAGE/components/alert-api.md +48 -0
- package/AI_USAGE/components/alert.md +222 -3
- package/AI_USAGE/components/bar-chart-api.md +177 -0
- package/AI_USAGE/components/bar-chart.md +297 -3
- package/AI_USAGE/components/boxicons.md +147 -0
- package/AI_USAGE/components/button-api.md +144 -0
- package/AI_USAGE/components/button.md +447 -3
- package/AI_USAGE/components/charts.md +81 -0
- package/AI_USAGE/components/checkbox-api.md +145 -0
- package/AI_USAGE/components/checkbox.md +365 -3
- package/AI_USAGE/components/color-picker-api.md +52 -0
- package/AI_USAGE/components/color-picker.md +211 -3
- package/AI_USAGE/components/config-provider-api.md +38 -0
- package/AI_USAGE/components/config-provider.md +250 -3
- package/AI_USAGE/components/date-picker-api.md +1114 -0
- package/AI_USAGE/components/date-picker.md +378 -3
- package/AI_USAGE/components/dialog-api.md +142 -0
- package/AI_USAGE/components/dialog.md +284 -3
- package/AI_USAGE/components/draggable-api.md +146 -0
- package/AI_USAGE/components/draggable.md +259 -0
- package/AI_USAGE/components/drawer-api.md +78 -0
- package/AI_USAGE/components/drawer.md +227 -0
- package/AI_USAGE/components/dropdown-api.md +529 -0
- package/AI_USAGE/components/dropdown.md +392 -3
- package/AI_USAGE/components/empty-api.md +36 -0
- package/AI_USAGE/components/empty.md +227 -3
- package/AI_USAGE/components/finicon.md +88 -0
- package/AI_USAGE/components/form-api.md +524 -0
- package/AI_USAGE/components/form.md +454 -0
- package/AI_USAGE/components/grid-api.md +527 -0
- package/AI_USAGE/components/grid.md +224 -0
- package/AI_USAGE/components/heatmap-api.md +122 -0
- package/AI_USAGE/components/heatmap.md +220 -0
- package/AI_USAGE/components/icon-api.md +4707 -0
- package/AI_USAGE/components/icon.md +257 -0
- package/AI_USAGE/components/image-api.md +440 -0
- package/AI_USAGE/components/image.md +465 -0
- package/AI_USAGE/components/input-api.md +184 -0
- package/AI_USAGE/components/input-number-api.md +66 -0
- package/AI_USAGE/components/input-number.md +294 -0
- package/AI_USAGE/components/input-tag-api.md +114 -0
- package/AI_USAGE/components/input-tag.md +482 -0
- package/AI_USAGE/components/input.md +293 -3
- package/AI_USAGE/components/layout-api.md +147 -0
- package/AI_USAGE/components/layout.md +230 -0
- package/AI_USAGE/components/line-chart-api.md +197 -0
- package/AI_USAGE/components/line-chart.md +279 -3
- package/AI_USAGE/components/link-api.md +42 -0
- package/AI_USAGE/components/link.md +197 -0
- package/AI_USAGE/components/menu-api.md +516 -0
- package/AI_USAGE/components/menu.md +268 -0
- package/AI_USAGE/components/message-api.md +215 -0
- package/AI_USAGE/components/message-box-api.md +108 -0
- package/AI_USAGE/components/message-box.md +268 -3
- package/AI_USAGE/components/message.md +231 -3
- package/AI_USAGE/components/network-api.md +91 -0
- package/AI_USAGE/components/network.md +378 -0
- package/AI_USAGE/components/notification-api.md +236 -0
- package/AI_USAGE/components/notification.md +275 -3
- package/AI_USAGE/components/pagination-api.md +62 -0
- package/AI_USAGE/components/pagination.md +380 -3
- package/AI_USAGE/components/pie-chart-api.md +109 -0
- package/AI_USAGE/components/pie-chart.md +245 -3
- package/AI_USAGE/components/popconfirm-api.md +75 -0
- package/AI_USAGE/components/popconfirm.md +231 -3
- package/AI_USAGE/components/popover-api.md +75 -0
- package/AI_USAGE/components/popover.md +208 -3
- package/AI_USAGE/components/popup-api.md +75 -0
- package/AI_USAGE/components/popup.md +52 -0
- package/AI_USAGE/components/progress-api.md +44 -0
- package/AI_USAGE/components/progress.md +248 -3
- package/AI_USAGE/components/radio-api.md +165 -0
- package/AI_USAGE/components/radio.md +259 -3
- package/AI_USAGE/components/rate-api.md +54 -0
- package/AI_USAGE/components/rate.md +233 -3
- package/AI_USAGE/components/resize-box-api.md +56 -0
- package/AI_USAGE/components/resize-box.md +231 -0
- package/AI_USAGE/components/scrollbar-api.md +77 -0
- package/AI_USAGE/components/scrollbar.md +218 -0
- package/AI_USAGE/components/select-api.md +758 -0
- package/AI_USAGE/components/select.md +640 -3
- package/AI_USAGE/components/skeleton-api.md +85 -0
- package/AI_USAGE/components/skeleton.md +150 -0
- package/AI_USAGE/components/slider-api.md +51 -0
- package/AI_USAGE/components/slider.md +233 -3
- package/AI_USAGE/components/space-api.md +38 -0
- package/AI_USAGE/components/space.md +145 -0
- package/AI_USAGE/components/spin-api.md +43 -0
- package/AI_USAGE/components/spin.md +205 -0
- package/AI_USAGE/components/steps-api.md +111 -0
- package/AI_USAGE/components/steps.md +201 -3
- package/AI_USAGE/components/switch-api.md +58 -0
- package/AI_USAGE/components/switch.md +290 -3
- package/AI_USAGE/components/table-api.md +2919 -0
- package/AI_USAGE/components/table.md +1414 -0
- package/AI_USAGE/components/tabs-api.md +135 -0
- package/AI_USAGE/components/tabs.md +308 -3
- package/AI_USAGE/components/tag-api.md +124 -0
- package/AI_USAGE/components/tag.md +292 -0
- package/AI_USAGE/components/textarea-api.md +55 -0
- package/AI_USAGE/components/textarea.md +326 -3
- package/AI_USAGE/components/time-picker-api.md +137 -0
- package/AI_USAGE/components/time-picker.md +271 -3
- package/AI_USAGE/components/time-range-selector-api.md +44 -0
- package/AI_USAGE/components/time-range-selector.md +355 -0
- package/AI_USAGE/components/timeline-api.md +93 -0
- package/AI_USAGE/components/timeline.md +312 -0
- package/AI_USAGE/components/tooltip-api.md +77 -0
- package/AI_USAGE/components/tooltip.md +182 -0
- package/AI_USAGE/components/trend-chart-api.md +119 -0
- package/AI_USAGE/components/trend-chart.md +335 -0
- package/AI_USAGE/components/trigger-api.md +124 -0
- package/AI_USAGE/components/trigger.md +185 -0
- package/AI_USAGE/components/upload-api.md +200 -0
- package/AI_USAGE/components/upload.md +711 -3
- package/AI_USAGE/components/watermark-api.md +87 -0
- package/AI_USAGE/components/watermark.md +200 -0
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +35 -7
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +33651 -5
- package/CHANGELOG.md +18 -0
- package/dist/_utils/inherit-component-type.d.ts +11 -0
- package/dist/components/date-picker/index.d.ts +420 -5
- package/dist/components/form-input/index.d.ts +617 -2
- package/dist/components/layout/index.d.ts +689 -1
- package/dist/components/menu/index.d.ts +786 -1
- package/dist/es/_utils/inherit-component-type.js +6 -0
- package/dist/es/components/date-picker/index.js +18 -17
- package/dist/es/components/form-input/index.js +12 -11
- package/dist/es/components/layout/index.js +10 -9
- package/dist/es/components/menu/hooks/use-level.js +5 -5
- package/dist/es/components/menu/index.js +13 -10
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/package.json +10 -5
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
2
|
# Alert AI 使用
|
|
3
3
|
|
|
4
|
-
适用版本:x-next@1.
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
5
|
|
|
6
|
-
先读 [通用接入](../core.md)。公开导出:`Alert
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`Alert`;主要模型:v-model:visible。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./alert-api.md),包含本组件族全部子组件和别名。
|
|
7
7
|
|
|
8
8
|
按需样式:`x-next/style/alert`(包含 base.css、alert.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
9
|
|
|
10
|
+
## 已核验行为与示例
|
|
11
|
+
|
|
10
12
|
[组件文档与 live demo](https://x-next.yjmf.com/components/alert)。用 `v-model:visible` 控制显示;`defaultVisible=true`、`type='info'`、`showIcon=true`、`closable=false`。常用类型为 info、success、warning、error、normal。
|
|
11
13
|
|
|
12
14
|
`close(event)` 返回 `MouseEvent`,`after-close` 在关闭动画结束后触发且无参数。默认插槽放正文,`title` / `icon` / `action` / `close-element` 插槽可自定义对应内容。
|
|
@@ -30,4 +32,221 @@ function restore() { visible.value = true; feedback.value = '提示显示中'; }
|
|
|
30
32
|
</template>
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
## 场景用法
|
|
36
|
+
|
|
37
|
+
以下示例从本地 `src/docs/components/alert.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./alert-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
38
|
+
|
|
39
|
+
### 用途与选型
|
|
40
|
+
|
|
41
|
+
用于展示页面内的重要提示、状态说明或操作反馈。
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### 何时使用
|
|
45
|
+
|
|
46
|
+
- 页面中有需要用户注意的静态提示、状态说明或操作反馈。
|
|
47
|
+
- 提示不需要自动消失,或希望用户手动关闭。
|
|
48
|
+
- 需要在顶部公告、表单说明、结果反馈等场景中保持内容可见。
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### 基础用法
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import 'x-next/style.css';
|
|
56
|
+
import { Alert } from 'x-next';
|
|
57
|
+
|
|
58
|
+
</script>
|
|
59
|
+
<template>
|
|
60
|
+
<Alert type="info" title="提示">这是一条提示信息。</Alert>
|
|
61
|
+
<Alert type="success">保存成功,配置已生效。</Alert>
|
|
62
|
+
</template>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 类型
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import 'x-next/style.css';
|
|
70
|
+
import { Alert } from 'x-next';
|
|
71
|
+
|
|
72
|
+
</script>
|
|
73
|
+
<template>
|
|
74
|
+
<Alert type="info">用于普通信息提示。</Alert>
|
|
75
|
+
<Alert type="success">用于成功状态反馈。</Alert>
|
|
76
|
+
<Alert type="warning">用于需要关注的警告信息。</Alert>
|
|
77
|
+
<Alert type="strong">用于需要强调的提醒信息。</Alert>
|
|
78
|
+
<Alert type="error">用于错误或失败信息。</Alert>
|
|
79
|
+
<Alert type="normal">用于弱提示或中性说明。</Alert>
|
|
80
|
+
</template>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 标题
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
import 'x-next/style.css';
|
|
88
|
+
import { Alert } from 'x-next';
|
|
89
|
+
|
|
90
|
+
</script>
|
|
91
|
+
<template>
|
|
92
|
+
<Alert type="info" title="系统提示">维护窗口为今天 22:00 至 23:00。</Alert>
|
|
93
|
+
<Alert type="warning">
|
|
94
|
+
<template #title>容量不足</template>
|
|
95
|
+
当前空间即将用尽,请及时清理。
|
|
96
|
+
</Alert>
|
|
97
|
+
</template>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 可关闭
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<script setup lang="ts">
|
|
104
|
+
import 'x-next/style.css';
|
|
105
|
+
import { Button, Alert } from 'x-next';
|
|
106
|
+
import { ref } from 'vue';
|
|
107
|
+
|
|
108
|
+
const alertKey = ref(0);
|
|
109
|
+
const closeCount = ref(0);
|
|
110
|
+
const afterCloseCount = ref(0);
|
|
111
|
+
|
|
112
|
+
const handleClose = () => {
|
|
113
|
+
closeCount.value += 1;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const handleAfterClose = () => {
|
|
117
|
+
afterCloseCount.value += 1;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const reset = () => {
|
|
121
|
+
alertKey.value += 1;
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
<template>
|
|
125
|
+
<Button size="small" @click="reset">重新显示</Button>
|
|
126
|
+
<Alert
|
|
127
|
+
:key="alertKey"
|
|
128
|
+
closable
|
|
129
|
+
type="success"
|
|
130
|
+
@close="handleClose"
|
|
131
|
+
@after-close="handleAfterClose"
|
|
132
|
+
>
|
|
133
|
+
保存成功,点击关闭按钮后会触发关闭事件。
|
|
134
|
+
</Alert>
|
|
135
|
+
<div>close:{{ closeCount }} 次,after-close:{{ afterCloseCount }} 次</div>
|
|
136
|
+
</template>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 受控显示
|
|
140
|
+
|
|
141
|
+
```vue
|
|
142
|
+
<script setup lang="ts">
|
|
143
|
+
import 'x-next/style.css';
|
|
144
|
+
import { Button, Alert } from 'x-next';
|
|
145
|
+
import { ref } from 'vue';
|
|
146
|
+
|
|
147
|
+
const visible = ref(true);
|
|
148
|
+
</script>
|
|
149
|
+
<template>
|
|
150
|
+
<Button size="small" @click="visible = true">显示提示</Button>
|
|
151
|
+
<Alert v-model:visible="visible" closable type="info">
|
|
152
|
+
通过 v-model:visible 控制显示状态,关闭后可由外部重新显示。
|
|
153
|
+
</Alert>
|
|
154
|
+
</template>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 隐藏图标
|
|
158
|
+
|
|
159
|
+
```vue
|
|
160
|
+
<script setup lang="ts">
|
|
161
|
+
import 'x-next/style.css';
|
|
162
|
+
import { Alert } from 'x-next';
|
|
163
|
+
|
|
164
|
+
</script>
|
|
165
|
+
<template>
|
|
166
|
+
<Alert :show-icon="false" type="info">隐藏信息提示的默认图标。</Alert>
|
|
167
|
+
<Alert :show-icon="false" type="warning" title="无图标标题">
|
|
168
|
+
标题和正文布局仍然保持可读。
|
|
169
|
+
</Alert>
|
|
170
|
+
</template>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 自定义图标和关闭元素
|
|
174
|
+
|
|
175
|
+
```vue
|
|
176
|
+
<script setup lang="ts">
|
|
177
|
+
import 'x-next/style.css';
|
|
178
|
+
import { Alert } from 'x-next';
|
|
179
|
+
|
|
180
|
+
</script>
|
|
181
|
+
<template>
|
|
182
|
+
<Alert type="warning">
|
|
183
|
+
<template #icon>
|
|
184
|
+
<span class="custom-icon">!</span>
|
|
185
|
+
</template>
|
|
186
|
+
自定义图标会替换默认状态图标。
|
|
187
|
+
</Alert>
|
|
188
|
+
|
|
189
|
+
<Alert closable type="info">
|
|
190
|
+
<template #close-element>知道了</template>
|
|
191
|
+
可以通过 close-element 插槽替换关闭按钮内容。
|
|
192
|
+
</Alert>
|
|
193
|
+
|
|
194
|
+
<Alert type="normal">
|
|
195
|
+
<template #icon>
|
|
196
|
+
<span class="custom-icon">i</span>
|
|
197
|
+
</template>
|
|
198
|
+
normal 类型默认不显示图标;传入 icon 插槽后会显示自定义图标。
|
|
199
|
+
</Alert>
|
|
200
|
+
</template>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 操作区
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<script setup lang="ts">
|
|
207
|
+
import 'x-next/style.css';
|
|
208
|
+
import { Alert, Button } from 'x-next';
|
|
209
|
+
|
|
210
|
+
</script>
|
|
211
|
+
<template>
|
|
212
|
+
<Alert type="warning" title="容量不足" closable>
|
|
213
|
+
当前空间即将用尽,请及时清理。
|
|
214
|
+
<template #action>
|
|
215
|
+
<Button size="small" type="primary">去处理</Button>
|
|
216
|
+
</template>
|
|
217
|
+
</Alert>
|
|
218
|
+
|
|
219
|
+
<Alert type="info">
|
|
220
|
+
有新的配置建议可查看。
|
|
221
|
+
<template #action>
|
|
222
|
+
<Button size="small" type="text">查看详情</Button>
|
|
223
|
+
</template>
|
|
224
|
+
</Alert>
|
|
225
|
+
</template>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### 顶部公告
|
|
229
|
+
|
|
230
|
+
```vue
|
|
231
|
+
<script setup lang="ts">
|
|
232
|
+
import 'x-next/style.css';
|
|
233
|
+
import { Alert } from 'x-next';
|
|
234
|
+
|
|
235
|
+
</script>
|
|
236
|
+
<template>
|
|
237
|
+
<Alert banner center>这是居中的顶部公告。</Alert>
|
|
238
|
+
<Alert banner type="warning">banner 只改变边框和圆角,不会自动改变提示类型。</Alert>
|
|
239
|
+
</template>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 交互说明
|
|
243
|
+
|
|
244
|
+
- Alert 是页面内静态提示,不会自动消失。
|
|
245
|
+
- 未传 `visible` 时,Alert 使用内部状态;`closable` 关闭后当前实例会隐藏。
|
|
246
|
+
- 传入 `visible` 或使用 `v-model:visible` 时,显示状态由外部控制,关闭会触发 `update:visible=false`。
|
|
247
|
+
- `close-element` 只替换关闭按钮内容,关闭事件仍由外层关闭按钮承载。
|
|
248
|
+
- `normal` 类型默认不显示图标;如需图标,请使用 `icon` 插槽。
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./alert-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# BarChart 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## BarChart API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/bar-chart/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| categories | 类目轴标签,与各系列 data 下标对应 | undefined | (string | number)[] | 否 | [] |
|
|
17
|
+
| series | 数据系列,必填 | undefined | BarChartSeries[] | 是 | [] |
|
|
18
|
+
| stack | 多系列是否堆叠;false 时并排 | undefined | false | true | 否 | false |
|
|
19
|
+
| height | 图表高度,数字按 px | undefined | string | number | 否 | 240 |
|
|
20
|
+
| width | 图表宽度,数字按 px | undefined | string | number | 否 | "100%" |
|
|
21
|
+
| max | 数值轴上界;传入后锁定刻度,超出部分截断 | undefined | number | 否 | 未声明 |
|
|
22
|
+
| barWidth | 柱体宽度,默认按类目带自适应 | undefined | number | 否 | 未声明 |
|
|
23
|
+
| barRadius | 柱顶圆角半径 | undefined | number | 否 | 4 |
|
|
24
|
+
| padding | 绘制边距,1-4 个非负数字字符串或单个数字 | undefined | string | number | 否 | "8" |
|
|
25
|
+
| grid | 网格线配置 | undefined | BarChartGridOptions | 否 | null |
|
|
26
|
+
| labels | 轴标签配置 | undefined | BarChartLabelsOptions | 否 | null |
|
|
27
|
+
| tooltip | 悬浮提示 | undefined | false | true | 否 | true |
|
|
28
|
+
| legend | 图例,点击可隐藏/显示系列 | undefined | false | true | 否 | false |
|
|
29
|
+
| valueFormatter | 数值格式化,用于提示、图例与数值轴 | undefined | (value: number) => string | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
|
|
30
|
+
| loading | 加载中 | undefined | false | true | { [x: string]: unknown; } | 否 | false |
|
|
31
|
+
| ariaLabel | 无障碍名称;设置后画布带 role="img" | undefined | string | 否 | 未声明 |
|
|
32
|
+
|
|
33
|
+
### Events
|
|
34
|
+
|
|
35
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| bar-click | 见场景用法与类型 | undefined | (data: BarChartClickData) => any |
|
|
38
|
+
| legend-change | 见场景用法与类型 | undefined | (visibleIndexes: number[]) => any |
|
|
39
|
+
|
|
40
|
+
### Slots
|
|
41
|
+
|
|
42
|
+
| 名称 | 用途 | 公开类型 |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| tooltip | 自定义悬浮提示内容 | undefined | (props: BarChartTooltipSlotProps) => unknown |
|
|
45
|
+
| legend | 自定义图例 | undefined | (props: { series: BarChartSeries[]; hiddenIndexes: number[]; }) => unknown |
|
|
46
|
+
| bar | 自定义柱体渲染 | undefined | (props: { seriesIndex: number; index: number; value: number; x: number; y: number; width: number; height: number; color: string; }) => unknown |
|
|
47
|
+
| empty | 自定义空态内容 | undefined | () => unknown |
|
|
48
|
+
|
|
49
|
+
### 实例方法
|
|
50
|
+
|
|
51
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
52
|
+
|
|
53
|
+
### 关联类型定义
|
|
54
|
+
|
|
55
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
56
|
+
|
|
57
|
+
```typescript-reference
|
|
58
|
+
interface BarChartSeries {
|
|
59
|
+
/** 系列名,用于悬浮提示与多系列区分 */
|
|
60
|
+
name?: string;
|
|
61
|
+
/** 该系列按 categories 顺序排列的值 */
|
|
62
|
+
data: Array<number | null | undefined>;
|
|
63
|
+
/** 该系列的颜色,默认取内置分类色板(按系列下标循环) */
|
|
64
|
+
color?: CSSColor;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface BarChartGridOptions {
|
|
68
|
+
/** 是否显示横向网格线,默认 true */
|
|
69
|
+
horizontalLines?: boolean;
|
|
70
|
+
/** 横向网格线数量(含基线),默认 4 */
|
|
71
|
+
horizontalLinesNumber?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface BarChartLabelsOptions {
|
|
75
|
+
/** 是否显示类目标签,默认 true */
|
|
76
|
+
xVisible?: boolean;
|
|
77
|
+
/** 是否显示数值轴标签,默认 true */
|
|
78
|
+
yVisible?: boolean;
|
|
79
|
+
/** 类目标签格式化 */
|
|
80
|
+
xFormatter?: (label: string, index: number) => string;
|
|
81
|
+
/** 数值轴刻度格式化 */
|
|
82
|
+
yFormatter?: (value: number) => string;
|
|
83
|
+
/** 轴标签字号,默认 12 */
|
|
84
|
+
fontSize?: number;
|
|
85
|
+
/** 轴标签颜色,默认取组件文字 token */
|
|
86
|
+
color?: CSSColor;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface BarChartTooltipItem {
|
|
90
|
+
/** 系列下标 */
|
|
91
|
+
seriesIndex: number;
|
|
92
|
+
/** 系列名,未提供时为 undefined */
|
|
93
|
+
name?: string;
|
|
94
|
+
/** 该系列在当前类目的值 */
|
|
95
|
+
value: number;
|
|
96
|
+
/**
|
|
97
|
+
* 该系列生效的颜色:业务传入值原样返回,未传入时是内置色板的
|
|
98
|
+
* `var(--x-bar-chart-color-series-N)` 引用,可直接用于 style 背景色。
|
|
99
|
+
*/
|
|
100
|
+
color: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface BarChartActiveData {
|
|
104
|
+
/** 类目下标 */
|
|
105
|
+
index: number;
|
|
106
|
+
/** 类目标签(已应用 labels.xFormatter) */
|
|
107
|
+
label: string;
|
|
108
|
+
/** 各类目的系列值 */
|
|
109
|
+
items: BarChartTooltipItem[];
|
|
110
|
+
/** 所有系列的合计值;stack 时为堆叠总值 */
|
|
111
|
+
total: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface BarChartClickData extends BarChartActiveData {
|
|
115
|
+
/** 命中的系列下标;点击落在空白或零值类目时为 null */
|
|
116
|
+
seriesIndex: number | null;
|
|
117
|
+
/** 命中的柱体值;未命中时为 null */
|
|
118
|
+
value: number | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface BarChartTooltipSlotProps extends BarChartActiveData {
|
|
122
|
+
/** 组件当前的数值格式化函数,供自定义内容保持一致 */
|
|
123
|
+
formatValue: (value: number) => string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type BarChartProps = ExtractPropTypes<typeof barChartProps>;
|
|
127
|
+
|
|
128
|
+
interface BarChartPlot {
|
|
129
|
+
left: number;
|
|
130
|
+
top: number;
|
|
131
|
+
right: number;
|
|
132
|
+
bottom: number;
|
|
133
|
+
width: number;
|
|
134
|
+
height: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface BarChartBarGeometry {
|
|
138
|
+
/** 类目下标 */
|
|
139
|
+
index: number;
|
|
140
|
+
/** 系列下标 */
|
|
141
|
+
seriesIndex: number;
|
|
142
|
+
/** 该柱体代表的值 */
|
|
143
|
+
value: number;
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
width: number;
|
|
147
|
+
height: number;
|
|
148
|
+
/** path 绘制指令(仅顶部圆角) */
|
|
149
|
+
path: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface ComputeBarLayoutParams {
|
|
153
|
+
count: number;
|
|
154
|
+
/** values[seriesIndex][categoryIndex],调用方需已把 null / 负数归一化为 0 */
|
|
155
|
+
values: number[][];
|
|
156
|
+
stack: boolean;
|
|
157
|
+
plot: BarChartPlot;
|
|
158
|
+
domainMax: number;
|
|
159
|
+
barWidth?: number;
|
|
160
|
+
barRadius: number;
|
|
161
|
+
/** 堆叠分段之间的间隙,默认 1px */
|
|
162
|
+
stackGap?: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
interface BarChartLayout {
|
|
166
|
+
band: number;
|
|
167
|
+
barWidth: number;
|
|
168
|
+
bars: BarChartBarGeometry[];
|
|
169
|
+
/** 每个类目中心 x,供标签、激活线与悬浮锚点使用 */
|
|
170
|
+
categoryCenters: number[];
|
|
171
|
+
/** 每个类目最高柱体顶部的 y;无数据时为绘图区底部 */
|
|
172
|
+
categoryTops: number[];
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
返回 [BarChart 用法](./bar-chart.md)。
|