Skip to content

Commit

Permalink
Merge branch 'release/0.9.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Jun 10, 2017
2 parents b0b7e49 + 352452d commit e803479
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![alt tag](https://working-minds.github.io/realizejs/assets/img/content/realizejs.png)

### Current version: 0.9.10 beta
### Current version: 0.9.11 beta

Read the documentation on how to get started on [Realize.js](https://working-minds.github.io/realizejs/en)
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "realizejs",
"version": "0.9.10",
"version": "0.9.11",
"authors": [
"Ariel Lindgren <[email protected]>",
"Pedro Jesus <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "realizejs",
"version": "0.9.10",
"version": "0.9.11",
"description": "A rich set of UI components based on Material Design using React.js",
"authors": [
"Ariel Lindgren <[email protected]>",
Expand Down
5 changes: 4 additions & 1 deletion src/js/components/grid_form/grid_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export default class GridForm extends Component {
eagerLoad: true,
readOnly: false,
formComponent: Form,
data: {
dataRows: []
},
onSubmit() {},
onReset() {},
onSuccess() { return true; },
Expand All @@ -87,7 +90,7 @@ export default class GridForm extends Component {
selectedDataRow: {},
selectedRowId: null,
isLoading: this.props.isLoading,
clientSideData: [],
clientSideData: this.props.data.dataRows,
};

constructor(props) {
Expand Down
12 changes: 12 additions & 0 deletions src/js/components/input/grid_form/input_grid_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import _ from 'lodash';
import PropTypes from '../../../prop_types';
import { autobind, mixin } from '../../../utils/decorators';
import { uuid } from '../../../utils';

import GridForm from '../../grid_form/grid_form';
import InputGridFormFields from './input_grid_form_fields';
Expand Down Expand Up @@ -31,6 +32,7 @@ export default class InputGridForm extends InputBase {
fields: {},
form: {},
clientSide: true,
clientSideIdField: '_clientSideId',
inputWrapperComponent: null,
onSuccess() {},
onDestroySuccess() {},
Expand Down Expand Up @@ -58,6 +60,15 @@ export default class InputGridForm extends InputBase {
}));
}

buildGridData() {
const { value, clientSideIdField } = this.props;
const dataRows = !value || value === ''
? []
: value.map((v) => { return { ...v, [clientSideIdField]: uuid.v4() }; });

return { dataRows };
}

/* GridForm Result serializer */

serialize() {
Expand Down Expand Up @@ -108,6 +119,7 @@ export default class InputGridForm extends InputBase {
formComponent={InputGridFormFields}
form={this.parseFormProp()}
columns={this.parseColumnsProp()}
data={this.buildGridData()}
onSuccess={this.handleOnSuccess}
onDestroySuccess={this.handleOnDestroySuccess}
errors={this.props.errors}
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/table/table_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default class TableCell extends Component {

renderFormattedValue(value) {
const valueFormatter = this.getValueFormatter().bind(this);
return (!_.isEmpty(value) || typeof value === 'boolean') ? valueFormatter(value) : '-';
return (!_.isEmpty(value) || typeof value === 'boolean' || typeof value === 'number') ? valueFormatter(value) : '-';
}

renderValue() {
Expand Down
23 changes: 11 additions & 12 deletions src/js/mixins/input/select_component_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,16 @@ export default {

/* Serializer functions */

getDisplayValues () {
return map(this.selectedOptions(), function(selectedOption) {
return selectedOption[this.props.nameField];
}.bind(this));
},
getSelectValue() {
const { multiple } = this.props;
const { value } = this.state;

serialize () {
var serializedInput = {};
serializedInput[this.props.name] = this.getValue();
serializedInput[this.props.name + "Display"] = this.getDisplayValues();
return (!multiple && Array.isArray(value))
? value[0]
: value;
},

return serializedInput;
}
}
serialize() {
return { [this.props.name]: this.getSelectValue() };
},
};

0 comments on commit e803479

Please sign in to comment.