[SSE] Add Text to columns button to toolbar
This commit is contained in:
parent
fe90c69ebe
commit
b1ca425937
|
@ -60,9 +60,14 @@ define([
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'DataTab': {
|
'DataTab': {
|
||||||
'data:group': this.onGroup,
|
'data:group': this.onGroup,
|
||||||
'data:ungroup': this.onUngroup
|
'data:ungroup': this.onUngroup,
|
||||||
|
'data:tocolumns': this.onTextToColumn
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._state = {
|
||||||
|
CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '')
|
||||||
|
};
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
},
|
},
|
||||||
|
@ -98,7 +103,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectionChanged: function(info) {
|
onSelectionChanged: function(info) {
|
||||||
|
if (!this.toolbar.editMode || !this.view) return;
|
||||||
|
|
||||||
// special disable conditions
|
// special disable conditions
|
||||||
|
Common.Utils.lockControls(SSE.enumLock.multiselectCols, info.asc_getSelectedColsCount()>1, {array: [this.view.btnTextToColumns]});
|
||||||
|
Common.Utils.lockControls(SSE.enumLock.multiselect, info.asc_getFlags().asc_getMultiselect(), {array: [this.view.btnTextToColumns]});
|
||||||
},
|
},
|
||||||
|
|
||||||
onUngroup: function(type) {
|
onUngroup: function(type) {
|
||||||
|
@ -139,7 +148,35 @@ define([
|
||||||
})).show();
|
})).show();
|
||||||
} else if (val!==undefined) //undefined - error, true - rows, false - columns
|
} else if (val!==undefined) //undefined - error, true - rows, false - columns
|
||||||
me.api.asc_group(val);
|
me.api.asc_group(val);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
onTextToColumn: function() {
|
||||||
|
this.api.asc_TextImport(this._state.CSVOptions, _.bind(this.onTextToColumnCallback, this), false);
|
||||||
|
},
|
||||||
|
|
||||||
|
onTextToColumnCallback: function(data) {
|
||||||
|
if (!data || !data.length) return;
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
(new Common.Views.OpenDialog({
|
||||||
|
title: me.textWizard,
|
||||||
|
closable: true,
|
||||||
|
type: Common.Utils.importTextType.Columns,
|
||||||
|
preview: true,
|
||||||
|
previewData: data,
|
||||||
|
settings: me._state.CSVOptions,
|
||||||
|
api: me.api,
|
||||||
|
handler: function (result, encoding, delimiter, delimiterChar) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
if (me && me.api) {
|
||||||
|
me.api.asc_TextToColumns(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).show();
|
||||||
|
},
|
||||||
|
|
||||||
|
textWizard: 'Text to Columns Wizard'
|
||||||
|
|
||||||
}, SSE.Controllers.DataTab || {}));
|
}, SSE.Controllers.DataTab || {}));
|
||||||
});
|
});
|
|
@ -153,6 +153,10 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="panel" data-tab="data">
|
<section class="panel" data-tab="data">
|
||||||
|
<div class="group">
|
||||||
|
<span class="btn-slot text x-huge" id="slot-btn-text-column"></span>
|
||||||
|
</div>
|
||||||
|
<div class="separator long"></div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<span class="btn-slot text x-huge" id="slot-btn-group"></span>
|
<span class="btn-slot text x-huge" id="slot-btn-group"></span>
|
||||||
<span class="btn-slot text x-huge" id="slot-btn-ungroup"></span>
|
<span class="btn-slot text x-huge" id="slot-btn-ungroup"></span>
|
||||||
|
|
|
@ -58,6 +58,10 @@ define([
|
||||||
me.btnGroup.on('click', function (b, e) {
|
me.btnGroup.on('click', function (b, e) {
|
||||||
me.fireEvent('data:group');
|
me.fireEvent('data:group');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.btnTextToColumns.on('click', function (b, e) {
|
||||||
|
me.fireEvent('data:tocolumns');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -102,7 +106,17 @@ define([
|
||||||
_injectComponent('#slot-btn-ungroup', this.btnUngroup);
|
_injectComponent('#slot-btn-ungroup', this.btnUngroup);
|
||||||
this.lockedControls.push(this.btnUngroup);
|
this.lockedControls.push(this.btnUngroup);
|
||||||
|
|
||||||
this._state = {disabled: false};
|
this.btnTextToColumns = new Common.UI.Button({
|
||||||
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
iconCls: 'btn-img-group',
|
||||||
|
caption: this.capBtnTextToCol,
|
||||||
|
split: false,
|
||||||
|
disabled: true,
|
||||||
|
lock: [_set.multiselect, _set.multiselectCols, _set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||||
|
});
|
||||||
|
_injectComponent('#slot-btn-text-column', this.btnTextToColumns);
|
||||||
|
this.lockedControls.push(this.btnTextToColumns);
|
||||||
|
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -126,6 +140,7 @@ define([
|
||||||
me.btnUngroup.setMenu(_menu);
|
me.btnUngroup.setMenu(_menu);
|
||||||
|
|
||||||
me.btnGroup.updateHint(me.tipGroup);
|
me.btnGroup.updateHint(me.tipGroup);
|
||||||
|
me.btnTextToColumns.updateHint(me.tipToColumns);
|
||||||
|
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
|
@ -154,7 +169,9 @@ define([
|
||||||
textColumns: 'Ungroup columns',
|
textColumns: 'Ungroup columns',
|
||||||
textClear: 'Clear outline',
|
textClear: 'Clear outline',
|
||||||
tipGroup: 'Group range of cells',
|
tipGroup: 'Group range of cells',
|
||||||
tipUngroup: 'Ungroup range of cells'
|
tipUngroup: 'Ungroup range of cells',
|
||||||
|
capBtnTextToCol: 'Text to Columns',
|
||||||
|
tipToColumns: 'Separate cell text into columns'
|
||||||
}
|
}
|
||||||
}()), SSE.Views.DataTab || {}));
|
}()), SSE.Views.DataTab || {}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -87,7 +87,8 @@ define([
|
||||||
cantGroupUngroup: 'cant-group-ungroup',
|
cantGroupUngroup: 'cant-group-ungroup',
|
||||||
docPropsLock: 'doc-props-lock',
|
docPropsLock: 'doc-props-lock',
|
||||||
printAreaLock: 'print-area-lock',
|
printAreaLock: 'print-area-lock',
|
||||||
namedRangeLock: 'named-range-lock'
|
namedRangeLock: 'named-range-lock',
|
||||||
|
multiselectCols:'is-multiselect-cols'
|
||||||
};
|
};
|
||||||
|
|
||||||
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
|
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
|
||||||
|
|
|
@ -223,6 +223,7 @@
|
||||||
"Common.Views.SignSettingsDialog.textShowDate": "Show sign date in signature line",
|
"Common.Views.SignSettingsDialog.textShowDate": "Show sign date in signature line",
|
||||||
"Common.Views.SignSettingsDialog.textTitle": "Signature Setup",
|
"Common.Views.SignSettingsDialog.textTitle": "Signature Setup",
|
||||||
"Common.Views.SignSettingsDialog.txtEmpty": "This field is required",
|
"Common.Views.SignSettingsDialog.txtEmpty": "This field is required",
|
||||||
|
"SSE.Controllers.DataTab.textWizard": "Text to Columns Wizard",
|
||||||
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
|
"SSE.Controllers.DocumentHolder.alignmentText": "Alignment",
|
||||||
"SSE.Controllers.DocumentHolder.centerText": "Center",
|
"SSE.Controllers.DocumentHolder.centerText": "Center",
|
||||||
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",
|
"SSE.Controllers.DocumentHolder.deleteColumnText": "Delete Column",
|
||||||
|
@ -1318,11 +1319,13 @@
|
||||||
"SSE.Views.ChartSettingsDlg.textZero": "Zero",
|
"SSE.Views.ChartSettingsDlg.textZero": "Zero",
|
||||||
"SSE.Views.ChartSettingsDlg.txtEmpty": "This field is required",
|
"SSE.Views.ChartSettingsDlg.txtEmpty": "This field is required",
|
||||||
"SSE.Views.DataTab.capBtnGroup": "Group",
|
"SSE.Views.DataTab.capBtnGroup": "Group",
|
||||||
|
"SSE.Views.DataTab.capBtnTextToCol": "Text to Columns",
|
||||||
"SSE.Views.DataTab.capBtnUngroup": "Ungroup",
|
"SSE.Views.DataTab.capBtnUngroup": "Ungroup",
|
||||||
"SSE.Views.DataTab.textRows": "Ungroup rows",
|
|
||||||
"SSE.Views.DataTab.textColumns": "Ungroup columns",
|
|
||||||
"SSE.Views.DataTab.textClear": "Clear outline",
|
"SSE.Views.DataTab.textClear": "Clear outline",
|
||||||
|
"SSE.Views.DataTab.textColumns": "Ungroup columns",
|
||||||
|
"SSE.Views.DataTab.textRows": "Ungroup rows",
|
||||||
"SSE.Views.DataTab.tipGroup": "Group range of cells",
|
"SSE.Views.DataTab.tipGroup": "Group range of cells",
|
||||||
|
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
|
||||||
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
||||||
"SSE.Views.DigitalFilterDialog.cancelButtonText": "Cancel",
|
"SSE.Views.DigitalFilterDialog.cancelButtonText": "Cancel",
|
||||||
"SSE.Views.DigitalFilterDialog.capAnd": "And",
|
"SSE.Views.DigitalFilterDialog.capAnd": "And",
|
||||||
|
|
Loading…
Reference in a new issue