x-next 1.13.0 → 1.15.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 +108 -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 +256 -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 +306 -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 +1457 -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/tree-select-api.md +498 -0
- package/AI_USAGE/components/tree-select.md +744 -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 +36 -7
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +34972 -5
- package/CHANGELOG.md +39 -0
- package/dist/_props/css.d.ts +2 -1
- package/dist/_utils/inherit-component-type.d.ts +11 -0
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/index.d.ts +3 -3
- package/dist/components/date-picker/index.d.ts +420 -5
- package/dist/components/form-input/index.d.ts +617 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts +689 -1
- package/dist/components/line-chart/LineChart.d.ts +1 -1
- package/dist/components/line-chart/index.d.ts +3 -3
- package/dist/components/line-chart/interface.d.ts +2 -2
- package/dist/components/menu/index.d.ts +786 -1
- package/dist/components/tree-select/TreeNode.vue.d.ts +478 -0
- package/dist/components/tree-select/TreeSelect.d.ts +1549 -0
- package/dist/components/tree-select/TreeSelectDropdown.vue.d.ts +569 -0
- package/dist/components/tree-select/hooks/use-tree-select.d.ts +92 -0
- package/dist/components/tree-select/index.d.ts +3321 -0
- package/dist/components/tree-select/interface.d.ts +203 -0
- package/dist/components/tree-select/utils.d.ts +64 -0
- package/dist/es/_styles/palette-aliases.js +3 -0
- package/dist/es/_utils/inherit-component-type.js +6 -0
- package/dist/es/components/_components/feedback-icon/index.vue2.js +10 -10
- package/dist/es/components/button/Button.js +9 -9
- package/dist/es/components/date-picker/index.js +18 -17
- package/dist/es/components/drawer/src/Drawer.vue.js +6 -6
- package/dist/es/components/form-input/index.js +12 -11
- package/dist/es/components/form-switch/Switch.vue2.js +18 -18
- package/dist/es/components/image/Image.vue2.js +13 -13
- package/dist/es/components/image/ImagePreview.vue2.js +33 -33
- package/dist/es/components/index.js +55 -52
- package/dist/es/components/layout/index.js +10 -9
- package/dist/es/components/link/Link.vue2.js +12 -12
- package/dist/es/components/menu/hooks/use-level.js +5 -5
- package/dist/es/components/menu/index.js +13 -10
- package/dist/es/components/message/message.vue2.js +13 -13
- package/dist/es/components/spin/Spin.js +28 -28
- package/dist/es/components/tag/Tag.vue2.js +22 -22
- package/dist/es/components/timeline/src/Timeline.js +7 -7
- package/dist/es/components/tree-select/TreeNode.vue.js +91 -0
- package/dist/es/components/tree-select/TreeNode.vue2.js +162 -0
- package/dist/es/components/tree-select/TreeSelect.js +865 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue.js +57 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue2.js +79 -0
- package/dist/es/components/tree-select/hooks/use-tree-select.js +376 -0
- package/dist/es/components/tree-select/index.js +13 -0
- package/dist/es/components/tree-select/utils.js +181 -0
- package/dist/es/icons/animation/animation-loading.js +2 -2
- package/dist/es/index.js +71 -68
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/base.css +1 -1
- package/dist/style/dependencies.json +10 -0
- package/dist/style/drawer.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style/tree-select.css +1 -0
- package/dist/style/tree-select.js +8 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +11 -5
- package/volar.d.ts +2 -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
|
# Rate AI 使用
|
|
3
3
|
|
|
4
|
-
适用版本:x-next@1.
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
5
|
|
|
6
|
-
先读 [通用接入](../core.md)。公开导出:`Rate
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`Rate`;主要模型:v-model。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./rate-api.md),包含本组件族全部子组件和别名。
|
|
7
7
|
|
|
8
8
|
按需样式:`x-next/style/rate`(包含 base.css、rate.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
9
|
|
|
10
|
+
## 已核验行为与示例
|
|
11
|
+
|
|
10
12
|
[组件文档与 live demo](https://x-next.yjmf.com/components/rate)。数值模型默认非受控值为 `0`,`count=5`;`allowHalf`、`allowClear`、`readonly`、`disabled` 默认关闭。启用半星后步长为 `0.5`,值限制在有效数量内;没有 `size` 属性。
|
|
11
13
|
|
|
12
14
|
`change(value)` 返回 `number`,`hover-change(value)` 返回 `number | undefined`。`character` 插槽提供 `index`、`value`、`count`、`disabled`;`tooltips` 为提示数组。
|
|
@@ -27,4 +29,232 @@ function changed(value: number) { feedback.value = value ? `评分 ${value}` : '
|
|
|
27
29
|
</template>
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
## 场景用法
|
|
33
|
+
|
|
34
|
+
以下示例从本地 `src/docs/components/rate.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./rate-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
35
|
+
|
|
36
|
+
### 用途与选型
|
|
37
|
+
|
|
38
|
+
用于评分、打星或展示满意度等级,适合评价表单、质量反馈和评分结果展示。
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### 何时使用
|
|
42
|
+
|
|
43
|
+
- 需要用户快速给出等级评价时。
|
|
44
|
+
- 需要在详情、列表或卡片中展示评分结果时。
|
|
45
|
+
- 评分项数量较少,并且每个等级含义容易理解时。
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### 基础用法
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<script setup lang="ts">
|
|
52
|
+
import 'x-next/style.css';
|
|
53
|
+
import { Rate } from 'x-next';
|
|
54
|
+
import { ref } from 'vue';
|
|
55
|
+
|
|
56
|
+
const value = ref(3);
|
|
57
|
+
</script>
|
|
58
|
+
<template>
|
|
59
|
+
<Rate v-model="value" />
|
|
60
|
+
</template>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 半星评分
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<script setup lang="ts">
|
|
67
|
+
import 'x-next/style.css';
|
|
68
|
+
import { Rate } from 'x-next';
|
|
69
|
+
import { ref } from 'vue';
|
|
70
|
+
|
|
71
|
+
const value = ref(2.5);
|
|
72
|
+
</script>
|
|
73
|
+
<template>
|
|
74
|
+
<Rate v-model="value" allow-half />
|
|
75
|
+
</template>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 可清除
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
import 'x-next/style.css';
|
|
83
|
+
import { Rate } from 'x-next';
|
|
84
|
+
import { ref } from 'vue';
|
|
85
|
+
|
|
86
|
+
const value = ref(4);
|
|
87
|
+
</script>
|
|
88
|
+
<template>
|
|
89
|
+
<Rate v-model="value" allow-clear />
|
|
90
|
+
</template>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 只读和禁用
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<script setup lang="ts">
|
|
97
|
+
import 'x-next/style.css';
|
|
98
|
+
import { Rate } from 'x-next';
|
|
99
|
+
import { ref } from 'vue';
|
|
100
|
+
|
|
101
|
+
const readonlyValue = ref(3.5);
|
|
102
|
+
const disabledValue = ref(2);
|
|
103
|
+
</script>
|
|
104
|
+
<template>
|
|
105
|
+
<Rate v-model="readonlyValue" allow-half readonly />
|
|
106
|
+
<Rate v-model="disabledValue" disabled />
|
|
107
|
+
</template>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 自定义数量
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import 'x-next/style.css';
|
|
115
|
+
import { Rate } from 'x-next';
|
|
116
|
+
import { ref } from 'vue';
|
|
117
|
+
|
|
118
|
+
const value = ref(6);
|
|
119
|
+
</script>
|
|
120
|
+
<template>
|
|
121
|
+
<Rate v-model="value" :count="8" />
|
|
122
|
+
</template>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 自定义字符
|
|
126
|
+
|
|
127
|
+
```vue
|
|
128
|
+
<script setup lang="ts">
|
|
129
|
+
import 'x-next/style.css';
|
|
130
|
+
import { Rate } from 'x-next';
|
|
131
|
+
import { ref } from 'vue';
|
|
132
|
+
|
|
133
|
+
const value = ref(3);
|
|
134
|
+
</script>
|
|
135
|
+
<template>
|
|
136
|
+
<Rate v-model="value">
|
|
137
|
+
<template #character="{ index }">
|
|
138
|
+
<span>{{ index + 1 }}</span>
|
|
139
|
+
</template>
|
|
140
|
+
</Rate>
|
|
141
|
+
</template>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 自定义颜色和笑脸分级
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import 'x-next/style.css';
|
|
149
|
+
import { Rate } from 'x-next';
|
|
150
|
+
import { ref } from 'vue';
|
|
151
|
+
|
|
152
|
+
const value = ref(4);
|
|
153
|
+
const scoreColors = {
|
|
154
|
+
2: '#f53f3f',
|
|
155
|
+
4: '#ff7d00',
|
|
156
|
+
5: '#00b42a',
|
|
157
|
+
};
|
|
158
|
+
</script>
|
|
159
|
+
<template>
|
|
160
|
+
<Rate v-model="value" :color="scoreColors" />
|
|
161
|
+
<Rate v-model="value" grading />
|
|
162
|
+
</template>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 提示文本
|
|
166
|
+
|
|
167
|
+
```vue
|
|
168
|
+
<script setup lang="ts">
|
|
169
|
+
import 'x-next/style.css';
|
|
170
|
+
import { Rate } from 'x-next';
|
|
171
|
+
import { ref } from 'vue';
|
|
172
|
+
|
|
173
|
+
const value = ref(3);
|
|
174
|
+
const tooltipTexts = ['很差', '一般', '还行', '不错', '很好'];
|
|
175
|
+
</script>
|
|
176
|
+
<template>
|
|
177
|
+
<Rate v-model="value" :tooltips="tooltipTexts" />
|
|
178
|
+
<p>{{ tooltipTexts[value - 1] }}</p>
|
|
179
|
+
</template>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 事件
|
|
183
|
+
|
|
184
|
+
```vue
|
|
185
|
+
<script setup lang="ts">
|
|
186
|
+
import 'x-next/style.css';
|
|
187
|
+
import { Rate } from 'x-next';
|
|
188
|
+
import { ref } from 'vue';
|
|
189
|
+
|
|
190
|
+
const value = ref(2);
|
|
191
|
+
const hoverValue = ref<number | undefined>();
|
|
192
|
+
const log = ref('等待操作');
|
|
193
|
+
</script>
|
|
194
|
+
<template>
|
|
195
|
+
<Rate
|
|
196
|
+
v-model="value"
|
|
197
|
+
allow-half
|
|
198
|
+
allow-clear
|
|
199
|
+
@change="(nextValue) => log = `change: ${nextValue}`"
|
|
200
|
+
@hover-change="(nextValue) => hoverValue = nextValue"
|
|
201
|
+
/>
|
|
202
|
+
<p>{{ log }},hover:{{ hoverValue ?? '-' }}</p>
|
|
203
|
+
</template>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 表单组合
|
|
207
|
+
|
|
208
|
+
```vue
|
|
209
|
+
<script setup lang="ts">
|
|
210
|
+
import 'x-next/style.css';
|
|
211
|
+
import { Form, FormItem, Rate, Space, Button } from 'x-next';
|
|
212
|
+
import { reactive, ref } from 'vue';
|
|
213
|
+
import type { FormInstance, FieldRule } from 'x-next';
|
|
214
|
+
const formRef = ref<FormInstance>();
|
|
215
|
+
const formModel = reactive({ score: 0 });
|
|
216
|
+
const formResult = ref('点击校验查看结果');
|
|
217
|
+
const handleFormValidate = async () => {
|
|
218
|
+
const errors = await formRef.value!.validate();
|
|
219
|
+
formResult.value = errors
|
|
220
|
+
? `校验失败:${Object.values(errors).map((error) => error.message).join(';')}`
|
|
221
|
+
: '校验通过';
|
|
222
|
+
};
|
|
223
|
+
const handleFormReset = () => {
|
|
224
|
+
formRef.value!.resetFields();
|
|
225
|
+
formResult.value = '已重置';
|
|
226
|
+
};
|
|
227
|
+
import type { HTMLAttributes } from 'vue';
|
|
228
|
+
const nativeAttrs1 = { "aria-label": "服务评分" } satisfies HTMLAttributes;
|
|
229
|
+
</script>
|
|
230
|
+
<template>
|
|
231
|
+
<Form ref="formRef" :model="formModel" layout="vertical">
|
|
232
|
+
<FormItem label="服务评分" field="score" :rules="[{ type: 'number', min: 1, message: '请选择至少 1 分' }]">
|
|
233
|
+
<Rate v-bind="nativeAttrs1" v-model="formModel.score" allow-half allow-clear />
|
|
234
|
+
</FormItem>
|
|
235
|
+
<FormItem>
|
|
236
|
+
<Space>
|
|
237
|
+
<Button type="primary" @click="handleFormValidate">校验</Button>
|
|
238
|
+
<Button @click="handleFormReset">重置</Button>
|
|
239
|
+
</Space>
|
|
240
|
+
</FormItem>
|
|
241
|
+
</Form>
|
|
242
|
+
<p role="status">{{ formResult }}</p>
|
|
243
|
+
</template>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 键盘交互
|
|
247
|
+
|
|
248
|
+
`allowClear` 只影响重复点击同一评分;方向键、Home、End 和数字键始终定位到目标分值,在边界重复操作不会切换为 0。
|
|
249
|
+
|
|
250
|
+
| 按键 | 行为 |
|
|
251
|
+
| --- | --- |
|
|
252
|
+
| `ArrowRight` / `ArrowUp` | 增加评分 |
|
|
253
|
+
| `ArrowLeft` / `ArrowDown` | 减少评分 |
|
|
254
|
+
| `Home` | 清零 |
|
|
255
|
+
| `End` | 选择最大评分 |
|
|
256
|
+
| `0-9` | 在评分总数范围内快速设置对应分值 |
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./rate-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# ResizeBox 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## ResizeBox API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/resize-box/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| width | 宽度 | undefined | number | 否 | 未声明 |
|
|
17
|
+
| height | 高度 | undefined | number | 否 | 未声明 |
|
|
18
|
+
| minWidth | 最小宽度 | undefined | number | 否 | 0 |
|
|
19
|
+
| maxWidth | 最大宽度 | undefined | number | 否 | 未声明 |
|
|
20
|
+
| minHeight | 最小高度 | undefined | number | 否 | 0 |
|
|
21
|
+
| maxHeight | 最大高度 | undefined | number | 否 | 未声明 |
|
|
22
|
+
| component | 渲染的 HTML 标签 | undefined | string | 否 | "div" |
|
|
23
|
+
| directions | 可拖拽方向 | undefined | ("top" | "bottom" | "right" | "left")[] | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
|
|
24
|
+
|
|
25
|
+
### Events
|
|
26
|
+
|
|
27
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| update:width | 宽度变化时触发 | undefined | (width: number) => any |
|
|
30
|
+
| update:height | 高度变化时触发 | undefined | (height: number) => any |
|
|
31
|
+
| movingStart | 拖拽开始时触发 | undefined | (ev: MouseEvent) => any |
|
|
32
|
+
| moving | 拖拽或键盘调整中触发 | undefined | (size: { width: number; height: number; }, ev: MouseEvent | KeyboardEvent) => any |
|
|
33
|
+
| movingEnd | 拖拽结束时触发 | undefined | (ev: MouseEvent) => any |
|
|
34
|
+
|
|
35
|
+
### Slots
|
|
36
|
+
|
|
37
|
+
| 名称 | 用途 | 公开类型 |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| default | 内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
40
|
+
| resize-trigger | 自定义拖拽杆内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
41
|
+
| resize-trigger-icon | 自定义拖拽杆图标 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
42
|
+
|
|
43
|
+
### 实例方法
|
|
44
|
+
|
|
45
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
46
|
+
|
|
47
|
+
### 关联类型定义
|
|
48
|
+
|
|
49
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
50
|
+
|
|
51
|
+
```typescript-reference
|
|
52
|
+
type DirectionType = 'left' | 'right' | 'top' | 'bottom';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
返回 [ResizeBox 用法](./resize-box.md)。
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# ResizeBox AI 使用
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`ResizeBox`;主要模型:v-model:width、v-model:height。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./resize-box-api.md),包含本组件族全部子组件和别名。
|
|
7
|
+
|
|
8
|
+
按需样式:`x-next/style/resize-box`(包含 base.css、resize-box.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
|
+
|
|
10
|
+
## 场景用法
|
|
11
|
+
|
|
12
|
+
以下示例从本地 `src/docs/components/resize-box.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./resize-box-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
13
|
+
|
|
14
|
+
### 用途与选型
|
|
15
|
+
|
|
16
|
+
用于需要拖拽改变尺寸的面板、侧栏或编辑器区域。
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 基础用法
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import 'x-next/style.css';
|
|
24
|
+
import { ResizeBox } from 'x-next';
|
|
25
|
+
import { ref } from 'vue';
|
|
26
|
+
|
|
27
|
+
const width = ref(260);
|
|
28
|
+
const height = ref(120);
|
|
29
|
+
</script>
|
|
30
|
+
<template>
|
|
31
|
+
<ResizeBox
|
|
32
|
+
v-model:width="width"
|
|
33
|
+
v-model:height="height"
|
|
34
|
+
:max-width="520"
|
|
35
|
+
:max-height="260"
|
|
36
|
+
:directions="['right', 'bottom']"
|
|
37
|
+
class="demo-resize-box"
|
|
38
|
+
>
|
|
39
|
+
拖动右侧或底部边缘
|
|
40
|
+
</ResizeBox>
|
|
41
|
+
</template>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 受控尺寸
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import 'x-next/style.css';
|
|
49
|
+
import { Space, Button, ResizeBox } from 'x-next';
|
|
50
|
+
import { ref } from 'vue';
|
|
51
|
+
const controlledWidth = ref(280);
|
|
52
|
+
const controlledHeight = ref(140);
|
|
53
|
+
|
|
54
|
+
const width = controlledWidth;
|
|
55
|
+
const height = controlledHeight;
|
|
56
|
+
</script>
|
|
57
|
+
<template>
|
|
58
|
+
<Space>
|
|
59
|
+
<Button @click="width = 240">宽 240</Button>
|
|
60
|
+
<Button @click="width = 320">宽 320</Button>
|
|
61
|
+
<Button @click="height = 120">高 120</Button>
|
|
62
|
+
<Button @click="height = 180">高 180</Button>
|
|
63
|
+
</Space>
|
|
64
|
+
<ResizeBox
|
|
65
|
+
v-model:width="width"
|
|
66
|
+
v-model:height="height"
|
|
67
|
+
:max-width="520"
|
|
68
|
+
:max-height="260"
|
|
69
|
+
:directions="['right', 'bottom']"
|
|
70
|
+
>
|
|
71
|
+
{{ width }} x {{ height }}
|
|
72
|
+
</ResizeBox>
|
|
73
|
+
</template>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 尺寸限制
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<script setup lang="ts">
|
|
80
|
+
import 'x-next/style.css';
|
|
81
|
+
import { ResizeBox } from 'x-next';
|
|
82
|
+
import { ref } from 'vue';
|
|
83
|
+
const limitedWidth = ref(280);
|
|
84
|
+
const limitedHeight = ref(140);
|
|
85
|
+
|
|
86
|
+
const width = limitedWidth;
|
|
87
|
+
const height = limitedHeight;
|
|
88
|
+
</script>
|
|
89
|
+
<template>
|
|
90
|
+
<ResizeBox
|
|
91
|
+
v-model:width="width"
|
|
92
|
+
v-model:height="height"
|
|
93
|
+
:min-width="200"
|
|
94
|
+
:max-width="360"
|
|
95
|
+
:min-height="100"
|
|
96
|
+
:max-height="220"
|
|
97
|
+
:directions="['right', 'bottom']"
|
|
98
|
+
>
|
|
99
|
+
宽度 200-360,高度 100-220
|
|
100
|
+
</ResizeBox>
|
|
101
|
+
</template>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 四方向拖拽
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
import 'x-next/style.css';
|
|
109
|
+
import { ResizeBox } from 'x-next';
|
|
110
|
+
import { ref } from 'vue';
|
|
111
|
+
const directionWidth = ref(300);
|
|
112
|
+
const directionHeight = ref(160);
|
|
113
|
+
|
|
114
|
+
const width = directionWidth;
|
|
115
|
+
const height = directionHeight;
|
|
116
|
+
</script>
|
|
117
|
+
<template>
|
|
118
|
+
<ResizeBox
|
|
119
|
+
v-model:width="width"
|
|
120
|
+
v-model:height="height"
|
|
121
|
+
:max-width="520"
|
|
122
|
+
:max-height="260"
|
|
123
|
+
:directions="['left', 'right', 'top', 'bottom']"
|
|
124
|
+
>
|
|
125
|
+
四个方向均可拖拽
|
|
126
|
+
</ResizeBox>
|
|
127
|
+
</template>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 自定义触发杆
|
|
131
|
+
|
|
132
|
+
```vue
|
|
133
|
+
<script setup lang="ts">
|
|
134
|
+
import 'x-next/style.css';
|
|
135
|
+
import { ResizeBox } from 'x-next';
|
|
136
|
+
import { ref } from 'vue';
|
|
137
|
+
const customWidth = ref(280);
|
|
138
|
+
const customHeight = ref(120);
|
|
139
|
+
|
|
140
|
+
const width = customWidth;
|
|
141
|
+
const height = customHeight;
|
|
142
|
+
</script>
|
|
143
|
+
<template>
|
|
144
|
+
<ResizeBox
|
|
145
|
+
v-model:width="width"
|
|
146
|
+
v-model:height="height"
|
|
147
|
+
:max-width="520"
|
|
148
|
+
:max-height="260"
|
|
149
|
+
:directions="['right', 'bottom']"
|
|
150
|
+
>
|
|
151
|
+
自定义触发内容
|
|
152
|
+
<template #resize-trigger="{ direction }">
|
|
153
|
+
<div class="demo-resize-trigger">
|
|
154
|
+
{{ direction === 'right' ? '拖动' : '调整高度' }}
|
|
155
|
+
</div>
|
|
156
|
+
</template>
|
|
157
|
+
</ResizeBox>
|
|
158
|
+
</template>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 自定义触发图标
|
|
162
|
+
|
|
163
|
+
```vue
|
|
164
|
+
<script setup lang="ts">
|
|
165
|
+
import 'x-next/style.css';
|
|
166
|
+
import { ResizeBox } from 'x-next';
|
|
167
|
+
|
|
168
|
+
</script>
|
|
169
|
+
<template>
|
|
170
|
+
<ResizeBox :width="260" :height="120" :max-width="520" :directions="['right']">
|
|
171
|
+
自定义图标
|
|
172
|
+
<template #resize-trigger-icon="{ direction }">
|
|
173
|
+
<span>{{ direction === 'right' ? '⋮' : '⋯' }}</span>
|
|
174
|
+
</template>
|
|
175
|
+
</ResizeBox>
|
|
176
|
+
</template>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 拖拽事件
|
|
180
|
+
|
|
181
|
+
```vue
|
|
182
|
+
<script setup lang="ts">
|
|
183
|
+
import 'x-next/style.css';
|
|
184
|
+
import { ResizeBox } from 'x-next';
|
|
185
|
+
import { ref } from 'vue';
|
|
186
|
+
const eventWidth = ref(300);
|
|
187
|
+
const eventHeight = ref(140);
|
|
188
|
+
const eventLogs = ref<string[]>([]);
|
|
189
|
+
const pushLog = (message: string) => {
|
|
190
|
+
eventLogs.value = [message, ...eventLogs.value].slice(0, 4);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const width = eventWidth;
|
|
194
|
+
const height = eventHeight;
|
|
195
|
+
</script>
|
|
196
|
+
<template>
|
|
197
|
+
<ResizeBox
|
|
198
|
+
v-model:width="width"
|
|
199
|
+
v-model:height="height"
|
|
200
|
+
:max-width="520"
|
|
201
|
+
:max-height="260"
|
|
202
|
+
:directions="['right', 'bottom']"
|
|
203
|
+
@moving-start="pushLog('开始拖拽')"
|
|
204
|
+
@moving="(size) => pushLog(`拖拽中:${size.width} x ${size.height}`)"
|
|
205
|
+
@moving-end="pushLog('结束拖拽')"
|
|
206
|
+
>
|
|
207
|
+
查看事件日志
|
|
208
|
+
</ResizeBox>
|
|
209
|
+
</template>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 配合 LayoutSidebar
|
|
213
|
+
|
|
214
|
+
```vue
|
|
215
|
+
<script setup lang="ts">
|
|
216
|
+
import 'x-next/style.css';
|
|
217
|
+
import { Layout, LayoutSidebar, LayoutContent } from 'x-next';
|
|
218
|
+
|
|
219
|
+
</script>
|
|
220
|
+
<template>
|
|
221
|
+
<Layout>
|
|
222
|
+
<LayoutSidebar :width="220" :resize-directions="['right']">
|
|
223
|
+
可调整侧栏
|
|
224
|
+
</LayoutSidebar>
|
|
225
|
+
<LayoutContent>内容区域</LayoutContent>
|
|
226
|
+
</Layout>
|
|
227
|
+
</template>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./resize-box-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Scrollbar 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## Scrollbar API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/scrollbar-v2/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| type | 滚动条类型,embed 悬浮在内容上,track 保留轨道空间 | undefined | "embed" | "track" | 否 | "embed" |
|
|
17
|
+
| outerClass | 外层自定义类名 | undefined | string | { [x: string]: any; } | unknown[] | 否 | 未声明 |
|
|
18
|
+
| outerStyle | 外层自定义样式 | undefined | null | string | false | CSSProperties | StyleValue[] | 否 | 未声明 |
|
|
19
|
+
| hide | 隐藏自定义滚动条,内部兼容选项,不建议业务直接使用 | undefined | false | true | 否 | false |
|
|
20
|
+
| disableHorizontal | 禁用横向滚动并隐藏横向自定义滚动条 | undefined | false | true | 否 | false |
|
|
21
|
+
| disableVertical | 禁用纵向滚动并隐藏纵向自定义滚动条 | undefined | false | true | 否 | false |
|
|
22
|
+
| horizontalWheel | 纯横向滚动时将鼠标滚轮转换为横向滚动,滚动到边界后放行页面滚动 | undefined | false | true | 否 | false |
|
|
23
|
+
|
|
24
|
+
### Events
|
|
25
|
+
|
|
26
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| scroll | 内容滚动时触发 | undefined | (ev: Event) => any |
|
|
29
|
+
|
|
30
|
+
### Slots
|
|
31
|
+
|
|
32
|
+
| 名称 | 用途 | 公开类型 |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| default | 滚动内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
35
|
+
|
|
36
|
+
### 实例方法 / 暴露值
|
|
37
|
+
|
|
38
|
+
| 名称 | 公开类型 |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| scrollTo | (options?: number | { left?: number; top?: number; }, y?: number) => void |
|
|
41
|
+
| scrollTop | (top: number) => void |
|
|
42
|
+
| scrollLeft | (left: number) => void |
|
|
43
|
+
|
|
44
|
+
### 关联类型定义
|
|
45
|
+
|
|
46
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
47
|
+
|
|
48
|
+
```typescript-reference
|
|
49
|
+
interface ThumbData {
|
|
50
|
+
ratio: number;
|
|
51
|
+
thumbSize: number;
|
|
52
|
+
max: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface ThumbMap {
|
|
56
|
+
size: 'width' | 'height';
|
|
57
|
+
direction: 'left' | 'top';
|
|
58
|
+
client: 'clientX' | 'clientY';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface ScrollbarProps {
|
|
62
|
+
type?: 'track' | 'embed';
|
|
63
|
+
outerClass?: any;
|
|
64
|
+
outerStyle?: any;
|
|
65
|
+
/**
|
|
66
|
+
* Internal compatibility option for composite components.
|
|
67
|
+
* Hides custom thumbs but keeps native scrolling available.
|
|
68
|
+
*/
|
|
69
|
+
hide?: boolean;
|
|
70
|
+
disableHorizontal?: boolean;
|
|
71
|
+
disableVertical?: boolean;
|
|
72
|
+
horizontalWheel?: boolean;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
返回 [Scrollbar 用法](./scrollbar.md)。
|