From 2ece50265019ec0c0f49c67bbfcfc896d24fde2a Mon Sep 17 00:00:00 2001 From: soupette Date: Thu, 24 May 2018 13:59:58 +0200 Subject: [PATCH] Add refs to inputs Date Select & Select --- .../strapi-helper-plugin/lib/src/components/InputDate/index.js | 3 +++ .../lib/src/components/InputNumber/index.js | 3 +++ .../lib/src/components/InputSelect/index.js | 3 +++ .../strapi-helper-plugin/lib/src/components/InputText/index.js | 3 +++ .../admin/src/components/FilterOptions/InputWithAutoFocus.js | 1 + 5 files changed, 13 insertions(+) diff --git a/packages/strapi-helper-plugin/lib/src/components/InputDate/index.js b/packages/strapi-helper-plugin/lib/src/components/InputDate/index.js index a503d47225..2ed4faa85e 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputDate/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputDate/index.js @@ -47,6 +47,7 @@ function InputDate(props) { value: moment, }})} onFocus={props.onFocus} + ref={props.inputRef} tabIndex={props.tabIndex} timeFormat='HH:mm:ss' utc={true} @@ -64,6 +65,7 @@ InputDate.defaultProps = { deactivateErrorHighlight: false, disabled: false, error: false, + inputRef: () => {}, onBlur: () => {}, onFocus: () => {}, placeholder: 'app.utils.placeholder.defaultMessage', @@ -77,6 +79,7 @@ InputDate.propTypes = { deactivateErrorHighlight: PropTypes.bool, disabled: PropTypes.bool, error: PropTypes.bool, + inputRef: PropTypes.func, name: PropTypes.string.isRequired, onBlur: PropTypes.func, onChange: PropTypes.func.isRequired, diff --git a/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js b/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js index aaa8e00eb4..249b611264 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js @@ -26,6 +26,7 @@ function InputNumber(props) { onChange={props.onChange} onFocus={props.onFocus} placeholder={message} + ref={props.inputRef} style={props.style} tabIndex={props.tabIndex} type="number" @@ -42,6 +43,7 @@ InputNumber.defaultProps = { deactivateErrorHighlight: false, disabled: false, error: false, + inputRef: () => {}, onBlur: () => {}, onFocus: () => {}, placeholder: 'app.utils.placeholder.defaultMessage', @@ -55,6 +57,7 @@ InputNumber.propTypes = { deactivateErrorHighlight: PropTypes.bool, disabled: PropTypes.bool, error: PropTypes.bool, + inputRef: PropTypes.func, name: PropTypes.string.isRequired, onBlur: PropTypes.func, onChange: PropTypes.func.isRequired, diff --git a/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js b/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js index 586ccf4085..2fa3b79c96 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js @@ -32,6 +32,7 @@ function InputSelect(props) { onBlur={props.onBlur} onChange={props.onChange} onFocus={props.onFocus} + ref={props.inputRef} style={props.style} tabIndex={props.tabIndex} value={props.value} @@ -53,6 +54,7 @@ InputSelect.defaultProps = { deactivateErrorHighlight: false, disabled: false, error: false, + inputRef: () => {}, onBlur: () => {}, onFocus: () => {}, style: {}, @@ -65,6 +67,7 @@ InputSelect.propTypes = { deactivateErrorHighlight: PropTypes.bool, disabled: PropTypes.bool, error: PropTypes.bool, + inputRef: PropTypes.func, name: PropTypes.string.isRequired, onBlur: PropTypes.func, onChange: PropTypes.func.isRequired, diff --git a/packages/strapi-helper-plugin/lib/src/components/InputText/index.js b/packages/strapi-helper-plugin/lib/src/components/InputText/index.js index d30bc49069..73be8f7bc0 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputText/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputText/index.js @@ -28,6 +28,7 @@ function InputText(props) { onChange={props.onChange} onFocus={props.onFocus} placeholder={message} + ref={props.inputRef} style={props.style} tabIndex={props.tabIndex} type="text" @@ -44,6 +45,7 @@ InputText.defaultProps = { deactivateErrorHighlight: false, disabled: false, error: false, + inputRef: () => {}, onBlur: () => {}, onFocus: () => {}, placeholder: 'app.utils.placeholder.defaultMessage', @@ -57,6 +59,7 @@ InputText.propTypes = { deactivateErrorHighlight: PropTypes.bool, disabled: PropTypes.bool, error: PropTypes.bool, + inputRef: PropTypes.func, name: PropTypes.string.isRequired, onBlur: PropTypes.func, onChange: PropTypes.func.isRequired, diff --git a/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/InputWithAutoFocus.js b/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/InputWithAutoFocus.js index 93c56205b7..97da1498e1 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/InputWithAutoFocus.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/InputWithAutoFocus.js @@ -37,6 +37,7 @@ class InputWithAutofocus extends React.Component { return ( this.inputEl = input} name={name} onChange={onChange} selectOptions={['true', 'false']}