Merge pull request #283 from ONLYOFFICE/feature/Bug_42429
Feature/bug 42429
This commit is contained in:
commit
8eb9904a72
|
@ -750,6 +750,14 @@
|
||||||
border: 1px solid @input-border;
|
border: 1px solid @input-border;
|
||||||
.border-radius(@border-radius-small);
|
.border-radius(@border-radius-small);
|
||||||
|
|
||||||
|
&.template-table {
|
||||||
|
width: 92px;
|
||||||
|
}
|
||||||
|
&.sheet-template-table {
|
||||||
|
width: 83px;
|
||||||
|
height: 54px;
|
||||||
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
.btn.btnsize(52px);
|
.btn.btnsize(52px);
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=2 class="padding-small">
|
<td colspan=2 class="padding-small">
|
||||||
<div class="" id="table-combo-template" style="width: 100%; height: 64px;"></div>
|
<div class="" id="table-btn-template" style="width: 100%; height: 58px;"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -130,7 +130,7 @@ define([
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTableTemplateSelect: function(combo, record){
|
onTableTemplateSelect: function(btn, picker, itemView, record){
|
||||||
if (this.api && !this._noApply) {
|
if (this.api && !this._noApply) {
|
||||||
var properties = new Asc.CTableProp();
|
var properties = new Asc.CTableProp();
|
||||||
properties.put_TableStyle(record.get('templateId'));
|
properties.put_TableStyle(record.get('templateId'));
|
||||||
|
@ -466,22 +466,21 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
//for table-template
|
//for table-template
|
||||||
value = props.get_TableStyle();
|
value = props.get_TableStyle();
|
||||||
if (this._state.TemplateId!==value || this._isTemplatesChanged) {
|
if (this._state.TemplateId!==value || this._isTemplatesChanged) {
|
||||||
this.cmbTableTemplate.suspendEvents();
|
var rec = this.mnuTableTemplatePicker.store.findWhere({
|
||||||
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
|
|
||||||
templateId: value
|
templateId: value
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.menuPicker.selectRecord(rec);
|
if (!rec) {
|
||||||
this.cmbTableTemplate.resumeEvents();
|
rec = this.mnuTableTemplatePicker.store.at(0);
|
||||||
|
|
||||||
if (this._isTemplatesChanged) {
|
|
||||||
if (rec)
|
|
||||||
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
|
|
||||||
else
|
|
||||||
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
|
|
||||||
}
|
}
|
||||||
this._state.TemplateId=value;
|
this.btnTableTemplate.suspendEvents();
|
||||||
|
this.mnuTableTemplatePicker.selectRecord(rec, true);
|
||||||
|
this.btnTableTemplate.resumeEvents();
|
||||||
|
|
||||||
|
this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '52px', 'width': '72px', 'background-position': 'center'});
|
||||||
|
|
||||||
|
this._state.TemplateId = value;
|
||||||
}
|
}
|
||||||
this._isTemplatesChanged = false;
|
this._isTemplatesChanged = false;
|
||||||
|
|
||||||
|
@ -693,29 +692,36 @@ define([
|
||||||
var self = this;
|
var self = this;
|
||||||
this._isTemplatesChanged = true;
|
this._isTemplatesChanged = true;
|
||||||
|
|
||||||
if (!this.cmbTableTemplate) {
|
if (!this.btnTableTemplate) {
|
||||||
this.cmbTableTemplate = new Common.UI.ComboDataView({
|
this.btnTableTemplate = new Common.UI.Button({
|
||||||
itemWidth: 70,
|
cls : 'btn-large-dataview template-table',
|
||||||
itemHeight: 50,
|
iconCls : 'icon-template-table',
|
||||||
menuMaxHeight: 300,
|
menu : new Common.UI.Menu({
|
||||||
enableKeyEvents: true,
|
style: 'width: 575px;',
|
||||||
cls: 'combo-template'
|
items: [
|
||||||
|
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
|
||||||
|
]
|
||||||
|
})
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.render($('#table-combo-template'));
|
this.btnTableTemplate.on('render:after', function(btn) {
|
||||||
this.cmbTableTemplate.openButton.menu.cmpEl.css({
|
self.mnuTableTemplatePicker = new Common.UI.DataView({
|
||||||
'min-width': 175,
|
el: $('#id-table-menu-template'),
|
||||||
'max-width': 175
|
parentMenu: btn.menu,
|
||||||
|
restoreHeight: 350,
|
||||||
|
groups: new Common.UI.DataViewGroupStore(),
|
||||||
|
store: new Common.UI.DataViewStore(),
|
||||||
|
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="50" width="70"></div>'),
|
||||||
|
style: 'max-height: 350px;'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this));
|
this.btnTableTemplate.render($('#table-btn-template'));
|
||||||
this.cmbTableTemplate.openButton.menu.on('show:after', function () {
|
this.lockedControls.push(this.btnTableTemplate);
|
||||||
self.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true});
|
this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate));
|
||||||
});
|
|
||||||
this.lockedControls.push(this.cmbTableTemplate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var count = self.cmbTableTemplate.menuPicker.store.length;
|
var count = self.mnuTableTemplatePicker.store.length;
|
||||||
if (count>0 && count==Templates.length) {
|
if (count>0 && count==Templates.length) {
|
||||||
var data = self.cmbTableTemplate.menuPicker.store.models;
|
var data = self.mnuTableTemplatePicker.store.models;
|
||||||
_.each(Templates, function(template, index){
|
_.each(Templates, function(template, index){
|
||||||
data[index].set('imageUrl', template.asc_getImage());
|
data[index].set('imageUrl', template.asc_getImage());
|
||||||
});
|
});
|
||||||
|
@ -738,7 +744,7 @@ define([
|
||||||
tip : tip
|
tip : tip
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
self.cmbTableTemplate.menuPicker.store.reset(arr);
|
self.mnuTableTemplatePicker.store.reset(arr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=2 class="padding-small">
|
<td colspan=2 class="padding-small">
|
||||||
<div class="" id="table-combo-template" style="width: 100%; height: 64px;"></div>
|
<div class="" id="table-btn-template" style="width: 100%; height: 58px;"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -128,7 +128,7 @@ define([
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTableTemplateSelect: function(combo, record){
|
onTableTemplateSelect: function(btn, picker, itemView, record){
|
||||||
if (this.api && !this._noApply) {
|
if (this.api && !this._noApply) {
|
||||||
var properties = new Asc.CTableProp();
|
var properties = new Asc.CTableProp();
|
||||||
properties.put_TableStyle(record.get('templateId'));
|
properties.put_TableStyle(record.get('templateId'));
|
||||||
|
@ -436,20 +436,19 @@ define([
|
||||||
//for table-template
|
//for table-template
|
||||||
value = props.get_TableStyle();
|
value = props.get_TableStyle();
|
||||||
if (this._state.TemplateId!==value || this._isTemplatesChanged) {
|
if (this._state.TemplateId!==value || this._isTemplatesChanged) {
|
||||||
this.cmbTableTemplate.suspendEvents();
|
var rec = this.mnuTableTemplatePicker.store.findWhere({
|
||||||
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
|
|
||||||
templateId: value
|
templateId: value
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.menuPicker.selectRecord(rec);
|
if (!rec) {
|
||||||
this.cmbTableTemplate.resumeEvents();
|
rec = this.mnuTableTemplatePicker.store.at(0);
|
||||||
|
|
||||||
if (this._isTemplatesChanged) {
|
|
||||||
if (rec)
|
|
||||||
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
|
|
||||||
else
|
|
||||||
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
|
|
||||||
}
|
}
|
||||||
this._state.TemplateId=value;
|
this.btnTableTemplate.suspendEvents();
|
||||||
|
this.mnuTableTemplatePicker.selectRecord(rec, true);
|
||||||
|
this.btnTableTemplate.resumeEvents();
|
||||||
|
|
||||||
|
this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '52px', 'width': '72px', 'background-position': 'center'});
|
||||||
|
|
||||||
|
this._state.TemplateId = value;
|
||||||
}
|
}
|
||||||
this._isTemplatesChanged = false;
|
this._isTemplatesChanged = false;
|
||||||
|
|
||||||
|
@ -660,29 +659,36 @@ define([
|
||||||
var self = this;
|
var self = this;
|
||||||
this._isTemplatesChanged = true;
|
this._isTemplatesChanged = true;
|
||||||
|
|
||||||
if (!this.cmbTableTemplate) {
|
if (!this.btnTableTemplate) {
|
||||||
this.cmbTableTemplate = new Common.UI.ComboDataView({
|
this.btnTableTemplate = new Common.UI.Button({
|
||||||
itemWidth: 70,
|
cls : 'btn-large-dataview template-table',
|
||||||
itemHeight: 50,
|
iconCls : 'icon-template-table',
|
||||||
menuMaxHeight: 300,
|
menu : new Common.UI.Menu({
|
||||||
enableKeyEvents: true,
|
style: 'width: 575px;',
|
||||||
cls: 'combo-template'
|
items: [
|
||||||
|
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
|
||||||
|
]
|
||||||
|
})
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.render($('#table-combo-template'));
|
this.btnTableTemplate.on('render:after', function(btn) {
|
||||||
this.cmbTableTemplate.openButton.menu.cmpEl.css({
|
self.mnuTableTemplatePicker = new Common.UI.DataView({
|
||||||
'min-width': 175,
|
el: $('#id-table-menu-template'),
|
||||||
'max-width': 175
|
parentMenu: btn.menu,
|
||||||
|
restoreHeight: 350,
|
||||||
|
groups: new Common.UI.DataViewGroupStore(),
|
||||||
|
store: new Common.UI.DataViewStore(),
|
||||||
|
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="50" width="70"></div>'),
|
||||||
|
style: 'max-height: 350px;'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this));
|
this.btnTableTemplate.render($('#table-btn-template'));
|
||||||
this.cmbTableTemplate.openButton.menu.on('show:after', function () {
|
this.lockedControls.push(this.btnTableTemplate);
|
||||||
self.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true});
|
this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate));
|
||||||
});
|
|
||||||
this.lockedControls.push(this.cmbTableTemplate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var count = self.cmbTableTemplate.menuPicker.store.length;
|
var count = self.mnuTableTemplatePicker.store.length;
|
||||||
if (count>0 && count==Templates.length) {
|
if (count>0 && count==Templates.length) {
|
||||||
var data = self.cmbTableTemplate.menuPicker.store.models;
|
var data = self.mnuTableTemplatePicker.store.models;
|
||||||
_.each(Templates, function(template, index){
|
_.each(Templates, function(template, index){
|
||||||
data[index].set('imageUrl', template.asc_getImage());
|
data[index].set('imageUrl', template.asc_getImage());
|
||||||
});
|
});
|
||||||
|
@ -705,7 +711,7 @@ define([
|
||||||
tip : tip
|
tip : tip
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
self.cmbTableTemplate.menuPicker.store.reset(arr);
|
self.mnuTableTemplatePicker.store.reset(arr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=2 class="padding-small">
|
<td colspan=2 class="padding-small">
|
||||||
<div class="" id="table-combo-template" style="width: 100%; height: 60px;"></div>
|
<div class="" id="table-btn-template" style="width: 100%; height: 52px;"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -100,7 +100,7 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this);
|
Common.NotificationCenter.trigger('edit:complete', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTableTemplateSelect: function(combo, record){
|
onTableTemplateSelect: function(btn, picker, itemView, record){
|
||||||
if (this.api && !this._noApply) {
|
if (this.api && !this._noApply) {
|
||||||
this.api.asc_changeAutoFilter(this._state.TableName, Asc.c_oAscChangeFilterOptions.style, record.get('name'));
|
this.api.asc_changeAutoFilter(this._state.TableName, Asc.c_oAscChangeFilterOptions.style, record.get('name'));
|
||||||
}
|
}
|
||||||
|
@ -398,19 +398,18 @@ define([
|
||||||
//for table-template
|
//for table-template
|
||||||
value = props.asc_getTableStyleName();
|
value = props.asc_getTableStyleName();
|
||||||
if (this._state.TemplateName!==value || this._isTemplatesChanged) {
|
if (this._state.TemplateName!==value || this._isTemplatesChanged) {
|
||||||
this.cmbTableTemplate.suspendEvents();
|
var rec = this.mnuTableTemplatePicker.store.findWhere({
|
||||||
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
|
|
||||||
name: value
|
name: value
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.menuPicker.selectRecord(rec);
|
if (!rec) {
|
||||||
this.cmbTableTemplate.resumeEvents();
|
rec = this.mnuTableTemplatePicker.store.at(0);
|
||||||
|
|
||||||
if (this._isTemplatesChanged) {
|
|
||||||
if (rec)
|
|
||||||
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
|
|
||||||
else
|
|
||||||
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
|
|
||||||
}
|
}
|
||||||
|
this.btnTableTemplate.suspendEvents();
|
||||||
|
this.mnuTableTemplatePicker.selectRecord(rec, true);
|
||||||
|
this.btnTableTemplate.resumeEvents();
|
||||||
|
|
||||||
|
this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '48px', 'width': '63px', 'background-position': 'center'});
|
||||||
|
|
||||||
this._state.TemplateName=value;
|
this._state.TemplateName=value;
|
||||||
}
|
}
|
||||||
this._isTemplatesChanged = false;
|
this._isTemplatesChanged = false;
|
||||||
|
@ -429,29 +428,38 @@ define([
|
||||||
var self = this;
|
var self = this;
|
||||||
this._isTemplatesChanged = true;
|
this._isTemplatesChanged = true;
|
||||||
|
|
||||||
if (!this.cmbTableTemplate) {
|
if (!this.btnTableTemplate) {
|
||||||
this.cmbTableTemplate = new Common.UI.ComboDataView({
|
this.btnTableTemplate = new Common.UI.Button({
|
||||||
itemWidth: 61,
|
cls : 'btn-large-dataview sheet-template-table',
|
||||||
itemHeight: 46,
|
iconCls : 'icon-template-table',
|
||||||
menuMaxHeight: 300,
|
menu : new Common.UI.Menu({
|
||||||
enableKeyEvents: true
|
style: 'width: 512px;',
|
||||||
|
items: [
|
||||||
|
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
|
||||||
|
]
|
||||||
|
})
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.render($('#table-combo-template'));
|
this.btnTableTemplate.on('render:after', function(btn) {
|
||||||
this.cmbTableTemplate.openButton.menu.cmpEl.css({
|
self.mnuTableTemplatePicker = new Common.UI.DataView({
|
||||||
'min-width': 175,
|
el: $('#id-table-menu-template'),
|
||||||
'max-width': 175
|
parentMenu: btn.menu,
|
||||||
|
restoreHeight: 325,
|
||||||
|
groups: new Common.UI.DataViewGroupStore(),
|
||||||
|
store: new Common.UI.DataViewStore(),
|
||||||
|
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="46" width="61"></div>'),
|
||||||
|
style: 'max-height: 325px;'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this));
|
this.btnTableTemplate.render($('#table-btn-template'));
|
||||||
this.cmbTableTemplate.openButton.menu.on('show:after', function () {
|
this.lockedControls.push(this.btnTableTemplate);
|
||||||
self.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true});
|
this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate));
|
||||||
});
|
if (this._locked) this.btnTableTemplate.setDisabled(this._locked);
|
||||||
this.lockedControls.push(this.cmbTableTemplate);
|
|
||||||
if (this._locked) this.cmbTableTemplate.setDisabled(this._locked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var count = self.cmbTableTemplate.menuPicker.store.length;
|
|
||||||
|
var count = self.mnuTableTemplatePicker.store.length;
|
||||||
if (count>0 && count==Templates.length) {
|
if (count>0 && count==Templates.length) {
|
||||||
var data = self.cmbTableTemplate.menuPicker.store.models;
|
var data = self.mnuTableTemplatePicker.store.models;
|
||||||
_.each(Templates, function(template, index){
|
_.each(Templates, function(template, index){
|
||||||
data[index].set('imageUrl', template.asc_getImage());
|
data[index].set('imageUrl', template.asc_getImage());
|
||||||
});
|
});
|
||||||
|
@ -469,7 +477,7 @@ define([
|
||||||
tip : template.asc_getDisplayName()
|
tip : template.asc_getDisplayName()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
self.cmbTableTemplate.menuPicker.store.reset(arr);
|
self.mnuTableTemplatePicker.store.reset(arr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -736,7 +736,7 @@ define([
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter],
|
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter],
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
items: [
|
items: [
|
||||||
{ template: _.template('<div id="id-toolbar-menu-table-templates" style="width: 288px; height: 300px; margin: 0px 4px;"></div>') }
|
{ template: _.template('<div id="id-toolbar-menu-table-templates" style="width: 494px; height: 300px; margin: 0px 4px;"></div>') }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue