diff --git a/apps/common/embed/lib/view/SearchBar.js b/apps/common/embed/lib/view/SearchBar.js new file mode 100644 index 000000000..7800e132b --- /dev/null +++ b/apps/common/embed/lib/view/SearchBar.js @@ -0,0 +1,77 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * SearchBar.js + * + * Created by Julia Svinareva on 27.04.2022 + * Copyright (c) 2022 Ascensio System SIA. All rights reserved. + * + */ + +!window.common && (window.common = {}); +!common.view && (common.view = {}); +common.view.SearchBar = new(function() { + var tpl = ''; + var tplBody = '' + + '
' + + '' + + '' + + '' + + '
'; + + return { + create: function(parent) { + !parent && (parent = 'body'); + + var _$dlg = $(tpl + .replace(/\{body}/, tplBody) + .replace(/\{textFind}/, this.textFind)) + .appendTo(parent) + .attr('id', 'dlg-search'); + + return _$dlg; + }, + + disableNavButtons: function (resultNumber, allResults) { + var disable = $('#search-bar-text').val() === ''; + $('#search-bar-back').attr({disabled: disable || !allResults || resultNumber === 0}); + $('#search-bar-next').attr({disabled: disable || resultNumber + 1 === allResults}); + }, + + textFind: 'Find' + + }; +})(); \ No newline at end of file diff --git a/apps/common/embed/resources/img/icon-menu-sprite.svg b/apps/common/embed/resources/img/icon-menu-sprite.svg index 97b51fd3e..c04600809 100644 --- a/apps/common/embed/resources/img/icon-menu-sprite.svg +++ b/apps/common/embed/resources/img/icon-menu-sprite.svg @@ -1,4 +1,4 @@ - + @@ -148,5 +148,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/apps/common/embed/resources/less/common.less b/apps/common/embed/resources/less/common.less index 1d6c7bbf0..5d588ee1d 100644 --- a/apps/common/embed/resources/less/common.less +++ b/apps/common/embed/resources/less/common.less @@ -503,7 +503,7 @@ @icon-height: 20px; .svg-icon { background: data-uri('../../../../common/embed/resources/img/icon-menu-sprite.svg') no-repeat; - background-size: @icon-width*19 @icon-height*2; + background-size: @icon-width*22 @icon-height*2; &.download { background-position: -@icon-width 0; @@ -557,6 +557,18 @@ &.more-vertical { background-position: -@icon-width*14 0; } + &.search-close { + background-position: -@icon-width*18 0; + } + &.search { + background-position: -@icon-width*19 0; + } + &.search-arrow-up { + background-position: -@icon-width*20 0; + } + &.search-arrow-down { + background-position: -@icon-width*21 0; + } } .mi-icon { @@ -785,4 +797,73 @@ font-weight: normal; } } +} + +#id-search { + button.active { + background-color: @btnActiveColor !important; + background-position: -@icon-width*19 -@icon-height; + } +} + +.search-window { + width: 301px; + height: 54px; + z-index: 50; + position: fixed; + + box-shadow: 0 5px 15px rgba(0,0,0,0.2); + border-radius: 5px; + border: solid 1px #CBCBCB; + + .body { + width: 100%; + height: 100%; + border-radius: 5px; + background-color: #FFFFFF; + display: flex; + padding: 16px; + + input { + width: 192px; + height: 22px; + border-radius: 2px; + box-shadow: none; + border: solid 1px #CFCFCF; + padding: 1px 3px; + color: #444444; + font-size: 11px; + + &::placeholder { + color: #CFCFCF; + } + + &:focus { + border-color: #848484; + outline: 0; + } + } + + .tools { + display: flex; + + button { + border: none; + margin-left: 7px; + cursor: pointer; + width: 20px; + height: 20px; + opacity: 0.8; + + &:hover:not(:disabled) { + background-color: #d8dadc; + } + + &:disabled { + opacity: 0.4; + cursor: default; + } + } + } + } } \ No newline at end of file diff --git a/apps/common/main/lib/component/InputField.js b/apps/common/main/lib/component/InputField.js index f1cf1bc52..6fed5ad58 100644 --- a/apps/common/main/lib/component/InputField.js +++ b/apps/common/main/lib/component/InputField.js @@ -444,6 +444,9 @@ define([ 'class="form-control <%= cls %>" ', 'placeholder="<%= placeHolder %>" ', 'value="<%= value %>"', + 'data-hint="<%= dataHint %>"', + 'data-hint-offset="<%= dataHintOffset %>"', + 'data-hint-direction="<%= dataHintDirection %>"', '>', '', '
' + @@ -464,7 +467,10 @@ define([ name : this.name, placeHolder : this.placeHolder, spellcheck : this.spellcheck, - scope : me + scope : me, + dataHint : this.options.dataHint, + dataHintOffset: this.options.dataHintOffset, + dataHintDirection: this.options.dataHintDirection })); if (parentEl) { diff --git a/apps/common/main/lib/template/SearchPanel.template b/apps/common/main/lib/template/SearchPanel.template new file mode 100644 index 000000000..bdba42b87 --- /dev/null +++ b/apps/common/main/lib/template/SearchPanel.template @@ -0,0 +1,63 @@ + \ No newline at end of file diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 54a2fb61d..7f7fcc26a 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -105,6 +105,7 @@ define([ '
' + '
' + '
' + + '' + '
' + '
' + // '
' + @@ -348,6 +349,9 @@ define([ }); } } + + if (me.btnSearch) + me.btnSearch.updateHint(me.tipSearch + Common.Utils.String.platformKey('Ctrl+F')); } function onFocusDocName(e){ @@ -447,6 +451,15 @@ define([ reset : onResetUsers }); + me.btnSearch = new Common.UI.Button({ + cls: 'btn-header no-caret', + iconCls: 'toolbar__icon icon--inverse btn-menu-search', + enableToggle: true, + dataHint: '0', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + me.btnFavorite = new Common.UI.Button({ id: 'btn-favorite', cls: 'btn-header', @@ -540,6 +553,7 @@ define([ if ( config.canEdit && config.canRequestEditRights ) this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big'); } + me.btnSearch.render($html.find('#slot-btn-search')); if (!config.isEdit || config.customization && !!config.customization.compactHeader) { if (config.user.guest && config.canRenameAnonymous) { @@ -875,6 +889,7 @@ define([ textRemoveFavorite: 'Remove from Favorites', textAddFavorite: 'Mark as favorite', textHideNotes: 'Hide Notes', + tipSearch: 'Search', textShare: 'Share' } }(), Common.Views.Header || {})) diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js new file mode 100644 index 000000000..55b91e303 --- /dev/null +++ b/apps/common/main/lib/view/SearchBar.js @@ -0,0 +1,194 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * +*/ +/** + * SearchBar.js + * + * Created by Julia Svinareva on 03.02.2022 + * Copyright (c) 2022 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/component/Window' +], function () { + 'use strict'; + + Common.UI.SearchBar = Common.UI.Window.extend(_.extend({ + options: { + modal: false, + width: 328, + height: 54, + header: false, + cls: 'search-bar', + alias: 'SearchBar' + }, + + initialize : function(options) { + _.extend(this.options, options || {}); + + this.template = [ + '
', + '', + '
', + '
', + '
', + '
', + '
', + '
', + '
' + ].join(''); + + this.options.tpl = _.template(this.template)(this.options); + + Common.UI.Window.prototype.initialize.call(this, this.options); + + Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this)); + $(window).on('resize', _.bind(this.onLayoutChanged, this)); + }, + + render: function() { + Common.UI.Window.prototype.render.call(this); + + this.inputSearch = this.$window.find('#search-bar-text'); + this.inputSearch.on('input', _.bind(function () { + this.disableNavButtons(); + this.fireEvent('search:input', [this.inputSearch.val()]); + }, this)).on('keydown', _.bind(function (e) { + this.fireEvent('search:keydown', [this.inputSearch.val(), e]); + }, this)); + + this.btnBack = new Common.UI.Button({ + parentEl: $('#search-bar-back'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-up', + hint: this.tipPreviousResult + }); + this.btnBack.on('click', _.bind(this.onBtnNextClick, this, 'back')); + + this.btnNext = new Common.UI.Button({ + parentEl: $('#search-bar-next'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-down', + hint: this.tipNextResult + }); + this.btnNext.on('click', _.bind(this.onBtnNextClick, this, 'next')); + + this.btnOpenPanel = new Common.UI.Button({ + parentEl: $('#search-bar-open-panel'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon more-vertical', + hint: this.tipOpenAdvancedSettings + }); + this.btnOpenPanel.on('click', _.bind(this.onOpenPanel, this)); + + this.btnClose = new Common.UI.Button({ + parentEl: $('#search-bar-close'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-close', + hint: this.tipCloseSearch + }); + this.btnClose.on('click', _.bind(function () { + this.hide(); + }, this)) + + this.on('animate:before', _.bind(this.focus, this)); + + Common.NotificationCenter.on('search:updateresults', _.bind(this.disableNavButtons, this)); + + return this; + }, + + show: function(text) { + var top = $('#app-title').height() + $('#toolbar').height() + 2, + left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32; + Common.UI.Window.prototype.show.call(this, left, top); + + if (text) { + this.inputSearch.val(text); + this.fireEvent('search:input', [text]); + } else { + this.inputSearch.val(''); + } + + this.disableNavButtons(); + this.focus(); + }, + + focus: function() { + var me = this; + setTimeout(function(){ + me.inputSearch.focus(); + me.inputSearch.select(); + }, 10); + }, + + setText: function (text) { + this.inputSearch.val(text); + this.fireEvent('search:input', [text]); + }, + + getSettings: function() { + return { + + }; + }, + + onLayoutChanged: function () { + var top = $('#app-title').height() + $('#toolbar').height() + 2, + left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32; + this.$window.css({left: left, top: top}); + }, + + onBtnNextClick: function(action) { + this.fireEvent('search:'+action, [this.inputSearch.val(), false]); + }, + + onOpenPanel: function () { + this.hide(); + this.fireEvent('search:show', [true, this.inputSearch.val()]); + }, + + disableNavButtons: function (resultNumber, allResults) { + var disable = this.inputSearch.val() === ''; + this.btnBack.setDisabled(disable || !allResults || resultNumber === 0); + this.btnNext.setDisabled(disable || resultNumber + 1 === allResults); + }, + + textFind: 'Find', + tipPreviousResult: 'Previous result', + tipNextResult: 'Next result', + tipOpenAdvancedSettings: 'Open advanced settings', + tipCloseSearch: 'Close search' + + }, Common.UI.SearchBar || {})); +}); \ No newline at end of file diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js new file mode 100644 index 000000000..1f1d52163 --- /dev/null +++ b/apps/common/main/lib/view/SearchPanel.js @@ -0,0 +1,418 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * +*/ +/** + * User: Julia.Svinareva + * Date: 11.02.2022 + */ + +define([ + 'text!common/main/lib/template/SearchPanel.template', + 'common/main/lib/util/utils', + 'common/main/lib/component/BaseView', + 'common/main/lib/component/Layout' +], function (template) { + 'use strict'; + + Common.Views.SearchPanel = Common.UI.BaseView.extend(_.extend({ + el: '#left-panel-search', + template: _.template(template), + + initialize: function(options) { + _.extend(this, options); + Common.UI.BaseView.prototype.initialize.call(this, arguments); + + this.mode = false; + + window.SSE && (this.extendedOptions = Common.localStorage.getBool('sse-search-options-extended', true)); + }, + + render: function(el) { + var me = this; + if (!this.rendered) { + el = el || this.el; + $(el).html(this.template({ + scope: this + })); + this.$el = $(el); + + this.inputText = new Common.UI.InputField({ + el: $('#search-adv-text'), + placeHolder: this.textFind, + allowBlank: true, + validateOnBlur: false, + style: 'width: 100%;', + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.inputText._input.on('input', _.bind(function () { + this.fireEvent('search:input', [this.inputText._input.val()]); + }, this)).on('keydown', _.bind(function (e) { + this.fireEvent('search:keydown', [this.inputText._input.val(), e]); + }, this)); + + this.inputReplace = new Common.UI.InputField({ + el: $('#search-adv-replace-text'), + placeHolder: this.textReplaceWith, + allowBlank: true, + validateOnBlur: false, + style: 'width: 100%;', + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + + this.btnBack = new Common.UI.Button({ + parentEl: $('#search-adv-back'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-up', + hint: this.tipPreviousResult, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnBack.on('click', _.bind(this.onBtnNextClick, this, 'back')); + + this.btnNext = new Common.UI.Button({ + parentEl: $('#search-adv-next'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-down', + hint: this.tipNextResult, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnNext.on('click', _.bind(this.onBtnNextClick, this, 'next')); + + this.btnReplace = new Common.UI.Button({ + el: $('#search-adv-replace') + }); + this.btnReplace.on('click', _.bind(this.onReplaceClick, this, 'replace')); + + this.btnReplaceAll = new Common.UI.Button({ + el: $('#search-adv-replace-all') + }); + this.btnReplaceAll.on('click', _.bind(this.onReplaceClick, this, 'replaceall')); + + this.$reaultsNumber = $('#search-adv-results-number'); + this.updateResultsNumber('no-results'); + + this.chCaseSensitive = new Common.UI.CheckBox({ + el: $('#search-adv-case-sensitive'), + labelText: this.textCaseSensitive, + value: false, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }).on('change', function(field) { + me.fireEvent('search:options', ['case-sensitive', field.getValue() === 'checked']); + }); + + /*this.chUseRegExp = new Common.UI.CheckBox({ + el: $('#search-adv-use-regexp'), + labelText: this.textMatchUsingRegExp, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }).on('change', function(field) { + me.fireEvent('search:options', ['regexp', field.getValue() === 'checked']); + });*/ + + 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' + }).on('change', function(field) { + me.fireEvent('search:options', ['match-word', field.getValue() === 'checked']); + }); + + this.buttonClose = new Common.UI.Button({ + parentEl: $('#search-btn-close', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-close', + hint: this.textCloseSearch, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'medium' + }); + this.buttonClose.on('click', _.bind(this.onClickClosePanel, this)); + + this.$resultsContainer = $('#search-results'); + this.$resultsContainer.hide(); + + Common.NotificationCenter.on('search:updateresults', _.bind(this.disableNavButtons, this)); + if (window.SSE) { + this.cmbWithin = new Common.UI.ComboBox({ + el: $('#search-adv-cmb-within'), + menuStyle: 'min-width: 100%;', + style: "width: 219px;", + editable: false, + cls: 'input-group-nr', + data: [ + { value: 0, displayValue: this.textSheet }, + { value: 1, displayValue: this.textWorkbook }, + { value: 2, displayValue: this.textSpecificRange} + ], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }).on('selected', function(combo, record) { + me.fireEvent('search:options', ['within', record.value]); + }); + + this.inputSelectRange = new Common.UI.InputFieldBtn({ + el: $('#search-adv-select-range'), + placeHolder: this.textSelectDataRange, + allowBlank: true, + validateOnChange: true, + validateOnBlur: true, + style: "width: 219px; margin-top: 8px", + disabled: true, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }).on('keyup:after', function(input, e) { + me.fireEvent('search:options', ['range', input.getValue(), e.keyCode !== Common.UI.Keys.RETURN]); + }); + + this.cmbSearch = new Common.UI.ComboBox({ + el: $('#search-adv-cmb-search'), + menuStyle: 'min-width: 100%;', + style: "width: 219px;", + editable: false, + cls: 'input-group-nr', + data: [ + { value: 0, displayValue: this.textByRows }, + { value: 1, displayValue: this.textByColumns } + ], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }).on('selected', function(combo, record) { + me.fireEvent('search:options', ['search', !record.value]); + }); + + this.cmbLookIn = new Common.UI.ComboBox({ + el: $('#search-adv-cmb-look-in'), + menuStyle: 'min-width: 100%;', + style: "width: 219px;", + editable: false, + cls: 'input-group-nr', + data: [ + { value: 0, displayValue: this.textFormulas }, + { value: 1, displayValue: this.textValues } + ], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }).on('selected', function(combo, record) { + me.fireEvent('search:options', ['lookIn', !record.value]); + }); + + this.$searchOptionsBlock = $('.search-options-block'); + this.$searchOptionsBlock.show(); + $('#open-search-options').on('click', _.bind(this.expandSearchOptions, this)); + + if (!this.extendedOptions) { + this.$searchOptionsBlock.addClass('no-expand'); + } + + this.cmbWithin.setValue(0); + this.cmbSearch.setValue(0); + this.cmbLookIn.setValue(0); + + var tableTemplate = '
' + + '
' + this.textSheet + '
' + + '
' + this.textName + '
' + + '
' + this.textCell + '
' + + '
' + this.textValue + '
' + + '
' + this.textFormula + '
' + + '
' + + '
', + $resultTable = $(tableTemplate).appendTo(this.$resultsContainer); + this.$resultsContainer.scroller = new Common.UI.Scroller({ + el: $resultTable.find('.search-items'), + includePadding: true, + useKeyboard: true, + minScrollbarLength: 40, + alwaysVisibleY: true + }); + } else { + this.$resultsContainer.scroller = new Common.UI.Scroller({ + el: this.$resultsContainer, + includePadding: true, + useKeyboard: true, + minScrollbarLength: 40, + alwaysVisibleY: true + }); + } + Common.NotificationCenter.on('window:resize', function() { + me.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); + me.$resultsContainer.scroller.update({alwaysVisibleY: true}); + }); + } + + this.rendered = true; + this.trigger('render:after', this); + return this; + }, + + show: function () { + Common.UI.BaseView.prototype.show.call(this,arguments); + this.fireEvent('show', this ); + + this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); + this.$resultsContainer.scroller.update({alwaysVisibleY: true}); + }, + + hide: function () { + Common.UI.BaseView.prototype.hide.call(this,arguments); + this.fireEvent('hide', this ); + }, + + focus: function(type) { + var me = this, + el = type === 'replace' ? me.inputReplace.$el : (type === 'range' ? me.inputSelectRange.$el : me.inputText.$el); + setTimeout(function(){ + el.find('input').focus(); + el.find('input').select(); + }, 10); + }, + + setSearchMode: function (mode) { + if (this.mode !== mode) { + this.$el.find('.edit-setting')[mode !== 'no-replace' ? 'show' : 'hide'](); + this.$el.find('#search-adv-title').text(mode !== 'no-replace' ? this.textFindAndReplace : this.textFind); + this.mode = mode; + } + }, + + ChangeSettings: function(props) { + }, + + updateResultsNumber: function (current, count) { + var text; + if (count > 300) { + text = this.textTooManyResults; + } else { + text = current === 'no-results' ? this.textNoSearchResults : (!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count)); + } + this.$reaultsNumber.text(text); + this.disableReplaceButtons(!count); + }, + + onClickClosePanel: function() { + Common.NotificationCenter.trigger('leftmenu:change', 'hide'); + this.fireEvent('hide', this ); + }, + + onBtnNextClick: function (action) { + this.fireEvent('search:'+action, [this.inputText.getValue(), true]); + }, + + onReplaceClick: function (action) { + this.fireEvent('search:'+action, [this.inputText.getValue(), this.inputReplace.getValue()]); + }, + + getSettings: function() { + return { + textsearch: this.inputText.getValue(), + matchcase: this.chCaseSensitive.checked, + matchword: this.chMatchWord.checked + }; + }, + + expandSearchOptions: function () { + this.extendedOptions = !this.extendedOptions; + this.$searchOptionsBlock[this.extendedOptions ? 'removeClass' : 'addClass']('no-expand'); + Common.localStorage.setBool('sse-search-options-extended', this.extendedOptions); + + this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); + this.$resultsContainer.scroller.update({alwaysVisibleY: true}); + }, + + setFindText: function (val) { + this.inputText.setValue(val); + }, + + clearResultsNumber: function () { + this.updateResultsNumber('no-results'); + }, + + disableNavButtons: function (resultNumber, allResults) { + var disable = this.inputText._input.val() === ''; + this.btnBack.setDisabled(disable || !allResults || resultNumber === 0); + this.btnNext.setDisabled(disable || !allResults || resultNumber + 1 === allResults); + }, + + disableReplaceButtons: function (disable) { + this.btnReplace.setDisabled(disable); + this.btnReplaceAll.setDisabled(disable); + }, + + textFind: 'Find', + textFindAndReplace: 'Find and replace', + textCloseSearch: 'Close search', + textReplace: 'Replace', + textReplaceAll: 'Replace All', + textSearchResults: 'Search results: {0}/{1}', + textReplaceWith: 'Replace with', + textCaseSensitive: 'Case sensitive', + textMatchUsingRegExp: 'Match using regular expressions', + textWholeWords: 'Whole words only', + textWithin: 'Within', + textSelectDataRange: 'Select Data range', + textSearch: 'Search', + textLookIn: 'Look in', + textSheet: 'Sheet', + textWorkbook: 'Workbook', + textSpecificRange: 'Specific range', + textByRows: 'By rows', + textByColumns: 'By columns', + textFormulas: 'Formulas', + textValues: 'Values', + textSearchOptions: 'Search options', + textNoMatches: 'No matches', + textNoSearchResults: 'No search results', + textItemEntireCell: 'Entire cell contents', + textTooManyResults: 'There are too many results to show here', + tipPreviousResult: 'Previous result', + tipNextResult: 'Next result', + textName: 'Name', + textCell: 'Cell', + textValue: 'Value', + textFormula: 'Formula' + + }, Common.Views.SearchPanel || {})); +}); \ No newline at end of file diff --git a/apps/common/main/resources/img/toolbar/1.25x/more-vertical.png b/apps/common/main/resources/img/toolbar/1.25x/more-vertical.png new file mode 100644 index 000000000..2abea9e3f Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1.25x/more-vertical.png differ diff --git a/apps/common/main/resources/img/toolbar/1.5x/more-vertical.png b/apps/common/main/resources/img/toolbar/1.5x/more-vertical.png new file mode 100644 index 000000000..44d1c6f79 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1.5x/more-vertical.png differ diff --git a/apps/common/main/resources/img/toolbar/1.75x/more-vertical.png b/apps/common/main/resources/img/toolbar/1.75x/more-vertical.png new file mode 100644 index 000000000..a9158bfc4 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1.75x/more-vertical.png differ diff --git a/apps/common/main/resources/img/toolbar/1x/more-vertical.png b/apps/common/main/resources/img/toolbar/1x/more-vertical.png new file mode 100644 index 000000000..07d127a25 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1x/more-vertical.png differ diff --git a/apps/common/main/resources/img/toolbar/2x/more-vertical.png b/apps/common/main/resources/img/toolbar/2x/more-vertical.png new file mode 100644 index 000000000..b2338321d Binary files /dev/null and b/apps/common/main/resources/img/toolbar/2x/more-vertical.png differ diff --git a/apps/common/main/resources/less/common.less b/apps/common/main/resources/less/common.less index d4fb2bef7..0ec08f6e4 100644 --- a/apps/common/main/resources/less/common.less +++ b/apps/common/main/resources/less/common.less @@ -92,6 +92,10 @@ label { #left-panel-comments { height: 100%; } + + #left-panel-search { + height: 100%; + } } .right-panel { diff --git a/apps/common/main/resources/less/searchdialog.less b/apps/common/main/resources/less/searchdialog.less index 322fb7845..8e0ec2cab 100644 --- a/apps/common/main/resources/less/searchdialog.less +++ b/apps/common/main/resources/less/searchdialog.less @@ -80,4 +80,164 @@ } } } +} + +.search-bar { + z-index: 950; + .box { + padding: 16px; + display: flex; + input[type=text] { + width: 192px; + } + .tools { + display: flex; + align-items: center; + div { + margin-left: 5px; + &:first-of-type { + margin-left: 7px; + } + } + } + } +} + +.search-panel { + display: table; + position: relative; + border-collapse: collapse; + line-height: 15px; + + > div { + display: table-row; + } + + #search-header { + position: absolute; + height: 45px; + left: 0; + top: 0; + right: 0; + padding: 12px; + overflow: hidden; + border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie; + border-bottom: @scaled-one-px-value solid @border-toolbar; + + label { + font-size: 12px; + .font-weight-bold(); + margin-top: 2px; + } + + #search-btn-close { + float: right; + } + } + + #search-adv-settings { + position: absolute; + left: 0; + right: 0; + top: 45px; + padding: 10px 15px 0 15px; + + table { + width: 100%; + } + + .padding-small { + padding-bottom: 8px; + } + + .padding-large { + padding-bottom: 14px; + } + + #search-adv-results-number { + padding-top: 2px; + width: calc(100% - 48px); + color: @text-secondary-ie; + color: @text-secondary; + } + } + + .search-options-block { + display: none; + } + + #open-search-options { + cursor: pointer; + margin-left: 15px; + + .search-options-txt { + display: inline-block; + padding: 5px 0; + } + + .search-options-caret { + width: 24px; + height: 24px; + background-position: 3px -270px; + display: inline-block; + position: absolute; + left: 0; + cursor: pointer; + margin-left: 8px; + } + + } + + #search-options { + + label { + margin-top: 6px; + &:not(:first-of-type) { + margin-top: 8px; + } + } + } + + .no-expand { + #search-options { + display: none; + } + .search-options-caret { + transform: rotate(270deg); + } + } + + #search-results { + position: absolute; + left: 0; + right: 0; + bottom: 0; + width: 100%; + border-top: @scaled-one-px-value-ie solid @border-toolbar-ie; + border-top: @scaled-one-px-value solid @border-toolbar; + padding: 12px 0; + overflow: hidden; + + .item { + padding: 6px 15px; + word-break: break-all; + cursor: pointer; + + &:hover { + background-color: @highlight-button-hover-ie; + background-color: @highlight-button-hover; + } + &.selected { + background-color: @highlight-button-pressed-ie; + background-color: @highlight-button-pressed; + color: @text-normal-pressed-ie; + color: @text-normal-pressed; + } + + b { + font-style: italic; + } + } + } + } \ No newline at end of file diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index b4ba894b1..c6b115212 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -198,6 +198,7 @@
+
of 0
+
of 0