From 277d5c65a680520d9486eb25245d06abe58ac635 Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Sun, 9 Apr 2023 18:31:51 -0400 Subject: [PATCH 1/7] fix: textinput cursor moving to start --- src/components/TextInput/TextInput.react.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/TextInput/TextInput.react.js b/src/components/TextInput/TextInput.react.js index 38149edf12..588bb8b2e0 100644 --- a/src/components/TextInput/TextInput.react.js +++ b/src/components/TextInput/TextInput.react.js @@ -15,6 +15,7 @@ class TextInput extends React.Component { if (props.multiline !== this.props.multiline) { const node = props.forwardedRef.current; node.focus(); + node.setSelectionRange(this.props.value.length, this.props.value.length); } } From 4917fb9b14f0ad986adfad4441e069478f4c8c97 Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Fri, 14 Apr 2023 00:54:21 -0400 Subject: [PATCH 2/7] fix: incorrect relation class name --- Parse-Dashboard/parse-dashboard-config.json | 12 ++++-------- src/dashboard/Data/Browser/Browser.react.js | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Parse-Dashboard/parse-dashboard-config.json b/Parse-Dashboard/parse-dashboard-config.json index 84d5d15396..0cbaf15ed0 100644 --- a/Parse-Dashboard/parse-dashboard-config.json +++ b/Parse-Dashboard/parse-dashboard-config.json @@ -2,13 +2,9 @@ "apps": [ { "serverURL": "http://localhost:1337/parse", - "appId": "hello", - "masterKey": "world", - "appName": "", - "iconName": "", - "primaryBackgroundColor": "", - "secondaryBackgroundColor": "" + "appId": "APP_ID", + "masterKey": "MASTER_KEY", + "appName": "MyApp" } - ], - "iconsFolder": "icons" + ] } diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js index 46e18e8947..d96db56a8c 100644 --- a/src/dashboard/Data/Browser/Browser.react.js +++ b/src/dashboard/Data/Browser/Browser.react.js @@ -857,7 +857,7 @@ class Browser extends DashboardView { getRelationURL() { const relation = this.state.relation; - const className = this.props.params.className; + const className = relation.parent.className; const entityId = relation.parent.id; const relationName = relation.key; return generatePath(this.context, `browser/${className}/${entityId}/${relationName}`); From 4cc5026611afeb9d384012c880f6bf17c71e990d Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Fri, 14 Apr 2023 00:58:20 -0400 Subject: [PATCH 3/7] fix: removed config changes --- Parse-Dashboard/parse-dashboard-config.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Parse-Dashboard/parse-dashboard-config.json b/Parse-Dashboard/parse-dashboard-config.json index 0cbaf15ed0..84d5d15396 100644 --- a/Parse-Dashboard/parse-dashboard-config.json +++ b/Parse-Dashboard/parse-dashboard-config.json @@ -2,9 +2,13 @@ "apps": [ { "serverURL": "http://localhost:1337/parse", - "appId": "APP_ID", - "masterKey": "MASTER_KEY", - "appName": "MyApp" + "appId": "hello", + "masterKey": "world", + "appName": "", + "iconName": "", + "primaryBackgroundColor": "", + "secondaryBackgroundColor": "" } - ] + ], + "iconsFolder": "icons" } From 94636aa7cfa71e486a6f4b2b7d019ab265983d47 Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Fri, 14 Apr 2023 12:18:10 -0400 Subject: [PATCH 4/7] fix: removed code from another bug fix --- src/dashboard/Data/Browser/Browser.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js index d96db56a8c..46e18e8947 100644 --- a/src/dashboard/Data/Browser/Browser.react.js +++ b/src/dashboard/Data/Browser/Browser.react.js @@ -857,7 +857,7 @@ class Browser extends DashboardView { getRelationURL() { const relation = this.state.relation; - const className = relation.parent.className; + const className = this.props.params.className; const entityId = relation.parent.id; const relationName = relation.key; return generatePath(this.context, `browser/${className}/${entityId}/${relationName}`); From be5b4c9a45d394521b2ef45b640e4f8eae90e47d Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Fri, 14 Apr 2023 13:15:21 -0400 Subject: [PATCH 5/7] fix: added if condition --- src/components/TextInput/TextInput.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/TextInput.react.js b/src/components/TextInput/TextInput.react.js index 588bb8b2e0..6ab9df19a5 100644 --- a/src/components/TextInput/TextInput.react.js +++ b/src/components/TextInput/TextInput.react.js @@ -15,7 +15,7 @@ class TextInput extends React.Component { if (props.multiline !== this.props.multiline) { const node = props.forwardedRef.current; node.focus(); - node.setSelectionRange(this.props.value.length, this.props.value.length); + if (this.props.value) node.setSelectionRange(this.props.value.length, this.props.value.length); } } From 2dd269227c0e3813a6a29672aa91b8d3ec8501a5 Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Mon, 17 Apr 2023 18:16:56 -0400 Subject: [PATCH 6/7] fix: removed code from another bug fix --- src/components/TextInput/TextInput.react.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/TextInput/TextInput.react.js b/src/components/TextInput/TextInput.react.js index 6ab9df19a5..38149edf12 100644 --- a/src/components/TextInput/TextInput.react.js +++ b/src/components/TextInput/TextInput.react.js @@ -15,7 +15,6 @@ class TextInput extends React.Component { if (props.multiline !== this.props.multiline) { const node = props.forwardedRef.current; node.focus(); - if (this.props.value) node.setSelectionRange(this.props.value.length, this.props.value.length); } } From a4e28b92ea924790a8515c0e4eef9ad80ada7fd4 Mon Sep 17 00:00:00 2001 From: Ashish Baravaliya Date: Mon, 17 Apr 2023 18:34:53 -0400 Subject: [PATCH 7/7] fix: filters focus issue --- .../BrowserFilter/BrowserFilter.react.js | 9 ++- .../BrowserFilter/FilterRow.react.js | 56 ++++++++++--------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/components/BrowserFilter/BrowserFilter.react.js b/src/components/BrowserFilter/BrowserFilter.react.js index 17de624df6..20446a3654 100644 --- a/src/components/BrowserFilter/BrowserFilter.react.js +++ b/src/components/BrowserFilter/BrowserFilter.react.js @@ -24,6 +24,7 @@ export default class BrowserFilter extends React.Component { this.state = { open: false, + editMode: true, filters: new List(), blacklistedFilters: Filters.BLACKLISTED_FILTERS.concat(props.blacklistedFilters) }; @@ -48,7 +49,8 @@ export default class BrowserFilter extends React.Component { } this.setState(prevState => ({ open: !prevState.open, - filters: filters + filters: filters, + editMode: this.props.filters.size === 0 })); this.props.setCurrent(null); } @@ -59,7 +61,8 @@ export default class BrowserFilter extends React.Component { this.setState(({ filters }) => ({ filters: filters.push( new Map({ field: field, constraint: available[field][0] }) - ) + ), + editMode: true })); } @@ -116,7 +119,7 @@ export default class BrowserFilter extends React.Component { onChange={filters => this.setState({ filters: filters })} onSearch={this.apply.bind(this)} renderRow={props => ( - 0} parentContentId={POPOVER_CONTENT_ID} /> + 0} editMode={this.state.editMode} parentContentId={POPOVER_CONTENT_ID} /> )} />
diff --git a/src/components/BrowserFilter/FilterRow.react.js b/src/components/BrowserFilter/FilterRow.react.js index 80cf0e0ba3..cf8cc5a90d 100644 --- a/src/components/BrowserFilter/FilterRow.react.js +++ b/src/components/BrowserFilter/FilterRow.react.js @@ -11,7 +11,7 @@ import DateTimeEntry from 'components/DateTimeEntry/DateTimeEntry.react'; import Icon from 'components/Icon/Icon.react'; import Parse from 'parse'; import PropTypes from 'lib/PropTypes'; -import React from 'react'; +import React, { useCallback } from 'react'; import styles from 'components/BrowserFilter/BrowserFilter.scss'; import validateNumeric from 'lib/validateNumeric'; @@ -20,13 +20,7 @@ for (let c in Constraints) { constraintLookup[Constraints[c].name] = c; } -let setFocus = (input) => { - if (input !== null) { - input.focus(); - } -} - -function compareValue(info, value, onChangeCompareTo, onKeyDown, active, parentContentId) { +function compareValue(info, value, onChangeCompareTo, onKeyDown, active, parentContentId, setFocus) { switch (info.type) { case null: return null; @@ -91,25 +85,35 @@ let FilterRow = ({ onDeleteRow, active, parentContentId, - }) => ( -
- - Constraints[c].name)} - onChange={(c) => onChangeConstraint(constraintLookup[c], compareTo)} /> - {compareValue(compareInfo, compareTo, onChangeCompareTo, onKeyDown, active, parentContentId)} - -
-); + editMode + }) => { + + let setFocus = useCallback((input) => { + if (input !== null && editMode) { + input.focus(); + } + }, []) + + return ( +
+ + Constraints[c].name)} + onChange={(c) => onChangeConstraint(constraintLookup[c], compareTo)} /> + {compareValue(compareInfo, compareTo, onChangeCompareTo, onKeyDown, active, parentContentId, setFocus)} + +
+ ); +} -export default FilterRow; +export default React.memo(FilterRow); FilterRow.propTypes = { fields: PropTypes.arrayOf(PropTypes.string).isRequired,