[DE PE] Make new search: add Whole words only, change get/put methods in controllers

This commit is contained in:
JuliaSvinareva 2022-03-09 17:39:03 +03:00
parent 37b0fd88d3
commit e77f9db33d
3 changed files with 41 additions and 16 deletions

View file

@ -128,6 +128,15 @@ define([
dataHintOffset: 'small'
});
this.chMatchWord = new Common.UI.CheckBox({
el: $('#search-adv-match-word'),
labelText: window.SSE ? this.textItemEntireCell : this.textWholeWords,
value: false,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.buttonClose = new Common.UI.Button({
parentEl: $('#search-btn-close', this.$el),
cls: 'btn-toolbar',
@ -137,15 +146,6 @@ define([
this.buttonClose.on('click', _.bind(this.onClickClosePanel, this));
if (window.SSE) {
this.chMatchWord = new Common.UI.CheckBox({
el: $('#search-adv-match-word'),
labelText: this.options.matchwordstr || this.textWholeWords,
value: false,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.cmbWithin = new Common.UI.ComboBox({
el: $('#search-adv-cmb-within'),
menuStyle: 'min-width: 100%;',
@ -303,7 +303,8 @@ define([
textValues: 'Values',
textSearchOptions: 'Search options',
textNoMatches: 'No matches',
textNoSearchResults: 'No search results'
textNoSearchResults: 'No search results',
textItemEntireCell: 'Entire cell contents'
}, Common.Views.SearchPanel || {}));
});

View file

@ -89,7 +89,11 @@ define([
onQuerySearch: function (d, w, opts) {
if (opts.textsearch && opts.textsearch.length) {
if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase)) {
var searchSettings = new AscCommon.CSearchSettings();
searchSettings.put_Text(opts.textsearch);
searchSettings.put_MatchCase(opts.matchcase);
searchSettings.put_WholeWords(opts.matchword);
if (!this.api.asc_findText(searchSettings, d != 'back')) {
var me = this;
me.view.updateResultsNumber(undefined, 0);
Common.UI.info({
@ -104,7 +108,11 @@ define([
onQueryReplace: function(w, opts) {
if (!_.isEmpty(opts.textsearch)) {
if (!this.api.asc_replaceText(opts.textsearch, opts.textreplace, false, opts.matchcase)) {
var searchSettings = new AscCommon.CSearchSettings();
searchSettings.put_Text(opts.textsearch);
searchSettings.put_MatchCase(opts.matchcase);
searchSettings.put_WholeWords(opts.matchword);
if (!this.api.asc_replaceText(searchSettings, opts.textreplace, false)) {
var me = this;
me.view.updateResultsNumber(undefined, 0);
Common.UI.info({
@ -119,7 +127,11 @@ define([
onQueryReplaceAll: function(w, opts) {
if (!_.isEmpty(opts.textsearch)) {
this.api.asc_replaceText(opts.textsearch, opts.textreplace, true, opts.matchcase, opts.matchword);
var searchSettings = new AscCommon.CSearchSettings();
searchSettings.put_Text(opts.textsearch);
searchSettings.put_MatchCase(opts.matchcase);
searchSettings.put_WholeWords(opts.matchword);
this.api.asc_replaceText(searchSettings, opts.textreplace, true);
}
},

View file

@ -89,7 +89,11 @@ define([
onQuerySearch: function (d, w, opts) {
if (opts.textsearch && opts.textsearch.length) {
if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase)) {
var searchSettings = new AscCommon.CSearchSettings();
searchSettings.put_Text(opts.textsearch);
searchSettings.put_MatchCase(opts.matchcase);
searchSettings.put_WholeWords(opts.matchword);
if (!this.api.asc_findText(searchSettings, d != 'back')) {
var me = this;
me.view.updateResultsNumber(undefined, 0);
Common.UI.info({
@ -104,7 +108,11 @@ define([
onQueryReplace: function(w, opts) {
if (!_.isEmpty(opts.textsearch)) {
if (!this.api.asc_replaceText(opts.textsearch, opts.textreplace, false, opts.matchcase)) {
var searchSettings = new AscCommon.CSearchSettings();
searchSettings.put_Text(opts.textsearch);
searchSettings.put_MatchCase(opts.matchcase);
searchSettings.put_WholeWords(opts.matchword);
if (!this.api.asc_replaceText(searchSettings, opts.textreplace, false)) {
var me = this;
me.view.updateResultsNumber(undefined, 0);
Common.UI.info({
@ -119,7 +127,11 @@ define([
onQueryReplaceAll: function(w, opts) {
if (!_.isEmpty(opts.textsearch)) {
this.api.asc_replaceText(opts.textsearch, opts.textreplace, true, opts.matchcase);
var searchSettings = new AscCommon.CSearchSettings();
searchSettings.put_Text(opts.textsearch);
searchSettings.put_MatchCase(opts.matchcase);
searchSettings.put_WholeWords(opts.matchword);
this.api.asc_replaceText(searchSettings, opts.textreplace, true);
}
},