ru.coon 3.0.68 → 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,14 @@
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
+
8
+ # Version 3.0.69, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/01e9715d7b9ff10d4898cdf49adc51e10f59ab9b)
9
+ * HT-14867 feat: Черезполосная расцветка строк репорта. Исправление работы со свойствами репорта. ([d91a8e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d91a8ef5f74369009e220fee35e12b485cb27cbb))
10
+ * update: CHANGELOG.md ([62d169], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/62d1691d0a2292271bd17353bae0e5eb3fd1ad11))
11
+
1
12
  # Version 3.0.68, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4c8a28a5fc4878ff7e670c77d3bc794069ab7d2d)
2
13
  * HT-14811: исправление редактирования характеристик FKV ([b5c035], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b5c0356d657071ecc5353a39be973d5b592f7648))
3
14
  * update: CHANGELOG.md ([87a10f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/87a10faa1d038191be9cec97076df7bcea165105))
@@ -24,9 +35,13 @@
24
35
 
25
36
  # Version 3.0.63, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/eb48b260e66b233a4cad92d0d856d0d8da4c021b)
26
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
+
27
41
  * ## Fixes
28
42
  * <span style='color:red'>fix csrf in ReportTreeStore</span> ([cb402a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cb402a1790a7b1081a5e8a17968db947ba583df9))
29
43
 
44
+ * remove default value ([0047e3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0047e3d4507183fa9fbcc32a1ce4b5004fb91524))
30
45
  * HT-14775 fix: Исправление ширины системного тулбара ([bdd783], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bdd7836f8eef889ec642e486e896d3910eeb1850))
31
46
  * update: CHANGELOG.md ([0624d1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0624d16d97c878b4e695b775a6a08cb00d3f12bd))
32
47
 
@@ -40,6 +55,7 @@
40
55
  * ## Fixes
41
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))
42
57
 
58
+ * Добавлена возможность переноса пунктов меню между рабочими пространствами. Closes NEVA-987. ([5ad5e4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5ad5e47733bcf3bd2770e79e767dc9e2db6401e9))
43
59
  * HT-13993 добавлена боковая панель фильтров для репортов ([e2d5c7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e2d5c7436900d232cd48c9389a685affbacf721a))
44
60
  * HT-14628 открытие компонента внутри репорта - закрытие через крестик ([fc4f4e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/fc4f4e9112a3ba1a85cb4a064d65d7a7cfb8cec1))
45
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.68",
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
  },
@@ -25,6 +25,10 @@ Ext.define('Coon.report.component.reportpanel.ReportGrid', {
25
25
  },
26
26
  url: '/ReportFormData/get',
27
27
  contextMenuItemsAdded: false,
28
+ /**
29
+ * Черезполосная раскраска строк
30
+ */
31
+ bodyCls: 'enable-striped-rows',
28
32
 
29
33
  initComponent: function() {
30
34
  this.store = Ext.create('Coon.report.component.reportpanel.ReportStore', {
@@ -54,4 +54,9 @@
54
54
  .x-grid-cell.filtered-cell {
55
55
  //background-color: #fff6e8;
56
56
  }
57
+ .x-grid-with-row-lines.enable-striped-rows {
58
+ .x-grid-item-alt:not(.inheritParentBgColor, .x-grid-item-over) {
59
+ background-color: rgba(137, 204, 198, 0.07);
60
+ }
61
+ }
57
62
  }
@@ -0,0 +1,12 @@
1
+ Ext.define('Coon.report.component.settings.property.PropertyDescriptionPanel', {
2
+ extend: 'Ext.panel.Panel',
3
+ xtype: 'PropertyDescriptionPanel',
4
+ cls: 'PropertyDescriptionPanel',
5
+ frame: true,
6
+ bodyStyle: {
7
+ fontSize: '16px',
8
+ lineHeight: '1.2',
9
+ color: 'gray',
10
+ wordBreak: 'break-word',
11
+ },
12
+ });
@@ -0,0 +1,38 @@
1
+ .PropertyDescriptionPanel {
2
+ padding: 8px;
3
+ .deprecated {
4
+ color: red;
5
+ font-weight: bold;
6
+ font-size: 1.2em;
7
+ padding: 0 4px;
8
+ text-transform: underline;
9
+ text-align: center
10
+ }
11
+ .description {
12
+ color: gray;
13
+ }
14
+ .unknown {
15
+ color: darkolivegreen;
16
+ font-weight: bold;
17
+ font-size: 1.2em;
18
+ padding: 0 4px;
19
+ text-align: center
20
+ }
21
+ .exclude {
22
+ padding-top: 10px;
23
+ .exclude-prop-key {
24
+ font-weight: bold;
25
+ }
26
+ .exclude-onval {
27
+ font-style: italic;
28
+ }
29
+ }
30
+
31
+ .description-default-value {
32
+ padding-top: 8px;
33
+ .default-value {
34
+ font-style: italic;
35
+ }
36
+ }
37
+
38
+ }
@@ -2,14 +2,16 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
2
2
  extend: 'Ext.panel.Panel',
3
3
  xtype: 'PropertySelectPanel',
4
4
  uses: [],
5
- requires: [],
5
+ requires: [
6
+ 'Coon.report.component.settings.property.PropertyDescriptionPanel'
7
+ ],
6
8
  referenceHolder: true,
7
9
  defaultListenerScope: true,
8
10
 
9
11
  viewModel: {
10
12
  },
11
13
 
12
- width: 600,
14
+ width: 1000,
13
15
  height: 500,
14
16
 
15
17
  layout: {
@@ -19,6 +21,7 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
19
21
  buttons: [
20
22
  {
21
23
  text: 'подтвердить',
24
+ ui: 'green-button',
22
25
  reference: 'submitBtn',
23
26
  handler: 'onSubmit',
24
27
  disabled: true,
@@ -75,9 +78,8 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
75
78
  },
76
79
  items: [
77
80
  {
78
- width: 300,
79
- frame: 1,
80
81
  xtype: 'treepanel',
82
+ width: 400,
81
83
  padding: '8 0',
82
84
  layout: 'fit',
83
85
  reference: 'propertyGrid',
@@ -95,7 +97,7 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
95
97
  xtype: 'treecolumn',
96
98
  text: 'Свойство',
97
99
  dataIndex: 'id',
98
- width: 310,
100
+ flex: 1,
99
101
  menuDisabled: true,
100
102
  renderer(val, meta, record) {
101
103
  return val ? `${val}`:`${(record.get('children') && record.get('propTag')) || record.get('key') || ''}`;
@@ -125,11 +127,9 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
125
127
  },
126
128
  },
127
129
  {
128
- xtype: 'panel',
129
- frame: 1,
130
- reference: 'descriptionField',
130
+ xtype: 'PropertyDescriptionPanel',
131
+ reference: 'propDescriptionPanel',
131
132
  flex: 1,
132
- bodyPadding: '16px',
133
133
  }
134
134
  ],
135
135
  }
@@ -147,9 +147,11 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
147
147
  },
148
148
 
149
149
  onSelectItem(_, record) {
150
- if (!record.isLeaf()) {
151
- return;
152
- }
150
+ this.lookup('propDescriptionPanel').setHtml(
151
+ record.isLeaf() ?
152
+ Coon.report.component.settings.property.ReportPropertyDictionary.makePropDescription(record.get('key')) :
153
+ ''
154
+ );
153
155
  },
154
156
 
155
157
  filter: function(_, value) {
@@ -163,8 +165,7 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
163
165
  if (!record.isLeaf()) {
164
166
  return true;
165
167
  }
166
- const result = record.get('key') && record.get('key').toLowerCase().startsWith(value);
167
- return result;
168
+ return record.get('key') && record.get('key').toLowerCase().startsWith(value);
168
169
  }, this);
169
170
  },
170
171
 
@@ -64,26 +64,79 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
64
64
 
65
65
  addNewPropRecord(record) {
66
66
  if (typeof record === 'string') {
67
- record = {key: record, value: ''};
67
+ record = {key: record, value: undefined};
68
68
  } else {
69
- record.value = record.singleValue ? 'true' : '';
69
+ record.value = record.defaultValue !== null ?
70
+ record.defaultValue : '';
70
71
  }
71
- const store = this.lookup('reportPropertyGrid').getStore();
72
- if (!record.multiple) {
72
+ const grid = this.lookup('reportPropertyGrid');
73
+ const store = grid.getStore();
74
+ const conflictedProperty = this.checkConflict(record);
75
+ if (conflictedProperty) {
76
+ Ext.Msg.alert('!', `Новое свойство ${record.key}, конфликтует со свойством ${conflictedProperty}`);
77
+ return;
78
+ }
79
+ if (record.singleValue) {
73
80
  if (store.getRange().find((el) => el.get('key') === record.key)) {
74
- Ext.Msg.alert('!', 'свойство уже добавлено');
81
+ Ext.Msg.alert('!', 'Свойство уже добавлено');
75
82
  return;
76
83
  }
77
84
  }
78
85
  const idx = Number.parseInt(
79
86
  store.max('sequenceNumber')
80
87
  );
81
- store.add({
88
+ const newRecord = store.add({
82
89
  key: record.key,
83
90
  value: record.value,
84
91
  sequenceNumber: idx + 1,
85
92
  isNew: true,
86
93
  });
94
+
95
+ if (Ext.isDefined(record.value)) {
96
+ this.syncProperties();
97
+ store.on('refresh', () => {
98
+ const newRecord = store.findRecord('key', record.key);
99
+ newRecord && grid.getSelectionModel().select(newRecord);
100
+ }, this, {single: true});
101
+ } else {
102
+ grid.getSelectionModel().select(newRecord);
103
+ }
104
+ },
105
+
106
+ /**
107
+ * @param {Object} newProperty - новое свойство. Объект key: value
108
+ * @returns {boolean}
109
+ */
110
+ checkConflict(newProperty) {
111
+ const propertyConfig = this.getPropertyDict(newProperty.key);
112
+ if (!propertyConfig) {
113
+ return false;
114
+ }
115
+ const convert = (value) => {
116
+ if (Ext.isString(value) && Coon.format.isBoolean(value)) {
117
+ return value === 'true';
118
+ }
119
+ return value;
120
+ };
121
+
122
+ const store = this.lookup('reportPropertyGrid').getStore();
123
+ if (propertyConfig.exclude) {
124
+ for (const [key, value] of Object.entries(propertyConfig.exclude)) {
125
+ const found = store.findRecord('key', key);
126
+ if (found && convert(found.get('value')) === convert(value.onVal.toString())) {
127
+ return key;
128
+ }
129
+ }
130
+ }
131
+
132
+ const propertyMap = Coon.report.component.settings.property.ReportPropertyDictionary.getPropertyMap();
133
+ for (const [key, value] of propertyMap.entries()) {
134
+ const isExcluded = Ext.isObject(value.exclude) && convert(value.exclude[newProperty.key]?.onVal) === convert(newProperty.value);
135
+ if (isExcluded && store.findRecord('key', key)) {
136
+ return key;
137
+ }
138
+ }
139
+ return false;
87
140
  },
88
141
 
89
142
  onAddProperty(btn) {
@@ -106,7 +159,6 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
106
159
  }
107
160
  ],
108
161
  });
109
- return;
110
162
  } else {
111
163
  const win = Ext.widget('WindowWrap', {
112
164
  width: 400,
@@ -136,7 +188,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
136
188
  }
137
189
  },
138
190
 
139
- onRemoveProp(btn) {
191
+ onRemoveProp() {
140
192
  const record = this.lookup('reportPropertyGrid').getSelection()[0];
141
193
  const isDeleted = !record.get('isDeleted');
142
194
  record.set('isDeleted', isDeleted);
@@ -151,31 +203,15 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
151
203
  this.publishState('data', this.getData());
152
204
  },
153
205
 
154
- makePropDescription(key) {
155
- const dict = this.getPropertyDict(key);
156
- let description;
157
- if (dict) {
158
- description = dict.description;
159
- if (dict.deprecated) {
160
- description =
161
- `<div class="deprecated">
162
- использование свойства не рекомендуется
163
- </div>
164
- <div class="description">${description}</div>`;
165
- }
166
- } else {
167
- description = '<div class="unknown">неизвестное свойство</div>';
168
- }
169
- return description;
170
- },
171
-
172
206
  onSelectProperty(grid, record) {
173
207
  this.lookup('propForm').record = record;
174
208
  const field = this.lookup('propForm').down('textarea');
175
- this.getViewModel().set('locals.originalPropValue', record.get('value'));
209
+ this.getViewModel().set('locals.originalPropValue', record.get('isNew') ? null : record.get('value'));
176
210
  field.setValue(record.get('value'));
177
211
  this.lookup('propDescriptionPanel')
178
- .setHtml(this.makePropDescription(record.get('key')));
212
+ .setHtml(
213
+ Coon.report.component.settings.property.ReportPropertyDictionary.makePropDescription(record.get('key'))
214
+ );
179
215
  },
180
216
 
181
217
  getData() {
@@ -205,10 +241,6 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
205
241
 
206
242
  setData(data) {
207
243
  this.data = (data || []).map(this.getOnlyPropValue, this);
208
- // this.data.forEach((prop) => {
209
- // const dict = this.getPropertyDict(prop.key);
210
- // prop.description = dict && dict.description;
211
- // });
212
244
  if (!this.rendered) {
213
245
  this.lookup('reportPropertyGrid').on('render', function() {
214
246
  this.lookup('reportPropertyGrid').getStore().loadData(this.data);
@@ -27,25 +27,4 @@
27
27
  border-bottom: 1px dotted lightcoral!important;
28
28
  }
29
29
  }
30
- .propDescriptionPanel {
31
- padding: 8px;
32
- .deprecated {
33
- color: red;
34
- font-weight: bold;
35
- font-size: 1.2em;
36
- padding: 0 4px;
37
- text-transform: underline;
38
- text-align: center
39
- }
40
- .description {
41
- color: gray;
42
- }
43
- .unknown {
44
- color: darkolivegreen;
45
- font-weight: bold;
46
- font-size: 1.2em;
47
- padding: 0 4px;
48
- text-align: center
49
- }
50
- }
51
- }
30
+ }
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Справочник свойств отчета.
3
+ * Представлены в виде дерева (schema).
4
+ * Узлы представлены в виде объектов.
5
+ * Если узел дерева - это какая-то категория свойств отчета (для более понятной картины свойства отчета в дереве сгруппированы по папкам), то
6
+ * в узле leaf: false.
7
+ * Описание некоторых свойств узла дерева:
8
+ * {
9
+ * id: 'fixedTitle', // идентификатор свойства
10
+ * defaultValue: true, // значение свойства при добавлении, используемое по умолчанию.
11
+ * description: 'Пусто', // описание свойства для пользователя
12
+ * singleValue: true, // необязательное свойство. По умолчанию имеет значение true. Если false, то свойство можно
13
+ * // завести несколько раз
14
+ * },
15
+ */
1
16
  Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
2
17
  singleton: true,
3
18
 
@@ -11,14 +26,16 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
11
26
  if (!node.id) {
12
27
  throw new Error(' [ERROR]ReportPropertyDictionary: node.id cant be empty');
13
28
  }
14
- node.path = path || 'root';
15
- node.key = node.id;
16
- if (node.singleValue) {
17
- node.value = true;
18
- }
19
29
  if (this.propertyMap.has(node.id)) {
20
30
  throw new Error(` [ERROR]ReportPropertyDictionary: node.id [${node.id}] is not unique`);
21
31
  }
32
+ node.path = path || 'root';
33
+ node.key = node.id;
34
+ node.singleValue = !Ext.isDefined(node.singleValue) ? true : node.singleValue;
35
+ if (Ext.isDefined(node.defaultValue)) {
36
+ node.value = node.defaultValue;
37
+ }
38
+ node.description = node.leaf && !node.description ? this._notDescribed : node.description;
22
39
  this.propertyMap.set(node.id, node);
23
40
  if (Array.isArray(node.children) && node.children.length) {
24
41
  node.children.forEach((el) => processNode(el, node.path + '.' + node.id));
@@ -28,26 +45,54 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
28
45
  return this;
29
46
  },
30
47
 
31
- getPropById(id) {
32
- const prop = this.propertyMap.get(id);
33
- if (prop) {
34
- prop.name = prop.id;
35
- prop.leaf = !prop.children;
36
- return Ext.clone(prop);
37
- }
38
- },
39
-
40
48
  getPropertyMap() {
41
49
  const acc = new Map();
42
50
  this.propertyMap.forEach((v, k) => acc.set(k, Object.assign({}, v, {children: false})));
43
51
  return acc;
44
52
  },
45
53
 
46
-
47
54
  getSchema() {
48
55
  return Ext.clone(this.schema);
49
56
  },
50
57
 
58
+ makePropDescription(key) {
59
+ const dict = this.getPropertyMap().get(key);
60
+ let description;
61
+ if (dict) {
62
+ description = dict.description;
63
+ if (dict.deprecated) {
64
+ description =
65
+ `<div class="deprecated">
66
+ использование свойства не рекомендуется
67
+ </div>
68
+ <div class="description">${description}</div>`;
69
+ }
70
+ if (Ext.isObject(dict.exclude)) {
71
+ description += this.getExcludeDescription(dict.exclude);
72
+ }
73
+ if (Ext.isDefined(dict.defaultValue)) {
74
+ description += `<div class="description-default-value">
75
+ Значение по умолчанию: <span class="default-value"> ${dict.defaultValue}</span>
76
+ </div>`;
77
+ }
78
+ } else {
79
+ description = '<div class="unknown">неизвестное свойство</div>';
80
+ }
81
+ return description;
82
+ },
83
+
84
+ getExcludeDescription(exclude) {
85
+ let html = '<div class="exclude">Недопустимо при наличии свойств:';
86
+ for (const [key, value] of Object.entries(exclude)) {
87
+ html += `<br>
88
+ <span class="exclude-prop-key">${key}</span> - со значением
89
+ <span class="exclude-onval">${value.onVal}</span>
90
+ `;
91
+ }
92
+ html += '</div>';
93
+ return html;
94
+ },
95
+
51
96
  schema: [
52
97
  {
53
98
  id: 'CLIENT',
@@ -57,30 +102,29 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
57
102
  id: 'gridProperties',
58
103
  leaf: true,
59
104
  deprecated: true,
105
+ defaultValue: '{}',
60
106
  description: 'свойство позволяет настроить таблицу репорта',
61
107
  },
62
108
  {
63
109
  id: 'isReportEngineUsed',
64
110
  leaf: true,
65
- singleValue: true,
66
- description: 'Пусто',
111
+ defaultValue: true,
67
112
  },
68
113
  {
69
114
  id: 'fixedTitle',
70
115
  leaf: true,
71
- singleValue: true,
72
- description: 'Пусто',
116
+ defaultValue: true,
73
117
  },
74
118
  {
75
119
  id: 'autoFilter',
76
120
  leaf: true,
77
- singleValue: true,
121
+ defaultValue: true,
78
122
  description: 'Свойство позволяет репорту делать автоматическую фильтрацию значений при загрузке или при изменении фильтров.',
79
123
  },
80
124
  {
81
125
  id: 'hideFilterPanel',
82
126
  leaf: true,
83
- singleValue: true,
127
+ defaultValue: true,
84
128
  description: 'Свойство скрывает всю панель фильтрации у репорта.',
85
129
  exclude: {
86
130
  hideFilterButtons: {
@@ -99,7 +143,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
99
143
  },
100
144
  {
101
145
  id: 'hideFilterButtons',
102
- singleValue: true,
146
+ defaultValue: true,
103
147
  description: 'Свойство скрывает кнопки взаимодействия в панели фильтрации.',
104
148
  leaf: true,
105
149
  exclude: {
@@ -114,91 +158,87 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
114
158
  {
115
159
  id: 'autoScroll',
116
160
  leaf: true,
117
- singleValue: true,
118
- description: 'Пусто',
161
+ defaultValue: true,
119
162
  },
120
163
  {
121
164
  id: 'activeComponent',
122
165
  leaf: true,
123
- defaultVal: undefined,
124
- description: 'Пусто',
166
+ defaultValue: null,
125
167
  },
126
168
  {
127
169
  id: 'headerOnGrid',
128
170
  leaf: true,
129
- singleValue: true,
171
+ defaultValue: true,
130
172
  description: 'Устанавливает заголовок репорта над таблицей.',
131
173
  },
132
174
  {
133
175
  id: 'clearButtonConfig',
134
176
  leaf: true,
135
- defaultVal: {},
177
+ defaultValue: '{}',
136
178
  description: 'Свойства, передаваемые кнопке очистки в панели фильтрации.',
137
179
  },
138
180
  {
139
181
  id: 'findButtonConfig',
140
182
  leaf: true,
141
- defaultVal: {},
183
+ defaultValue: '{}',
142
184
  description: 'Свойства, передаваемые кнопке поиска в панели фильтрации.',
143
185
  },
144
186
  {
145
187
  id: 'enableAutoSize',
146
188
  leaf: true,
147
- singleValue: true,
189
+ defaultValue: true,
148
190
  description: 'Позволяет репорту автоматически рассчитать ширину колонок при загрузке.',
149
191
  },
150
192
  {
151
193
  id: 'enableSummaryFeature',
152
194
  leaf: true,
153
- singleValue: true,
195
+ defaultValue: true,
154
196
  description: 'Свойство позволяет добавить результирующую строку вниз таблицы.',
155
197
  },
156
198
  {
157
199
  id: 'enableGroupingFeature',
158
200
  leaf: true,
159
- singleValue: true,
201
+ defaultValue: true,
160
202
  description: 'Добавляет к таблице возможность группировки полей.',
161
203
  },
162
204
  {
163
205
  id: 'startCollapsed',
164
206
  leaf: true,
165
- singleValue: true,
166
- description: 'Пусто',
207
+ defaultValue: true,
167
208
  },
168
209
  {
169
210
  id: 'enableTextSelection',
170
211
  leaf: true,
171
- singleValue: true,
212
+ defaultValue: true,
172
213
  description: 'Параметр задает возможность выделять текст внутри ячеек таблицы.',
173
214
  },
174
215
  {
175
216
  id: 'isTree',
176
217
  leaf: true,
177
- singleValue: true,
218
+ defaultValue: true,
178
219
  description: 'Параметр задает вид репорта в виде дерева.',
179
220
  },
180
221
  {
181
222
  id: 'selectOnlyLeaf',
182
223
  leaf: true,
183
- singleValue: true,
224
+ defaultValue: true,
184
225
  description: 'Параметр задает в дереве выбор/не выбор каталогов в качестве передаваемой записи.',
185
226
  },
186
227
  {
187
228
  id: 'groupSortFunc',
188
229
  leaf: true,
189
- defaultVal: null,
190
- description: 'Пусто',
230
+ defaultValue: null,
191
231
  },
192
232
  {
193
233
  id: 'toggleFilterPanel',
194
234
  leaf: true,
195
- singleValue: true,
235
+ defaultValue: true,
196
236
  description: 'Свойство даёт возможность скрывать/показывать фильтры панели по кнопке.',
197
237
  },
198
238
  {
199
239
  id: 'enableChipToolbar',
200
240
  leaf: true,
201
- singleValue: true,
241
+ defaultValue: true,
202
242
  description: 'Свойство включает видимость тулбара с чипами. В чипах отображаются критерии поиска. ' +
203
243
  '<a href="https://confluence.sigma-it.ru/pages/viewpage.action?pageId=636874446" target="_blank"> ' +
204
244
  'Описание <i class="fas fa-external-link-alt"></i></a>',
@@ -206,13 +246,12 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
206
246
  {
207
247
  id: 'enableHighlightingRequiredFields',
208
248
  leaf: true,
209
- singleValue: true,
249
+ defaultValue: true,
210
250
  description: 'Свойство даёт возможность скрывать/показывать признак обязательности заполнения полей.',
211
251
  },
212
252
  {
213
253
  id: 'filterItemsOnRow',
214
254
  leaf: true,
215
- defaultVal: null,
216
255
  description: `Кол-во параметров в 1 строке (по умолчанию равен 4).
217
256
  Порядок следования параметров определяется свойством orderSq.</br>
218
257
  number
@@ -221,7 +260,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
221
260
  {
222
261
  id: 'formFieldFocusPluginConfig',
223
262
  leaf: true,
224
- defaultVal: '{disabled: false, defaultFocusFirstField: true}',
263
+ defaultValue: '{disabled: false, defaultFocusFirstField: true}',
225
264
  description: 'Свойства, передаваемые плагину formFieldFocusPlugin, используемому в фильтр панели репорта ',
226
265
  propertyValueType: 'object',
227
266
  }
@@ -234,7 +273,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
234
273
  {
235
274
  id: 'REPORT_LOGGER_ENABLE',
236
275
  leaf: true,
237
- singleValue: true,
276
+ defaultValue: true,
238
277
  description: `
239
278
  Если свойство принимает значение true,
240
279
  то результирующий запрос, построенный при помощи шаблонизатора, будет отражен в Loki-логах. </br>
@@ -244,7 +283,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
244
283
  {
245
284
  id: 'FETCH_SIZE',
246
285
  leaf: true,
247
- defaultVal: null,
286
+ defaultValue: null,
248
287
  description: `
249
288
  Количество строк, извлекаемых из базы данных за один раз. </br>
250
289
  number`,
@@ -252,7 +291,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
252
291
  {
253
292
  id: 'REPORT_DATA_MODE',
254
293
  leaf: true,
255
- defaultVal: null,
294
+ defaultValue: null,
256
295
  description: `
257
296
  Параметр задает режим работы отчета.
258
297
  По умолчанию принимает значение SWE.
@@ -262,8 +301,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
262
301
  {
263
302
  id: 'WITH_CUSTOM_JDBC_CODE',
264
303
  leaf: true,
265
- singleValue: true,
266
- defaultVal: null,
304
+ defaultValue: true,
267
305
  description: `
268
306
  Пусто. </br>
269
307
  boolean
@@ -272,7 +310,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
272
310
  {
273
311
  id: 'timeout',
274
312
  leaf: true,
275
- defaultVal: null,
313
+ defaultValue: null,
276
314
  description: `
277
315
  Параметр задает время в мсек.
278
316
  если запрос к БД работает дольше,
@@ -283,7 +321,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
283
321
  {
284
322
  id: 'DATA_SOURCE_NAME',
285
323
  leaf: true,
286
- defaultVal: null,
324
+ defaultValue: null,
287
325
  description: `
288
326
  Источник данных (JDBC URL). </br>
289
327
  string
@@ -296,13 +334,13 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
296
334
  {
297
335
  id: 'ACCESS_CONTEXT_PATH',
298
336
  leaf: true,
299
- defaultVal: null,
337
+ defaultValue: null,
300
338
  description: 'Путь до политики',
301
339
  },
302
340
  {
303
341
  id: 'ACCESS_FIELD_NAME',
304
342
  leaf: true,
305
- defaultVal: null,
343
+ defaultValue: null,
306
344
  description: 'Поле в репорте, по которому фильтровать строки репорта.',
307
345
  propertyValueType: 'combo',
308
346
  }
@@ -311,8 +349,8 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
311
349
  {
312
350
  id: 'TAG',
313
351
  leaf: true,
314
- defaultVal: null,
315
- multiple: true,
352
+ defaultValue: null,
353
+ singleValue: false,
316
354
  description: `
317
355
  Свойство позволяет добавить еще один параметр поиска отчета в списке отчетов. </br>
318
356
  string
@@ -321,22 +359,16 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
321
359
  {
322
360
  id: 'TEMPLATE',
323
361
  leaf: true,
324
- defaultVal: null,
362
+ defaultValue: null,
325
363
  description: `
326
364
  Свойство задает использование определенного шаблонизатора (на данный момент используется только FREEMARKER). </br>
327
365
  string
328
366
  `,
329
- exclude: {
330
- REPORT_LOGGER_ENABLE: {
331
- onVal: '',
332
- },
333
- },
334
367
  },
335
368
  {
336
369
  id: 'cached',
337
370
  leaf: true,
338
- singleValue: true,
339
- defaultVal: null,
371
+ defaultValue: true,
340
372
  description: `
341
373
  Включает кэширование репортов. </br>
342
374
  boolean
@@ -345,7 +377,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
345
377
  {
346
378
  id: 'timeToLive',
347
379
  leaf: true,
348
- defaultVal: null,
380
+ defaultValue: null,
349
381
  description: `
350
382
  Время жизни кэша. </br>
351
383
  number (minutes)
@@ -354,5 +386,4 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
354
386
  ],
355
387
  }
356
388
  ],
357
-
358
389
  });
@@ -19,18 +19,9 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyForm', {
19
19
  },
20
20
  items: [
21
21
  {
22
- xtype: 'panel',
22
+ xtype: 'PropertyDescriptionPanel',
23
23
  reference: 'propDescriptionPanel',
24
- cls: 'propDescriptionPanel',
25
24
  flex: 1,
26
- frame: true,
27
- bodyStyle: {
28
- fontSize: '16px',
29
- padding: '8px',
30
- lineHeight: '1.2',
31
- color: 'gray',
32
- wordBreak: 'break-word',
33
- },
34
25
  },
35
26
  {
36
27
  xtype: 'textarea',
@@ -57,6 +48,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyForm', {
57
48
  },
58
49
  {
59
50
  text: 'подтвердить',
51
+ ui: 'green-button',
60
52
  disabled: true,
61
53
  itemId: 'submit',
62
54
  handler: 'onChangeValue',
@@ -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.68',
3
+ number: '3.0.71',
4
4
  });