ru.coon 3.0.78 → 3.0.80

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,6 +1,23 @@
1
+ # Version 3.0.80, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3b43f1d4de9199df4725890955ab76c6e4491cdc)
2
+ * refactoring OpenPanelPlugin ([67cd0c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/67cd0c0b004f89f7fb3607497a43f960ae4f0735))
3
+ * update: CHANGELOG.md ([6e78bf], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6e78bf0dd1e0394557f2aba6b2fa56c1f022fc86))
4
+
5
+ # Version 3.0.79, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/05cc0396686f91876a09be0e05bed80d6e3591a8)
6
+ * ## Fixes
7
+ * <span style='color:red'> HT-13828 upd</span> ([54a357], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/54a357933afc6b44569625816ad724d56053c012))
8
+ * <span style='color:red'> HT-13828 upd</span> ([7f75df], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7f75df96aaa27d9563b63117c27e84fc01671624))
9
+ * <span style='color:red'> HT-13828 ReportFormData/getCSVReport</span> ([bb3a16], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bb3a1642daeb9ee52bdfb1726f3245b8669fd1a8))
10
+
11
+ * refactoring ([5f3f72], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5f3f72e58a8b60e83f60a682162e3a7a15ba4e4e))
12
+ * ([Update], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/Update file OpenPanelPlugin.jsa547ab1288c887b0c3c9405d86fc8f6afd7de2c3))
13
+ * upd ([85ffb7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/85ffb7997e465b3618f903f321b056fe87304126))
14
+ * upd ([0dca21], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0dca21517a5c8dfc0f607c6050c7e6191e2f5421))
15
+ * update: CHANGELOG.md ([8a9562], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8a9562a11c8d0b93f21c7a3f2954a45dcb381e7d))
16
+
1
17
  # Version 3.0.78, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a6e988a302441a8caed1ca77948890a3d01926d2)
2
18
  * ## Fixes
3
19
  * <span style='color:red'> Добавление недостающих стилей, при формировании заголовка таблицы. Closes HT-10579.</span> ([2a5f88], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2a5f88a201ed319f030164e13513458a09e0f2bf))
20
+ * <span style='color:red'> HT-13828 ReportFormData/getCSVReport</span> ([b10fd7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b10fd76a565c5393cca7fb91d77420ce253b80c3))
4
21
  * <span style='color:red'>fix HT-15169: TriggerFieldEditorCreator set window title</span> ([d55115], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d55115c1684ecc8ad9e9689fc1216c22100ac076))
5
22
  * <span style='color:red'>fix HT-15169: TriggerFieldEditorCreator set window title</span> ([3bc707], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3bc707c3aab9349482572c15e4f243a7ad97687d))
6
23
  * <span style='color:red'>fix HT-15169: CharacteristicGridEditor delete value</span> ([99e05a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/99e05a21822c48dce600109db56481baff030783))
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "3.0.78",
7
+ "version": "3.0.80",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -120,6 +120,32 @@ Ext.define('Coon.report.plugin.configPanel.ExportReportDataToFilePluginConfigPan
120
120
  displayField: 'name',
121
121
  valueField: 'id',
122
122
  name: 'exportFileFormat',
123
+ listeners: {
124
+ change: function(_, value) {
125
+ const isCsvOrTxtFormat = value === 'csv' || value === 'txt';
126
+ this.down('[name=charsetOption]').setHidden(!isCsvOrTxtFormat);
127
+ this.down('[name=exportWithHeaders]').setHidden(!isCsvOrTxtFormat);
128
+ },
129
+ scope: this,
130
+ },
131
+ },
132
+ {
133
+ xtype: 'radiogroup',
134
+ fieldLabel: 'Кодировка',
135
+ hidden: true,
136
+ simpleValue: true,
137
+ vertical: true,
138
+ name: 'charsetOption',
139
+ items: [
140
+ {boxLabel: 'UTF-8', inputValue: 'utf-8', checked: true},
141
+ {boxLabel: 'windows-1251', inputValue: 'windows-1251'}
142
+ ],
143
+ },
144
+ {
145
+ xtype: 'checkbox',
146
+ hidden: true,
147
+ boxLabel: 'exportWithHeaders',
148
+ name: 'exportWithHeaders',
123
149
  },
124
150
  {
125
151
  xtype: 'container',
@@ -13,6 +13,8 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
13
13
  allowUserSelectColumnsToUpload: undefined,
14
14
  addToSearchButton: false,
15
15
  countHours: 1,
16
+ charsetOption: 'utf-8',
17
+ exportWithHeaders: false,
16
18
  },
17
19
  exportConfig: {},
18
20
  defaultDateFormat: 'Y-m-d_h-i',
@@ -23,7 +25,6 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
23
25
  this.callParent(arguments);
24
26
  },
25
27
 
26
-
27
28
  createToolbarItem: function(config) {
28
29
  const tbItem = this.callParent([config]);
29
30
  tbItem.exportFileFormat = this.exportFileFormat;
@@ -34,6 +35,9 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
34
35
  this.callParent([grid]);
35
36
  this.grid = grid;
36
37
  const format = this.config.exportFileFormat;
38
+
39
+ this.setupCharsetConfig();
40
+
37
41
  this.buttonText = this.buttonText || (format && 'Экспорт в ' + format);
38
42
  grid.on('render', function() {
39
43
  this.report = grid.findParentByType('ReportPanel');
@@ -54,6 +58,15 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
54
58
  }, this);
55
59
  this.printPdfCommand = Ext.create('command.GetPdfReportDataCommand', {useRawFilterParams: this.getAddToSearchButton()});
56
60
  },
61
+
62
+ setupCharsetConfig() {
63
+ this.config.charsetOption = this.config.charsetOption || 'utf-8';
64
+
65
+ if (this.config.charsetOption.toLowerCase().startsWith('utf')) {
66
+ this.config.insertBOM = '\uFEFF';
67
+ }
68
+ },
69
+
57
70
  callExportByType() {
58
71
  switch (this.config.exportFileFormat) {
59
72
  case 'pdf':
@@ -70,6 +83,7 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
70
83
  break;
71
84
  }
72
85
  },
86
+
73
87
  handler: function() {
74
88
  if (this.config.allowUserSelectColumnsToUpload) {
75
89
  this.showPanel();
@@ -186,6 +200,7 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
186
200
  this.config.cmp.timeout :
187
201
  (this.getCountHours() * this.defaultTimeout);
188
202
  },
203
+
189
204
  printCsvFile: async function(extension) {
190
205
  this.grid.mask('подождите пожалуйста...');
191
206
  const currentParamList = this.getAddToSearchButton() ? this.report.northPanel.collectParams() : this.report.currentParamList;
@@ -208,17 +223,23 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
208
223
  toExcel: JSON.stringify(this.config.toExcel),
209
224
  separator: ';',
210
225
  border: '',
226
+ exportWithHeaders: JSON.stringify(this.config.exportWithHeaders),
227
+ charset: this.config.charsetOption,
211
228
  }, this.exportConfig);
212
229
  Ext.Ajax.request({
213
230
  url,
214
231
  method: 'POST',
215
232
  binary: true,
233
+ headers: {
234
+ 'Content-Type': `application/x-www-form-urlencoded;charset=${this.config.charsetOption}`,
235
+ },
216
236
  timeout: this.getTimeout(),
217
237
  params: params,
218
238
  success(response) {
239
+ const blobParts = this.config.insertBOM ? [this.config.insertBOM, response.responseBytes] : [response.responseBytes];
219
240
  this.grid.unmask();
220
241
  Coon.util.downloadFileFromBlob(
221
- new Blob(['\uFEFF', response.responseBytes], {type: 'text/csv;charset=utf-8'}),
242
+ new Blob(blobParts, {type: `text/csv;charset=${this.config.charsetOption}`}),
222
243
  `${this.fileName}.${extension}`
223
244
  );
224
245
  },
@@ -230,6 +251,7 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
230
251
  scope: this,
231
252
  });
232
253
  },
254
+
233
255
  printExcelFile: async function() {
234
256
  this.grid.mask('подождите пожалуйста...');
235
257
  const currentParamList = this.getAddToSearchButton() ? this.report.northPanel.collectParams() : this.report.currentParamList;
@@ -275,3 +297,4 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
275
297
  });
276
298
  },
277
299
  });
300
+
@@ -21,17 +21,37 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
21
21
  },
22
22
 
23
23
  init: function(view) {
24
- this.view = view;
25
- if (view.getController()) {
26
- this.getViewModel = () => view.getController().getViewModel();
27
- view.getController()[this.handlerName] = Ext.bind(this.handler, this);
24
+ if (!this.handlerName) {
25
+ Coon.log.error('OpenPanelPlugin.init: handlerName is required');
26
+ return;
27
+ }
28
+ if (!this.getCmp().getViewModel()) {
29
+ Coon.log.error('OpenPanelPlugin.init: viewModel is required');
30
+ return;
31
+ }
32
+ if (!this.config.uiElementCd) {
33
+ Coon.log.error('OpenPanelPlugin.init: uiElementCd is required');
34
+ return;
35
+ }
36
+ this.cmpController = view.getController();
37
+ if (this.cmpController) {
38
+ this.getViewModel = () => this.cmpController.getViewModel();
39
+ this.cmpController[this.handlerName] = Ext.bind(this.handler, this);
40
+ this.getCmp().onDestroy(function() {
41
+ this.cmpController[this.handlerName] = undefined;
42
+ }, this);
28
43
  }
29
44
  this.initBindable();
30
45
  },
31
46
 
32
47
  getFromModel: function(value) {
33
- if (Ext.isString(value) && value.startsWith('{')) {
34
- value = this.view.getViewModel().get(value.substring(1, value.length - 1));
48
+ if (
49
+ Ext.isString(value) &&
50
+ value.length > 2 &&
51
+ value.startsWith('{') &&
52
+ value.endsWith('}')
53
+ ) {
54
+ value = this.getCmp().getViewModel().get(value.substring(1, value.length - 1));
35
55
  }
36
56
  return value;
37
57
  },
@@ -44,16 +64,25 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
44
64
  if (this.uiElementCd) {
45
65
  this.uiElementCd = this.getFromModel(this.uiElementCd);
46
66
  const command = Ext.create('command.GetUIElementCommand');
67
+ command.on('failure', function(error) {
68
+ Coon.log.error(`OpenPanelPlugin.handler: failed to get UIElement [${this.uiElementCd}]`, error);
69
+ });
47
70
  command.on('complete', function(UIElementBean) {
48
71
  const elementNS = Coon.uielement.UIElementBeanFields;
49
72
  const exists = Ext.ClassManager.getByAlias('widget.' + UIElementBean[elementNS.$xtype]);
50
- if (exists === undefined) {
51
- Coon.log.log(UIElementBean[elementNS.$xtype] + ' does not exist');
73
+ if (!exists) {
74
+ Coon.log.log(UIElementBean.xtype + ' does not exist');
52
75
  return;
53
76
  }
54
77
  this.panelXType = UIElementBean[elementNS.$xtype];
55
- this.defaultProperties = JSON5.parse(UIElementBean['propertyData']);
56
- this.openPanel();
78
+ try {
79
+ this.openPanel(
80
+ JSON5.parse(UIElementBean['propertyData'])
81
+ );
82
+ } catch (ex) {
83
+ Coon.log.error('OpenPanelPlugin.handler: invalid propertyData JSON5', ex);
84
+ return;
85
+ }
57
86
  }, this);
58
87
  command.execute(this.uiElementCd);
59
88
  } else {
@@ -90,8 +119,8 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
90
119
  this.centerView.setActiveComponent({componentContextId});
91
120
  return;
92
121
  }
93
- console.log('OPP.panel', panel);
94
122
  this.centerView.setActiveComponent(panel);
123
+ this.addPanelEventListeners(panel);
95
124
  Coon.Function.executeComponentDoInit(panel, this.initArguments);
96
125
  panel.setClosable(true);
97
126
  panel.on('afterlayout', function(panel) {
@@ -129,17 +158,25 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
129
158
  Coon.Function.executeComponentDoInit(panel, this.initArguments);
130
159
  }, this);
131
160
 
132
- if (!Ext.isEmpty(this.panelEventListeners)) {
133
- for (const eventName in this.panelEventListeners) {
134
- if (this.panelEventListeners.hasOwnProperty(eventName)) {
135
- panel.on(eventName, this.view.getController()[this.panelEventListeners[eventName]], this.view);
136
- }
137
- }
138
- }
161
+ this.addPanelEventListeners(panel);
139
162
 
140
163
  openWindow.show();
141
164
  },
142
165
 
166
+ addPanelEventListeners(panel) {
167
+ if (!this.cmpController) {
168
+ return;
169
+ }
170
+ Object.entries(
171
+ this.panelEventListeners || {}
172
+ ).forEach(([eventName, handlerName]) => {
173
+ const handler = this.cmpController[handlerName];
174
+ if (typeof handler === 'function') {
175
+ panel.on(eventName, handler, this.getCmp());
176
+ }
177
+ });
178
+ },
179
+
143
180
  setInitArguments() {
144
181
  this.initArguments = {};
145
182
  for (const name in this.parameters) {
@@ -147,10 +184,13 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
147
184
  }
148
185
  },
149
186
 
150
- openPanel: function() {
151
- const defaultProperties = this.defaultProperties || {};
152
- const properties = Ext.apply(defaultProperties, this.properties);
187
+ openPanel: function(cmpProperties = {}) {
188
+ const properties = Ext.apply({}, cmpProperties, this.properties);
153
189
  this.panelXType = this.getFromModel(this.panelXType);
190
+ if (!Ext.ClassManager.getByAlias(`widget.${this.panelXType}`)) {
191
+ Coon.log.error(`OpenPanelPlugin.openPanel: panelXType [${this.panelXType}] does not exist`);
192
+ return;
193
+ }
154
194
  const panel = Ext.widget(this.panelXType, properties);
155
195
 
156
196
  this.setInitArguments();
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '3.0.78',
3
+ number: '3.0.80',
4
4
  });