Skip to content

Commit

Permalink
Merge pull request #1386 from KleeGroup/develop
Browse files Browse the repository at this point in the history
Release 2.1.7
  • Loading branch information
Hartorn authored May 30, 2017
2 parents 43ad876 + 4eff8d7 commit 5168116
Show file tree
Hide file tree
Showing 51 changed files with 1,136 additions and 679 deletions.
256 changes: 129 additions & 127 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,135 +1,137 @@
{
"name": "focus-components",
"version": "2.1.6",
"description": "Focus component repository.",
"main": "index.js",
"scripts": {
"babelify": "better-npm-run babelify",
"bundle": "better-npm-run bundle",
"copy-sass": "better-npm-run copy-sass",
"build": "node scripts/mdl-variables-copy.js && better-npm-run babelify && better-npm-run copy-sass && better-npm-run bundle",
"test": "better-npm-run test",
"test:watch": "better-npm-run test-watch",
"postinstall": "node scripts/mdl-variables-copy.js",
"profile": "better-npm-run profile",
"prepublish": "npm run build",
"fix-lint": "eslint --fix src/** || exit 0"
"name": "focus-components",
"version": "2.1.7",
"description": "Focus component repository.",
"main": "index.js",
"scripts": {
"babelify": "better-npm-run babelify",
"bundle": "better-npm-run bundle",
"copy-sass": "better-npm-run copy-sass",
"build": "node scripts/mdl-variables-copy.js && better-npm-run babelify && better-npm-run copy-sass && better-npm-run bundle",
"test": "better-npm-run test",
"test:watch": "better-npm-run test-watch",
"postinstall": "node scripts/mdl-variables-copy.js",
"profile": "better-npm-run profile",
"prepublish": "npm run build",
"fix-lint": "eslint --fix src/** || exit 0"
},
"betterScripts": {
"babelify": {
"env": {
"BABEL_ENV": "production"
},
"command": "node scripts/babelify.js"
},
"betterScripts": {
"babelify": {
"env": {
"BABEL_ENV": "production"
},
"command": "node scripts/babelify.js"
},
"copy-sass": {
"command": "cd src && find . -name *.scss | xargs tar cvf - | tar xfp - -C ../"
},
"bundle": {
"command": "webpack --progress",
"env": {
"DEV": false,
"NODE_ENV": "production",
"LIBRARY_NAME": "FocusComponents",
"MINIMIFY": false,
"PACKAGE_JSON_PATH": "../",
"BABEL_ENV": "production"
}
},
"profile": {
"command": "webpack --progress --json --profile > profile.json",
"env": {
"DEV": false,
"NODE_ENV": "production",
"LIBRARY_NAME": "FocusComponents",
"MINIMIFY": false,
"PACKAGE_JSON_PATH": "../"
}
},
"test": {
"command": "mocha src/**/__tests__/**/*.js",
"env": {
"BABEL_ENV": "production"
}
},
"test-watch": {
"command": "mocha src/**/__tests__/**/*.js -w",
"env": {
"BABEL_ENV": "production"
}
}
"copy-sass": {
"command": "cd src && find . -name *.scss | xargs tar cvf - | tar xfp - -C ../"
},
"babel": {
"presets": [
"focus"
]
"bundle": {
"command": "webpack --progress",
"env": {
"DEV": false,
"NODE_ENV": "production",
"LIBRARY_NAME": "FocusComponents",
"MINIMIFY": false,
"PACKAGE_JSON_PATH": "../",
"BABEL_ENV": "production"
}
},
"repository": {
"type": "git",
"url": "https://github.com/KleeGroup/focus-components.git"
"profile": {
"command": "webpack --progress --json --profile > profile.json",
"env": {
"DEV": false,
"NODE_ENV": "production",
"LIBRARY_NAME": "FocusComponents",
"MINIMIFY": false,
"PACKAGE_JSON_PATH": "../"
}
},
"keywords": [
"react",
"focus"
],
"author": "Focus Team <focus@kleegroup.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/KleeGroup/focus-components/issues"
"test": {
"command": "mocha src/**/__tests__/**/*.js",
"env": {
"BABEL_ENV": "production"
}
},
"homepage": "https://github.com/KleeGroup/focus-components",
"dependencies": {
"closest": "0.0.1",
"daterangepicker": "0.0.3",
"immutable": "^3.7.4",
"lodash": "^3.10.1",
"material-design-lite": "1.1.3",
"object-assign": "^2.0.0",
"react-addons-css-transition-group": "^15.2.1",
"react-date-picker": "^3.1.6",
"uuid": "^2.0.1"
},
"devDependencies": {
"autoprefixer-loader": "^3.2.0",
"babel": "^6.3.26",
"babel-cli": "^6.4.0",
"babel-core": "^6.4.0",
"babel-eslint": "4.1.3",
"babel-loader": "^6.2.1",
"babel-preset-focus": "^0.5.2",
"babel-runtime": "^6.3.19",
"better-npm-run": "0.0.5",
"chai": "^3.2.0",
"chai-subset": "^1.0.1",
"css-loader": "^0.19.0",
"eslint": "^2.3.0",
"eslint-config-focus": "0.3.0",
"eslint-plugin-filenames": "0.1.1",
"eslint-plugin-react": "3.5.0",
"exports-loader": "^0.6.2",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.4",
"focus-core": "0.17.0-beta0",
"in-publish": "^2.0.0",
"jquery": "^2.1.4",
"jsdom": "^6.4.0",
"json-loader": "^0.5.3",
"mocha": "^2.2.5",
"moment": "^2.10.6",
"node-sass": "^3.3.3",
"numeral": "^1.5.3",
"react": "^15.3.2",
"react-addons-test-utils": "^15.2.1",
"react-dom": "^15.2.1",
"react-hot-loader": "^1.3.0",
"sass-loader": "^2.0.1",
"sinon": "^1.16.1",
"sinon-chai": "^2.8.0",
"source-map-loader": "^0.1.5",
"style-loader": "^0.12.4",
"url-loader": "^0.5.6",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1",
"webpack-focus": "^0.11.4"
"test-watch": {
"command": "mocha src/**/__tests__/**/*.js -w",
"env": {
"BABEL_ENV": "production"
}
}
},
"babel": {
"presets": [
"focus"
]
},
"repository": {
"type": "git",
"url": "https://github.com/KleeGroup/focus-components.git"
},
"keywords": [
"react",
"focus"
],
"author": "Focus Team <focus@kleegroup.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/KleeGroup/focus-components/issues"
},
"homepage": "https://github.com/KleeGroup/focus-components",
"dependencies": {
"closest": "0.0.1",
"daterangepicker": "0.0.3",
"immutable": "^3.7.4",
"lodash": "^3.10.1",
"material-design-lite": "1.3.0",
"object-assign": "^2.0.0",
"react-addons-css-transition-group": "^15.2.1",
"react-date-picker": "^3.1.6",
"uuid": "^2.0.1"
},
"devDependencies": {
"autoprefixer-loader": "^3.2.0",
"babel": "^6.3.26",
"babel-cli": "^6.4.0",
"babel-core": "^6.4.0",
"babel-eslint": "7.1.1",
"babel-loader": "^6.2.1",
"babel-preset-focus": "^0.5.2",
"babel-runtime": "^6.3.19",
"better-npm-run": "0.0.5",
"chai": "^3.2.0",
"chai-subset": "^1.0.1",
"css-loader": "^0.19.0",
"enzyme": "2.8.2",
"eslint": "3.17.1",
"eslint-config-focus": "0.5.0",
"eslint-plugin-filenames": "1.1.0",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-react": "6.10.0",
"exports-loader": "^0.6.2",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.4",
"focus-core": "2.1.1",
"in-publish": "^2.0.0",
"jquery": "^2.1.4",
"jsdom": "^6.4.0",
"json-loader": "^0.5.3",
"mocha": "^2.2.5",
"moment": "^2.10.6",
"node-sass": "^3.3.3",
"numeral": "^1.5.3",
"react": "^15.3.2",
"react-addons-test-utils": "^15.2.1",
"react-dom": "^15.2.1",
"react-hot-loader": "^1.3.0",
"sass-loader": "^2.0.1",
"sinon": "^1.16.1",
"sinon-chai": "^2.8.0",
"source-map-loader": "^0.1.5",
"style-loader": "^0.12.4",
"url-loader": "^0.5.6",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1",
"webpack-focus": "^0.11.4"
}
}
6 changes: 3 additions & 3 deletions src/behaviours/material/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const Material = (ref, jsClass, watchedProp) => Component => class MaterialCompo
}

componentWillReceiveProps(nextProps) {
watchedProp = watchedProp || 'error';
const newWatchedProp = nextProps[watchedProp];
if (newWatchedProp !== this.props[watchedProp]) {
const propName = watchedProp || 'error';
const newWatchedProp = nextProps[propName];
if (newWatchedProp !== this.props[propName] || ((this.props.placeholder || nextProps.placeholder) && this.props.value !== nextProps.value)) {
const refNode = ReactDOM.findDOMNode(this.refs[ref]);
componentHandler.upgradeElement(refNode, jsClass);
}
Expand Down
4 changes: 2 additions & 2 deletions src/behaviours/scroll/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isUndefined} from 'lodash/lang';
import {isUndefined, isNull} from 'lodash/lang';

const Scroll = Component => class ScrollComponent extends Component {
constructor(props) {
Expand All @@ -16,7 +16,7 @@ const Scroll = Component => class ScrollComponent extends Component {
scrollPosition(domNode) {
const y = window.pageYOffset || document.documentElement.scrollTop;
const x = window.pageXOffset || document.documentElement.scrollLeft;
if(isUndefined(domNode)) {
if(isUndefined(domNode) || isNull(domNode)) {
return { top: y, left: x };
}
const nodeRect = domNode.getBoundingClientRect();
Expand Down
38 changes: 19 additions & 19 deletions src/behaviours/store/connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isArray, isFunction, isObject} from 'lodash/lang';
import {isArray, isFunction} from 'lodash/lang';
import {capitalize} from 'lodash/string'
import {keys} from 'lodash/object';
import React, {Component} from 'react';
Expand All @@ -8,14 +8,14 @@ import React, {Component} from 'react';
// - Provide a function to read state from your store
export default function connectToStores(storesConfiguration, getState) {
// Validate the stores object
if(!isArray(storesConfiguration)) {
if (!isArray(storesConfiguration)) {
throw new Error('connectToStores: you need to provide an array of store config.');
}

// Validate .
if(!isFunction(getState)) {
if (!isFunction(getState)) {
throw new Error('connectToStores: you need to provide function to read state from store.');
}
}
// Return a wrapper function around the component
return function connectComponent(DecoratedComponent) {

Expand All @@ -38,7 +38,7 @@ export default function connectToStores(storesConfiguration, getState) {
storesConfiguration.forEach(storeConf => {
const {properties, store} = storeConf;
properties.forEach((property) => {
if(!store || !store.definition || !store.definition[property]) {
if (!store || !store.definition || !store.definition[property]) {
console.warn(`
StoreConnector ${displayName}:
You add a property : ${property} in your store configuration which is not in your definition : ${keys(store.definition)}
Expand All @@ -53,36 +53,36 @@ export default function connectToStores(storesConfiguration, getState) {

// When a component will receive a new props.
componentWillReceiveProps(nextProps) {
this.updateState(nextProps);
this.updateState(nextProps);
}

// Component unmount.
componentWillUnmount() {
this._isMounted = false;
this._isMounted = false;
storesConfiguration.forEach(storeConf => {
const {properties, store} = storeConf;
properties.forEach((property) => {
const capitalizedProperty = capitalize(property);
storeConf.store[`remove${capitalizedProperty}ChangeListener`](this.handleStoresChanged);
storeConf.store[`remove${capitalizedProperty}ErrorListener`](this.handleStoresChanged);
store[`remove${capitalizedProperty}ChangeListener`](this.handleStoresChanged);
store[`remove${capitalizedProperty}ErrorListener`](this.handleStoresChanged);
});
});
}

componentDidMount(){
this._isMounted = true;
this.updateState(this.props);
}
componentDidMount() {
this._isMounted = true;
this.updateState(this.props);
}

updateState(props){
if(this._isMounted){
this.setState(getState(this.props));
}
}
updateState(props) {
if (this._isMounted) {
this.setState(getState(props));
}
}

//Handle the store changes
handleStoresChanged = () => {
this.updateState(this.props);
this.updateState(this.props);
};

// Render the component with only props, some from the real props some from the state
Expand Down
Loading

0 comments on commit 5168116

Please sign in to comment.