ru.coon 2.8.21 → 2.8.23
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/CHANGELOG.md +26 -0
- package/package.json +1 -1
- package/src/chart/BaseChart.js +4 -1
- package/src/chart/CoonChart.js +76 -49
- package/src/chart/editor/CoonChartEditor.js +81 -60
- package/src/chart/editor/CoonChartEditorController.js +134 -176
- package/src/chart/editor/DataSourceChartBindForm.js +97 -119
- package/src/report/component/ReportPanel.js +27 -0
- package/src/report/plugin/grid/FilterFormEditingPlugin.js +1 -1
- package/src/report/plugin/grid/ToolbarButtonPlugin.js +18 -2
- package/src/report/plugin/grid/ToolbarItemPlugin.js +1 -0
- package/src/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
|
+
# Version 2.8.23, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c36774795559da6d9f0d5780d591a33e16b1c99f)
|
|
2
|
+
* ## Features
|
|
3
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([24fca5], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/24fca5f0d13c24b0e4d76c489d082589647d05de))
|
|
4
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([055785], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/05578581ee41bb993ed48efbc9072d0fd11b69b5))
|
|
5
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([dd953a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/dd953a4782945ddfb6516fe8866bc9d6ee9d3370))
|
|
6
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([81da35], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/81da35474745b812fcf89c4b569870ed72a4c66e))
|
|
7
|
+
|
|
8
|
+
* upd ([571495], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/571495ffbd6b23c76edd9eac741b87163fc59cdc))
|
|
9
|
+
* add loadFakeData to ReportPanel ([671b7f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/671b7f27f3538291a56ba8c1b45016910b42e17d))
|
|
10
|
+
* update: CHANGELOG.md ([c73ba4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c73ba4e040a66da70edbeb990b8e7d42a690cc1b))
|
|
11
|
+
|
|
12
|
+
# Version 2.8.22, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/abdcd052a504db9e3ef0d640c05c861dab6fc771)
|
|
13
|
+
* ## Features
|
|
14
|
+
* <span style='color:green'>feat: HT-10212: fix layout bug</span> ([cec2b3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cec2b36d2917ca56537c119f1ce1ead71c8ca009))
|
|
15
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([6ddef7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6ddef7e1775c40563be1d0959a6270a929fa7509))
|
|
16
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([57ffb8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/57ffb80671975236cd3cfc78583ac9e13779392b))
|
|
17
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([239bb2], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/239bb2d06eeb59e3dee05507fed41f41a8d64498))
|
|
18
|
+
* <span style='color:green'>feat: HT-10463: fix add in context menu button</span> ([4588f7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4588f75ee55b80327192cb7df28770d41d4707c6))
|
|
19
|
+
|
|
20
|
+
* update: CHANGELOG.md ([866504], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/86650477e9606983c72620ed063150bb23fc3e4e))
|
|
21
|
+
|
|
1
22
|
# Version 2.8.21, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/dcc7c4b24a73690b18533027979c7ed0e3c88a78)
|
|
2
23
|
* ## Features
|
|
3
24
|
* <span style='color:green'>feat: BFL-16584: fix create plugin method</span> ([0b4aaf], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0b4aafb76151f2a689fed079857e972fb9c34ebd))
|
|
25
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([9eff33], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9eff333c0a480672aea7d594bd44688fe3e89653))
|
|
4
26
|
|
|
5
27
|
* update: CHANGELOG.md ([5cbccf], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5cbccffafebcc1252fae28c0ca74fa09e43b2180))
|
|
6
28
|
|
|
7
29
|
# Version 2.8.20, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c7acd5384ee23afce8f37cc9b5821c3837f5cf98)
|
|
8
30
|
* ## Features
|
|
9
31
|
* <span style='color:green'>feat: BFL-16584: fix create plugin method</span> ([36b867], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/36b8678a1bb336a50930d379219dc61ac5a06a97))
|
|
32
|
+
* <span style='color:green'>feat: Add itemId property with pluginId value on each toolbar item to auto generate testId. Related to HT-8881.</span> ([32f736], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/32f7362b2a2a090842dd56feadc5586a5188b037))
|
|
33
|
+
* <span style='color:green'>feat: HT-10270 CoonChart new chartType and refactoring</span> ([fee620], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/fee62060cb96b665b4353b1c962b897de1c09046))
|
|
10
34
|
|
|
11
35
|
* update: CHANGELOG.md ([7dcff7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7dcff78843efc4b137d3796aee2273bf65db0e53))
|
|
12
36
|
|
|
@@ -174,6 +198,8 @@ feat: HT-10458: Check then summery row has values</span> ([b87004], [link](http:
|
|
|
174
198
|
* <span style='color:green'>feat: TR-67905 loginForm and TextFieldFormatter plugin</span> ([aafbfc], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/aafbfc81b05aa91a172905b47bf7c620f720be11))
|
|
175
199
|
* <span style='color:green'>feat: HT-10115: chain plugin return result, log unified buttons call handlers result</span> ([408dab], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/408dab15c6afc49e47bd80729bf55e1a541522cc))
|
|
176
200
|
* <span style='color:green'>feat: [ReportTree][CharacteristicGridCopyPlugin] Added testId generation. Related to HT-8881.</span> ([2bc5e8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2bc5e899f6a5d390844fcc25fc4511b5d195fbb8))
|
|
201
|
+
* <span style='color:green'>feat: [ReportTree] Added generating of testId's on tree nodes. Related to HT-8881.</span> ([648ff1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/648ff18a85a4cdb3ca1a9953e08808b4c3a822ad))
|
|
202
|
+
* <span style='color:green'>feat: [CharacteristicGridCopyPlugin] Added property to enable generating of testId's on column widgets. Related to HT-8881.</span> ([aa03d7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/aa03d72ab1592b7134d1d980f442a9901852424b))
|
|
177
203
|
|
|
178
204
|
* ## Fixes
|
|
179
205
|
* <span style='color:red'> TR-68748: set aceEditor value on render editor</span> ([0ec858], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0ec858f3daaa04b6ae03ad6980b98e68795538f9))
|
package/package.json
CHANGED
package/src/chart/BaseChart.js
CHANGED
|
@@ -63,6 +63,9 @@ Ext.define('Coon.chart.BaseChart', {
|
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
clearChart() {
|
|
66
|
+
if (!this.chart) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
66
69
|
this.chart.clear();
|
|
67
70
|
this.ownerCt.setFilterDefaults({});
|
|
68
71
|
},
|
|
@@ -71,7 +74,7 @@ Ext.define('Coon.chart.BaseChart', {
|
|
|
71
74
|
rows = rows || cfg.rows;
|
|
72
75
|
cfg.series = cfg.serieFields.map((field) => {
|
|
73
76
|
return Object.assign({}, cfg.serieConfig, {data: rows.map((row) => {
|
|
74
|
-
return
|
|
77
|
+
return {name: row[cfg.legend], value: row[field]};
|
|
75
78
|
})});
|
|
76
79
|
});
|
|
77
80
|
Coon.log.debug('loadChart', {cfg, rows});
|
package/src/chart/CoonChart.js
CHANGED
|
@@ -180,43 +180,45 @@ Ext.define('Coon.chart.CoonChart', {
|
|
|
180
180
|
},
|
|
181
181
|
|
|
182
182
|
getChartConfig(type) {
|
|
183
|
+
const typeConfig = type === 'pie' ? type : 'default';
|
|
184
|
+
const defaultConfig = {
|
|
185
|
+
rows: [],
|
|
186
|
+
tooltip: {
|
|
187
|
+
trigger: 'item',
|
|
188
|
+
},
|
|
189
|
+
legend: {},
|
|
190
|
+
};
|
|
183
191
|
const config = {
|
|
184
|
-
|
|
185
|
-
rows: [],
|
|
192
|
+
default: {
|
|
186
193
|
categoryAxis: {
|
|
187
194
|
type: 'category',
|
|
188
|
-
data: [],
|
|
189
195
|
},
|
|
190
196
|
valueAxis: {
|
|
191
197
|
type: 'value',
|
|
198
|
+
name: '',
|
|
199
|
+
},
|
|
200
|
+
legend: {
|
|
201
|
+
data: [],
|
|
192
202
|
},
|
|
193
|
-
serieFields: [],
|
|
194
203
|
serieConfig: {
|
|
195
204
|
name: '',
|
|
196
|
-
type:
|
|
205
|
+
type: type,
|
|
197
206
|
},
|
|
207
|
+
categoryLineY: false,
|
|
198
208
|
},
|
|
199
209
|
pie: {
|
|
200
|
-
rows: [],
|
|
201
|
-
tooltip: {
|
|
202
|
-
trigger: 'item',
|
|
203
|
-
},
|
|
204
210
|
legend: {
|
|
205
211
|
orient: 'vertical',
|
|
206
212
|
left: 'left',
|
|
207
213
|
},
|
|
208
214
|
serieConfig: {
|
|
209
215
|
name: '',
|
|
210
|
-
type:
|
|
216
|
+
type: type,
|
|
211
217
|
radius: '50%',
|
|
212
218
|
},
|
|
213
|
-
serieFields: [],
|
|
214
219
|
},
|
|
215
220
|
};
|
|
216
|
-
|
|
217
|
-
if (result) {
|
|
218
|
-
return result;
|
|
219
|
-
}
|
|
221
|
+
return Ext.apply(defaultConfig, config[typeConfig]);
|
|
220
222
|
},
|
|
221
223
|
|
|
222
224
|
getCoonChartData(coonChartId) {
|
|
@@ -224,7 +226,7 @@ Ext.define('Coon.chart.CoonChart', {
|
|
|
224
226
|
loadUiElementCommand.on('complete', function(response) {
|
|
225
227
|
const propertyData = response.propertyData && JSON.parse(response.propertyData);
|
|
226
228
|
this.coonChartData = Object.assign(this.getChartConfig(propertyData.chartType), response, propertyData);
|
|
227
|
-
this.coonChartData.axisName = this.coonChartData.chartType === 'bar' && this.coonChartData.fieldset[this.coonChartData.
|
|
229
|
+
// this.coonChartData.axisName = this.coonChartData.chartType === 'bar' && this.coonChartData.fieldset[this.coonChartData.categoryField];
|
|
228
230
|
this.loadDataFromSource();
|
|
229
231
|
}, this);
|
|
230
232
|
loadUiElementCommand.execute(coonChartId);
|
|
@@ -237,16 +239,20 @@ Ext.define('Coon.chart.CoonChart', {
|
|
|
237
239
|
}
|
|
238
240
|
const doFilter = (this.filterDefaults ? this.filterDefaults.doFilter : undefined);
|
|
239
241
|
if (this.autoFilter || doFilter) {
|
|
240
|
-
me.
|
|
242
|
+
me.loadMask = new Ext.LoadMask({
|
|
243
|
+
target: me,
|
|
244
|
+
msg: 'Идет построение графика...',
|
|
245
|
+
});
|
|
246
|
+
me.loadMask.show();
|
|
241
247
|
this.getDataSourceData(this.coonChartData).then(function(data) {
|
|
242
248
|
if (data && Array.isArray(data.list) && data.list.length > 0) {
|
|
243
249
|
me.coonChartData.rows = data.list;
|
|
244
250
|
me.setChartData(me.coonChartData);
|
|
245
251
|
}
|
|
246
|
-
me.unmask();
|
|
247
252
|
}).catch((error) => {
|
|
248
|
-
me.unmask();
|
|
249
253
|
Coon.log.error('getDataSourceData', error);
|
|
254
|
+
}).finally(() => {
|
|
255
|
+
me.loadMask && me.loadMask.destroy();
|
|
250
256
|
});
|
|
251
257
|
}
|
|
252
258
|
},
|
|
@@ -301,51 +307,72 @@ Ext.define('Coon.chart.CoonChart', {
|
|
|
301
307
|
|
|
302
308
|
setChartData(config, fieldAlerts) {
|
|
303
309
|
const alerts = [];
|
|
304
|
-
const isSettingAxisData = config.
|
|
310
|
+
const isSettingAxisData = config.chartType === 'bar' || config.chartType === 'line';
|
|
311
|
+
const defaultConfig = this.getChartConfig(config.chartType);
|
|
305
312
|
const isNumber = (v) => Ext.Number.isFinite(parseFloat(v));
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
313
|
+
const normalizeValue = (row, fieldConfig, type) => {
|
|
314
|
+
let value;
|
|
315
|
+
const field = fieldConfig.reportField;
|
|
316
|
+
if (type === 'serie') {
|
|
317
|
+
value = isNumber(row[field]) && row[field] ||
|
|
318
|
+
isNumber(fieldConfig.defaultValue) && fieldConfig.defaultValue;
|
|
310
319
|
}
|
|
311
|
-
if (
|
|
320
|
+
if (type === 'axis') {
|
|
321
|
+
value = row[field] || fieldConfig.defaultValue;
|
|
322
|
+
}
|
|
323
|
+
if (!value) {
|
|
312
324
|
alerts.push({type: 'serie', val: field});
|
|
325
|
+
return;
|
|
313
326
|
}
|
|
314
327
|
return value;
|
|
315
328
|
};
|
|
316
329
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
330
|
+
const categoryAxis = config.categoryConfig.map((fieldConfig) => {
|
|
331
|
+
const configObj = Object.assign({}, fieldConfig.additionalConfig, fieldConfig, defaultConfig.categoryAxis);
|
|
332
|
+
delete configObj.additionalConfig;
|
|
333
|
+
return configObj;
|
|
334
|
+
});
|
|
335
|
+
const valueAxis = config.valueConfig.map((fieldConfig) => {
|
|
336
|
+
const configObj = Object.assign({}, fieldConfig.additionalConfig, fieldConfig, defaultConfig.valueAxis);
|
|
337
|
+
delete configObj.additionalConfig;
|
|
338
|
+
return configObj;
|
|
339
|
+
});
|
|
340
|
+
const legend = config.legendConfig.map((fieldConfig) => {
|
|
341
|
+
const configObj = Object.assign({}, fieldConfig.additionalConfig, fieldConfig, defaultConfig.legend);
|
|
342
|
+
delete configObj.additionalConfig;
|
|
343
|
+
return configObj;
|
|
344
|
+
});
|
|
345
|
+
const series = config.serieConfig.map((fieldConfig) => {
|
|
346
|
+
const configObj = Object.assign({}, fieldConfig.additionalConfig, fieldConfig, defaultConfig.serieConfig);
|
|
347
|
+
delete configObj.additionalConfig;
|
|
348
|
+
return configObj;
|
|
349
|
+
});
|
|
350
|
+
config.rows.map((row) => {
|
|
351
|
+
categoryAxis.forEach((categoryEl) => {
|
|
352
|
+
categoryEl.data = categoryEl.data || [];
|
|
353
|
+
categoryEl.data.push(normalizeValue(row, categoryEl, 'axis'));
|
|
354
|
+
});
|
|
355
|
+
series.forEach((serieEl) => {
|
|
356
|
+
serieEl.data = serieEl.data || [];
|
|
357
|
+
serieEl.data.push(normalizeValue(row, serieEl, 'serie'));
|
|
358
|
+
});
|
|
359
|
+
legend.forEach((legendEl) => {
|
|
360
|
+
legendEl.data = legendEl.data || [];
|
|
361
|
+
legendEl.data.push(normalizeValue(row, legendEl, 'axis'));
|
|
337
362
|
});
|
|
338
363
|
});
|
|
339
|
-
|
|
340
|
-
|
|
364
|
+
config.categoryAxis = isSettingAxisData && categoryAxis;
|
|
365
|
+
config.valueAxis = isSettingAxisData && valueAxis;
|
|
366
|
+
config.legend = legend;
|
|
367
|
+
if (isSettingAxisData && !config.categoryLineY) {
|
|
341
368
|
config.xAxis = config.categoryAxis;
|
|
342
369
|
config.yAxis = config.valueAxis;
|
|
343
370
|
}
|
|
344
|
-
if (config.
|
|
371
|
+
if (isSettingAxisData && config.categoryLineY) {
|
|
345
372
|
config.yAxis = config.categoryAxis;
|
|
346
373
|
config.xAxis = config.valueAxis;
|
|
347
374
|
}
|
|
348
|
-
config.series =
|
|
375
|
+
config.series = series;
|
|
349
376
|
this.showErrorMessage(alerts, fieldAlerts);
|
|
350
377
|
this.down('BaseChart').clearChart();
|
|
351
378
|
this.loadChart(config);
|
|
@@ -34,13 +34,10 @@ Ext.define('Coon.chart.editor.CoonChartEditor', {
|
|
|
34
34
|
type: 'vbox',
|
|
35
35
|
align: 'stretch',
|
|
36
36
|
},
|
|
37
|
-
// defaults: {
|
|
38
|
-
// flex: 1,
|
|
39
|
-
// },
|
|
40
37
|
items: [
|
|
41
38
|
{
|
|
42
39
|
xtype: 'panel',
|
|
43
|
-
title: 'Параметры',
|
|
40
|
+
title: 'Параметры диаграммы',
|
|
44
41
|
layout: {
|
|
45
42
|
type: 'vbox',
|
|
46
43
|
align: 'stretch',
|
|
@@ -74,61 +71,98 @@ Ext.define('Coon.chart.editor.CoonChartEditor', {
|
|
|
74
71
|
reference: 'description',
|
|
75
72
|
xtype: 'textfield',
|
|
76
73
|
bind: '{coonChart.description}',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
xtype: 'combo',
|
|
77
|
+
fieldLabel: 'Тип диаграммы',
|
|
78
|
+
reference: 'chartType',
|
|
79
|
+
editable: false,
|
|
80
|
+
bind: {
|
|
81
|
+
value: '{coonChart.chartType}',
|
|
82
|
+
},
|
|
83
|
+
store: ['bar', 'pie', 'line'],
|
|
77
84
|
}
|
|
78
85
|
],
|
|
79
86
|
},
|
|
80
87
|
{
|
|
81
|
-
xtype: '
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
bind: {
|
|
86
|
-
value: '{coonChart.chartType}',
|
|
88
|
+
xtype: 'panel',
|
|
89
|
+
layout: {
|
|
90
|
+
type: 'hbox',
|
|
91
|
+
align: 'stretch',
|
|
87
92
|
},
|
|
88
|
-
store: ['bar', 'pie'],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
xtype: 'radiogroup',
|
|
92
|
-
reference: 'sourceType',
|
|
93
93
|
items: [
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
{
|
|
95
|
+
xtype: 'combo',
|
|
96
|
+
reference: 'sourceType',
|
|
97
|
+
displayField: 'descr',
|
|
98
|
+
valueField: 'val',
|
|
99
|
+
name: 'sourceType',
|
|
100
|
+
flex: 1,
|
|
101
|
+
store: [
|
|
102
|
+
{descr: 'репорт', val: 'report'},
|
|
103
|
+
{descr: 'команда', val: 'command'}
|
|
104
|
+
],
|
|
105
|
+
bind: {
|
|
106
|
+
value: '{coonChart.sourceType}',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
xtype: 'AbstractComponentComboBox',
|
|
111
|
+
fieldLabel: 'команда',
|
|
112
|
+
reference: 'command',
|
|
113
|
+
displayField: 'name',
|
|
114
|
+
valueField: 'value',
|
|
115
|
+
flex: 2,
|
|
116
|
+
getData() {
|
|
117
|
+
return [];
|
|
118
|
+
},
|
|
119
|
+
bind: {
|
|
120
|
+
value: '{coonChart.commandSourceId}',
|
|
121
|
+
hidden: '{coonChart.sourceType === "report"}',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
xtype: 'ReportLookupCombo',
|
|
126
|
+
reportId: 'REPORTS',
|
|
127
|
+
valueField: 'CM_REPORT_CD',
|
|
128
|
+
displayField: 'CM_REPORT_CD',
|
|
129
|
+
reference: 'reportSourceField',
|
|
130
|
+
flex: 2,
|
|
131
|
+
bind: {
|
|
132
|
+
value: '{coonChart.reportSourceId}',
|
|
133
|
+
hidden: '{coonChart.sourceType === "command"}',
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
]},
|
|
112
137
|
{
|
|
113
138
|
xtype: 'textfield',
|
|
114
|
-
fieldLabel: '
|
|
115
|
-
reference: '
|
|
139
|
+
fieldLabel: 'Параметры в фомате {"parameter1Name":"value","parameter2Name":"value"}',
|
|
140
|
+
reference: 'parametersField',
|
|
116
141
|
bind: {
|
|
117
|
-
value: '{coonChart.
|
|
118
|
-
hidden: '{coonChart.sourceType === "command"}',
|
|
142
|
+
value: '{coonChart.parameters}',
|
|
119
143
|
},
|
|
120
144
|
},
|
|
121
145
|
{
|
|
122
|
-
xtype: '
|
|
123
|
-
|
|
124
|
-
|
|
146
|
+
xtype: 'checkbox',
|
|
147
|
+
boxLabel: 'Отобразить категорию по оси y',
|
|
148
|
+
boxLabelAlign: 'after',
|
|
125
149
|
bind: {
|
|
126
|
-
value: '{coonChart.
|
|
150
|
+
value: '{coonChart.categoryLineY}',
|
|
127
151
|
},
|
|
128
152
|
}
|
|
129
153
|
],
|
|
130
154
|
buttons: [
|
|
131
|
-
{
|
|
155
|
+
{
|
|
156
|
+
text: 'Загрузить данные',
|
|
157
|
+
itemId: 'configDataSourceBindBtn',
|
|
158
|
+
handler: 'configDataSourceBinds',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
text: 'Отобразить диаграмму',
|
|
162
|
+
tooltip: 'Чтобы отобразить диаграмму нужно загрузить данные',
|
|
163
|
+
itemId: 'loadDataBtn',
|
|
164
|
+
handler: 'showCoonChartHandler',
|
|
165
|
+
}
|
|
132
166
|
],
|
|
133
167
|
},
|
|
134
168
|
{
|
|
@@ -140,23 +174,6 @@ Ext.define('Coon.chart.editor.CoonChartEditor', {
|
|
|
140
174
|
align: 'stretch',
|
|
141
175
|
},
|
|
142
176
|
items: [
|
|
143
|
-
// {
|
|
144
|
-
// xtype: 'panel',
|
|
145
|
-
// title: 'конфигурация',
|
|
146
|
-
// layout: {
|
|
147
|
-
// type: 'vbox',
|
|
148
|
-
// align: 'stretch',
|
|
149
|
-
// },
|
|
150
|
-
// flex: 1,
|
|
151
|
-
// items: [
|
|
152
|
-
// {
|
|
153
|
-
// xtype: 'UiAceEditor',
|
|
154
|
-
// reference: 'UiAceEditor',
|
|
155
|
-
// flex: 1,
|
|
156
|
-
// margin: 10,
|
|
157
|
-
// }
|
|
158
|
-
// ],
|
|
159
|
-
// },
|
|
160
177
|
{
|
|
161
178
|
xtype: 'DataSourceChartBindForm',
|
|
162
179
|
flex: 1,
|
|
@@ -183,7 +200,11 @@ Ext.define('Coon.chart.editor.CoonChartEditor', {
|
|
|
183
200
|
{text: 'отменить', itemId: 'cancel', handler(btn) {
|
|
184
201
|
btn.up('CoonChartEditor').close();
|
|
185
202
|
}},
|
|
186
|
-
{
|
|
203
|
+
{
|
|
204
|
+
text: 'подтвердить',
|
|
205
|
+
itemId: 'submit',
|
|
206
|
+
handler: 'onSubmitCoonChart',
|
|
207
|
+
}
|
|
187
208
|
],
|
|
188
209
|
|
|
189
210
|
});
|
|
@@ -3,172 +3,159 @@ Ext.define('Coon.chart.editor.CoonChartEditorController', {
|
|
|
3
3
|
|
|
4
4
|
alias: 'controller.CoonChartEditorController',
|
|
5
5
|
|
|
6
|
-
control: {
|
|
7
|
-
'button#submit': {
|
|
8
|
-
click: 'onSubmitCoonChart',
|
|
9
|
-
},
|
|
10
|
-
'radiogroup': {
|
|
11
|
-
change: 'onChangeSourceType',
|
|
12
|
-
},
|
|
13
|
-
'button#configDataSourceBindBtn': {
|
|
14
|
-
click: 'configDataSourceBinds',
|
|
15
|
-
},
|
|
16
|
-
'button#loadDataBtn': {
|
|
17
|
-
click: 'onChangeDataSourceConfig',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
|
|
21
6
|
init() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
this.setComboStore(chartType);
|
|
27
|
-
vm.set('coonChart.config', this.lookup('SampleChart').getChartConfig(chartType));
|
|
7
|
+
this.vm = this.getViewModel();
|
|
8
|
+
this.dataSourceChartBindForm = this.getView().down('DataSourceChartBindForm');
|
|
9
|
+
this.vm.bind('{coonChart.chartType}', function(chartType) {
|
|
10
|
+
this.vm.set('coonChart.config', this.lookup('SampleChart').getChartConfig(chartType));
|
|
28
11
|
}, this);
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
this.vm.bind('{coonChart.sourceType}', function(sourceType) {
|
|
13
|
+
if (sourceType === 'command' && !this.lookup('command').getStore().getRange().length) {
|
|
14
|
+
this.lookup('command').store.loadData(this.getCommandsList());
|
|
15
|
+
}
|
|
33
16
|
}, this);
|
|
34
|
-
vm.bind({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.clearFieldset();
|
|
17
|
+
this.vm.bind('{fieldAlerts}', function(fieldAlerts) {
|
|
18
|
+
Object.entries(fieldAlerts).map(([field, textAlert]) => {
|
|
19
|
+
this.dataSourceChartBindForm.links.form.getStore().getRange().forEach((record) => {
|
|
20
|
+
fieldAlerts[record.get('reportField')] && record.set('alert', fieldAlerts[record.get('reportField')]);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
41
23
|
}, this);
|
|
24
|
+
this.vm.bind('{coonChart.reportSourceId}', this.loadReportConfig, this);
|
|
42
25
|
},
|
|
43
26
|
|
|
44
|
-
|
|
45
27
|
doInit(coonChartId, mode) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
vm.set('isInit', true);
|
|
28
|
+
this.vm.set('editorMode', mode || coonChartId ? 'edit' : 'add');
|
|
29
|
+
if (coonChartId) {
|
|
30
|
+
this.vm.set('coonChart.id', coonChartId);
|
|
31
|
+
this.vm.set('isInit', true);
|
|
51
32
|
const loadUiElementCommand = Ext.create('Coon.uielement.command.GetUIElementCommand');
|
|
52
33
|
loadUiElementCommand.on('complete', this.loadCoonChartHandler, this);
|
|
53
|
-
loadUiElementCommand.execute(
|
|
34
|
+
loadUiElementCommand.execute(coonChartId);
|
|
54
35
|
}
|
|
55
36
|
},
|
|
56
37
|
|
|
57
38
|
loadCoonChartHandler(coonChartBean) {
|
|
58
|
-
const vm = this.getViewModel();
|
|
59
39
|
const coonChart = coonChartBean.propertyData && Object.assign(coonChartBean, JSON.parse(coonChartBean.propertyData));
|
|
60
|
-
vm.set('coonChart', coonChart);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
this.vm.set('coonChart', coonChart);
|
|
41
|
+
const dataToChartGrid = [...coonChart.valueConfig, ...coonChart.categoryConfig, ...coonChart.legendConfig, ...coonChart.serieConfig];
|
|
42
|
+
dataToChartGrid.length && dataToChartGrid.forEach((configObj) => {
|
|
43
|
+
configObj.additionalConfig = JSON.stringify(configObj.additionalConfig);
|
|
44
|
+
});
|
|
45
|
+
this.dataSourceChartBindForm.links.form.getStore().loadData(dataToChartGrid);
|
|
46
|
+
this.vm.set('dataToChartGrid', dataToChartGrid);
|
|
64
47
|
},
|
|
65
48
|
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
49
|
+
loadReportConfig() {
|
|
50
|
+
const form = this.dataSourceChartBindForm;
|
|
51
|
+
const coonChart = this.vm.get('coonChart');
|
|
52
|
+
form.mask();
|
|
53
|
+
this.clearBindForm();
|
|
54
|
+
coonChart.reportSourceId && this.getReportFieldsData(coonChart.reportSourceId).then((response) => {
|
|
55
|
+
if (!response || !response.fields) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.vm.set('reportFieldStore', response.fields);
|
|
59
|
+
form.links.grid.reconfigure(null, response.fields.map((key) =>
|
|
60
|
+
({dataIndex: `${key.reportFieldCd}`, text: `${key.description}`, flex: 1})
|
|
61
|
+
));
|
|
62
|
+
}).catch((error) => {
|
|
63
|
+
Coon.log.error('getReportFieldsData', error);
|
|
64
|
+
}).finally(() => {
|
|
65
|
+
form.unmask();
|
|
66
|
+
});
|
|
67
|
+
},
|
|
77
68
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
configDataSourceBinds() {
|
|
70
|
+
const form = this.dataSourceChartBindForm;
|
|
71
|
+
const coonChart = this.vm.get('coonChart');
|
|
72
|
+
form.mask();
|
|
73
|
+
this.lookup('SampleChart').getDataSourceData(coonChart, coonChart.parameters).then((data) => {
|
|
74
|
+
if (data && Array.isArray(data.list) && data.list.length > 0) {
|
|
75
|
+
this.vm.set('rows', data.list);
|
|
76
|
+
form.links.grid.getStore().loadData(data.list);
|
|
77
|
+
} else {
|
|
78
|
+
form.links.grid.getStore().removeAll();
|
|
79
|
+
}
|
|
80
|
+
}).catch((error) => {
|
|
81
|
+
Coon.log.error('getDataSourceData', error);
|
|
82
|
+
}).finally(() => {
|
|
83
|
+
form.unmask();
|
|
84
|
+
});
|
|
83
85
|
},
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
vm.set('coonChart.fieldDefaults', {});
|
|
90
|
-
this.getView().down('BaseChart').clearChart();
|
|
91
|
-
}
|
|
87
|
+
rendererComboValues(value, metaData, record) {
|
|
88
|
+
const editor = metaData.column && metaData.column.getEditor && metaData.column.getEditor();
|
|
89
|
+
editor.setValue(value);
|
|
90
|
+
return value && editor.getVisibleValue() || record.get('name');
|
|
92
91
|
},
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
acc[val] = acc[val] || [];
|
|
100
|
-
acc[val].push(field);
|
|
101
|
-
}
|
|
102
|
-
if (val === 'x' || val === 'y' || val === 'legend') {
|
|
103
|
-
acc[val] = field;
|
|
104
|
-
}
|
|
105
|
-
return acc;
|
|
106
|
-
}, {});
|
|
107
|
-
const config = this.setChartConfig(entries);
|
|
108
|
-
const fieldAlerts = {};
|
|
109
|
-
if (config) {
|
|
110
|
-
this.lookup('SampleChart').setChartData(config, fieldAlerts);
|
|
111
|
-
vm.set('fieldAlerts', fieldAlerts);
|
|
112
|
-
vm.set('isInit', false);
|
|
93
|
+
clearBindForm() {
|
|
94
|
+
if (!this.vm.get('isInit')) {
|
|
95
|
+
this.vm.set('coonChart.config', this.lookup('SampleChart').getChartConfig(this.vm.get('coonChart.chartType')));
|
|
96
|
+
this.dataSourceChartBindForm.links.form.getStore().removeAll();
|
|
97
|
+
this.getView().down('BaseChart').clearChart();
|
|
113
98
|
}
|
|
114
|
-
Coon.log.debug('onChangeDataSourceConfig.config', config);
|
|
115
99
|
},
|
|
116
100
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const axisField = entries.x || entries.y || entries.legend;
|
|
121
|
-
const config = Ext.apply(this.lookup('SampleChart').getChartConfig(coonChart.chartType), {
|
|
122
|
-
fieldDefaults: coonChart.fieldDefaults,
|
|
123
|
-
rows: vm.get('rows').map((item) => (Object.assign({}, item))),
|
|
124
|
-
serieFields: entries.serie,
|
|
125
|
-
// serieConfig: {
|
|
126
|
-
// name: '',
|
|
127
|
-
// type: coonChart.chartType,
|
|
128
|
-
// },
|
|
129
|
-
axisField: axisField,
|
|
130
|
-
axisName: coonChart.chartType === 'bar' && vm.get(`coonChart.fieldset.${axisField}`),
|
|
131
|
-
// isSettingAxisData: coonChart.chartType === 'bar',
|
|
101
|
+
addHandler() {
|
|
102
|
+
this.dataSourceChartBindForm.links.form.getStore().add({});
|
|
103
|
+
},
|
|
132
104
|
|
|
133
|
-
|
|
134
|
-
|
|
105
|
+
deleteHandler() {
|
|
106
|
+
const record = this.dataSourceChartBindForm.links.form.getSelection()[0];
|
|
107
|
+
if (!record) {
|
|
135
108
|
return;
|
|
136
109
|
}
|
|
137
|
-
|
|
138
|
-
return config;
|
|
110
|
+
this.dataSourceChartBindForm.links.form.getStore().remove(record);
|
|
139
111
|
},
|
|
140
112
|
|
|
141
|
-
|
|
142
|
-
if (!
|
|
113
|
+
showCoonChartHandler() {
|
|
114
|
+
if (!this.vm.get('rows')) {
|
|
115
|
+
Ext.Msg.alert('Сообщение системы', 'Для отображения предпросмотра диаграммы необходимо сначала загрузить данные');
|
|
143
116
|
return;
|
|
144
117
|
}
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
vm.set('rows', data.list);
|
|
163
|
-
form.loadData(data.list);
|
|
164
|
-
} else {
|
|
165
|
-
form.links.grid.getStore().removeAll();
|
|
118
|
+
const me = this;
|
|
119
|
+
const store = this.dataSourceChartBindForm.links.form.getStore();
|
|
120
|
+
const coonChart = this.vm.get('coonChart');
|
|
121
|
+
const valueConfig = [];
|
|
122
|
+
const categoryConfig = [];
|
|
123
|
+
const legendConfig = [];
|
|
124
|
+
const serieConfig = [];
|
|
125
|
+
|
|
126
|
+
store.queryBy((record) => {
|
|
127
|
+
const reportFieldStoreRecord = me.vm.get('reportFieldStore').find((el) => el.reportFieldCd === record.get('reportField'));
|
|
128
|
+
const config = record.get('additionalConfig') && JSON5.parse(record.get('additionalConfig')) || {};
|
|
129
|
+
const type = record.get('axisType');
|
|
130
|
+
let arrayForPush = type === 'valueField' && valueConfig ||
|
|
131
|
+
type === 'categoryField' && categoryConfig ||
|
|
132
|
+
type === 'legend' && legendConfig;
|
|
133
|
+
if (type === 'serie') {
|
|
134
|
+
arrayForPush = serieConfig;
|
|
166
135
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
136
|
+
arrayForPush && arrayForPush.push({
|
|
137
|
+
axisType: type,
|
|
138
|
+
reportField: record.get('reportField'),
|
|
139
|
+
name: reportFieldStoreRecord && reportFieldStoreRecord.description || record.get('reportField'),
|
|
140
|
+
defaultValue: record.get('defaultValue'),
|
|
141
|
+
additionalConfig: config,
|
|
142
|
+
});
|
|
171
143
|
});
|
|
144
|
+
const config = {
|
|
145
|
+
rows: this.vm.get('rows').map((item) => (Object.assign({}, item))),
|
|
146
|
+
chartType: coonChart.chartType,
|
|
147
|
+
valueConfig: valueConfig,
|
|
148
|
+
categoryConfig: categoryConfig,
|
|
149
|
+
legendConfig: legendConfig,
|
|
150
|
+
serieConfig: serieConfig,
|
|
151
|
+
categoryLineY: this.vm.get('coonChart.categoryLineY'),
|
|
152
|
+
};
|
|
153
|
+
this.vm.set('coonChart.config', config);
|
|
154
|
+
const fieldAlerts = {};
|
|
155
|
+
this.lookup('SampleChart').setChartData(config, fieldAlerts);
|
|
156
|
+
this.vm.set('fieldAlerts', fieldAlerts);
|
|
157
|
+
this.vm.set('isInit', false);
|
|
158
|
+
Coon.log.debug('showCoonChartHandler.config', config);
|
|
172
159
|
},
|
|
173
160
|
|
|
174
161
|
getReportFieldsData(reportId) {
|
|
@@ -194,72 +181,43 @@ Ext.define('Coon.chart.editor.CoonChartEditorController', {
|
|
|
194
181
|
return [...commandSet.values()].sort().map((el) => ({name: el, value: el}));
|
|
195
182
|
},
|
|
196
183
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const fieldsetProps = Object.values(fieldset);
|
|
202
|
-
const enableLoadDataBtn = fieldsetProps.find((val) => val === 'x' || val === 'y' || val === 'legend') &&
|
|
203
|
-
fieldsetProps.find((val) => val === 'serie');
|
|
204
|
-
this.getViewModel().set('disableLoadDataBtn', !enableLoadDataBtn);
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
checkDuplicateAxis(combo, newValue) {
|
|
208
|
-
const vm = this.getViewModel();
|
|
209
|
-
const newValueData = combo.getStore().findRecord('value', newValue);
|
|
210
|
-
if (!newValue || newValueData && !newValueData.get('isUnique')) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const fieldset = vm.get('coonChart.fieldset');
|
|
214
|
-
fieldset && Object.entries(fieldset).forEach((arr) => {
|
|
215
|
-
if (arr[1] === newValue && combo.itemId !== arr[0]) {
|
|
216
|
-
this.lookup(arr[0]) && this.lookup(arr[0]).reset();
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
setParams() {
|
|
222
|
-
const vm = this.getViewModel();
|
|
223
|
-
const coonChart = vm.get('coonChart');
|
|
224
|
-
coonChart.propertyData = {
|
|
184
|
+
createUiElement() {
|
|
185
|
+
const coonChart = this.vm.get('coonChart');
|
|
186
|
+
const coonChartConfig = coonChart.config;
|
|
187
|
+
const propertyData = {
|
|
225
188
|
reportSourceId: coonChart.reportSourceId,
|
|
226
189
|
commandSourceId: coonChart.commandSourceId,
|
|
227
190
|
sourceType: coonChart.sourceType,
|
|
228
191
|
chartType: coonChart.chartType,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
legend: coonChart.config.legend,
|
|
192
|
+
categoryConfig: coonChartConfig && coonChartConfig.categoryConfig,
|
|
193
|
+
valueConfig: coonChartConfig && coonChartConfig.valueConfig,
|
|
194
|
+
legendConfig: coonChartConfig && coonChartConfig.legendConfig,
|
|
195
|
+
serieConfig: coonChartConfig && coonChartConfig.serieConfig,
|
|
196
|
+
categoryLineY: coonChart.categoryLineY,
|
|
235
197
|
};
|
|
236
198
|
return {
|
|
237
199
|
id: coonChart.id,
|
|
238
200
|
description: coonChart.description,
|
|
239
201
|
xtype: 'CoonChart',
|
|
240
|
-
propertyData: JSON.stringify(
|
|
202
|
+
propertyData: JSON.stringify(propertyData),
|
|
241
203
|
};
|
|
242
204
|
},
|
|
243
205
|
|
|
244
206
|
async onSubmitCoonChart() {
|
|
245
|
-
const vm = this.getViewModel();
|
|
246
|
-
// vm.set('coonChart.propertyData', JSON.stringify(coonChart.propertyData));
|
|
247
207
|
const validation = await this.validate();
|
|
248
|
-
if (validation.state) {
|
|
249
|
-
// const commandName = vm.get('mode') === 'EDIT' ? 'SaveUIElementCommand' : 'AddUIElementCommand';
|
|
208
|
+
if (validation && validation.state) {
|
|
250
209
|
const command = Ext.create('command.SaveUIElementCommand', {activeComponent: this.getView()});
|
|
251
210
|
command.on('complete', function(coonChartBean) {
|
|
252
|
-
vm.set('editorMode', 'edit');
|
|
211
|
+
this.vm.set('editorMode', 'edit');
|
|
253
212
|
}, this);
|
|
254
|
-
command.execute(this.
|
|
213
|
+
command.execute(this.createUiElement());
|
|
255
214
|
} else {
|
|
256
215
|
Ext.Msg.alert('Сообщение системы', validation.context);
|
|
257
216
|
}
|
|
258
217
|
},
|
|
259
218
|
|
|
260
219
|
async validate() {
|
|
261
|
-
const
|
|
262
|
-
const coonChart = vm.get('coonChart');
|
|
220
|
+
const coonChart = this.vm.get('coonChart');
|
|
263
221
|
const state = coonChart && coonChart.id && coonChart.description;
|
|
264
222
|
try {
|
|
265
223
|
const validSource = await this.lookup('SampleChart').getDataSourceData(coonChart, coonChart.parameters);
|
|
@@ -9,30 +9,111 @@ Ext.define('Coon.chart.editor.DataSourceChartBindForm', {
|
|
|
9
9
|
|
|
10
10
|
items: [
|
|
11
11
|
{
|
|
12
|
-
xtype: '
|
|
13
|
-
title: '
|
|
12
|
+
xtype: 'grid',
|
|
13
|
+
title: 'Привязка данных к диаграмме',
|
|
14
14
|
itemId: 'form',
|
|
15
|
-
|
|
16
|
-
type: 'vbox',
|
|
17
|
-
align: 'stretch',
|
|
18
|
-
},
|
|
19
|
-
scrollable: 'y',
|
|
15
|
+
reference: 'linksForm',
|
|
20
16
|
collapsible: true,
|
|
21
|
-
|
|
17
|
+
height: 200,
|
|
18
|
+
resizable: {
|
|
19
|
+
handles: 's',
|
|
20
|
+
pinned: true,
|
|
21
|
+
},
|
|
22
|
+
plugins: [
|
|
23
|
+
{ptype: 'cellediting', clicksToEdit: 1}
|
|
24
|
+
],
|
|
25
|
+
store: {
|
|
26
|
+
type: 'json',
|
|
27
|
+
data: [],
|
|
28
|
+
},
|
|
29
|
+
tbar: {
|
|
30
|
+
items: [
|
|
31
|
+
{
|
|
32
|
+
text: 'Добавить',
|
|
33
|
+
handler: 'addHandler',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
text: 'Удалить',
|
|
37
|
+
handler: 'deleteHandler',
|
|
38
|
+
bind: {
|
|
39
|
+
disabled: '{!linksForm.selection}',
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
columns: [
|
|
22
45
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
header: 'Тип данных',
|
|
47
|
+
dataIndex: 'axisType',
|
|
48
|
+
flex: 1,
|
|
49
|
+
renderer: 'rendererComboValues',
|
|
50
|
+
editor: {
|
|
51
|
+
xtype: 'BaseComboBox',
|
|
52
|
+
queryMode: 'local',
|
|
53
|
+
allowBlank: false,
|
|
54
|
+
displayField: 'name',
|
|
55
|
+
valueField: 'value',
|
|
56
|
+
store: {
|
|
57
|
+
fields: ['name', 'value'],
|
|
58
|
+
data: [
|
|
59
|
+
{name: 'ось категорий', value: 'categoryField'},
|
|
60
|
+
{name: 'ось значений', value: 'valueField'},
|
|
61
|
+
{name: 'серия значений', value: 'serie'},
|
|
62
|
+
{name: 'legend', value: 'legend'}
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
header: 'Поле репорта',
|
|
69
|
+
dataIndex: 'reportField',
|
|
70
|
+
flex: 1,
|
|
71
|
+
renderer: 'rendererComboValues',
|
|
72
|
+
editor: {
|
|
73
|
+
xtype: 'BaseComboBox',
|
|
74
|
+
loadOnRender: false,
|
|
75
|
+
allowBlank: false,
|
|
76
|
+
forceSelection: true,
|
|
77
|
+
displayField: 'description',
|
|
78
|
+
valueField: 'reportFieldCd',
|
|
79
|
+
disableOnEmptyStore: true,
|
|
80
|
+
bind: {
|
|
81
|
+
store: '{reportFieldStore}',
|
|
82
|
+
},
|
|
28
83
|
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
text: 'Значение по умолчанию<br>(если получили пустое)',
|
|
87
|
+
dataIndex: 'defaultValue',
|
|
88
|
+
flex: 1,
|
|
89
|
+
xtype: 'hintColumn',
|
|
90
|
+
editor: {
|
|
91
|
+
xtype: 'textfield',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
text: 'Доп.конфиг в формате:<br>{св-во1:"значение1",св-во2:"значение2"}',
|
|
96
|
+
dataIndex: 'additionalConfig',
|
|
97
|
+
flex: 2,
|
|
98
|
+
xtype: 'hintColumn',
|
|
99
|
+
editor: {
|
|
100
|
+
xtype: 'textfield',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
text: 'Уведомление о некорректных<br>данных',
|
|
105
|
+
dataIndex: 'alert',
|
|
106
|
+
flex: 1,
|
|
107
|
+
xtype: 'hintColumn',
|
|
29
108
|
}
|
|
30
109
|
],
|
|
31
110
|
},
|
|
32
111
|
{
|
|
33
112
|
xtype: 'grid',
|
|
34
|
-
title: '
|
|
113
|
+
title: 'Показаны первые 100 строк',
|
|
35
114
|
layout: 'fit',
|
|
115
|
+
itemId: 'reportData',
|
|
116
|
+
flex: 1,
|
|
36
117
|
store: [],
|
|
37
118
|
columns: [],
|
|
38
119
|
scrollable: true,
|
|
@@ -42,112 +123,9 @@ Ext.define('Coon.chart.editor.DataSourceChartBindForm', {
|
|
|
42
123
|
initComponent(...args) {
|
|
43
124
|
this.callParent(...args);
|
|
44
125
|
this.links = {
|
|
45
|
-
grid: this.down('grid'),
|
|
46
|
-
form: this.down('
|
|
126
|
+
grid: this.down('grid#reportData'),
|
|
127
|
+
form: this.down('grid#form'),
|
|
47
128
|
};
|
|
48
129
|
},
|
|
49
130
|
|
|
50
|
-
loadReportFields(data) {
|
|
51
|
-
// const fields = data.map((r) => r.description);
|
|
52
|
-
this.links.form.removeAll();
|
|
53
|
-
data.forEach((field) => {
|
|
54
|
-
this.links.form.add({
|
|
55
|
-
xtype: 'panel',
|
|
56
|
-
margin: 4,
|
|
57
|
-
flex: 1,
|
|
58
|
-
layout: {
|
|
59
|
-
type: 'hbox',
|
|
60
|
-
align: 'bottom',
|
|
61
|
-
pack: 'center',
|
|
62
|
-
},
|
|
63
|
-
items: [
|
|
64
|
-
{xtype: 'displayfield', value: field.description, width: 130, fieldStyle: 'text-align: right'},
|
|
65
|
-
{
|
|
66
|
-
xtype: 'combo',
|
|
67
|
-
itemId: field.reportFieldCd,
|
|
68
|
-
maxWidth: 350,
|
|
69
|
-
reference: field.reportFieldCd,
|
|
70
|
-
flex: 1,
|
|
71
|
-
displayField: 'name',
|
|
72
|
-
valueField: 'value',
|
|
73
|
-
labelAlign: 'top',
|
|
74
|
-
// store: {
|
|
75
|
-
// fields: ['name', 'value'],
|
|
76
|
-
// data: [
|
|
77
|
-
// {name: 'ось X', value: 'x'},
|
|
78
|
-
// {name: 'ось Y', value: 'y'},
|
|
79
|
-
// {name: 'серия значений(данные графика)', value: 'serie'}
|
|
80
|
-
// ],
|
|
81
|
-
// },
|
|
82
|
-
bind: {
|
|
83
|
-
value: `{coonChart.fieldset.${field.reportFieldCd}}`,
|
|
84
|
-
store: '{comboStore}',
|
|
85
|
-
},
|
|
86
|
-
listeners: {
|
|
87
|
-
change: 'checkDuplicateAxis',
|
|
88
|
-
},
|
|
89
|
-
triggers: {
|
|
90
|
-
reset: {
|
|
91
|
-
cls: 'x-fa fa-times',
|
|
92
|
-
handler(combo) {
|
|
93
|
-
combo.reset();
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
// {
|
|
99
|
-
// xtype: 'textfield',
|
|
100
|
-
// itemId: `${field}_radius`,
|
|
101
|
-
// fieldLabel: 'radius',
|
|
102
|
-
// tooltip: 'Радиус',
|
|
103
|
-
// width: 100,
|
|
104
|
-
// hidden: true,
|
|
105
|
-
// bind: {
|
|
106
|
-
// value: `{radius.${field}}`,
|
|
107
|
-
// hidden: `{coonChart.fieldset.${field} !== "serie" && chartType !== "pie"}`,
|
|
108
|
-
// },
|
|
109
|
-
// listeners: {
|
|
110
|
-
// disable: function(field) {
|
|
111
|
-
// field.reset();
|
|
112
|
-
// },
|
|
113
|
-
// },
|
|
114
|
-
// },
|
|
115
|
-
{
|
|
116
|
-
xtype: 'textfield',
|
|
117
|
-
itemId: `${field.reportFieldCd}_defval`,
|
|
118
|
-
fieldLabel: 'default',
|
|
119
|
-
tooltip: 'значение по умолчанию(если получили пустое)',
|
|
120
|
-
width: 100,
|
|
121
|
-
disabled: true,
|
|
122
|
-
bind: {
|
|
123
|
-
value: `{coonChart.fieldDefaults.${field.reportFieldCd}}`,
|
|
124
|
-
disabled: `{!coonChart.fieldset.${field.reportFieldCd}}`,
|
|
125
|
-
},
|
|
126
|
-
listeners: {
|
|
127
|
-
disable: function(field) {
|
|
128
|
-
field.reset();
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
xtype: 'displayfield',
|
|
134
|
-
itemId: `${field.reportFieldCd}_alertMsg`,
|
|
135
|
-
fieldStyle: {
|
|
136
|
-
color: 'red',
|
|
137
|
-
},
|
|
138
|
-
tooltip: 'уведомление о некорректных данных',
|
|
139
|
-
flex: 1,
|
|
140
|
-
bind: {
|
|
141
|
-
value: `{fieldAlerts.${field.reportFieldCd}}`,
|
|
142
|
-
},
|
|
143
|
-
}
|
|
144
|
-
],
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
this.links.grid.reconfigure(null, data.map((key) => ({dataIndex: `${key.reportFieldCd}`, text: `${key.description}`, flex: 1})));
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
loadData(rows) {
|
|
151
|
-
this.links.grid.getStore().loadData(rows);
|
|
152
|
-
},
|
|
153
131
|
});
|
|
@@ -302,6 +302,32 @@ Ext.define('Coon.report.component.ReportPanel', {
|
|
|
302
302
|
return undefined;
|
|
303
303
|
},
|
|
304
304
|
|
|
305
|
+
loadFakeData(len = 1000) {
|
|
306
|
+
if (!this.isConfigured) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const getValue = (type) => {
|
|
310
|
+
const strGen = Ext.create('Ext.data.identifier.Uuid');
|
|
311
|
+
if (type === 'number') {
|
|
312
|
+
return Math.random() * 99999;
|
|
313
|
+
}
|
|
314
|
+
if (type === 'boolean') {
|
|
315
|
+
return Math.random() > 0.5;
|
|
316
|
+
}
|
|
317
|
+
if (type === 'date') {
|
|
318
|
+
return new Date(Math.ceil(Math.random() * 2e12));
|
|
319
|
+
}
|
|
320
|
+
return strGen.generate();
|
|
321
|
+
};
|
|
322
|
+
const columns = this.grid.getColumns().filter((column) => !column.hidden && !column.ignoreExport);
|
|
323
|
+
const getRow = () => columns.reduce((acc, {dataIndex, type}) => {
|
|
324
|
+
acc[dataIndex] = getValue(type);
|
|
325
|
+
return acc;
|
|
326
|
+
}, {id: Ext.id(false, 'fakeid-')});
|
|
327
|
+
const data = [...Array(len)].map(getRow);
|
|
328
|
+
this.grid.getStore().loadData(data);
|
|
329
|
+
},
|
|
330
|
+
|
|
305
331
|
initComponent: function() {
|
|
306
332
|
this.gridProperties = this.gridProperties || {};
|
|
307
333
|
this.centerProperties = this.centerProperties || {};
|
|
@@ -557,6 +583,7 @@ Ext.define('Coon.report.component.ReportPanel', {
|
|
|
557
583
|
command.on('complete', function(response) {
|
|
558
584
|
response.plugins = this.preprocessPlugins(response.plugins);
|
|
559
585
|
this.build(response);
|
|
586
|
+
this.isConfigured = true;
|
|
560
587
|
this.fireEvent('configured', response, this);
|
|
561
588
|
this.grid.fireEvent('configured', response, this);
|
|
562
589
|
}, this);
|
|
@@ -8,7 +8,7 @@ Ext.define('Coon.report.plugin.grid.FilterFormEditingPlugin', {
|
|
|
8
8
|
/* description: 'Отключает возможность выделения строк',
|
|
9
9
|
tags: ['Фильтры'],*/
|
|
10
10
|
init: function(filterPanel) {
|
|
11
|
-
filterPanel.on('
|
|
11
|
+
filterPanel.on('added', this.onRenderFilterPanel, this);
|
|
12
12
|
this.filterPanel = filterPanel;
|
|
13
13
|
filterPanel.removeAll();
|
|
14
14
|
filterPanel.add({
|
|
@@ -13,7 +13,7 @@ Ext.define('Coon.report.plugin.grid.ToolbarButtonPlugin', {
|
|
|
13
13
|
* добавить кнопку на панель или не стоит:)
|
|
14
14
|
*/
|
|
15
15
|
addButtonOnToolbar: true,
|
|
16
|
-
|
|
16
|
+
addToContextMenu: false,
|
|
17
17
|
addToColumnMenu: false,
|
|
18
18
|
/**
|
|
19
19
|
* text on button.If undefined button shows without text
|
|
@@ -53,7 +53,6 @@ Ext.define('Coon.report.plugin.grid.ToolbarButtonPlugin', {
|
|
|
53
53
|
this.separateAction = new Ext.Button(Ext.apply({
|
|
54
54
|
isPlgBtn: true,
|
|
55
55
|
text: this.buttonText,
|
|
56
|
-
tooltip: this.tooltip,
|
|
57
56
|
disabled: this.isCreatedButtonDisabled(),
|
|
58
57
|
iconCls: this.buttonIconCls,
|
|
59
58
|
handler: Ext.bind(this.handler, this),
|
|
@@ -72,9 +71,26 @@ Ext.define('Coon.report.plugin.grid.ToolbarButtonPlugin', {
|
|
|
72
71
|
if (this.addToColumnMenu) {
|
|
73
72
|
this.component.getStore().on('load', this.addColumnMenuItem, this, {single: true});
|
|
74
73
|
}
|
|
74
|
+
if (this.addToContextMenu && this.component.contextMenu) {
|
|
75
|
+
this.component.getStore().on('load', this.addToContextMenuHandler, this, {single: true});
|
|
76
|
+
}
|
|
75
77
|
this.setActionColumn();
|
|
76
78
|
},
|
|
77
79
|
|
|
80
|
+
addToContextMenuHandler: function(config) {
|
|
81
|
+
const menu = this.component.contextMenu;
|
|
82
|
+
if (this.buttonUI && !config['ui']) {
|
|
83
|
+
config['ui'] = this.buttonUI;
|
|
84
|
+
}
|
|
85
|
+
menu && menu.add(new Ext.menu.Item({
|
|
86
|
+
text: this.buttonText,
|
|
87
|
+
iconCls: this.buttonIconCls,
|
|
88
|
+
ui: this.buttonUI,
|
|
89
|
+
handler: Ext.Function.createSequence(Ext.bind(this.handler, this), function() {
|
|
90
|
+
menu.hide();
|
|
91
|
+
}),
|
|
92
|
+
}));
|
|
93
|
+
},
|
|
78
94
|
setActionColumn: function() {
|
|
79
95
|
if (this.columnExists || !(this.addActionColumn || this.addActionColumnNew)) {
|
|
80
96
|
return;
|
|
@@ -104,6 +104,7 @@ Ext.define('Coon.report.plugin.grid.ToolbarItemPlugin', {
|
|
|
104
104
|
position: this.position,
|
|
105
105
|
sortSequence: this.sortSequence,
|
|
106
106
|
pType: this.pluginConfig ? this.pluginConfig.ptype : '',
|
|
107
|
+
itemId: this.pluginId,
|
|
107
108
|
};
|
|
108
109
|
if (!this.position || isNaN(Number(this.position)) || Number(this.position) <= 0) {
|
|
109
110
|
cfg.position = this.sortSequence;
|
package/src/version.js
CHANGED