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
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# TimeRangeSelector AI 使用
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`TimeRangeSelector`;主要模型:v-model。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./time-range-selector-api.md),包含本组件族全部子组件和别名。
|
|
7
|
+
|
|
8
|
+
按需样式:`x-next/style/time-range-selector`(包含 base.css、time-range-selector.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
|
+
|
|
10
|
+
## 场景用法
|
|
11
|
+
|
|
12
|
+
以下示例从本地 `src/docs/components/time-range-selector.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./time-range-selector-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 { TimeRangeSelector } from 'x-next';
|
|
25
|
+
import { ref } from 'vue';
|
|
26
|
+
|
|
27
|
+
const ranges = ref<[string, string][]>([
|
|
28
|
+
['08:00', '12:00'],
|
|
29
|
+
['14:00', '18:00'],
|
|
30
|
+
]);
|
|
31
|
+
</script>
|
|
32
|
+
<template>
|
|
33
|
+
<TimeRangeSelector v-model="ranges" />
|
|
34
|
+
</template>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 禁用时间段
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import 'x-next/style.css';
|
|
42
|
+
import { TimeRangeSelector } from 'x-next';
|
|
43
|
+
import { ref } from 'vue';
|
|
44
|
+
|
|
45
|
+
const ranges = ref<[string, string][]>([
|
|
46
|
+
['07:00', '11:00'],
|
|
47
|
+
['15:00', '19:00'],
|
|
48
|
+
]);
|
|
49
|
+
</script>
|
|
50
|
+
<template>
|
|
51
|
+
<TimeRangeSelector
|
|
52
|
+
v-model="ranges"
|
|
53
|
+
:disabled-ranges="[['12:00', '13:00']]"
|
|
54
|
+
:step-minutes="30"
|
|
55
|
+
/>
|
|
56
|
+
</template>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 场景风格
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<script setup lang="ts">
|
|
63
|
+
import 'x-next/style.css';
|
|
64
|
+
import { TimeRangeSelector } from 'x-next';
|
|
65
|
+
import { ref } from 'vue';
|
|
66
|
+
|
|
67
|
+
const defaultRanges = ref<[string, string][]>([['07:00', '11:00']]);
|
|
68
|
+
const scheduleRanges = ref<[string, string][]>([
|
|
69
|
+
['08:30', '12:30'],
|
|
70
|
+
['14:00', '18:00'],
|
|
71
|
+
]);
|
|
72
|
+
const monitorRanges = ref<[string, string][]>([
|
|
73
|
+
['00:00', '04:00'],
|
|
74
|
+
['19:00', '23:00'],
|
|
75
|
+
]);
|
|
76
|
+
const compactRanges = ref<[string, string][]>([
|
|
77
|
+
['09:00', '13:00'],
|
|
78
|
+
['15:00', '19:00'],
|
|
79
|
+
]);
|
|
80
|
+
const hiddenCursorRanges = ref<[string, string][]>([
|
|
81
|
+
['08:00', '12:00'],
|
|
82
|
+
['14:00', '18:00'],
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
const defaultDisabled = ref<[string, string][]>([['13:00', '15:00']]);
|
|
86
|
+
const scheduleDisabled = ref<[string, string][]>([['12:30', '14:00']]);
|
|
87
|
+
const monitorDisabled = ref<[string, string][]>([['04:00', '06:00']]);
|
|
88
|
+
const compactDisabled = ref<[string, string][]>([['13:00', '14:30']]);
|
|
89
|
+
const hiddenCursorDisabled = ref<[string, string][]>([['12:00', '13:00']]);
|
|
90
|
+
</script>
|
|
91
|
+
<template>
|
|
92
|
+
<TimeRangeSelector
|
|
93
|
+
v-model="defaultRanges"
|
|
94
|
+
scene="default"
|
|
95
|
+
:disabled-ranges="defaultDisabled"
|
|
96
|
+
/>
|
|
97
|
+
<TimeRangeSelector
|
|
98
|
+
v-model="scheduleRanges"
|
|
99
|
+
scene="schedule"
|
|
100
|
+
:disabled-ranges="scheduleDisabled"
|
|
101
|
+
/>
|
|
102
|
+
<TimeRangeSelector
|
|
103
|
+
v-model="monitorRanges"
|
|
104
|
+
scene="monitor"
|
|
105
|
+
:disabled-ranges="monitorDisabled"
|
|
106
|
+
/>
|
|
107
|
+
<TimeRangeSelector
|
|
108
|
+
v-model="compactRanges"
|
|
109
|
+
scene="compact"
|
|
110
|
+
:disabled-ranges="compactDisabled"
|
|
111
|
+
/>
|
|
112
|
+
<TimeRangeSelector
|
|
113
|
+
v-model="hiddenCursorRanges"
|
|
114
|
+
scene="compact"
|
|
115
|
+
:disabled-ranges="hiddenCursorDisabled"
|
|
116
|
+
:show-cursor="false"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 自定义颜色
|
|
122
|
+
|
|
123
|
+
更细的主题控制可以覆盖组件 CSS 变量。
|
|
124
|
+
|
|
125
|
+
```vue
|
|
126
|
+
<script setup lang="ts">
|
|
127
|
+
import 'x-next/style.css';
|
|
128
|
+
import { TimeRangeSelector } from 'x-next';
|
|
129
|
+
import { ref } from 'vue';
|
|
130
|
+
|
|
131
|
+
const defaultRanges = ref<[string, string][]>([['08:00', '12:00']]);
|
|
132
|
+
const scheduleRanges = ref<[string, string][]>([['09:00', '13:00']]);
|
|
133
|
+
const monitorRanges = ref<[string, string][]>([['00:00', '04:00']]);
|
|
134
|
+
const compactRanges = ref<[string, string][]>([['15:00', '19:00']]);
|
|
135
|
+
|
|
136
|
+
const defaultDisabled = ref<[string, string][]>([['13:00', '15:00']]);
|
|
137
|
+
const scheduleDisabled = ref<[string, string][]>([['13:00', '14:30']]);
|
|
138
|
+
const monitorDisabled = ref<[string, string][]>([['04:00', '06:00']]);
|
|
139
|
+
const compactDisabled = ref<[string, string][]>([['12:00', '13:30']]);
|
|
140
|
+
</script>
|
|
141
|
+
<template>
|
|
142
|
+
<TimeRangeSelector
|
|
143
|
+
v-model="defaultRanges"
|
|
144
|
+
color="#0f766e"
|
|
145
|
+
:disabled-ranges="defaultDisabled"
|
|
146
|
+
/>
|
|
147
|
+
<TimeRangeSelector
|
|
148
|
+
v-model="scheduleRanges"
|
|
149
|
+
scene="schedule"
|
|
150
|
+
color="#2563eb"
|
|
151
|
+
:disabled-ranges="scheduleDisabled"
|
|
152
|
+
/>
|
|
153
|
+
<TimeRangeSelector
|
|
154
|
+
v-model="monitorRanges"
|
|
155
|
+
scene="monitor"
|
|
156
|
+
color="#dc2626"
|
|
157
|
+
:disabled-ranges="monitorDisabled"
|
|
158
|
+
/>
|
|
159
|
+
<TimeRangeSelector
|
|
160
|
+
v-model="compactRanges"
|
|
161
|
+
scene="compact"
|
|
162
|
+
color="#16a34a"
|
|
163
|
+
:disabled-ranges="compactDisabled"
|
|
164
|
+
:show-cursor="false"
|
|
165
|
+
/>
|
|
166
|
+
</template>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```vue
|
|
170
|
+
<script setup lang="ts">
|
|
171
|
+
import 'x-next/style.css';
|
|
172
|
+
import { TimeRangeSelector } from 'x-next';
|
|
173
|
+
import { ref } from 'vue';
|
|
174
|
+
|
|
175
|
+
const ranges = ref<[string, string][]>([
|
|
176
|
+
['08:00', '12:00'],
|
|
177
|
+
['15:00', '19:00'],
|
|
178
|
+
]);
|
|
179
|
+
</script>
|
|
180
|
+
<template>
|
|
181
|
+
<TimeRangeSelector v-model="ranges" class="custom-time-range" />
|
|
182
|
+
</template>
|
|
183
|
+
<style scoped>
|
|
184
|
+
.custom-time-range {
|
|
185
|
+
--x-time-range-selector-color: #0f766e;
|
|
186
|
+
--x-time-range-selector-grid-radius: 8px;
|
|
187
|
+
--x-time-range-selector-range-height: 34px;
|
|
188
|
+
--x-time-range-selector-range-radius: 8px;
|
|
189
|
+
}
|
|
190
|
+
</style>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 限制范围数量
|
|
194
|
+
|
|
195
|
+
```vue
|
|
196
|
+
<script setup lang="ts">
|
|
197
|
+
import 'x-next/style.css';
|
|
198
|
+
import { TimeRangeSelector } from 'x-next';
|
|
199
|
+
import { ref } from 'vue';
|
|
200
|
+
|
|
201
|
+
const ranges = ref<[string, string][]>([
|
|
202
|
+
['08:00', '12:00'],
|
|
203
|
+
['14:00', '18:00'],
|
|
204
|
+
]);
|
|
205
|
+
</script>
|
|
206
|
+
<template>
|
|
207
|
+
<TimeRangeSelector v-model="ranges" :max-ranges="3" />
|
|
208
|
+
</template>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 允许重叠
|
|
212
|
+
|
|
213
|
+
```vue
|
|
214
|
+
<script setup lang="ts">
|
|
215
|
+
import 'x-next/style.css';
|
|
216
|
+
import { TimeRangeSelector } from 'x-next';
|
|
217
|
+
import { ref } from 'vue';
|
|
218
|
+
|
|
219
|
+
const ranges = ref<[string, string][]>([
|
|
220
|
+
['08:00', '12:00'],
|
|
221
|
+
['10:00', '14:00'],
|
|
222
|
+
]);
|
|
223
|
+
</script>
|
|
224
|
+
<template>
|
|
225
|
+
<TimeRangeSelector v-model="ranges" overlap-allowed />
|
|
226
|
+
</template>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 更细步长
|
|
230
|
+
|
|
231
|
+
```vue
|
|
232
|
+
<script setup lang="ts">
|
|
233
|
+
import 'x-next/style.css';
|
|
234
|
+
import { TimeRangeSelector } from 'x-next';
|
|
235
|
+
import { ref } from 'vue';
|
|
236
|
+
|
|
237
|
+
const ranges = ref<[string, string][]>([
|
|
238
|
+
['08:15', '12:15'],
|
|
239
|
+
]);
|
|
240
|
+
</script>
|
|
241
|
+
<template>
|
|
242
|
+
<TimeRangeSelector v-model="ranges" :step-minutes="15" />
|
|
243
|
+
</template>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 整体禁用与只读
|
|
247
|
+
|
|
248
|
+
禁用时退出 Tab 序列,只读时仍可聚焦查看。两种状态都阻止创建、移动、缩放与删除;拖拽过程中切换状态会取消预览并恢复外部值。
|
|
249
|
+
|
|
250
|
+
```vue
|
|
251
|
+
<script setup lang="ts">
|
|
252
|
+
import 'x-next/style.css';
|
|
253
|
+
import { Space, Checkbox, TimeRangeSelector } from 'x-next';
|
|
254
|
+
import { ref } from 'vue';
|
|
255
|
+
const ranges = ref<[string, string][]>([['08:00', '12:00']]);
|
|
256
|
+
const disabled = ref(false);
|
|
257
|
+
const readonly = ref(false);
|
|
258
|
+
</script>
|
|
259
|
+
<template>
|
|
260
|
+
<Space><Checkbox v-model="disabled">禁用</Checkbox><Checkbox v-model="readonly">只读</Checkbox></Space>
|
|
261
|
+
<TimeRangeSelector v-model="ranges" :disabled="disabled" :readonly="readonly" />
|
|
262
|
+
</template>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 键盘与删除事件
|
|
266
|
+
|
|
267
|
+
Home / End 定位到一天的首尾时间块。键盘每次移动一个 `stepMinutes`,遵守禁区、重叠、最大数量和 24:00 边界。双击区间或在区间聚焦后按 Delete / Backspace 删除。删除先触发 `remove`,再触发 `update:modelValue` 和 `change`。
|
|
268
|
+
|
|
269
|
+
```vue
|
|
270
|
+
<script setup lang="ts">
|
|
271
|
+
import 'x-next/style.css';
|
|
272
|
+
import { TimeRangeSelector } from 'x-next';
|
|
273
|
+
import { ref } from 'vue';
|
|
274
|
+
const ranges = ref<[string, string][]>([]);
|
|
275
|
+
const log = ref('等待操作');
|
|
276
|
+
const removed = ref('等待删除');
|
|
277
|
+
const onChange = (value: [string, string][]) => { log.value = `change: ${JSON.stringify(value)}`; };
|
|
278
|
+
const onRemove = (value: [string, string]) => { removed.value = `remove: ${value.join(' - ')}`; };
|
|
279
|
+
import type { HTMLAttributes } from 'vue';
|
|
280
|
+
const nativeAttrs1 = { "aria-label": "排班时间段" } satisfies HTMLAttributes;
|
|
281
|
+
</script>
|
|
282
|
+
<template>
|
|
283
|
+
<TimeRangeSelector v-bind="nativeAttrs1" v-model="ranges" :disabled-ranges="[['12:00', '13:00']]" :max-ranges="3"
|
|
284
|
+
@change="onChange" @remove="onRemove" />
|
|
285
|
+
<p>{{ log }};{{ removed }}</p>
|
|
286
|
+
</template>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Form 禁用、校验与重置
|
|
290
|
+
|
|
291
|
+
用户完成拖拽或键盘修改时触发 Form 的 change 校验;外部模型同步不会重复触发 change。
|
|
292
|
+
|
|
293
|
+
```vue
|
|
294
|
+
<script setup lang="ts">
|
|
295
|
+
import 'x-next/style.css';
|
|
296
|
+
import { Checkbox, Form, FormItem, TimeRangeSelector, Space, Button } from 'x-next';
|
|
297
|
+
import { reactive, ref } from 'vue';
|
|
298
|
+
import type { FormInstance } from 'x-next';
|
|
299
|
+
const form = reactive({ ranges: [] as [string, string][] });
|
|
300
|
+
const formRef = ref<FormInstance>();
|
|
301
|
+
const disabled = ref(false);
|
|
302
|
+
const result = ref('至少选择一个时间段');
|
|
303
|
+
const validate = async () => { result.value = (await formRef.value!.validate()) ? '请添加时间段' : '校验通过'; };
|
|
304
|
+
const reset = () => { formRef.value!.resetFields(); result.value = '已重置'; };
|
|
305
|
+
</script>
|
|
306
|
+
<template>
|
|
307
|
+
<Checkbox v-model="disabled">禁用整个表单</Checkbox>
|
|
308
|
+
<Form ref="formRef" :model="form" :disabled="disabled" layout="vertical">
|
|
309
|
+
<FormItem field="ranges" label="工作时段" :rules="{ type: 'array', minLength: 1, message: '至少选择一个时间段' }">
|
|
310
|
+
<TimeRangeSelector v-model="form.ranges" />
|
|
311
|
+
</FormItem>
|
|
312
|
+
</Form>
|
|
313
|
+
<Space><Button @click="validate">校验</Button><Button @click="reset">重置</Button></Space>
|
|
314
|
+
<p>{{ result }}</p>
|
|
315
|
+
</template>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 受控接收与拒绝更新
|
|
319
|
+
|
|
320
|
+
拖拽中显示预览,结束后提交更新请求。父级未同步接收时,下一个渲染周期恢复 `modelValue`;键盘操作也遵循此规则。外部模型更新会终止正在进行的拖拽。
|
|
321
|
+
|
|
322
|
+
```vue
|
|
323
|
+
<script setup lang="ts">
|
|
324
|
+
import 'x-next/style.css';
|
|
325
|
+
import { Checkbox, TimeRangeSelector } from 'x-next';
|
|
326
|
+
import { ref } from 'vue';
|
|
327
|
+
const ranges = ref<[string, string][]>([['08:00', '12:00']]);
|
|
328
|
+
const accept = ref(false);
|
|
329
|
+
const log = ref('当前拒绝修改,操作后会恢复');
|
|
330
|
+
const handleUpdate = (value: [string, string][]) => {
|
|
331
|
+
log.value = `请求:${JSON.stringify(value)},${accept.value ? '已接收' : '已拒绝'}`;
|
|
332
|
+
if (accept.value) ranges.value = value;
|
|
333
|
+
};
|
|
334
|
+
</script>
|
|
335
|
+
<template>
|
|
336
|
+
<Checkbox v-model="accept">接收修改</Checkbox>
|
|
337
|
+
<TimeRangeSelector :model-value="ranges" @update:model-value="handleUpdate" />
|
|
338
|
+
<p>{{ log }}</p>
|
|
339
|
+
</template>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### 交互说明
|
|
343
|
+
|
|
344
|
+
- 在时间轴空白区域按下并拖动可创建范围。
|
|
345
|
+
- 拖动范围主体可移动时间段,拖动过程中会保持原区间宽度。
|
|
346
|
+
- 拖动左右边缘可调整开始和结束时间。
|
|
347
|
+
- 双击已选范围可删除。
|
|
348
|
+
- 当 `overlapAllowed` 为 `false` 时,组件会阻止创建或拖入重叠区间。
|
|
349
|
+
- 禁用时间段不会被纳入最终值,拖拽靠近禁用时间段时会停在边界。
|
|
350
|
+
|
|
351
|
+
`disabledRanges` 只限制指定时间段;整体禁用请使用 `disabled`。拖拽时显示内部预览,外部模型更新会终止当前拖拽并同步值。请使用 `v-model` 接收最终结果;父级拒绝更新时会在下一渲染周期恢复 `modelValue`。
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./time-range-selector-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Timeline 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## Timeline API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/timeline/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| reverse | 是否倒序展示 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
17
|
+
| lineType | 轴线样式 | undefined | "dashed" | "dotted" | "solid" | 否 | "solid" |
|
|
18
|
+
| direction | 时间线方向 | undefined | "horizontal" | "vertical" | 否 | "vertical" |
|
|
19
|
+
| mode | 展示模式 | undefined | "top" | "bottom" | "right" | "left" | "alternate" | 否 | "left" |
|
|
20
|
+
| pending | 是否展示幽灵节点,传入字符串时作为节点内容展示 | undefined | string | false | true | 否 | false(Vue Boolean 转换) |
|
|
21
|
+
| labelPosition | 标签文本位置 | undefined | "same" | "relative" | 否 | "same" |
|
|
22
|
+
|
|
23
|
+
### Events
|
|
24
|
+
|
|
25
|
+
未声明组件 emits;原生事件与包装透传按本页用法核实。
|
|
26
|
+
|
|
27
|
+
### Slots
|
|
28
|
+
|
|
29
|
+
| 名称 | 用途 | 公开类型 |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| default | 时间线节点列表 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
32
|
+
| dot | 自定义幽灵节点 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
33
|
+
|
|
34
|
+
### 实例方法
|
|
35
|
+
|
|
36
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
37
|
+
|
|
38
|
+
### 关联类型定义
|
|
39
|
+
|
|
40
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
41
|
+
|
|
42
|
+
```typescript-reference
|
|
43
|
+
type CSSColor = CSSProperties['color'];
|
|
44
|
+
|
|
45
|
+
type LineType = 'dotted' | 'dashed' | 'solid';
|
|
46
|
+
|
|
47
|
+
type TimelineDirection = 'vertical' | 'horizontal';
|
|
48
|
+
|
|
49
|
+
type TimelineMode = 'left' | 'right' | 'top' | 'bottom' | 'alternate';
|
|
50
|
+
|
|
51
|
+
type TimelineLabelPosition = 'same' | 'relative';
|
|
52
|
+
|
|
53
|
+
type TimelineDotType = 'solid' | 'hollow';
|
|
54
|
+
|
|
55
|
+
type TimelineItemPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## TimelineItem API
|
|
60
|
+
|
|
61
|
+
公开声明:`dist/components/timeline-item/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
62
|
+
|
|
63
|
+
### Props
|
|
64
|
+
|
|
65
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
66
|
+
| --- | --- | --- | --- | --- |
|
|
67
|
+
| label | 标签文本 | undefined | string | 否 | 未声明 |
|
|
68
|
+
| dotColor | 时间点颜色 | undefined | string & {} | "initial" | "red" | "orangered" | "orange" | "gold" | "lime" | "green" | "cyan" | "blue" | "purple" | "magenta" | "gray" | "-moz-initial" | "inherit" | "revert" | "revert-layer" | "unset" | "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "goldenrod" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "limegreen" | "linen" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "rebeccapurple" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen" | "transparent" | "AccentColor" | "AccentColorText" | "ActiveText" | "ButtonBorder" | "ButtonFace" | "ButtonText" | "Canvas" | "CanvasText" | "Field" | "FieldText" | "GrayText" | "Highlight" | "HighlightText" | "LinkText" | "Mark" | "MarkText" | "SelectedItem" | "SelectedItemText" | "VisitedText" | "ActiveBorder" | "ActiveCaption" | "AppWorkspace" | "Background" | "ButtonHighlight" | "ButtonShadow" | "CaptionText" | "InactiveBorder" | "InactiveCaption" | "InactiveCaptionText" | "InfoBackground" | "InfoText" | "Menu" | "MenuText" | "Scrollbar" | "ThreeDDarkShadow" | "ThreeDFace" | "ThreeDHighlight" | "ThreeDLightShadow" | "ThreeDShadow" | "Window" | "WindowFrame" | "WindowText" | "currentColor" | 否 | 未声明 |
|
|
69
|
+
| dotType | 时间点类型 | undefined | "solid" | "hollow" | 否 | "solid" |
|
|
70
|
+
| lineType | 当前节点后的轴线样式 | undefined | "dashed" | "dotted" | "solid" | 否 | 未声明 |
|
|
71
|
+
| lineColor | 当前节点后的轴线颜色 | undefined | string & {} | "initial" | "red" | "orangered" | "orange" | "gold" | "lime" | "green" | "cyan" | "blue" | "purple" | "magenta" | "gray" | "-moz-initial" | "inherit" | "revert" | "revert-layer" | "unset" | "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "goldenrod" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "limegreen" | "linen" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "rebeccapurple" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen" | "transparent" | "AccentColor" | "AccentColorText" | "ActiveText" | "ButtonBorder" | "ButtonFace" | "ButtonText" | "Canvas" | "CanvasText" | "Field" | "FieldText" | "GrayText" | "Highlight" | "HighlightText" | "LinkText" | "Mark" | "MarkText" | "SelectedItem" | "SelectedItemText" | "VisitedText" | "ActiveBorder" | "ActiveCaption" | "AppWorkspace" | "Background" | "ButtonHighlight" | "ButtonShadow" | "CaptionText" | "InactiveBorder" | "InactiveCaption" | "InactiveCaptionText" | "InfoBackground" | "InfoText" | "Menu" | "MenuText" | "Scrollbar" | "ThreeDDarkShadow" | "ThreeDFace" | "ThreeDHighlight" | "ThreeDLightShadow" | "ThreeDShadow" | "Window" | "WindowFrame" | "WindowText" | "currentColor" | 否 | 未声明 |
|
|
72
|
+
| position | 交替模式下的单项位置 | undefined | "top" | "bottom" | "right" | "left" | 否 | 未声明 |
|
|
73
|
+
|
|
74
|
+
### Events
|
|
75
|
+
|
|
76
|
+
未声明组件 emits;原生事件与包装透传按本页用法核实。
|
|
77
|
+
|
|
78
|
+
### Slots
|
|
79
|
+
|
|
80
|
+
| 名称 | 用途 | 公开类型 |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| default | 时间线内容 | any |
|
|
83
|
+
| dot | 自定义时间点节点,优先级高于 icon | any |
|
|
84
|
+
| icon | 自定义时间点图标,兼容旧用法 | any |
|
|
85
|
+
| label | 自定义标签 | any |
|
|
86
|
+
| description | 自定义描述,未传入默认插槽时展示 | any |
|
|
87
|
+
|
|
88
|
+
### 实例方法
|
|
89
|
+
|
|
90
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
返回 [Timeline 用法](./timeline.md)。
|