ru.coon 2.8.16 → 2.8.17

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,4 +1,14 @@
1
+ # Version 2.8.17, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/51f5ec3eb47e0e8f6357a21d23aa0b5412ca66d7)
2
+ * ## Features
3
+ * <span style='color:green'>feat: HT-10458: remove empty summary row. fix template apply in footer and header</span> ([378487], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/378487478540583f055d1c4cc1ee281f434a9648))
4
+
5
+ * ([Update], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/Update file FIOField.js151e69908b2b1601488561180fb27485dd745da8))
6
+ * update: CHANGELOG.md ([3da6d4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3da6d4cc8a37e38a6844115b356539d4c92343eb))
7
+
1
8
  # Version 2.8.16, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/87872e4d0fe6f6cdf23cc72721ec14721a15e7c8)
9
+ * ## Features
10
+ * <span style='color:green'>feat: HT-10401: check unused records and disable button</span> ([30a78e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/30a78e86d06aa91646d7e1ef71b98ba7d57a965d))
11
+
2
12
  * update: CHANGELOG.md ([80dc33], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/80dc3360b47ddac2924e7d25d40873815511154a))
3
13
 
4
14
  # Version 2.8.15, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8243a899e863488223002046a50b6692d3af8fb5)
@@ -12,6 +22,8 @@
12
22
  * ## Fixes
13
23
  * <span style='color:red'>fixes</span> ([77fb8d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/77fb8de94f02156769b48092d91ea16a11f9aa94))
14
24
 
25
+ * HT-10126 доработать RestoreSelectionPlugin, чтобы первая запись выбиралась на afterrender ([a8c823], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a8c823280eb868d5fc9ff135022ce3c5ad6e9ffa))
26
+ * CRM-9117 Удвоенная информация о формате полей Имени и Фамилии при создании ФЛ ([5ed95a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5ed95ab5eb3f7bb4f392e2111ac41a9138641010))
15
27
  * update: CHANGELOG.md ([b6ceb3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b6ceb36854b9ae262d9dcf375f19695392da16ca))
16
28
 
17
29
  # Version 2.8.14, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/dcae10177e3289827d597b883c0e7be99ff45e98)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.8.16",
7
+ "version": "2.8.17",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -842,6 +842,23 @@ Ext.define('Coon.common.component.editor.CharacteristicGridEditor', {
842
842
 
843
843
  },
844
844
 
845
+ hasUnusedTypes() {
846
+ const usedTypeList = this.getUsedTypeList();
847
+ const unused = this.getTypeList().filter(function(record) {
848
+ if (
849
+ !record[Coon.report.model.CharacteristicBeanFields.$visible] ||
850
+ (
851
+ record[Coon.report.model.CharacteristicBeanFields.$single] &&
852
+ usedTypeList.indexOf(record[Coon.report.model.CharacteristicBeanFields.$type]) != -1
853
+ )
854
+ ) {
855
+ return false;
856
+ }
857
+ return true;
858
+ });
859
+ return unused.length > 0;
860
+ },
861
+
845
862
  // private
846
863
  getTypeList: function() {
847
864
  return this.typeMap.getRange(0, this.typeMap.getCount());
@@ -44,6 +44,7 @@ Ext.define('Coon.common.component.editor.TypedCharacteristicEditor', {
44
44
  },
45
45
  },
46
46
  });
47
+
47
48
  this.plugins = Ext.clone(this.plugins) || [];
48
49
 
49
50
  if (this.enableToolBar) {
@@ -58,12 +59,15 @@ Ext.define('Coon.common.component.editor.TypedCharacteristicEditor', {
58
59
  if (this.getReadMode()) {
59
60
  buttons.add.disable();
60
61
  buttons.del.disable();
61
- } else if (select) {
62
- if (this.getSelection()[0].get(ns.$required)) {
62
+ } else {
63
+ if (select) {
64
+ if (this.getSelection()[0].get(ns.$required)) {
65
+ buttons.del.disable();
66
+ }
67
+ } else {
63
68
  buttons.del.disable();
64
69
  }
65
- } else {
66
- buttons.del.disable();
70
+ buttons.add.setDisabled(!this.hasUnusedTypes());
67
71
  }
68
72
  }.bind(this),
69
73
 
@@ -331,6 +335,7 @@ Ext.define('Coon.common.component.editor.TypedCharacteristicEditor', {
331
335
  }
332
336
  }
333
337
  }
338
+ this.processButtons();
334
339
  },
335
340
 
336
341
  delHandler: function() {
@@ -8,26 +8,26 @@ Ext.define('Coon.common.field.FIOField', {
8
8
  // Если одно или больше трех слов
9
9
  this.defaultRegex = /^[А-ЯЁ][.]?[а-яё]*(?:[\s.][А-ЯЁ][а-яё]*)*$/;
10
10
  this.defaultMsg =
11
- 'Слова должны начинаться с заглавной буквы и заканчиваться строчной.' +
11
+ 'Слова должны начинаться с заглавной буквы и заканчиваться строчной. ' +
12
12
  'Допускается использовать инициалы в формате "А."'
13
13
  ;
14
14
  this.rules = [
15
15
  {
16
16
  words: 1,
17
17
  regex: this.defaultRegex,
18
- msg: this.defaultMsg,
18
+ msg: '',
19
19
  },
20
20
  // Бюльбюль(-Оглы| оглы| Оглы)
21
21
  {
22
22
  words: 2,
23
23
  regex: /^[А-Я]*([А-ЯЁ][а-яё]*[-\s][А-яЁё]*)$/,
24
- msg: 'Если два слова: разделитель - дефис или пробел.',
24
+ msg: ' Если два слова: разделитель - дефис или пробел.',
25
25
  },
26
26
  // Ван-(дер|Дер)-Варт
27
27
  {
28
28
  words: 3,
29
29
  regex: /^[А-Я]*([А-ЯЁ][а-яё]*[-\s][А-яЁё]*[-\s][А-ЯЁ][а-яё]*)$/,
30
- msg: `Если три слова: последнее слово с заглавной буквы.`,
30
+ msg: ' Если три слова: последнее слово с заглавной буквы.',
31
31
  }
32
32
  ];
33
33
 
@@ -54,7 +54,7 @@ Ext.define('Coon.common.field.FIOField', {
54
54
  .filter((word) => word !== '').length;
55
55
  const rule = this.rules[wordsCount - 1];
56
56
  const regex = (rule && rule.regex) || this.defaultRegex;
57
- const msg = (rule && rule.msg) || this.defaultMsg;
57
+ const msg = (rule && rule.msg) || '';
58
58
  if (!this.upperCase && !regex.test(value)) {
59
59
  return this.defaultMsg + msg;
60
60
  }
@@ -62,7 +62,7 @@ Ext.define('Coon.common.field.FIOField', {
62
62
  if (this.upperCase && !/(^[А-ЯЁ]*[?\-][А-ЯЁ]+$)|(^[А-ЯЁ]+$)|(^[А-ЯЁ][?.]+$)/.test(value)) {
63
63
  return (
64
64
  'Значение должно состоять из заглавных букв. ' +
65
- 'Допускается использовать -, но после него должна быть заглавная буква' +
65
+ 'Допускается использовать -, но после него должна быть заглавная буква. ' +
66
66
  'Допускается использовать инициалы в формате "А."'
67
67
  );
68
68
  }
@@ -51,6 +51,21 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
51
51
  color: '#000000',
52
52
  },
53
53
  },
54
+ htmlEntities: [
55
+ {regex: '>', entity: '&gt;'},
56
+ {regex: '<', entity: '&lt;'},
57
+ {regex: '&', entity: '&amp;'}
58
+ ],
59
+
60
+ html_entities_decode(s) {
61
+ let reg;
62
+ for (const v in this.htmlEntities) {
63
+ reg = new RegExp(this.htmlEntities[v].entity, 'g');
64
+ s = s.replace(reg, this.htmlEntities[v].regex);
65
+ }
66
+ return s;
67
+ },
68
+
54
69
  injectForm() {
55
70
  // if element already exist
56
71
  if (document.querySelector(`form#${this.formId()}`)) {
@@ -232,8 +247,9 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
232
247
  table.data.rows.forEach((tr) => {
233
248
  result.push(tr.reduce((accumulator, td) => {
234
249
  if (td.display === true) {
250
+ const html = this.processingTemplate(this.html_entities_decode(td.content).replace(/&nbsp;|<br>/gi, ''));
235
251
  const tmp = {
236
- 'value': td.content.replace(/&nbsp;|<br>/gi, ''),
252
+ 'value': this.applyTemplate(html, this.getDataForTemplate(html)),
237
253
  };
238
254
  if (td.colspan && td.colspan > 1) {
239
255
  tmp.mergeAcross = td.colspan - 1;
@@ -384,9 +400,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
384
400
  );
385
401
  }
386
402
  if (this.headerXlsx) {
387
- const headerXlsx = this.parseJsEditorObj(this.headerXlsx, workbook);
388
- const html = this.processingTemplate(JSON.stringify(headerXlsx));
389
- headerRows = headerRows.concat(JSON.parse(this.applyTemplate(html, this.getDataForTemplate(html))));
403
+ headerRows = headerRows.concat(this.parseJsEditorObj(this.headerXlsx, workbook));
390
404
  }
391
405
  const dataIndexToColumn = [];
392
406
  const visibleColumns = [];
@@ -418,9 +432,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
418
432
  );
419
433
  }, this);
420
434
  if (this.footerXlsx) {
421
- const footerXlsx = this.parseJsEditorObj(this.footerXlsx, workbook);
422
- const html = this.processingTemplate(JSON.stringify(footerXlsx));
423
- footerRows = JSON.parse(this.applyTemplate(html, this.getDataForTemplate(html)));
435
+ footerRows = this.parseJsEditorObj(this.footerXlsx, workbook);
424
436
  }
425
437
  return {headerRows, dataRows, footerRows};
426
438
  },
@@ -573,19 +585,14 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
573
585
  */
574
586
  getSummaryRows() {
575
587
  const summaryRows = [];
588
+ if (!this.component.initialConfig.features.find((f) => f.summaryBar && f.showSummaryRow)) {
589
+ return summaryRows;
590
+ }
576
591
  const summaries = this.exporter.getConfig().data.getSummaries();
592
+
577
593
  if (summaries && summaries.length) {
578
594
  summaries.each((row) => {
579
- let flag = false;
580
- const values = row.getCells().getValues('_value').map((value) => {
581
- if (value) {
582
- flag = true;
583
- }
584
- return ({value});
585
- });
586
- if (flag) {
587
- summaryRows.push(values);
588
- }
595
+ summaryRows.push(row.getCells().getValues('_value').map((value) => ({value})));
589
596
  });
590
597
  }
591
598
  return summaryRows;
@@ -959,9 +966,8 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
959
966
  }
960
967
  result.push('</tbody></table>');
961
968
  }
962
-
963
969
  if (!Ext.isEmpty(this.header)) {
964
- const html = this.processingTemplate(this.headerTemplate.html);
970
+ const html = this.processingTemplate(this.html_entities_decode(this.headerTemplate.html));
965
971
  result.push(this.applyTemplate(html, this.getDataForTemplate(html)));
966
972
  }
967
973
  // собираем заголовки
@@ -1004,7 +1010,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1004
1010
  fields.map(({name}) => name).filter(
1005
1011
  (name, index) => visibleColumns.includes(index)
1006
1012
  ).forEach((name, index) => {
1007
- rec.set(name, row[index].value);
1013
+ rec.set(name, row[index] ? row[index].value : '');
1008
1014
  });
1009
1015
  selections.push(rec);
1010
1016
  });
@@ -1023,7 +1029,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1023
1029
  result.push('</table>');
1024
1030
  // Нижний колонтитул (если задан).
1025
1031
  if (!Ext.isEmpty(this.footer)) {
1026
- const html = this.processingTemplate(this.footerTemplate.html);
1032
+ const html = this.processingTemplate(this.html_entities_decode(this.footerTemplate.html));
1027
1033
  result.push(this.applyTemplate(html, this.getDataForTemplate(html)));
1028
1034
  }
1029
1035
  result.push('</body></html>');
@@ -27,7 +27,15 @@ Ext.define('Coon.report.plugin.grid.RestoreSelectionPlugin', {
27
27
  init: function(grid) {
28
28
  this.grid = grid;
29
29
  grid.setRecordIDForRestore = Ext.bind(this.setRecordIDForRestore, this);
30
- grid.getStore().on('load', this.restoreSelectionHandler, this);
30
+
31
+ if (!grid.rendered) {
32
+ grid.on('afterrender', function() {
33
+ this.restoreSelectionHandler();
34
+ grid.getStore().on('load', this.restoreSelectionHandler, this);
35
+ }, this, {single: true});
36
+ } else {
37
+ grid.getStore().on('load', this.restoreSelectionHandler, this);
38
+ }
31
39
  grid.getSelectionModel().on('selectionchange', this.storeSelectionHandler, this);
32
40
  grid.on('newEntityAdd', this.setRecordIDForRestore, this);
33
41
  },
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.8.16',
3
+ number: '2.8.17',
4
4
  });