ru.coon 3.0.27 → 3.0.29

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,16 @@
1
+ # Version 3.0.29, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b6a41718051c6d94703539202ec2f58d6c5382da)
2
+ * upd ([adee34], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/adee34983691322c146d3a60d2f1a64f674ae72a))
3
+ * update: CHANGELOG.md ([b35442], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b35442505415f72a6602ff3d8939d7ece509252a))
4
+
5
+ # Version 3.0.28, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/768d77a310f5e22d445d6b61c8847a5cbb6223f0)
6
+ * ## Fixes
7
+ * <span style='color:red'>fix promisifyCmd</span> ([c98165], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c98165c423a5236f7c8806118729aee836acf2d5))
8
+ * <span style='color:red'> change third state checkbox column state icon</span> ([9ef718], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9ef718914ab1805fd438a3eb1a8af44429e36ba2))
9
+
10
+ * HT-13285 доработка файла excel на вкладке "Расчет объема" ([a15f0b], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a15f0b6ec6c88cb4b002965f2e8101f28e6c3445))
11
+ * sync ([e92865], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e9286538cc8c9138ecf723126e0cf93d5688730d))
12
+ * update: CHANGELOG.md ([cbdfb1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cbdfb1c2a19add33132466102fb4d91989a5f07c))
13
+
1
14
  # Version 3.0.27, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a403b7cf0d4817c3635a0ddbb66e8b76dbcf5e90)
2
15
  * ## Features
3
16
  * <span style='color:green'>feat: add new Checkbox extanded class</span> ([e5f596], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e5f59621281256e829d43255c67c972d88b62564))
@@ -7,9 +20,11 @@
7
20
  * <span style='color:red'>fix ExportReportDataToFilePlugin</span> ([6a57ae], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6a57aed40578f772fb0ccee045f0ef7faad732e3))
8
21
  * <span style='color:red'> refactoring</span> ([0994e5], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0994e5c35ddff9da568194ab8662d45d8b9d0b07))
9
22
 
23
+ * upd ([203202], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/203202334ca544d119ccac5e1ea97e5946aad53a))
10
24
  * refactoring ([5d5fec], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5d5fec88ed2803b3dabab726d1821c128c28ad92))
11
25
  * refactoring ([c8320a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c8320a03c3f4c26d5a8fab4d22390e347e8c9ba4))
12
26
  * HT-13143 feat: Исправление вычисления ширины и отступов системной части тулбара ([8ce65e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8ce65e1a1f5c898b88b3110a649b41a76da41004))
27
+ * sync ([e32f95], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e32f951490389d02e7b7e9cde69c78c5ad92a005))
13
28
  * update: CHANGELOG.md ([242158], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/24215801553180b4721c1605f482da9d2821c365))
14
29
 
15
30
  # Version 3.0.26, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a0df7c2d955b5d5d24ba68a0fe0a97375acc5ee3)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "3.0.27",
7
+ "version": "3.0.29",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -27,34 +27,39 @@ Ext.define('Coon.app.viewPort.CVWrapperPanel', {
27
27
  return header && header.getTitle();
28
28
  },
29
29
 
30
+ processFavoriteControl(component) {
31
+ component.on('afterrender', function() {
32
+ const title = this.getComponentTitle();
33
+ if (title && title.iconEl) {
34
+ if (typeof title.title === 'string') {
35
+ component.setTitle(title.title);
36
+ }
37
+ const props = Coon.nav.menu.FavoriteCfg.get().favorite || [];
38
+ const index = props.indexOf(this.menuItem.MENU_ENTRY_CD);
39
+ if (index >= 0) {
40
+ title.iconEl.dom.classList.add('is-favorite-item');
41
+ }
42
+ Ext.on('nav:favoriteitemschange', this.changeFavorite, this);
43
+ }
44
+ }, this, {single: true});
45
+
46
+ component.on('beforedestroy', function() {
47
+ Ext.un('nav:favoriteitemschange', this.changeFavorite, this);
48
+ }, this);
49
+ this.on('activate', function(...args) {
50
+ Ext.fireEvent('nav:menuitemchange', this.menuItem);
51
+ component.fireEvent('activatecomponent', ...args);
52
+ });
53
+ },
54
+
30
55
  initComponent(...args) {
31
56
  this.callParent(...args);
32
57
  const component = this.getComponent(0);
33
- if (this.menuItem) {
34
- component.on('afterrender', function() {
35
- const title = this.getComponentTitle();
36
- if (title && title.iconEl) {
37
- if (typeof title.title === 'string') {
38
- component.setTitle(title.title);
39
- }
40
- const props = Coon.nav.menu.FavoriteCfg.get().favorite || [];
41
- const index = props.indexOf(this.menuItem.MENU_ENTRY_CD);
42
- if (index >= 0) {
43
- title.iconEl.dom.classList.add('is-favorite-item');
44
- }
45
- Ext.on('nav:favoriteitemschange', this.changeFavorite, this);
46
- }
47
- }, this, {single: true});
48
-
49
- component.on('beforedestroy', function() {
50
- Ext.un('nav:favoriteitemschange', this.changeFavorite, this);
51
- }, this);
58
+ if (!component) {
59
+ return;
52
60
  }
53
- if (component) {
54
- this.on('activate', function(...args) {
55
- this.menuItem && Ext.fireEvent('nav:menuitemchange', this.menuItem);
56
- component.fireEvent('activatecomponent', ...args);
57
- });
61
+ if (this.menuItem) {
62
+ this.processFavoriteControl(component);
58
63
  }
59
64
  },
60
65
  });
@@ -13,7 +13,6 @@ Ext.define('Coon.app.viewPort.CenterView', {
13
13
  },
14
14
 
15
15
  plugins: [
16
- // 'tabscrollermenu',
17
16
  {
18
17
  ptype: 'tabreorderer',
19
18
  animate: false,
@@ -126,8 +125,20 @@ Ext.define('Coon.app.viewPort.CenterView', {
126
125
  if (previousView) {
127
126
  component.prevComponentContextId = previousView.componentContextId;
128
127
  }
128
+
129
129
  this.add(component);
130
130
 
131
+ component.on('titlechange', function(title) {
132
+ if (typeof title !== 'string') {
133
+ if (typeof title.getTitle !== 'function') {
134
+ return;
135
+ }
136
+ title = title.getTitle();
137
+ }
138
+ const tab = component.tab;
139
+ tab.setText(title);
140
+ tab.setTooltip(title);
141
+ });
131
142
  component.on('destroy', function() {
132
143
  const activeTab = this.getActiveTab();
133
144
  if (!activeTab || !activeTab.menuItem) {
@@ -160,7 +160,6 @@ Ext.define('Coon.common.ComponentFactory', {
160
160
  iconCls: menuItem.MENU_ENTRY_ICON,
161
161
  },
162
162
  items: [config],
163
- // title: menuItem.MENU_ENTRY_DESCR,
164
163
  };
165
164
  const instance = Ext.create(instanceConfig);
166
165
  return instance;
@@ -221,5 +221,4 @@ Ext.define('Coon.common.panel.WindowWrap', {
221
221
  const url = this.items.get(0).viewModel.data.href;
222
222
  window.open(url);
223
223
  },
224
-
225
224
  });
@@ -24,7 +24,7 @@ Ext.define('Coon.report.column.BigNumColumn', {
24
24
  * @returns {string|null}
25
25
  */
26
26
  renderer: function(v, cellValues) {
27
- const column = cellValues.column;
27
+ const column = cellValues && cellValues.column;
28
28
 
29
29
  let me;
30
30
 
@@ -41,7 +41,10 @@ Ext.define('Coon.report.column.ThreeStateCheckColumn', {
41
41
  this.addCls('ThreeStateCheckColumn');
42
42
 
43
43
  this.on('afterrender', function() {
44
- this.getView().getStore().on('load', (store, items) => {
44
+ this.getView().getStore().on('load', (store, items, success) => {
45
+ if (!success) {
46
+ return;
47
+ }
45
48
  this.totalItemCount = items.length;
46
49
  this.checkedItemCount = store.getRange().filter((el) => el.get('checked')).length;
47
50
  this.updateHeaderStatus();
@@ -3,15 +3,15 @@
3
3
  .x-column-header-checkbox {
4
4
  &:after {
5
5
  content: 'indeterminate_check_box';
6
- mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgcng9IjEuNSIgc3Ryb2tlPSIjMTExMTExIi8+CjxwYXRoIGQ9Ik01IDdIOSIgc3Ryb2tlPSIjMTExMTExIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K");
7
- -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgcng9IjEuNSIgc3Ryb2tlPSIjMTExMTExIi8+CjxwYXRoIGQ9Ik01IDdIOSIgc3Ryb2tlPSIjMTExMTExIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K");
6
+ mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG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zAuMDY3MDAzNCAxNS44IC0xLjUgMTQuMjMzIC0xLjUgMTIuM0wxLjUgMTJDMS41IDEyLjExMDUgMS43MjM4NiAxMi4yIDIgMTIuMkgxMkMxMi4yNzYxIDEyLjIgMTIuNSAxMi4xMTA1IDEyLjUgMTJMMTUuNSAxMi4zWk0yIDE1LjhDMC4wNjcwMDM0IDE1LjggLTEuNSAxNC4yMzMgLTEuNSAxMi4zVjEuN0MtMS41IC0wLjIzMjk5NyAwLjA2NzAwMzQgLTEuOCAyIC0xLjhWMS44QzEuNzIzODYgMS44IDEuNSAxLjg4OTU0IDEuNSAyVjEyQzEuNSAxMi4xMTA1IDEuNzIzODYgMTIuMiAyIDEyLjJWMTUuOFpNMTIgLTEuOEMxMy45MzMgLTEuOCAxNS41IC0wLjIzMjk5NyAxNS41IDEuN1YxMi4zQzE1LjUgMTQuMjMzIDEzLjkzMyAxNS44IDEyIDE1LjhWMTIuMkMxMi4yNzYxIDEyLjIgMTIuNSAxMi4xMTA1IDEyLjUgMTJWMkMxMi41IDEuODg5NTQgMTIuMjc2MSAxLjggMTIgMS44Vi0xLjhaIiBmaWxsPSIjMTExMTExIiBtYXNrPSJ1cmwoI3BhdGgtMS1pbnNpZGUtMV8yMzM4XzExNDQwMSkiLz4KPHBhdGggZD0iTTQuNSA3SDkuNSIgc3Ryb2tlPSIjMTExMTExIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K");
8
8
  mask-size: 80%;
9
9
  -webkit-mask-size: 80%;
10
10
  mask-repeat: no-repeat;
11
11
  -webkit-mask-repeat: no-repeat;
12
12
  mask-position: center;
13
13
  -webkit-mask-position: center;
14
- background-color: var(--highlight-color);
14
+ background-color: #111;
15
15
  }
16
16
  }
17
17
  }
@@ -57,6 +57,12 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
57
57
  actOnSingleClick: false,
58
58
  },
59
59
 
60
+ init() {
61
+ this.ownerComponent = this.getCmp().up('ReportPanel') ||
62
+ this.getCmp();
63
+ this.callParent(arguments);
64
+ },
65
+
60
66
  handler: function() {
61
67
  this.effectiveXTypeObject = this.getEffectiveXType();
62
68
  if (this.oldFrame) {
@@ -103,31 +109,81 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
103
109
  }
104
110
  },
105
111
 
106
- getOwnerComponent() {
107
- const reportPanel = this.component.query('^ panel').find((p) => p instanceof Coon.report.component.ReportPanel);
108
- return reportPanel || this.component;
112
+ getReportId() {
113
+ return this.properties.reportId;
109
114
  },
110
115
 
111
- prepareProperties(ownerComponent) {
112
- let properties = Coon.Function.convertAdvancedProperties.call(
113
- ownerComponent,
114
- this.properties
115
- );
116
- const defaultProperties = Ext.apply(
117
- {defaultFocus: 'textfield[hidden=false][readOnly=false]'},
118
- this.effectiveXTypeObject.properties || {}
116
+ getComponentId() {
117
+ return this.uiElementCd ? this.getUIElement() : this.getReportId();
118
+ },
119
+
120
+ makeComponentConfig(config, params) {
121
+ if (config.isReport) {
122
+ config.params.params = Ext.apply({}, params);
123
+ }
124
+ config.properties = Ext.apply(
125
+ {
126
+ xtype: config.xtype,
127
+ defaultFocus: 'textfield[hidden=false][readOnly=false]',
128
+ launchConfig: {
129
+ source: 'OpenCustomPanelButtonPlugin',
130
+ params: config.params,
131
+ },
132
+ componentContextId: Coon.util.ContextManager.generateKey({
133
+ params: config.params,
134
+ id: this.getComponentId(),
135
+ xtype: config.xtype,
136
+ source: this.$className.split('.').pop(),
137
+ }),
138
+ componentConfig: {
139
+ parentComponent: this.getCmp(),
140
+ context: Object.assign(
141
+ {id: this.getComponentId()},
142
+ config.params
143
+ ),
144
+ },
145
+ parentViewModel: this.component.getViewModel() || this.component.lookupViewModel(),
146
+ ctxMgr: Coon.util.ContextManager,
147
+ },
148
+ this.effectiveXTypeObject.properties || {},
149
+ Coon.Function.convertAdvancedProperties.call(
150
+ this.ownerComponent,
151
+ this.properties
152
+ )
119
153
  );
120
- properties = Ext.apply(defaultProperties, properties);
154
+ this.buildContext(config);
155
+ },
121
156
 
122
- return properties;
157
+ getWindowSizeConfig() {
158
+ if (this.getAutoSize()) {
159
+ return {};
160
+ } else {
161
+ return {
162
+ height: this.panelHeight || 450,
163
+ width: this.panelWidth || 780,
164
+ };
165
+ }
123
166
  },
124
167
 
125
- prepareWindowProperties(properties, xtype, ownerComponent) {
168
+ getWindowConfig(panel, properties, isCustomPanel) {
169
+ let windowProperties;
126
170
  if (this.properties && this.properties.windowProperties) {
127
- return Coon.Function.convertAdvancedProperties.call(ownerComponent, this.properties.windowProperties);
171
+ windowProperties = Coon.Function.convertAdvancedProperties.call(
172
+ this.ownerComponent,
173
+ this.properties.windowProperties
174
+ );
128
175
  } else {
129
- return xtype === 'UiCustomPanel' ? this.properties : properties;
176
+ windowProperties = isCustomPanel ? this.properties : properties;
130
177
  }
178
+ return Ext.apply(
179
+ {
180
+ xtype: 'WindowWrap',
181
+ layout: 'fit',
182
+ items: [panel],
183
+ },
184
+ windowProperties,
185
+ this.getWindowSizeConfig()
186
+ );
131
187
  },
132
188
 
133
189
  getCenterView() {
@@ -141,7 +197,7 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
141
197
  return !!this.centerView.findComponent(componentContextId);
142
198
  },
143
199
 
144
- isCenterViewMode() {
200
+ isCVMode() {
145
201
  this.displacedMode = !this.openInWindow;
146
202
  return this.displacedMode &&
147
203
  !this.isInWindow() &&
@@ -149,160 +205,158 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
149
205
  !this.openInReport;
150
206
  },
151
207
 
152
- buildContext(properties, params) {
153
- const parent = this.getCmp().up('[componentContextId]');
154
- if (parent && parent.componentContextId) {
155
- properties.ctxMgr = Coon.util.ContextManager;
156
- properties.componentContextId = properties.ctxMgr.createContext(
157
- parent.componentContextId,
158
- Object.assign(
159
- {},
160
- params,
161
- {
162
- uiElementCd: properties.uiElementCd,
163
- xtype: properties.xtype,
164
- }
165
- ));
208
+ buildContext(config) {
209
+ return;// TODO - need refactoring
210
+ },
211
+
212
+ setComponentType(config) {
213
+ config.xtype = this.oldFrame ? 'uxiframe' : this.effectiveXTypeObject.effectiveXType;
214
+ if (!config.xtype) {
215
+ config.errors.push('invalid xtype');
216
+ return config;
217
+ }
218
+ if (config.xtype === 'ReportPanel' || config.xtype === 'DynamicReportForm') {
219
+ config.isReport = true;
220
+ return config;
221
+ }
222
+ if (config.xtype === 'UiCustomPanel') {
223
+ config.isCustomPanel = true;
224
+ return config;
166
225
  }
167
226
  },
168
227
 
169
- configureCustomPanel(params) {
170
- const properties = this.prepareProperties(
171
- this.getCmp().up('ReportPanel') ||
172
- this.getCmp()
173
- );
174
- properties.xtype = 'UiCustomPanel';
175
- return properties;
228
+ setMode(config) {
229
+ if (this.openInReport) {
230
+ config.openInReport = true;
231
+ return config;
232
+ }
233
+ if (this.isCVMode()) {
234
+ if (!this.getCenterView()) {
235
+ config.errors.push('centerViewNotFound');
236
+ return config;
237
+ }
238
+ config.openInCVTab = true;
239
+ return config;
240
+ }
241
+ config.openInWindow = true;
242
+ return config;
176
243
  },
177
244
 
178
- openPanel: function(params) {
179
- const xtype = this.oldFrame ? 'uxiframe' : this.effectiveXTypeObject.effectiveXType;
180
- if (!xtype) {
245
+ hasErrors(errors) {
246
+ if (errors.length === 0) {
181
247
  return;
182
248
  }
249
+ Coon.log.error([
250
+ '\nOCPB errors: ',
251
+ '*'.repeat(16),
252
+ ...errors,
253
+ '*'.repeat(16)
254
+ ].join('\n'));
255
+ return true;
256
+ },
183
257
 
184
- if (xtype === 'UiCustomPanel') {
185
- this.configureCustomPanel(params);
258
+ ifComponentExists(config) {
259
+ if (
260
+ config.openInCVTab &&
261
+ this.hasInCenterView(config.componentContextId)
262
+ ) {
263
+ this.centerView.setActiveComponent(config);
264
+ return true;
186
265
  }
266
+ },
187
267
 
188
- const ownerComponent = this.getOwnerComponent();
189
- const properties = this.prepareProperties(ownerComponent);
190
- properties.xtype = xtype;
191
-
192
- const componentContextId = Coon.util.ContextManager.generateKey(
193
- Object.assign(
194
- {},
195
- params,
196
- {
197
- uiElementCd: properties.uiElementCd,
198
- xtype,
199
- source: this.$className.split('.').pop(),
200
- }
201
- )
268
+ createComponent(config) {
269
+ config.targetComponent = Ext.create(config.properties);
270
+ Coon.eventBus.emit(
271
+ 'nav.state.loadComponent',
272
+ config.targetComponent,
273
+ config.params
202
274
  );
275
+ Coon.log.debug('OCPB.openPanel', {config, panel: config.targetComponent});
276
+ },
203
277
 
204
- if (this.isCenterViewMode() && !this.getCenterView()) {
205
- Coon.log.error('couldn\'t find parent component "centerview"');
206
- return;
207
- }
278
+ addComponentToCV(config) {
279
+ this.centerView.setActiveComponent(config.targetComponent);
280
+ Coon.Function.executeComponentDoInit(config.targetComponent, config.params);
281
+ config.targetComponent.setClosable(true);
282
+ config.targetComponent.on('afterlayout', function(panel) {
283
+ panel.focus();
284
+ }, this, {single: true});
208
285
 
209
- if (this.isCenterViewMode() && this.hasInCenterView(componentContextId)) {
210
- this.centerView.setActiveComponent({componentContextId});
211
- return;
286
+ Coon.eventBus.emit(
287
+ 'nav.loadComponent',
288
+ {
289
+ isNew: true,
290
+ id: config.targetComponent.id,
291
+ component: config.targetComponent,
292
+ viewport: this.component.up('centerview'),
293
+ params: config.params,
294
+ }
295
+ );
296
+ },
297
+
298
+ addComponentToReport(config) {
299
+ if (typeof this.component.up('ReportPanel').openInReport === 'function') {
300
+ this.component.up('ReportPanel').openInReport(config.targetComponent, config.params);
301
+ } else {
302
+ Coon.log.debug('this.component', this.component);
212
303
  }
304
+ },
213
305
 
214
- const windowProperties = this.prepareWindowProperties(properties, xtype, ownerComponent);
306
+ addComponentToWindowWrap(config) {
307
+ config.targetWindow = Ext.widget(
308
+ this.getWindowConfig(
309
+ config.targetComponent,
310
+ config.properties,
311
+ config.xtype
312
+ )
313
+ );
215
314
 
216
- if (xtype === 'ReportPanel' || xtype === 'DynamicReportForm' || /.*FormPanel.*/.test(xtype)) {
217
- params.params = Ext.apply({}, params);
315
+ if (typeof this.addNavigationThroughRecords === 'function') {
316
+ this.addNavigationThroughRecords(config.targetComponent);
218
317
  }
219
-
220
- properties.parentViewModel = this.component.getViewModel() || this.component.lookupViewModel();
221
- if (!properties.uiElementCd && params.uiElementCd) {
222
- properties.uiElementCd = params.uiElementCd;
318
+ config.targetComponent.on('afterrender', function() {
319
+ Coon.Function.executeComponentDoInit(config.targetComponent.getWrappedComponent(), config.params);
320
+ });
321
+ if (this.oldFrame) {
322
+ window.oldFrameWindow = config.targetComponent;
323
+ window.addEventListener('message', this.receiveMessage, false);
223
324
  }
224
- properties.launchConfig = {
225
- source: 'OpenCustomPanelButtonPlugin',
226
- params: params,
227
- };
228
-
229
-
230
- properties.componentContextId = componentContextId;
231
- properties.componentConfig = {
232
- parentComponent: this.getCmp(),
233
- context: Object.assign(
234
- {},
235
- params,
236
- {
237
- uiElementCd: properties.uiElementCd,
238
- }
239
- ),
240
- };
241
-
242
- this.buildContext(properties, params);
243
- const panel = Ext.create(properties);
244
- Coon.log.debug('OCPB.openPanel', xtype, properties.uiElementCd, {properties, params, panel});
245
- let parentWidget = panel;
325
+ config.targetComponent.show();
326
+ },
246
327
 
247
- Coon.eventBus.emit(
248
- 'nav.state.loadComponent',
249
- panel,
250
- params
251
- );
328
+ openPanel(params) {
329
+ const config = {errors: [], params};
330
+ this.setComponentType(config);
331
+ this.setMode(config);
332
+ if (this.hasErrors(config.errors)) {
333
+ return;
334
+ }
335
+ this.makeComponentConfig(config, params);
336
+ if (this.ifComponentExists(config)) {
337
+ return;
338
+ }
339
+ this.createComponent(config);
252
340
 
253
- if (this.isCenterViewMode()) {
254
- this.centerView.setActiveComponent(panel);
255
- Coon.Function.executeComponentDoInit(panel, params);
256
- panel.setClosable(true);
257
- panel.on('afterlayout', function(panel) {
258
- panel.focus();
259
- }, this, {single: true});
260
-
261
- Coon.eventBus.emit(
262
- 'nav.loadComponent',
263
- {
264
- isNew: true,
265
- id: panel.id,
266
- component: panel,
267
- viewport: this.component.up('centerview'),
268
- params,
269
- }
270
- );
271
- } else if (this.openInReport) {
272
- if (typeof this.component.up('ReportPanel').openInReport === 'function') {
273
- this.component.up('ReportPanel').openInReport(panel, params);
274
- } else {
275
- Coon.log.debug('this.component', this.component);
276
- }
341
+ if (config.openInCVTab) {
342
+ this.addComponentToCV(config);
343
+ } else if (config.openInReport) {
344
+ this.addComponentToReport(config);
277
345
  } else {
278
- const defaultWindowConfig = this.getConfig('autoSize') === true ?
279
- {} :
280
- {
281
- height: this.panelHeight || 450,
282
- width: this.panelWidth || 780,
283
- };
284
- Ext.apply(defaultWindowConfig, windowProperties);
285
-
286
- const openWindow = Ext.widget('WindowWrap', Ext.applyIf({
287
- items: panel,
288
- }, Ext.apply({}, windowProperties || {}, defaultWindowConfig || {})));
289
-
290
- if (typeof this.addNavigationThroughRecords === 'function') {
291
- this.addNavigationThroughRecords(openWindow);
292
- }
293
- parentWidget = openWindow;
294
- openWindow.on('afterrender', function() {
295
- Coon.Function.executeComponentDoInit(panel, params);
296
- });
297
- if (this.oldFrame) {
298
- window.oldFrameWindow = openWindow;
299
- window.addEventListener('message', this.receiveMessage, false);
300
- }
301
- openWindow.show();
346
+ this.addComponentToWindowWrap(config);
302
347
  }
303
348
 
304
- if (this.getSendDataForNewRecord() === true && (!Ext.isEmpty(this.getNewRecordPrimaryKey()) || this.getTransmitKeyValue())) {
305
- parentWidget.content.on(this.getEventOnAddNewEntity(), function(data) {
349
+ const targetComponent = config.targetWindow || config.targetComponent;
350
+
351
+ if (
352
+ this.getSendDataForNewRecord() === true &&
353
+ (
354
+ !Ext.isEmpty(this.getNewRecordPrimaryKey()) ||
355
+ this.getTransmitKeyValue()
356
+ ) &&
357
+ targetComponent.content
358
+ ) {
359
+ targetComponent.content.on(this.getEventOnAddNewEntity(), function(data) {
306
360
  try {
307
361
  const entityId = this.getTransmitKeyValue() ?
308
362
  data :
@@ -315,32 +369,32 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
315
369
  }
316
370
 
317
371
  if (this.reloadAfterClose) {
318
- this.reloadAfterActionBindEvent(parentWidget);
372
+ this.reloadAfterActionBindEvent(targetComponent);
319
373
  }
320
- if (this.handleNewObjectEvent && !Ext.isEmpty(parentWidget.down('UniversalUploadPanel'))) {
321
- parentWidget.down('UniversalUploadPanel').closeAfterLoad = true;
322
- parentWidget.down('UniversalUploadPanel').lookup('submitButton').on('click', function() {
323
- parentWidget.down('UniversalUploadPanel').on('complete', function() {
324
- parentWidget.down('UniversalUploadPanel').on('initReportAfterClose', function(id) {
374
+ if (this.handleNewObjectEvent && !Ext.isEmpty(targetComponent.down('UniversalUploadPanel'))) {
375
+ targetComponent.down('UniversalUploadPanel').closeAfterLoad = true;
376
+ targetComponent.down('UniversalUploadPanel').lookup('submitButton').on('click', function() {
377
+ targetComponent.down('UniversalUploadPanel').on('complete', function() {
378
+ targetComponent.down('UniversalUploadPanel').on('initReportAfterClose', function(id) {
325
379
  }, this, {single: true});
326
380
  }, this);
327
381
  }, this);
328
382
  }
329
383
  if (this.closeAfterClose) {
330
- parentWidget.on('close', function() {
384
+ targetComponent.on('close', function() {
331
385
  if (this.component) {
332
386
  this.component.fireEvent('close');
333
387
  }
334
388
  }, this);
335
389
  }
336
- if ((xtype === 'ReportPanel' || xtype === 'DynamicReportForm') && this.sendDataOnSelect) {
337
- parentWidget.content && parentWidget.content.on('select', function(content, data) {
390
+ if (config.isReport && this.sendDataOnSelect) {
391
+ targetComponent.content && targetComponent.content.on('select', function(content, data) {
338
392
  if (this.component) {
339
393
  this.component.fireEvent('needReload', 'SELECTED', data);
340
394
  }
341
395
  }, this);
342
396
  } else if (this.sendDataOnSelect) {
343
- parentWidget.content && parentWidget.content.on('save', function(data) {
397
+ targetComponent.content && targetComponent.content.on('save', function(data) {
344
398
  if (this.component) {
345
399
  this.component.fireEvent('needReload', 'SELECTED', data);
346
400
  }
@@ -386,7 +440,8 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
386
440
  return Ext.isDefined(this.component.up('window'));
387
441
  },
388
442
 
389
- getEffectiveXType: function(reportPanel) {
443
+ getEffectiveXType: function() {
444
+ const reportPanel = this.getCmp();
390
445
  let effectiveXType = this.xtype || this.panelXType;
391
446
  let deferred = false;
392
447
  if (this.xtypeSelector) {
@@ -90,7 +90,7 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
90
90
  this.centerView.setActiveComponent({componentContextId});
91
91
  return;
92
92
  }
93
-
93
+ console.log('OPP.panel', panel);
94
94
  this.centerView.setActiveComponent(panel);
95
95
  Coon.Function.executeComponentDoInit(panel, this.initArguments);
96
96
  panel.setClosable(true);
@@ -0,0 +1,71 @@
1
+ Ext.define('Coon.util.SimLoadReportCommand', {
2
+ mixins: ['Ext.mixin.Observable'],
3
+ alias: 'command.SimLoadReportCommand',
4
+
5
+ constructor: function(config) {
6
+ this.mixins.observable.constructor.call(this, config);
7
+ Ext.apply(this, config);
8
+ },
9
+
10
+ loadReportConfig(id) {
11
+ return Coon.util.promisifyCmd(
12
+ 'command.GetReportCommand',
13
+ id,
14
+ true
15
+ );
16
+ },
17
+
18
+ async execute(reportId, generateFakeData) {
19
+ const config = await this.loadReportConfig(reportId);
20
+ console.log({config});
21
+ if (!config) {
22
+ this.fireEvent('failure', 'report not found');
23
+ }
24
+ if (generateFakeData) {
25
+ const fakeData = this.loadFakeData(config.fields, generateFakeData);
26
+ this.setList(reportId, fakeData);
27
+ }
28
+ const list = this.getList(reportId);
29
+ this.fireEvent('complete', {list, totalCount: list.length});
30
+ },
31
+
32
+ loadFakeData(fields, len) {
33
+ len = Math.min(len, 100);
34
+ const getValue = (type) => {
35
+ const strGen = Ext.create('Ext.data.identifier.Uuid');
36
+ if (type === 'number') {
37
+ return Math.random() * 99999;
38
+ }
39
+ if (type === 'boolean') {
40
+ return Math.random() > 0.5;
41
+ }
42
+ if (type === 'date') {
43
+ return new Date(Math.ceil(Math.random() * 2e12));
44
+ }
45
+ return strGen.generate();
46
+ };
47
+ const columns = fields.filter((column) => column.visibleSwitch);
48
+ const getRow = () => columns.reduce((acc, {reportFieldCd, reportFieldTypeLookup}) => {
49
+ acc[reportFieldCd] = getValue(
50
+ (reportFieldTypeLookup || '').toLowerCase()
51
+ );
52
+ return acc;
53
+ }, {id: Ext.id(false, 'fakeid-')});
54
+ return [...Array(len)].map(getRow);
55
+ },
56
+
57
+ getList(id) {
58
+ return Ext.decode(localStorage.getItem('simlet.' + id), true) || [];
59
+ },
60
+
61
+ setList(id, list) {
62
+ return localStorage.setItem('simlet.' + id, Ext.encode(list, true));
63
+ },
64
+
65
+ inputParameters: function() {
66
+ return [
67
+ {name: 'reportId', description: 'reportId'},
68
+ {name: 'fake', description: 'generate fake data'}
69
+ ];
70
+ },
71
+ });
@@ -0,0 +1,4 @@
1
+ Ext.define('Coon.util.SimUpsertReportCommand', {
2
+ mixins: ['Ext.mixin.Observable'],
3
+ alias: 'command.SimLoadReportCommand',
4
+ });
package/src/util.js CHANGED
@@ -48,13 +48,13 @@ Ext.define('Coon.util', {
48
48
  };
49
49
  const command = getCommand(cls);
50
50
  return new Promise((resolve, reject) => {
51
+ command.on('complete', resolve);
52
+ command.on('failure', reject);
51
53
  if (cls.getParamsFromObject) {
52
54
  command.executeWith(cls.params);
53
55
  } else {
54
56
  command.execute(...args);
55
57
  }
56
- command.on('complete', resolve);
57
- command.on('failure', reject);
58
58
  });
59
59
  },
60
60
 
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '3.0.27',
3
+ number: '3.0.29',
4
4
  });