ru.coon 2.7.1 → 2.7.3

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/package.json +1 -1
  3. package/src/command/ASyncBaseCommand.js +4 -0
  4. package/src/common/component/editor/CharacteristicLoaderPlugin.js +12 -2
  5. package/src/common/field/combo/CommandComboBox.js +20 -0
  6. package/src/report/component/settings/ReportPropertiesGrid.js +22 -0
  7. package/src/report/component/settings/ReportPropertiesGridController.js +60 -1
  8. package/src/report/component/settings/context/ReportFormContextParametersGrid.js +73 -88
  9. package/src/report/plugin/configPanel/ExecuteCommandButtonPluginConfigPanel.js +92 -59
  10. package/src/report/plugin/grid/ExecuteCommandButtonPlugin.js +23 -8
  11. package/src/report/plugin/grid/ReportColumnStatePlugin.js +10 -7
  12. package/src/uielement/component/UiCustomController.js +6 -15
  13. package/src/uielement/component/settings/UiAceEditor.js +1 -1
  14. package/src/uielement/component/settings/UiAceEditorPanel.js +6 -1
  15. package/src/uielement/component/settings/plugin/UiCustomPanelPluginPanel.scss +19 -0
  16. package/src/uielement/plugin/ExecuteCommandPlugin.js +5 -3
  17. package/src/uielement/plugin/configPanel/executeCommand/DataMappingPanel.js +215 -0
  18. package/src/uielement/plugin/configPanel/executeCommand/ExecuteCommandPluginConfigPanelFormEditor.js +625 -0
  19. package/src/uielement/plugin/configPanel/executeCommand/ExecuteCommandPluginConfigPanelFormEditor.scss +22 -0
  20. package/src/util.js +4 -3
  21. package/src/version.js +1 -1
  22. package/src/uielement/plugin/configPanel/ExecuteCommandPluginConfigPanelFormEditor.js +0 -332
@@ -6,10 +6,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
6
6
  'Coon.report.model.ReportNavigationContextBeanFields',
7
7
  'Coon.report.model.ComboValueWrapperFields',
8
8
  'Coon.report.model.ComboValueWrapper',
9
- 'Coon.report.model.ReportParameterMaintenanceBeanFields',
10
- 'Coon.report.model.ReportFieldMaintenanceBeanFields',
11
9
  'Coon.report.model.ReportNavigationContextBean',
12
- 'Coon.report.store.ReportNavigationContextStore',
13
10
  'Coon.report.plugin.grid.GridStoreDependency',
14
11
  'Coon.report.store.RefStore'
15
12
  ],
@@ -79,7 +76,9 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
79
76
  }];
80
77
  }
81
78
 
82
- this.store = Ext.create('Coon.report.store.ReportNavigationContextStore');
79
+ this.store = new Ext.data.Store({
80
+ fields: Coon.report.model.ReportNavigationContextBeanFields,
81
+ });
83
82
 
84
83
  const numEditor = Ext.create('Ext.form.field.Number', {
85
84
  allowDecimals: false,
@@ -99,8 +98,8 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
99
98
 
100
99
  this.valueEditor = Ext.create('Coon.common.field.combo.BaseComboBox', {
101
100
  loadOnRender: false,
102
- displayField: Coon.report.model.ComboValueWrapperFields.$description,
103
- valueField: Coon.report.model.ComboValueWrapperFields.$value,
101
+ displayField: 'description',
102
+ valueField: 'value',
104
103
  store: Ext.create('Coon.report.store.RefStore'),
105
104
  allowBlank: false,
106
105
  });
@@ -109,14 +108,13 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
109
108
  allowBlank: false,
110
109
  });
111
110
 
112
- const ns = Coon.report.model.ReportNavigationContextBeanFields;
113
111
  this.columns = {
114
112
  items: [
115
- {required: true, text: '№ п/п', dataIndex: ns.$sortSequence, xtype: 'BigNumColumn', editor: numEditor, flex: .3},
113
+ {required: true, text: '№ п/п', dataIndex: 'sortSequence', xtype: 'BigNumColumn', editor: numEditor, flex: .3},
116
114
  {
117
115
  required: true,
118
116
  text: 'Параметр',
119
- dataIndex: ns.$reportParameter,
117
+ dataIndex: 'reportParameter',
120
118
  xtype: 'hintColumn',
121
119
  editor: paramEditor,
122
120
  },
@@ -124,7 +122,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
124
122
  required: true,
125
123
  text: 'Тип',
126
124
  minWidth: 150,
127
- dataIndex: ns.$reportNavigationOptionContextSource,
125
+ dataIndex: 'reportNavigationOptionContextSource',
128
126
  xtype: 'hintColumn',
129
127
  editor: this.typeEditor,
130
128
  renderer: Coon.format.comboRenderer(this.typeEditor),
@@ -132,44 +130,49 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
132
130
  },
133
131
  {
134
132
  text: 'Значение',
135
- tooltip: 'название поля таблицы отчета',
136
- dataIndex: ns.$reportNavigationOptionContextSourceValue,
133
+ tooltip: 'название поля таблицы отчета/название параметра отчета',
134
+ dataIndex: 'reportNavigationOptionContextSourceValue',
137
135
  xtype: 'hintColumn',
138
136
  width: 130,
139
137
  editor: this.valueEditor,
140
138
  renderer: Ext.bind(function(value, meta, record) {
141
- const type = record.get(ns.$reportNavigationOptionContextSource);
139
+ const type = record.get('reportNavigationOptionContextSource');
142
140
  let visibleValue;
143
- const fieldsNS = Coon.report.model.ComboValueWrapperFields;
144
- let pos;
141
+
142
+ let found;
145
143
  if (type === 'FLD') {
146
- pos = this.fieldsStore.findExact(fieldsNS.$value, value);
147
- if (pos !== -1) {
148
- visibleValue = this.fieldsStore.getAt(pos).get(fieldsNS.$description);
149
- }
144
+ found = this.fieldsStore.findRecord('value', value);
145
+ visibleValue = found && found.get('description');
150
146
  } else if (type === 'PRM') {
151
- pos = this.paramsStore.findExact(fieldsNS.$value, value);
152
- if (pos !== -1) {
153
- visibleValue = this.paramsStore.getAt(pos).get(fieldsNS.$description);
154
- }
147
+ found = this.paramsStore.findRecord('value', value);
148
+ visibleValue = found && found.get('description');
155
149
  } else if (type === 'SELR' || type === 'ALLR' || type === 'RCRD' || type === 'MDFD' || type === 'CHCK') {
156
- for (let i = 0; i < this.storeForSELR.length; i++) {
157
- if (this.storeForSELR[i].value === value) {
158
- visibleValue = this.storeForSELR[i].description;
159
- }
160
- }
150
+ found = this.storeForSELR.find((obj) => obj.value === value);
151
+ visibleValue = found && found.description;
161
152
  }
162
153
  return Coon.format.withHint(visibleValue);
163
154
  }, this),
164
155
  },
165
156
  {
166
157
  text: 'Значение по умолчанию',
167
- dataIndex: ns.$defaultValue,
158
+ dataIndex: 'defaultValue',
168
159
  xtype: 'hintColumn',
169
160
  editor: valueDefaultEditor,
170
161
  flex: .7,
171
162
  },
172
- {text: 'Обязательно', dataIndex: ns.$editable, xtype: 'checkcolumn', editable: true, flex: .35}
163
+ {
164
+ text: 'Обязательно',
165
+ dataIndex: 'editable',
166
+ xtype: 'checkcolumn',
167
+ editable: true,
168
+ flex: .35,
169
+ },
170
+ {
171
+ text: 'Описание',
172
+ tooltip: 'Описание параметра отчета',
173
+ dataIndex: 'description',
174
+ xtype: 'hintColumn',
175
+ }
173
176
  ],
174
177
  defaults: {
175
178
  sortable: true,
@@ -196,12 +199,12 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
196
199
  });
197
200
  } else {
198
201
  this.on('beforeedit', function(plugin, context) {
199
- if (context.field === ns.$sortSequence) {
202
+ if (context.field === 'sortSequence') {
200
203
  return context.record.get('isNew');
201
204
  }
202
205
 
203
- if (context.field === ns.$reportNavigationOptionContextSourceValue) {
204
- const type = context.record.get(ns.$reportNavigationOptionContextSource);
206
+ if (context.field === 'reportNavigationOptionContextSourceValue') {
207
+ const type = context.record.get('reportNavigationOptionContextSource');
205
208
  if (type === 'DFLT') {
206
209
  return false;
207
210
  } else {
@@ -212,9 +215,9 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
212
215
  }, this);
213
216
 
214
217
  this.on('edit', function(plugin, context) {
215
- if (context.field === ns.$reportNavigationOptionContextSource) {
216
- context.record.set(ns.$reportNavigationOptionContextSourceValue, null);
217
- context.record.set(ns.$defaultValue, null);
218
+ if (context.field === 'reportNavigationOptionContextSource') {
219
+ context.record.set('reportNavigationOptionContextSourceValue', null);
220
+ context.record.set('defaultValue', null);
218
221
  }
219
222
  return true;
220
223
  }, this);
@@ -223,15 +226,13 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
223
226
 
224
227
  this.fieldsStore = Ext.create('Coon.report.store.RefStore');
225
228
  this.paramsStore = Ext.create('Coon.report.store.ReportParameterStore');
226
- this.typeEditor.getStore().on('load', function() {
227
- if (!this.additionalContext || !Ext.isArray(this.additionalContext)) {
228
- return;
229
- }
230
- for (let i = 0; i < this.additionalContext.length; i++) {
231
- const record = this.additionalContext[i];
232
- if (this.typeEditor.getStore().find('value', record.get('value')) === -1) {
233
- this.typeEditor.getStore().add(record);
234
- }
229
+ this.typeEditor.getStore().on('load', function(store, records) {
230
+ if (Ext.isArray(this.additionalContext) && records.length) {
231
+ this.additionalContext.forEach((record) => {
232
+ if (record && record.isModel && record.get('value') && store.find('VALUE', record.get('value')) === -1) {
233
+ store.add(record);
234
+ }
235
+ });
235
236
  }
236
237
  }, this);
237
238
  },
@@ -302,13 +303,12 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
302
303
  },
303
304
 
304
305
  getData: function() {
305
- const records = this.getStore().getRange();
306
306
  const recordsToSave = [];
307
- for (let i = 0; i < records.length; i++) {
308
- if (!records[i].get('isDeleted')) {
309
- recordsToSave.push(records[i]);
307
+ this.store.each((record) => {
308
+ if (!record.get('isDeleted')) {
309
+ recordsToSave.push(record);
310
310
  }
311
- }
311
+ });
312
312
  return Coon.Function.serializeRecords(recordsToSave);
313
313
  },
314
314
 
@@ -345,32 +345,18 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
345
345
  },
346
346
 
347
347
  changeFieldsList: function(fields) {
348
- const ns = Coon.report.model.ComboValueWrapperFields;
349
- const cvList = [];
350
-
351
- const fieldNs = Coon.report.model.ReportFieldMaintenanceBeanFields;
352
- for (let i = 0; i < fields.length; i++) {
353
- const field = fields[i];
354
- const obj = {};
355
- obj[ns.$value] = field[fieldNs.$reportField];
356
- obj[ns.$description] = field[fieldNs.$description];
357
- cvList.push(obj);
358
- }
348
+ const cvList = fields.map((field) => ({
349
+ value: field['reportFieldCd'],
350
+ description: field['description'],
351
+ }));
359
352
  this.fieldsStore.loadData(cvList);
360
353
  },
361
354
 
362
355
  changeParametersList: function(parameters) {
363
- const ns = Coon.report.model.ComboValueWrapperFields;
364
- const cvList = [];
365
-
366
- const paramNs = Coon.report.model.ReportParameterMaintenanceBeanFields;
367
- for (let i = 0; i < parameters.length; i++) {
368
- const param = parameters[i];
369
- const obj = {};
370
- obj[ns.$value] = param[paramNs.$reportParameter];
371
- obj[ns.$description] = param[paramNs.$description];
372
- cvList.push(obj);
373
- }
356
+ const cvList = parameters.map((param) => ({
357
+ value: param['reportParameterCd'],
358
+ description: param['description'],
359
+ }));
374
360
  this.paramsStore.loadData(cvList);
375
361
  },
376
362
 
@@ -401,12 +387,10 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
401
387
  return;
402
388
  }
403
389
 
404
- const record = Ext.create('Coon.report.model.ReportNavigationContextBean', {
390
+ this.getStore().insert(0, {
405
391
  isNew: true,
406
392
  reportNavigationOptionContextSource: 'DFLT',
407
393
  });
408
- // record.markDirty();
409
- this.getStore().insert(0, record);
410
394
 
411
395
  const editor = this.findPlugin('cellediting');
412
396
  editor.startEditByPosition({row: 0, column: 0});
@@ -463,6 +447,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
463
447
  default:
464
448
  break;
465
449
  }
450
+
466
451
  this.loadData(parameters);
467
452
  }
468
453
  }
@@ -472,37 +457,37 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
472
457
  parameters = parameters || [];
473
458
  nameField = nameField || 'name';
474
459
  isRequiredField = isRequiredField || 'required';
475
- const dataForLoad = [];
460
+
461
+ let dataForLoad = [];
476
462
  if (this.loadParametersSource.field.getValue() !== this.lastSource) {
477
463
  this.lastSource = this.loadParametersSource.field.getValue();
478
- for (let i = 0; i < parameters.length; i++) {
479
- dataForLoad.push(this.getDataForRecord(i, parameters[i][nameField], parameters[i][isRequiredField]));
480
- }
464
+ dataForLoad = parameters.map(function(parameter, i) {
465
+ return this.getDataForRecord(i, parameter[nameField], parameter[isRequiredField], parameter['description']);
466
+ }, this);
481
467
  this.load(dataForLoad);
482
468
  } else {
483
- for (let i = 0; i < parameters.length; i++) {
484
- if (this.getStore().findExact('reportParameter', parameters[i][nameField]) === -1) {
485
- const record = Ext.create('Coon.report.model.ReportNavigationContextBean',
486
- this.getDataForRecord(i, parameters[i][nameField], parameters[i][isRequiredField]));
487
- dataForLoad.push(record);
469
+ parameters.forEach(function(parameter, i) {
470
+ if (!this.getStore().findRecord('reportParameter', parameter[nameField])) {
471
+ dataForLoad.push(this.getDataForRecord(i, parameter[nameField], parameter[isRequiredField], parameter['description']));
488
472
  }
489
- }
473
+ }, this);
490
474
  if (dataForLoad.length > 0) {
491
- this.getStore().insert(this.getStore().getCount(), dataForLoad);
475
+ this.getStore().add(dataForLoad);
492
476
  }
493
477
  }
494
478
  },
495
479
 
496
- getDataForRecord: function(i, value, editable) {
480
+ getDataForRecord: function(i, value, editable, description) {
497
481
  return {
498
482
  sortSequence: i,
499
483
  reportParameter: value,
500
484
  isNew: true,
501
485
  editable: editable || false,
486
+ description: description,
502
487
  };
503
488
  },
504
489
  deleteHandler: function() {
505
- const record = this.getSelectionModel().getSelection()[0];
490
+ const record = this.getSelection()[0];
506
491
  if (record) {
507
492
  this.deleteAction(record);
508
493
  }
@@ -86,16 +86,18 @@ Ext.define('Coon.report.plugin.configPanel.ExecuteCommandButtonPluginConfigPanel
86
86
 
87
87
  createItems: function() {
88
88
  this.commandCombo = this.createCommandPicker();
89
+ this.commandCombo.on('change', function(field, newValue) {
90
+ newValue && this.southRegion.setTitle(`Настройки команды ${newValue}`);
91
+ }, this);
89
92
 
90
93
  this.completeHandler = Ext.create({
91
94
  xtype: 'UiAceEditorPanel',
92
- margin: '8 0',
95
+ margin: 8,
93
96
  frame: true,
94
97
  hideSearchPanel: true,
95
98
  height: 300,
96
99
  text: `
97
- completeHandler(запускается после успешного выполнения команды)<br />
98
- получает в качестве аргумента data - результат,возвращенный бэкендом
100
+ completeHandler(запускается после успешного выполнения команды) получает в качестве аргумента data - результат,возвращенный бэкендом
99
101
  `,
100
102
  name: 'completeHandler',
101
103
  });
@@ -107,55 +109,55 @@ Ext.define('Coon.report.plugin.configPanel.ExecuteCommandButtonPluginConfigPanel
107
109
  text: 'вставить отладочную функцию для анализа response',
108
110
  handler(btn) {
109
111
  const fn = `
110
- console.table(response);
111
- const getRows = (data, stopRecursion) => Object.entries(data).map(([k, v]) => {
112
- if (Ext.isObject) {
113
- try {
114
- v = JSON.stringify(v)
115
- } catch (e) {
116
- v = stopRecursion ?
117
- typeof(v) + ' : ' + v.toString() :
118
- getRows(v, 'final').map(({name, value}) => name + ':' + value).join(', ')
119
- }
120
- } else {
121
- v = typeof(v) + ' : ' + v.toString()
122
- }
123
- return {
124
- name: k,
125
- value: v
126
- }
127
- })
128
- const win = Ext.widget('WindowWrap', {
129
- title: 'содержимое переменной response',
130
- width: 800,
131
- height: 600,
132
- items: [
133
- {
134
- xtype: 'grid',
135
- store: {
136
- fields: ['name', 'value']
137
- },
138
- columns: [
139
- {dataIndex: 'name', text: 'свойство', width: 200},
140
- {dataIndex: 'value', text: 'значение', flex: 1},
112
+ console.table(response);
113
+ const getRows = (data, stopRecursion) => Object.entries(data).map(([k, v]) => {
114
+ if (Ext.isObject) {
115
+ try {
116
+ v = JSON.stringify(v)
117
+ } catch (e) {
118
+ v = stopRecursion ?
119
+ typeof(v) + ' : ' + v.toString() :
120
+ getRows(v, 'final').map(({name, value}) => name + ':' + value).join(', ')
121
+ }
122
+ } else {
123
+ v = typeof(v) + ' : ' + v.toString()
124
+ }
125
+ return {
126
+ name: k,
127
+ value: v
128
+ }
129
+ })
130
+ const win = Ext.widget('WindowWrap', {
131
+ title: 'содержимое переменной response',
132
+ width: 800,
133
+ height: 600,
134
+ items: [
135
+ {
136
+ xtype: 'grid',
137
+ store: {
138
+ fields: ['name', 'value']
139
+ },
140
+ columns: [
141
+ {dataIndex: 'name', text: 'свойство', width: 200},
142
+ {dataIndex: 'value', text: 'значение', flex: 1},
143
+ ]
144
+ }
141
145
  ]
142
- }
143
- ]
144
- })
145
- win.show()
146
- win.down('grid').store.loadData(getRows(response))`;
146
+ })
147
+ win.show()
148
+ win.down('grid').store.loadData(getRows(response))`;
147
149
  btn.up('UiAceEditorPanel').links.editor.setValue(fn);
148
150
  },
149
151
  }
150
152
  ],
151
- margin: '8 0',
153
+ margin: 8,
152
154
  frame: true,
153
155
  hideSearchPanel: true,
154
156
  height: 300,
155
157
  text: `
156
- errorHandler(обработка ошибки возлагается на эту функцию,<br /> окно ошибки приложения не будет запущено!)<br />
157
- параметры функции: response
158
- `,
158
+ errorHandler(обработка ошибки возлагается на эту функцию,<br /> окно ошибки приложения не будет запущено!)<br />
159
+ параметры функции: response
160
+ `,
159
161
  name: 'errorHandler',
160
162
  });
161
163
 
@@ -182,9 +184,14 @@ win.down('grid').store.loadData(getRows(response))`;
182
184
  flex: 1,
183
185
  title: 'Свойства команды',
184
186
  autoExpandColumn: 2,
187
+ loadPropertiesSource: {
188
+ field: this.commandCombo,
189
+ type: this.commandCombo.commandType,
190
+ },
185
191
  });
186
192
 
187
193
  this.tabs = Ext.create('Ext.tab.Panel', {
194
+ flex: 1,
188
195
  activeTab: 0,
189
196
  items: [
190
197
  {
@@ -199,17 +206,52 @@ win.down('grid').store.loadData(getRows(response))`;
199
206
  this.fieldConfigGrid
200
207
  ],
201
208
  },
202
- this.propertiesGrid
209
+ this.propertiesGrid,
210
+ {
211
+ title: 'complete handler',
212
+ scrollable: true,
213
+ layout: 'fit',
214
+ items: [
215
+ this.completeHandler
216
+ ],
217
+ },
218
+ {
219
+ title: 'error handler',
220
+ scrollable: true,
221
+ layout: 'fit',
222
+ items: [
223
+ this.errorHandler
224
+ ],
225
+ }
226
+ ],
227
+ });
228
+ this.southRegion = Ext.create('Ext.panel.Panel', {
229
+ title: 'Настройки команды',
230
+ flex: 0.5,
231
+ minHeight: 300,
232
+ layout: {
233
+ type: 'vbox',
234
+ align: 'stretch',
235
+ },
236
+ items: [
237
+ this.commandCombo,
238
+ this.tabs
203
239
  ],
204
240
  });
205
241
  return [
206
242
  {
207
243
  xtype: 'panel',
208
- layout: 'border',
244
+ layout: {
245
+ type: 'vbox', align: 'stretch',
246
+ },
209
247
  flex: 1,
248
+ defaults: {
249
+ collapsible: true,
250
+ },
210
251
  items: [
211
252
  {
212
- region: 'center',
253
+ title: 'Параметры плагина',
254
+ flex: 1,
213
255
  autoScroll: true,
214
256
  layout: 'form',
215
257
  defaults: {
@@ -227,7 +269,6 @@ win.down('grid').store.loadData(getRows(response))`;
227
269
  this.createHotKeyPanel(),
228
270
  this.createVisibilityKeyPanel(),
229
271
  this.isCreatedButtonHidden(),
230
- this.commandCombo,
231
272
  this.createConfirmFieldSet(),
232
273
  this.createSuccessFieldSet(),
233
274
  {
@@ -280,9 +321,9 @@ win.down('grid').store.loadData(getRows(response))`;
280
321
  boxLabel: 'useSimpleEngine',
281
322
  boxLabelAlign: 'after',
282
323
  name: 'useSimpleEngine',
283
- },
284
- this.completeHandler,
285
- this.errorHandler
324
+ }
325
+ // this.completeHandler,
326
+ // this.errorHandler
286
327
  ],
287
328
  defaults: {
288
329
  labelWidth: 130,
@@ -291,15 +332,7 @@ win.down('grid').store.loadData(getRows(response))`;
291
332
  }
292
333
  ],
293
334
  },
294
- {
295
- region: 'south',
296
- split: true,
297
- height: 200,
298
- layout: 'fit',
299
- items: [
300
- this.tabs
301
- ],
302
- }
335
+ this.southRegion
303
336
  ],
304
337
  }
305
338
  ];
@@ -69,24 +69,39 @@ Ext.define('Coon.report.plugin.grid.ExecuteCommandButtonPlugin', {
69
69
 
70
70
  try {
71
71
  const command = Ext.create('command.' + this.ctype, propertyForCommand);
72
- if (this.getErrorHandler()) {
72
+
73
+ if (typeof this.completeHandler === 'string' && this.completeHandler) {
74
+ const completeHandler = new Function('data', `
75
+ try {
76
+ ${this.completeHandler}
77
+ } catch (ex) {
78
+ Coon.log.error('completeHandler', ex);
79
+ }
80
+ `);
81
+ this.completeHandler = completeHandler.bind(this.component);
82
+ }
83
+
84
+ if (typeof this.errorHandler === 'string' && this.errorHandler) {
73
85
  const errorHandler = new Function('response', `
74
86
  try {
75
- ${this.getErrorHandler()}
87
+ ${this.errorHandler}
76
88
  } catch (ex) {
77
- Coon.log.error(ex)
89
+ Coon.log.error('errorHandler', ex);
78
90
  }
79
91
  `);
80
- command.processError = errorHandler.bind(this.component);
81
- Coon.log.debug('command.processError', command.processError);
92
+ this.errorHandler = errorHandler.bind(this.component);
82
93
  }
94
+
83
95
  command.additionalParameterEventToClose = 'postCompleted';
84
96
  if (command.execute) {
85
97
  if (Ext.isFunction(command.on)) {
98
+ command.on('failure', function(data) {
99
+ Ext.isFunction(this.errorHandler) && this.errorHandler(data);
100
+ }, this);
101
+
86
102
  command.on('complete', function(data) {
87
- if (this.completeHandler && Ext.isFunction(this.completeHandler)) {
88
- this.completeHandler(data);
89
- }
103
+ Ext.isFunction(this.completeHandler) && this.completeHandler(data);
104
+
90
105
  if (this.reloadAfterComplete) {
91
106
  this.component.fireEvent('needReload', this.reloadAfterComplete);
92
107
  }
@@ -44,7 +44,7 @@ Ext.define('Coon.report.plugin.grid.ReportColumnStatePlugin', {
44
44
  }
45
45
  }
46
46
  },
47
- columnInteractionHandler(_, col) {
47
+ columnInteractionHandler() {
48
48
  const currentState = [];
49
49
  const columns = this.grid.getColumns();
50
50
  columns.forEach((e) => {
@@ -82,12 +82,15 @@ Ext.define('Coon.report.plugin.grid.ReportColumnStatePlugin', {
82
82
  const stateMap = new Map();
83
83
  currentReportState.forEach((e) => stateMap.set(e.columnId, e));
84
84
 
85
- columns.forEach((currentColumn, i) => {
86
- const currentColumnState = stateMap.get(currentColumn.dataIndex);
87
- if (currentColumnState) {
88
- currentColumn.setHidden(currentColumnState.hidden);
89
- currentColumn.setWidth(currentColumnState.width ? currentColumnState.width : 100);
90
- columnHeader.moveBefore(currentColumn, columnHeader.getComponent(currentColumnState.position));
85
+ columns.forEach((column, i) => {
86
+ if (column.hidden) {
87
+ return;
88
+ }
89
+ const state = stateMap.get(column.dataIndex);
90
+ if (state) {
91
+ column.setHidden(state.hidden);
92
+ column.setWidth(state.width ? state.width : 100);
93
+ columnHeader.moveBefore(column, columnHeader.getComponent(state.position));
91
94
  }
92
95
  });
93
96
  }