ru.coon 3.0.42 → 3.0.44

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,13 @@
1
+ # Version 3.0.44, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/756720c821a0d995e730a59515674c414c9c3a14)
2
+ * HT-13021 feat: Рефакторинг SelectionModelPlugin ([431870], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/431870ce07d71eb0d366c1407e7c4a6cf11672e3))
3
+ * update: CHANGELOG.md ([bdfcd8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bdfcd820035ddda767868813dca5d0a1d1f5a87f))
4
+
5
+ # Version 3.0.43, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ed0d119336e1e590451052944f718cc75fecacee)
6
+ * ## Fixes
7
+ * <span style='color:red'> util.promisifyCmd - move getCommand in Promise</span> ([15cd69], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/15cd69c943724bc75905aa9df16ab02b1d4a564d))
8
+
9
+ * update: CHANGELOG.md ([22c545], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/22c5454a7bf27678f57cd0a5e2d49170b4d63a6d))
10
+
1
11
  # Version 3.0.42, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7859eef6bddbdc1445b1027d10a93f8e71dfe828)
2
12
  * ## Fixes
3
13
  * <span style='color:red'>fix MethodChainPlugin set sortableColumns false</span> ([5cb285], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5cb2859e29cc2b98172ea823d7198a92580af6d7))
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "3.0.42",
7
+ "version": "3.0.44",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -29,39 +29,105 @@ Ext.define('Coon.report.column.ThreeStateCheckColumn', {
29
29
  checkedItemCount: 0,
30
30
  totalItemCount: 0,
31
31
  massCheckChange: false,
32
- maskDisplayThreshold: 5000,
32
+ maskDisplayThreshold: 1000,
33
+ // Отслеживание количества нажатых чекбоксов на основании событий checkchange и headercheckchange
34
+ countOnCheck: true,
35
+
36
+ groupingCheckboxWidth: 50,
37
+ checkboxWidth: 40,
33
38
 
34
39
  constructor: function(cfg) {
40
+ this.wrapOriginalToggleAll();
41
+ this.callParent([cfg]);
42
+ this.subscribe();
43
+ },
44
+
45
+ wrapOriginalToggleAll() {
35
46
  this.toggleAllOriginal = this.toggleAll;
36
47
  this.toggleAll = this.toggleAllRewrite;
48
+ },
37
49
 
38
- this.callParent([cfg]);
39
-
50
+ subscribe() {
40
51
  // добавления класса на случай перезаписи cls при использовании xtype
41
52
  this.addCls('ThreeStateCheckColumn');
42
53
 
43
- this.on('afterrender', function() {
44
- this.getView().getStore().on('load', (store, items, success) => {
45
- if (!success) {
46
- return;
47
- }
48
- this.totalItemCount = items.length;
49
- this.checkedItemCount = store.getRange().filter((el) => el.get('checked')).length;
54
+ this.on('afterrender', this.onAfterRender, this);
55
+
56
+ this.on('headercheckchange', (component, checked) => {
57
+ this.loadMask && this.loadMask.destroy();
58
+ this.massCheckChange = false;
59
+ });
60
+ if (this.countOnCheck) {
61
+ this.on('headercheckchange', (component, checked) => {
62
+ this.checkedItemCount = checked ? this.totalItemCount : 0;
50
63
  this.updateHeaderStatus();
51
64
  });
52
- }, this);
65
+ this.on('checkchange', (component, rowIndex, checked) => {
66
+ if (this.checkOnSelect || this.defaultMode) {
67
+ const store = this.getView().getStore();
68
+ this.checkedItemCount = store.getRange().filter((el) => el.get('checked')).length;
69
+ } else {
70
+ this.checkedItemCount = checked ? this.checkedItemCount + 1 : this.checkedItemCount - 1;
71
+ }
72
+ this.updateHeaderStatus();
73
+ }, this);
74
+ } else {
75
+ this.on('added', function(column) {
76
+ column.getView().on('selectionchange', function(selModel, selected) {
77
+ this.checkedItemCount = selected.length;
78
+ this.updateHeaderStatus();
79
+ }, this);
80
+ }, this);
81
+ }
82
+ },
83
+
84
+ getGrid() {
85
+ if (!this.grid) {
86
+ this.grid = this.up('grid');
87
+ }
88
+ return this.grid;
89
+ },
53
90
 
54
- this.on('checkchange', (component, rowIndex, checked) => {
55
- this.checkedItemCount = checked ? this.checkedItemCount + 1 : this.checkedItemCount - 1;
91
+ onAfterRender() {
92
+ const store = this.getGrid().getStore();
93
+ this.totalItemCount = store.getCount();
94
+ store.on('load', (store, items, success) => {
95
+ if (!success) {
96
+ return;
97
+ }
98
+ this.totalItemCount = items.length;
99
+ this.checkedItemCount = store.getRange().filter((el) => el.get('checked')).length;
56
100
  this.updateHeaderStatus();
57
101
  });
58
-
59
- this.on('headercheckchange', (component, checked) => {
60
- this.checkedItemCount = checked ? this.totalItemCount : 0;
102
+ store.on('datachanged', (store) => {
103
+ (this.checkOnSelect || this.defaultMode) && (this.checkedItemCount = store.getRange().filter((el) => el.get('checked')).length);
104
+ this.totalItemCount = store.getCount();
61
105
  this.updateHeaderStatus();
106
+ });
107
+ store.on('filterchange', () => {
108
+ this.totalItemCount = store.getCount();
109
+ this.updateHeaderStatus();
110
+ });
62
111
 
63
- this.loadMask && this.loadMask.destroy();
64
- this.massCheckChange = false;
112
+ if (this.getGrid().features.find((feature) => feature.$className === 'Ext.grid.feature.Grouping')) {
113
+ this.groupingCheckboxSwitch();
114
+ }
115
+ },
116
+
117
+ groupingCheckboxSwitch() {
118
+ const checkcolumn = this.getGrid().getColumns()[0];
119
+
120
+ checkcolumn.setWidth(this.groupingCheckboxWidth);
121
+ this.getGrid().addCls('group-style-checkbox');
122
+
123
+ this.getGrid().on('groupchange', (store, grouper) => {
124
+ if (grouper) {
125
+ checkcolumn.setWidth(this.groupingCheckboxWidth);
126
+ this.getGrid().addCls('group-style-checkbox');
127
+ } else {
128
+ checkcolumn.setWidth(this.checkboxWidth);
129
+ this.getGrid().removeCls('group-style-checkbox');
130
+ }
65
131
  });
66
132
  },
67
133
 
@@ -69,10 +135,17 @@ Ext.define('Coon.report.column.ThreeStateCheckColumn', {
69
135
  * Обновление визуального статуса чекбокса заголовка в зависимости от кол-ва отмеченных записей
70
136
  */
71
137
  updateHeaderStatus() {
138
+ const component = this.up('grid, treepanel');
139
+ if (!component) {
140
+ return;
141
+ }
142
+ const selModel = component.getSelectionModel();
72
143
  if ((this.checkedItemCount === 0) || (this.checkedItemCount === this.totalItemCount)) {
73
144
  this.removeCls('indeterminate_check_box');
74
145
  } else {
75
- this.addCls('indeterminate_check_box');
146
+ if (selModel.getSelectionMode() === 'MULTI') {
147
+ this.addCls('indeterminate_check_box');
148
+ }
76
149
  }
77
150
  },
78
151
 
@@ -92,6 +165,7 @@ Ext.define('Coon.report.column.ThreeStateCheckColumn', {
92
165
  }
93
166
  this.massCheckChange = true;
94
167
  setTimeout(() => {
168
+ this.allChecked = (this.defaultMode && (this.checkedItemCount > 0)) ? true : this.allChecked;
95
169
  this.toggleAllOriginal(e);
96
170
  }, 0);
97
171
  },
@@ -138,6 +212,6 @@ Ext.define('Coon.report.column.ThreeStateCheckColumn', {
138
212
  * @returns {component}
139
213
  */
140
214
  getParentComponent() {
141
- return this.getView().up('ReportPanel') || this.getView().up('grid');
215
+ return this.getView().up('ReportPanel, grid, treepanel');
142
216
  },
143
217
  });
@@ -1,4 +1,11 @@
1
1
  .ThreeStateCheckColumn {
2
+ display: flex;
3
+ flex-direction: row;
4
+ justify-content: center;
5
+ .x-column-header-inner.x-leaf-column-header {
6
+ padding: 2px 0 8px !important;
7
+ width: 21px;
8
+ }
2
9
  &.indeterminate_check_box {
3
10
  .x-column-header-checkbox {
4
11
  &:after {
@@ -929,6 +929,17 @@ Ext.define('Coon.report.component.ReportPanel', {
929
929
  return plugins;
930
930
  },
931
931
 
932
+ checkPluginsFeaturesCompat(plugins, features) {
933
+ const selectionModelFeature = features.find((feature) => feature.ftype === 'SelectionModelFeature');
934
+ if (selectionModelFeature) {
935
+ const index = plugins.findIndex((item) => item.ptype === 'SelectionModelPlugin');
936
+ if (index !== -1) {
937
+ Coon.log.warn('Из-за наличия SelectionModelFeature отключен SelectionModelPlugin');
938
+ plugins.splice(index, 1);
939
+ }
940
+ }
941
+ },
942
+
932
943
  createGrid: function(reportBean) {
933
944
  const ns = Coon.report.model.ReportBeanFields;
934
945
  const gridPlugins = this.getPluginConfigByType(
@@ -937,14 +948,20 @@ Ext.define('Coon.report.component.ReportPanel', {
937
948
  reportBean[ns.$plugins]
938
949
  );
939
950
 
951
+ const features = this.getPluginConfigByType('GRID_FEATURE', 'f', reportBean[ns.$plugins]);
952
+
940
953
  const plugins = this.mixPlugins(gridPlugins, [
941
954
  {ptype: 'GridContextPlugin'},
942
955
  {ptype: 'GridContextMenu'},
943
956
  {ptype: 'gridexporter'},
944
957
  {ptype: 'AddFilterConditionPlugin'},
945
958
  {ptype: 'CalculatorPlugin'},
946
- {ptype: 'GridRowCountPlugin'}
959
+ {ptype: 'GridRowCountPlugin'},
960
+ {ptype: 'SelectionModelPlugin', defaultMode: true}
947
961
  ]);
962
+
963
+ this.checkPluginsFeaturesCompat(plugins, features);
964
+
948
965
  plugins.sort(this.raiseUpGroupButton);
949
966
 
950
967
  const gridConfig = {
@@ -955,7 +972,7 @@ Ext.define('Coon.report.component.ReportPanel', {
955
972
  sortable: true,
956
973
  },
957
974
  },
958
- features: this.getPluginConfigByType('GRID_FEATURE', 'f', reportBean[ns.$plugins]),
975
+ features,
959
976
  plugins,
960
977
  preventDblClick: this.preventDblClick,
961
978
  groupField: this.groupField,
@@ -1225,9 +1242,26 @@ Ext.define('Coon.report.component.ReportPanel', {
1225
1242
  return data;
1226
1243
  },
1227
1244
 
1228
- getSelection: function(firstSelectedOnly) {
1229
- const selectedRecords = this.grid.getSelection();
1230
- return selectedRecords && selectedRecords.length > 0 && firstSelectedOnly ? selectedRecords[0] : selectedRecords;
1245
+ // getSelection: function(firstSelectedOnly) {
1246
+ // const selectedRecords = this.grid.getSelection();
1247
+ // return selectedRecords && selectedRecords.length > 0 && firstSelectedOnly ? selectedRecords[0] : selectedRecords;
1248
+ // },
1249
+
1250
+ countSelectedRecords() {
1251
+ const grid = this.grid;
1252
+ if (!grid) {
1253
+ return;
1254
+ }
1255
+ // const selectionModelPlugin = grid.findPlugin('SelectionModelPlugin');
1256
+ // const selectionModelFeature = grid.getFeature('SelectionModelFeature');
1257
+ // if (selectionModelPlugin) {
1258
+ // return grid.getSelectionModel().getSelection().length;
1259
+ // } else if (selectionModelFeature) {
1260
+ // return grid.getSelectionModel().getSelection().length;
1261
+ // } else {
1262
+ // return grid.getSelectionModel().getSelection().length;
1263
+ // }
1264
+ return grid.getSelectionModel().getSelection().length;
1231
1265
  },
1232
1266
 
1233
1267
  registerApi(apiKey, api) {
@@ -114,4 +114,22 @@ Ext.define('Coon.report.component.reportpanel.ReportGrid', {
114
114
  this.getStore().removeAll(!this.rendered);
115
115
  }
116
116
  },
117
+
118
+ getCheckedRecords() {
119
+ if (this.getFeature('SelectionModelFeature')) {
120
+ return this.checkedRecords;
121
+ } else if (this.findPlugin('SelectionModelPlugin')?.defaultMode) {
122
+ // В этой конфигурации плагина реализована синхронизация выделения с чекбоксами.
123
+ return this.getSelectionModel().getSelection();
124
+ } else {
125
+ return this.checkedRecords;
126
+ }
127
+ },
128
+
129
+ getFeature(ftype) {
130
+ if (!ftype) {
131
+ return;
132
+ }
133
+ return this.features.find((feature) => feature.ftype === ftype);
134
+ },
117
135
  });
@@ -0,0 +1,38 @@
1
+ Ext.define('Coon.report.component.settings.common.PluginParameterTypeComboBox', {
2
+ extend: 'Coon.common.field.combo.BaseComboBox',
3
+ alias: 'widget.PluginParameterTypeComboBox',
4
+ data: undefined,
5
+ mode: 'local',
6
+ valueField: 'VALUE',
7
+ displayField: 'DESCRIPTION',
8
+ editable: false,
9
+ typeAhead: false,
10
+ triggerAction: 'all',
11
+ loadOnRender: false,
12
+
13
+ initComponent: function() {
14
+ this.listConfig = {
15
+ tpl: Ext.create('Ext.XTemplate',
16
+ '<ul class="x-list-plain">' +
17
+ '<tpl for=".">',
18
+ '<li role="option" data-qtip="{TOOLTIP}" class="x-boundlist-item">{' +
19
+ this.displayField + '}</li>',
20
+ '</tpl>' +
21
+ '</ul>'),
22
+ };
23
+ this.store = Ext.create('Ext.data.Store', {
24
+ fields: ['VALUE', 'DESCRIPTION', 'TYPE', 'TOOLTIP'],
25
+ data: [
26
+ ['ALLR', 'allRecords', 'MULTI', 'Все записи'],
27
+ ['CHCK', 'checkedRecords', 'MULTI', 'Записи, отмеченные чекбоксом'],
28
+ ['DFLT', 'default', 'CONSTANT', 'Константа'],
29
+ ['FLD', 'field', 'SINGLE', 'Поле из выбранной записи'],
30
+ ['MDFD', 'modifiedRecords', 'MULTI', 'Измененные записи'],
31
+ ['PRM', 'parameter', 'PARAMETER', 'Параметр отчета'],
32
+ ['RCRD', 'record', 'SINGLE', 'Текущая записись'],
33
+ ['SELR', 'selectedRecords', 'MULTI', 'Выбранные записи']
34
+ ],
35
+ });
36
+ this.callParent(arguments);
37
+ },
38
+ });
@@ -90,9 +90,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormContextParametersGri
90
90
  });
91
91
 
92
92
  this.typeEditor = Ext.create({
93
- xtype: 'lookupCombo',
94
- loadOnRender: false,
95
- lookupId: 'REPORT_NAV_OPT_CTXT_SRC_FLG',
93
+ xtype: 'PluginParameterTypeComboBox',
96
94
  allowBlank: false,
97
95
  });
98
96
 
@@ -141,6 +141,7 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanelControlle
141
141
 
142
142
  if (this.context && this.activePanel.setContext) {
143
143
  this.activePanel.setContext(this.context);
144
+ this.activePanel.getViewModel() && this.activePanel.getViewModel().set('context', this.context);
144
145
  }
145
146
 
146
147
  this.activePanel.on('updateContext', function(kv, oldValue) {
@@ -73,8 +73,16 @@ Ext.define('Coon.report.plugin.configPanel.GridToolbarButtonPluginConfigPanel',
73
73
  items: [
74
74
  {
75
75
  fieldLabel: 'Зависит от параметра отчета',
76
- xtype: 'textfield',
76
+ xtype: 'combo',
77
77
  name: 'dependOnGridParameters',
78
+ submitFormat: true,
79
+ queryMode: 'local',
80
+ displayField: 'descriptionFull',
81
+ valueField: 'reportParameterCd',
82
+ store: {
83
+ type: 'json',
84
+ data: [],
85
+ },
78
86
  },
79
87
  {
80
88
  xtype: 'container',
@@ -197,6 +205,27 @@ Ext.define('Coon.report.plugin.configPanel.GridToolbarButtonPluginConfigPanel',
197
205
  },
198
206
 
199
207
  controller: {
208
+ bindings: {
209
+ onContextChange: '{context}',
210
+ },
211
+
212
+ onContextChange(context) {
213
+ const dependOnGridParameters = this.view.down('[name=dependOnGridParameters]');
214
+ if (dependOnGridParameters) {
215
+ const data = JSON.parse(JSON.stringify(context.parameters));
216
+ data.map((item) => {
217
+ item.descriptionFull = `${item.reportParameterCd} (${item.description})`;
218
+ return item;
219
+ });
220
+ const store = dependOnGridParameters.getStore();
221
+ store.loadData(data);
222
+
223
+ // hack: to visually display value in the field
224
+ const values = dependOnGridParameters.getValue();
225
+ dependOnGridParameters.setValue(values);
226
+ }
227
+ },
228
+
200
229
  setHideMsgValue() {
201
230
  this.getViewModel().set('hideAddActionColumnMsg',
202
231
  this.lookup('actionColumnRef').collapsed ||
@@ -39,75 +39,97 @@ Ext.define('Coon.report.plugin.configPanel.SelectionModelPluginConfigPanel', {
39
39
  value: '{description}',
40
40
  },
41
41
  },
42
- {
43
- xtype: 'combo',
44
- fieldLabel: 'Режим',
45
- bind: {
46
- value: '{mode}',
47
- store: '{modes}',
48
- },
49
- },
50
42
  {
51
43
  xtype: 'checkbox',
52
- boxLabel: 'Возможность снять выделение записи по нажатию',
53
- tooltip: 'allowDeselect',
44
+ boxLabel: 'Режим по умолчанию',
54
45
  bind: {
55
- value: '{allowDeselect}',
46
+ value: '{defaultMode}',
56
47
  },
57
48
  },
58
49
  {
59
- xtype: 'checkbox',
60
- boxLabel: 'Переключить по нажатию (применимо только в режиме "SINGLE" и при allowDeselect: true)',
61
- tooltip: 'toggleOnClick',
62
- bind: {
63
- value: '{toggleOnClick}',
64
- hidden: '{mode !== "SINGLE" || !allowDeselect}',
65
- },
50
+ html: '<a href="https://confluence.sigma-it.ru" target="_blank">Описание режима по умолчанию.</a>',
66
51
  },
67
52
  {
68
- xtype: 'checkbox',
69
- boxLabel: 'Добавить колонку с чекбоксами',
53
+ xtype: 'container',
54
+ margin: '20 0 0 0',
70
55
  bind: {
71
- value: '{addCheckboxColumn}',
56
+ disabled: '{defaultMode}',
72
57
  },
73
- },
74
- {
75
- xtype: 'fieldcontainer',
76
- layout: 'anchor',
77
- scrollable: 'y',
78
- bind: {
79
- disabled: '{!addCheckboxColumn}',
58
+ layout: {
59
+ type: 'vbox', align: 'stretch',
80
60
  },
81
- defaults: {anchor: '100%', labelAlign: 'top'},
82
61
  items: [
83
62
  {
84
- xtype: 'checkbox',
85
- boxLabel: 'Выделять строку при выставлении чекбокса',
63
+ xtype: 'combo',
64
+ fieldLabel: 'Режим',
86
65
  bind: {
87
- value: '{selectOnCheck}',
66
+ value: '{mode}',
67
+ store: '{modes}',
88
68
  },
89
69
  },
90
70
  {
91
71
  xtype: 'checkbox',
92
- boxLabel: 'Отмечать чекбокс при выделении строки',
72
+ boxLabel: 'Возможность снять выделение записи по нажатию',
73
+ tooltip: 'allowDeselect',
93
74
  bind: {
94
- value: '{checkOnSelect}',
75
+ value: '{allowDeselect}',
95
76
  },
96
77
  },
97
78
  {
98
79
  xtype: 'checkbox',
99
- boxLabel: 'Включить фильтр в меню колонки',
80
+ boxLabel: 'Переключить по нажатию (применимо только в режиме "SINGLE" и при allowDeselect: true)',
81
+ tooltip: 'toggleOnClick',
100
82
  bind: {
101
- value: '{filterable}',
102
- disabled: '{menuDisabled}',
83
+ value: '{toggleOnClick}',
84
+ hidden: '{mode !== "SINGLE" || !allowDeselect}',
103
85
  },
104
86
  },
105
87
  {
106
88
  xtype: 'checkbox',
107
- boxLabel: 'Отключить меню колонки',
89
+ boxLabel: 'Добавить колонку с чекбоксами',
90
+ bind: {
91
+ value: '{addCheckboxColumn}',
92
+ },
93
+ },
94
+ {
95
+ xtype: 'fieldcontainer',
96
+ layout: 'anchor',
97
+ scrollable: 'y',
108
98
  bind: {
109
- value: '{menuDisabled}',
99
+ disabled: '{!addCheckboxColumn}',
110
100
  },
101
+ defaults: {anchor: '100%', labelAlign: 'top'},
102
+ items: [
103
+ {
104
+ xtype: 'checkbox',
105
+ boxLabel: 'Выделять строку при выставлении чекбокса',
106
+ bind: {
107
+ value: '{selectOnCheck}',
108
+ },
109
+ },
110
+ {
111
+ xtype: 'checkbox',
112
+ boxLabel: 'Отмечать чекбокс при выделении строки',
113
+ bind: {
114
+ value: '{checkOnSelect}',
115
+ },
116
+ },
117
+ {
118
+ xtype: 'checkbox',
119
+ boxLabel: 'Включить фильтр в меню колонки',
120
+ bind: {
121
+ value: '{filterable}',
122
+ disabled: '{menuDisabled}',
123
+ },
124
+ },
125
+ {
126
+ xtype: 'checkbox',
127
+ boxLabel: 'Отключить меню колонки',
128
+ bind: {
129
+ value: '{menuDisabled}',
130
+ },
131
+ }
132
+ ],
111
133
  }
112
134
  ],
113
135
  }
@@ -22,25 +22,21 @@ Ext.define('Coon.report.plugin.grid.FitColumnPlugin', {
22
22
  },
23
23
 
24
24
 
25
- handler: function() {
26
- if (this.component) {
27
- let width = 0;
28
- const columns = this.component.getColumnManager().getColumns();
29
- for (let i = 0; i < columns.length; i++) {
30
- const column = columns[i];
31
- if (column.isVisible()) {
32
- width += column.getWidth();
33
- }
34
- }
35
- const gridWidth = this.component.getWidth() - Ext.getScrollbarSize().width;
36
- for (let i = 0; i < columns.length; i++) {
37
- const column = columns[i];
38
- if (column.isVisible()) {
39
- column.setWidth(Math.floor(column.getWidth() * gridWidth / width));
40
- }
41
- }
42
- this.component.fireEvent('autosizecolumnscoplete');
25
+ handler() {
26
+ let width = 0;
27
+ const columns = this.component.getVisibleColumns().filter((column) => column.resizable);
28
+ const unresizableWidth = this.component.getVisibleColumns().filter((column) => !column.resizable).reduce((acc, column) => {
29
+ acc += column.getWidth();
30
+ return acc;
31
+ }, 0);
32
+ for (const column of columns) {
33
+ width += column.getWidth();
34
+ }
35
+ const gridWidth = this.component.getWidth() - Ext.getScrollbarSize().width - unresizableWidth;
36
+ for (const column of columns) {
37
+ column.setWidth(Math.floor(column.getWidth() * gridWidth / width));
43
38
  }
39
+ this.component.fireEvent('autosizecolumnscoplete');
44
40
  },
45
41
 
46
42
  customValidation: function(component) {
@@ -48,15 +44,15 @@ Ext.define('Coon.report.plugin.grid.FitColumnPlugin', {
48
44
  },
49
45
 
50
46
  customInit: function() {
51
- if (this.autoFit) {
52
- this.component.getStore().on('load', function() {
53
- if (this.component.rendered) {
54
- Ext.defer(this.handler, 1, this);
55
- } else {
56
- this.component.on('afterrender', this.handler, this);
57
- }
58
- }, this);
47
+ if (!this.autoFit) {
48
+ return;
59
49
  }
50
+ this.component.getStore().on('load', function() {
51
+ if (this.component.rendered) {
52
+ Ext.defer(this.handler, 1, this);
53
+ } else {
54
+ this.component.on('afterrender', this.handler, this);
55
+ }
56
+ }, this);
60
57
  },
61
58
  });
62
-