Permalink
Browse files

Fixed flow build. Improved style.

  • Loading branch information...
michele
michele committed Jan 14, 2018
1 parent 70a0e20 commit 808cc6c4a42932135e1c6520163b73591253d792
Showing with 36 additions and 52 deletions.
  1. +5 −3 .eslintrc
  2. +1 −1 .flowconfig
  3. +14 −4 dist/FunctionalDataGrid.js
  4. +1 −1 dist/FunctionalDataGrid.js.map
  5. +2 −3 package.json
  6. +4 −1 src/FunctionalDataGrid.js
  7. +1 −1 src/Row.js
  8. +2 −2 src/SelectFilter.js
  9. +1 −1 src/TextBoxFilter.js
  10. +1 −5 webpack.config.js
  11. +4 −30 yarn.lock
View
@@ -3,13 +3,15 @@
"env": {
"browser": true
},
"plugins": ["react"],
"plugins": ["react", "flowtype"],
"extends": [
"eslint:recommended",
"plugin:react/recommended"
"plugin:react/recommended",
"plugin:flowtype/recommended"
],
rules: {
"no-unexpected-multiline": 2,
"no-unused-vars": 1
"no-unused-vars": 1,
"flowtype/space-before-type-colon": 0
}
}
View
@@ -8,7 +8,7 @@ decls
flow-typed
[options]
unsafe.enable_getters_and_setters=true
module.system.node.resolve_dirname=node_modules
module.name_mapper='.*\.\(css\|scss\)$' -> '<PROJECT_ROOT>/interfaces/CssModule.js'
module.name_mapper='.*\.\(html\|svg\|png\|jpg\|gif\)$' -> '<PROJECT_ROOT>/interfaces/WebpackAsset.js'
View
@@ -8026,7 +8026,7 @@ var TextBoxFilter = function (_React$Component) {
var _this = (0, _possibleConstructorReturn3.default)(this, (TextBoxFilter.__proto__ || (0, _getPrototypeOf2.default)(TextBoxFilter)).call(this, props));
_this.render = function () {
return _react2.default.createElement('input', { type: 'text', style: { width: '100%', padding: '2px 5px', backgroundColor: '#eee', border: 'solid 1px #ccc', color: '#000' }, onChange: _this.triggerOnUpdateFilter });
return _react2.default.createElement('input', { type: 'text', style: { width: '100%', boxSizing: 'border-box', padding: '2px 5px', backgroundColor: '#eee', border: 'solid 1px #ccc', color: '#000' }, onChange: _this.triggerOnUpdateFilter });
};
_this.triggerOnUpdateFilter = function (event /*: Object*/) {
@@ -11515,6 +11515,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
var debounceTimeout = 250;
var defaultInitialColumnWidth = 100;
/*:: type FunctionalDataGridProps = {
columns: List<BaseColumn | ColumnGroup>,
initialFilter : List<Filter>,
@@ -11542,6 +11544,14 @@ var FunctionalDataGrid = function (_React$Component) {
return _this.updateElements(data, groups, sort, filter);
}, debounceTimeout);
_this.getInitialColumnWidths = function (columns /*: List<BaseColumn | ColumnGroup>*/) {
return columns.groupBy(function (c) {
return c.id;
}).map(function (v) {
return v.get(0).width != null ? v.get(0).width : defaultInitialColumnWidth;
});
};
_this.componentWillMount = function () {
_this.updateElements(_this.props.data, _this.props.groups, _this.state.sort, _this.state.filter);
};
@@ -11767,7 +11777,7 @@ var FunctionalDataGrid = function (_React$Component) {
cachedElements: (0, _immutable.List)(),
sort: _this.props.initialSort,
filter: _this.props.initialFilter,
columnWidths: (0, _immutable.Map)()
columnWidths: _this.getInitialColumnWidths(props.columns)
};
return _this;
}
@@ -14367,7 +14377,7 @@ var Row = function (_React$Component) {
)
);
}, _this.getColumnWidth = function (c /*: BaseColumn*/) {
return _this.props.columnWidths.get(c.id) != null ? _this.props.columnWidths.get(c.id) : c.width;
return _this.props.columnWidths.get(c.id);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
@@ -37325,7 +37335,7 @@ var SelectFilter = function (_React$Component) {
_this.render = function () {
return _react2.default.createElement(
'select',
{ style: { width: '100%', padding: '2.5px' }, onChange: _this.triggerOnUpdateFilter },
{ style: { width: '100%', boxSizing: 'border-box', padding: '2.5px' }, onChange: _this.triggerOnUpdateFilter },
_react2.default.createElement('option', { key: -1, value: '' }),
_this.props.choices.map(function (c, index) {
return _react2.default.createElement(

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -35,17 +35,16 @@
"eslint": "4.15.0",
"eslint-config-react": "1.1.7",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.41.0",
"eslint-plugin-flowtype": "^2.41.0",
"eslint-plugin-react": "7.5.1",
"file-loader": "1.1.6",
"flow": "0.2.3",
"flow-bin": "0.61.0",
"flow-status-webpack-plugin": "0.1.7",
"flow-typed": "2.2.3",
"graceful-fs": "4.1.11",
"json-loader": "0.5.7",
"postcss-loader": "2.0.10",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.10",
"webpack": "3.10.0"
},
"scripts": {
@@ -15,6 +15,7 @@ import DataRow from "./DataRow"
import debounce from 'debounce'
const debounceTimeout = 250
const defaultInitialColumnWidth = 100
type FunctionalDataGridProps = {
columns: List<BaseColumn | ColumnGroup>,
@@ -50,10 +51,12 @@ export default class FunctionalDataGrid extends React.Component<FunctionalDataGr
cachedElements : List(),
sort : this.props.initialSort,
filter : this.props.initialFilter,
columnWidths : Map()
columnWidths : this.getInitialColumnWidths(props.columns)
}
}
getInitialColumnWidths = (columns : List<BaseColumn | ColumnGroup>) => columns.groupBy(c => c.id).map(v => v.get(0).width != null ? v.get(0).width : defaultInitialColumnWidth)
componentWillMount = () => {
this.updateElements(this.props.data, this.props.groups, this.state.sort, this.state.filter)
}
View
@@ -52,5 +52,5 @@ export default class Row extends React.Component<RowProps> {
</div>
</div>
getColumnWidth = (c : BaseColumn) => this.props.columnWidths.get(c.id) != null ? this.props.columnWidths.get(c.id) : c.width
getColumnWidth = (c : BaseColumn) => this.props.columnWidths.get(c.id)
}
View
@@ -23,7 +23,7 @@ export default class SelectFilter extends React.Component<SelectFilterProps, Sel
}
}
render = () => <select style={{width: '100%', padding: '2.5px'}} onChange={this.triggerOnUpdateFilter}>
render = () => <select style={{width: '100%', boxSizing: 'border-box', padding: '2.5px'}} onChange={this.triggerOnUpdateFilter}>
<option key={-1} value={''} />
{ this.props.choices.map((c, index) => <option key={index} value={c[1]}>{ c[0] }</option>) }
</select>
@@ -32,4 +32,4 @@ export default class SelectFilter extends React.Component<SelectFilterProps, Sel
event.persist()
this.props.onUpdateFilter((value) => event.target.value === '' || (value === event.target.value))
}
}
}
View
@@ -21,7 +21,7 @@ export default class TextBoxFilter extends React.Component<TextBoxFilterProps, T
}
}
render = () => <input type="text" style={{width: '100%', padding: '2px 5px', backgroundColor: '#eee', border: 'solid 1px #ccc', color: '#000'}} onChange={this.triggerOnUpdateFilter} />
render = () => <input type="text" style={{width: '100%', boxSizing: 'border-box', padding: '2px 5px', backgroundColor: '#eee', border: 'solid 1px #ccc', color: '#000'}} onChange={this.triggerOnUpdateFilter} />
triggerOnUpdateFilter = (event : Object) => {
event.persist()
View
@@ -1,7 +1,6 @@
var path = require('path')
var url = require('url')
var webpack = require('webpack')
var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin')
const distDir = "dist";
@@ -63,9 +62,6 @@ module.exports = {
resolve: { modules: [ "node_modules" ] },
cache: true,
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new FlowStatusWebpackPlugin({
failOnError: true
})
new webpack.NoEmitOnErrorsPlugin()
]
}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 808cc6c

Please sign in to comment.