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 / docs / examples / CustomFields / SubmitField.js View on Github external
type="submit"
  />
);
SubmitField.contextTypes = BaseField.contextTypes;

// This field is a kind of a shortcut for few fields. You can also access all
// field props here, like value or onChange for some extra logic.
const Composite = () => (
  <section>
    
    
    
  </section>
);

const CompositeField = connectField(Composite);

export default function ExamplesSubmitField() {
  return (
     alert(JSON.stringify(model, null, 2))}
    &gt;
      
      <hr>
      
      <br>
      
    
  );
}
github focallocal / fl-maps / imports / client / utils / uniforms-custom / InputField.js View on Github external
const handleChange = (e, onChange, max, min) =&gt; {
  const { value, type } = e.target

  // Prevent numbers lower than the minimum
  if (type === 'number' &amp;&amp; value &lt; min) {
    return
  }

  onChange(value.substr(0, max))
}

Text.defaultProps = { type: 'text' }

export default connectField(Text)
github vazco / uniforms / packages / uniforms / __tests__ / connectField.js View on Github external
it('is in chain (true)', () =&gt; {
      const Field1 = connectField(props =&gt; props.children, {
        includeInChain: true
      });
      const Field2 = connectField(Test);

      mount(
        
          
        ,
        reactContext
      );

      expect(Test.mock.calls[0]).toEqual(
        expect.arrayContaining([
          expect.objectContaining({ name: 'field.subfield' })
        ])
      );
github vazco / uniforms / packages / uniforms-antd / src / ListDelField.tsx View on Github external
.concat(parent.value.slice(1 + fieldIndex))
        )
      }
      {...filterDOMProps(props)}
    />
  );
};

ListDel.defaultProps = {
  icon: 'delete',
  shape: 'circle-outline',
  size: 'small',
  type: 'ghost'
};

export default connectField(ListDel, {
  includeParent: true,
  initialValue: false
});
github vazco / uniforms / packages / uniforms-bootstrap4 / 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 / DateField.js View on Github external
disabled || dateParse(event.target.valueAsNumber, onChange)
    }
    placeholder={placeholder}
    ref={inputRef}
    type="datetime-local"
    value={dateFormat(value)}
    {...filterDOMProps(props)}
  />
);

Date.defaultProps = {
  fullWidth: true,
  margin: 'dense'
};

export default connectField(Date);
github vazco / uniforms / docs / components / ApplicationPropsField.js View on Github external
);
};

export default connectField(ApplicationProps, {baseField: ApplicationField});
github vazco / uniforms / packages / uniforms-material / src / RadioField.js View on Github external
control={}
          key={item}
          label={transform ? transform(item) : item}
          value={`${item}`}
        /&gt;
      ))}
    
  );
};

Radio.defaultProps = {
  fullWidth: true,
  margin: 'dense'
};

export default connectField(Radio);
github vazco / uniforms / packages / uniforms-unstyled / src / ErrorField.js View on Github external
import React from 'react';
import connectField from 'uniforms/connectField';
import filterDOMProps from 'uniforms/filterDOMProps';
import nothing from 'uniforms/nothing';

const Error = ({ children, error, errorMessage, ...props }) =&gt;
  !error ? (
    nothing
  ) : (
    <div>{children || errorMessage}</div>
  );
export default connectField(Error, { initialValue: false });
github vazco / uniforms / packages / uniforms-unstyled / src / SelectField.js View on Github external
allowedValues,
          disabled,
          id,
          name,
          onChange,
          transform,
          value,
          inputRef,
          label,
          placeholder,
          required
        })}
  
);

export default connectField(Select);