Change ComboBoxColor component: show displayValue

This commit is contained in:
Julia Radzhabova 2020-04-16 18:42:54 +03:00
parent f88966764a
commit 04a2b32cc1
3 changed files with 12 additions and 5 deletions

View file

@ -271,7 +271,7 @@ define([
Common.UI.ComboBoxColor = Common.UI.ComboBox.extend(_.extend({
template: _.template([
'<div class="input-group combobox input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="input-group combobox combo-color input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="padding:2px 14px 2px 3px; <%= style %> display: block;">',
'<div style="display: inline-block;overflow: hidden;width: 100%;height: 100%;"></div>',
'</div>',
@ -309,12 +309,13 @@ define([
updateFormControl: function(record) {
var formcontrol = $(this.el).find('.form-control > div');
formcontrol[0].innerHTML = record.get('displayValue');
if (record.get('value')!=-1) {
formcontrol[0].innerHTML = '';
formcontrol.css({'background': '#' + record.get('value'), 'margin-top': '0'});
record.get('displayColor') && formcontrol.css({'color': '#' + record.get('displayColor'), 'text-align': 'center'});
} else {
formcontrol[0].innerHTML = record.get('displayValue');
formcontrol.css({'background': '', 'margin-top': '1px'});
formcontrol.css({'color': '', 'text-align': ''});
}
},

View file

@ -44,3 +44,9 @@
}
}
}
.combo-color {
.form-control:not(input) {
cursor: pointer;
}
}

View file

@ -268,7 +268,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template',
if (item)
color_data.push({
value: Common.Utils.ThemeColor.getHexColor(item.get_r(), item.get_g(), item.get_b()).toLocaleUpperCase(),
displayValue: Common.Utils.ThemeColor.getHexColor(item.get_r(), item.get_g(), item.get_b()).toLocaleUpperCase(),
displayValue: '',
color: item
});
else
@ -555,7 +555,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template',
var value = item ? Common.Utils.ThemeColor.getHexColor(item.get_r(), item.get_g(), item.get_b()).toLocaleUpperCase() : -1,
color_data = {
value: value,
displayValue: item ? value : ((level.cmbSort.getValue()==Asc.c_oAscSortOptions.ByColorFill) ? me.textNone : me.textAuto),
displayValue: item ? '' : ((level.cmbSort.getValue()==Asc.c_oAscSortOptions.ByColorFill) ? me.textNone : me.textAuto),
color: item
};
item ? level.color_data.push(color_data) : level.color_data.unshift(color_data);