Skip to content

Commit

Permalink
Merge pull request #3005 from ONLYOFFICE/fix/bugfix
Browse files Browse the repository at this point in the history
Fix filling ComboDataView (fill hidden component)
  • Loading branch information
JuliaRadzhabova authored May 23, 2024
2 parents fafca33 + 196712c commit 938f194
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 13 deletions.
17 changes: 17 additions & 0 deletions apps/common/main/lib/component/ComboDataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ define([
enableKeyEvents : false,
beforeOpenHandler : null,
additionalMenuItems : null,
fillOnChangeVisibility: false,
showLast: true,
minWidth: -1,
dataHint: '',
Expand Down Expand Up @@ -95,6 +96,7 @@ define([
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.fillOnChangeVisibility = this.options.fillOnChangeVisibility || false;
this.itemTemplate = this.options.itemTemplate || _.template([
'<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '" + <% if(typeof imageUrl === "undefined" || imageUrl===null || imageUrl==="") { %> style="visibility: hidden;" <% } %>/>',
Expand Down Expand Up @@ -235,6 +237,20 @@ define([
this.startCheckSize();
},

checkVisibility: function() {
var me = this;
if (!me._timer_visibility) {
me._timer_visibility = setInterval(function() {
if (me.isVisible()) {
clearInterval(me._timer_visibility);
delete me._timer_visibility;
var record = me.menuPicker.getSelectedRec();
record && me.fillComboView(record, !!record, true);
}
}, 500);
}
},

startCheckSize: function() {
var me = this;
me.checkSize();
Expand Down Expand Up @@ -562,6 +578,7 @@ define([
me.resumeEvents();
}
}
me.fillOnChangeVisibility && !me.isVisible() && me.checkVisibility();
return me.fieldPicker.store.models; // return list of visible items
}
}
Expand Down
4 changes: 3 additions & 1 deletion apps/documenteditor/main/app/view/ChartSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ define([
dataHintDirection: 'bottom',
dataHintOffset: 'big',
delayRenderTips: true,
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="item-icon-box" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" ' +
Expand Down Expand Up @@ -738,7 +739,8 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
delayRenderTips: true
delayRenderTips: true,
fillOnChangeVisibility: true
});
this.cmbChartStyle.render($('#chart-combo-style'));
this.cmbChartStyle.openButton.menu.cmpEl.css({
Expand Down
1 change: 1 addition & 0 deletions apps/documenteditor/main/app/view/ImageSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ define([
dataHintDirection: 'bottom',
dataHintOffset: '-10, 0',
delayRenderTips: true,
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="item-icon-box" id="<%= id %>" style="">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" ' +
Expand Down
2 changes: 2 additions & 0 deletions apps/documenteditor/main/app/view/ShapeSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down Expand Up @@ -1811,6 +1812,7 @@ define([
dataHintDirection: 'bottom',
dataHintOffset: 'big',
delayRenderTips: true,
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="item-icon-box" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" ' +
Expand Down
6 changes: 4 additions & 2 deletions apps/documenteditor/main/app/view/TextArtSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTransform.render($('#textart-combo-transform'));
this.cmbTransform.openButton.menu.cmpEl.css({
Expand Down Expand Up @@ -1257,7 +1258,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTextArt.render($('#textart-combo-template'));
this.cmbTextArt.openButton.menu.cmpEl.css({
Expand Down
3 changes: 2 additions & 1 deletion apps/pdfeditor/main/app/view/ChartSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
delayRenderTips: true
delayRenderTips: true,
fillOnChangeVisibility: true
});
this.cmbChartStyle.render($('#chart-combo-style'));
this.cmbChartStyle.openButton.menu.cmpEl.css({
Expand Down
1 change: 1 addition & 0 deletions apps/pdfeditor/main/app/view/ShapeSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down
7 changes: 5 additions & 2 deletions apps/pdfeditor/main/app/view/TextArtSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down Expand Up @@ -1555,7 +1556,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTransform.render($('#textart-combo-transform'));
this.cmbTransform.openButton.menu.cmpEl.css({
Expand Down Expand Up @@ -1699,7 +1701,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTextArt.render($('#textart-combo-template'));
this.cmbTextArt.openButton.menu.cmpEl.css({
Expand Down
1 change: 1 addition & 0 deletions apps/presentationeditor/main/app/view/ChartSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
delayRenderTips: true
});
this.cmbChartStyle.render($('#chart-combo-style'));
Expand Down
1 change: 1 addition & 0 deletions apps/presentationeditor/main/app/view/ShapeSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down
1 change: 1 addition & 0 deletions apps/presentationeditor/main/app/view/SlideSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down
7 changes: 5 additions & 2 deletions apps/presentationeditor/main/app/view/TextArtSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down Expand Up @@ -1555,7 +1556,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTransform.render($('#textart-combo-transform'));
this.cmbTransform.openButton.menu.cmpEl.css({
Expand Down Expand Up @@ -1698,7 +1700,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTextArt.render($('#textart-combo-template'));
this.cmbTextArt.openButton.menu.cmpEl.css({
Expand Down
1 change: 1 addition & 0 deletions apps/spreadsheeteditor/main/app/view/CellSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down
6 changes: 4 additions & 2 deletions apps/spreadsheeteditor/main/app/view/ChartSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,8 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
delayRenderTips: true
delayRenderTips: true,
fillOnChangeVisibility: true
});
this.cmbChartStyle.render($('#chart-combo-style'));
this.cmbChartStyle.openButton.menu.cmpEl.css({
Expand Down Expand Up @@ -1338,7 +1339,8 @@ define([
menuMaxHeight: 272,
enableKeyEvents: true,
cls: 'combo-spark-style',
delayRenderTips: true
delayRenderTips: true,
fillOnChangeVisibility: true
});
this.cmbSparkStyle.render($('#spark-combo-style'));
this.cmbSparkStyle.openButton.menu.cmpEl.css({
Expand Down
1 change: 1 addition & 0 deletions apps/spreadsheeteditor/main/app/view/ShapeSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down
3 changes: 2 additions & 1 deletion apps/spreadsheeteditor/main/app/view/SlicerSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ define([
cls: 'combo-slicer-style',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.btnSlicerStyle.render($('#slicer-btn-style'));
this.btnSlicerStyle.openButton.menu.cmpEl.css({
Expand Down
7 changes: 5 additions & 2 deletions apps/spreadsheeteditor/main/app/view/TextArtSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ define([
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
fillOnChangeVisibility: true,
itemTemplate: _.template([
'<div class="style" id="<%= id %>">',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ',
Expand Down Expand Up @@ -1548,7 +1549,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTransform.render($('#textart-combo-transform'));
this.cmbTransform.openButton.menu.cmpEl.css({
Expand Down Expand Up @@ -1692,7 +1694,8 @@ define([
cls: 'combo-textart',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
dataHintOffset: 'big',
fillOnChangeVisibility: true
});
this.cmbTextArt.render($('#textart-combo-template'));
this.cmbTextArt.openButton.menu.cmpEl.css({
Expand Down

0 comments on commit 938f194

Please sign in to comment.