ru.coon 2.8.15 → 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,12 +1,29 @@
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
+
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
+
12
+ * update: CHANGELOG.md ([80dc33], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/80dc3360b47ddac2924e7d25d40873815511154a))
13
+
1
14
  # Version 2.8.15, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8243a899e863488223002046a50b6692d3af8fb5)
2
15
  * ## Features
3
16
  * <span style='color:green'>feat: HT-10125: remove tbfill when it has in items</span> ([f57798], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f57798b08404721c6d13512b3be38771dc53ee30))
4
17
  * <span style='color:green'>feat: HT-10125: remove tbfill when it has in items</span> ([3e9b04], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3e9b04e719016aedab59ac8b889da93de0540715))
18
+ * <span style='color:green'>feat: HT-10008: refactor overrides styles code part</span> ([ffbcc9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ffbcc9fc179deba7c46fb1e158136cd32a5d4c3c))
5
19
  * <span style='color:green'>feat: HT-8951: fix css</span> ([7ddd11], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7ddd117e3ba365e1c2da3472ecd0efe180e1e204))
20
+ * <span style='color:green'>feat: HT-10485: apply tpl for xls and xlsx</span> ([eb4503], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/eb450352f7e5062d394f6b0f29eff84603c1511a))
6
21
 
7
22
  * ## Fixes
8
23
  * <span style='color:red'>fixes</span> ([77fb8d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/77fb8de94f02156769b48092d91ea16a11f9aa94))
9
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))
10
27
  * update: CHANGELOG.md ([b6ceb3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b6ceb36854b9ae262d9dcf375f19695392da16ca))
11
28
 
12
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.15",
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()}`)) {
@@ -205,14 +220,18 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
205
220
  return this.mergeDeep(target, ...sources);
206
221
  },
207
222
 
208
- applyTemplate(content) {
223
+ getCurrentFilterParameters() {
224
+ return this.component.up('ReportPanel').currentParamList || {};
225
+ },
226
+
227
+ applyTemplate(content = '', data = {}) {
209
228
  const tpl = new Ext.XTemplate(content, {
210
229
  disableFormats: true,
211
230
  date(format = 'd.m.Y') {
212
231
  return Ext.Date.format(new Date(), format);
213
232
  },
214
233
  });
215
- return tpl.apply({params: this.component.up('ReportPanel').currentParamList || {}});
234
+ return tpl.apply(Object.assign(data, {parameters: this.getCurrentFilterParameters()}));
216
235
  },
217
236
 
218
237
  parseJsEditorObj: function(obj, workbook) {
@@ -228,8 +247,9 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
228
247
  table.data.rows.forEach((tr) => {
229
248
  result.push(tr.reduce((accumulator, td) => {
230
249
  if (td.display === true) {
250
+ const html = this.processingTemplate(this.html_entities_decode(td.content).replace(/&nbsp;|<br>/gi, ''));
231
251
  const tmp = {
232
- 'value': this.applyTemplate(td.content.replace(/<br>/gi, '')),
252
+ 'value': this.applyTemplate(html, this.getDataForTemplate(html)),
233
253
  };
234
254
  if (td.colspan && td.colspan > 1) {
235
255
  tmp.mergeAcross = td.colspan - 1;
@@ -368,7 +388,6 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
368
388
  const dataRows = [];
369
389
  let headerRows = [];
370
390
  let footerRows = [];
371
- const dataForTemplate = this.getDataForTemplate();
372
391
  const grid = this.component;
373
392
  const columnModel = grid.getColumns();
374
393
  const columnCount = grid.getColumns().length;
@@ -381,11 +400,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
381
400
  );
382
401
  }
383
402
  if (this.headerXlsx) {
384
- const headerXlsx = this.parseJsEditorObj(this.headerXlsx, workbook);
385
- const tmpl = new Ext.XTemplate(
386
- this.processingTemplate(JSON.stringify(headerXlsx))
387
- ).apply(dataForTemplate);
388
- headerRows = headerRows.concat(JSON.parse(tmpl));
403
+ headerRows = headerRows.concat(this.parseJsEditorObj(this.headerXlsx, workbook));
389
404
  }
390
405
  const dataIndexToColumn = [];
391
406
  const visibleColumns = [];
@@ -417,11 +432,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
417
432
  );
418
433
  }, this);
419
434
  if (this.footerXlsx) {
420
- const footerXlsx = this.parseJsEditorObj(this.footerXlsx, workbook);
421
- const tmpl = new Ext.XTemplate(
422
- this.processingTemplate(JSON.stringify(footerXlsx))
423
- ).apply(dataForTemplate);
424
- footerRows = JSON.parse(tmpl);
435
+ footerRows = this.parseJsEditorObj(this.footerXlsx, workbook);
425
436
  }
426
437
  return {headerRows, dataRows, footerRows};
427
438
  },
@@ -477,8 +488,8 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
477
488
  return fileName;
478
489
  }
479
490
  try {
480
- fileName = new Ext.XTemplate(fileName, {strict: true}).apply({
481
- parameters: this.component.up('ReportPanel').currentParamList || {},
491
+ fileName = this.applyTemplate(fileName, {
492
+ parameters: this.getCurrentFilterParameters(),
482
493
  });
483
494
  } catch (err) {
484
495
  Coon.log.warn(err);
@@ -534,7 +545,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
534
545
  this.collectGridDataAsObject(this.getSelected(), exporter.excel);
535
546
  const tableHeaderRows = this.getTableHeaderRows(exporter);
536
547
  const summaryRows = this.getSummaryRows();
537
- this.assignStyle([...dataRows, ...summaryRows], this.allBordersStyle);
548
+ // this.assignStyle([...dataRows, ...summaryRows], this.allBordersStyle);
538
549
  exporter.jsonData = [...headerRows, ...tableHeaderRows, ...dataRows, ...summaryRows, ...footerRows];
539
550
  exporter.getContent = this.getContent.bind(exporter, this);
540
551
  return exporter;
@@ -574,19 +585,14 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
574
585
  */
575
586
  getSummaryRows() {
576
587
  const summaryRows = [];
588
+ if (!this.component.initialConfig.features.find((f) => f.summaryBar && f.showSummaryRow)) {
589
+ return summaryRows;
590
+ }
577
591
  const summaries = this.exporter.getConfig().data.getSummaries();
592
+
578
593
  if (summaries && summaries.length) {
579
594
  summaries.each((row) => {
580
- let flag = false;
581
- const values = row.getCells().getValues('_value').map((value) => {
582
- if (value) {
583
- flag = true;
584
- }
585
- return ({value});
586
- });
587
- if (flag) {
588
- summaryRows.push(values);
589
- }
595
+ summaryRows.push(row.getCells().getValues('_value').map((value) => ({value})));
590
596
  });
591
597
  }
592
598
  return summaryRows;
@@ -941,7 +947,6 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
941
947
  const result = [];
942
948
  const grid = this.component;
943
949
  const columnCount = grid.getColumns().length;
944
- const dataForTemplates = this.getDataForTemplate();
945
950
  result.push('<html>' +
946
951
  '<head>' +
947
952
  '<meta http-equiv=Content-Type content="text/html; charset=utf-8">' +
@@ -961,9 +966,9 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
961
966
  }
962
967
  result.push('</tbody></table>');
963
968
  }
964
-
965
969
  if (!Ext.isEmpty(this.header)) {
966
- result.push(new Ext.XTemplate(this.processingTemplate(this.headerTemplate.html)).apply(dataForTemplates));
970
+ const html = this.processingTemplate(this.html_entities_decode(this.headerTemplate.html));
971
+ result.push(this.applyTemplate(html, this.getDataForTemplate(html)));
967
972
  }
968
973
  // собираем заголовки
969
974
  const dataIndexToColumn = [];
@@ -1005,7 +1010,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1005
1010
  fields.map(({name}) => name).filter(
1006
1011
  (name, index) => visibleColumns.includes(index)
1007
1012
  ).forEach((name, index) => {
1008
- rec.set(name, row[index].value);
1013
+ rec.set(name, row[index] ? row[index].value : '');
1009
1014
  });
1010
1015
  selections.push(rec);
1011
1016
  });
@@ -1024,7 +1029,8 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1024
1029
  result.push('</table>');
1025
1030
  // Нижний колонтитул (если задан).
1026
1031
  if (!Ext.isEmpty(this.footer)) {
1027
- result.push(new Ext.XTemplate(this.processingTemplate(this.footerTemplate.html)).apply(dataForTemplates));
1032
+ const html = this.processingTemplate(this.html_entities_decode(this.footerTemplate.html));
1033
+ result.push(this.applyTemplate(html, this.getDataForTemplate(html)));
1028
1034
  }
1029
1035
  result.push('</body></html>');
1030
1036
  return result;
@@ -1140,23 +1146,23 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1140
1146
  </td>
1141
1147
  `);
1142
1148
  } else {
1143
- const col = Ext.apply(
1144
- {value: this.getRenderedValue(value, valueType) || ''},
1145
- this.getRowStyleXlsx(grid, record, workbook)
1146
- );
1149
+ let styles = this.getRowStyleXlsx(grid, record, workbook);
1150
+ const col = {value: this.getRenderedValue(value, valueType) || ''};
1151
+ styles = this.mergeDeep(styles, this.allBordersStyle);
1147
1152
  if (valueType === 'float') {
1148
1153
  let precision = Number(columnConfig.precision);
1149
1154
  if (!Number.isInteger(precision)) {
1150
1155
  precision = Number(this.getConfig('floatPrecision') || this.defaultFloatPrecision);
1151
1156
  }
1152
- col['styleId'] = workbook.addCellStyle({
1153
- format: precision !== 0 ? '0.'.padEnd(precision + 2, '0') : '0',
1154
- });
1157
+ styles = this.mergeDeep(styles, {format: precision !== 0 ? '0.'.padEnd(precision + 2, '0') : '0'});
1155
1158
  if (col['value'].length) {
1156
1159
  col['value'] = parseFloat(col['value'].replace(/\s/g, '').replace(',', '.'));
1157
1160
  }
1158
1161
  }
1159
- result.push(col);
1162
+
1163
+ col['styleId'] = workbook.addCellStyle(styles);
1164
+
1165
+ result.push(JSON.parse(JSON.stringify(col)));
1160
1166
  }
1161
1167
  }, this);
1162
1168
  if (!object) {
@@ -1181,7 +1187,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1181
1187
  }
1182
1188
  }
1183
1189
 
1184
- return Object.keys(styles).length ? {'styleId': workbook.addCellStyle(styles)} : {};
1190
+ return {styles: styles};
1185
1191
  },
1186
1192
  getRowStyle: function(grid, record) {
1187
1193
  const rowElement = Ext.fly(grid.getView().getRow(grid.getStore().indexOf(record)));
@@ -1301,8 +1307,7 @@ Ext.define('Coon.report.plugin.grid.CopyRowsFromGrid', {
1301
1307
  },
1302
1308
 
1303
1309
  // Получение параметров шаблонов
1304
- getDataForTemplate: function() {
1305
- const text = (this.header || '') + (this.footer || '');
1310
+ getDataForTemplate: function(text) {
1306
1311
  if (Ext.isEmpty(text)) {
1307
1312
  return {};
1308
1313
  }
@@ -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.15',
3
+ number: '2.8.17',
4
4
  });