Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-127020 Move autoFocus functionality to the management toolbar taglib #99157

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ClaySampleManagementToolbarsDisplayContext managementToolbarsDisplayContext = ne
filterDropdownItems="<%= managementToolbarsDisplayContext.getFilterDropdownItems() %>"
searchActionURL="mySearchActionURL?key1=val1&key2=val2&key3=val3"
searchFormName="mySearchName"
searchInputAutoFocus="<%= true %>"
searchInputName="mySearchInputName"
selectable="<%= true %>"
sortingOrder="desc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static Boolean isDisabled() {
return false;
}

public static Boolean isSearchInputAutoFocus() {
return false;
}

public static Boolean isSelectable() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@ public Boolean isDisabled() {
return _disabled;
}

public Boolean isSearchInputAutoFocus() {
if (_searchInputAutoFocus == null) {
if (_managementToolbarDisplayContext != null) {
_managementToolbarDisplayContext.isSearchInputAutoFocus();
}

return ManagementToolbarDefaults.isSearchInputAutoFocus();
}

return _searchInputAutoFocus;
}

public Boolean isSelectable() {
if (_selectable == null) {
if (_managementToolbarDisplayContext != null) {
Expand Down Expand Up @@ -465,6 +477,10 @@ public void setSearchFormName(String searchFormName) {
_searchFormName = searchFormName;
}

public void setSearchInputAutoFocus(Boolean searchInputAutoFocus) {
_searchInputAutoFocus = searchInputAutoFocus;
}

public void setSearchInputName(String searchInputName) {
_searchInputName = searchInputName;
}
Expand Down Expand Up @@ -566,6 +582,7 @@ protected void cleanUp() {
_searchContainerId = null;
_searchFormMethod = null;
_searchFormName = null;
_searchInputAutoFocus = null;
_searchInputName = null;
_searchValue = null;
_selectable = null;
Expand Down Expand Up @@ -624,6 +641,7 @@ protected Map<String, Object> prepareProps(Map<String, Object> props) {

props.put("searchFormMethod", searchFormMethod);
props.put("searchFormName", _namespace(namespace, getSearchFormName()));
props.put("searchInputAutoFocus", isSearchInputAutoFocus());
props.put(
"searchInputName", _namespace(namespace, getSearchInputName()));
props.put("searchValue", getSearchValue());
Expand Down Expand Up @@ -1166,6 +1184,7 @@ private void _writeLabelItem(
private String _searchContainerId;
private String _searchFormMethod;
private String _searchFormName;
private Boolean _searchInputAutoFocus;
private String _searchInputName;
private String _searchValue;
private Boolean _selectable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public default Boolean isDisabled() {
return false;
}

public default Boolean isSearchInputAutoFocus() {
return ManagementToolbarDefaults.isSearchInputAutoFocus();
}

public default Boolean isSelectable() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,12 @@
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description></description>
<name>searchInputAutoFocus</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description></description>
<name>searchInputName</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function ManagementToolbar({
searchData,
searchFormMethod,
searchFormName,
searchInputAutoFocus,
searchInputName,
searchValue,
selectAllURL,
Expand Down Expand Up @@ -116,6 +117,7 @@ function ManagementToolbar({
searchData={searchData}
searchFormMethod={searchFormMethod}
searchFormName={searchFormName}
searchInputAutoFocus={searchInputAutoFocus}
searchInputName={searchInputName}
searchMobile={searchMobile}
searchValue={searchValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const SearchControls = ({
searchData,
searchFormMethod,
searchFormName,
searchInputAutoFocus,
searchInputName,
searchMobile,
searchValue,
Expand All @@ -39,6 +40,7 @@ const SearchControls = ({
<ClayInput.Group>
<ClayInput.GroupItem>
<ClayInput
autoFocus={searchInputAutoFocus}
className="form-control input-group-inset input-group-inset-after"
defaultValue={searchValue}
disabled={disabled}
Expand Down