commit
3a86a6c41a
|
@ -546,15 +546,15 @@
|
||||||
}
|
}
|
||||||
&.search-close {
|
&.search-close {
|
||||||
background-position: -@icon-width*18 0;
|
background-position: -@icon-width*18 0;
|
||||||
}
|
background-position: -@icon-width*18 @icon-normal-top;
|
||||||
&.search {
|
|
||||||
background-position: -@icon-width*24 0;
|
|
||||||
}
|
}
|
||||||
&.search-arrow-up {
|
&.search-arrow-up {
|
||||||
background-position: -@icon-width*27 0;
|
background-position: -@icon-width*27 0;
|
||||||
|
background-position: -@icon-width*27 @icon-normal-top;
|
||||||
}
|
}
|
||||||
&.search-arrow-down {
|
&.search-arrow-down {
|
||||||
background-position: -@icon-width*28 0;
|
background-position: -@icon-width*28 0;
|
||||||
|
background-position: -@icon-width*28 @icon-normal-top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMouseDown: function(e) {
|
onItemMouseDown: function(e) {
|
||||||
Common.UI.HintManager.clearHints();
|
Common.UI.HintManager && Common.UI.HintManager.clearHints();
|
||||||
if (e.which != 1) {
|
if (e.which != 1) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -185,7 +185,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableNavButtons: function (resultNumber, allResults) {
|
disableNavButtons: function (resultNumber, allResults) {
|
||||||
var disable = this.inputSearch.val() === '' || !allResults;
|
var disable = (this.inputSearch.val() === '' && !window.SSE) || !allResults;
|
||||||
this.btnBack.setDisabled(disable);
|
this.btnBack.setDisabled(disable);
|
||||||
this.btnNext.setDisabled(disable);
|
this.btnNext.setDisabled(disable);
|
||||||
},
|
},
|
||||||
|
|
|
@ -375,7 +375,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableNavButtons: function (resultNumber, allResults) {
|
disableNavButtons: function (resultNumber, allResults) {
|
||||||
var disable = this.inputText._input.val() === '' || !allResults;
|
var disable = (this.inputText._input.val() === '' && !window.SSE) || !allResults;
|
||||||
this.btnBack.setDisabled(disable);
|
this.btnBack.setDisabled(disable);
|
||||||
this.btnNext.setDisabled(disable);
|
this.btnNext.setDisabled(disable);
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,7 +80,7 @@ define([
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this._state = {
|
this._state = {
|
||||||
searchText: '',
|
searchText: undefined,
|
||||||
matchCase: false,
|
matchCase: false,
|
||||||
matchWord: false,
|
matchWord: false,
|
||||||
useRegExp: false,
|
useRegExp: false,
|
||||||
|
@ -106,6 +106,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onGetTextAroundSearchPack', _.bind(this.onApiGetTextAroundSearch, this));
|
this.api.asc_registerCallback('asc_onGetTextAroundSearchPack', _.bind(this.onApiGetTextAroundSearch, this));
|
||||||
this.api.asc_registerCallback('asc_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this));
|
this.api.asc_registerCallback('asc_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this));
|
||||||
this.api.asc_registerCallback('asc_onSearchEnd', _.bind(this.onApiSearchEnd, this));
|
this.api.asc_registerCallback('asc_onSearchEnd', _.bind(this.onApiSearchEnd, this));
|
||||||
|
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onActiveSheetChanged, this));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -158,7 +159,7 @@ define([
|
||||||
this._state.lookInFormulas = value;
|
this._state.lookInFormulas = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (runSearch && this._state.searchText) {
|
if (runSearch) {
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
if (this.onQuerySearch()) {
|
if (this.onQuerySearch()) {
|
||||||
this.searchTimer && clearInterval(this.searchTimer);
|
this.searchTimer && clearInterval(this.searchTimer);
|
||||||
|
@ -196,7 +197,7 @@ define([
|
||||||
|
|
||||||
onSearchNext: function (type, text, e) {
|
onSearchNext: function (type, text, e) {
|
||||||
var isReturnKey = type === 'keydown' && e.keyCode === Common.UI.Keys.RETURN;
|
var isReturnKey = type === 'keydown' && e.keyCode === Common.UI.Keys.RETURN;
|
||||||
if (text && text.length > 0 && (isReturnKey || type !== 'keydown')) {
|
if (isReturnKey || type !== 'keydown') {
|
||||||
this._state.searchText = text;
|
this._state.searchText = text;
|
||||||
if (this.onQuerySearch(type) && (this.searchTimer || isReturnKey)) {
|
if (this.onQuerySearch(type) && (this.searchTimer || isReturnKey)) {
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
|
@ -222,15 +223,14 @@ define([
|
||||||
|
|
||||||
me.hideResults();
|
me.hideResults();
|
||||||
me._state.searchText = me._state.newSearchText;
|
me._state.searchText = me._state.newSearchText;
|
||||||
if (me._state.newSearchText !== '' && me.onQuerySearch()) {
|
if (me.onQuerySearch()) {
|
||||||
if (me.view.$el.is(':visible')) {
|
if (me.view.$el.is(':visible')) {
|
||||||
me.api.asc_StartTextAroundSearch();
|
me.api.asc_StartTextAroundSearch();
|
||||||
}
|
}
|
||||||
//me.view.disableReplaceButtons(false);
|
|
||||||
} else if (me._state.newSearchText === '') {
|
} else if (me._state.newSearchText === '') {
|
||||||
me.view.updateResultsNumber('no-results');
|
me.view.updateResultsNumber('no-results');
|
||||||
me.view.disableNavButtons();
|
me.view.disableNavButtons();
|
||||||
//me.view.disableReplaceButtons(true);
|
Common.NotificationCenter.trigger('search:updateresults', undefined, 0);
|
||||||
}
|
}
|
||||||
clearInterval(me.searchTimer);
|
clearInterval(me.searchTimer);
|
||||||
me.searchTimer = undefined;
|
me.searchTimer = undefined;
|
||||||
|
@ -239,7 +239,7 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onQuerySearch: function (d, w, opts, fromPanel) {
|
onQuerySearch: function (d, isNeedRecalc) {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (this._state.withinSheet === Asc.c_oAscSearchBy.Range && !this._state.isValidSelectedRange) {
|
if (this._state.withinSheet === Asc.c_oAscSearchBy.Range && !this._state.isValidSelectedRange) {
|
||||||
Common.UI.warning({
|
Common.UI.warning({
|
||||||
|
@ -264,13 +264,14 @@ define([
|
||||||
}
|
}
|
||||||
options.asc_setScanByRows(this._state.searchByRows);
|
options.asc_setScanByRows(this._state.searchByRows);
|
||||||
options.asc_setLookIn(this._state.lookInFormulas ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value);
|
options.asc_setLookIn(this._state.lookInFormulas ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value);
|
||||||
|
options.asc_setNeedRecalc(isNeedRecalc);
|
||||||
if (!this.api.asc_findText(options)) {
|
if (!this.api.asc_findText(options)) {
|
||||||
this.resultItems = [];
|
this.resultItems = [];
|
||||||
this.view.updateResultsNumber(undefined, 0);
|
this.view.updateResultsNumber(undefined, 0);
|
||||||
//this.view.disableReplaceButtons(true);
|
|
||||||
this._state.currentResult = 0;
|
this._state.currentResult = 0;
|
||||||
this._state.resultsNumber = 0;
|
this._state.resultsNumber = 0;
|
||||||
this.view.disableNavButtons();
|
this.view.disableNavButtons();
|
||||||
|
Common.NotificationCenter.trigger('search:updateresults', undefined, 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -348,10 +349,10 @@ define([
|
||||||
this.resultItems = [];
|
this.resultItems = [];
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
|
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
|
||||||
//this.view.disableReplaceButtons(true);
|
|
||||||
this._state.currentResult = 0;
|
this._state.currentResult = 0;
|
||||||
this._state.resultsNumber = 0;
|
this._state.resultsNumber = 0;
|
||||||
this.view.disableNavButtons();
|
this.view.disableNavButtons();
|
||||||
|
Common.NotificationCenter.trigger('search:updateresults', undefined, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiRemoveTextAroundSearch: function (arr) {
|
onApiRemoveTextAroundSearch: function (arr) {
|
||||||
|
@ -482,7 +483,8 @@ define([
|
||||||
|
|
||||||
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText);
|
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText);
|
||||||
if (this.resultItems && this.resultItems.length > 0 &&
|
if (this.resultItems && this.resultItems.length > 0 &&
|
||||||
(!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||
|
(!text && !this.view.inputText.getValue() ||
|
||||||
|
!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||
|
||||||
this._state.matchCase && text === this.view.inputText.getValue())) { // show old results
|
this._state.matchCase && text === this.view.inputText.getValue())) { // show old results
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -494,14 +496,12 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
if (text && text !== '' && text === this._state.searchText) { // search was made
|
if (this._state.searchText !== undefined && text === this._state.searchText) { // search was made
|
||||||
//this.view.disableReplaceButtons(false);
|
|
||||||
this.api.asc_StartTextAroundSearch();
|
this.api.asc_StartTextAroundSearch();
|
||||||
} else if (text && text !== '') { // search wasn't made
|
} else if (this._state.searchText !== undefined) { // search wasn't made
|
||||||
this.onInputSearchChange(text);
|
this.onInputSearchChange(text);
|
||||||
} else {
|
} else {
|
||||||
this.resultItems = [];
|
this.resultItems = [];
|
||||||
//this.view.disableReplaceButtons(true);
|
|
||||||
this.view.clearResultsNumber();
|
this.view.clearResultsNumber();
|
||||||
}
|
}
|
||||||
this.view.disableNavButtons(this._state.currentResult, this._state.resultsNumber);
|
this.view.disableNavButtons(this._state.currentResult, this._state.resultsNumber);
|
||||||
|
@ -547,6 +547,17 @@ define([
|
||||||
this.removeResultItems('stop');
|
this.removeResultItems('stop');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onActiveSheetChanged: function (index) {
|
||||||
|
if (this._state.isHighlightedResults && this._state.withinSheet === Asc.c_oAscSearchBy.Sheet) {
|
||||||
|
this.hideResults();
|
||||||
|
if (this.onQuerySearch(undefined, true)) {
|
||||||
|
this.searchTimer && clearInterval(this.searchTimer);
|
||||||
|
this.searchTimer = undefined;
|
||||||
|
this.api.asc_StartTextAroundSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.',
|
textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.',
|
||||||
textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced',
|
textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced',
|
||||||
textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.',
|
textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.',
|
||||||
|
|
Loading…
Reference in a new issue