[mobile] Changed searchbar

This commit is contained in:
SergeyEzhin 2021-04-15 14:07:26 +03:00
parent 1cc8510e12
commit 6fe3f773d1
10 changed files with 102 additions and 220 deletions

View file

@ -38,23 +38,19 @@ class SearchSettingsView extends Component {
}
onFindReplaceClick(action) {
runInAction(() => searchOptions.usereplace = action == 'replace');
runInAction(() => {
searchOptions.usereplace = action == 'replace';
searchOptions.isReplaceAll = action == 'replace-all';
});
this.setState({
useReplace: searchOptions.usereplace,
isReplaceAll: searchOptions.isReplaceAll
});
if (this.onReplaceChecked) {}
}
onSwitchReplaceMode(value) {
runInAction(() => searchOptions.isReplaceAll = value === true);
this.setState({
isReplaceAll: searchOptions.isReplaceAll
});
}
extraSearchOptions() {
}
@ -261,14 +257,15 @@ class SearchView extends Component {
render() {
const usereplace = searchOptions.usereplace;
const hidden = {display: "none"};
const isReplaceAll = searchOptions.isReplaceAll;
// const hidden = {display: "none"};
const searchQuery = this.state.searchQuery;
const replaceQuery = this.state.replaceQuery;
const isIos = Device.ios;
const { _t } = this.props;
if(this.searchbar && this.searchbar.enabled) {
usereplace ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace');
usereplace || isReplaceAll ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace');
}
return (
@ -282,12 +279,14 @@ class SearchView extends Component {
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
<div className="searchbar-input-wrap" style={!usereplace ? hidden: null}>
{usereplace || isReplaceAll ? (
<div className="searchbar-input-wrap">
<input placeholder={_t.textReplace} type="search" id="idx-replace-val" value={replaceQuery}
onChange={e => {this.changeReplaceQuery(e.target.value)}} />
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
) : null}
</div>
<div className="buttons-row searchbar-inner__right">
<div className="buttons-row">
@ -302,55 +301,22 @@ class SearchView extends Component {
</a>
</div>
<div className="buttons-row-replace">
{!Device.isPhone ? (
{!Device.isPhone && usereplace ? (
<Fragment>
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
</Fragment>
) : (
<Fragment>
{searchOptions.isReplaceAll ? (
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
) : (
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
)}
{isReplaceAll ? (
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
) : usereplace ? (
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
) : null}
</Fragment>
)}
</div>
</div>
{/* <div className="searchbar-inner__center">
<div className="searchbar-input-wrap">
<input placeholder={_t.textSearch} type="search" value={searchQuery}
onChange={e => {this.changeSearchQuery(e.target.value)}} />
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
<div className="searchbar-input-wrap" style={!usereplace ? hidden: null}>
<input placeholder={_t.textReplace} type="search" id="idx-replace-val" value={replaceQuery}
onChange={e => {this.changeReplaceQuery(e.target.value)}} />
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
</div> */}
{/* <div className="buttons-row searchbar-inner__right">
<div className="buttons-row buttons-row-replace">
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
</div>
<div className="buttons-row">
<a className={"link icon-only prev " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onSearchClick(SEARCH_BACKWARD)}>
<i className="icon icon-prev" />
</a>
<a className={"link icon-only next " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onSearchClick(SEARCH_FORWARD)}>
<i className="icon icon-next" />
</a>
</div>
</div>
<div className="buttons-row searchbar-inner__left">
<a id="idx-btn-search-settings" className="link icon-only" onClick={this.onSettingsClick}>
<i className="icon icon-settings" />
</a>
</div> */}
</div>
</form>
)

View file

@ -440,10 +440,18 @@
height: 28px;
margin: 8px 0;
}
.buttons-row-replace a {
.buttons-row-replace {
margin-top: 5px;
a {
color: @themeColor;
}
}
.searchbar-inner {
&__left, &__right {
height: 100%;
}
}
}
.searchbar input[type=search] {
box-sizing: border-box;
@ -462,51 +470,12 @@
padding: 0 28px;
}
.searchbar-inner {
// &__right {
// .buttons-row a.next {
// margin-left: 15px;
// }
// }
}
.searchbar-expandable.searchbar-enabled {
&.replace {
height: 88px;
}
}
// @media(max-width: 550px)
// {
// .searchbar-expandable.searchbar-enabled {
// top: 0;
// .searchbar-inner {
// // &__left {
// // margin-right: 15px;
// // }
// // &__center {
// // flex-direction: column;
// // }
// // &__right {
// // flex-direction: column-reverse;
// // margin-left: 10px;
// // }
// }
// &.replace {
// height: 88px;
// margin-top: 5px;
// .searchbar-inner {
// height: 100%;
// &__center {
// .searchbar-input-wrap {
// margin: 8px 0;
// }
// }
// }
// }
// }
// }
.actions-button {
background: rgba(255,255,255,.95);
}

View file

@ -28,8 +28,52 @@
display: flex;
justify-content: center;
}
.searchbar-inner {
padding-right: 19px;
&__left, &__right {
height: auto;
}
&__right {
display: flex;
flex-direction: column;
.buttons-row, .buttons-row-replace {
height: 50%;
}
}
&__center {
flex-wrap: wrap;
}
a.link-settings {
margin: 0;
padding: 0;
}
}
.searchbar-expandable.searchbar-enabled {
top: 0;
.searchbar-inner {
height: 100%;
}
&.replace {
height: 96px;
.searchbar-inner {
&__right {
height: 100%;
}
}
}
}
.searchbar-input-wrap {
height: 32px;
margin-right: 10px;
margin: 8px 0;
}
&-inner {
overflow: initial;
}
}
// Buttons
.segmented {
.decrement, .increment {
display: flex;
@ -322,30 +366,14 @@
// Find and Replace
.searchbar-inner {
&__center {
flex-wrap: wrap;
}
&__left {
padding-top: 4px;
}
.searchbar {
background-color: @themeColor;
}
.buttons-row-replace a {
color: @white;
}
.navbar {
.searchbar-input-wrap {
height: 32px;
margin-right: 10px;
margin: 4px 0;
}
&-inner {
overflow: initial;
}
}
.searchbar .input-clear-button {
width: 18px;
height: 18px;
@ -390,48 +418,6 @@
color: @white;
}
.navbar {
.searchbar-expandable.searchbar-enabled {
top: 0;
// height: 100%;
.searchbar-inner {
height: 100%;
// &__center {
// flex-direction: column;
// }
// &__right {
// flex-direction: column-reverse;
// }
}
&.replace {
height: 96px;
}
}
// a.link {
// padding: 0 16px;
// }
// a.icon-only {
// width: auto;
// height: 48px;
// }
.buttons-row-replace a {
color: @white;
}
// .searchbar .buttons-row {
// align-self: flex-start;
// }
}
@media(max-width: 550px) {
.searchbar-expandable.searchbar-enabled {
.searchbar-inner {
// &__left {
// margin-right: 33px;
// }
}
}
}
.actions-button-text {
cursor: pointer;
line-height: 48px;

View file

@ -23,27 +23,18 @@
}
.searchbar-inner {
flex-wrap: wrap;
padding-left: 25px;
padding-right: 18px;
justify-content: space-between;
height: 100%;
// &__center {
// display: flex;
// align-items: center;
// width: 100%;
// }
// &__right {
// display: flex;
// align-items: center;
// }
&__left {
height: 100%;
// height: 100%;
width: 65%;
}
&__right {
height: 100%;
// height: 100%;
.buttons-row {
display: flex;
justify-content: flex-end;
}
.link-settings {
@ -60,7 +51,7 @@
align-items: center;
width: 100%;
justify-content: center;
margin-top: 5px;
// margin-top: 5px;
a {
font-size: 15px;
height: auto;
@ -79,31 +70,4 @@
.searchbar-expandable.searchbar-enabled {
top: 0;
}
// @media(max-width: 550px)
// {
// .searchbar-expandable.searchbar-enabled {
// .searchbar-inner {
// // &__left {
// // min-width: 22px;
// // max-width: 22px;
// // }
// // &__center {
// // flex-direction: column;
// // }
// // &__right {
// // flex-direction: column-reverse;
// // }
// }
// &.replace {
// top: 0;
// .searchbar-inner {
// height: 100%;
// &__left {
// align-self: flex-start;
// }
// }
// }
// }
// }
}

View file

@ -248,7 +248,8 @@
"textReplaceAll": "Replace All",
"textCaseSensitive": "Case Sensitive",
"textHighlightResults": "Highlight Results",
"textSearch": "Search"
"textSearch": "Search",
"textFindAndReplaceAll": "Find and Replace All"
},
"Edit": {
"textClose": "Close",

View file

@ -35,13 +35,11 @@ class SearchSettings extends SearchSettingsView {
<List>
<ListItem radio title={_t.textFind} name="find-replace-checkbox" checked={!this.state.useReplace} onClick={e => this.onFindReplaceClick('find')} />
<ListItem radio title={_t.textFindAndReplace} name="find-replace-checkbox" checked={this.state.useReplace} onClick={e => this.onFindReplaceClick('replace')} />
</List>
{Device.isPhone ? (
<List>
<ListItem checkbox checked={this.state.isReplaceAll} title={_t.textReplaceAll}
onChange={() => this.onSwitchReplaceMode(!this.state.isReplaceAll)}></ListItem>
</List>
<ListItem radio title={_t.textFindAndReplaceAll} name="find-replace-checkbox" checked={this.state.isReplaceAll}
onClick={() => this.onFindReplaceClick('replace-all')}></ListItem>
) : null}
</List>
<List>
<ListItem title={_t.textCaseSensitive}>
<Toggle slot="after" className="toggle-case-sensitive" />

View file

@ -91,7 +91,8 @@
"textCaseSensitive": "Case Sensitive",
"textHighlight": "Highlight Results",
"textReplace": "Replace",
"textNoTextFound": "Text not Found"
"textNoTextFound": "Text not Found",
"textFindAndReplaceAll": "Find and Replace All"
},
"Add": {
"textSlide": "Slide",

View file

@ -28,13 +28,11 @@ class SearchSettings extends SearchSettingsView {
<List>
<ListItem radio title={_t.textFind} name="find-replace-checkbox" checked={!this.state.useReplace} onClick={e => this.onFindReplaceClick('find')} />
<ListItem radio title={_t.textFindAndReplace} name="find-replace-checkbox" checked={this.state.useReplace} onClick={e => this.onFindReplaceClick('replace')} />
</List>
{Device.isPhone ? (
<List>
<ListItem checkbox checked={this.state.isReplaceAll} title={_t.textReplaceAll}
onChange={() => this.onSwitchReplaceMode(!this.state.isReplaceAll)}></ListItem>
</List>
<ListItem radio title={_t.textFindAndReplaceAll} name="find-replace-checkbox" checked={this.state.isReplaceAll}
onClick={() => this.onFindReplaceClick('replace-all')}></ListItem>
) : null}
</List>
<List>
<ListItem title={_t.textCaseSensitive}>
<Toggle slot="after" className="toggle-case-sensitive" />

View file

@ -331,7 +331,8 @@
"textFormulas": "Formulas",
"textValues": "Values",
"textNoTextFound": "Text not found",
"textReplaceAll": "Replace All"
"textReplaceAll": "Replace All",
"textFindAndReplaceAll": "Find and Replace All"
}
},
"Statusbar": {

View file

@ -36,13 +36,11 @@ class SearchSettings extends SearchSettingsView {
<List>
<ListItem radio title={_t.textFind} name="find-replace-checkbox" checked={!this.state.useReplace} onClick={e => this.onFindReplaceClick('find')} />
<ListItem radio title={_t.textFindAndReplace} name="find-replace-checkbox" checked={this.state.useReplace} onClick={e => this.onFindReplaceClick('replace')} />
</List>
{Device.isPhone ? (
<List>
<ListItem checkbox checked={this.state.isReplaceAll} title={_t.textReplaceAll}
onChange={() => this.onSwitchReplaceMode(!this.state.isReplaceAll)}></ListItem>
</List>
<ListItem radio title={_t.textFindAndReplaceAll} name="find-replace-checkbox" checked={this.state.isReplaceAll}
onClick={() => this.onFindReplaceClick('replace-all')}></ListItem>
) : null}
</List>
<BlockTitle>{_t.textSearchIn}</BlockTitle>
<List>
<ListItem radio title={_t.textWorkbook} name="search-in-checkbox" value="0" checked={this.state.searchIn === 0} onClick={() => this.setState({