[SSE mobile] Add Search by rows/by columns

This commit is contained in:
Julia Svinareva 2019-06-07 13:53:47 +03:00
parent 5a009e4c90
commit ca34b2f594
3 changed files with 47 additions and 7 deletions

View file

@ -170,9 +170,11 @@ define([
isMatchCase = Common.SharedSettings.get('search-match-case') === true, isMatchCase = Common.SharedSettings.get('search-match-case') === true,
isMatchCell = Common.SharedSettings.get('search-match-cell') === true, isMatchCell = Common.SharedSettings.get('search-match-cell') === true,
isHighlightRes = Common.SharedSettings.get('search-highlight-res') === true, isHighlightRes = Common.SharedSettings.get('search-highlight-res') === true,
searchBy = Common.SharedSettings.get('search-by') === 'rows' ? 'rows' : 'columns',
$pageSettings = $('.page[data-page=search-settings]'), $pageSettings = $('.page[data-page=search-settings]'),
$inputType = $pageSettings.find('input[name=search-type]'), $inputType = $pageSettings.find('input[name=search-type]'),
$inputSearchIn = $pageSettings.find('input[name=search-in]'), $inputSearchIn = $pageSettings.find('input[name=search-in]'),
$inputSearchBy = $pageSettings.find('input[name=search-by]'),
$inputMatchCase = $pageSettings.find('#search-match-case input:checkbox'), $inputMatchCase = $pageSettings.find('#search-match-case input:checkbox'),
$inputMatchCell = $pageSettings.find('#search-match-cell input:checkbox'), $inputMatchCell = $pageSettings.find('#search-match-cell input:checkbox'),
$inputHighlightResults = $pageSettings.find('#search-highlight-res input:checkbox'); $inputHighlightResults = $pageSettings.find('#search-highlight-res input:checkbox');
@ -182,10 +184,12 @@ define([
$inputMatchCase.prop('checked', isMatchCase); $inputMatchCase.prop('checked', isMatchCase);
$inputMatchCell.prop('checked', isMatchCell); $inputMatchCell.prop('checked', isMatchCell);
$inputHighlightResults.prop('checked', isHighlightRes); $inputHighlightResults.prop('checked', isHighlightRes);
$inputSearchBy.val([searchBy]);
// init events // init events
$inputType.single('change', _.bind(me.onTypeChange, me)); $inputType.single('change', _.bind(me.onTypeChange, me));
$inputSearchIn.single('change', _.bind(me.onSearchInChange, me)); $inputSearchIn.single('change', _.bind(me.onSearchInChange, me));
$inputSearchBy.single('change', _.bind(me.onSearchByChange, me));
$inputMatchCase.single('change', _.bind(me.onMatchCaseClick, me)); $inputMatchCase.single('change', _.bind(me.onMatchCaseClick, me));
$inputMatchCell.single('change', _.bind(me.onMatchCellClick, me)); $inputMatchCell.single('change', _.bind(me.onMatchCellClick, me));
$inputHighlightResults.single('change', _.bind(me.onHighlightResultsClick, me)); $inputHighlightResults.single('change', _.bind(me.onHighlightResultsClick, me));
@ -278,7 +282,8 @@ define([
onQuerySearch: function(query, direction) { onQuerySearch: function(query, direction) {
var matchCase = Common.SharedSettings.get('search-match-case') || false, var matchCase = Common.SharedSettings.get('search-match-case') || false,
matchCell = Common.SharedSettings.get('search-match-cell') || false, matchCell = Common.SharedSettings.get('search-match-cell') || false,
lookInSheet = Common.SharedSettings.get('search-in') === 'sheet'; lookInSheet = Common.SharedSettings.get('search-in') === 'sheet',
searchBy = Common.SharedSettings.get('search-by') === 'rows';
if (query && query.length) { if (query && query.length) {
var options = new Asc.asc_CFindOptions(); var options = new Asc.asc_CFindOptions();
@ -287,7 +292,7 @@ define([
options.asc_setIsMatchCase(matchCase); options.asc_setIsMatchCase(matchCase);
options.asc_setIsWholeCell(matchCell); options.asc_setIsWholeCell(matchCell);
options.asc_setScanOnOnlySheet(lookInSheet); options.asc_setScanOnOnlySheet(lookInSheet);
// options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); options.asc_setScanByRows(searchBy);
// options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); // options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value);
if (!this.api.asc_findText(options)) { if (!this.api.asc_findText(options)) {
@ -307,7 +312,8 @@ define([
onQueryReplace: function(search, replace) { onQueryReplace: function(search, replace) {
var matchCase = Common.SharedSettings.get('search-match-case') || false, var matchCase = Common.SharedSettings.get('search-match-case') || false,
matchCell = Common.SharedSettings.get('search-match-cell') || false, matchCell = Common.SharedSettings.get('search-match-cell') || false,
lookInSheet = Common.SharedSettings.get('search-in') === 'sheet'; lookInSheet = Common.SharedSettings.get('search-in') === 'sheet',
searchBy = Common.SharedSettings.get('search-by') === 'rows';
if (search && search.length) { if (search && search.length) {
this.api.isReplaceAll = false; this.api.isReplaceAll = false;
@ -318,7 +324,7 @@ define([
options.asc_setIsMatchCase(matchCase); options.asc_setIsMatchCase(matchCase);
options.asc_setIsWholeCell(matchCell); options.asc_setIsWholeCell(matchCell);
options.asc_setScanOnOnlySheet(lookInSheet); options.asc_setScanOnOnlySheet(lookInSheet);
// options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); options.asc_setScanByRows(searchBy);
// options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); // options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value);
options.asc_setIsReplaceAll(false); options.asc_setIsReplaceAll(false);
@ -329,7 +335,8 @@ define([
onQueryReplaceAll: function(search, replace) { onQueryReplaceAll: function(search, replace) {
var matchCase = Common.SharedSettings.get('search-match-case') || false, var matchCase = Common.SharedSettings.get('search-match-case') || false,
matchCell = Common.SharedSettings.get('search-match-cell') || false, matchCell = Common.SharedSettings.get('search-match-cell') || false,
lookInSheet = Common.SharedSettings.get('search-in') === 'sheet'; lookInSheet = Common.SharedSettings.get('search-in') === 'sheet',
searchBy = Common.SharedSettings.get('search-by') === 'rows';
if (search && search.length) { if (search && search.length) {
this.api.isReplaceAll = true; this.api.isReplaceAll = true;
@ -340,7 +347,7 @@ define([
options.asc_setIsMatchCase(matchCase); options.asc_setIsMatchCase(matchCase);
options.asc_setIsWholeCell(matchCell); options.asc_setIsWholeCell(matchCell);
options.asc_setScanOnOnlySheet(lookInSheet); options.asc_setScanOnOnlySheet(lookInSheet);
// options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); options.asc_setScanByRows(searchBy);
// options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); // options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value);
options.asc_setIsReplaceAll(true); options.asc_setIsReplaceAll(true);
@ -360,6 +367,10 @@ define([
Common.SharedSettings.set('search-in', $(e.currentTarget).val()); Common.SharedSettings.set('search-in', $(e.currentTarget).val());
}, },
onSearchByChange: function(e) {
Common.SharedSettings.set('search-by', $(e.currentTarget).val());
},
onMatchCaseClick: function (e) { onMatchCaseClick: function (e) {
Common.SharedSettings.set('search-match-case', $(e.currentTarget).is(':checked')); Common.SharedSettings.set('search-match-case', $(e.currentTarget).is(':checked'));
}, },

View file

@ -95,6 +95,29 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="content-block-title"><%= scope.textSearchBy %></div>
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="search-by" value="rows">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textByRows %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="search-by" value="columns">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textByColumns %></div>
</div>
</label>
</li>
</ul>
</div>
<div class="list-block"> <div class="list-block">
<ul> <ul>
<li> <li>

View file

@ -161,6 +161,9 @@ define([
if (Common.SharedSettings.get('search-highlight-res')) { if (Common.SharedSettings.get('search-highlight-res')) {
this.fireEvent('search:highlight', [this, true]); this.fireEvent('search:highlight', [this, true]);
} }
if(Common.SharedSettings.get('search-by') === undefined) {
Common.SharedSettings.set('search-by', 'rows');
}
searchBar = $$('.searchbar.document'); searchBar = $$('.searchbar.document');
@ -209,7 +212,10 @@ define([
textSearchIn: 'Search In', textSearchIn: 'Search In',
textWorkbook: 'Workbook', textWorkbook: 'Workbook',
textSheet: 'Sheet', textSheet: 'Sheet',
textHighlightRes: 'Highlight results' textHighlightRes: 'Highlight results',
textByColumns: 'By columns',
textByRows: 'By rows',
textSearchBy: 'Search'
} }
})(), SSE.Views.Search || {})) })(), SSE.Views.Search || {}))
}); });