[SSE] Add sparklines
This commit is contained in:
parent
807a96bef2
commit
5ab470ec5f
|
@ -79,6 +79,7 @@ define([
|
|||
'Toolbar': {
|
||||
'change:compact': this.onClickChangeCompact.bind(me),
|
||||
'add:chart' : this.onSelectChart,
|
||||
'add:spark' : this.onSelectSpark,
|
||||
'insert:textart': this.onInsertTextart,
|
||||
'change:scalespn': this.onClickChangeScaleInMenu.bind(me),
|
||||
'click:customscale': this.onScaleClick.bind(me),
|
||||
|
@ -1130,6 +1131,28 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
},
|
||||
|
||||
onSelectSpark: function(type) {
|
||||
if (!this.editMode) return;
|
||||
var me = this,
|
||||
info = me.api.asc_getCellInfo(),
|
||||
seltype = info.asc_getSelectionType();
|
||||
|
||||
if (me.api) {
|
||||
if (seltype==Asc.c_oAscSelectionType.RangeCells || seltype==Asc.c_oAscSelectionType.RangeCol ||
|
||||
seltype==Asc.c_oAscSelectionType.RangeRow || seltype==Asc.c_oAscSelectionType.RangeMax) {
|
||||
var sparkLineInfo = info.asc_getSparklineInfo();
|
||||
if (!!sparkLineInfo) {
|
||||
var props = new Asc.sparklineGroup();
|
||||
props.asc_setType(type);
|
||||
this.api.asc_setSparklineGroup(sparkLineInfo.asc_getId(), props);
|
||||
} else {
|
||||
// add sparkline
|
||||
}
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
},
|
||||
|
||||
onInsertTextart: function (data) {
|
||||
if (this.api) {
|
||||
this.toolbar.fireEvent('inserttextart', this.toolbar);
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
<span class="btn-slot text x-huge" id="slot-btn-instext"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-instextart"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-inschart"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-inssparkline"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
|
|
|
@ -722,6 +722,15 @@ define([
|
|||
menu : true
|
||||
});
|
||||
|
||||
me.btnInsertSparkline = new Common.UI.Button({
|
||||
id : 'tlbtn-insertsparkline',
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
iconCls : 'toolbar__icon btn-insert-sparkline',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.editPivot],
|
||||
caption : me.capInsertSpark,
|
||||
menu : true
|
||||
});
|
||||
|
||||
me.btnInsertShape = new Common.UI.Button({
|
||||
id : 'tlbtn-insertshape',
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
|
@ -1461,7 +1470,7 @@ define([
|
|||
me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter,
|
||||
me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnCondFormat,
|
||||
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
|
||||
me.btnInsertChart, me.btnColorSchemas,
|
||||
me.btnInsertChart, me.btnColorSchemas, me.btnInsertSparkline,
|
||||
me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint,
|
||||
/*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle,
|
||||
me.btnPageMargins, me.btnPageSize, me.btnPageOrient, me.btnPrintArea, me.btnPrintTitles, me.btnImgAlign, me.btnImgBackward, me.btnImgForward, me.btnImgGroup, me.btnScale
|
||||
|
@ -1661,6 +1670,7 @@ define([
|
|||
_injectComponent('#slot-btn-colorschemas', this.btnColorSchemas);
|
||||
_injectComponent('#slot-btn-search', this.btnSearch);
|
||||
_injectComponent('#slot-btn-inschart', this.btnInsertChart);
|
||||
_injectComponent('#slot-btn-inssparkline', this.btnInsertSparkline);
|
||||
_injectComponent('#slot-field-styles', this.listStyles);
|
||||
_injectComponent('#slot-btn-chart', this.btnEditChart);
|
||||
_injectComponent('#slot-btn-chart-data', this.btnEditChartData);
|
||||
|
@ -1720,6 +1730,7 @@ define([
|
|||
_updateHint(this.btnInsertTable, this.tipInsertTable);
|
||||
_updateHint(this.btnInsertImage, this.tipInsertImage);
|
||||
_updateHint(this.btnInsertChart, this.tipInsertChartSpark);
|
||||
_updateHint(this.btnInsertSparkline, this.tipInsertSpark);
|
||||
_updateHint(this.btnInsertText, this.tipInsertText);
|
||||
_updateHint(this.btnInsertTextArt, this.tipInsertTextart);
|
||||
_updateHint(this.btnInsertHyperlink, this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K'));
|
||||
|
@ -1919,6 +1930,34 @@ define([
|
|||
this.btnInsertChart.menu.on('show:before', onShowBefore);
|
||||
}
|
||||
|
||||
if ( this.btnInsertSparkline ) {
|
||||
this.btnInsertSparkline.setMenu(new Common.UI.Menu({
|
||||
style: 'width: 166px;padding: 5px 0 10px;',
|
||||
items: [
|
||||
{ template: _.template('<div id="id-toolbar-menu-insertspark" class="menu-insertchart"></div>') }
|
||||
]
|
||||
}));
|
||||
|
||||
var onShowBefore = function(menu) {
|
||||
var picker = new Common.UI.DataView({
|
||||
el: $('#id-toolbar-menu-insertspark'),
|
||||
parentMenu: menu,
|
||||
showLast: false,
|
||||
restoreHeight: 50,
|
||||
// groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getSparkGroupData()),
|
||||
store: new Common.UI.DataViewStore(Common.define.chartData.getSparkData()),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist"><svg width="40" height="40" class=\"icon\"><use xlink:href=\"#chart-<%= iconCls %>\"></use></svg></div>')
|
||||
});
|
||||
picker.on('item:click', function (picker, item, record, e) {
|
||||
if (record)
|
||||
me.fireEvent('add:spark', [record.get('type')]);
|
||||
if (e.type !== 'click') menu.hide();
|
||||
});
|
||||
menu.off('show:before', onShowBefore);
|
||||
};
|
||||
this.btnInsertSparkline.menu.on('show:before', onShowBefore);
|
||||
}
|
||||
|
||||
if (this.btnInsertTextArt) {
|
||||
var onShowBeforeTextArt = function (menu) {
|
||||
var collection = SSE.getCollection('Common.Collections.TextArt');
|
||||
|
@ -2648,6 +2687,8 @@ define([
|
|||
tipEditChartData: 'Select Data',
|
||||
tipEditChartType: 'Change Chart Type',
|
||||
textAutoColor: 'Automatic',
|
||||
textItems: 'Items'
|
||||
textItems: 'Items',
|
||||
tipInsertSpark: 'Insert sparkline',
|
||||
capInsertSpark: 'Sparkline'
|
||||
}, SSE.Views.Toolbar || {}));
|
||||
});
|
|
@ -3257,6 +3257,8 @@
|
|||
"SSE.Views.Toolbar.txtTime": "Time",
|
||||
"SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells",
|
||||
"SSE.Views.Toolbar.txtYen": "¥ Yen",
|
||||
"SSE.Views.Toolbar.tipInsertSpark": "Insert sparkline",
|
||||
"SSE.Views.Toolbar.capInsertSpark": "Sparkline",
|
||||
"SSE.Views.Top10FilterDialog.textType": "Show",
|
||||
"SSE.Views.Top10FilterDialog.txtBottom": "Bottom",
|
||||
"SSE.Views.Top10FilterDialog.txtBy": "by",
|
||||
|
|
Loading…
Reference in a new issue