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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# InputNumber 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## InputNumber API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/form-input-number/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| modelValue | 绑定值 | undefined | number | 否 | 未声明 |
|
|
17
|
+
| defaultValue | 默认值,非受控模式 | undefined | number | 否 | 未声明 |
|
|
18
|
+
| mode | 按钮模式 | undefined | "button" | "embed" | 否 | "embed" |
|
|
19
|
+
| precision | 数字精度 | undefined | number | 否 | 未声明 |
|
|
20
|
+
| step | 数字变化步长 | undefined | number | 否 | 1 |
|
|
21
|
+
| disabled | 是否禁用 | undefined | false | true | 否 | false |
|
|
22
|
+
| error | 是否错误状态 | undefined | false | true | 否 | false |
|
|
23
|
+
| max | 最大值 | undefined | number | 否 | Infinity |
|
|
24
|
+
| min | 最小值 | undefined | number | 否 | -Infinity |
|
|
25
|
+
| formatter | 展示值格式化 | undefined | Function | 否 | 未声明 |
|
|
26
|
+
| parser | 将展示值解析为数字字符串 | undefined | Function | 否 | 未声明 |
|
|
27
|
+
| placeholder | 占位提示 | undefined | string | 否 | 未声明 |
|
|
28
|
+
| hideButton | 是否隐藏步进按钮;mode="button" 时同时用于让出 prepend / append 插槽 | undefined | false | true | 否 | false |
|
|
29
|
+
| size | 输入框尺寸 | undefined | "mini" | "small" | "medium" | "large" | 否 | 未声明 |
|
|
30
|
+
| allowClear | 是否允许清空 | undefined | false | true | 否 | false |
|
|
31
|
+
| modelEvent | 触发 v-model 更新的事件 | undefined | "input" | "change" | 否 | "change" |
|
|
32
|
+
| readOnly | 是否只读 | undefined | false | true | 否 | false |
|
|
33
|
+
| inputAttrs | 内部 input 元素属性 | undefined | { [x: string]: any; } | 否 | 未声明 |
|
|
34
|
+
|
|
35
|
+
### Events
|
|
36
|
+
|
|
37
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| update:modelValue | 值更新时触发 | undefined | (value: number | undefined) => any |
|
|
40
|
+
| change | 值变化时触发 | undefined | (value: number | undefined, ev: Event) => any |
|
|
41
|
+
| focus | 获取焦点时触发 | undefined | (ev: FocusEvent) => any |
|
|
42
|
+
| blur | 失去焦点时触发 | undefined | (ev: FocusEvent) => any |
|
|
43
|
+
| clear | 点击清除按钮时触发 | undefined | (ev: Event) => any |
|
|
44
|
+
| input | 输入时触发 | undefined | (value: number | undefined, inputValue: string, ev: Event) => any |
|
|
45
|
+
| keydown | 按下键盘时触发 | undefined | (ev: KeyboardEvent) => any |
|
|
46
|
+
|
|
47
|
+
### Slots
|
|
48
|
+
|
|
49
|
+
| 名称 | 用途 | 公开类型 |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| prefix | 前缀内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
52
|
+
| suffix | 后缀内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
53
|
+
| prepend | 前置标签 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
54
|
+
| append | 后置标签 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
55
|
+
| plus | 自定义增加按钮图标 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
56
|
+
| minus | 自定义减少按钮图标 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
57
|
+
|
|
58
|
+
### 实例方法 / 暴露值
|
|
59
|
+
|
|
60
|
+
| 名称 | 公开类型 |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| focus | () => void |
|
|
63
|
+
| blur | () => void |
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
返回 [InputNumber 用法](./input-number.md)。
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# InputNumber AI 使用
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`InputNumber`;主要模型:v-model。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./input-number-api.md),包含本组件族全部子组件和别名。
|
|
7
|
+
|
|
8
|
+
按需样式:`x-next/style/form-input-number`(包含 base.css、button.css、form-input.css、form-input-number.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
|
+
|
|
10
|
+
## 场景用法
|
|
11
|
+
|
|
12
|
+
以下示例从本地 `src/docs/components/input-number.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./input-number-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 { InputNumber } from 'x-next';
|
|
25
|
+
import { ref } from 'vue';
|
|
26
|
+
|
|
27
|
+
const value = ref(12);
|
|
28
|
+
</script>
|
|
29
|
+
<template>
|
|
30
|
+
<InputNumber v-model="value" :min="0" :max="100" />
|
|
31
|
+
<InputNumber :default-value="32" :min="0" :max="100" />
|
|
32
|
+
<InputNumber :default-value="500" disabled />
|
|
33
|
+
</template>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 按钮模式
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import 'x-next/style.css';
|
|
41
|
+
import { InputNumber } from 'x-next';
|
|
42
|
+
import { ref } from 'vue';
|
|
43
|
+
const value = ref(12);
|
|
44
|
+
</script>
|
|
45
|
+
<template>
|
|
46
|
+
<InputNumber v-model="value" :min="0" :max="100" />
|
|
47
|
+
<InputNumber v-model="value" mode="button" :min="0" :max="100" />
|
|
48
|
+
</template>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 尺寸
|
|
52
|
+
|
|
53
|
+
四种尺寸的高度分别为 `24px`、`28px`、`32px`、`36px`;`mode="button"` 时两侧按钮与输入框等高。
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import 'x-next/style.css';
|
|
58
|
+
import { InputNumber } from 'x-next';
|
|
59
|
+
import { ref } from 'vue';
|
|
60
|
+
const value = ref(12);
|
|
61
|
+
</script>
|
|
62
|
+
<template>
|
|
63
|
+
<InputNumber v-model="value" size="mini" />
|
|
64
|
+
<InputNumber v-model="value" size="small" />
|
|
65
|
+
<InputNumber v-model="value" size="medium" />
|
|
66
|
+
<InputNumber v-model="value" size="large" />
|
|
67
|
+
|
|
68
|
+
<InputNumber v-model="value" mode="button" size="mini" />
|
|
69
|
+
<InputNumber v-model="value" mode="button" size="small" />
|
|
70
|
+
<InputNumber v-model="value" mode="button" size="medium" />
|
|
71
|
+
<InputNumber v-model="value" mode="button" size="large" />
|
|
72
|
+
</template>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 精度和步长
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<script setup lang="ts">
|
|
79
|
+
import 'x-next/style.css';
|
|
80
|
+
import { InputNumber } from 'x-next';
|
|
81
|
+
import { ref } from 'vue';
|
|
82
|
+
const value = ref(12);
|
|
83
|
+
</script>
|
|
84
|
+
<template>
|
|
85
|
+
<InputNumber v-model="value" :step="1.2" :precision="2" />
|
|
86
|
+
</template>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 格式化展示
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import 'x-next/style.css';
|
|
94
|
+
import { InputNumber } from 'x-next';
|
|
95
|
+
import { ref } from 'vue';
|
|
96
|
+
|
|
97
|
+
const value = ref(12000);
|
|
98
|
+
const formatter = (value: string) => {
|
|
99
|
+
const values = value.split('.');
|
|
100
|
+
values[0] = values[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
101
|
+
return values.join('.');
|
|
102
|
+
};
|
|
103
|
+
const parser = (value: string) => value.replace(/,/g, '');
|
|
104
|
+
</script>
|
|
105
|
+
<template>
|
|
106
|
+
<InputNumber
|
|
107
|
+
v-model="value"
|
|
108
|
+
:min="0"
|
|
109
|
+
:formatter="formatter"
|
|
110
|
+
:parser="parser"
|
|
111
|
+
/>
|
|
112
|
+
</template>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 前缀和后缀
|
|
116
|
+
|
|
117
|
+
`mode="button"` 时左右两端是加减按钮,`prepend` / `append` 插槽会被按钮占用。
|
|
118
|
+
需要自定义前后置内容时,请同时指定 `hide-button`(如上例第四项)。
|
|
119
|
+
|
|
120
|
+
```vue
|
|
121
|
+
<script setup lang="ts">
|
|
122
|
+
import 'x-next/style.css';
|
|
123
|
+
import { InputNumber } from 'x-next';
|
|
124
|
+
import { ref } from 'vue';
|
|
125
|
+
const value = ref(12);
|
|
126
|
+
</script>
|
|
127
|
+
<template>
|
|
128
|
+
<InputNumber v-model="value" allow-clear>
|
|
129
|
+
<template #prefix>¥</template>
|
|
130
|
+
</InputNumber>
|
|
131
|
+
<InputNumber v-model="value" allow-clear hide-button>
|
|
132
|
+
<template #suffix>%</template>
|
|
133
|
+
</InputNumber>
|
|
134
|
+
<InputNumber v-model="value">
|
|
135
|
+
<template #prepend>数量</template>
|
|
136
|
+
<template #append>件</template>
|
|
137
|
+
</InputNumber>
|
|
138
|
+
<InputNumber v-model="value" mode="button" hide-button>
|
|
139
|
+
<template #prepend>数量</template>
|
|
140
|
+
<template #append>件</template>
|
|
141
|
+
</InputNumber>
|
|
142
|
+
</template>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 自定义图标
|
|
146
|
+
|
|
147
|
+
```vue
|
|
148
|
+
<script setup lang="ts">
|
|
149
|
+
import 'x-next/style.css';
|
|
150
|
+
import { InputNumber } from 'x-next';
|
|
151
|
+
import { ref } from 'vue';
|
|
152
|
+
const value = ref(12);
|
|
153
|
+
</script>
|
|
154
|
+
<template>
|
|
155
|
+
<InputNumber v-model="value" :min="0" :max="100">
|
|
156
|
+
<template #plus>+</template>
|
|
157
|
+
<template #minus>-</template>
|
|
158
|
+
</InputNumber>
|
|
159
|
+
</template>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 触发时机
|
|
163
|
+
|
|
164
|
+
```vue
|
|
165
|
+
<script setup lang="ts">
|
|
166
|
+
import 'x-next/style.css';
|
|
167
|
+
import { InputNumber } from 'x-next';
|
|
168
|
+
import { ref } from 'vue';
|
|
169
|
+
const value = ref(12);
|
|
170
|
+
</script>
|
|
171
|
+
<template>
|
|
172
|
+
<InputNumber
|
|
173
|
+
v-model="value"
|
|
174
|
+
:min="10"
|
|
175
|
+
:max="100"
|
|
176
|
+
model-event="input"
|
|
177
|
+
/>
|
|
178
|
+
</template>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 状态
|
|
182
|
+
|
|
183
|
+
```vue
|
|
184
|
+
<script setup lang="ts">
|
|
185
|
+
import 'x-next/style.css';
|
|
186
|
+
import { InputNumber } from 'x-next';
|
|
187
|
+
|
|
188
|
+
</script>
|
|
189
|
+
<template>
|
|
190
|
+
<InputNumber :default-value="12" read-only />
|
|
191
|
+
<InputNumber :default-value="12" error />
|
|
192
|
+
<InputNumber :default-value="12" disabled />
|
|
193
|
+
|
|
194
|
+
<InputNumber :default-value="12" mode="button" read-only />
|
|
195
|
+
<InputNumber :default-value="12" mode="button" error />
|
|
196
|
+
<InputNumber :default-value="12" mode="button" disabled />
|
|
197
|
+
</template>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 事件回调
|
|
201
|
+
|
|
202
|
+
```vue
|
|
203
|
+
<script setup lang="ts">
|
|
204
|
+
import 'x-next/style.css';
|
|
205
|
+
import { InputNumber } from 'x-next';
|
|
206
|
+
import { ref } from 'vue';
|
|
207
|
+
const value = ref(12);
|
|
208
|
+
const eventLog = ref('等待操作');
|
|
209
|
+
const handleInput = (value: number | undefined, inputValue: string) => {
|
|
210
|
+
eventLog.value = `input: ${inputValue || '空'} / ${value ?? '空'}`;
|
|
211
|
+
};
|
|
212
|
+
const handleChange = (value: number | undefined) => {
|
|
213
|
+
eventLog.value = `change: ${value ?? '空'}`;
|
|
214
|
+
};
|
|
215
|
+
const handleClear = () => {
|
|
216
|
+
eventLog.value = 'clear';
|
|
217
|
+
};
|
|
218
|
+
</script>
|
|
219
|
+
<template>
|
|
220
|
+
<InputNumber
|
|
221
|
+
v-model="value"
|
|
222
|
+
allow-clear
|
|
223
|
+
@input="handleInput"
|
|
224
|
+
@change="handleChange"
|
|
225
|
+
@clear="handleClear"
|
|
226
|
+
/>
|
|
227
|
+
<p role="status">{{ eventLog }}</p>
|
|
228
|
+
</template>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 方法
|
|
232
|
+
|
|
233
|
+
```vue
|
|
234
|
+
<script setup lang="ts">
|
|
235
|
+
import 'x-next/style.css';
|
|
236
|
+
import { InputNumber, Button } from 'x-next';
|
|
237
|
+
import { ref } from 'vue';
|
|
238
|
+
const value = ref(12);
|
|
239
|
+
const inputNumberRef = ref();
|
|
240
|
+
</script>
|
|
241
|
+
<template>
|
|
242
|
+
<InputNumber ref="inputNumberRef" v-model="value" />
|
|
243
|
+
<Button @click="inputNumberRef?.focus()">聚焦</Button>
|
|
244
|
+
<Button @click="inputNumberRef?.blur()">失焦</Button>
|
|
245
|
+
</template>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 在 Form 中校验
|
|
249
|
+
|
|
250
|
+
组件放进 `x-form-item` 后会自动继承 Form 的尺寸与禁用状态,并按 FormItem 的校验规则展示错误。默认 `validateTrigger` 为 `change`,即值变化时触发校验。
|
|
251
|
+
|
|
252
|
+
```vue
|
|
253
|
+
<script setup lang="ts">
|
|
254
|
+
import 'x-next/style.css';
|
|
255
|
+
import { Form, FormItem, InputNumber, Space, Button } from 'x-next';
|
|
256
|
+
import { reactive, ref } from 'vue';
|
|
257
|
+
import type { FormInstance, FieldRule } from 'x-next';
|
|
258
|
+
|
|
259
|
+
const formState = reactive({ quantity: undefined as number | undefined });
|
|
260
|
+
const formRules: Record<string, FieldRule[]> = {
|
|
261
|
+
quantity: [{ required: true, type: 'number', min: 1, message: '数量至少为 1' }],
|
|
262
|
+
};
|
|
263
|
+
const formRef = ref<FormInstance>();
|
|
264
|
+
const validateResult = ref('');
|
|
265
|
+
|
|
266
|
+
const handleValidate = async () => {
|
|
267
|
+
const errors = await formRef.value!.validate();
|
|
268
|
+
validateResult.value = errors
|
|
269
|
+
? `校验失败:${Object.values(errors).map((error) => error.message).join(';')}`
|
|
270
|
+
: '校验通过';
|
|
271
|
+
};
|
|
272
|
+
const handleReset = () => {
|
|
273
|
+
formRef.value!.resetFields();
|
|
274
|
+
validateResult.value = '已重置';
|
|
275
|
+
};
|
|
276
|
+
</script>
|
|
277
|
+
<template>
|
|
278
|
+
<Form ref="formRef" :model="formState" :rules="formRules">
|
|
279
|
+
<FormItem field="quantity" label="数量">
|
|
280
|
+
<InputNumber v-model="formState.quantity" :min="1" placeholder="请输入数量" />
|
|
281
|
+
</FormItem>
|
|
282
|
+
<FormItem>
|
|
283
|
+
<Space>
|
|
284
|
+
<Button type="primary" @click="handleValidate">校验</Button>
|
|
285
|
+
<Button @click="handleReset">重置</Button>
|
|
286
|
+
</Space>
|
|
287
|
+
</FormItem>
|
|
288
|
+
</Form>
|
|
289
|
+
<p role="status">{{ validateResult }}</p>
|
|
290
|
+
</template>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./input-number-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# InputTag 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## InputTag API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/form-input-tag/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| modelValue | 绑定值 | undefined | (string | number | TagData)[] | 否 | 未声明 |
|
|
17
|
+
| defaultValue | 默认值,非受控模式 | undefined | (string | number | TagData)[] | 否 | [] |
|
|
18
|
+
| inputValue | 输入框绑定值 | undefined | string | 否 | 未声明 |
|
|
19
|
+
| defaultInputValue | 输入框默认值 | undefined | string | 否 | "" |
|
|
20
|
+
| placeholder | 占位提示 | undefined | string | 否 | 未声明 |
|
|
21
|
+
| disabled | 是否禁用 | undefined | false | true | 否 | false |
|
|
22
|
+
| error | 是否错误状态 | undefined | false | true | 否 | false |
|
|
23
|
+
| readonly | 是否只读 | undefined | false | true | 否 | false |
|
|
24
|
+
| allowClear | 是否允许清空 | undefined | false | true | 否 | false |
|
|
25
|
+
| size | 输入框尺寸 | undefined | "mini" | "small" | "medium" | "large" | 否 | 未声明 |
|
|
26
|
+
| maxTagCount | 最多展示标签个数,0 不限制 | undefined | number | 否 | 0 |
|
|
27
|
+
| retainInputValue | 创建或失焦后是否保留输入内容 | undefined | false | true | { create?: boolean; blur?: boolean; } | 否 | false |
|
|
28
|
+
| formatTag | 格式化标签内容 | undefined | (data: TagData) => string | 否 | 未声明 |
|
|
29
|
+
| uniqueValue | 是否仅创建唯一值 | undefined | false | true | 否 | false |
|
|
30
|
+
| fieldNames | 自定义 TagData 字段名 | undefined | { [x: string]: string | undefined; value?: string | undefined; label?: string | undefined; closable?: string | undefined; tagProps?: string | undefined; } | 否 | 未声明 |
|
|
31
|
+
| tagNowrap | 标签内容是否不换行 | undefined | false | true | 否 | false |
|
|
32
|
+
| baseCls | 见场景用法与类型 | undefined | string | 否 | 未声明 |
|
|
33
|
+
| focused | 见场景用法与类型 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
34
|
+
| disabledInput | 见场景用法与类型 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
35
|
+
| uninjectFormItemContext | 见场景用法与类型 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
36
|
+
| inputAttrs | 见场景用法与类型 | undefined | { [x: string]: unknown; } | 否 | 未声明 |
|
|
37
|
+
|
|
38
|
+
### Events
|
|
39
|
+
|
|
40
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| update:modelValue | 值更新时触发 | undefined | (value: (string | number | TagData)[]) => any |
|
|
43
|
+
| update:inputValue | 输入值更新时触发 | undefined | (inputValue: string) => any |
|
|
44
|
+
| change | 标签值变化时触发 | undefined | (value: (string | number | TagData)[], ev: Event) => any |
|
|
45
|
+
| inputValueChange | 输入值变化时触发 | undefined | (inputValue: string, ev: Event) => any |
|
|
46
|
+
| pressEnter | 按下回车且输入内容非空时触发 | undefined | (inputValue: string, ev: KeyboardEvent) => any |
|
|
47
|
+
| remove | 删除标签时触发 | undefined | (removed: string | number, ev: Event) => any |
|
|
48
|
+
| clear | 点击清除按钮时触发 | undefined | (ev: MouseEvent) => any |
|
|
49
|
+
| focus | 获取焦点时触发 | undefined | (ev: FocusEvent) => any |
|
|
50
|
+
| blur | 失去焦点时触发 | undefined | (ev: FocusEvent) => any |
|
|
51
|
+
| keydown | 按下键盘时触发 | undefined | (ev: KeyboardEvent) => any |
|
|
52
|
+
|
|
53
|
+
### Slots
|
|
54
|
+
|
|
55
|
+
| 名称 | 用途 | 公开类型 |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| prefix | 前缀内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
58
|
+
| suffix | 后缀内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
59
|
+
| tag | 自定义标签内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
60
|
+
|
|
61
|
+
### 实例方法 / 暴露值
|
|
62
|
+
|
|
63
|
+
| 名称 | 公开类型 |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| focus | () => void |
|
|
66
|
+
| blur | () => void |
|
|
67
|
+
|
|
68
|
+
### 关联类型定义
|
|
69
|
+
|
|
70
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
71
|
+
|
|
72
|
+
```typescript-reference
|
|
73
|
+
interface TagData {
|
|
74
|
+
/**
|
|
75
|
+
* @zh 标签值
|
|
76
|
+
* @en Tag value
|
|
77
|
+
*/
|
|
78
|
+
value?: string | number;
|
|
79
|
+
/**
|
|
80
|
+
* @zh 标签内容
|
|
81
|
+
* @en Tag content
|
|
82
|
+
*/
|
|
83
|
+
label?: string;
|
|
84
|
+
/**
|
|
85
|
+
* @zh 是否可关闭
|
|
86
|
+
* @en Whether to close
|
|
87
|
+
*/
|
|
88
|
+
closable?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @zh 标签属性
|
|
91
|
+
* @en Tag props
|
|
92
|
+
*/
|
|
93
|
+
tagProps?: TagProps;
|
|
94
|
+
[other: string]: any;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
type InputTagFieldNames = FieldString<TagData>;
|
|
98
|
+
|
|
99
|
+
interface TagDataInfo extends TagData {
|
|
100
|
+
raw: Record<string, unknown>;
|
|
101
|
+
originalIndex: number;
|
|
102
|
+
value: string | number;
|
|
103
|
+
label: string;
|
|
104
|
+
closable: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface InputTagInstance {
|
|
108
|
+
focus: () => void;
|
|
109
|
+
blur: () => void;
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
返回 [InputTag 用法](./input-tag.md)。
|