x-next 1.12.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 +386 -5
- 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 +33657 -7
- package/CHANGELOG.md +40 -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/components/network/Network.vue.d.ts +7 -3
- package/dist/components/network/index.d.ts +10 -2
- package/dist/components/network/props.d.ts +5 -0
- package/dist/components/network/utils.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +4 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +101 -130
- package/dist/components/pagination/page-item.vue.d.ts +1 -0
- package/dist/components/pagination/page-jumper.vue.d.ts +1 -1
- package/dist/components/pagination/page-options.vue.d.ts +6 -4
- package/dist/components/pagination/utils.d.ts +3 -0
- package/dist/components/time-range-selector/index.d.ts +6 -6
- package/dist/es/_container/resize-observer-v2.js +1 -1
- package/dist/es/_container/resize-observer.js +1 -1
- package/dist/es/_hooks/use-resize-observer.js +1 -1
- package/dist/es/_styles/palette-aliases.js +4 -4
- package/dist/es/_utils/inherit-component-type.js +6 -0
- package/dist/es/_virtual/advancedFormat.js +1 -1
- package/dist/es/_virtual/customParseFormat.js +1 -1
- package/dist/es/_virtual/dayjs.min.js +1 -1
- package/dist/es/_virtual/isBetween.js +1 -1
- package/dist/es/_virtual/quarterOfYear.js +1 -1
- package/dist/es/_virtual/weekOfYear.js +1 -1
- package/dist/es/_virtual/weekYear.js +1 -1
- package/dist/es/_virtual/zh-cn.js +1 -1
- package/dist/es/components/button/Button.js +53 -42
- package/dist/es/components/date-picker/index.js +18 -17
- package/dist/es/components/draggable/useDraggable.js +1 -1
- package/dist/es/components/form/Form.vue2.js +1 -1
- package/dist/es/components/form/FormItem.vue2.js +1 -1
- package/dist/es/components/form-input/index.js +12 -11
- package/dist/es/components/form-input-number/InputNumber.js +1 -1
- package/dist/es/components/form-slider/Slider.vue2.js +1 -1
- package/dist/es/components/form-slider/slider-ticks.vue2.js +1 -1
- package/dist/es/components/form-slider/utils.js +1 -1
- package/dist/es/components/layout/index.js +10 -9
- package/dist/es/components/menu/MenuItem.js +1 -1
- package/dist/es/components/menu/hooks/use-level.js +5 -5
- package/dist/es/components/menu/index.js +13 -10
- package/dist/es/components/menu/overflow-wrap.js +1 -1
- package/dist/es/components/network/Network.vue.js +17 -12
- package/dist/es/components/network/Network.vue2.js +78 -70
- package/dist/es/components/network/utils.js +112 -71
- package/dist/es/components/pagination/Pagination.js +132 -123
- package/dist/es/components/pagination/page-item-ellipsis.vue.js +10 -10
- package/dist/es/components/pagination/page-item-ellipsis.vue2.js +24 -19
- package/dist/es/components/pagination/page-item-step.vue.js +14 -11
- package/dist/es/components/pagination/page-item-step.vue2.js +20 -22
- package/dist/es/components/pagination/page-item.vue.js +10 -9
- package/dist/es/components/pagination/page-item.vue2.js +24 -19
- package/dist/es/components/pagination/page-jumper.vue2.js +23 -23
- package/dist/es/components/pagination/page-options.vue.js +15 -10
- package/dist/es/components/pagination/page-options.vue2.js +21 -17
- package/dist/es/components/pagination/utils.js +4 -2
- package/dist/es/components/progress/circle.vue2.js +1 -1
- package/dist/es/components/progress/line.vue2.js +1 -1
- package/dist/es/components/progress/steps.vue2.js +1 -1
- package/dist/es/components/rate/Rate.js +1 -1
- package/dist/es/components/virtual-list-v2/virtual-list-item.js +1 -1
- package/dist/es/locale/en-US.js +2 -0
- package/dist/es/locale/zh-CN.js +2 -0
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/locale/zh-cn.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/advancedFormat.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/customParseFormat.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/isBetween.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/quarterOfYear.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/weekOfYear.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/weekYear.js +1 -1
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/locale/interface.d.ts +3 -0
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/form-select.css +1 -1
- package/dist/style/network.css +1 -1
- package/dist/style/pagination.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +10 -5
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/index.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/is.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/locale/en-US.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/array.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/base.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/boolean.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/custom.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/number.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/object.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/string.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/type.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/util.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/compute-scroll-into-view@3.1.1/node_modules/compute-scroll-into-view/dist/index.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/scroll-into-view-if-needed@3.1.0/node_modules/scroll-into-view-if-needed/dist/index.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
2
|
# Button AI 使用
|
|
3
3
|
|
|
4
|
-
适用版本:x-next@1.
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
5
|
|
|
6
|
-
先读 [通用接入](../core.md)。公开导出:`Button
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`Button, ButtonGroup`;主要模型:无。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./button-api.md),包含本组件族全部子组件和别名。
|
|
7
7
|
|
|
8
8
|
按需样式:`x-next/style/button`(包含 base.css、button.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
9
|
|
|
10
|
+
## 已核验行为与示例
|
|
11
|
+
|
|
10
12
|
[组件文档与 live demo](https://x-next.yjmf.com/components/button)。`type` 默认 `'default'`,视觉主按钮用 `'primary'`;`htmlType` 默认 `'button'`,原生提交用 `'submit'`。尺寸优先级为显式 `size` → ButtonGroup → ConfigProvider → `'medium'`;Button 不通过 FormItem 继承尺寸。`disabled` / `loading` 默认关闭。
|
|
11
13
|
|
|
12
14
|
`click` 载荷为 `MouseEvent`,禁用或加载中不会触发。`default`、`prefix`、`suffix`、`icon` 插槽可组合内容;异步业务自行维护 `loading`。
|
|
@@ -32,4 +34,446 @@ async function save(_event: MouseEvent) {
|
|
|
32
34
|
</template>
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
## 场景用法
|
|
38
|
+
|
|
39
|
+
以下示例从本地 `src/docs/components/button.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./button-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
40
|
+
|
|
41
|
+
### 用途与选型
|
|
42
|
+
|
|
43
|
+
按钮用于触发即时操作,是业务界面里最常见的动作入口。
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### 何时使用
|
|
47
|
+
|
|
48
|
+
- 触发提交、保存、删除、打开弹层等即时动作。
|
|
49
|
+
- 在操作区表达主次关系、危险程度和加载反馈。
|
|
50
|
+
- 多个相关动作需要组成按钮组时。
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### 基础用法
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import 'x-next/style.css';
|
|
58
|
+
import { Button } from 'x-next';
|
|
59
|
+
|
|
60
|
+
</script>
|
|
61
|
+
<template>
|
|
62
|
+
<Button>默认按钮</Button>
|
|
63
|
+
<Button type="primary">主要按钮</Button>
|
|
64
|
+
<Button type="outline">描边按钮</Button>
|
|
65
|
+
<Button type="text">文本按钮</Button>
|
|
66
|
+
</template>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 外部水波纹
|
|
70
|
+
|
|
71
|
+
Button 默认开启类似 Ant Design Vue 的外部轮廓水波纹。`disabled`、`loading`、`link` 和 `type="text"` 状态不会展示外部水波纹。
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<script setup lang="ts">
|
|
75
|
+
import 'x-next/style.css';
|
|
76
|
+
import { Button } from 'x-next';
|
|
77
|
+
|
|
78
|
+
</script>
|
|
79
|
+
<template>
|
|
80
|
+
<Button>默认水波纹</Button>
|
|
81
|
+
<Button type="primary">主要水波纹</Button>
|
|
82
|
+
<Button status="danger">危险水波纹</Button>
|
|
83
|
+
<Button loading>加载不触发</Button>
|
|
84
|
+
<Button disabled>禁用不触发</Button>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 状态
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<script setup lang="ts">
|
|
92
|
+
import 'x-next/style.css';
|
|
93
|
+
import { Button } from 'x-next';
|
|
94
|
+
|
|
95
|
+
</script>
|
|
96
|
+
<template>
|
|
97
|
+
<Button status="default">默认</Button>
|
|
98
|
+
<Button status="success">成功</Button>
|
|
99
|
+
<Button status="warning">警告</Button>
|
|
100
|
+
<Button status="strong">强调</Button>
|
|
101
|
+
<Button status="danger">危险</Button>
|
|
102
|
+
<Button status="info">信息</Button>
|
|
103
|
+
<Button disabled>禁用</Button>
|
|
104
|
+
</template>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 状态色实心按钮
|
|
108
|
+
|
|
109
|
+
五种状态色都提供实心(高亮)形态,**统一使用白字**与主题惯例一致。实心底色即主题种子色:主要 `#1c61ff`、成功 `#00a809`、警告 `#ffb800`、强调 `#ff8200`、危险 `#e02225`。
|
|
110
|
+
|
|
111
|
+
危险色种子 `#e02225` 的白字对比为 4.75:1,实心底直接使用种子本身,不再需要压暗变体。
|
|
112
|
+
|
|
113
|
+
实心底与白字在明暗主题下都恒定不翻转,因此暗色下仍是同一块强调色。更换主题种子色(`base.scss` 的 `--x-color-<name>`)后实心按钮整体联动。
|
|
114
|
+
|
|
115
|
+
亮黄色、亮橙色实底上的白字属于主题惯例内的折中:这类底亮度过高,强行让白字达到正文级 4.5:1 只能压深到底色失去品牌识别。参考 Arco 的橙色实底白字为 2.57:1、Ant Design 的 `warning` 为 1.90:1,本库 `warning` / `strong` 与二者处于同一水平。需要更高可读性时,可改用 `type="outline"`、`plain` 或 `type="text"` 形态,或把种子色选得更深。各状态实测值与回归下限由 `script/check-contrast.js` 守护。
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
import 'x-next/style.css';
|
|
120
|
+
import { Button } from 'x-next';
|
|
121
|
+
|
|
122
|
+
</script>
|
|
123
|
+
<template>
|
|
124
|
+
<Button type="primary">主要</Button>
|
|
125
|
+
<Button type="primary" status="success">成功</Button>
|
|
126
|
+
<Button type="primary" status="warning">警告</Button>
|
|
127
|
+
<Button type="primary" status="strong">强调</Button>
|
|
128
|
+
<Button type="primary" status="danger">危险</Button>
|
|
129
|
+
</template>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 类型与边框
|
|
133
|
+
|
|
134
|
+
`border="false"` 使用弱背景状态色,不会切换成实心危险按钮。需要实心危险按钮时使用 `type="primary" status="danger"`。
|
|
135
|
+
|
|
136
|
+
`link` 保持透明背景和对应状态文字色,非圆形链接按钮的高度随文字行高变化、没有水平内边距。禁用和加载期间不会响应悬浮或按下颜色。
|
|
137
|
+
|
|
138
|
+
彩色文字按钮(`plain`、`outline`、`text`、`link`)在亮色主题中沿用品牌主色,暗色主题中使用同色系的亮色档,与 Link、Tag 同源。对比度下限对齐 Arco 同级角色,由 `script/check-contrast.js` 的 `ARCO_BASELINE` 守护。
|
|
139
|
+
|
|
140
|
+
### 交互三态
|
|
141
|
+
|
|
142
|
+
按钮的常态、悬浮、按下按**渐深梯度**设计,每一级都可感知且保持轻盈(明度差 ≥ 0.025,由门禁守护):
|
|
143
|
+
|
|
144
|
+
| 形态 | 常态 | 悬浮 | 按下 |
|
|
145
|
+
| --- | --- | --- | --- |
|
|
146
|
+
| 默认 / 信息(灰色系) | `fill-2` | `neutral-3` | `neutral-4` |
|
|
147
|
+
| 彩色弱底 / 描边 / 文本(除 warning) | 无色或同色浅底 | 同色浅底混入按钮文字色 10% | 同色浅底混入按钮文字色 16% |
|
|
148
|
+
| warning 弱底 / 描边 / 文本 | 无色或同色浅底 | 同色浅底混入按钮文字色 25% | 同色浅底混入按钮文字色 40% |
|
|
149
|
+
| 链接 | 透明背景、状态文字色 | 保持常态 | 保持常态 |
|
|
150
|
+
| 实色 | 种子实底 | 混白 8%(更亮) | 混恒定深 10%(更深) |
|
|
151
|
+
|
|
152
|
+
默认按钮不用 `fill-2/3/4` 递进:全局 fill 灰阶在浅端被压缩,`fill-2` 与 `fill-3` 只差 3 个通道,悬浮态几乎看不出变化;改用 `neutral-3/4` 后与 Arco 的步进一致。
|
|
153
|
+
|
|
154
|
+
```vue
|
|
155
|
+
<script setup lang="ts">
|
|
156
|
+
import 'x-next/style.css';
|
|
157
|
+
import { Button } from 'x-next';
|
|
158
|
+
|
|
159
|
+
</script>
|
|
160
|
+
<template>
|
|
161
|
+
<Button type="dashed">虚线按钮</Button>
|
|
162
|
+
<Button type="outline">线性按钮</Button>
|
|
163
|
+
<Button type="text">文本按钮</Button>
|
|
164
|
+
<Button plain status="success">朴素成功</Button>
|
|
165
|
+
<Button :border="false" status="danger">无边框危险</Button>
|
|
166
|
+
<Button link>链接按钮</Button>
|
|
167
|
+
<Button link status="danger">危险链接</Button>
|
|
168
|
+
<Button link disabled>禁用链接</Button>
|
|
169
|
+
</template>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 状态矩阵
|
|
173
|
+
|
|
174
|
+
Button 的状态色基于组件 alias token 组织,例如 `--x-button-color-bg-danger-subtle`、`--x-button-color-bg-danger-solid`、`--x-button-color-text-danger`。后续自定义主题可以优先覆盖这些组件级 token。
|
|
175
|
+
|
|
176
|
+
```vue
|
|
177
|
+
<script setup lang="ts">
|
|
178
|
+
import 'x-next/style.css';
|
|
179
|
+
import { Button } from 'x-next';
|
|
180
|
+
|
|
181
|
+
</script>
|
|
182
|
+
<template>
|
|
183
|
+
<Button status="danger">弱危险</Button>
|
|
184
|
+
<Button type="primary" status="danger">实心危险</Button>
|
|
185
|
+
<Button type="outline" status="danger">描边危险</Button>
|
|
186
|
+
<Button type="dashed" status="danger">虚线危险</Button>
|
|
187
|
+
<Button type="text" status="danger">文本危险</Button>
|
|
188
|
+
<Button :border="false" status="danger">无边框危险</Button>
|
|
189
|
+
</template>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 形状
|
|
193
|
+
|
|
194
|
+
默认使用小圆角;`square` 为直角,`round` 为胶囊形,`circle` 为等宽高圆形,适合图标或单字内容。纯图标按钮请通过 `aria-label` 提供操作名称。
|
|
195
|
+
|
|
196
|
+
```vue
|
|
197
|
+
<script setup lang="ts">
|
|
198
|
+
import 'x-next/style.css';
|
|
199
|
+
import { Button, Icon } from 'x-next';
|
|
200
|
+
const sizes = ['mini', 'small', 'medium', 'large', 'huge'] as const;
|
|
201
|
+
</script>
|
|
202
|
+
<template>
|
|
203
|
+
<div v-for="size in sizes" :key="size">
|
|
204
|
+
<span>{{ size }}</span>
|
|
205
|
+
<Button :size="size">默认</Button>
|
|
206
|
+
<Button :size="size" shape="square">直角</Button>
|
|
207
|
+
<Button :size="size" shape="round">胶囊</Button>
|
|
208
|
+
<Button v-bind="{ 'aria-label': `${size} 添加` }" :size="size" shape="circle" type="primary" >
|
|
209
|
+
<template #icon><Icon name="plus" /></template>
|
|
210
|
+
</Button>
|
|
211
|
+
</div>
|
|
212
|
+
</template>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 尺寸
|
|
216
|
+
|
|
217
|
+
`mini`、`small`、`medium`、`large`、`huge` 的默认高度分别为 24、28、32、36、38px。
|
|
218
|
+
|
|
219
|
+
以下为默认主题中的尺寸规格;链接和形状选项会按对应规则调整布局。
|
|
220
|
+
|
|
221
|
+
| 尺寸 | 高度 | 字号 | 字重 | 左右内边距 | 默认圆角 |
|
|
222
|
+
| --- | --- | --- | --- | --- | --- |
|
|
223
|
+
| `mini` | 24px | 12px | 500 | 8px | 4px |
|
|
224
|
+
| `small` | 28px | 13px | 500 | 10px | 4px |
|
|
225
|
+
| `medium` | 32px | 14px | 500 | 14px | 4px |
|
|
226
|
+
| `large` | 36px | 14px | 500 | 20px | 6px |
|
|
227
|
+
| `huge` | 38px | 16px | 500 | 28px | 6px |
|
|
228
|
+
|
|
229
|
+
```vue
|
|
230
|
+
<script setup lang="ts">
|
|
231
|
+
import 'x-next/style.css';
|
|
232
|
+
import { Button } from 'x-next';
|
|
233
|
+
|
|
234
|
+
</script>
|
|
235
|
+
<template>
|
|
236
|
+
<Button size="mini">迷你</Button>
|
|
237
|
+
<Button size="small">小型</Button>
|
|
238
|
+
<Button size="medium">中型</Button>
|
|
239
|
+
<Button size="large">大型</Button>
|
|
240
|
+
<Button size="huge">超大</Button>
|
|
241
|
+
</template>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 加载与事件
|
|
245
|
+
|
|
246
|
+
```vue
|
|
247
|
+
<script setup lang="ts">
|
|
248
|
+
import 'x-next/style.css';
|
|
249
|
+
import { Button } from 'x-next';
|
|
250
|
+
import { ref } from 'vue';
|
|
251
|
+
|
|
252
|
+
const loading = ref(false);
|
|
253
|
+
const logs = ref<string[]>([]);
|
|
254
|
+
|
|
255
|
+
const runAsync = () => {
|
|
256
|
+
loading.value = true;
|
|
257
|
+
logs.value = ['async start', ...logs.value];
|
|
258
|
+
window.setTimeout(() => {
|
|
259
|
+
loading.value = false;
|
|
260
|
+
logs.value = ['async done', ...logs.value];
|
|
261
|
+
}, 1200);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const pushLog = (label: string) => {
|
|
265
|
+
logs.value = [`${label} clicked`, ...logs.value];
|
|
266
|
+
};
|
|
267
|
+
</script>
|
|
268
|
+
<template>
|
|
269
|
+
<Button :loading="loading" type="primary" @click="runAsync">异步提交</Button>
|
|
270
|
+
<Button :debounce="800" @click="pushLog('debounce')">防重复点击</Button>
|
|
271
|
+
<Button loading @click="pushLog('loading')">加载中</Button>
|
|
272
|
+
<Button disabled @click="pushLog('disabled')">禁用按钮</Button>
|
|
273
|
+
<ul aria-live="polite">
|
|
274
|
+
<li v-for="(log, index) in logs" :key="index">{{ log }}</li>
|
|
275
|
+
</ul>
|
|
276
|
+
</template>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### 原生表单类型
|
|
280
|
+
|
|
281
|
+
<form class="example-box example-box-column" @submit.prevent="handleNativeSubmit">
|
|
282
|
+
</form>
|
|
283
|
+
|
|
284
|
+
`type` 控制视觉样式,`html-type` 控制原生按钮行为。默认 `html-type="button"`,不会因为放进表单而意外提交。
|
|
285
|
+
|
|
286
|
+
```vue
|
|
287
|
+
<script setup lang="ts">
|
|
288
|
+
import 'x-next/style.css';
|
|
289
|
+
import { Button } from 'x-next';
|
|
290
|
+
const handleSubmit = () => {
|
|
291
|
+
// 处理已经通过原生 submit 事件提交的数据
|
|
292
|
+
};
|
|
293
|
+
</script>
|
|
294
|
+
<template>
|
|
295
|
+
<form @submit.prevent="handleSubmit">
|
|
296
|
+
<Button type="primary" html-type="submit">提交表单</Button>
|
|
297
|
+
<Button html-type="reset">重置</Button>
|
|
298
|
+
<Button>普通按钮</Button>
|
|
299
|
+
</form>
|
|
300
|
+
</template>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 文字与图标
|
|
304
|
+
|
|
305
|
+
按钮支持中英文混排,可以通过 `prefix`、`suffix` 插槽添加图标或附加文字。下面展示不同尺寸的组合,切换加载状态可查看加载图标与内容的排列。
|
|
306
|
+
|
|
307
|
+
```vue
|
|
308
|
+
<script setup lang="ts">
|
|
309
|
+
import 'x-next/style.css';
|
|
310
|
+
import { Switch, Button, Icon } from 'x-next';
|
|
311
|
+
import { ref } from 'vue';
|
|
312
|
+
|
|
313
|
+
const loading = ref(false);
|
|
314
|
+
const clickCount = ref(0);
|
|
315
|
+
const sizes = ['mini', 'small', 'medium', 'large', 'huge'] as const;
|
|
316
|
+
import type { ButtonHTMLAttributes } from 'vue';
|
|
317
|
+
const nativeAttrs1 = { "aria-label": "切换文字与图标示例加载" } satisfies ButtonHTMLAttributes;
|
|
318
|
+
</script>
|
|
319
|
+
<template>
|
|
320
|
+
<label>
|
|
321
|
+
<Switch v-bind="nativeAttrs1" v-model="loading" />
|
|
322
|
+
切换加载状态
|
|
323
|
+
</label>
|
|
324
|
+
<div class="button-row">
|
|
325
|
+
<Button v-for="size in sizes" :key="size" :size="size" :loading="loading" @click="clickCount++">
|
|
326
|
+
保存 Save
|
|
327
|
+
</Button>
|
|
328
|
+
</div>
|
|
329
|
+
<div class="button-row">
|
|
330
|
+
<Button v-for="size in sizes" :key="size" :size="size" :loading="loading" @click="clickCount++">
|
|
331
|
+
<template #prefix><Icon name="download" /></template>
|
|
332
|
+
导出
|
|
333
|
+
<template #suffix><span>CSV</span></template>
|
|
334
|
+
</Button>
|
|
335
|
+
</div>
|
|
336
|
+
<p aria-live="polite">
|
|
337
|
+
{{ loading ? '加载中,按钮暂不可点击' : '可点击按钮' }} · 已点击 {{ clickCount }} 次
|
|
338
|
+
</p>
|
|
339
|
+
</template>
|
|
340
|
+
<style scoped>
|
|
341
|
+
.button-row {
|
|
342
|
+
display: flex;
|
|
343
|
+
flex-wrap: wrap;
|
|
344
|
+
align-items: center;
|
|
345
|
+
gap: 12px;
|
|
346
|
+
margin-top: 12px;
|
|
347
|
+
}
|
|
348
|
+
</style>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### 插槽内容
|
|
352
|
+
|
|
353
|
+
```vue
|
|
354
|
+
<script setup lang="ts">
|
|
355
|
+
import 'x-next/style.css';
|
|
356
|
+
import { Button } from 'x-next';
|
|
357
|
+
|
|
358
|
+
import type { HTMLAttributes } from 'vue';
|
|
359
|
+
const nativeAttrs1 = { "aria-label": "帮助" } satisfies HTMLAttributes;
|
|
360
|
+
</script>
|
|
361
|
+
<template>
|
|
362
|
+
<Button type="primary">
|
|
363
|
+
<template #prefix>
|
|
364
|
+
<span aria-hidden="true">+</span>
|
|
365
|
+
</template>
|
|
366
|
+
新建
|
|
367
|
+
</Button>
|
|
368
|
+
<Button>
|
|
369
|
+
导出
|
|
370
|
+
<template #suffix>
|
|
371
|
+
<span aria-hidden="true">↓</span>
|
|
372
|
+
</template>
|
|
373
|
+
</Button>
|
|
374
|
+
<Button v-bind="nativeAttrs1" shape="circle" >
|
|
375
|
+
<template #icon>
|
|
376
|
+
<span aria-hidden="true">?</span>
|
|
377
|
+
</template>
|
|
378
|
+
</Button>
|
|
379
|
+
</template>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### 宽度与窄按钮
|
|
383
|
+
|
|
384
|
+
```vue
|
|
385
|
+
<script setup lang="ts">
|
|
386
|
+
import 'x-next/style.css';
|
|
387
|
+
import { Button } from 'x-next';
|
|
388
|
+
|
|
389
|
+
</script>
|
|
390
|
+
<template>
|
|
391
|
+
<Button block type="primary">撑满父容器</Button>
|
|
392
|
+
<Button narrow>窄按钮</Button>
|
|
393
|
+
<Button size="large" narrow>大型窄按钮</Button>
|
|
394
|
+
<Button loading-fill type="primary" loading>填充加载</Button>
|
|
395
|
+
</template>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### 填充加载与恢复
|
|
399
|
+
|
|
400
|
+
`loading-fill` 在加载时将图标居中覆盖按钮,保留原宽度与圆角;前后缀、图标和文字视觉隐藏,按钮名称仍保留。结束后恢复全部内容。普通 `loading` 在文字前显示加载图标;圆形和仅使用 `icon` 插槽的按钮自动居中覆盖内容,避免固定宽度下并排挤压。
|
|
401
|
+
|
|
402
|
+
```vue
|
|
403
|
+
<script setup lang="ts">
|
|
404
|
+
import 'x-next/style.css';
|
|
405
|
+
import { Switch, Button, Icon } from 'x-next';
|
|
406
|
+
import { ref } from 'vue';
|
|
407
|
+
|
|
408
|
+
const loading = ref(false);
|
|
409
|
+
const clickCount = ref(0);
|
|
410
|
+
import type { ButtonHTMLAttributes } from 'vue';
|
|
411
|
+
const nativeAttrs1 = { "aria-label": "切换填充加载" } satisfies ButtonHTMLAttributes;
|
|
412
|
+
</script>
|
|
413
|
+
<template>
|
|
414
|
+
<label>
|
|
415
|
+
<Switch v-bind="nativeAttrs1" v-model="loading" />
|
|
416
|
+
切换填充加载
|
|
417
|
+
</label>
|
|
418
|
+
<Button loading-fill :loading="loading" type="primary" @click="clickCount++">
|
|
419
|
+
<template #prefix><Icon name="download" /></template>
|
|
420
|
+
导出报告
|
|
421
|
+
<template #suffix><span>CSV</span></template>
|
|
422
|
+
</Button>
|
|
423
|
+
<Button loading-fill :loading="loading" type="outline" shape="round" @click="clickCount++">
|
|
424
|
+
保存设置
|
|
425
|
+
</Button>
|
|
426
|
+
<p aria-live="polite">
|
|
427
|
+
{{ loading ? '加载中,按钮暂不可点击' : '内容已恢复,可点击按钮' }} · 已点击 {{ clickCount }} 次
|
|
428
|
+
</p>
|
|
429
|
+
</template>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### 按钮组
|
|
433
|
+
|
|
434
|
+
按钮组只连接相邻边缘,保留两端的形状;只有一个按钮时仍保留完整圆角。
|
|
435
|
+
|
|
436
|
+
```vue
|
|
437
|
+
<script setup lang="ts">
|
|
438
|
+
import 'x-next/style.css';
|
|
439
|
+
import { Switch, ButtonGroup, Button } from 'x-next';
|
|
440
|
+
import { ref } from 'vue';
|
|
441
|
+
|
|
442
|
+
const disabled = ref(false);
|
|
443
|
+
const clickCount = ref(0);
|
|
444
|
+
import type { ButtonHTMLAttributes } from 'vue';
|
|
445
|
+
const nativeAttrs1 = { "aria-label": "切换按钮组禁用" } satisfies ButtonHTMLAttributes;
|
|
446
|
+
</script>
|
|
447
|
+
<template>
|
|
448
|
+
<label>
|
|
449
|
+
<Switch v-bind="nativeAttrs1" v-model="disabled" />
|
|
450
|
+
切换按钮组禁用
|
|
451
|
+
</label>
|
|
452
|
+
<ButtonGroup type="primary" :disabled="disabled">
|
|
453
|
+
<Button @click="clickCount++">上一页</Button>
|
|
454
|
+
<Button @click="clickCount++">下一页</Button>
|
|
455
|
+
</ButtonGroup>
|
|
456
|
+
<ButtonGroup status="danger" size="small" :disabled="disabled">
|
|
457
|
+
<Button @click="clickCount++">移除</Button>
|
|
458
|
+
<Button @click="clickCount++">清空</Button>
|
|
459
|
+
<Button disabled>禁用</Button>
|
|
460
|
+
</ButtonGroup>
|
|
461
|
+
<ButtonGroup size="large" :disabled="disabled">
|
|
462
|
+
<Button @click="clickCount++">单个按钮</Button>
|
|
463
|
+
</ButtonGroup>
|
|
464
|
+
<ButtonGroup shape="round" :disabled="disabled">
|
|
465
|
+
<Button @click="clickCount++">左侧</Button>
|
|
466
|
+
<Button @click="clickCount++">中间</Button>
|
|
467
|
+
<Button @click="clickCount++">右侧</Button>
|
|
468
|
+
</ButtonGroup>
|
|
469
|
+
<p aria-live="polite">按钮组已点击 {{ clickCount }} 次</p>
|
|
470
|
+
</template>
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### ButtonGroup
|
|
474
|
+
|
|
475
|
+
`ButtonGroup` 可作为按钮组样式容器使用,并可通过组级 `type`、`status`、`shape`、`size`、`disabled` 为内部 `Button` 提供默认值。子按钮显式传入同名属性时,以子按钮自身属性为准。
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./button-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Charts AI 用法
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
先读 [通用接入](../core.md)。本地组件文档导入的选型和配套资源用法。
|
|
7
|
+
|
|
8
|
+
### 用途与选型
|
|
9
|
+
|
|
10
|
+
x-next 内置一套手写 SVG 图表,无外部图表库依赖:颜色跟随 `--x-color-*` token 联动主题与换主色,交互与组件库其余部分一致(受控、插槽、无障碍)。
|
|
11
|
+
|
|
12
|
+
覆盖 AI 面板与后台系统里最常用的五类基础图表;**复杂图表**(K 线 / 桑基 / 关系图 / 地图 / 甘特 / 3D)请在业务侧接入 ECharts 等专业库,不要期望用这里的组件硬拼。
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 怎么选
|
|
16
|
+
|
|
17
|
+
| 要看什么 | 用哪个 | 说明 |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| 随时间的**变化趋势**(Token、成本、请求量) | [LineChart 折线图](./line-chart.md) | 主图首选。多系列对比、面积填充、堆叠面积 |
|
|
20
|
+
| 按类目**比较大小**(各接口耗时、各渠道量) | [BarChart 柱状趋势图](./bar-chart.md) | 单系列看趋势,多系列并排或堆叠看构成 |
|
|
21
|
+
| 看**占比构成**(模型占比、渠道占比) | [PieChart 饼图](./pie-chart.md) | 建议用环形 + 中心合计;类别超过 7 个改用堆叠柱 |
|
|
22
|
+
| 卡片角落的**迷你走势** | [TrendChart 迷你趋势图](./trend-chart.md) | 无坐标轴、无图例,纯形态提示;高度控制在 40~60px、宽度 100~320px |
|
|
23
|
+
| **活跃度分布**(按天 / 周) | [Heatmap 热力图](./heatmap.md) | 一年或任意区间的密度分布 |
|
|
24
|
+
|
|
25
|
+
### 选择时的三个判断
|
|
26
|
+
|
|
27
|
+
1. **要读数还是看形态?** 需要坐标轴读数、悬浮明细、多系列对比,用 LineChart / BarChart / PieChart;只需要「大致在涨还是跌」,用 TrendChart。
|
|
28
|
+
2. **是趋势还是构成?** 时间轴上比较用折线;类目间比较用柱状;占比用环形。别用饼图做趋势,也别用折线表达静态构成。
|
|
29
|
+
3. **类目有多少?** 折线与柱状在 30+ 类目下仍然可读(x 轴标签会自动抽稀);饼图超过 7 个分片就该换堆叠柱状,角度比长度更难分辨。
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### 五个组件的分工
|
|
33
|
+
|
|
34
|
+
| 组件 | 数据模型 | 坐标轴 | 典型高度 |
|
|
35
|
+
| --- | --- | --- | --- |
|
|
36
|
+
| LineChart | `series[{ name, data }]` + `categories` | 类目轴 + 数值轴(支持负值) | 240 ~ 320 |
|
|
37
|
+
| BarChart | `series[{ name, data }]` + `categories` | 类目轴 + 数值轴(0 基线) | 240 ~ 320 |
|
|
38
|
+
| PieChart | `data[{ name, value }]` | 无 | 200 ~ 300 |
|
|
39
|
+
| TrendChart | `dataset: number[]` | 无 | 40 ~ 60 |
|
|
40
|
+
| Heatmap | `data[{ timestamp, value }]` | 无 | 按格子尺寸 |
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### 共同约定
|
|
44
|
+
|
|
45
|
+
- **尺寸**:`height` 传数字按 px(默认 240 ~ 280),`width` 默认撑满父容器;容器尺寸变化时自动重算几何与标签抽稀。
|
|
46
|
+
- **提示**:默认开启,整块画布只挂一个提示节点(不是每个数据点一个浮层),支持 `tooltip` 插槽完全自定义。
|
|
47
|
+
- **图例**:`legend` 开启后点击项可临时隐藏对应系列 / 分片,并触发 `legend-change`;数值轴会按剩余可见系列重算。
|
|
48
|
+
- **键盘与读屏**:画布可聚焦,方向键移动读数,Home / End 跳首尾,Esc 关闭;键盘导航时通过 `aria-live` 播报,`ariaLabel` 提供图像名称。
|
|
49
|
+
- **缺测**:BarChart 与 PieChart 把 `null` / 负数按 0 处理(不画柱、不计入占比);LineChart 默认在缺测处**断开**,可用 `connectNulls` 改为跨过连接。
|
|
50
|
+
- **按需引入**:图表族共享一层样式,按需引入时需要同时引 `base.css` 与对应组件样式。
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### 组合示例
|
|
54
|
+
|
|
55
|
+
同一个面板里组合折线与柱状:把数量放柱状、比率放折线,共用同一组 `categories`。
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<script setup lang="ts">
|
|
59
|
+
import 'x-next/style.css';
|
|
60
|
+
import { LineChart } from 'x-next';
|
|
61
|
+
import { ref } from 'vue';
|
|
62
|
+
|
|
63
|
+
const categories = ref(['周一', '周二', '周三', '周四', '周五', '周六', '周日']);
|
|
64
|
+
const series = ref([
|
|
65
|
+
{ name: '请求量', data: [820, 932, 901, 934, 1290, 1330, 1320] },
|
|
66
|
+
{ name: '错误数', data: [120, 132, 101, 134, 90, 230, 210] },
|
|
67
|
+
]);
|
|
68
|
+
</script>
|
|
69
|
+
<template>
|
|
70
|
+
<LineChart
|
|
71
|
+
:categories="categories"
|
|
72
|
+
:series="series"
|
|
73
|
+
legend
|
|
74
|
+
area
|
|
75
|
+
:height="260"
|
|
76
|
+
/>
|
|
77
|
+
</template>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
返回 [AI 索引](../index.md)。
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Checkbox 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## Checkbox API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/form-checkbox/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| modelValue | 绑定值 | undefined | false | true | CheckboxValue[] | 否 | undefined |
|
|
17
|
+
| defaultChecked | 默认是否选中,非受控模式 | undefined | false | true | 否 | false |
|
|
18
|
+
| value | 选项值,在 CheckboxGroup 中使用 | undefined | string | number | false | true | 否 | false(Vue Boolean 转换) |
|
|
19
|
+
| disabled | 是否禁用 | undefined | false | true | 否 | false |
|
|
20
|
+
| indeterminate | 是否为半选状态 | undefined | false | true | 否 | false |
|
|
21
|
+
| size | 组件尺寸 | undefined | "mini" | "small" | "medium" | "large" | 否 | 未声明 |
|
|
22
|
+
| uninjectGroupContext | 见场景用法与类型 | undefined | false | true | 否 | false |
|
|
23
|
+
|
|
24
|
+
### Events
|
|
25
|
+
|
|
26
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| update:modelValue | 值更新时触发 | undefined | (value: boolean | CheckboxValueList) => any |
|
|
29
|
+
| change | 值变化时触发 | undefined | (value: boolean | CheckboxValueList, ev: Event) => any |
|
|
30
|
+
|
|
31
|
+
### Slots
|
|
32
|
+
|
|
33
|
+
| 名称 | 用途 | 公开类型 |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| default | 复选框文案 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
36
|
+
| checkbox | 自定义复选框图形 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
37
|
+
|
|
38
|
+
### 实例方法
|
|
39
|
+
|
|
40
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
41
|
+
|
|
42
|
+
### 关联类型定义
|
|
43
|
+
|
|
44
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
45
|
+
|
|
46
|
+
```typescript-reference
|
|
47
|
+
type CheckboxValue = string | number | boolean;
|
|
48
|
+
|
|
49
|
+
type CheckboxValueList = CheckboxValue[];
|
|
50
|
+
|
|
51
|
+
interface CheckboxOption {
|
|
52
|
+
/**
|
|
53
|
+
* @zh 文案
|
|
54
|
+
* @en label content
|
|
55
|
+
*/
|
|
56
|
+
label?: RenderContent;
|
|
57
|
+
/**
|
|
58
|
+
* @zh 选项的 `value`
|
|
59
|
+
* @en The `value` of the option
|
|
60
|
+
*/
|
|
61
|
+
value: CheckboxValue;
|
|
62
|
+
/**
|
|
63
|
+
* @zh 是否禁用
|
|
64
|
+
* @en Whether to disable
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* @zh 是否为半选状态
|
|
69
|
+
* @en Whether it is half-selected
|
|
70
|
+
*/
|
|
71
|
+
indeterminate?: boolean;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## CheckboxGroup API
|
|
77
|
+
|
|
78
|
+
公开声明:`dist/components/form-checkbox/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
79
|
+
|
|
80
|
+
### Props
|
|
81
|
+
|
|
82
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
83
|
+
| --- | --- | --- | --- | --- |
|
|
84
|
+
| modelValue | 绑定值 | undefined | CheckboxValue[] | 否 | undefined |
|
|
85
|
+
| defaultValue | 默认值,非受控模式 | undefined | CheckboxValue[] | 否 | [] |
|
|
86
|
+
| max | 最多可选数量 | undefined | number | 否 | 未声明 |
|
|
87
|
+
| options | 选项数据 | undefined | (CheckboxValue | CheckboxOption)[] | 否 | 未声明 |
|
|
88
|
+
| direction | 排列方向 | undefined | "horizontal" | "vertical" | 否 | "horizontal" |
|
|
89
|
+
| disabled | 是否禁用 | undefined | false | true | 否 | false |
|
|
90
|
+
| size | 组件尺寸 | undefined | "mini" | "small" | "medium" | "large" | 否 | 未声明 |
|
|
91
|
+
|
|
92
|
+
### Events
|
|
93
|
+
|
|
94
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| update:modelValue | 值更新时触发 | undefined | (value: CheckboxValueList) => any |
|
|
97
|
+
| change | 值变化时触发 | undefined | (value: CheckboxValueList, ev: Event) => any |
|
|
98
|
+
|
|
99
|
+
### Slots
|
|
100
|
+
|
|
101
|
+
| 名称 | 用途 | 公开类型 |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| default | 自定义复选框列表 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
104
|
+
| label | 自定义 options 文案 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
105
|
+
| checkbox | 自定义复选框图形 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
106
|
+
|
|
107
|
+
### 实例方法
|
|
108
|
+
|
|
109
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
110
|
+
|
|
111
|
+
### 关联类型定义
|
|
112
|
+
|
|
113
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
114
|
+
|
|
115
|
+
```typescript-reference
|
|
116
|
+
type CheckboxValue = string | number | boolean;
|
|
117
|
+
|
|
118
|
+
type CheckboxValueList = CheckboxValue[];
|
|
119
|
+
|
|
120
|
+
interface CheckboxOption {
|
|
121
|
+
/**
|
|
122
|
+
* @zh 文案
|
|
123
|
+
* @en label content
|
|
124
|
+
*/
|
|
125
|
+
label?: RenderContent;
|
|
126
|
+
/**
|
|
127
|
+
* @zh 选项的 `value`
|
|
128
|
+
* @en The `value` of the option
|
|
129
|
+
*/
|
|
130
|
+
value: CheckboxValue;
|
|
131
|
+
/**
|
|
132
|
+
* @zh 是否禁用
|
|
133
|
+
* @en Whether to disable
|
|
134
|
+
*/
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* @zh 是否为半选状态
|
|
138
|
+
* @en Whether it is half-selected
|
|
139
|
+
*/
|
|
140
|
+
indeterminate?: boolean;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
返回 [Checkbox 用法](./checkbox.md)。
|