ru.coon 2.5.38 → 2.5.40

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/.husky/pre-commit CHANGED
File without changes
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # Version 2.5.40, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5b5d783b6007d6cf16d9f3fb48e203818a0b9c47)
2
+ * ## Fixes
3
+ * <span style='color:red'>fix</span> ([5400c1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5400c17b624f78acfa1dbe8c27742e7a1f4b1cc1))
4
+ * <span style='color:red'> Переделан механизм добавления меню в кнопку "Поиск"</span> ([0437f3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0437f3f77c410d545f65d75516091db6ba41ad80))
5
+
6
+ * revert to bf9339051130805e551f48ce07bd5bac3d49d140 ([80394d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/80394d8e7b64a12c3e137d74661c529d6162004c))
7
+ * update: CHANGELOG.md ([14b820], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/14b8208316d9994deafbbd54ccab2fdae4900e74))
8
+
9
+ # Version 2.5.39, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/197e1a48c71c978b75397d971309a8df6c4eae59)
10
+ * hotfix ExportReportDataToFilePlugin ([ccdd78], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ccdd78c5e826fc1c93493e9336bdfb3124b58f44))
11
+ * update: CHANGELOG.md ([35314e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/35314ed753380fa21254cf133f068f812e6b5031))
12
+
1
13
  # Version 2.5.38, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cf1397fbbe07d11e5cdf281bdd82611040a1b31e)
2
14
  * ## Features
3
15
  * <span style='color:green'>feat: TR-67541 Исправление причину сообщений WRN callParent has no target при сборке wb</span> ([a5753d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a5753dff2b7454b5d466e30cb4369f8632059805))
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.5.38",
7
+ "version": "2.5.40",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
File without changes
File without changes
@@ -24,7 +24,7 @@ Ext.define('Coon.report.command.BaseReportDataCommand', {
24
24
 
25
25
  execute: function(grid, config) {
26
26
  this.grid = grid;
27
- const form = this.getForm() || this.injectForm();
27
+ const form = this.getForm() || this.injectForm() && this.getForm();
28
28
 
29
29
  const filename = config.reportFileName ||
30
30
  this.grid.reportId ||
@@ -93,7 +93,6 @@ Ext.define('Coon.report.command.BaseReportDataCommand', {
93
93
  <input name="parameterList" id="toReportFormDataParameterList"/>
94
94
  `;
95
95
  document.body.append(form);
96
- return form;
97
96
  },
98
97
 
99
98
  });
@@ -21,11 +21,17 @@ Ext.define('Coon.report.component.report.NorthPanel', {
21
21
  enableHighlightingRequiredFields: false,
22
22
  },
23
23
  initComponent() {
24
- this.searchButton = Ext.widget('button', Ext.apply({
24
+ this.searchButton = Ext.widget('splitbutton', Ext.apply({
25
25
  ui: 'orange-button',
26
26
  text: 'Поиск',
27
27
  }, this.findButtonConfig || {}));
28
28
 
29
+ // arrowVisible is not working, so we need this hack
30
+ this.searchButton['_splitCls'] = this.searchButton.getSplitCls();
31
+ this.searchButton.getSplitCls = function() {
32
+ return this.menu && this.menu.items.length ? this['_splitCls'] : '';
33
+ };
34
+
29
35
  this.clearButton = Ext.widget('button', Ext.apply({
30
36
  ui: 'green-button',
31
37
  text: 'Очистить',
@@ -64,7 +70,7 @@ Ext.define('Coon.report.component.report.NorthPanel', {
64
70
  */
65
71
  this.on('added', function() {
66
72
  this.reportPanel = this.findParentByType('ReportPanel');
67
- this.searchButton.handler = this.reportPanel ? Ext.bind(this.reportPanel.filterHandler, this.reportPanel): Ext.emptyFn;
73
+ this.searchButton.handler = this.reportPanel ? Ext.bind(this.reportPanel.filterHandler, this.reportPanel) : Ext.emptyFn;
68
74
  this.clearButton.handler = Ext.bind(function() {
69
75
  this.clearFilter();
70
76
  this.clearData();
@@ -93,7 +99,7 @@ Ext.define('Coon.report.component.report.NorthPanel', {
93
99
  Ext.merge(this, properties);
94
100
  this.filterPlugins.push({
95
101
  ptype: 'EnterConfirmFormPlugin',
96
- confirmHandler: this.reportPanel ? Ext.bind(this.reportPanel.filterHandler, this.reportPanel): Ext.emptyFn,
102
+ confirmHandler: this.reportPanel ? Ext.bind(this.reportPanel.filterHandler, this.reportPanel) : Ext.emptyFn,
97
103
  });
98
104
 
99
105
  const [enableHighlightingRequiredFields, hiddenLegend] = this.hasPropertiesFilterPanel(reportFormBean.plugins, properties);
@@ -107,7 +113,7 @@ Ext.define('Coon.report.component.report.NorthPanel', {
107
113
  });
108
114
  filterPanel.on('searchbuttontoggle', function(isValid, errorMessage) {
109
115
  this.searchButton.setDisabled(!isValid);
110
- this.searchButton.setTooltip(!isValid ? errorMessage: '');
116
+ this.searchButton.setTooltip(!isValid ? errorMessage : '');
111
117
  }, this);
112
118
  this.filterContainer.removeAll();
113
119
  this.filterContainer.add(filterPanel);
@@ -196,35 +202,19 @@ Ext.define('Coon.report.component.report.NorthPanel', {
196
202
  if (!menuItems.length) {
197
203
  return;
198
204
  }
199
- if (this.splitSearchButton) {
200
- menuItems.forEach((c) => {
201
- this.splitSearchButton.menu.insert(0,
202
- c.$className && c.isMenuItem ?
203
- c :
204
- Ext.create(Object.assign(c, {xtype: 'menuitem'}))
205
- );
206
- });
207
- } else {
208
- const btn = this.searchButton;
209
- if (btn) {
210
- this.splitSearchButton = Ext.create(
211
- Object.assign(
212
- {
213
- xtype: 'splitbutton',
214
- handler: btn.handler.bind(btn),
215
- menu: menuItems,
216
- },
217
- btn.initialConfig || {},
218
- {margin: btn.margin}
219
- )
220
- );
221
- btn.hide();
222
- btn.ownerCt.items.items.splice(
223
- btn.ownerCt.items.items.indexOf(btn),
205
+ const existingMenu = this.searchButton.getMenu();
206
+ if (existingMenu && existingMenu.items.length) {
207
+ for (const menuItem of menuItems) {
208
+ existingMenu.insert(
224
209
  0,
225
- this.splitSearchButton
210
+ menuItem.$className && menuItem.isMenuItem ?
211
+ menuItem :
212
+ Ext.create(Object.assign(menuItem, {xtype: 'menuitem'}))
226
213
  );
227
214
  }
215
+ } else {
216
+ this.searchButton.setMenu(menuItems);
217
+ this.searchButton.btnWrap.addCls(this.searchButton.getSplitCls());
228
218
  }
229
219
  },
230
220
  });
@@ -17,6 +17,7 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
17
17
  config.invisibleByDefault = config.addToSearchButton === true;
18
18
  this.callParent(arguments);
19
19
  },
20
+
20
21
  init(grid) {
21
22
  this.callParent([grid]);
22
23
  const format = this.config.exportFileFormat;
@@ -32,14 +33,7 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
32
33
  }
33
34
  this.grid = grid;
34
35
  }, this);
35
- this.getDataCommand = Ext.create(
36
- `command.${
37
- format === 'pdf' ?
38
- 'GetPdfReportDataCommand' :
39
- 'GetExcelFromRowsOrReportData'
40
- }`,
41
- {useRawFilterParams: this.getConfig('addToSearchButton')}
42
- );
36
+ this.printPdfCommand = Ext.create('command.GetPdfReportDataCommand', {useRawFilterParams: this.getConfig('addToSearchButton')});
43
37
  },
44
38
 
45
39
  handler: function() {
@@ -47,8 +41,10 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
47
41
  this.showPanel();
48
42
  } else {
49
43
  this.config.columns = this.config.columnList.map((record) => record.reportField);
50
- this.getSelections();
51
- this.getDataCommand.execute(this.report, this.config);
44
+ this.getRecordsToPrint();
45
+ this.config.exportFileFormat === 'pdf' ?
46
+ this.printPdfCommand.execute(this.report, this.config) :
47
+ this.printExcelFile();
52
48
  }
53
49
  },
54
50
 
@@ -114,8 +110,10 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
114
110
  title: 'Выводить колонки',
115
111
  });
116
112
  this.win.on('setColumns', function() {
117
- this.getSelections();
118
- this.getDataCommand.execute(this.report, this.config);
113
+ this.getRecordsToPrint();
114
+ this.config.exportFileFormat === 'pdf' ?
115
+ this.printPdfCommand.execute(this.report, this.config) :
116
+ this.printExcelFile();
119
117
  this.win.close();
120
118
  }, this);
121
119
  this.win.show();
@@ -126,24 +124,60 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
126
124
  },
127
125
 
128
126
  setColumns: function() {
129
- const selectedColumns = this.columnsGrid.getStore().queryRecords('checkbox', true);
130
- if (!selectedColumns.length) {
127
+ const checkedRecords = this.columnsGrid.getStore().queryRecords('checkbox', true);
128
+ if (!checkedRecords.length) {
131
129
  return;
132
130
  }
133
- this.config.columns = selectedColumns.map((record) => record.get('reportField'));
131
+ this.config.columns = checkedRecords.map((record) => record.get('reportField'));
134
132
  this.win.fireEvent('setColumns');
135
133
  },
136
134
 
137
- getSelections: function() {
138
- const rows = this.grid.getSelectionModel().getSelection();
139
- if (rows.length > 0) {
140
- this.config.toExcel = [];
141
- for (let i = 0; i < rows.length; i++) {
142
- const rowData = rows[i].getData();
143
- delete rowData['id'];
144
- this.config.toExcel.push(rowData);
135
+ getSelectedRecords() {
136
+ return this.grid.getSelectionModel().getSelection();
137
+ },
138
+
139
+ getRecordsToPrint: function() {
140
+ this.config.toExcel = [];
141
+ const selectedRecords = this.getSelectedRecords();
142
+ const records = selectedRecords.length ? selectedRecords : this.grid.getStore().getRange();
143
+
144
+ records.forEach((rec) => {
145
+ const recData = rec.getData();
146
+ delete recData['id'];
147
+ this.config.toExcel.push(recData);
148
+ });
149
+ },
150
+
151
+ printExcelFile: async function() {
152
+ const fileName = this.config.reportFileName || this.report.reportId || 'defaultReportName';
153
+ const currentParamList = this.report.currentParamList;
154
+ const parameterList = [];
155
+
156
+ for (const key in currentParamList) {
157
+ if (currentParamList.hasOwnProperty(key) && !Ext.isEmpty(currentParamList[key])) {
158
+ parameterList.push({type: key, value: currentParamList[key]});
145
159
  }
146
160
  }
161
+
162
+ const hasSelected = !!(this.getSelectedRecords() || []).length;
163
+ const url = hasSelected && !this.getConfig('addToSearchButton') ?
164
+ '/ReportFormData/getExcelFromRowsOrReport' :
165
+ '/ReportFormData/getExcelReport';
166
+
167
+ Ext.Ajax.request({
168
+ url,
169
+ method: 'POST',
170
+ binary: true,
171
+ params: {
172
+ reportId: this.report.reportId,
173
+ fileName: fileName,
174
+ appendDateToFileName: Ext.isBoolean(this.config.appendDateToFileName) ? this.config.appendDateToFileName : true,
175
+ parameterList: JSON.stringify(parameterList),
176
+ columnList: JSON.stringify(this.config.columns),
177
+ toExcel: JSON.stringify(this.config.toExcel),
178
+ },
179
+ success: (responce) => Coon.util.downloadFileFromBlob(new Blob([responce.responseBytes]), `${fileName}.xlsx`),
180
+ });
147
181
  },
148
182
 
149
183
  });
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.5.38',
3
+ number: '2.5.40',
4
4
  });
@@ -1,7 +0,0 @@
1
- **спецификация:**
2
-
3
- входные параметры:
4
-
5
- - exportFileFormat [xls/pdf]
6
- - allowUserSelectColumnsToUpload
7
- - addToSearchButton добавить в кнопку "поиск", в этом случае в качестве параметра отправляем текущие параметры из FilterPanel(useRawFilterParams: true)