[SSE] Added field settings dialog.
This commit is contained in:
parent
c05e416215
commit
22a99d9168
|
@ -183,6 +183,7 @@ require([
|
|||
'spreadsheeteditor/main/app/view/ShapeSettings',
|
||||
'spreadsheeteditor/main/app/view/TextArtSettings',
|
||||
'spreadsheeteditor/main/app/view/PivotSettings',
|
||||
'spreadsheeteditor/main/app/view/FieldSettingsDialog',
|
||||
'spreadsheeteditor/main/app/view/ValueFieldSettingsDialog',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/util/LocalStorage',
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<div id="id-pivot-field-settings-layout" class="settings-panel active">
|
||||
<div class="inner-content">
|
||||
<table cols="1" style="width: 100%;">
|
||||
<tr>
|
||||
<td class="padding-small" style="white-space: nowrap;">
|
||||
<label class="header" style="vertical-align: middle; margin-right: 4px;"><%= scope.txtSourceName %></label>
|
||||
<label id="field-settings-source" style="vertical-align: middle; max-width: 220px; overflow: hidden; text-overflow: ellipsis;"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-large">
|
||||
<label class="header"><%= scope.txtCustomName %></label>
|
||||
<div id="field-settings-custom" style="width:264px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<label class="header"><%= scope.textReport %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-radio-tab"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-radio-outline"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-large">
|
||||
<div id="field-settings-chk-compact" style="margin-left: 20px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-repeat"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-blank"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-subtotals"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-radio-top" style="margin-left: 20px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-large">
|
||||
<div id="field-settings-radio-bottom" style="margin-left: 20px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-empty"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="id-pivot-field-settings-subtotals" class="settings-panel">
|
||||
<div class="inner-content">
|
||||
<table cols="1" style="width: 100%;">
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<label class="header"><%= scope.txtSummarize %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-sum"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-count"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-ave"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-max"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-min"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-product"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-num"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-dev"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-devp"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-var"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small">
|
||||
<div id="field-settings-chk-varp"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
288
apps/spreadsheeteditor/main/app/view/FieldSettingsDialog.js
Normal file
288
apps/spreadsheeteditor/main/app/view/FieldSettingsDialog.js
Normal file
|
@ -0,0 +1,288 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* FieldSettingsDialog.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 17.07.2017
|
||||
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([ 'text!spreadsheeteditor/main/app/template/FieldSettingsDialog.template',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/InputField',
|
||||
'common/main/lib/component/ComboBox',
|
||||
'common/main/lib/component/CheckBox',
|
||||
'common/main/lib/view/AdvancedSettingsWindow'
|
||||
], function (contentTemplate) { 'use strict';
|
||||
|
||||
SSE.Views.FieldSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
||||
options: {
|
||||
contentWidth: 284,
|
||||
height: 440,
|
||||
toggleGroup: 'pivot-field-settings-group',
|
||||
storageName: 'sse-pivot-field-settings-category'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
var me = this;
|
||||
|
||||
_.extend(this.options, {
|
||||
title: this.textTitle,
|
||||
items: [
|
||||
{panelId: 'id-pivot-field-settings-layout', panelCaption: this.strLayout},
|
||||
{panelId: 'id-pivot-field-settings-subtotals', panelCaption: this.strSubtotals}
|
||||
],
|
||||
contentTemplate: _.template(contentTemplate)({
|
||||
scope: this
|
||||
})
|
||||
}, options);
|
||||
|
||||
this.api = options.api;
|
||||
this.handler = options.handler;
|
||||
this.props = options.props;
|
||||
this.fieldIndex = options.fieldIndex || 0;
|
||||
this.names = options.names || [];
|
||||
this.type = options.type || 0; // 0 - columns, 1 - rows, 3 - filters
|
||||
|
||||
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
|
||||
var me = this;
|
||||
|
||||
this.inputCustomName = new Common.UI.InputField({
|
||||
el : $('#field-settings-custom'),
|
||||
allowBlank : true,
|
||||
validateOnBlur: false,
|
||||
style : 'width: 100%;'
|
||||
});
|
||||
|
||||
this.lblSourceName = this.$window.find('#field-settings-source');
|
||||
|
||||
this.radioTabular = new Common.UI.RadioBox({
|
||||
el: $('#field-settings-radio-tab'),
|
||||
labelText: this.txtTabular,
|
||||
name: 'asc-radio-report-form'
|
||||
});
|
||||
|
||||
this.radioOutline = new Common.UI.RadioBox({
|
||||
el: $('#field-settings-radio-outline'),
|
||||
labelText: this.txtOutline,
|
||||
name: 'asc-radio-report-form',
|
||||
checked: true
|
||||
});
|
||||
|
||||
this.chCompact = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-compact'),
|
||||
labelText: this.txtCompact
|
||||
});
|
||||
|
||||
this.chRepeat = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-repeat'),
|
||||
labelText: this.txtRepeat
|
||||
});
|
||||
|
||||
this.chBlank = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-blank'),
|
||||
labelText: this.txtBlank
|
||||
});
|
||||
|
||||
this.chSubtotals = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-subtotals'),
|
||||
labelText: this.txtShowSubtotals
|
||||
});
|
||||
|
||||
this.radioTop = new Common.UI.RadioBox({
|
||||
el: $('#field-settings-radio-top'),
|
||||
labelText: this.txtTop,
|
||||
name: 'asc-radio-show-subtotals'
|
||||
});
|
||||
|
||||
this.radioBottom = new Common.UI.RadioBox({
|
||||
el: $('#field-settings-radio-bottom'),
|
||||
labelText: this.txtBottom,
|
||||
name: 'asc-radio-show-subtotals',
|
||||
checked: true
|
||||
});
|
||||
|
||||
this.chEmpty = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-empty'),
|
||||
labelText: this.txtEmpty
|
||||
});
|
||||
|
||||
this.chSum = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-sum'),
|
||||
labelText: this.txtSum
|
||||
});
|
||||
// this.chSum.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Sum));
|
||||
|
||||
this.chCount = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-count'),
|
||||
labelText: this.txtCount
|
||||
});
|
||||
// this.chCount.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Count));
|
||||
|
||||
this.chAve = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-ave'),
|
||||
labelText: this.txtAverage
|
||||
});
|
||||
// this.chAve.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Average));
|
||||
|
||||
this.chMax = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-max'),
|
||||
labelText: this.txtMax
|
||||
});
|
||||
// this.chMax.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Max));
|
||||
|
||||
this.chMin = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-min'),
|
||||
labelText: this.txtMin
|
||||
});
|
||||
// this.chMin.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Min));
|
||||
|
||||
this.chProduct = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-product'),
|
||||
labelText: this.txtProduct
|
||||
});
|
||||
// this.chProduct.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Product));
|
||||
|
||||
this.chNum = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-num'),
|
||||
labelText: this.txtCountNums
|
||||
});
|
||||
// this.chNum.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.CountNums));
|
||||
|
||||
this.chDev = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-dev'),
|
||||
labelText: this.txtStdDev
|
||||
});
|
||||
// this.chDev.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.StdDev));
|
||||
|
||||
this.chDevp = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-devp'),
|
||||
labelText: this.txtStdDevp
|
||||
});
|
||||
// this.chDevp.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.StdDevp));
|
||||
|
||||
this.chVar = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-var'),
|
||||
labelText: this.txtVar
|
||||
});
|
||||
// this.chVar.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Var));
|
||||
|
||||
this.chVarp = new Common.UI.CheckBox({
|
||||
el: $('#field-settings-chk-varp'),
|
||||
labelText: this.txtVarp
|
||||
});
|
||||
// this.chVarp.on('change', _.bind(this.onFunctionChange, this, Asc.c_oAscDataConsolidateFunction.Varp));
|
||||
|
||||
this.afterRender();
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
this._setDefaults(this.props);
|
||||
if (this.storageName) {
|
||||
var value = Common.localStorage.getItem(this.storageName);
|
||||
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
|
||||
}
|
||||
},
|
||||
|
||||
show: function() {
|
||||
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
|
||||
},
|
||||
|
||||
_setDefaults: function (props) {
|
||||
if (props) {
|
||||
var field = ((this.type == 0) ? props.asc_getColumnFields() : ((this.type == 1) ? props.asc_getRowFields() : props.asc_getFilterFields()))[this.fieldIndex],
|
||||
cache_names = props.asc_getCacheFields(),
|
||||
pivot_names = props.asc_getPivotFields();
|
||||
|
||||
this.lblSourceName.html(Common.Utils.String.htmlEncode(cache_names[field.asc_getIndex()].asc_getName()));
|
||||
this.inputCustomName.setValue(Common.Utils.String.htmlEncode((pivot_names[field.asc_getIndex()] || cache_names[field.asc_getIndex()]).asc_getName()));
|
||||
}
|
||||
},
|
||||
|
||||
getSettings: function () {
|
||||
return {};
|
||||
},
|
||||
|
||||
onDlgBtnClick: function(event) {
|
||||
var me = this;
|
||||
var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event;
|
||||
if (state == 'ok') {
|
||||
this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined);
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
||||
onPrimary: function() {
|
||||
this.onDlgBtnClick('ok');
|
||||
return false;
|
||||
},
|
||||
|
||||
textTitle: 'Field Settings',
|
||||
textCancel: 'Cancel',
|
||||
textOk: 'OK',
|
||||
strSubtotals: 'Subtotals',
|
||||
strLayout: 'Layout',
|
||||
txtSourceName: 'Source name: ',
|
||||
txtCustomName: 'Custom name',
|
||||
textReport: 'Report Form',
|
||||
txtTabular: 'Tabular',
|
||||
txtOutline: 'Outline',
|
||||
txtCompact: 'Compact',
|
||||
txtRepeat: 'Repeat Items Labels at Each Row',
|
||||
txtBlank: 'Insert Blank Rows After Each Item',
|
||||
txtShowSubtotals: 'Show Subtotals',
|
||||
txtTop: 'Show at Top of Group',
|
||||
txtBottom: 'Show at Bottom of Group',
|
||||
txtEmpty: 'Show Items with No Data',
|
||||
txtSummarize: 'Functions for Subtotals',
|
||||
txtAverage: 'Average',
|
||||
txtCount: 'Count',
|
||||
txtCountNums: 'Count Numbers',
|
||||
txtMax: 'Max',
|
||||
txtMin: 'Min',
|
||||
txtProduct: 'Product',
|
||||
txtStdDev: 'StdDev',
|
||||
txtStdDevp: 'StdDevp',
|
||||
txtSum: 'Sum',
|
||||
txtVar: 'Var',
|
||||
txtVarp: 'Varp'
|
||||
|
||||
}, SSE.Views.FieldSettingsDialog || {}))
|
||||
});
|
|
@ -46,6 +46,7 @@ define([
|
|||
'backbone',
|
||||
'common/main/lib/component/Button',
|
||||
'common/main/lib/component/ListView',
|
||||
'spreadsheeteditor/main/app/view/FieldSettingsDialog',
|
||||
'spreadsheeteditor/main/app/view/ValueFieldSettingsDialog'
|
||||
], function (menuTemplate, $, _, Backbone, Sortable) {
|
||||
'use strict';
|
||||
|
@ -652,7 +653,7 @@ define([
|
|||
var me = this;
|
||||
var win;
|
||||
if (me.api && !this._locked){
|
||||
if (type == 2) // value field
|
||||
if (type == 2) { // value field
|
||||
(new SSE.Views.ValueFieldSettingsDialog(
|
||||
{
|
||||
props: me._originalProps,
|
||||
|
@ -667,6 +668,23 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', me);
|
||||
}
|
||||
})).show();
|
||||
} else {
|
||||
(new SSE.Views.FieldSettingsDialog(
|
||||
{
|
||||
props: me._originalProps,
|
||||
fieldIndex: record.get('index'),
|
||||
names: me._state.names,
|
||||
api: me.api,
|
||||
type: type,
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok' && me.api && value) {
|
||||
// me.api.asc_changeFormatTableInfo(me._state.TableName, Asc.c_oAscChangeTableStyleInfo.advancedSettings, value);
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', me);
|
||||
}
|
||||
})).show();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
define([
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/MetricSpinner',
|
||||
'common/main/lib/component/InputField',
|
||||
'common/main/lib/component/ComboBox',
|
||||
'common/main/lib/view/AdvancedSettingsWindow'
|
||||
], function () { 'use strict';
|
||||
|
|
|
@ -173,6 +173,7 @@ require([
|
|||
'spreadsheeteditor/main/app/view/ShapeSettings',
|
||||
'spreadsheeteditor/main/app/view/TextArtSettings',
|
||||
'spreadsheeteditor/main/app/view/PivotSettings',
|
||||
'spreadsheeteditor/main/app/view/FieldSettingsDialog',
|
||||
'spreadsheeteditor/main/app/view/ValueFieldSettingsDialog',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/util/LocalStorage',
|
||||
|
|
Loading…
Reference in a new issue