Tencent / Tencent/tdesign-react

[formitem] 希望增加formitem独立校验能力

Open
#1,928 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

💪🏻 enhancement
Dominant language
TypeScript
Stars
965
Forks
373
Avg merge
3d 6h
Merged PRs (30d)
17

Description

这个功能解决了什么问题

现在的formitem的校验能力是依赖于form管理的,但是在有些场景下用户只希望用到formitem的样式,只希望用到label、requiredMark等样式的api,背后的数据状态是自己管理的,这样就会导致一个问题是:formitem中输入的内容没办法做到校验,希望formitem能够新增一个api,实现脱离form也能使用到校验的能力。

类似于下面这个demo,formitem外面不要包form,但是rules能够起到作用,当然api的名字不叫rules。
https://stackblitz.com/edit/react-6vysbz?file=src%2Fdemo.jsx

简单来说就是增加一个脱离form的formitem校验能力

你建议的方案是什么

简单来说就是增加一个脱离form的formitem校验能力

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the FormItem and Form validation entry points, then reproduce the standalone FormItem scenario in the linked StackBlitz demo. Compare the requested behavior with the existing rules-based form flow and define the standalone API and its completion criteria before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.