From c50173a579cd159c4ab455d0486b06abf305105c Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 17 May 2019 10:15:40 +0200 Subject: [PATCH 1/5] :bug: Autofocus seulement si saisie en cours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sans l'autofocus, il faut alors cliquer deux fois sur la ligne CA pour pouvoir l'éditer : 1) pour passer le CA d'une div à un input 2) pour commencer à éditer et donc afficher le clavier --- source/components/TargetSelection.js | 51 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 6aaef3b01..d834bc3fa 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -267,31 +267,32 @@ let TargetInputOrValue = withLanguage( language, firstStepCompleted, inversionFail - }) => ( - - {activeInput === target.dottedName || - !target.formule || - isEmpty(target.formule) ? ( - - ) : ( - - )} - - ) + }) => { + let inputIsActive = activeInput === target.dottedName + return ( + + {inputIsActive || !target.formule || isEmpty(target.formule) ? ( + + ) : ( + + )} + + ) + } ) const TargetValue = connect( From 2656cfeb595094131d954e264001f14db29319c1 Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 17 May 2019 10:22:38 +0200 Subject: [PATCH 2/5] =?UTF-8?q?:arrow=5Fup:=20Mise=20=C3=A0=20jour=20de=20?= =?UTF-8?q?d=C3=A9pendances=20:=20redux-form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Et donc react-redux --- package.json | 4 +-- yarn.lock | 71 +++++++++++++++++++++++++--------------------------- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index c648a51e2..a23cba932 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "react-helmet": "6.0.0-beta", "react-highlight-words": "^0.11.0", "react-i18next": "^10.0.1", - "react-redux": "^5.0.7", + "react-redux": "^7.0.3", "react-router": "^4.3.1", "react-router-dom": "^4.3.1", "react-select": "^1.2.1", @@ -54,7 +54,7 @@ "reduce-reducers": "^0.1.2", "redux": "^3.7.2", "redux-batched-actions": "^0.4.1", - "redux-form": "^7.4.2", + "redux-form": "^8.2.0", "redux-thunk": "^2.3.0", "reselect": "^4.0.0", "screenfull": "^3.3.2", diff --git a/yarn.lock b/yarn.lock index b4dae20c5..7ad52171d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -710,6 +710,13 @@ dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.2.0", "@babel/runtime@^7.4.3": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.4.tgz#dc2e34982eb236803aa27a07fea6857af1b9171d" + integrity sha512-w0+uT71b6Yi7i5SE0co4NioIpSYS6lLiXvCzWzGSKvpK5vdQtCbICHMj+gbAKAOtxiV6HsVh/MBdaF9EQ6faSg== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/template@^7.1.0", "@babel/template@^7.2.2", "@babel/template@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.0.tgz#12474e9c077bae585c5d835a95c0b0b790c25c8b" @@ -4316,19 +4323,12 @@ hoek@4.x.x: version "4.2.1" resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" -hoist-non-react-statics@^2.2.2, hoist-non-react-statics@^2.5.0, hoist-non-react-statics@^2.5.4: +hoist-non-react-statics@^2.2.2, hoist-non-react-statics@^2.5.0: version "2.5.5" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== -hoist-non-react-statics@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz#c09c0555c84b38a7ede6912b61efddafd6e75e1e" - integrity sha512-TFsu3TV3YLY+zFTZDrN8L2DTFanObwmBLpWvJs1qfUuEQ5bTAdFcwfx2T/bsCXfM9QHSLvjfP+nihEl0yvozxw== - dependencies: - react-is "^16.3.2" - -hoist-non-react-statics@^3.3.0: +hoist-non-react-statics@^3.2.1, hoist-non-react-statics@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b" integrity sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA== @@ -5380,7 +5380,7 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash-es@^4.17.10, lodash-es@^4.2.1: +lodash-es@^4.17.11, lodash-es@^4.2.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0" @@ -7392,37 +7392,31 @@ react-input-autosize@^2.1.2: dependencies: prop-types "^15.5.8" -react-is@^16.3.2: - version "16.6.3" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.6.3.tgz#d2d7462fcfcbe6ec0da56ad69047e47e56e7eac0" - integrity sha512-u7FDWtthB4rWibG/+mFbVd5FvdI20yde86qKGx4lVUTWmPlSWQ4QxbBIrrs+HnXGbxOUlUzTAP/VDmvCwaP2yA== - -react-is@^16.6.0: - version "16.8.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.1.tgz#a80141e246eb894824fb4f2901c0c50ef31d4cdb" - integrity sha512-ioMCzVDWvCvKD8eeT+iukyWrBGrA3DiFYkXfBsVYIRdaREZuBjENG+KjrikavCLasozqRWTwFUagU/O4vPpRMA== - react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4: version "16.8.4" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2" integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA== -react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4: +react-is@^16.8.6: + version "16.8.6" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" + integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== + +react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" -react-redux@^5.0.7: - version "5.1.1" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.1.1.tgz#88e368682c7fa80e34e055cd7ac56f5936b0f52f" - integrity sha512-LE7Ned+cv5qe7tMV5BPYkGQ5Lpg8gzgItK07c67yHvJ8t0iaD9kPFPAli/mYkiyJYrs2pJgExR2ZgsGqlrOApg== +react-redux@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.0.3.tgz#983c5a6de81cb1e696bd1c090ba826545f9170f1" + integrity sha512-vYZA7ftOYlDk3NetitsI7fLjryt/widNl1SLXYvFenIpm7vjb4ryK0EeFrgn62usg5fYkyIAWNUPKnwWPevKLg== dependencies: - "@babel/runtime" "^7.1.2" - hoist-non-react-statics "^3.1.0" + "@babel/runtime" "^7.4.3" + hoist-non-react-statics "^3.3.0" invariant "^2.2.4" - loose-envify "^1.1.0" - prop-types "^15.6.1" - react-is "^16.6.0" - react-lifecycles-compat "^3.0.0" + loose-envify "^1.4.0" + prop-types "^15.7.2" + react-is "^16.8.6" react-router-dom@^4.3.1: version "4.3.1" @@ -7665,17 +7659,20 @@ redux-batched-actions@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/redux-batched-actions/-/redux-batched-actions-0.4.1.tgz#a8de8cef50a1db4f009d5222820c836515597e22" -redux-form@^7.4.2: - version "7.4.2" - resolved "https://registry.yarnpkg.com/redux-form/-/redux-form-7.4.2.tgz#d6061088fb682eb9fc5fb9749bd8b102f03154b0" +redux-form@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/redux-form/-/redux-form-8.2.0.tgz#87667f39a7eebd4c6ed368817481c1ece80c8890" + integrity sha512-KXsOLwlhV1hn8unTWtxNpFJW2vtIyoGX4zCIw3lSbWCqz8kOyG774aSTPt7k9MTKzJBtxNGZK0O0d2UhTk+JkQ== dependencies: + "@babel/runtime" "^7.2.0" es6-error "^4.1.1" - hoist-non-react-statics "^2.5.4" + hoist-non-react-statics "^3.2.1" invariant "^2.2.4" is-promise "^2.1.0" - lodash "^4.17.10" - lodash-es "^4.17.10" + lodash "^4.17.11" + lodash-es "^4.17.11" prop-types "^15.6.1" + react-is "^16.7.0" react-lifecycles-compat "^3.0.4" redux-thunk@^2.3.0: From 3ec3311f125c59398d16a179783a5f56b8b0e392 Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 17 May 2019 10:51:41 +0200 Subject: [PATCH 3/5] =?UTF-8?q?:bug:=20le=20onKey=20provoquait=20un=20saut?= =?UTF-8?q?=20du=20curseur=20=C3=A0=20la=20fin=20de=20la=20saisie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/CurrencyInput/CurrencyInput.js | 4 ---- source/components/TargetSelection.js | 1 - 2 files changed, 5 deletions(-) diff --git a/source/components/CurrencyInput/CurrencyInput.js b/source/components/CurrencyInput/CurrencyInput.js index 521e0e01d..f9fd66eb3 100644 --- a/source/components/CurrencyInput/CurrencyInput.js +++ b/source/components/CurrencyInput/CurrencyInput.js @@ -47,9 +47,6 @@ class CurrencyInput extends Component { this.input.current.selectionEnd = cursorPosition this.adaptInputSize() } - focusInput = () => { - this.input.current.focus() - } handleChange = event => { let value = event.target.value value = value @@ -77,7 +74,6 @@ class CurrencyInput extends Component { return (
{ }} debounce={600} className="targetInput" - key={props.input.value} defaultValue={props.input.value} {...props.input} {...props} From 6c288a92ed6ed46e7d309cc773092205bfef75a7 Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 17 May 2019 11:34:09 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Moins=20de=20complexit=C3=A9=20dans=20lea?= =?UTF-8?q?=20saisie=20de=20somme=20mon=C3=A9taire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Si je comprends bien, ce code servait à obtenir [ €456] plutôt que [€ 456]. Je pense que l'avantage n'est pas flagrant, et surtout, ça provoque un gros :bug: sur iOS : impossible de refermer le clavier quand on est sur l'input. On ne peut même plus changer d'onglet du navigateur ! --- .../components/CurrencyInput/CurrencyInput.js | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/source/components/CurrencyInput/CurrencyInput.js b/source/components/CurrencyInput/CurrencyInput.js index f9fd66eb3..36b216a0f 100644 --- a/source/components/CurrencyInput/CurrencyInput.js +++ b/source/components/CurrencyInput/CurrencyInput.js @@ -1,7 +1,7 @@ import classnames from 'classnames' import { omit } from 'ramda' import React, { Component } from 'react' -import { debounce, isIE } from '../../utils' +import { debounce } from '../../utils' import './CurrencyInput.css' let isCurrencyPrefixed = language => @@ -21,39 +21,13 @@ class CurrencyInput extends Component { : this.props.onChange input = React.createRef() - getSnapshotBeforeUpdate = () => { - if (!this.input.current) { - return - } - return this.input.current.selectionStart - } - componentDidMount() { - this.adaptInputSize() - } - adaptInputSize = () => { - // Because ch mesurement in IE is not consistent with other browsers, we have to apply a multiplier - // https://stackoverflow.com/questions/17825638/css3-ch-unit-inconsistent-between-ie9-and-other-browsers - const widthMultiplier = isIE() ? 1.4 : 1 - - if (this.input.current && isCurrencyPrefixed(this.props.language)) - this.input.current.style.width = - widthMultiplier * (this.input.current.value.length + 0.2) + 'ch' - } - componentDidUpdate = (_, __, cursorPosition) => { - if (!this.input.current) { - return - } - this.input.current.selectionStart = cursorPosition - this.input.current.selectionEnd = cursorPosition - this.adaptInputSize() - } handleChange = event => { let value = event.target.value value = value .replace(/,/g, '.') .replace(/[^\d.]/g, '') .replace(/\.(.*)\.(.*)/g, '$1.$2') - this.setState({ value }, this.adaptInputSize) + this.setState({ value }) if (value.endsWith('.')) { return From 606e241b2b12286c326414c6852965a664326ff6 Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 17 May 2019 12:11:23 +0200 Subject: [PATCH 5/5] =?UTF-8?q?D=C3=A9sactivation=20de=20flow=20sur=20un?= =?UTF-8?q?=20fichier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pas prioritaire, provoque une erreur dans les tests unitaires qui empêche de merger un bug critique --- source/components/AnswerList.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/components/AnswerList.js b/source/components/AnswerList.js index 5241a2758..6cea72976 100644 --- a/source/components/AnswerList.js +++ b/source/components/AnswerList.js @@ -1,5 +1,3 @@ -/* @flow */ - import { resetSimulation } from 'Actions/actions' import Overlay from 'Components/Overlay' import RuleLink from 'Components/RuleLink' @@ -96,7 +94,7 @@ export default compose( withColours, connect( state => ({ answers: answerWithValueSelector(state) }), - (dispatch: Function) => ({ + dispatch => ({ resetSimulation: () => { dispatch(resetSimulation()) },