This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = this.data.slice(); | |
const searchText = this.getSearchText(); | |
const columnKeys = Object.keys(this.getColumns()); | |
const reg = new RegExp(searchText.toLocaleLowerCase().split('').join('.*?'), ['g']); | |
const result = data.filter((value) => { | |
return columnKeys.some((key) => { | |
return reg.exec(String(value[key]).toLocaleLowerCase()); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _sort({array, sortField, order}) { | |
order = order.toLowerCase(); | |
const isAsc = order === Order.ASC; | |
return array.sort((a, b) => { | |
let valueA = a[sortField] === null ? '' : a[sortField]; | |
let valueB = b[sortField] === null ? '' : b[sortField]; | |
if(!isAsc) { | |
const temp = valueA; valueA = valueB; valueB = temp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React.cloneElement(child, { | |
onSort: this.handleSort.bind(this, field), | |
orderStatus: this.state.orderStatus | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React.Children.map(this.props.children, (child, index) => { | |
const props = child.props; | |
return Object.assign({}, child.props, {index}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.disable-select { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {List, Map} from 'immutable'; | |
import {ActionTypes} from '../constants/Constants'; | |
const defaultState = new Map({ | |
dataList: new Map({ | |
currentAccount: '', | |
currentPath: new List(), | |
data: new List(), | |
isLoading: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleOutSideClick(event) { | |
const {onRowUnSelected} = this.props; | |
const isDescendantOfRoot = ReactDOM.findDOMNode(this.tbody).contains(event.target); | |
if (!isDescendantOfRoot) { | |
event.stopPropagation(); | |
this.setState({ | |
selectedRowIndex: -1 | |
}, () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fileReader = new FileReader(); | |
fileReader.readAsText(file); | |
fileReader.onloadend = (fileEvent) => { | |
const result = fileEvent.target.result; | |
console.log(result); | |
}; |
OlderNewer