[SSE] Fix named ranges for slicers
This commit is contained in:
parent
5708510830
commit
7c2fc19882
|
@ -1243,7 +1243,7 @@ define([
|
||||||
(new SSE.Views.NamedRangePasteDlg({
|
(new SSE.Views.NamedRangePasteDlg({
|
||||||
handler: function(result, settings) {
|
handler: function(result, settings) {
|
||||||
if (result == 'ok' && settings) {
|
if (result == 'ok' && settings) {
|
||||||
me.api.asc_insertInCell(settings.asc_getName(true), settings.asc_getIsTable() ? Asc.c_oAscPopUpSelectorType.Table : Asc.c_oAscPopUpSelectorType.Range, false);
|
me.api.asc_insertInCell(settings.asc_getName(true), (settings.asc_getType()===Asc.c_oAscDefNameType.table) ? Asc.c_oAscPopUpSelectorType.Table : Asc.c_oAscPopUpSelectorType.Range, false);
|
||||||
Common.component.Analytics.trackEvent('ToolBar', 'Paste Named Range');
|
Common.component.Analytics.trackEvent('ToolBar', 'Paste Named Range');
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||||
|
|
|
@ -121,7 +121,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
|
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
|
||||||
itemTemplate: _.template([
|
itemTemplate: _.template([
|
||||||
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">',
|
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">',
|
||||||
'<div class="listitem-icon toolbar__icon <% print(isTable?"btn-menu-table":"btn-named-range") %>"></div>',
|
'<div class="listitem-icon toolbar__icon <% print(isTable?"btn-menu-table":(isSlicer ? "btn-slicer" : "btn-named-range")) %>"></div>',
|
||||||
'<div style="width:141px;padding-right: 5px;"><%= name %></div>',
|
'<div style="width:141px;padding-right: 5px;"><%= name %></div>',
|
||||||
'<div style="width:117px;padding-right: 5px;"><%= scopeName %></div>',
|
'<div style="width:117px;padding-right: 5px;"><%= scopeName %></div>',
|
||||||
'<div style="width:204px;"><%= range %></div>',
|
'<div style="width:204px;"><%= range %></div>',
|
||||||
|
@ -189,15 +189,18 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
var arr = [];
|
var arr = [];
|
||||||
for (var i=0; i<this.ranges.length; i++) {
|
for (var i=0; i<this.ranges.length; i++) {
|
||||||
var scope = this.ranges[i].asc_getScope(),
|
var scope = this.ranges[i].asc_getScope(),
|
||||||
id = this.ranges[i].asc_getIsLock();
|
id = this.ranges[i].asc_getIsLock(),
|
||||||
|
type = this.ranges[i].asc_getType();
|
||||||
arr.push({
|
arr.push({
|
||||||
name: this.ranges[i].asc_getName(true),
|
name: this.ranges[i].asc_getName(true),
|
||||||
scope: scope,
|
scope: scope,
|
||||||
scopeName: (scope===null) ? this.textWorkbook: this.sheetNames[scope],
|
scopeName: (scope===null) ? this.textWorkbook: this.sheetNames[scope],
|
||||||
range: this.ranges[i].asc_getRef(),
|
range: this.ranges[i].asc_getRef(),
|
||||||
isTable: (this.ranges[i].asc_getIsTable()===true),
|
|
||||||
lock: (id!==null && id!==undefined),
|
lock: (id!==null && id!==undefined),
|
||||||
lockuser: (id) ? this.getUserName(id) : this.guestText
|
lockuser: (id) ? this.getUserName(id) : this.guestText,
|
||||||
|
type: type,
|
||||||
|
isTable: type===Asc.c_oAscDefNameType.table,
|
||||||
|
isSlicer: type===Asc.c_oAscDefNameType.slicer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.rangesStore.reset(arr);
|
this.rangesStore.reset(arr);
|
||||||
|
@ -286,7 +289,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
xy = me.$window.offset(),
|
xy = me.$window.offset(),
|
||||||
rec = this.rangeList.getSelectedRec(),
|
rec = this.rangeList.getSelectedRec(),
|
||||||
idx = _.indexOf(this.rangeList.store.models, rec),
|
idx = _.indexOf(this.rangeList.store.models, rec),
|
||||||
oldname = (isEdit && rec) ? new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('isTable'), undefined, undefined, undefined, true) : null;
|
oldname = (isEdit && rec) ? new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true) : null;
|
||||||
|
|
||||||
var win = new SSE.Views.NamedRangeEditDlg({
|
var win = new SSE.Views.NamedRangeEditDlg({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
|
@ -320,7 +323,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
var rec = this.rangeList.getSelectedRec();
|
var rec = this.rangeList.getSelectedRec();
|
||||||
if (rec) {
|
if (rec) {
|
||||||
this.currentNamedRange = _.indexOf(this.rangeList.store.models, rec);
|
this.currentNamedRange = _.indexOf(this.rangeList.store.models, rec);
|
||||||
this.api.asc_delDefinedNames(new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('isTable'), undefined, undefined, undefined, true));
|
this.api.asc_delDefinedNames(new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -376,7 +379,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
}
|
}
|
||||||
this.currentNamedRange = _.indexOf(this.rangeList.store.models, record);
|
this.currentNamedRange = _.indexOf(this.rangeList.store.models, record);
|
||||||
this.btnEditRange.setDisabled(rawData.lock);
|
this.btnEditRange.setDisabled(rawData.lock);
|
||||||
this.btnDeleteRange.setDisabled(rawData.lock || rawData.isTable);
|
this.btnDeleteRange.setDisabled(rawData.lock || rawData.isTable || rawData.isSlicer);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ define([
|
||||||
this.txtDataRange.setValue((val) ? val : '');
|
this.txtDataRange.setValue((val) ? val : '');
|
||||||
this.dataRangeValid = val;
|
this.dataRangeValid = val;
|
||||||
|
|
||||||
this.txtDataRange.setDisabled(this.isEdit && props.asc_getIsTable());
|
this.txtDataRange.setDisabled(this.isEdit && (props.asc_getType()===Asc.c_oAscDefNameType.table || props.asc_getType()===Asc.c_oAscDefNameType.slicer));
|
||||||
} else
|
} else
|
||||||
this.cmbScope.setValue(-255);
|
this.cmbScope.setValue(-255);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getSettings: function() {
|
getSettings: function() {
|
||||||
return (new Asc.asc_CDefName(this.inputName.getValue(), this.txtDataRange.getValue(), (this.cmbScope.getValue()==-255) ? null : this.cmbScope.getValue(), this.props.asc_getIsTable(), undefined, undefined, undefined, true));
|
return (new Asc.asc_CDefName(this.inputName.getValue(), this.txtDataRange.getValue(), (this.cmbScope.getValue()==-255) ? null : this.cmbScope.getValue(), this.props.asc_getType(), undefined, undefined, undefined, true));
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrimary: function() {
|
onPrimary: function() {
|
||||||
|
|
|
@ -94,7 +94,7 @@ define([
|
||||||
itemTemplate: _.template([
|
itemTemplate: _.template([
|
||||||
'<div style="pointer-events:none;">',
|
'<div style="pointer-events:none;">',
|
||||||
'<div id="<%= id %>" class="list-item" style="pointer-events:none;width: 100%;display:inline-block;">',
|
'<div id="<%= id %>" class="list-item" style="pointer-events:none;width: 100%;display:inline-block;">',
|
||||||
'<div class="listitem-icon toolbar__icon <% print(isTable?"btn-menu-table":"btn-named-range") %>"></div>',
|
'<div class="listitem-icon toolbar__icon <% print(isTable?"btn-menu-table":(isSlicer ? "btn-slicer" : "btn-named-range")) %>"></div>',
|
||||||
'<div style="width:186px;padding-right: 5px;"><%= name %></div>',
|
'<div style="width:186px;padding-right: 5px;"><%= name %></div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>'
|
'</div>'
|
||||||
|
@ -122,11 +122,14 @@ define([
|
||||||
for (var i=0; i<this.ranges.length; i++) {
|
for (var i=0; i<this.ranges.length; i++) {
|
||||||
var name = this.ranges[i].asc_getName(true);
|
var name = this.ranges[i].asc_getName(true);
|
||||||
if (name !== prev_name) {
|
if (name !== prev_name) {
|
||||||
|
var type = this.ranges[i].asc_getType();
|
||||||
arr.push({
|
arr.push({
|
||||||
name: name,
|
name: name,
|
||||||
scope: this.ranges[i].asc_getScope(),
|
scope: this.ranges[i].asc_getScope(),
|
||||||
range: this.ranges[i].asc_getRef(),
|
range: this.ranges[i].asc_getRef(),
|
||||||
isTable: (this.ranges[i].asc_getIsTable()===true)
|
type: type,
|
||||||
|
isTable: type===Asc.c_oAscDefNameType.table,
|
||||||
|
isSlicer: type===Asc.c_oAscDefNameType.slicer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
prev_name = name;
|
prev_name = name;
|
||||||
|
@ -145,7 +148,7 @@ define([
|
||||||
|
|
||||||
getSettings: function() {
|
getSettings: function() {
|
||||||
var rec = this.rangeList.getSelectedRec();
|
var rec = this.rangeList.getSelectedRec();
|
||||||
return (rec) ? (new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('isTable'), undefined, undefined, undefined, true)) : null;
|
return (rec) ? (new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true)) : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrimary: function() {
|
onPrimary: function() {
|
||||||
|
|
Loading…
Reference in a new issue