Code Monkey home page Code Monkey logo

fields-ant's People

Contributors

cry-stal-lee avatar dependabot-preview[bot] avatar ekatsuta avatar ellenshin avatar karen-ka avatar kbouchard avatar mumumumu avatar renatodv avatar rkuykendall avatar rpalermodrums avatar sha-4 avatar wpontius avatar wsaffran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fields-ant's Issues

Add radio button type

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

Fieldset custom validators cannot access all model values

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.

Issues applying insertIf to multiple fields

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:

  1. Allow insertIf to be used on fieldSets in addition to fields
  2. Don't display a legend if a fieldSet has no fields

I would prefer the first fix, as it makes sense to have fieldSets be dynamic in a similar way to fields.

Cards do not support ant design props

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.

insertIf does not show field on initial render

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.

FormModal form model does not reflect dynamically passed field sets

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.

Allow search on any key in option select

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

showLabel prop does not hide label for a field config

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.

insertIf passes removed field value on save

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

Support popovers in legends and labels

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

Append default class names based on field type

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

Bug with ordering of insertIf and object search create update

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

Allow for multiple create field in object search create

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...

Inaccurate FormCard prop interface

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.