Files
heroui-vue/docs/migrations/M14-textarea.md
T

81 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# M14 TextArea 交接报告
实施日期:2026-10-21。状态:实施者自测完成,待集成人复核。**未提交、未推送。**
## 1. 起点与范围
| 项 | 值 |
| --------- | ---------------------------------------------------------------------------------------------------------------- |
| 起始 HEAD | `37e11e6`;与 M13 同一 checkout、同一交付批次 |
| 边界 | 可改 TextArea 局部封装/CSS/变体;不复制 useTextControl;不改 TextField/Form/Switch/InputGroup 核心 |
| 上游 | `text-area.mdx`、`packages/react/src/components/textarea`、`demos/cn/textarea`、`styles/components/textarea.css` |
## 2. 能力核对与局部缺口
| 能力 | 状态 |
| ------------------------------------ | --------------------------------------------------- |
| 值 v-model / default-value | 已有(useTextControl) |
| FormData / reset / 取消 reset | 已有 |
| 受控拒绝恢复 DOM | 已有 |
| disabled / readonly / required | 已有 |
| variant primary/secondary、fullWidth | 已有 |
| rows | **本批补**:显式 `rows` prop,默认 3(上游 API 表) |
| cols/wrap/autocomplete/maxlength 等 | attrs 透传 |
| Label/Description/FieldError 关联 | 已有 |
| InputGroup 相邻回归 | 本批测试覆盖 |
未改 useTextControl;无第二份值/错误状态。
## 3. 交付
- `apps/docs/components/textarea.md`(7 预览,Vue API 表)
- 演示 7:basic、variants、on-surface、full-width、controlled、rows、textarea-custom-styles(对应上游 `text-area-custom-styles` 预览名)
- `TextArea.vue`:`rows?: number` 默认 3
- 测试(与 M13 共用 `tests/field-docs-textarea.test.ts`):rows 默认与显式、FormData/disabled/readonly/reset/取消 reset、受控拒绝、字段关联、InputGroup 回归、类型约束
## 4. 示例对照(7/7)
| 预览 | 上游文件 | 内容 |
| ---------------------- | ----------------- | ---------------------------- |
| textarea-basic | basic.tsx | aria-label + h-32 w-96 |
| textarea-variants | variants.tsx | primary/secondary fullWidth |
| textarea-on-surface | on-surface.tsx | Surface + secondary |
| textarea-full-width | full-width.tsx | 全宽 |
| textarea-controlled | controlled.tsx | v-model + 字符数 Description |
| textarea-rows | rows.tsx | rows 3/6 + Label |
| textarea-custom-styles | custom-styles.tsx | 自定义圆角/阴影 |
## 5. API 差异
- `value`/`onChange` → `v-model`;`className` → `class`(string|array|object)。
- `rows` 默认 3 与上游一致;校验类 prop 仍通过 TextField。
## 6. 命令
与 M13 同次执行:`pnpm test` 13 文件 / **201**(SSR 3);`pnpm test:unit` 12 文件 / **198**;typecheck / build:docs / format 通过。
## 7. 浏览器
`/components/textarea`:9 个 textarea(含演示外页面代码),rows=3 与 rows=6 生效;表格无溢出;390 窄屏正常。
## 8. 未验证
浅/深切换交互、位图、Nuxt、RTL、读屏、独立安装、resize 手感(仅样式属性)。
## 9. 最短复核步骤
1. `pnpm exec vitest run tests/field-docs-textarea.test.ts`
2. `/components/textarea`:变体、全宽、受控计数、行数 3/6。
3. 在 `/components/text-field` 的 textarea 示例与 InputGroup with-textarea 回归。
## 10. 需集成人确认
- `rows` 默认 3 是否需要与 Input 默认高度策略统一文档说明。
- 自定义样式预览名 `textarea-custom-styles` 对应上游 `text-area-custom-styles`。
实施者不宣布验收通过。
## 11. 复核返工(2026-10-21)
按 M13–M14 复核报告,在 TextArea 文档补充 `update:modelValue`、`focus()`、`element` 暴露说明;行为测试覆盖 focus/element 与 autoComplete 等字段下发。`pnpm test` 208 项通过。