mighty-justice / fields-ant Goto Github PK
View Code? Open in Web Editor NEWForm and CRUD component builder for Ant Design
Home Page: https://mighty-justice.github.io/fields-ant/
License: MIT License
Form and CRUD component builder for Ant Design
Home Page: https://mighty-justice.github.io/fields-ant/
License: MIT License
In an inline form, post-submit I would expect the checkbox to clear to its default value. Instead, it remains checked when its value is false.
Example:
{"detail":"Only account admins may create or delete users."}
As it stands now, we can use option select to achieve the same goals, but radio buttons are a field type we often use.
Adding this in fields-ant (along with using insertIf
) would decrease the number of custom forms in our repositories
Currently, we can pass custom validators that are sent directly to the ant form. However, these validators only have access to the following parameters: (rule, value, callback, source, options)
. Doing more complicated validation, like requiring one of two fields to be filled out, has to rely on the source parameter, which does not contain all model values (at least not when used within a create field).
It would be great to have access to: the current field value, all field values, and even the form manager to be able to have more complex validators that do not require observing the form directly.
A user should be able to go back to the select/search component if they click a "back" button while in the "create fields" state
Currently, I would like to apply the same insertIf
condition to two fields. I have these fields in their own fieldSet with a legend. If the condition is false, both the fields disappear as intended, but the legend still shows (even though there are no fields in the fieldSet).
I can think of two possible fixes:
insertIf
to be used on fieldSets in addition to fieldsI would prefer the first fix, as it makes sense to have fieldSets be dynamic in a similar way to fields.
I would expect to be able to pass any of the card props here to fields-ant card components.
My specific example is passing bordered={false}
to Card
. I can use a workaround for these borders with style, but other props won't have such easy workarounds.
Right now validation error JSON is just put into a toast notification with no formatting. This must be improved for any user-facing websites.
I have a modal that uses FormModal
with a cardConfig
that uses insertIf
for a field. This insertIf
works great if the values in the modal are changed. On initial render, however, the model that is passed to the insertIf
function is empty, even though fields have defaults.
I want to be able to pass an endpoint and an object with keys and values to the input.
For example, the following config values:
endpoint: 'fruits',
filters: { type: 'citrus' }
should create string:
/fruits/?type=citrus&search=<SEARCH_VALUE>
The array type would, similar to objectSearchCreate, specify the field configs of child elements.
Right now, rowProps
and legend
are stripped from createFields
in NestedFieldSet.tsx
.
The model is cleared on first click, but the selected option still shows until the second click
Failing test available here: https://github.com/mighty-justice/fields-ant/tree/no-required-asterisk
From @ekatsuta --
For example, in an object create search form, if there are multiple fields in the create form, putting resetOnSuccess on the form will only reset one of the fields - should reset form entirely and bring user back to the search view
Steps to reproduce with v1.0.2
1- From EA page, add a new LH
2- Enter malformed website
3- Hit submit, backend error arises
4- Fix error, form remains disabled
When using FormModal
, dynamically adding and removing field sets is not reflected in the form model, meaning insertIf
and ultimately onSave
are called with old form fields.
A short example of field sets that would be passed to FormModal
:
private get fieldSets () {
if (this.isLoading.isTrue) {
return [];
}
return [[
{ field: 'will_only_show', label: 'will not be in model' },
{ field: 'will_never_show', label: 'or be in model', insertIf: (model: IModel) => !!model.will_only_show },
]];
}
The workaround is to pass an insertIf
to each field that checks this.isLoading.isFalse
, but that is a bit of a hassle.
Our example:
Two field sets each with only an objectSearchCreate
field. The second objectSearchCreate
depends on the first, so when the first is not selected, the second does not show. However, the div and separator are still visible even though there are no fields present.
Dependabot was set up to create pull requests against the branch frontend-bumps
, but couldn't find it.
If the branch has been permanently deleted you can update Dependabot's target branch from your dashboard.
This will allow us to also rebalance the widths
Ran into an issue where I was trying to pass an onChange
props to ObjectSearch
. I think onChange
might need to be added to IObjectSearchProps
.
When you search but can't find a result and decide to create a new object, there should be the ability populate object fields based on that search. This is present on mighty-v2.
From @ekatsuta --
When passing a searchIcon prop to an editProp in fields ant, the formatting breaks. Formatting gets misaligned when passing searchIcon with a Font Awesome Icon.
This specifically comes in the case of searching US states, where the name is the full state name (New Jersey) and the value is the state code (NJ). While we want to send the value to the backend, we want users to be able to search using the name.
One option is to make this a controlled component and create a custom onSearch
function for the <Select />
component that will filter the options on whatever key is specified
{ field: `lien_return.id` },
{ field: `lien_return.is_something` },
Dependabot was set up to create pull requests against the branch frontend-bumps
, but couldn't find it.
If the branch has been permanently deleted you can update Dependabot's target branch from your dashboard.
If I pass a fieldSets
as part of a cardConfig
to a FormModal
, I expect showLabel
to control whether or not that field's label is visible.
But for
fieldSets: [[
{
field: 'no_label',
showLabel: false,
},
]]
the label "No Label" is still visible.
Ran into an issue where an objectSearch
field with searchOnEmpty
enabled.
It seems like if the initial empty search can take a while, and results from a second, quicker, search can be overridden by the initial search results.
I expect that, on save, only field values where insertIf
returns true get passed. However, it seems that even though the modal doesn't render the false insertIf
fields, the values are still being passed in the model object to the onSave
function
We only support strings when we label fields and field sets, which means we cannot add popovers / tooltips. Popover content should be able to be passed as well as popover children
Right now, we can pass fields-ant-address
as a className
prop to all address fields, but it would be nice if fields-ant itself used classes. The class names would hopefully include fields-ant
and the field config type and would be set on either FormField
, FormItem
, or both as a starting point
Say I have the following in a fieldSet (this would not actually work but is meant to be an example):
[
{ field: 'person', createFields: [{ field: 'name' }], type: 'objectSearchCreate' },
{ field: 'nickname', insertIf: (model) => !!model.person.name },
]
The point of the insertIf is I only want to show the nickname
field if the object search create is adding a new person and the name field of the createFields
has a value in it.
However, when the back to search button is clicked, even though the insertIf
should return false and the nickname field should disappear, it doesn't. When the model is logged in the insertIf
, the name
field value is still there. Thus, there seems to be an ordering problem with when the model is updated and when the insertIf functions are called
See new_case_contact.gif
in Robert's downloads folder ( not public gif )
Currently, the ObjectSearchCreate
field only allows for one input once a user has not found the object they were searching for and has decided to add a new one. We should allow another field set with any number of fields/types/editProps etc...
I get a TypeScript error when passing showControls={false}
to FormCard
, even though it is an acceptable prop to pass down to Form
. It looks like showControls
is added to IFormProps
and FormCard
uses the base ISharedFormProps
instead.
Unsure if other tweaks to these prop interfaces are necessary. This is low priority, since it's an easy local fix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.