Skip to content

Commit

Permalink
Removed unwanted props from uniforms-bootstrap3 (#64).
Browse files Browse the repository at this point in the history
  • Loading branch information
radekmie committed Jul 19, 2016
1 parent 6443e4d commit adc5c8f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 123 deletions.
29 changes: 6 additions & 23 deletions packages/uniforms-bootstrap3/src/components/fields/ErrorField.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
import React from 'react';
import classnames from 'classnames';
import {connectField} from 'uniforms';
import {nothing} from 'uniforms';
import React from 'react';
import classnames from 'classnames';
import {connectField} from 'uniforms';
import {filterDOMProps} from 'uniforms';
import {nothing} from 'uniforms';

const Error = ({
changed, // eslint-disable-line no-unused-vars
changedMap, // eslint-disable-line no-unused-vars
children,
className,
disabled, // eslint-disable-line no-unused-vars
error, // eslint-disable-line no-unused-vars
errorMessage,
field, // eslint-disable-line no-unused-vars
fieldType, // eslint-disable-line no-unused-vars
fields, // eslint-disable-line no-unused-vars
findError, // eslint-disable-line no-unused-vars
findField, // eslint-disable-line no-unused-vars
findValue, // eslint-disable-line no-unused-vars
grid, // eslint-disable-line no-unused-vars
id, // eslint-disable-line no-unused-vars
label, // eslint-disable-line no-unused-vars
name, // eslint-disable-line no-unused-vars
onChange, // eslint-disable-line no-unused-vars
parent, // eslint-disable-line no-unused-vars
placeholder, // eslint-disable-line no-unused-vars
value, // eslint-disable-line no-unused-vars
...props
}) =>
!errorMessage ? nothing : (
<section className={classnames('panel panel-danger', className)} {...props}>
<section className={classnames('panel panel-danger', className)} {...filterDOMProps(props)}>
<section className="panel-body">
{children ? (
children
Expand Down
16 changes: 5 additions & 11 deletions packages/uniforms-bootstrap3/src/components/fields/HiddenField.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import {BaseField} from 'uniforms';
import {nothing} from 'uniforms';
import React from 'react';
import {BaseField} from 'uniforms';
import {filterDOMProps} from 'uniforms';
import {nothing} from 'uniforms';

export default class HiddenField extends BaseField {
componentWillReceiveProps ({value: valueDesired}) {
Expand All @@ -19,14 +20,7 @@ export default class HiddenField extends BaseField {

return (
props.noDOM ? nothing : (
<input
disabled={props.disabled}
id={props.id}
name={props.name}
ref={props.inputRef}
type="hidden"
value={props.value}
/>
<input ref={props.inputRef} type="hidden" value={props.value} {...filterDOMProps(props)} />
)
);
}
Expand Down
30 changes: 7 additions & 23 deletions packages/uniforms-bootstrap3/src/components/fields/ListAddField.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
import React from 'react';
import classnames from 'classnames';
import {connectField} from 'uniforms';
import React from 'react';
import classnames from 'classnames';
import {connectField} from 'uniforms';
import {filterDOMProps} from 'uniforms';

const ListAdd = ({
changed, // eslint-disable-line no-unused-vars
changedMap, // eslint-disable-line no-unused-vars
className,
disabled, // eslint-disable-line no-unused-vars
error, // eslint-disable-line no-unused-vars
errorMessage, // eslint-disable-line no-unused-vars
field, // eslint-disable-line no-unused-vars
fieldType, // eslint-disable-line no-unused-vars
fields, // eslint-disable-line no-unused-vars
findError, // eslint-disable-line no-unused-vars
findField, // eslint-disable-line no-unused-vars
findValue, // eslint-disable-line no-unused-vars
grid, // eslint-disable-line no-unused-vars
id, // eslint-disable-line no-unused-vars
initialCount, // eslint-disable-line no-unused-vars
label, // eslint-disable-line no-unused-vars
name, // eslint-disable-line no-unused-vars
onChange, // eslint-disable-line no-unused-vars
disabled,
parent,
placeholder, // eslint-disable-line no-unused-vars
value,
...props
}) => {
const limitNotReached = !(parent.maxCount <= parent.value.length);
const limitNotReached = !disabled && !(parent.maxCount <= parent.value.length);

return (
<section
className={classnames('badge pull-right', className)}
onClick={() => limitNotReached && parent.onChange(parent.value.concat([value]))}
{...props}
{...filterDOMProps(props)}
>
{/* TODO: configure to alternate icon */}
<i className="glyphicon glyphicon-plus" />
Expand Down
29 changes: 7 additions & 22 deletions packages/uniforms-bootstrap3/src/components/fields/ListDelField.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
import React from 'react';
import classnames from 'classnames';
import {connectField} from 'uniforms';
import React from 'react';
import classnames from 'classnames';
import {connectField} from 'uniforms';
import {filterDOMProps} from 'uniforms';

const ListDel = ({
changed, // eslint-disable-line no-unused-vars
changedMap, // eslint-disable-line no-unused-vars
className,
disabled, // eslint-disable-line no-unused-vars
error, // eslint-disable-line no-unused-vars
errorMessage, // eslint-disable-line no-unused-vars
field, // eslint-disable-line no-unused-vars
fieldType, // eslint-disable-line no-unused-vars
fields, // eslint-disable-line no-unused-vars
findError, // eslint-disable-line no-unused-vars
findField, // eslint-disable-line no-unused-vars
findValue, // eslint-disable-line no-unused-vars
grid, // eslint-disable-line no-unused-vars
id, // eslint-disable-line no-unused-vars
label, // eslint-disable-line no-unused-vars
disabled,
name,
onChange, // eslint-disable-line no-unused-vars
parent,
placeholder, // eslint-disable-line no-unused-vars
value, // eslint-disable-line no-unused-vars
...props
}) => {
const fieldIndex = +name.slice(1 + name.lastIndexOf('.'));
const limitNotReached = !(parent.minCount >= parent.value.length);
const limitNotReached = !disabled && !(parent.minCount >= parent.value.length);

return (
<span
Expand All @@ -35,7 +20,7 @@ const ListDel = ({
[].concat(parent.value.slice(0, fieldIndex))
.concat(parent.value.slice(1 + fieldIndex))
)}
{...props}
{...filterDOMProps(props)}
>
{/* TODO: configure to alternate icon */}
<i className="glyphicon glyphicon-minus" />
Expand Down
33 changes: 10 additions & 23 deletions packages/uniforms-bootstrap3/src/components/fields/ListField.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
import React from 'react';
import classnames from 'classnames';
import {Children} from 'react';
import {connectField} from 'uniforms';
import {joinName} from 'uniforms';
import React from 'react';
import classnames from 'classnames';
import {Children} from 'react';
import {connectField} from 'uniforms';
import {filterDOMProps} from 'uniforms';
import {joinName} from 'uniforms';

import ListAddField from './ListAddField';
import ListItemField from './ListItemField';

const List = ({
changed, // eslint-disable-line no-unused-vars
changedMap, // eslint-disable-line no-unused-vars
children,
className,
disabled, // eslint-disable-line no-unused-vars
error,
errorMessage, // eslint-disable-line no-unused-vars
field, // eslint-disable-line no-unused-vars
fieldType, // eslint-disable-line no-unused-vars
fields, // eslint-disable-line no-unused-vars
findError, // eslint-disable-line no-unused-vars
findField, // eslint-disable-line no-unused-vars
findValue, // eslint-disable-line no-unused-vars
grid, // eslint-disable-line no-unused-vars
id, // eslint-disable-line no-unused-vars
initialCount,
itemProps,
label,
maxCount, // eslint-disable-line no-unused-vars
minCount, // eslint-disable-line no-unused-vars
name,
onChange, // eslint-disable-line no-unused-vars
parent, // eslint-disable-line no-unused-vars
placeholder, // eslint-disable-line no-unused-vars
value,
...props
}) =>
<section className={classnames('panel panel-default', {'panel-danger': error}, className)} {...props}>
<section
className={classnames('panel panel-default', {'panel-danger': error}, className)}
{...filterDOMProps(props)}
>
<section className="panel-body">
{label && (
<section className="panel-heading">
Expand Down
27 changes: 6 additions & 21 deletions packages/uniforms-bootstrap3/src/components/fields/NestField.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
import React from 'react';
import {connectField} from 'uniforms';
import {injectName} from 'uniforms';
import {joinName} from 'uniforms';
import React from 'react';
import {connectField} from 'uniforms';
import {filterDOMProps} from 'uniforms';
import {injectName} from 'uniforms';
import {joinName} from 'uniforms';

import AutoField from './AutoField';

const Nest = ({
changed, // eslint-disable-line no-unused-vars
changedMap, // eslint-disable-line no-unused-vars
children,
disabled, // eslint-disable-line no-unused-vars
error, // eslint-disable-line no-unused-vars
errorMessage, // eslint-disable-line no-unused-vars
field, // eslint-disable-line no-unused-vars
fieldType, // eslint-disable-line no-unused-vars
fields,
findError, // eslint-disable-line no-unused-vars
findField, // eslint-disable-line no-unused-vars
findValue, // eslint-disable-line no-unused-vars
grid, // eslint-disable-line no-unused-vars
id, // eslint-disable-line no-unused-vars
label,
name,
onChange, // eslint-disable-line no-unused-vars
parent, // eslint-disable-line no-unused-vars
placeholder, // eslint-disable-line no-unused-vars
value, // eslint-disable-line no-unused-vars
...props
}) =>
<section {...props}>
<section {...filterDOMProps(props)}>
{label && (
<label>
{label}
Expand Down

0 comments on commit adc5c8f

Please sign in to comment.