question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support PrefixNameContext in Form

See original GitHub issue

What problem does this feature solve?

业务中使用Form组件开发大型表单。比如用来创建K8s资源对象(Application等)有大量字段和多层嵌套层级。比如: application.container.lifecycle.postStart.exec.command application.container.lifecycle.preStop.exec.command application.container.metadata.annotations.lbcinstance application.container.metadata.annotations.bound

手动配置每个Form.Item的name字段会有大量重复的prefix,比如: ['application', 'xxx1'], ['application', 'xxx2'], ['application', 'xxx3'] … (同一级最多可能10-20个字段)

What does the proposed API look like?

<PrefixContext.Provider value={["application", "container"]}>
  <PrefixContext.Provider value={["lifecycle"]}>
    <Form.Item name="postStart">
    {/* 实际name:["application", "container", "lifecycle", "postStart" ] */}
    </Form.Item>
    <Form.Item name="preStop">
    {/* 实际name:["application", "container", "lifecycle", "preStop" ] */}
    </Form.Item>
  </PrefixContext.Provider>
  <PrefixContext.Provider value={["metadata", "annotations"]}>
    <Form.Item name="lbcinstance">
    {/* 实际name:["application", "container", "metadata", "annotations", "lbcinstance" ] */}
    </Form.Item>
    <Form.Item name="bound">
    {/* 实际name:["application", "container", "metadata", "annotations", "bound" ] */}
    </Form.Item>
  </PrefixContext.Provider>
</PrefixContext.Provider>

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
Wxh16144commented, Dec 14, 2022

mark,我在想这个功能是不是业务同学实现 Context 比较好 ,而非组件库去做

0reactions
zombieJcommented, Dec 15, 2022

这个就是你上面的例子,Context 搞两条路径,一个存要传导的,一个存全量的。只要分割清楚就好了哈~

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a condition based on the full name prefix value?
I'm trying to display a question in my form based on the name prefix as the question only applies to woman. I have...
Read more >
Use a prefix to set the data source context
Resolve the data source using code ; Prefix. code:<full class name> ; Example. code:SXA.POC.DataSources.CodeDataSource,SXA.POC ...
Read more >
How to apply form prefix in django template - Stack Overflow
After all, I tried this {{ form1.name_of_term }}. simply made it work like charm. Although i didnt know and i cant explain.
Read more >
Available Prefixes and Fields for Configuration
The rules and the available prefixes and elements are outlined below. AddressScreen. Rule, Entity, Supported Prefix Syntax. AddressScreen, None, AddressGUID ...
Read more >
Prefix: Definition, Meaning, and Examples - ProWritingAid
As a verb, the basic meaning of prefix is “to place at the beginning.” For example, you might prefix a fancy title to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found