[forms] Make search

This commit is contained in:
JuliaSvinareva 2022-06-09 00:07:07 +03:00
parent 393a5fb7ee
commit 8955051b35
6 changed files with 60 additions and 40 deletions

View file

@ -1,4 +1,4 @@
<svg width="540" height="40" viewBox="0 0 540 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="580" height="40" viewBox="0 0 580 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="icon-menu-sprite Embedded Viewer">
<g id="view-settings">
<path id="Vector" d="M17 26H3V27H17V26Z" fill="white"/>
@ -204,5 +204,17 @@
<path id="Subtract_2" fill-rule="evenodd" clip-rule="evenodd" d="M530.948 26.052C530.638 26.0177 530.321 26 530 26C526.91 26 524.243 27.6351 523 30C523.439 30.8356 524.056 31.5801 524.807 32.1935L525.518 31.4821C524.979 31.055 524.519 30.5539 524.158 30C525.311 28.2309 527.473 27 530 27C530 27 530 27 530 27L530.948 26.052ZM530 33C532.527 32.9999 534.689 31.769 535.842 30C535.481 29.4463 535.021 28.9453 534.482 28.5182L535.194 27.8068C535.944 28.4202 536.561 29.1646 537 30C535.757 32.3649 533.09 34 530 34C529.679 34 529.363 33.9824 529.052 33.9481L530 33Z" fill="white"/>
<path id="Vector 169_2" d="M525 35L535 25" stroke="white"/>
</g>
<g id="arrow-up">
<path id="Union_4" fill-rule="evenodd" clip-rule="evenodd" d="M550 6.29297L550.354 6.64652L555.854 12.1465L555.146 12.8536L550 7.70718L544.854 12.8536L544.146 12.1465L549.646 6.64652L550 6.29297Z" fill="black"/>
</g>
<g id="arrow-up_2">
<path id="Union_3" fill-rule="evenodd" clip-rule="evenodd" d="M550 26.293L550.354 26.6465L555.854 32.1465L555.146 32.8536L550 27.7072L544.854 32.8536L544.146 32.1465L549.646 26.6465L550 26.293Z" fill="white"/>
</g>
<g id="arrow-down">
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M570 13.7071L570.354 13.3536L575.854 7.85359L575.146 7.14648L570 12.2929L564.854 7.14648L564.146 7.85359L569.646 13.3536L570 13.7071Z" fill="black"/>
</g>
<g id="arrow-down_2">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M570 33.7071L570.354 33.3536L575.854 27.8536L575.146 27.1465L570 32.2929L564.854 27.1465L564.146 27.8536L569.646 33.3536L570 33.7071Z" fill="white"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -440,7 +440,7 @@
.svg-icon {
background: data-uri('../../../../common/forms/resources/img/icon-menu-sprite.svg') no-repeat;
background-size: @icon-width*27 @icon-height*2;
background-size: @icon-width*29 @icon-height*2;
&.download {
background-position: -@icon-width 0;
@ -544,6 +544,18 @@
background-position: -@icon-width*26 0;
background-position: -@icon-width*26 @icon-normal-top;
}
&.search-close {
background-position: -@icon-width*18 0;
}
&.search {
background-position: -@icon-width*24 0;
}
&.search-arrow-up {
background-position: -@icon-width*27 0;
}
&.search-arrow-down {
background-position: -@icon-width*28 0;
}
}
.btn {

View file

@ -71,6 +71,7 @@ define([
].join('');
this.options.tpl = _.template(this.template)(this.options);
this.iconType = this.options.iconType;
Common.UI.Window.prototype.initialize.call(this, this.options);
@ -92,7 +93,7 @@ define([
this.btnBack = new Common.UI.Button({
parentEl: $('#search-bar-back'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-arrow-up',
iconCls: this.iconType === 'svg' ? 'svg-icon search-arrow-up' : 'toolbar__icon btn-arrow-up',
hint: this.tipPreviousResult
});
this.btnBack.on('click', _.bind(this.onBtnNextClick, this, 'back'));
@ -100,7 +101,7 @@ define([
this.btnNext = new Common.UI.Button({
parentEl: $('#search-bar-next'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-arrow-down',
iconCls: this.iconType === 'svg' ? 'svg-icon search-arrow-down' : 'toolbar__icon btn-arrow-down',
hint: this.tipNextResult
});
this.btnNext.on('click', _.bind(this.onBtnNextClick, this, 'next'));
@ -118,7 +119,7 @@ define([
this.btnClose = new Common.UI.Button({
parentEl: $('#search-bar-close'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-close',
iconCls: this.iconType === 'svg' ? 'svg-icon search-close' : 'toolbar__icon btn-close',
hint: this.tipCloseSearch
});
this.btnClose.on('click', _.bind(function () {

View file

@ -1481,51 +1481,46 @@ define([
menuItems = this.view.btnOptions.menu.items,
itemsCount = menuItems.length-4;
var initMenu = function(menu) {
var last;
// print
if (!menuItems[0].isVisible())
menuItems[1].setVisible(false);
else
last = menuItems[1];
var last; // divider item
// download
if (!menuItems[2].isVisible() && !menuItems[3].isVisible() && !menuItems[4].isVisible())
menuItems[5].setVisible(false);
// download and print
if (!menuItems[0].isVisible() && !menuItems[1].isVisible() && !menuItems[2].isVisible() && !menuItems[3].isVisible())
menuItems[4].setVisible(false);
else
last = menuItems[5];
last = menuItems[4];
// theme and zoom
if (!menuItems[6].isVisible() && !menuItems[7].isVisible())
menuItems[8].setVisible(false);
if (!menuItems[7].isVisible() && !menuItems[8].isVisible())
menuItems[9].setVisible(false);
else
last = menuItems[8];
last = menuItems[9];
// share, location
if (!menuItems[9].isVisible() && !menuItems[10].isVisible())
menuItems[11].setVisible(false);
if (!menuItems[10].isVisible() && !menuItems[11].isVisible())
menuItems[12].setVisible(false);
else
last = menuItems[11];
last = menuItems[12];
// embed, fullscreen
if (!menuItems[12].isVisible() && !menuItems[13].isVisible())
if (!menuItems[13].isVisible() && !menuItems[14].isVisible())
last && last.setVisible(false);
menu.off('show:after', initMenu);
};
if (!this.appOptions.canPrint) {
menuItems[0].setVisible(false);
menuItems[3].setVisible(false);
itemsCount--;
}
if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.isOFORM) {
menuItems[2].setVisible(false);
menuItems[0].setVisible(false);
itemsCount--;
}
if ( !this.appOptions.isOFORM || !this.appOptions.canDownload || this.appOptions.isOffline) {
menuItems[3].setVisible(false);
menuItems[4].setVisible(false);
menuItems[1].setVisible(false);
menuItems[2].setVisible(false);
itemsCount -= 2;
}
@ -1542,7 +1537,7 @@ define([
}
}
if (this.view.mnuThemes.items.length<1) {
menuItems[6].setVisible(false);
menuItems[7].setVisible(false);
itemsCount--;
} else {
this.view.menuItemsDarkMode = new Common.UI.MenuItem({
@ -1560,22 +1555,22 @@ define([
}
if ( !this.embedConfig.shareUrl || this.appOptions.isOFORM) {
menuItems[9].setVisible(false);
itemsCount--;
}
if (!this.appOptions.canBackToFolder) {
menuItems[10].setVisible(false);
itemsCount--;
}
if (!this.appOptions.canBackToFolder) {
menuItems[11].setVisible(false);
itemsCount--;
}
if ( !this.embedConfig.embedUrl || this.appOptions.isOFORM) {
menuItems[12].setVisible(false);
menuItems[13].setVisible(false);
itemsCount--;
}
if ( !this.embedConfig.fullscreenUrl || this.appOptions.isOFORM) {
menuItems[13].setVisible(false);
menuItems[14].setVisible(false);
itemsCount--;
}
if (itemsCount<1)
@ -1828,10 +1823,10 @@ define([
this.view && this.view.btnDownload.setDisabled(true);
this.view && this.view.btnSubmit.setDisabled(true);
if (this.view && this.view.btnOptions && this.view.btnOptions.menu) {
this.view.btnOptions.menu.items[0].setDisabled(true); // print
this.view.btnOptions.menu.items[2].setDisabled(true); // download
this.view.btnOptions.menu.items[3].setDisabled(true); // download docx
this.view.btnOptions.menu.items[4].setDisabled(true); // download pdf
this.view.btnOptions.menu.items[3].setDisabled(true); // print
this.view.btnOptions.menu.items[0].setDisabled(true); // download
this.view.btnOptions.menu.items[1].setDisabled(true); // download docx
this.view.btnOptions.menu.items[2].setDisabled(true); // download pdf
}
}
},

View file

@ -71,7 +71,8 @@ define([
if (!this.searchBar) {
this.searchBar = new Common.UI.SearchBar({
showOpenPanel: false,
width: 303
width: 303,
iconType: 'svg',
});
this.searchBar.on({
'search:back': _.bind(this.onSearchNext, this, 'back'),

View file

@ -543,7 +543,6 @@ PE.ApplicationController = new(function(){
}
function onError(id, level, errData) {
if (id === -82) return;
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
$('#id-critical-error-title').text(me.criticalErrorTitle);
$('#id-critical-error-message').text(me.scriptLoadError);