How to use the uniforms.connectField function in uniforms

To help you get started, we’ve selected a few uniforms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vazco / uniforms / packages / uniforms-bootstrap3 / src / ListItemField.tsx View on Github external
{props.children ? (
      Children.map(props.children, child =>
        React.cloneElement(child, {
          className: 'col-xs-11',
          name: joinName(props.name, child.props.name),
          label: null,
        }),
      )
    ) : (
      
    )}
  
);

export default connectField(ListItem, {
  includeInChain: false,
  includeParent: true,
});
github vazco / uniforms / packages / uniforms-antd / src / DateField.tsx View on Github external
id={props.id}
      name={props.name}
      onChange={value => props.onChange(value && value.toDate())}
      placeholder={props.placeholder}
      ref={props.inputRef}
      value={props.value && moment(props.value)}
      {...filterDOMProps(props)}
    />,
  );

Date.defaultProps = {
  showTime: true,
  style: { width: '100%' },
};

export default connectField(Date, { ensureValue: false });
github vazco / uniforms / packages / uniforms-material / src / ListAddField.tsx View on Github external
}
        {...filterDOMProps(props)}
      >
        {icon}
      
    
  );
};

ListAdd.defaultProps = {
  fullWidth: true,
  icon: '+',
  margin: 'dense',
};

export default connectField(ListAdd, {
  includeParent: true,
  initialValue: false,
});
github vazco / uniforms / packages / uniforms-unstyled / src / components / fields / AutoField.js View on Github external
case Date:    component = DateField; break;
                case Array:   component = ListField; break;
                case Number:  component = NumField;  break;
                case Object:  component = NestField; break;
                case String:  component = TextField; break;
                case Boolean: component = BoolField; break;

                default: throw new Error(`Unsupported field type: ${props.type.toString()}`);
            }
        }
    }

    return createElement(component, props);
};

export default connectField(Auto, {includeInChain: false});
github vazco / uniforms / docs / examples / CustomFields / RatingField.js View on Github external
{Array.from({length: max}, (_, index) => index + 1)
      .map(index => (
        <span style="{{">
            disabled || onChange(!required &amp;&amp; value === index ? null : index)
          }
        &gt;
          {index &lt;= value ? '★' : '☆'}
        </span>
      ))}
  
);

const RatingField = connectField(Rating);

export default function ExamplesRangeField() {
  return (
     alert(JSON.stringify(model, null, 2))}
    &gt;
      
      <br>
      
    
  );
}
github vazco / uniforms / packages / uniforms-bootstrap3 / src / ListAddField.tsx View on Github external
<div>
        limitNotReached &amp;&amp;
        parent.onChange(parent.value.concat([cloneDeep(value)]))
      }
      {...filterDOMProps(props)}
    &gt;
      {addIcon}
    </div>
  );
};

ListAdd.defaultProps = { addIcon: <i> };

export default connectField(ListAdd, {
  includeParent: true,
  initialValue: false,
});
</i>
github vazco / uniforms / packages / uniforms-material / src / SelectField.tsx View on Github external
{legend || label}
    ),
    children,
  );
};

const Select = ({ checkboxes, ...props }: any) =&gt;
  checkboxes ? renderCheckboxes(props) : renderSelect(props);

Select.defaultProps = {
  appearance: 'checkbox',
  fullWidth: true,
  margin: 'dense',
};

export default connectField(Select);
github vazco / uniforms / packages / uniforms-unstyled / src / ListItemField.tsx View on Github external
{props.children ? (
      Children.map(props.children, child =&gt;
        React.cloneElement(child, {
          name: joinName(props.name, child.props.name),
          label: null,
        }),
      )
    ) : (
      
    )}
  
);

export default connectField(ListItem, {
  includeInChain: false,
  includeParent: true,
});
github vazco / uniforms / packages / uniforms-bootstrap3 / src / ErrorField.tsx View on Github external
className={classnames('panel panel-danger text-danger', className)}
      {...filterDOMProps(props)}
    &gt;
      <div>
        {children ? (
          children
        ) : (
          <div>
            <h4>{errorMessage}</h4>
          </div>
        )}
      </div>
    
  );

export default connectField(Error, { initialValue: false });
github vazco / uniforms / packages / uniforms-semantic / src / ListDelField.tsx View on Github external
limitNotReached ? 'link' : 'disabled',
        'fitted close icon',
      )}
      onClick={() =>
        limitNotReached &&
        parent.onChange(
          []
            .concat(parent.value.slice(0, fieldIndex))
            .concat(parent.value.slice(1 + fieldIndex)),
        )
      }
    />
  );
};

export default connectField(ListDel, {
  includeParent: true,
  initialValue: false,
});