ru.coon 3.0.69 → 3.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -0
- package/CHANGELOG.md +20 -0
- package/package.json +2 -2
- package/src/app/viewPort/CenterView.js +1 -1
- package/src/common/panel/WindowWrap.js +1 -1
- package/src/format.js +1 -1
- package/src/nav/editor/menu/NavMenuTreeController.js +26 -0
- package/src/nav/editor/menu/NavMenuTreeView.js +1 -0
- package/src/nav/editor/workspace/NavWorkspaceListController.js +24 -1
- package/src/nav/editor/workspace/NavWorkspaceListView.js +1 -0
- package/src/report/component/ReportPanel.js +0 -5
- package/src/report/component/reportpanel/ReportGrid.scss +3 -1
- package/src/report/model/SummaryPluginBean.js +1 -3
- package/src/report/plugin/configPanel/SummaryPluginConfigPanelSummaryGrid.js +16 -5
- package/src/report/plugin/grid/GridRowStylePlugin.js +0 -1
- package/src/report/plugin/grid/GroupRowsPlugin.js +2 -42
- package/src/report/plugin/grid/SummaryPlugin.js +29 -53
- package/src/uielement/component/UiCustomController.js +1 -1
- package/src/version.js +1 -1
package/.eslintrc.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# Version 3.0.72, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c2f5896748cca4a1467fa9dedd00ed69b950c033)
|
|
2
|
+
* ## Fixes
|
|
3
|
+
* <span style='color:red'> исправление отображения кнопок репорта</span> ([45f49f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/45f49ff03cfd18a299ba92a73f415fc86f9c6bbf))
|
|
4
|
+
|
|
5
|
+
* remove span if no title ([33c3f7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/33c3f713cbee011f31de9a68216b5f615477fb0d))
|
|
6
|
+
* HT-14867 fix: Исправление подсветки выделенной строки. Отключение черезполосной раскраски строки при наличии плагина GridRowStylePlugin. ([650840], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6508409dac9bffbdfd672f2befd4f52e0d7dc40c))
|
|
7
|
+
* update: CHANGELOG.md ([7c81a0], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7c81a089d558f6788dd14582814325cd1d331e9c))
|
|
8
|
+
|
|
9
|
+
# Version 3.0.71, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c392614cffea74a4f5b5886307e26be5fffcb14a)
|
|
10
|
+
* update: CHANGELOG.md ([f10394], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f10394bec0b7055bc79a4716495bc9049e994758))
|
|
11
|
+
|
|
12
|
+
# Version 3.0.70, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f6109b23cc11c2f08c51e25913c6682f1615e007)
|
|
13
|
+
* update extjs_iconpack to 1.3.32 ([3ecbff], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3ecbff43a095b23a50d5d4d9519d5c9c47a96735))
|
|
14
|
+
* update: CHANGELOG.md ([89b129], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/89b129bf2c7a0ebc036089f75032ab8dd647d99d))
|
|
15
|
+
|
|
1
16
|
# Version 3.0.69, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/01e9715d7b9ff10d4898cdf49adc51e10f59ab9b)
|
|
2
17
|
* HT-14867 feat: Черезполосная расцветка строк репорта. Исправление работы со свойствами репорта. ([d91a8e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d91a8ef5f74369009e220fee35e12b485cb27cbb))
|
|
3
18
|
* update: CHANGELOG.md ([62d169], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/62d1691d0a2292271bd17353bae0e5eb3fd1ad11))
|
|
@@ -28,9 +43,13 @@
|
|
|
28
43
|
|
|
29
44
|
# Version 3.0.63, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/eb48b260e66b233a4cad92d0d856d0d8da4c021b)
|
|
30
45
|
# Version 3.0.62, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d8f3faa85fc70860397b0074b43d93aa9b9ffa00)
|
|
46
|
+
* ## Features
|
|
47
|
+
* <span style='color:green'>feat: Форматирование суммирующих строк, автоматическое число разрядов по умолчанию. Closes HT-14817.</span> ([42319f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/42319f2d024ef87e00dadfb112f049c4c20d4c7a))
|
|
48
|
+
|
|
31
49
|
* ## Fixes
|
|
32
50
|
* <span style='color:red'>fix csrf in ReportTreeStore</span> ([cb402a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cb402a1790a7b1081a5e8a17968db947ba583df9))
|
|
33
51
|
|
|
52
|
+
* remove default value ([0047e3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0047e3d4507183fa9fbcc32a1ce4b5004fb91524))
|
|
34
53
|
* HT-14775 fix: Исправление ширины системного тулбара ([bdd783], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bdd7836f8eef889ec642e486e896d3910eeb1850))
|
|
35
54
|
* update: CHANGELOG.md ([0624d1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0624d16d97c878b4e695b775a6a08cb00d3f12bd))
|
|
36
55
|
|
|
@@ -44,6 +63,7 @@
|
|
|
44
63
|
* ## Fixes
|
|
45
64
|
* <span style='color:red'>HT-14119 fix double loading FilterPanel with FilterFormEditingPlugin</span> ([43e7be], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/43e7be1760d09b482bafc8bd9f75d146be266d50))
|
|
46
65
|
|
|
66
|
+
* Добавлена возможность переноса пунктов меню между рабочими пространствами. Closes NEVA-987. ([5ad5e4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5ad5e47733bcf3bd2770e79e767dc9e2db6401e9))
|
|
47
67
|
* HT-13993 добавлена боковая панель фильтров для репортов ([e2d5c7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e2d5c7436900d232cd48c9389a685affbacf721a))
|
|
48
68
|
* HT-14628 открытие компонента внутри репорта - закрытие через крестик ([fc4f4e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/fc4f4e9112a3ba1a85cb4a064d65d7a7cfb8cec1))
|
|
49
69
|
* update: CHANGELOG.md ([2ab856], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2ab8566fb3c7400e91d3706a5bd8383d48060556))
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "ru.coon"
|
|
5
5
|
},
|
|
6
6
|
"description": "",
|
|
7
|
-
"version": "3.0.
|
|
7
|
+
"version": "3.0.72",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ace-diff": "3.0.3",
|
|
28
28
|
"decimal.js-light": "^2.5.1",
|
|
29
29
|
"echarts": "5.3.3",
|
|
30
|
-
"extjs_iconpack": "1.3.
|
|
30
|
+
"extjs_iconpack": "1.3.32",
|
|
31
31
|
"json5": "2.2.3",
|
|
32
32
|
"object-hash": "^3.0.0",
|
|
33
33
|
"sigma-printjs": "^1.0.3",
|
|
@@ -129,7 +129,7 @@ Ext.define('Coon.app.viewPort.CenterView', {
|
|
|
129
129
|
this.add(component);
|
|
130
130
|
|
|
131
131
|
component.on('titlechange', function(_, title) {
|
|
132
|
-
title = title || Coon.format.withHint('
|
|
132
|
+
title = title || Coon.format.withHint('', 'заголовок не задан');
|
|
133
133
|
if (typeof title !== 'string') {
|
|
134
134
|
if (typeof title.getTitle !== 'function') {
|
|
135
135
|
return;
|
|
@@ -162,7 +162,7 @@ Ext.define('Coon.common.panel.WindowWrap', {
|
|
|
162
162
|
}, this);
|
|
163
163
|
|
|
164
164
|
this.content.on('titlechange', function(_, title) {
|
|
165
|
-
title = title || Coon.format.withHint('
|
|
165
|
+
title = title || Coon.format.withHint('', 'заголовок не задан');
|
|
166
166
|
if (typeof title !== 'string') {
|
|
167
167
|
if (typeof title.getTitle !== 'function') {
|
|
168
168
|
return;
|
package/src/format.js
CHANGED
|
@@ -98,7 +98,7 @@ Ext.define('Coon.format', {
|
|
|
98
98
|
return v;
|
|
99
99
|
}
|
|
100
100
|
let format = '0,000.';
|
|
101
|
-
const digitsRight = precision ? precision : this.actualNumberPrecision(vNumber);
|
|
101
|
+
const digitsRight = precision >= 0 ? precision : this.actualNumberPrecision(vNumber);
|
|
102
102
|
let i;
|
|
103
103
|
for (i = 0; i < digitsRight; i++) {
|
|
104
104
|
format += '0';
|
|
@@ -13,10 +13,14 @@ Ext.define('Coon.nav.editor.menu.NavMenuTreeController', {
|
|
|
13
13
|
loadMenuData: 'loadMenuData',
|
|
14
14
|
setRootMenu: 'setRootMenu',
|
|
15
15
|
itemdblclick: 'openFormEdit',
|
|
16
|
+
beforedrop: 'onMenuTreeBeforeDrop',
|
|
16
17
|
drop: 'saveMenuOrder',
|
|
17
18
|
itemcontextmenu: 'showContextMenu',
|
|
18
19
|
},
|
|
19
20
|
},
|
|
21
|
+
init() {
|
|
22
|
+
Ext.on('nav:item:workspace-change', this.onItemWorkspaceChange.bind(this));
|
|
23
|
+
},
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Построение дерева меню для выбранного рабочего пространства
|
|
@@ -409,4 +413,26 @@ Ext.define('Coon.nav.editor.menu.NavMenuTreeController', {
|
|
|
409
413
|
html: `Взаимодействие с элементами меню происходит по нажатию на правую кнопку мыши.`,
|
|
410
414
|
}).show();
|
|
411
415
|
},
|
|
416
|
+
|
|
417
|
+
onMenuTreeBeforeDrop(node, {records}) {
|
|
418
|
+
return typeof records[0].get('LEAF_SW') !== 'undefined';
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
onItemWorkspaceChange(records, newWorkspaceCd) {
|
|
422
|
+
if (Array.isArray(records)) {
|
|
423
|
+
for (const record of records) {
|
|
424
|
+
record.set('WORKSPACE_CD', newWorkspaceCd);
|
|
425
|
+
record.set('index', -1);
|
|
426
|
+
}
|
|
427
|
+
this.getView().mask();
|
|
428
|
+
Promise.all(this.getDataPromises(records)).catch((error) => {
|
|
429
|
+
Coon.log.debug(error);
|
|
430
|
+
this.getView().unmask();
|
|
431
|
+
Ext.Msg.alert('Ошибка', error.toString());
|
|
432
|
+
}).finally(() => {
|
|
433
|
+
this.getView().unmask();
|
|
434
|
+
this.reloadMenu();
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
},
|
|
412
438
|
});
|
|
@@ -6,12 +6,13 @@ Ext.define('Coon.nav.editor.workspace.NavWorkspaceListController', {
|
|
|
6
6
|
extend: 'Ext.app.ViewController',
|
|
7
7
|
alias: 'controller.NavWorkspaceListController',
|
|
8
8
|
id: 'NavWorkspaceListController',
|
|
9
|
-
|
|
9
|
+
requires: ['Coon.util'],
|
|
10
10
|
listen: {
|
|
11
11
|
component: {
|
|
12
12
|
'NavWorkspaceListView': {
|
|
13
13
|
select: 'selectWorkspace',
|
|
14
14
|
itemdblclick: 'openFormEditWorkspace',
|
|
15
|
+
beforedrop: 'onWorkspaceListBeforeDrop',
|
|
15
16
|
drop: 'onSaveWorkspaceOrder',
|
|
16
17
|
itemcontextmenu: 'showWorkspaceContextMenu',
|
|
17
18
|
},
|
|
@@ -109,6 +110,28 @@ Ext.define('Coon.nav.editor.workspace.NavWorkspaceListController', {
|
|
|
109
110
|
}, this);
|
|
110
111
|
},
|
|
111
112
|
|
|
113
|
+
onWorkspaceListBeforeDrop: function(node, {records}, overModel, dropPosition, dropHandlers) {
|
|
114
|
+
if (!records[0].get('leaf')) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
if (records[0].get('WORKSPACE_CD') === overModel.get('WORKSPACE_CD')) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
const targetWorkspace = overModel.get('DESCRIPTION');
|
|
121
|
+
const infoStr = records.length === 1 ? `"${records[0].get('DESCR')}"` : Coon.util.pluralize(records.length, ['пункт', 'пункта', 'пунктов']) +
|
|
122
|
+
' меню';
|
|
123
|
+
dropHandlers.wait = true;
|
|
124
|
+
Ext.MessageBox.confirm(
|
|
125
|
+
`Подтверждение`,
|
|
126
|
+
`Вы уверены, что хотите перенести ${infoStr} в "${targetWorkspace}"?`,
|
|
127
|
+
(btn) => {
|
|
128
|
+
if (btn === 'yes') {
|
|
129
|
+
Ext.fireEvent('nav:item:workspace-change', records, overModel.get('WORKSPACE_CD'));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
dropHandlers.cancelDrop();
|
|
133
|
+
},
|
|
134
|
+
|
|
112
135
|
/**
|
|
113
136
|
* Срабатывает при перетаскивании рабочего пространства, сохраняет порядок отображения
|
|
114
137
|
*/
|
|
@@ -866,11 +866,6 @@ Ext.define('Coon.report.component.ReportPanel', {
|
|
|
866
866
|
}
|
|
867
867
|
config[prefix + 'type'] = plugin[ns.$uiElement].xtype || plugin[ns.$xtype];
|
|
868
868
|
config[ns.$sortSequence] = plugin[ns.$sortSequence] || null;
|
|
869
|
-
config.pluginConfig = {
|
|
870
|
-
properties: Object.assign({}, config),
|
|
871
|
-
type,
|
|
872
|
-
name: prefix + 'type',
|
|
873
|
-
};
|
|
874
869
|
return config;
|
|
875
870
|
});
|
|
876
871
|
},
|
|
@@ -54,8 +54,10 @@
|
|
|
54
54
|
.x-grid-cell.filtered-cell {
|
|
55
55
|
//background-color: #fff6e8;
|
|
56
56
|
}
|
|
57
|
+
}
|
|
58
|
+
.ReportGrid:not(.gridrowstyleplugin) {
|
|
57
59
|
.x-grid-with-row-lines.enable-striped-rows {
|
|
58
|
-
.x-grid-item-alt:not(.
|
|
60
|
+
.x-grid-item-alt:not(.x-grid-item-selected, .x-grid-item-over) {
|
|
59
61
|
background-color: rgba(137, 204, 198, 0.07);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Ext.define('Coon.report.model.SummaryPluginBean', {
|
|
2
2
|
extend: 'Ext.data.Model',
|
|
3
|
-
requires: 'Coon.report.model.SummaryPluginBeanFields',
|
|
4
3
|
fields: [
|
|
5
4
|
{
|
|
6
5
|
name: 'columnName',
|
|
@@ -12,9 +11,8 @@ Ext.define('Coon.report.model.SummaryPluginBean', {
|
|
|
12
11
|
},
|
|
13
12
|
{
|
|
14
13
|
name: 'precNum',
|
|
15
|
-
type: 'int',
|
|
16
14
|
validators: ['presence'],
|
|
17
|
-
defaultValue:
|
|
15
|
+
defaultValue: 'Не изменять',
|
|
18
16
|
}
|
|
19
17
|
],
|
|
20
18
|
});
|
|
@@ -55,10 +55,21 @@ Ext.define('Coon.report.plugin.configPanel.SummaryPluginConfigPanelSummaryGrid',
|
|
|
55
55
|
],
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const precisionEditor = Ext.create({
|
|
59
|
+
xtype: 'BaseComboBox',
|
|
60
|
+
valueField: 'id',
|
|
61
|
+
displayField: 'text',
|
|
62
|
+
store: {
|
|
63
|
+
data: [
|
|
64
|
+
{id: 'Не изменять', text: 'Не изменять'},
|
|
65
|
+
{id: 0, text: '0'},
|
|
66
|
+
{id: 1, text: '1'},
|
|
67
|
+
{id: 2, text: '2'},
|
|
68
|
+
{id: 3, text: '3'},
|
|
69
|
+
{id: 4, text: '4'},
|
|
70
|
+
{id: 5, text: '5'}
|
|
71
|
+
],
|
|
72
|
+
},
|
|
62
73
|
});
|
|
63
74
|
|
|
64
75
|
this.columns = {
|
|
@@ -70,7 +81,7 @@ Ext.define('Coon.report.plugin.configPanel.SummaryPluginConfigPanelSummaryGrid',
|
|
|
70
81
|
xtype: 'hintColumn',
|
|
71
82
|
editor: summaryTypeEditor,
|
|
72
83
|
},
|
|
73
|
-
{header: '
|
|
84
|
+
{header: 'Отображаемое число разрядов', dataIndex: ns.$precNum, editor: precisionEditor}
|
|
74
85
|
],
|
|
75
86
|
defaults: {
|
|
76
87
|
sortable: true,
|
|
@@ -271,7 +271,6 @@ Ext.define('Coon.report.plugin.grid.GridRowStylePlugin', {
|
|
|
271
271
|
if (uniqCls) {
|
|
272
272
|
grid.addCls(uniqCls);
|
|
273
273
|
}
|
|
274
|
-
grid.addCls('gridrowstyleplugin');
|
|
275
274
|
}
|
|
276
275
|
if (this.treeNodesColors !== false && this.treeNodesColors !== '') {
|
|
277
276
|
const proto = Ext.ClassManager.classes[Ext.ClassManager.aliasToName['widget.'+grid.xtype]].prototype;
|
|
@@ -10,7 +10,7 @@ Ext.define('Coon.report.plugin.grid.GroupRowsPlugin', {
|
|
|
10
10
|
extend: 'Coon.report.plugin.grid.ToolbarButtonPlugin',
|
|
11
11
|
alias: 'plugin.GroupRowsPlugin',
|
|
12
12
|
uses: [],
|
|
13
|
-
requires: ['
|
|
13
|
+
requires: ['Coon.report.plugin.grid.SummaryPlugin'],
|
|
14
14
|
isSingle: true,
|
|
15
15
|
configurePanelWizard: 'GroupRowsPluginConfigPanel',
|
|
16
16
|
|
|
@@ -75,47 +75,7 @@ Ext.define('Coon.report.plugin.grid.GroupRowsPlugin', {
|
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
setSummaryConfigColumn: function() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.valueConfig.forEach((config) => {
|
|
81
|
-
const column = columns.find((col) => col.dataIndex === config.columnName);
|
|
82
|
-
if (column) {
|
|
83
|
-
let summaryType = config.summaryType;
|
|
84
|
-
if (summaryType === 'sum') {
|
|
85
|
-
summaryType = function(records, fieldValues) {
|
|
86
|
-
let result = 0;
|
|
87
|
-
if (!Ext.isEmpty(fieldValues)) {
|
|
88
|
-
fieldValues.forEach((value) => {
|
|
89
|
-
const nextValue = parseFloat(value) || 0;
|
|
90
|
-
|
|
91
|
-
const resultString = '' + result;
|
|
92
|
-
const stringValue = '' + nextValue;
|
|
93
|
-
|
|
94
|
-
const resultPrecision = resultString.includes('.') ? resultString.substring(resultString.indexOf('.') + 1).length : 0;
|
|
95
|
-
const currentPrecision = stringValue.includes('.') ? stringValue.substring(stringValue.indexOf('.') + 1).length : 0;
|
|
96
|
-
|
|
97
|
-
const maxPrecision = Math.max(resultPrecision, currentPrecision);
|
|
98
|
-
const mp = Math.pow(10, maxPrecision);
|
|
99
|
-
result = (result * mp + (nextValue * mp)) / mp;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return result;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
column.setConfig('summaryType', summaryType);
|
|
106
|
-
const summaryRendererConfig = config.summaryRenderer || column.getConfig('summaryRenderer');
|
|
107
|
-
if (summaryRendererConfig && Ext.isFunction(summaryRendererConfig)) {
|
|
108
|
-
column.setConfig('summaryRenderer', summaryRendererConfig);
|
|
109
|
-
} else if (config.precNum) {
|
|
110
|
-
const summaryRenderer = function(value) {
|
|
111
|
-
const precNum = config.precNum;
|
|
112
|
-
const formatString = precNum ? `0.${'0'.repeat(precNum)}` : '0';
|
|
113
|
-
return Number.isNaN(value) ? '' : Ext.util.Format.number(value, formatString);
|
|
114
|
-
};
|
|
115
|
-
column.setConfig('summaryRenderer', summaryRenderer);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
78
|
+
Coon.report.plugin.grid.SummaryPlugin.applySummaryConfig(this.valueConfig, this.component.getColumns());
|
|
119
79
|
},
|
|
120
80
|
|
|
121
81
|
getFields: function(context) {
|
|
@@ -8,6 +8,34 @@ Ext.define('Coon.report.plugin.grid.SummaryPlugin', {
|
|
|
8
8
|
parameters: [],
|
|
9
9
|
configurePanelWizard: 'SummaryPluginConfigPanel',
|
|
10
10
|
|
|
11
|
+
statics: {
|
|
12
|
+
applySummaryConfig(valueConfig, columns) {
|
|
13
|
+
valueConfig.forEach((config) => {
|
|
14
|
+
const column = columns.find((col) => col.dataIndex === config.columnName);
|
|
15
|
+
if (column) {
|
|
16
|
+
let summaryType = config.summaryType;
|
|
17
|
+
if (summaryType === 'sum') {
|
|
18
|
+
summaryType = function(records, fieldValues) {
|
|
19
|
+
return fieldValues.reduce((a, b = 0) => new Decimal(a).plus(new Decimal(b)), 0);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
column.setConfig('summaryType', summaryType);
|
|
23
|
+
const summaryRendererConfig = config.summaryRenderer || column.getConfig('summaryRenderer');
|
|
24
|
+
if (typeof summaryRendererConfig === 'function') {
|
|
25
|
+
column.setConfig('summaryRenderer', summaryRendererConfig);
|
|
26
|
+
} else if (typeof config.precNum !== 'undefined') {
|
|
27
|
+
const decSeparator = column.xtype === 'MoneyColumn' ? '.' : ',';
|
|
28
|
+
const precision = Number.isNaN(config.precNum) ? undefined : config.precNum;
|
|
29
|
+
const summaryRenderer = (value) => {
|
|
30
|
+
return Number.isNaN(value) ? '' : Coon.format.bigNumFormat(value, decSeparator, ' ', precision);
|
|
31
|
+
};
|
|
32
|
+
column.setConfig('summaryRenderer', summaryRenderer);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
11
39
|
constructor: function(config) {
|
|
12
40
|
if (Ext.isEmpty(config.valueConfig)) {
|
|
13
41
|
config.valueConfig = [];
|
|
@@ -28,59 +56,7 @@ Ext.define('Coon.report.plugin.grid.SummaryPlugin', {
|
|
|
28
56
|
},
|
|
29
57
|
|
|
30
58
|
setColumns: function() {
|
|
31
|
-
|
|
32
|
-
for (let i = 0; i < this.valueConfig.length; i++) {
|
|
33
|
-
let column = undefined;
|
|
34
|
-
for (let j = 0; j < columns.length; j++) {
|
|
35
|
-
if (columns[j].dataIndex === this.valueConfig[i].columnName) {
|
|
36
|
-
column = columns[j];
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (column) {
|
|
41
|
-
let summaryType = this.valueConfig[i].summaryType;
|
|
42
|
-
if (summaryType === 'sum') {
|
|
43
|
-
summaryType = function(records, fieldValues) {
|
|
44
|
-
let result = 0;
|
|
45
|
-
if (!Ext.isEmpty(fieldValues)) {
|
|
46
|
-
for (let i = 0; i < fieldValues.length; i++) {
|
|
47
|
-
let nextValue = fieldValues[i];
|
|
48
|
-
if (!Ext.isNumeric(nextValue)) {
|
|
49
|
-
nextValue = Number(parseInt(nextValue, 10));
|
|
50
|
-
if (isNaN(nextValue)) {
|
|
51
|
-
nextValue = 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const resultString = '' + result;
|
|
55
|
-
const stringValue = '' + nextValue;
|
|
56
|
-
const resultPrecision = resultString.length - (resultString.indexOf('.') == -1 ?
|
|
57
|
-
resultString.length :
|
|
58
|
-
(resultString.indexOf('.') + 1));
|
|
59
|
-
const currentPrecision = stringValue.length - (stringValue.indexOf('.') == -1 ?
|
|
60
|
-
stringValue.length :
|
|
61
|
-
(stringValue.indexOf('.') + 1));
|
|
62
|
-
const maxPrecision = Math.max(resultPrecision, currentPrecision);
|
|
63
|
-
const mp = Math.pow(10, maxPrecision);
|
|
64
|
-
result = (result * mp + (nextValue * mp)) / mp;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
column.setConfig('summaryType', summaryType);
|
|
71
|
-
const summaryRendererConfig = this.valueConfig[i].summaryRenderer || column.getConfig('summaryRenderer');
|
|
72
|
-
if (summaryRendererConfig && Ext.isFunction(summaryRendererConfig)) {
|
|
73
|
-
column.setConfig('summaryRenderer', summaryRendererConfig);
|
|
74
|
-
} else if (this.valueConfig[i].precNum) {
|
|
75
|
-
const summaryRenderer = function(value) {
|
|
76
|
-
const precNum = this.valueConfig[i].precNum;
|
|
77
|
-
const formatString = precNum ? `0.${'0'.repeat(precNum)}` : '0';
|
|
78
|
-
return Number.isNaN(value) ? '' : Ext.util.Format.number(value, formatString);
|
|
79
|
-
}.bind(this);
|
|
80
|
-
column.setConfig('summaryRenderer', summaryRenderer);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
59
|
+
this.self.applySummaryConfig(this.valueConfig, this.grid.getColumns());
|
|
84
60
|
},
|
|
85
61
|
|
|
86
62
|
findAndActivateSummaryFeature: function() {
|
|
@@ -153,7 +153,7 @@ Ext.define('Coon.uielement.component.UiCustomController', {
|
|
|
153
153
|
if (!typeof title === 'string') {
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
title = title || Coon.format.withHint('
|
|
156
|
+
title = title || Coon.format.withHint('', 'заголовок не задан');
|
|
157
157
|
view.titleText = title;
|
|
158
158
|
if (
|
|
159
159
|
view.tab && typeof view.tab.setTooltip === 'function'
|
package/src/version.js
CHANGED