Refactoring

This commit is contained in:
Alexei Koshelev 2022-09-21 23:22:38 +03:00
parent 0b2476ecab
commit 5660dd8cfd
6 changed files with 18 additions and 15 deletions

View file

@ -93,8 +93,8 @@ define([
this.rootHeight = 0;
this.rendered = false;
this.needFillComboView = false;
this.minWidth = this.options.minWidth;
this.autoWidth = this.options.autoWidth;
this.minWidth = this.options.minWidth;
this.autoWidth = this.initAutoWidth = (Common.Utils.isIE10 || Common.Utils.isIE11) ? false : this.options.autoWidth;
this.delayRenderTips = this.options.delayRenderTips || false;
this.itemTemplate = this.options.itemTemplate || _.template([
'<div class="style" id="<%= id %>">',
@ -105,11 +105,6 @@ define([
'</div>'
].join(''));
if(this.autoWidth) {
this.style += ' position:absolute; top:50%; bottom:50%; margin: auto 0; padding-right: 12px;';
}
this.fieldPicker = new Common.UI.DataView({
cls: 'field-picker',
allowScrollbar: false,
@ -297,10 +292,10 @@ define([
autoChangeWidth: function() {
if(this.menuPicker.dataViewItems[0]){
var wrapEl = this.$el;
var wrapWidth = parseFloat(wrapEl.css('width')) - parseFloat(wrapEl.css('padding-left'));
var wrapWidth = wrapEl.width();
var itemEl = this.menuPicker.dataViewItems[0].$el;
var itemWidth = this.itemWidth + parseFloat(itemEl.css('padding-left')) + parseFloat(itemEl.css('padding-left')) + 2 * parseFloat(itemEl.css('border-width'));
var itemWidth = this.itemWidth + parseFloat(itemEl.css('padding-left')) + parseFloat(itemEl.css('padding-right')) + 2 * parseFloat(itemEl.css('border-width'));
var itemMargins = parseFloat(itemEl.css('margin-left')) + parseFloat(itemEl.css('margin-right'));
var fieldPickerEl = this.fieldPicker.$el;
@ -322,6 +317,14 @@ define([
widthCalc = maxWidth;
cmbDataViewEl.css('width', widthCalc);
if(this.initAutoWidth) {
this.initAutoWidth = false;
cmbDataViewEl.css('position', 'absolute');
cmbDataViewEl.css('top', '50%');
cmbDataViewEl.css('bottom', '50%');
cmbDataViewEl.css('margin', 'auto 0');
}
}
},

View file

@ -1483,7 +1483,7 @@ define([
_set.viewFormMode, _set.lostConnect, _set.disableOnStart],
itemWidth: itemWidth,
itemHeight: itemHeight,
style: 'min-width:151px;',
style: 'min-width:139px;',
// hint : this.tipParagraphStyle,
dataHint: '1',
dataHintDirection: 'bottom',

View file

@ -153,7 +153,7 @@
</div>
</section>
<section id="transitions-panel" class="panel" data-tab="transit">
<div class="group flex small" id="transit-field-effects" style="width: 867px; max-width: 867px; min-width: 120px;" data-group-width="867px"></div>
<div class="group flex small" id="transit-field-effects" style="width: 855px; max-width: 855px; min-width: 120px;" data-group-width="855px"></div>
<div class="group small">
<span class="btn-slot text x-huge" id="transit-button-parameters"></span>
@ -189,7 +189,7 @@
</div>
</section>
<section id="animation-panel" class="panel" data-tab="animate">
<div class="group flex small" id="animation-field-effects" style="width: 590px; max-width: 590px; min-width: 220px;" data-group-width="590px"></div>
<div class="group flex small" id="animation-field-effects" style="width: 672px; max-width: 672px; min-width: 220px;" data-group-width="672px"></div>
<div class="group small">
<span class="btn-slot text x-huge" id="animation-button-parameters"></span>
</div>

View file

@ -203,7 +203,7 @@ define([
cls: 'combo-transitions combo-animation',
itemWidth: itemWidth,
itemHeight: itemHeight,
style: 'min-width:201px;',
style: 'min-width:200px;',
itemTemplate: _.template([
'<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + itemWidth + 'px;height: ' + itemHeight + 'px;">',
'<div class = "icon toolbar__icon <%= iconCls %>"></div>',

View file

@ -1058,7 +1058,7 @@ define([
itemWidth: 88,
enableKeyEvents: true,
itemHeight: 40,
style: 'min-width:135px;',
style: 'min-width:123px;',
lock: [_set.themeLock, _set.lostConnect, _set.noSlides],
dataHint: '1',
dataHintDirection: 'bottom',

View file

@ -1303,7 +1303,7 @@ define([
enableKeyEvents : true,
itemWidth : 100,
itemHeight : 20,
style: 'min-width:147px; max-width: 672px;',
style: 'min-width:135px; max-width: 660px;',
groups: new Common.UI.DataViewGroupStore([
{id: 'menu-style-group-custom', caption: this.textCustom },
{id: 'menu-style-group-color', caption: this.textGoodBadAndNeutral },