ru.coon 3.0.69 → 3.0.71

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 CHANGED
@@ -17,6 +17,7 @@ module.exports = {
17
17
  'JSON5': 'readonly',
18
18
  'Coon': 'writable',
19
19
  'Iconpack': 'writable',
20
+ 'Decimal': 'readonly',
20
21
  },
21
22
  'parserOptions': {
22
23
  ecmaVersion: 2020,
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # Version 3.0.71, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c392614cffea74a4f5b5886307e26be5fffcb14a)
2
+ * update: CHANGELOG.md ([f10394], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f10394bec0b7055bc79a4716495bc9049e994758))
3
+
4
+ # Version 3.0.70, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f6109b23cc11c2f08c51e25913c6682f1615e007)
5
+ * update extjs_iconpack to 1.3.32 ([3ecbff], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3ecbff43a095b23a50d5d4d9519d5c9c47a96735))
6
+ * update: CHANGELOG.md ([89b129], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/89b129bf2c7a0ebc036089f75032ab8dd647d99d))
7
+
1
8
  # Version 3.0.69, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/01e9715d7b9ff10d4898cdf49adc51e10f59ab9b)
2
9
  * HT-14867 feat: Черезполосная расцветка строк репорта. Исправление работы со свойствами репорта. ([d91a8e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d91a8ef5f74369009e220fee35e12b485cb27cbb))
3
10
  * update: CHANGELOG.md ([62d169], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/62d1691d0a2292271bd17353bae0e5eb3fd1ad11))
@@ -28,9 +35,13 @@
28
35
 
29
36
  # Version 3.0.63, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/eb48b260e66b233a4cad92d0d856d0d8da4c021b)
30
37
  # Version 3.0.62, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d8f3faa85fc70860397b0074b43d93aa9b9ffa00)
38
+ * ## Features
39
+ * <span style='color:green'>feat: Форматирование суммирующих строк, автоматическое число разрядов по умолчанию. Closes HT-14817.</span> ([42319f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/42319f2d024ef87e00dadfb112f049c4c20d4c7a))
40
+
31
41
  * ## Fixes
32
42
  * <span style='color:red'>fix csrf in ReportTreeStore</span> ([cb402a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cb402a1790a7b1081a5e8a17968db947ba583df9))
33
43
 
44
+ * remove default value ([0047e3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0047e3d4507183fa9fbcc32a1ce4b5004fb91524))
34
45
  * HT-14775 fix: Исправление ширины системного тулбара ([bdd783], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bdd7836f8eef889ec642e486e896d3910eeb1850))
35
46
  * update: CHANGELOG.md ([0624d1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0624d16d97c878b4e695b775a6a08cb00d3f12bd))
36
47
 
@@ -44,6 +55,7 @@
44
55
  * ## Fixes
45
56
  * <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
57
 
58
+ * Добавлена возможность переноса пунктов меню между рабочими пространствами. Closes NEVA-987. ([5ad5e4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5ad5e47733bcf3bd2770e79e767dc9e2db6401e9))
47
59
  * HT-13993 добавлена боковая панель фильтров для репортов ([e2d5c7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e2d5c7436900d232cd48c9389a685affbacf721a))
48
60
  * HT-14628 открытие компонента внутри репорта - закрытие через крестик ([fc4f4e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/fc4f4e9112a3ba1a85cb4a064d65d7a7cfb8cec1))
49
61
  * 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.69",
7
+ "version": "3.0.71",
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.27",
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",
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
  });
@@ -22,6 +22,7 @@ Ext.define('Coon.nav.editor.menu.NavMenuTreeView', {
22
22
  enableDrag: true,
23
23
  allowContainerDrop: true,
24
24
  appendOnly: false,
25
+ ddGroup: 'gridTreeDD',
25
26
  },
26
27
  },
27
28
  },
@@ -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
  */
@@ -21,6 +21,7 @@ Ext.define('Coon.nav.editor.workspace.NavWorkspaceListView', {
21
21
  gridviewdragdrop: {
22
22
  enableDrop: true,
23
23
  enableDrag: true,
24
+ ddGroup: 'gridTreeDD',
24
25
  },
25
26
  },
26
27
  },
@@ -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: 2,
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 numberField = Ext.create('Ext.form.field.Number', {
59
- allowBlank: true,
60
- allowDecimals: false,
61
- minValue: 0,
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: 'Число разрядов', dataIndex: ns.$precNum, xtype: 'hintColumn', editor: numberField}
84
+ {header: 'Отображаемое число разрядов', dataIndex: ns.$precNum, editor: precisionEditor}
74
85
  ],
75
86
  defaults: {
76
87
  sortable: true,
@@ -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: ['Ext.grid.feature.Grouping'],
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
- const columns = this.component.getColumns();
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
- const columns = this.grid.getColumns();
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() {
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '3.0.69',
3
+ number: '3.0.71',
4
4
  });