Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disabled option to text field #139

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/components/fields/check-box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ var CheckBox = function (_React$Component) {
_createClass(CheckBox, [{
key: 'render',
value: function render() {
var _props = this.props,
attributes = _props.attributes,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name,
value = _props.value;
var _props = this.props;
var attributes = _props.attributes;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var value = _props.value;

var hasErrors = errors.count() > 0;

Expand Down
8 changes: 4 additions & 4 deletions lib/components/fields/common/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ var FieldHeader = function (_React$Component) {
}, {
key: 'render',
value: function render() {
var _props = this.props,
id = _props.id,
label = _props.label,
hint = _props.hint;
var _props = this.props;
var id = _props.id;
var label = _props.label;
var hint = _props.hint;

if (!label && !hint) {
return null;
Expand Down
37 changes: 19 additions & 18 deletions lib/components/fields/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var deleteField = _formalistCompose.actions.deleteField,
editField = _formalistCompose.actions.editField,
validateField = _formalistCompose.actions.validateField;
var deleteField = _formalistCompose.actions.deleteField;
var editField = _formalistCompose.actions.editField;
var validateField = _formalistCompose.actions.validateField;

/**
* Container class for fields.
Expand Down Expand Up @@ -88,17 +88,17 @@ var FieldContainer = function (_React$Component) {
}, {
key: 'render',
value: function render() {
var _props = this.props,
attributes = _props.attributes,
bus = _props.bus,
config = _props.config,
errors = _props.errors,
field = _props.field,
name = _props.name,
path = _props.path,
rules = _props.rules,
store = _props.store,
value = _props.value;
var _props = this.props;
var attributes = _props.attributes;
var bus = _props.bus;
var config = _props.config;
var errors = _props.errors;
var field = _props.field;
var name = _props.name;
var path = _props.path;
var rules = _props.rules;
var store = _props.store;
var value = _props.value;

var Field = field;

Expand All @@ -107,8 +107,8 @@ var FieldContainer = function (_React$Component) {

// Extract a few things from attributes
var label = attributes.label || this.props.name.replace(/_/g, ' ');
var _attributes = attributes,
hint = _attributes.hint;
var _attributes = attributes;
var hint = _attributes.hint;

// Curry with the form validation schema

Expand All @@ -129,9 +129,10 @@ var FieldContainer = function (_React$Component) {
}
return store.batchDispatch([editField(path, val), validateField(path, validate(editedValue))]);
}
};

// Set up standard classNames
};var containerClassNames = (0, _classnames2.default)(_container2.default.base, _defineProperty({}, '' + _container2.default.errors, errors.count() > 0));
// Set up standard classNames
var containerClassNames = (0, _classnames2.default)(_container2.default.base, _defineProperty({}, '' + _container2.default.errors, errors.count() > 0));

return (
// *Explicitly* pass all the props we care about down to the field
Expand Down
14 changes: 7 additions & 7 deletions lib/components/fields/date-field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ var DateField = function (_React$Component) {
value: function render() {
var _this2 = this;

var _props = this.props,
attributes = _props.attributes,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name,
value = _props.value;
var _props = this.props;
var attributes = _props.attributes;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var value = _props.value;

var hasErrors = errors.count() > 0;

Expand Down
14 changes: 7 additions & 7 deletions lib/components/fields/date-time-field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ var DateTimeField = function (_React$Component) {
value: function render() {
var _this2 = this;

var _props = this.props,
attributes = _props.attributes,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name,
value = _props.value;
var _props = this.props;
var attributes = _props.attributes;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var value = _props.value;

var hasErrors = errors.count() > 0;

Expand Down
47 changes: 24 additions & 23 deletions lib/components/fields/multi-selection-field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ SelectDefault.propTypes = {
option: _propTypes2.default.shape({
label: _propTypes2.default.string
})

/**
* Selection field
*
* Handles a singular select of a set of pre-supplied options.
*
*/
};

/**
* Selection field
*
* Handles a singular select of a set of pre-supplied options.
*
*/

var SelectionField = function (_React$Component) {
_inherits(SelectionField, _React$Component);

Expand Down Expand Up @@ -269,22 +270,22 @@ var SelectionField = function (_React$Component) {
value: function render() {
var _this2 = this;

var _props = this.props,
attributes = _props.attributes,
config = _props.config,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name,
value = _props.value;
var _state = this.state,
search = _state.search,
searchFocus = _state.searchFocus;
var options = attributes.options,
placeholder = attributes.placeholder,
selector_label = attributes.selector_label,
render_selection_as = attributes.render_selection_as,
render_option_as = attributes.render_option_as;
var _props = this.props;
var attributes = _props.attributes;
var config = _props.config;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var value = _props.value;
var _state = this.state;
var search = _state.search;
var searchFocus = _state.searchFocus;
var options = attributes.options;
var placeholder = attributes.placeholder;
var selector_label = attributes.selector_label;
var render_selection_as = attributes.render_selection_as;
var render_option_as = attributes.render_option_as;

var hasErrors = errors.count() > 0;

Expand Down
64 changes: 32 additions & 32 deletions lib/components/fields/multi-upload-field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,22 +462,22 @@ var MultiUploadField = function (_React$Component) {
*/

value: function render() {
var _props = this.props,
attributes = _props.attributes,
hint = _props.hint,
label = _props.label,
name = _props.name,
errors = _props.errors;
var upload_prompt = attributes.upload_prompt,
upload_action_label = attributes.upload_action_label;
var _props = this.props;
var attributes = _props.attributes;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var errors = _props.errors;
var upload_prompt = attributes.upload_prompt;
var upload_action_label = attributes.upload_action_label;


var hasErrors = errors.count() > 0;

var _state = this.state,
XHRErrorMessages = _state.XHRErrorMessages,
files = _state.files,
invalidFiles = _state.invalidFiles;
var _state = this.state;
var XHRErrorMessages = _state.XHRErrorMessages;
var files = _state.files;
var invalidFiles = _state.invalidFiles;

// Set up field classes

Expand Down Expand Up @@ -560,11 +560,11 @@ var _initialiseProps = function _initialiseProps() {
this.createFileObjects = function (val) {
// format the object
function formatObject(file) {
var name = file.name,
size = file.size,
type = file.type,
lastModifiedDate = file.lastModifiedDate,
lastModified = file.lastModified;
var name = file.name;
var size = file.size;
var type = file.type;
var lastModifiedDate = file.lastModifiedDate;
var lastModified = file.lastModified;

var lastModifiedAsString = lastModifiedDate ? lastModifiedDate.toString() : lastModified.toString();
return {
Expand Down Expand Up @@ -760,10 +760,10 @@ var _initialiseProps = function _initialiseProps() {
_this2.removeFile(0);
}

var permitted_file_type_regex = attributes.permitted_file_type_regex,
permitted_file_type_message = attributes.permitted_file_type_message,
max_file_size = attributes.max_file_size,
max_file_size_message = attributes.max_file_size_message;
var permitted_file_type_regex = attributes.permitted_file_type_regex;
var permitted_file_type_message = attributes.permitted_file_type_message;
var max_file_size = attributes.max_file_size;
var max_file_size_message = attributes.max_file_size_message;


var status = void 0;
Expand Down Expand Up @@ -910,8 +910,8 @@ var _initialiseProps = function _initialiseProps() {
};

this.renderInvalidFile = function (errorObject, index) {
var message = errorObject.message,
file = errorObject.file;
var message = errorObject.message;
var file = errorObject.file;
var name = file.name;


Expand Down Expand Up @@ -996,9 +996,9 @@ var _initialiseProps = function _initialiseProps() {
};

this.renderPreviewItem = function (fileObject, index) {
var progress = fileObject.progress,
file = fileObject.file,
fileAttributes = fileObject.fileAttributes;
var progress = fileObject.progress;
var file = fileObject.file;
var fileAttributes = fileObject.fileAttributes;
var file_name = fileAttributes.file_name;
var preview = file.preview;

Expand Down Expand Up @@ -1039,9 +1039,9 @@ var _initialiseProps = function _initialiseProps() {

this.renderDefaultTemplate = function (fileObject, index) {
var fileAttributes = fileObject.fileAttributes;
var file_name = fileAttributes.file_name,
thumbnail_url = fileAttributes.thumbnail_url,
original_url = fileAttributes.original_url;
var file_name = fileAttributes.file_name;
var thumbnail_url = fileAttributes.thumbnail_url;
var original_url = fileAttributes.original_url;

var hasThumbnail = thumbnail_url != null || (0, _utils.hasImageFormatType)(file_name);
var thumbnailImage = hasThumbnail ? _this2.renderThumbnail(thumbnail_url, file_name) : null;
Expand Down Expand Up @@ -1103,9 +1103,9 @@ var _initialiseProps = function _initialiseProps() {

this.renderFiles = function (files) {
var isSortable = _this2.state.uploadQueue.length === 0;
var _props2 = _this2.props,
config = _props2.config,
attributes = _props2.attributes;
var _props2 = _this2.props;
var config = _props2.config;
var attributes = _props2.attributes;
var render_uploaded_as = attributes.render_uploaded_as;


Expand Down
14 changes: 7 additions & 7 deletions lib/components/fields/number-field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ var NumberField = function (_React$Component) {
_createClass(NumberField, [{
key: 'render',
value: function render() {
var _props = this.props,
attributes = _props.attributes,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name,
value = _props.value;
var _props = this.props;
var attributes = _props.attributes;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var value = _props.value;

var hasErrors = errors.count() > 0;

Expand Down
14 changes: 7 additions & 7 deletions lib/components/fields/radio-buttons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ var RadioButtons = function (_React$Component) {
value: function render() {
var _this2 = this;

var _props = this.props,
attributes = _props.attributes,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name,
value = _props.value;
var _props = this.props;
var attributes = _props.attributes;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var value = _props.value;

var hasErrors = errors.count() > 0;

Expand Down
14 changes: 7 additions & 7 deletions lib/components/fields/rich-text-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ var RichTextArea = function (_React$Component) {
_createClass(RichTextArea, [{
key: 'render',
value: function render() {
var _props = this.props,
attributes = _props.attributes,
config = _props.config,
errors = _props.errors,
hint = _props.hint,
label = _props.label,
name = _props.name;
var _props = this.props;
var attributes = _props.attributes;
var config = _props.config;
var errors = _props.errors;
var hint = _props.hint;
var label = _props.label;
var name = _props.name;
var editorState = this.state.editorState;

var hasErrors = errors.count() > 0;
Expand Down
Loading