ru.coon 3.0.61 → 3.0.62
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 +11 -0
- package/package.json +1 -1
- package/src/app/Application.js +2 -1
- package/src/app/Router.js +41 -19
- package/src/app/viewPort/CenterView.js +8 -3
- package/src/common/ComponentFactory.js +1 -0
- package/src/common/component/OpenComponent.js +514 -0
- package/src/report/plugin/configPanel/ControlColumnByParamPluginConfigPanel.js +15 -0
- package/src/report/plugin/grid/OpenCustomPanelButtonPlugin.js +384 -362
- package/src/validator.js +6 -1
- package/src/version.js +1 -1
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
|
|
2
2
|
extend: 'Coon.report.plugin.grid.GridToolbarButtonPlugin',
|
|
3
3
|
alias: 'plugin.OpenCustomPanelButtonPlugin',
|
|
4
|
-
uses: [],
|
|
5
4
|
requires: [
|
|
6
5
|
'Coon.setup',
|
|
7
6
|
'Coon.eventBus',
|
|
8
7
|
'Coon.util.ContextManager'
|
|
9
8
|
],
|
|
10
|
-
alternateClassName: [
|
|
11
|
-
'Sigma.common.grid.plugin.OpenCustomPanelButtonPlugin',
|
|
12
|
-
'Sigma.common.plugin.grid.OpenCustomPanelButtonPlugin'
|
|
13
|
-
],
|
|
14
9
|
mixins: [
|
|
15
|
-
'Coon.common.plugin.mixin.navigatingThroughRecords'
|
|
10
|
+
'Coon.common.plugin.mixin.navigatingThroughRecords',
|
|
11
|
+
'Coon.validator.mixin'
|
|
16
12
|
],
|
|
17
13
|
configurePanelWizard: 'OpenCustomPanelButtonPluginConfigPanel',
|
|
18
14
|
|
|
@@ -62,14 +58,33 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
|
|
|
62
58
|
this.callParent(arguments);
|
|
63
59
|
},
|
|
64
60
|
|
|
61
|
+
getComponentType() {
|
|
62
|
+
if (this.xtypeSelector === 'UI_LIST') {
|
|
63
|
+
return ['u', this.UIElement];
|
|
64
|
+
}
|
|
65
|
+
if (this.xtypeSelector === 'LIST') {
|
|
66
|
+
return ['x', this.xtype];
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
65
70
|
handler: function() {
|
|
71
|
+
const openComponent = Ext.create('Coon.common.component.OpenComponent', {
|
|
72
|
+
config: Object.assign(
|
|
73
|
+
{},
|
|
74
|
+
this.getConfig(),
|
|
75
|
+
{xtype: this.xtype}
|
|
76
|
+
),
|
|
77
|
+
});
|
|
78
|
+
const params = this.getCmp().getContextManager().getParameters(this.parameters);
|
|
79
|
+
const [componentType, componentId] = this.getComponentType();
|
|
80
|
+
const urlComponent = `${componentType}-${componentId}`;
|
|
66
81
|
this.effectiveXTypeObject = this.getEffectiveXType();
|
|
67
82
|
if (this.oldFrame) {
|
|
68
83
|
this.effectiveXTypeObject = {
|
|
69
84
|
effectiveXType: undefined,
|
|
70
85
|
deferred: true,
|
|
71
86
|
};
|
|
72
|
-
|
|
87
|
+
openComponent.openPanel(this.getUIElement());
|
|
73
88
|
return;
|
|
74
89
|
}
|
|
75
90
|
if (Ext.isEmpty(this.effectiveXTypeObject.effectiveXType) && !this.effectiveXTypeObject.deferred) {
|
|
@@ -81,368 +96,375 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
|
|
|
81
96
|
Coon.log.log('UIElement не указан');
|
|
82
97
|
return;
|
|
83
98
|
}
|
|
84
|
-
const command = Ext.create('command.GetUIElementCommand');
|
|
85
|
-
command.on('complete', function(uIElementBean) {
|
|
86
|
-
if (!uIElementBean || !uIElementBean.xtype) {
|
|
87
|
-
Coon.log.error('UIElement dont exist or invalid');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const exists = Ext.ClassManager.getByAlias('widget.' + uIElementBean.xtype);
|
|
91
|
-
if (!exists) {
|
|
92
|
-
Coon.log.log(uIElementBean.xtype + ' does not exist');
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
this.effectiveXTypeObject.effectiveXType = uIElementBean.xtype;
|
|
96
|
-
this.effectiveXTypeObject.properties =
|
|
97
|
-
this.effectiveXTypeObject.effectiveXType === 'UiCustomPanel' ?
|
|
98
|
-
JSON5.parse(uIElementBean.propertyData) :
|
|
99
|
-
(
|
|
100
|
-
Ext.decode(uIElementBean.propertyData) ||
|
|
101
|
-
Coon.Function.convertAdvancedProperties(uIElementBean.properties)
|
|
102
|
-
);
|
|
103
|
-
this.component.getContextManager().executeFunction(Ext.bind(this.openPanel, this), this.parameters);
|
|
104
|
-
}, this);
|
|
105
|
-
command.execute(this.getUIElement());
|
|
106
|
-
} else {
|
|
107
|
-
this.component.getContextManager().executeFunction(Ext.bind(this.openPanel, this), this.parameters);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
getReportId() {
|
|
112
|
-
return this.properties.reportId;
|
|
113
|
-
},
|
|
114
99
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
config.params.params = Ext.apply({}, params);
|
|
123
|
-
}
|
|
124
|
-
const componentContextId = Coon.util.ContextManager.generateKey({
|
|
125
|
-
params: config.params,
|
|
126
|
-
id: componentId,
|
|
127
|
-
xtype: config.xtype,
|
|
128
|
-
source: this.$className.split('.').pop(),
|
|
129
|
-
});
|
|
130
|
-
config.componentContextId = componentContextId;
|
|
131
|
-
config.properties = Ext.apply(
|
|
132
|
-
{
|
|
133
|
-
xtype: config.xtype,
|
|
134
|
-
defaultFocus: 'textfield[hidden=false][readOnly=false]',
|
|
135
|
-
launchConfig: {
|
|
136
|
-
source: 'OpenCustomPanelButtonPlugin',
|
|
137
|
-
params: config.params,
|
|
138
|
-
},
|
|
139
|
-
componentContextId,
|
|
140
|
-
componentConfig: {
|
|
141
|
-
parentComponent: this.getCmp(),
|
|
142
|
-
context: Object.assign(
|
|
143
|
-
{
|
|
144
|
-
id: componentId,
|
|
145
|
-
},
|
|
146
|
-
config.params
|
|
147
|
-
),
|
|
148
|
-
},
|
|
149
|
-
parentViewModel: this.component.getViewModel() || this.component.lookupViewModel(),
|
|
150
|
-
ctxMgr: Coon.util.ContextManager,
|
|
151
|
-
},
|
|
152
|
-
this.effectiveXTypeObject.properties || {},
|
|
153
|
-
Coon.Function.convertAdvancedProperties.call(
|
|
154
|
-
this.ownerComponent,
|
|
155
|
-
this.properties
|
|
156
|
-
)
|
|
157
|
-
);
|
|
158
|
-
this.buildContext(config);
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
getWindowSizeConfig() {
|
|
162
|
-
if (this.getAutoSize()) {
|
|
163
|
-
return {};
|
|
164
|
-
} else {
|
|
165
|
-
return {
|
|
166
|
-
height: this.panelHeight || 450,
|
|
167
|
-
width: this.panelWidth || 780,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
getWindowConfig(panel, properties, isCustomPanel) {
|
|
173
|
-
let windowProperties;
|
|
174
|
-
if (this.properties && this.properties.windowProperties) {
|
|
175
|
-
windowProperties = Coon.Function.convertAdvancedProperties.call(
|
|
176
|
-
this.ownerComponent,
|
|
177
|
-
this.properties.windowProperties
|
|
100
|
+
openComponent.loadUIElement(
|
|
101
|
+
urlComponent,
|
|
102
|
+
params,
|
|
103
|
+
{
|
|
104
|
+
id: `#${this.getCmp().getId()}`,
|
|
105
|
+
rootId: this.getCmp().up('CVWrapperPanel')?.componentContextId,
|
|
106
|
+
}
|
|
178
107
|
);
|
|
108
|
+
openComponent.afterAddingComponent = function() {
|
|
109
|
+
openComponent.setComponentUrl(
|
|
110
|
+
urlComponent,
|
|
111
|
+
params
|
|
112
|
+
);
|
|
113
|
+
};
|
|
179
114
|
} else {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
windowProperties,
|
|
189
|
-
this.getWindowSizeConfig()
|
|
190
|
-
);
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
getCenterView() {
|
|
194
|
-
if (!this.centerView) {
|
|
195
|
-
this.centerView = this.centerView || this.component.up('centerview');
|
|
196
|
-
}
|
|
197
|
-
return this.centerView;
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
hasInCenterView(componentContextId) {
|
|
201
|
-
return !!this.centerView.findComponent(componentContextId);
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
isCVMode() {
|
|
205
|
-
this.displacedMode = !this.openInWindow;
|
|
206
|
-
return this.displacedMode &&
|
|
207
|
-
!this.isInWindow() &&
|
|
208
|
-
!this.oldFrame &&
|
|
209
|
-
!this.openInReport;
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
buildContext(config) {
|
|
213
|
-
return;// TODO - need refactoring
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
setComponentType(config) {
|
|
217
|
-
config.xtype = this.oldFrame ? 'uxiframe' : this.effectiveXTypeObject.effectiveXType;
|
|
218
|
-
if (!config.xtype) {
|
|
219
|
-
config.errors.push('invalid xtype');
|
|
220
|
-
return config;
|
|
221
|
-
}
|
|
222
|
-
if (config.xtype === 'ReportPanel' || config.xtype === 'DynamicReportForm') {
|
|
223
|
-
config.isReport = true;
|
|
224
|
-
return config;
|
|
225
|
-
}
|
|
226
|
-
if (config.xtype === 'UiCustomPanel') {
|
|
227
|
-
config.isCustomPanel = true;
|
|
228
|
-
return config;
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
setMode(config) {
|
|
233
|
-
if (this.openInReport) {
|
|
234
|
-
config.openInReport = true;
|
|
235
|
-
return config;
|
|
236
|
-
}
|
|
237
|
-
if (this.isCVMode()) {
|
|
238
|
-
if (!this.getCenterView()) {
|
|
239
|
-
config.errors.push('centerViewNotFound');
|
|
240
|
-
return config;
|
|
241
|
-
}
|
|
242
|
-
config.openInCVTab = true;
|
|
243
|
-
return config;
|
|
244
|
-
}
|
|
245
|
-
config.openInWindow = true;
|
|
246
|
-
return config;
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
hasErrors(errors) {
|
|
250
|
-
if (errors.length === 0) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
Coon.log.error([
|
|
254
|
-
'\nOCPB errors: ',
|
|
255
|
-
'*'.repeat(16),
|
|
256
|
-
...errors,
|
|
257
|
-
'*'.repeat(16)
|
|
258
|
-
].join('\n'));
|
|
259
|
-
return true;
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
ifComponentExists(config) {
|
|
263
|
-
if (
|
|
264
|
-
config.openInCVTab &&
|
|
265
|
-
this.hasInCenterView(config.componentContextId)
|
|
266
|
-
) {
|
|
267
|
-
this.centerView.setActiveComponent(config);
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
createComponent(config) {
|
|
273
|
-
config.targetComponent = Ext.create(config.properties);
|
|
274
|
-
Coon.eventBus.emit(
|
|
275
|
-
'nav.state.loadComponent',
|
|
276
|
-
config.targetComponent,
|
|
277
|
-
config.params
|
|
278
|
-
);
|
|
279
|
-
Coon.log.debug('OCPB.openPanel', {config, panel: config.targetComponent});
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
addComponentToCV(config) {
|
|
283
|
-
this.centerView.setActiveComponent(config.targetComponent);
|
|
284
|
-
Coon.Function.executeComponentDoInit(config.targetComponent, config.params);
|
|
285
|
-
config.targetComponent.setClosable(true);
|
|
286
|
-
config.targetComponent.on('afterlayout', function(panel) {
|
|
287
|
-
panel.focus();
|
|
288
|
-
}, this, {single: true});
|
|
289
|
-
|
|
290
|
-
Coon.eventBus.emit(
|
|
291
|
-
'nav.loadComponent',
|
|
292
|
-
{
|
|
293
|
-
isNew: true,
|
|
294
|
-
id: config.targetComponent.id,
|
|
295
|
-
component: config.targetComponent,
|
|
296
|
-
viewport: this.component.up('centerview'),
|
|
297
|
-
params: config.params,
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
addComponentToReport(config) {
|
|
303
|
-
if (typeof this.component.up('ReportPanel').openInReport === 'function') {
|
|
304
|
-
this.component.up('ReportPanel').openInReport(config.targetComponent, config.params);
|
|
305
|
-
} else {
|
|
306
|
-
Coon.log.debug('this.component', this.component);
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
|
|
310
|
-
addComponentToWindowWrap(config) {
|
|
311
|
-
config.targetWindow = Ext.widget(
|
|
312
|
-
this.getWindowConfig(
|
|
313
|
-
config.targetComponent,
|
|
314
|
-
config.properties,
|
|
315
|
-
config.xtype
|
|
316
|
-
)
|
|
317
|
-
);
|
|
318
|
-
|
|
319
|
-
if (typeof this.addNavigationThroughRecords === 'function') {
|
|
320
|
-
this.addNavigationThroughRecords(config.targetComponent);
|
|
321
|
-
}
|
|
322
|
-
config.targetComponent.on('afterrender', function() {
|
|
323
|
-
Coon.Function.executeComponentDoInit(config.targetComponent, config.params);
|
|
324
|
-
});
|
|
325
|
-
if (this.oldFrame) {
|
|
326
|
-
window.oldFrameWindow = config.targetComponent;
|
|
327
|
-
window.addEventListener('message', this.receiveMessage, false);
|
|
328
|
-
}
|
|
329
|
-
config.targetWindow.show();
|
|
330
|
-
},
|
|
331
|
-
|
|
332
|
-
openPanel(params) {
|
|
333
|
-
const config = {errors: [], params};
|
|
334
|
-
this.setComponentType(config);
|
|
335
|
-
this.setMode(config);
|
|
336
|
-
if (this.hasErrors(config.errors)) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
this.makeComponentConfig(config, params);
|
|
340
|
-
if (this.ifComponentExists(config)) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
this.createComponent(config);
|
|
344
|
-
|
|
345
|
-
if (config.openInCVTab) {
|
|
346
|
-
this.addComponentToCV(config);
|
|
347
|
-
} else if (config.openInReport) {
|
|
348
|
-
this.addComponentToReport(config);
|
|
349
|
-
} else {
|
|
350
|
-
this.addComponentToWindowWrap(config);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
const targetComponent = config.targetWindow || config.targetComponent;
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
this.getSendDataForNewRecord() === true &&
|
|
357
|
-
(
|
|
358
|
-
!Ext.isEmpty(this.getNewRecordPrimaryKey()) ||
|
|
359
|
-
this.getTransmitKeyValue()
|
|
360
|
-
) &&
|
|
361
|
-
targetComponent.content
|
|
362
|
-
) {
|
|
363
|
-
targetComponent.content.on(this.getEventOnAddNewEntity(), function(data) {
|
|
364
|
-
try {
|
|
365
|
-
const entityId = this.getTransmitKeyValue() ?
|
|
366
|
-
data :
|
|
367
|
-
this.getNewRecordPrimaryKey().split('.').reduce((obj, field) => obj[field], data);
|
|
368
|
-
entityId && this.component.fireEvent('newEntityAdd', entityId, true);
|
|
369
|
-
} catch (e) {
|
|
370
|
-
console.warn(e);
|
|
115
|
+
// this.component.getContextManager().executeFunction(Ext.bind(this.openPanel, this), this.parameters);
|
|
116
|
+
openComponent.loadUIElement(
|
|
117
|
+
urlComponent,
|
|
118
|
+
params,
|
|
119
|
+
{
|
|
120
|
+
id: `#${this.getCmp().getId()}`,
|
|
121
|
+
rootId: this.getCmp().up('CVWrapperPanel')?.componentContextId,
|
|
371
122
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
targetComponent.down('UniversalUploadPanel').closeAfterLoad = true;
|
|
380
|
-
targetComponent.down('UniversalUploadPanel').lookup('submitButton').on('click', function() {
|
|
381
|
-
targetComponent.down('UniversalUploadPanel').on('complete', function() {
|
|
382
|
-
targetComponent.down('UniversalUploadPanel').on('initReportAfterClose', function(id) {
|
|
383
|
-
}, this, {single: true});
|
|
384
|
-
}, this);
|
|
385
|
-
}, this);
|
|
386
|
-
}
|
|
387
|
-
if (this.closeAfterClose) {
|
|
388
|
-
targetComponent.on('close', function() {
|
|
389
|
-
if (this.component) {
|
|
390
|
-
this.component.fireEvent('close');
|
|
391
|
-
}
|
|
392
|
-
}, this);
|
|
393
|
-
}
|
|
394
|
-
if (config.isReport && this.sendDataOnSelect) {
|
|
395
|
-
targetComponent.content && targetComponent.content.on('select', function(content, data) {
|
|
396
|
-
if (this.component) {
|
|
397
|
-
this.component.fireEvent('needReload', 'SELECTED', data);
|
|
398
|
-
}
|
|
399
|
-
}, this);
|
|
400
|
-
} else if (this.sendDataOnSelect) {
|
|
401
|
-
targetComponent.content && targetComponent.content.on('save', function(data) {
|
|
402
|
-
if (this.component) {
|
|
403
|
-
this.component.fireEvent('needReload', 'SELECTED', data);
|
|
404
|
-
}
|
|
405
|
-
}, this);
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
|
|
409
|
-
reloadAfterActionBindEvent: function(parentWidget) {
|
|
410
|
-
if (this.isValidEventName(this.updateOnEvent) && parentWidget) {
|
|
411
|
-
const updateOnEvent = this.reloadAfterClose === 'BYEVENT' ? this.updateOnEvent : 'close';
|
|
412
|
-
|
|
413
|
-
if (updateOnEvent === 'close') {
|
|
414
|
-
parentWidget.on(updateOnEvent, this.fireEventNeedReload, this);
|
|
415
|
-
} else {
|
|
416
|
-
const view = parentWidget.content || parentWidget;
|
|
417
|
-
|
|
418
|
-
view.on(updateOnEvent, this.fireEventNeedReload, this);
|
|
419
|
-
}
|
|
420
|
-
} else {
|
|
421
|
-
throw new Error(`Invalid eventName - ${this.updateOnEvent}`);
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
isValidEventName: function(eventName) {
|
|
426
|
-
return typeof eventName === 'string' && eventName;
|
|
427
|
-
},
|
|
428
|
-
|
|
429
|
-
fireEventNeedReload: function() {
|
|
430
|
-
if (this.component) {
|
|
431
|
-
this.component.fireEvent('needReload', this.reloadAfterClose);
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
receiveMessage: function(event) {
|
|
436
|
-
if (event.data === 'closeExt7Frame') {
|
|
437
|
-
this.oldFrameWindow.close();
|
|
438
|
-
} else {
|
|
439
|
-
this.oldFrameWindow.setTitle(event.data);
|
|
123
|
+
);
|
|
124
|
+
openComponent.afterAddingComponent = function() {
|
|
125
|
+
openComponent.setComponentUrl(
|
|
126
|
+
urlComponent,
|
|
127
|
+
params
|
|
128
|
+
);
|
|
129
|
+
};
|
|
440
130
|
}
|
|
441
131
|
},
|
|
442
132
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
},
|
|
133
|
+
// getReportId() {
|
|
134
|
+
// return this.properties.reportId;
|
|
135
|
+
// },
|
|
136
|
+
|
|
137
|
+
// getComponentId(config) {
|
|
138
|
+
// return config.isCustomPanel ? this.getUIElement() : this.getReportId();
|
|
139
|
+
// },
|
|
140
|
+
|
|
141
|
+
// makeComponentConfig(config, params) {
|
|
142
|
+
// const componentId = this.getComponentId(config);
|
|
143
|
+
// if (config.isReport) {
|
|
144
|
+
// config.params.params = Ext.apply({}, params);
|
|
145
|
+
// }
|
|
146
|
+
// const componentContextId = Coon.util.ContextManager.generateKey({
|
|
147
|
+
// params: config.params,
|
|
148
|
+
// id: componentId,
|
|
149
|
+
// xtype: config.xtype,
|
|
150
|
+
// source: this.$className.split('.').pop(),
|
|
151
|
+
// });
|
|
152
|
+
// config.componentContextId = componentContextId;
|
|
153
|
+
// config.properties = Ext.apply(
|
|
154
|
+
// {
|
|
155
|
+
// xtype: config.xtype,
|
|
156
|
+
// defaultFocus: 'textfield[hidden=false][readOnly=false]',
|
|
157
|
+
// launchConfig: {
|
|
158
|
+
// source: 'OpenCustomPanelButtonPlugin',
|
|
159
|
+
// params: config.params,
|
|
160
|
+
// },
|
|
161
|
+
// componentContextId,
|
|
162
|
+
// componentConfig: {
|
|
163
|
+
// parentComponent: this.getCmp(),
|
|
164
|
+
// context: Object.assign(
|
|
165
|
+
// {
|
|
166
|
+
// id: componentId,
|
|
167
|
+
// },
|
|
168
|
+
// config.params
|
|
169
|
+
// ),
|
|
170
|
+
// },
|
|
171
|
+
// parentViewModel: this.component.getViewModel() || this.component.lookupViewModel(),
|
|
172
|
+
// ctxMgr: Coon.util.ContextManager,
|
|
173
|
+
// },
|
|
174
|
+
// this.effectiveXTypeObject.properties || {},
|
|
175
|
+
// Coon.Function.convertAdvancedProperties.call(
|
|
176
|
+
// this.ownerComponent,
|
|
177
|
+
// this.properties
|
|
178
|
+
// )
|
|
179
|
+
// );
|
|
180
|
+
// this.buildContext(config);
|
|
181
|
+
// },
|
|
182
|
+
|
|
183
|
+
// getWindowSizeConfig() {
|
|
184
|
+
// if (this.getAutoSize()) {
|
|
185
|
+
// return {};
|
|
186
|
+
// } else {
|
|
187
|
+
// return {
|
|
188
|
+
// height: this.panelHeight || 450,
|
|
189
|
+
// width: this.panelWidth || 780,
|
|
190
|
+
// };
|
|
191
|
+
// }
|
|
192
|
+
// },
|
|
193
|
+
|
|
194
|
+
// getWindowConfig(panel, properties, isCustomPanel) {
|
|
195
|
+
// let windowProperties;
|
|
196
|
+
// if (this.properties && this.properties.windowProperties) {
|
|
197
|
+
// windowProperties = Coon.Function.convertAdvancedProperties.call(
|
|
198
|
+
// this.ownerComponent,
|
|
199
|
+
// this.properties.windowProperties
|
|
200
|
+
// );
|
|
201
|
+
// } else {
|
|
202
|
+
// windowProperties = isCustomPanel ? this.properties : properties;
|
|
203
|
+
// }
|
|
204
|
+
// return Ext.apply(
|
|
205
|
+
// {
|
|
206
|
+
// xtype: 'WindowWrap',
|
|
207
|
+
// layout: 'fit',
|
|
208
|
+
// items: [panel],
|
|
209
|
+
// },
|
|
210
|
+
// windowProperties,
|
|
211
|
+
// this.getWindowSizeConfig()
|
|
212
|
+
// );
|
|
213
|
+
// },
|
|
214
|
+
|
|
215
|
+
// getCenterView() {
|
|
216
|
+
// if (!this.centerView) {
|
|
217
|
+
// this.centerView = this.centerView || this.component.up('centerview');
|
|
218
|
+
// }
|
|
219
|
+
// return this.centerView;
|
|
220
|
+
// },
|
|
221
|
+
|
|
222
|
+
// hasInCenterView(componentContextId) {
|
|
223
|
+
// return !!this.centerView.findComponent(componentContextId);
|
|
224
|
+
// },
|
|
225
|
+
|
|
226
|
+
// isCVMode() {
|
|
227
|
+
// this.displacedMode = !this.openInWindow;
|
|
228
|
+
// return this.displacedMode &&
|
|
229
|
+
// !this.isInWindow() &&
|
|
230
|
+
// !this.oldFrame &&
|
|
231
|
+
// !this.openInReport;
|
|
232
|
+
// },
|
|
233
|
+
|
|
234
|
+
// buildContext(config) {
|
|
235
|
+
// return;// TODO - need refactoring
|
|
236
|
+
// },
|
|
237
|
+
|
|
238
|
+
// setComponentType(config) {
|
|
239
|
+
// config.xtype = this.oldFrame ? 'uxiframe' : this.effectiveXTypeObject.effectiveXType;
|
|
240
|
+
// if (!config.xtype) {
|
|
241
|
+
// config.errors.push('invalid xtype');
|
|
242
|
+
// return config;
|
|
243
|
+
// }
|
|
244
|
+
// if (config.xtype === 'ReportPanel' || config.xtype === 'DynamicReportForm') {
|
|
245
|
+
// config.isReport = true;
|
|
246
|
+
// return config;
|
|
247
|
+
// }
|
|
248
|
+
// if (config.xtype === 'UiCustomPanel') {
|
|
249
|
+
// config.isCustomPanel = true;
|
|
250
|
+
// return config;
|
|
251
|
+
// }
|
|
252
|
+
// },
|
|
253
|
+
|
|
254
|
+
// setMode(config) {
|
|
255
|
+
// if (this.openInReport) {
|
|
256
|
+
// config.openInReport = true;
|
|
257
|
+
// return config;
|
|
258
|
+
// }
|
|
259
|
+
// if (this.isCVMode()) {
|
|
260
|
+
// if (!this.getCenterView()) {
|
|
261
|
+
// config.errors.push('centerViewNotFound');
|
|
262
|
+
// return config;
|
|
263
|
+
// }
|
|
264
|
+
// config.openInCVTab = true;
|
|
265
|
+
// return config;
|
|
266
|
+
// }
|
|
267
|
+
// config.openInWindow = true;
|
|
268
|
+
// return config;
|
|
269
|
+
// },
|
|
270
|
+
|
|
271
|
+
// hasErrors(errors) {
|
|
272
|
+
// if (errors.length === 0) {
|
|
273
|
+
// return;
|
|
274
|
+
// }
|
|
275
|
+
// Coon.log.error([
|
|
276
|
+
// '\nOCPB errors: ',
|
|
277
|
+
// '*'.repeat(16),
|
|
278
|
+
// ...errors,
|
|
279
|
+
// '*'.repeat(16)
|
|
280
|
+
// ].join('\n'));
|
|
281
|
+
// return true;
|
|
282
|
+
// },
|
|
283
|
+
|
|
284
|
+
// ifComponentExists(config) {
|
|
285
|
+
// if (
|
|
286
|
+
// config.openInCVTab &&
|
|
287
|
+
// this.hasInCenterView(config.componentContextId)
|
|
288
|
+
// ) {
|
|
289
|
+
// this.centerView.setActiveComponent(config);
|
|
290
|
+
// return true;
|
|
291
|
+
// }
|
|
292
|
+
// },
|
|
293
|
+
|
|
294
|
+
// createComponent(config) {
|
|
295
|
+
// config.targetComponent = Ext.create(config.properties);
|
|
296
|
+
// Coon.eventBus.emit(
|
|
297
|
+
// 'nav.state.loadComponent',
|
|
298
|
+
// config.targetComponent,
|
|
299
|
+
// config.params
|
|
300
|
+
// );
|
|
301
|
+
// Coon.log.debug('OCPB.openPanel', {config, panel: config.targetComponent});
|
|
302
|
+
// },
|
|
303
|
+
|
|
304
|
+
// addComponentToCV(config) {
|
|
305
|
+
// this.centerView.setActiveComponent(config.targetComponent);
|
|
306
|
+
// Coon.Function.executeComponentDoInit(config.targetComponent, config.params);
|
|
307
|
+
// config.targetComponent.setClosable(true);
|
|
308
|
+
// config.targetComponent.on('afterlayout', function(panel) {
|
|
309
|
+
// panel.focus();
|
|
310
|
+
// }, this, {single: true});
|
|
311
|
+
|
|
312
|
+
// Coon.eventBus.emit(
|
|
313
|
+
// 'nav.loadComponent',
|
|
314
|
+
// {
|
|
315
|
+
// isNew: true,
|
|
316
|
+
// id: config.targetComponent.id,
|
|
317
|
+
// component: config.targetComponent,
|
|
318
|
+
// viewport: this.component.up('centerview'),
|
|
319
|
+
// params: config.params,
|
|
320
|
+
// }
|
|
321
|
+
// );
|
|
322
|
+
// },
|
|
323
|
+
|
|
324
|
+
// addComponentToReport(config) {
|
|
325
|
+
// if (typeof this.component.up('ReportPanel').openInReport === 'function') {
|
|
326
|
+
// this.component.up('ReportPanel').openInReport(config.targetComponent, config.params);
|
|
327
|
+
// } else {
|
|
328
|
+
// Coon.log.debug('this.component', this.component);
|
|
329
|
+
// }
|
|
330
|
+
// },
|
|
331
|
+
|
|
332
|
+
// addComponentToWindowWrap(config) {
|
|
333
|
+
// config.targetWindow = Ext.widget(
|
|
334
|
+
// this.getWindowConfig(
|
|
335
|
+
// config.targetComponent,
|
|
336
|
+
// config.properties,
|
|
337
|
+
// config.xtype
|
|
338
|
+
// )
|
|
339
|
+
// );
|
|
340
|
+
|
|
341
|
+
// if (typeof this.addNavigationThroughRecords === 'function') {
|
|
342
|
+
// this.addNavigationThroughRecords(config.targetComponent);
|
|
343
|
+
// }
|
|
344
|
+
// config.targetComponent.on('afterrender', function() {
|
|
345
|
+
// Coon.Function.executeComponentDoInit(config.targetComponent, config.params);
|
|
346
|
+
// });
|
|
347
|
+
// if (this.oldFrame) {
|
|
348
|
+
// window.oldFrameWindow = config.targetComponent;
|
|
349
|
+
// window.addEventListener('message', this.receiveMessage, false);
|
|
350
|
+
// }
|
|
351
|
+
// config.targetWindow.show();
|
|
352
|
+
// },
|
|
353
|
+
|
|
354
|
+
// openPanel(params) {
|
|
355
|
+
// const config = {errors: [], params};
|
|
356
|
+
// this.setComponentType(config);
|
|
357
|
+
// this.setMode(config);
|
|
358
|
+
// if (this.hasErrors(config.errors)) {
|
|
359
|
+
// return;
|
|
360
|
+
// }
|
|
361
|
+
// this.makeComponentConfig(config, params);
|
|
362
|
+
// if (this.ifComponentExists(config)) {
|
|
363
|
+
// return;
|
|
364
|
+
// }
|
|
365
|
+
// this.createComponent(config);
|
|
366
|
+
|
|
367
|
+
// if (config.openInCVTab) {
|
|
368
|
+
// this.addComponentToCV(config);
|
|
369
|
+
// } else if (config.openInReport) {
|
|
370
|
+
// this.addComponentToReport(config);
|
|
371
|
+
// } else {
|
|
372
|
+
// this.addComponentToWindowWrap(config);
|
|
373
|
+
// }
|
|
374
|
+
|
|
375
|
+
// const targetComponent = config.targetWindow || config.targetComponent;
|
|
376
|
+
|
|
377
|
+
// if (
|
|
378
|
+
// this.getSendDataForNewRecord() === true &&
|
|
379
|
+
// (
|
|
380
|
+
// !Ext.isEmpty(this.getNewRecordPrimaryKey()) ||
|
|
381
|
+
// this.getTransmitKeyValue()
|
|
382
|
+
// ) &&
|
|
383
|
+
// targetComponent.content
|
|
384
|
+
// ) {
|
|
385
|
+
// targetComponent.content.on(this.getEventOnAddNewEntity(), function(data) {
|
|
386
|
+
// try {
|
|
387
|
+
// const entityId = this.getTransmitKeyValue() ?
|
|
388
|
+
// data :
|
|
389
|
+
// this.getNewRecordPrimaryKey().split('.').reduce((obj, field) => obj[field], data);
|
|
390
|
+
// entityId && this.component.fireEvent('newEntityAdd', entityId, true);
|
|
391
|
+
// } catch (e) {
|
|
392
|
+
// console.warn(e);
|
|
393
|
+
// }
|
|
394
|
+
// }, this);
|
|
395
|
+
// }
|
|
396
|
+
|
|
397
|
+
// if (this.reloadAfterClose) {
|
|
398
|
+
// this.reloadAfterActionBindEvent(targetComponent);
|
|
399
|
+
// }
|
|
400
|
+
// if (this.handleNewObjectEvent && !Ext.isEmpty(targetComponent.down('UniversalUploadPanel'))) {
|
|
401
|
+
// targetComponent.down('UniversalUploadPanel').closeAfterLoad = true;
|
|
402
|
+
// targetComponent.down('UniversalUploadPanel').lookup('submitButton').on('click', function() {
|
|
403
|
+
// targetComponent.down('UniversalUploadPanel').on('complete', function() {
|
|
404
|
+
// targetComponent.down('UniversalUploadPanel').on('initReportAfterClose', function(id) {
|
|
405
|
+
// }, this, {single: true});
|
|
406
|
+
// }, this);
|
|
407
|
+
// }, this);
|
|
408
|
+
// }
|
|
409
|
+
// if (this.closeAfterClose) {
|
|
410
|
+
// targetComponent.on('close', function() {
|
|
411
|
+
// if (this.component) {
|
|
412
|
+
// this.component.fireEvent('close');
|
|
413
|
+
// }
|
|
414
|
+
// }, this);
|
|
415
|
+
// }
|
|
416
|
+
// if (config.isReport && this.sendDataOnSelect) {
|
|
417
|
+
// targetComponent.content && targetComponent.content.on('select', function(content, data) {
|
|
418
|
+
// if (this.component) {
|
|
419
|
+
// this.component.fireEvent('needReload', 'SELECTED', data);
|
|
420
|
+
// }
|
|
421
|
+
// }, this);
|
|
422
|
+
// } else if (this.sendDataOnSelect) {
|
|
423
|
+
// targetComponent.content && targetComponent.content.on('save', function(data) {
|
|
424
|
+
// if (this.component) {
|
|
425
|
+
// this.component.fireEvent('needReload', 'SELECTED', data);
|
|
426
|
+
// }
|
|
427
|
+
// }, this);
|
|
428
|
+
// }
|
|
429
|
+
// },
|
|
430
|
+
|
|
431
|
+
// reloadAfterActionBindEvent: function(parentWidget) {
|
|
432
|
+
// if (this.isValidEventName(this.updateOnEvent) && parentWidget) {
|
|
433
|
+
// const updateOnEvent = this.reloadAfterClose === 'BYEVENT' ? this.updateOnEvent : 'close';
|
|
434
|
+
|
|
435
|
+
// if (updateOnEvent === 'close') {
|
|
436
|
+
// parentWidget.on(updateOnEvent, this.fireEventNeedReload, this);
|
|
437
|
+
// } else {
|
|
438
|
+
// const view = parentWidget.content || parentWidget;
|
|
439
|
+
|
|
440
|
+
// view.on(updateOnEvent, this.fireEventNeedReload, this);
|
|
441
|
+
// }
|
|
442
|
+
// } else {
|
|
443
|
+
// throw new Error(`Invalid eventName - ${this.updateOnEvent}`);
|
|
444
|
+
// }
|
|
445
|
+
// },
|
|
446
|
+
|
|
447
|
+
// isValidEventName: function(eventName) {
|
|
448
|
+
// return typeof eventName === 'string' && eventName;
|
|
449
|
+
// },
|
|
450
|
+
|
|
451
|
+
// fireEventNeedReload: function() {
|
|
452
|
+
// if (this.component) {
|
|
453
|
+
// this.component.fireEvent('needReload', this.reloadAfterClose);
|
|
454
|
+
// }
|
|
455
|
+
// },
|
|
456
|
+
|
|
457
|
+
// receiveMessage: function(event) {
|
|
458
|
+
// if (event.data === 'closeExt7Frame') {
|
|
459
|
+
// this.oldFrameWindow.close();
|
|
460
|
+
// } else {
|
|
461
|
+
// this.oldFrameWindow.setTitle(event.data);
|
|
462
|
+
// }
|
|
463
|
+
// },
|
|
464
|
+
|
|
465
|
+
// isInWindow() {
|
|
466
|
+
// return Ext.isDefined(this.component.up('window'));
|
|
467
|
+
// },
|
|
446
468
|
|
|
447
469
|
getEffectiveXType: function() {
|
|
448
470
|
const reportPanel = this.getCmp();
|