From d263e4a919a6c3f92db52fa1ad15585a642c2ca0 Mon Sep 17 00:00:00 2001 From: Bazire Houssin Date: Wed, 15 Nov 2017 12:13:36 +0100 Subject: [PATCH 1/7] Adding option to get partial values for default data --- src/common/mixin/store-behaviour.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/mixin/store-behaviour.js b/src/common/mixin/store-behaviour.js index 4378c8be9..9ffe69154 100644 --- a/src/common/mixin/store-behaviour.js +++ b/src/common/mixin/store-behaviour.js @@ -124,7 +124,8 @@ const storeMixin = { return this.buildEmptyFromDefinition(); } - return Object.keys(this.definition).reduce((acc, key) => ({ ...acc, [key]: null }), {}); + return Object.keys(this.definition) + .reduce((acc, key) => ((__IS_VERTIGO__ || this.partialObject) && !this.refs[`${this.definitionPath}.${key}`] ? acc : { ...acc, [key]: null }), {}); }, /** From 79a71f2c4295517a24e8bd28b6ac3d739b6cb8db Mon Sep 17 00:00:00 2001 From: Bazire Houssin Date: Wed, 15 Nov 2017 12:43:14 +0100 Subject: [PATCH 2/7] Store-Behaviour : getDefaultStoreData should have the node to filter, to handle initial case --- src/common/mixin/store-behaviour.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/mixin/store-behaviour.js b/src/common/mixin/store-behaviour.js index 4378c8be9..25544a2a2 100644 --- a/src/common/mixin/store-behaviour.js +++ b/src/common/mixin/store-behaviour.js @@ -58,7 +58,7 @@ const storeMixin = { let defaultStateData = {}; // If there is a custom function, use it. It should return store-level data, with node. if (this.getDefaultStoreData) { - defaultStateData = this.getDefaultStoreData(this.definition); + defaultStateData = this.getDefaultStoreData(this.definition, filterNodesArg); } else if ((!hasFilter || this.definitionInNode) && this.definition) { // If the information about store node is known, or we load all data from store // We build the default data From f510ec9fe164ac2b5accf9228619f31a4ffa87e5 Mon Sep 17 00:00:00 2001 From: bnau Date: Thu, 16 Nov 2017 11:33:34 +0100 Subject: [PATCH 3/7] Error translation --- src/components/input/select/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/input/select/index.js b/src/components/input/select/index.js index 5832bc4eb..a3bcc86a1 100644 --- a/src/components/input/select/index.js +++ b/src/components/input/select/index.js @@ -1,5 +1,6 @@ //dependencies import React, { Component, PropTypes } from 'react'; +import { translate } from 'focus-core/translation'; import ComponentBaseBehaviour from '../../../behaviours/component-base'; import filterProps from '../../../utils/filter-html-attributes'; import isUndefined from 'lodash/lang/isUndefined'; @@ -120,7 +121,7 @@ class Select extends Component { - {error &&
{error}
} + {error &&
{translate(error)}
} ); } From 21519537031be86e088aef0a42973895c1318ad9 Mon Sep 17 00:00:00 2001 From: bnau Date: Fri, 17 Nov 2017 13:05:50 +0100 Subject: [PATCH 4/7] Select input: error translation Test fix --- src/components/input/select/__tests__/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/input/select/__tests__/index.js b/src/components/input/select/__tests__/index.js index a6189bf90..0c9574ca7 100644 --- a/src/components/input/select/__tests__/index.js +++ b/src/components/input/select/__tests__/index.js @@ -3,6 +3,8 @@ import TestUtils from 'react-addons-test-utils'; import React from 'react'; import ReactDOM from 'react-dom'; +import { init } from 'focus-core/translation'; + import Select from '../'; const { renderIntoDocument, Simulate } = TestUtils; @@ -10,7 +12,15 @@ import identity from 'lodash/utility/identity'; import fixture from './fixture'; //onChangeSpy = jest.fn(); +const i18nConfig = { + resources: {}, + lng: 'fr-FR'///langOpts.i18nCulture +}; + describe('The select ', () => { + beforeEach(() => { + init(i18nConfig); + }); describe('when called with no props', () => { let component; beforeEach( From 49ce3405abce9acdfc4697dccac5d0c03fffac71 Mon Sep 17 00:00:00 2001 From: Hartorn Date: Sat, 18 Nov 2017 13:57:35 +0100 Subject: [PATCH 5/7] #1512 GetStateFromStore should not be called if there is no store --- src/common/mixin/store-behaviour.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/mixin/store-behaviour.js b/src/common/mixin/store-behaviour.js index 4378c8be9..3c6b81b14 100644 --- a/src/common/mixin/store-behaviour.js +++ b/src/common/mixin/store-behaviour.js @@ -27,8 +27,10 @@ const storeMixin = { /** @inheritdoc */ componentDidMount() { - const newState = this._getStateFromStores(); - this.setState(newState); + if (this.stores && this.stores.length > 0) { + const newState = this._getStateFromStores(); + this.setState(newState); + } }, /** @inheritdoc */ From 13e0ee60618cd9dff8ab119a16dc4429256c7820 Mon Sep 17 00:00:00 2001 From: Hartorn Date: Sat, 18 Nov 2017 14:06:53 +0100 Subject: [PATCH 6/7] #1508 : When saving, only partial data should be returned --- jest-config.js | 3 ++- src/common/mixin/store-behaviour.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/jest-config.js b/jest-config.js index ce4d1f5d6..17cdd33b3 100644 --- a/jest-config.js +++ b/jest-config.js @@ -1,6 +1,7 @@ module.exports = { globals: { - __DEV__: true + __DEV__: true, + __IS_VERTIGO__: false }, automock: false, unmockedModulePathPatterns: [ diff --git a/src/common/mixin/store-behaviour.js b/src/common/mixin/store-behaviour.js index 4378c8be9..9ffe69154 100644 --- a/src/common/mixin/store-behaviour.js +++ b/src/common/mixin/store-behaviour.js @@ -124,7 +124,8 @@ const storeMixin = { return this.buildEmptyFromDefinition(); } - return Object.keys(this.definition).reduce((acc, key) => ({ ...acc, [key]: null }), {}); + return Object.keys(this.definition) + .reduce((acc, key) => ((__IS_VERTIGO__ || this.partialObject) && !this.refs[`${this.definitionPath}.${key}`] ? acc : { ...acc, [key]: null }), {}); }, /** From 0d9a22a3d6ad59a8d2ade7c738aba8b961960cf3 Mon Sep 17 00:00:00 2001 From: Hartorn Date: Tue, 21 Nov 2017 22:45:10 +0100 Subject: [PATCH 7/7] Correcting peer dependencies + version 2.2.2 --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8d785b424..f5c3b87f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "focus-components", - "version": "2.2.1", + "version": "2.2.2", "description": "Focus component repository.", "main": "index.js", "scripts": { @@ -60,12 +60,12 @@ }, "homepage": "https://github.com/KleeGroup/focus-components", "peerDependencies": { - "focus-core": "2.2.0", + "focus-core": ">= 2.2.0 < 2.3", "material-design-lite": "1.3.0", "moment": "2.18.1", - "react": "15.4.2", - "react-dom": "15.4.2", - "react-addons-css-transition-group": "15.4.2" + "react": ">= 15.4.2 < 16.0.0", + "react-dom": ">= 15.4.2 < 16.0.0", + "react-addons-css-transition-group": ">= 15.4.2 < 16.0.0" }, "dependencies": { "closest": "0.0.1", @@ -93,4 +93,4 @@ "react-addons-test-utils": "15.4.2", "react-dom": "15.4.2" } -} \ No newline at end of file +}