Skip to content
This repository was archived by the owner on Oct 24, 2019. It is now read-only.

Commit b8ae012

Browse files
committed
Merge branch 'master' into production
2 parents 052a2d9 + bb72edd commit b8ae012

File tree

5 files changed

+38
-28
lines changed

5 files changed

+38
-28
lines changed

.prettierrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"printWidth" : 100,
3-
"singleQuote" : true,
4-
"bracketSpacing" : false,
5-
"arrowParens": "always"
3+
"singleQuote" : true
64
}

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = (api) => {
1+
module.exports = api => {
22
api.cache(true);
33

44
return {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@toast-ui/react-grid",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "TOAST UI Grid for React",
55
"main": "dist/toastui-react-grid.js",
66
"files": [

src/index.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default class Grid extends React.Component {
1515

1616
bindEventHandlers(props, prevProps) {
1717
Object.keys(props)
18-
.filter((key) => /on[A-Z][a-zA-Z]+/.test(key))
19-
.forEach((key) => {
18+
.filter(key => /on[A-Z][a-zA-Z]+/.test(key))
19+
.forEach(key => {
2020
const eventName = key[2].toLowerCase() + key.slice(3);
2121
// For <Grid onFocus={condition ? onFocus1 : onFocus2} />
2222
if (prevProps && prevProps[key] !== props[key]) {
@@ -35,21 +35,31 @@ export default class Grid extends React.Component {
3535
}
3636

3737
componentDidMount() {
38+
const {
39+
frozenColumnCount: frozenCount = 0,
40+
columnOptions: columnOptionsProp = {}
41+
} = this.props;
42+
43+
const columnOptions = {
44+
...columnOptionsProp,
45+
frozenCount
46+
};
47+
3848
this.gridInst = new TuiGrid({
3949
el: this.rootEl.current,
40-
...this.props
50+
...this.props,
51+
columnOptions
4152
});
42-
4353
this.bindEventHandlers(this.props);
4454
}
4555

4656
shouldComponentUpdate(nextProps) {
47-
const {oneTimeBindingProps = []} = this.props;
57+
const { oneTimeBindingProps = [] } = this.props;
4858
const reactiveProps = Object.keys(reactivePropSetterMap).filter(
49-
(propName) => oneTimeBindingProps.indexOf(propName) === -1
59+
propName => oneTimeBindingProps.indexOf(propName) === -1
5060
);
5161

52-
reactiveProps.forEach((propName) => {
62+
reactiveProps.forEach(propName => {
5363
const currentValue = this.props[propName];
5464
const nextValue = nextProps[propName];
5565
if (currentValue !== nextValue) {

stories/index.stories.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import React, {useCallback} from 'react';
1+
import React, { useCallback } from 'react';
22
import XHRMock from 'xhr-mock';
3-
import {storiesOf} from '@storybook/react';
3+
import { storiesOf } from '@storybook/react';
44
import Grid from '../src/index';
55
import TuiGrid from 'tui-grid';
6-
import {actions} from '@storybook/addon-actions';
7-
import {withKnobs, number, radios, button, object, array} from '@storybook/addon-knobs';
8-
import {data} from './dummy-data';
6+
import { actions } from '@storybook/addon-actions';
7+
import { withKnobs, number, radios, button, object, array } from '@storybook/addon-knobs';
8+
import { data } from './dummy-data';
99
import 'tui-grid/dist/tui-grid.css';
1010
import 'tui-pagination/dist/tui-pagination.css';
1111

1212
const columns = [
13-
{header: 'Name', name: 'name'},
14-
{header: 'Artist', name: 'artist'},
15-
{header: 'Type', name: 'type', editor: 'text'},
16-
{header: 'Release', name: 'release', editor: 'text'},
17-
{header: 'Genre', name: 'genre', editor: 'text'}
13+
{ header: 'Name', name: 'name' },
14+
{ header: 'Artist', name: 'artist' },
15+
{ header: 'Type', name: 'type', editor: 'text' },
16+
{ header: 'Release', name: 'release', editor: 'text' },
17+
{ header: 'Genre', name: 'genre', editor: 'text' }
1818
];
1919

2020
const stories = storiesOf('Toast UI Grid', module).addDecorator(withKnobs);
2121

22-
stories.add('Normal', () => <Grid columns={columns} data={data} header={{height: 60}} />);
22+
stories.add('Normal', () => <Grid columns={columns} data={data} header={{ height: 60 }} />);
2323

2424
stories.add('Set Language', () => {
2525
const options = {
@@ -85,7 +85,7 @@ stories.add('Using Method', () => {
8585
}
8686

8787
handleClickAppend = () => {
88-
this.grid.appendRow({}, {at: 0});
88+
this.grid.appendRow({}, { at: 0 });
8989
};
9090

9191
handleClickSort = () => {
@@ -204,15 +204,17 @@ stories.add('dataSource', () => {
204204
withCredentials: false,
205205
initialRequest: true,
206206
api: {
207-
readData: {url: 'api/readData', method: 'GET'}
207+
readData: { url: 'api/readData', method: 'GET' }
208208
}
209209
};
210210

211-
return <Grid columns={columns} pagination={true} data={dataSource} pageOptions={{perPage: 3}} />;
211+
return (
212+
<Grid columns={columns} pagination={true} data={dataSource} pageOptions={{ perPage: 3 }} />
213+
);
212214
});
213215

214216
stories.add('hook', () => {
215-
const condition = radios('condition', {true: 'true', false: 'false'}, 'true');
217+
const condition = radios('condition', { true: 'true', false: 'false' }, 'true');
216218
const ReactComponent = () => {
217219
const onClick = useCallback(() => {
218220
console.log('condition:', condition);
@@ -225,7 +227,7 @@ stories.add('hook', () => {
225227
});
226228

227229
stories.add('change event based on condition', () => {
228-
const condition = radios('condition', {true: 'true', false: 'false'}, 'true');
230+
const condition = radios('condition', { true: 'true', false: 'false' }, 'true');
229231

230232
return (
231233
<Grid

0 commit comments

Comments
 (0)