ru.coon 2.5.39 → 2.5.41

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,22 @@
1
+ # Version 2.5.41, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/612fb7573419ad9857649f7211c8d7a56e52cdb4)
2
+ * ## Features
3
+ * <span style='color:green'>feat: BFL-9521: init dependent form params anytime</span> ([2e5aa1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2e5aa16eeace7205cff9e01295f43d0f4ce956c6))
4
+
5
+ * ## Fixes
6
+ * <span style='color:red'> BFL-9515 исправления по проверке безопасности фронтенда в части взаимодействия с iswe в iframe</span> ([f34b8f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f34b8fdf31285fd53f932dfe277e961ffa275fd0))
7
+ * <span style='color:red'> postMessage origin fix. Closes BFL-9515.</span> ([21ab56], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/21ab56a1998efe4b6cd4e4d35337c8fbc5b47729))
8
+
9
+ * ([Update], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/Update src/uielement/component/settings/UiCustomPanelEditorController.js9987a0e79de3a1fa5fa93216f0ffd4bdb50c59fc))
10
+ * update: CHANGELOG.md ([958f76], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/958f76b4fca9844ca6bae88260580ff2340843e5))
11
+
12
+ # Version 2.5.40, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5b5d783b6007d6cf16d9f3fb48e203818a0b9c47)
13
+ * ## Fixes
14
+ * <span style='color:red'>fix</span> ([5400c1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5400c17b624f78acfa1dbe8c27742e7a1f4b1cc1))
15
+ * <span style='color:red'> Переделан механизм добавления меню в кнопку "Поиск"</span> ([0437f3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0437f3f77c410d545f65d75516091db6ba41ad80))
16
+
17
+ * revert to bf9339051130805e551f48ce07bd5bac3d49d140 ([80394d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/80394d8e7b64a12c3e137d74661c529d6162004c))
18
+ * update: CHANGELOG.md ([14b820], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/14b8208316d9994deafbbd54ccab2fdae4900e74))
19
+
1
20
  # Version 2.5.39, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/197e1a48c71c978b75397d971309a8df6c4eae59)
2
21
  * hotfix ExportReportDataToFilePlugin ([ccdd78], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ccdd78c5e826fc1c93493e9336bdfb3124b58f44))
3
22
  * update: CHANGELOG.md ([35314e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/35314ed753380fa21254cf133f068f812e6b5031))
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.5.39",
7
+ "version": "2.5.41",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -130,8 +130,10 @@ Ext.define('Coon.uielement.component.ExternalFrame', {
130
130
  if (this.showFrameTitle === true) {
131
131
  showFrameTitleParam = '&showFrameTitle=1';
132
132
  }
133
+ const wbTargetOrigin = `&wbTargetOrigin=` + window.origin;
134
+
133
135
  const req = await fetch(
134
- `${this.pathResolver}/${this.type.toUpperCase()}/${this.path}${themeParam}${ext7frameParam}${showFrameTitleParam}`
136
+ `${this.pathResolver}/${this.type.toUpperCase()}/${this.path}${themeParam}${ext7frameParam}${showFrameTitleParam}${wbTargetOrigin}`
135
137
  );
136
138
  const redirectedUrl = await req.text();
137
139
  Coon.log.debug(redirectedUrl, 'Redirecting to:');
@@ -26,6 +26,12 @@ Ext.define('Coon.report.component.report.NorthPanel', {
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,39 +202,19 @@ Ext.define('Coon.report.component.report.NorthPanel', {
196
202
  if (!menuItems.length) {
197
203
  return;
198
204
  }
199
- const btn = this.searchButton;
200
- btn.setMenu(menuItems);
201
- btn.setArrowVisible(true);
202
- return;
203
- // if (this.splitSearchButton) {
204
- // menuItems.forEach((c) => {
205
- // this.splitSearchButton.menu.insert(0,
206
- // c.$className && c.isMenuItem ?
207
- // c :
208
- // Ext.create(Object.assign(c, {xtype: 'menuitem'}))
209
- // );
210
- // });
211
- // } else {
212
- // const btn = this.searchButton;
213
- // if (btn) {
214
- // this.splitSearchButton = Ext.create(
215
- // Object.assign(
216
- // {
217
- // xtype: 'splitbutton',
218
- // handler: btn.handler.bind(btn),
219
- // menu: menuItems,
220
- // },
221
- // btn.initialConfig || {},
222
- // {margin: btn.margin}
223
- // )
224
- // );
225
- // btn.hide();
226
- // btn.ownerCt.items.items.splice(
227
- // btn.ownerCt.items.items.indexOf(btn),
228
- // 0,
229
- // this.splitSearchButton
230
- // );
231
- // }
232
- // }
205
+ const existingMenu = this.searchButton.getMenu();
206
+ if (existingMenu && existingMenu.items.length) {
207
+ for (const menuItem of menuItems) {
208
+ existingMenu.insert(
209
+ 0,
210
+ menuItem.$className && menuItem.isMenuItem ?
211
+ menuItem :
212
+ Ext.create(Object.assign(menuItem, {xtype: 'menuitem'}))
213
+ );
214
+ }
215
+ } else {
216
+ this.searchButton.setMenu(menuItems);
217
+ this.searchButton.btnWrap.addCls(this.searchButton.getSplitCls());
218
+ }
233
219
  },
234
220
  });
@@ -14,39 +14,26 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
14
14
  },
15
15
 
16
16
  constructor(config) {
17
- // config.invisibleByDefault = config.addToSearchButton === true;
17
+ config.invisibleByDefault = config.addToSearchButton === true;
18
18
  this.callParent(arguments);
19
19
  },
20
20
 
21
-
22
21
  init(grid) {
23
22
  this.callParent([grid]);
24
23
  const format = this.config.exportFileFormat;
25
24
  this.buttonText = this.buttonText || (format && 'Экспорт в ' + format);
26
- // grid.on(
27
- // 'render',
28
- // function() {
29
- // this.report = grid.findParentByType('ReportPanel');
30
- // if (this.getConfig('addToSearchButton') === true) {
31
- // this.report.northPanel.addToSearchButtonMenu({
32
- // text: this.buttonText,
33
- // iconCls: this.buttonIconCls,
34
- // handler: Ext.bind(this.handler, this),
35
- // });
36
- // }
37
- // this.grid = grid;
38
- // }, this,
39
- // {single: true}
40
- // );
41
- this.getDataCommand = Ext.create(
42
- `command.${
43
- format === 'pdf' ?
44
- 'GetPdfReportDataCommand' :
45
- 'GetExcelFromRowsOrReportData'
46
- }`,
47
- {useRawFilterParams: this.getConfig('addToSearchButton') || true}
48
- );
49
- debugger;
25
+ grid.on('render', function() {
26
+ this.report = grid.findParentByType('ReportPanel');
27
+ if (this.getConfig('addToSearchButton') === true) {
28
+ this.report.northPanel.addToSearchButtonMenu({
29
+ text: this.buttonText,
30
+ iconCls: this.buttonIconCls,
31
+ handler: Ext.bind(this.handler, this),
32
+ });
33
+ }
34
+ this.grid = grid;
35
+ }, this);
36
+ this.printPdfCommand = Ext.create('command.GetPdfReportDataCommand', {useRawFilterParams: this.getConfig('addToSearchButton')});
50
37
  },
51
38
 
52
39
  handler: function() {
@@ -54,8 +41,10 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
54
41
  this.showPanel();
55
42
  } else {
56
43
  this.config.columns = this.config.columnList.map((record) => record.reportField);
57
- this.getSelections();
58
- 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();
59
48
  }
60
49
  },
61
50
 
@@ -121,8 +110,10 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
121
110
  title: 'Выводить колонки',
122
111
  });
123
112
  this.win.on('setColumns', function() {
124
- this.getSelections();
125
- 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();
126
117
  this.win.close();
127
118
  }, this);
128
119
  this.win.show();
@@ -133,24 +124,60 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
133
124
  },
134
125
 
135
126
  setColumns: function() {
136
- const selectedColumns = this.columnsGrid.getStore().queryRecords('checkbox', true);
137
- if (!selectedColumns.length) {
127
+ const checkedRecords = this.columnsGrid.getStore().queryRecords('checkbox', true);
128
+ if (!checkedRecords.length) {
138
129
  return;
139
130
  }
140
- this.config.columns = selectedColumns.map((record) => record.get('reportField'));
131
+ this.config.columns = checkedRecords.map((record) => record.get('reportField'));
141
132
  this.win.fireEvent('setColumns');
142
133
  },
143
134
 
144
- getSelections: function() {
145
- const rows = this.grid.getSelectionModel().getSelection();
146
- if (rows.length > 0) {
147
- this.config.toExcel = [];
148
- for (const row of rows.length) {
149
- const rowData = Object.assign({}, row.getData());
150
- delete rowData['id'];
151
- 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]});
152
159
  }
153
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
+ });
154
181
  },
155
182
 
156
183
  });
@@ -0,0 +1,7 @@
1
+ **спецификация:**
2
+
3
+ входные параметры:
4
+
5
+ - exportFileFormat [xls/pdf]
6
+ - allowUserSelectColumnsToUpload
7
+ - addToSearchButton добавить в кнопку "поиск", в этом случае в качестве параметра отправляем текущие параметры из FilterPanel(useRawFilterParams: true)
@@ -100,13 +100,12 @@ Ext.define('Coon.report.plugin.report.BindCustomPanelPlugin', {
100
100
 
101
101
  initHandler: function() {
102
102
  const rows = this.component.getSelectionModel().getSelection();
103
+ const gridContextPlugin = this.component.getContextManager();
103
104
  if (this.dependOnGridRow && rows.length !== 1) {
104
105
  this.clearDependForm();
105
- } else {
106
- const gridContextPlugin = this.component.getContextManager();
107
- gridContextPlugin.resetContext();
108
- this.component.getContextManager().executeFunction(Ext.bind(this.doInitDependForm, this), this.parameters);
109
106
  }
107
+ gridContextPlugin.resetContext();
108
+ this.component.getContextManager().executeFunction(Ext.bind(this.doInitDependForm, this), this.parameters);
110
109
  },
111
110
 
112
111
  doInitDependForm: function(params) {
@@ -104,7 +104,7 @@ Ext.define('Coon.uielement.component.settings.FrameView', {
104
104
  this.on('afterrender', function() {
105
105
  const frameOrPage = new URLSearchParams(window.location.search).get('customForm');
106
106
  const target = frameOrPage === 'page' ? window.parentPage : window.parent;
107
- target.postMessage('give me elements', '*');
107
+ target.postMessage('give me elements', location.origin);
108
108
  }, this);
109
109
  this.callParent();
110
110
  },
@@ -46,7 +46,7 @@ Ext.define('Coon.uielement.component.settings.FrameViewController', {
46
46
  }
47
47
  },
48
48
  showPanel: function() {
49
- window.parent.postMessage('give me elements', '*');
49
+ window.parent.postMessage('give me elements', location.origin);
50
50
  },
51
51
  refreshPanel: function() {
52
52
  const uiContainer = this.lookup('uiContainer');
@@ -38,7 +38,7 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
38
38
  document.getElementById(event.source.frameElement.id).contentWindow :
39
39
  this.newPageRef;
40
40
  sender.autoload = vm.get('autoload');
41
- sender.postMessage(JSON.stringify(settings), '*');
41
+ sender.postMessage(JSON.stringify(settings), location.origin);
42
42
  }
43
43
  },
44
44
 
@@ -383,7 +383,7 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
383
383
  const isFrame = !vm.get('formEditorIsPage');
384
384
  const target = isFrame ? this.lookup('frame').getFrame().contentWindow : this.newPageRef;
385
385
  if (target) {
386
- target.postMessage(JSON.stringify(settings), '*');
386
+ target.postMessage(JSON.stringify(settings), location.origin);
387
387
  } else {
388
388
  this.openNewPage();
389
389
  }
@@ -394,7 +394,7 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
394
394
  const isFrame = !vm.get('formEditorIsPage');
395
395
  const target = isFrame ? this.lookup('frame').getFrame().contentWindow : this.newPageRef;
396
396
  if (target) {
397
- target.postMessage(JSON.stringify(msg), '*');
397
+ target.postMessage(JSON.stringify(msg), location.origin);
398
398
  }
399
399
  },
400
400
 
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.5.39',
3
+ number: '2.5.41',
4
4
  });