ru.coon 2.8.4 → 2.8.7

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 CHANGED
@@ -1,3 +1,18 @@
1
+ # Version 2.8.7, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/086c841f875dba30c6d46e2737876da1349717d5)
2
+ * ## Features
3
+ * <span style='color:green'>feat: Экспорт строки "Всего". Closes HT-10162.</span> ([afbcee], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/afbceeebb84975dd57bd22d0dccf87ec9b81c799))
4
+
5
+ * update: CHANGELOG.md ([d63112], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d63112ea1457bd42c43dfc86625b72a287c30b24))
6
+
7
+ # Version 2.8.6, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/71b44f6acfbe1db484173ac579218ed8c494ad3e)
8
+ * update: CHANGELOG.md ([0b6d30], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0b6d304fb344aaceedb55d591c80e4a815f339f0))
9
+
10
+ # Version 2.8.5, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/224b99c8b4b9674f6732b71e76aa06961fd4e91d)
11
+ * ## Fixes
12
+ * <span style='color:red'>fix modified state for characteristic record, HT-10117</span> ([2f8762], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2f876261d0065a0a02810ac5866f2832b2a36672))
13
+
14
+ * update: CHANGELOG.md ([1e5402], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1e5402b30bb754e5f58c5c3ccf70859dd6906f66))
15
+
1
16
  # Version 2.8.4, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/79f9eb3363e07fb47ac3ac23659b94b34c7423b9)
2
17
  * TR-69542 fix: восстановление утраченной авторизации по токену. ([402a8a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/402a8a5e63da1342b44b6e95a7eed96d5b9a42aa))
3
18
  * update: CHANGELOG.md ([b11b4c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b11b4c53ff53f0dde24c4e017e09046a77609ac4))
@@ -8,6 +23,7 @@
8
23
  # Version 2.8.2, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b2e3da084c82fa409dca30ef2388bab2f3ef267b)
9
24
  * ## Features
10
25
  * <span style='color:green'>feat: Added createFromString function. Related to BFL-15767.</span> ([cea621], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cea6218e44b5768116718379e25cc52706ef8a75))
26
+ * <span style='color:green'>feat: HT-9649 Доработка DatePickerPresetsField (убран trigger clear)</span> ([4559c6], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4559c6c4a8479928271e1b3daa34fc63a4eff8cb))
11
27
 
12
28
  * ## Fixes
13
29
  * <span style='color:red'> Разрешены html теги в колонке "Описание". Related to BFL-13996.</span> ([8a1793], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8a1793a93a87dcb10f92d854d491c31aefcd2563))
@@ -17,6 +33,9 @@
17
33
  * update: CHANGELOG.md ([ad61a8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ad61a8c449000e7b9ff6e921d39eecd97ddabea2))
18
34
 
19
35
  # Version 2.8.1, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/88c146ad577ce2a14d194c245e3d5151081af6af)
36
+ * ## Features
37
+ * <span style='color:green'>feat: HT-9649 Доработка DatePickerPresetsField</span> ([0f172e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0f172e42774d9f42ad8e228e5eda37880fd3b206))
38
+
20
39
  * ## Fixes
21
40
  * <span style='color:red'> HT-9264 CoonChart lite fix</span> ([d8e2d7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d8e2d7a5994649ea9707fd6e901d1201813bbc36))
22
41
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.8.4",
7
+ "version": "2.8.7",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -86,8 +86,10 @@ Ext.define('Coon.common.component.editor.CharacteristicGridCopyPlugin', {
86
86
  if (!masterRecord) {
87
87
  return;
88
88
  }
89
-
90
- slaveRecord.set('value', masterRecord.get('value'));
91
- slaveRecord.set('valueDescription', masterRecord.get('valueDescription') || '');
89
+ slaveRecord.set({
90
+ markToCommit: true,
91
+ value: masterRecord.get('value'),
92
+ valueDescription: masterRecord.get('valueDescription') || '',
93
+ });
92
94
  },
93
95
  });
@@ -9,9 +9,6 @@ Ext.define('Coon.common.field.DatePickerPresetsField', {
9
9
  prevYears: 10,
10
10
  nextYears: 0,
11
11
  },
12
- viewModel: {
13
- data: {},
14
- },
15
12
  inclinedMonthNames: [
16
13
  'января',
17
14
  'февраля',
@@ -255,5 +252,4 @@ Ext.define('Coon.common.field.DatePickerPresetsField', {
255
252
  }
256
253
  },
257
254
  },
258
-
259
255
  });
@@ -29,7 +29,28 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
29
29
  },
30
30
  defaultDateFormat: 'Y-m-d_h-i',
31
31
  forbiddenSymbolReplacer: 'underscore',
32
-
32
+ includeSummary: true,
33
+ allBordersStyle: {
34
+ borders: [
35
+ {position: 'Left', lineStyle: 'Continuous', weight: 1, color: '#000000'},
36
+ {position: 'Right', lineStyle: 'Continuous', weight: 1, color: '#000000'},
37
+ {position: 'Top', lineStyle: 'Continuous', weight: 1, color: '#000000'},
38
+ {position: 'Bottom', lineStyle: 'Continuous', weight: 1, color: '#000000'}
39
+ ],
40
+ },
41
+ tableHeaderStyle: {
42
+ alignment: {
43
+ wrapText: true,
44
+ horizontal: 'Center',
45
+ vertical: 'Automatic',
46
+ },
47
+ font: {
48
+ fontName: 'Arial',
49
+ family: 'Swiss',
50
+ bold: true,
51
+ color: '#000000',
52
+ },
53
+ },
33
54
  injectForm() {
34
55
  // if element already exist
35
56
  if (document.querySelector(`form#${this.formId()}`)) {
@@ -58,6 +79,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
58
79
  this.component.store = store;
59
80
  this.component.columns = columns;
60
81
  }, this);
82
+ Object.assign(this.tableHeaderStyle || {}, this.allBordersStyle);
61
83
  },
62
84
 
63
85
  createToolbarItem: function(config) {
@@ -422,7 +444,8 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
422
444
  });
423
445
  } else {
424
446
  filename += '.xls';
425
- const exporter = Ext.create('Ext.exporter.text.Html', {fileName: filename});
447
+ const exporter = this.exporter = Ext.create('Ext.exporter.text.Html', {fileName: filename});
448
+ this.prepareData(exporter);
426
449
  const blob = new Blob(this.collectGridDataAsArray(
427
450
  this.getSelected(),
428
451
  this.getTableHeaderRows(exporter, 'xls')
@@ -483,8 +506,9 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
483
506
  },
484
507
 
485
508
  initExporter: function(filename) {
486
- const exporter = Ext.create('Ext.exporter.excel.Xlsx', {
509
+ const exporter = this.exporter = Ext.create('Ext.exporter.excel.Xlsx', {
487
510
  fileName: filename + '.xlsx',
511
+ tableHeaderStyle: this.tableHeaderStyle,
488
512
  });
489
513
  exporter.excel = new Ext.exporter.file.ooxml.Excel({
490
514
  properties: {
@@ -495,13 +519,24 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
495
519
  exporter.worksheet = exporter.excel.addWorksheet({
496
520
  name: 'Лист 1',
497
521
  });
522
+ this.prepareData();
498
523
  const {headerRows, dataRows, footerRows} =
499
524
  this.collectGridDataAsObject(this.getSelected(), exporter.excel);
500
525
  const tableHeaderRows = this.getTableHeaderRows(exporter);
501
- exporter.jsonData = [...headerRows, ...tableHeaderRows, ...dataRows, ...footerRows];
502
- exporter.getContent = this.getContent.bind(exporter);
526
+ const summaryRows = this.getSummaryRows();
527
+ this.assignStyle([...dataRows, ...summaryRows], this.allBordersStyle);
528
+ exporter.jsonData = [...headerRows, ...tableHeaderRows, ...dataRows, ...summaryRows, ...footerRows];
529
+ exporter.getContent = this.getContent.bind(exporter, this);
503
530
  return exporter;
504
531
  },
532
+
533
+ prepareData() {
534
+ const exporterPlugin = this.component.plugins.find(
535
+ (p) => p.ptype === 'gridexporter'
536
+ ) || Ext.create('Ext.grid.plugin.Exporter').init(this.component);
537
+ this.exporter.setData(exporterPlugin.prepareData({includeSummary: this.includeSummary}));
538
+ },
539
+
505
540
  getContent: function() {
506
541
  const me = this;
507
542
  const config = this.getConfig();
@@ -518,17 +553,47 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
518
553
 
519
554
  return me.excel.render();
520
555
  },
521
- getTableHeaderRows(exporter, type = 'xlsx') {
522
- let exporterPlugin = this.component.plugins.find(
523
- (p) => p.ptype === 'gridexporter'
524
- );
525
- if (!exporterPlugin) {
526
- exporterPlugin = Ext.create('Ext.grid.plugin.Exporter');
527
- exporterPlugin.init(this.component);
556
+ /**
557
+ * Возвращает агрегирующие строки из плагина GroupRowsPlugin.
558
+ * Чтобы экспортировать текст, например "Всего" в конфиге колонки должны быть указаны:
559
+ * ```
560
+ * summaryRenderer: function(){return 'Всего'},
561
+ * exportSummaryRenderer: true
562
+ * ```
563
+ * @returns {Object[]}
564
+ */
565
+ getSummaryRows() {
566
+ const summaryRows = [];
567
+ const summaries = this.exporter.getConfig().data.getSummaries();
568
+ if (summaries && summaries.length) {
569
+ summaries.each((row) => {
570
+ summaryRows.push(row.getCells().getValues('_value').map((value) => ({value})));
571
+ });
572
+ }
573
+ return summaryRows;
574
+ },
575
+
576
+ assignStyle(target, style = {}) {
577
+ if (Array.isArray(target)) {
578
+ for (const row of target) {
579
+ if (Array.isArray(row)) {
580
+ this.assignStyle(row, style);
581
+ } else if (typeof row === 'object') {
582
+ Object.assign(
583
+ row,
584
+ {styleId: this.exporter.excel.addCellStyle(style)}
585
+ );
586
+ }
587
+ }
588
+ } else if (typeof target === 'object') {
589
+ this.assignStyle([target], style);
528
590
  }
529
- exporter.setData(exporterPlugin.prepareData({}));
591
+ return target;
592
+ },
593
+
594
+ getTableHeaderRows(exporter, type = 'xlsx') {
595
+ const config = exporter.getConfig();
530
596
  if (type === 'xls') {
531
- const config = exporter.getConfig();
532
597
  exporter.doc = new Ext.exporter.file.html.Doc({
533
598
  title: config.title,
534
599
  author: config.author,
@@ -541,20 +606,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
541
606
  return type === 'xls' ? header : header.map((row) => {
542
607
  row.cells.forEach((cell) => {
543
608
  Object.assign(cell, {
544
- styleId: exporter.excel.addCellStyle(
545
- {
546
- alignment: {
547
- wrapText: true,
548
- horizontal: 'Center',
549
- vertical: 'Automatic',
550
- },
551
- font: {
552
- fontName: 'Arial',
553
- family: 'Swiss',
554
- bold: true,
555
- },
556
- }
557
- ),
609
+ styleId: exporter.excel.addCellStyle(config.tableHeaderStyle),
558
610
  });
559
611
  });
560
612
  return row.cells;
@@ -911,18 +963,34 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
911
963
  }
912
964
  }
913
965
  result.push('<table border="1">');
914
- /* eslint-disable max-len */
915
966
  const headerTpl = new Ext.XTemplate(
916
967
  '<tpl for="columns">',
917
- ' <tr>\n',
918
- '<tpl for=".">',
919
- ' <th<tpl if="width"> width="{width}"</tpl><tpl if="mergeAcross"> colSpan="{mergeAcross}"</tpl><tpl if="mergeDown"> rowSpan="{mergeDown}"</tpl>>{text}</th>\n',
920
- '</tpl>',
921
- ' </tr>\n',
968
+ '<tr>',
969
+ ' <tpl for=".">',
970
+ ' <th',
971
+ ' <tpl if="width"> width="{width}"</tpl>',
972
+ ' <tpl if="mergeAcross"> colSpan="{mergeAcross}"</tpl>',
973
+ ' <tpl if="mergeDown"> rowSpan="{mergeDown}"</tpl>>',
974
+ ' {text}',
975
+ ' </th>',
976
+ ' </tpl>',
977
+ '</tr>',
922
978
  '</tpl>'
923
979
  );
924
- /* eslint-enable max-len */
925
980
  result.push(headerTpl.apply({columns: tableHeaderRows}));
981
+ if (this.includeSummary) {
982
+ const summaryRows = this.getSummaryRows();
983
+ const {fields} = this.component.getStore().config;
984
+ summaryRows.forEach((row) => {
985
+ const rec = Ext.create('Ext.data.Model');
986
+ fields.map(({name}) => name).filter(
987
+ (name, index) => visibleColumns.includes(index)
988
+ ).forEach((name, index) => {
989
+ rec.set(name, row[index].value);
990
+ });
991
+ selections.push(rec);
992
+ });
993
+ }
926
994
  let chunk = '';
927
995
  selections.forEach(function(record, i) {
928
996
  const row = [];
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.8.4',
3
+ number: '2.8.7',
4
4
  });