ru.coon 3.0.79 → 3.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/uielement/plugin/OpenPanelPlugin.js +54 -20
- package/src/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# Version 3.0.80, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3b43f1d4de9199df4725890955ab76c6e4491cdc)
|
|
2
|
+
* refactoring OpenPanelPlugin ([67cd0c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/67cd0c0b004f89f7fb3607497a43f960ae4f0735))
|
|
3
|
+
* update: CHANGELOG.md ([6e78bf], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6e78bf0dd1e0394557f2aba6b2fa56c1f022fc86))
|
|
4
|
+
|
|
1
5
|
# Version 3.0.79, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/05cc0396686f91876a09be0e05bed80d6e3591a8)
|
|
2
6
|
* ## Fixes
|
|
3
7
|
* <span style='color:red'> HT-13828 upd</span> ([54a357], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/54a357933afc6b44569625816ad724d56053c012))
|
package/package.json
CHANGED
|
@@ -21,17 +21,37 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
|
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
init: function(view) {
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (!this.handlerName) {
|
|
25
|
+
Coon.log.error('OpenPanelPlugin.init: handlerName is required');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!this.getCmp().getViewModel()) {
|
|
29
|
+
Coon.log.error('OpenPanelPlugin.init: viewModel is required');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!this.config.uiElementCd) {
|
|
33
|
+
Coon.log.error('OpenPanelPlugin.init: uiElementCd is required');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.cmpController = view.getController();
|
|
37
|
+
if (this.cmpController) {
|
|
38
|
+
this.getViewModel = () => this.cmpController.getViewModel();
|
|
39
|
+
this.cmpController[this.handlerName] = Ext.bind(this.handler, this);
|
|
40
|
+
this.getCmp().onDestroy(function() {
|
|
41
|
+
this.cmpController[this.handlerName] = undefined;
|
|
42
|
+
}, this);
|
|
28
43
|
}
|
|
29
44
|
this.initBindable();
|
|
30
45
|
},
|
|
31
46
|
|
|
32
47
|
getFromModel: function(value) {
|
|
33
|
-
if (
|
|
34
|
-
|
|
48
|
+
if (
|
|
49
|
+
Ext.isString(value) &&
|
|
50
|
+
value.length > 2 &&
|
|
51
|
+
value.startsWith('{') &&
|
|
52
|
+
value.endsWith('}')
|
|
53
|
+
) {
|
|
54
|
+
value = this.getCmp().getViewModel().get(value.substring(1, value.length - 1));
|
|
35
55
|
}
|
|
36
56
|
return value;
|
|
37
57
|
},
|
|
@@ -44,16 +64,25 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
|
|
|
44
64
|
if (this.uiElementCd) {
|
|
45
65
|
this.uiElementCd = this.getFromModel(this.uiElementCd);
|
|
46
66
|
const command = Ext.create('command.GetUIElementCommand');
|
|
67
|
+
command.on('failure', function(error) {
|
|
68
|
+
Coon.log.error(`OpenPanelPlugin.handler: failed to get UIElement [${this.uiElementCd}]`, error);
|
|
69
|
+
});
|
|
47
70
|
command.on('complete', function(UIElementBean) {
|
|
48
71
|
const elementNS = Coon.uielement.UIElementBeanFields;
|
|
49
72
|
const exists = Ext.ClassManager.getByAlias('widget.' + UIElementBean[elementNS.$xtype]);
|
|
50
|
-
if (exists
|
|
51
|
-
Coon.log.log(UIElementBean
|
|
73
|
+
if (!exists) {
|
|
74
|
+
Coon.log.log(UIElementBean.xtype + ' does not exist');
|
|
52
75
|
return;
|
|
53
76
|
}
|
|
54
77
|
this.panelXType = UIElementBean[elementNS.$xtype];
|
|
55
|
-
|
|
56
|
-
|
|
78
|
+
try {
|
|
79
|
+
this.openPanel(
|
|
80
|
+
JSON5.parse(UIElementBean['propertyData'])
|
|
81
|
+
);
|
|
82
|
+
} catch (ex) {
|
|
83
|
+
Coon.log.error('OpenPanelPlugin.handler: invalid propertyData JSON5', ex);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
57
86
|
}, this);
|
|
58
87
|
command.execute(this.uiElementCd);
|
|
59
88
|
} else {
|
|
@@ -135,15 +164,17 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
|
|
|
135
164
|
},
|
|
136
165
|
|
|
137
166
|
addPanelEventListeners(panel) {
|
|
167
|
+
if (!this.cmpController) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
138
170
|
Object.entries(
|
|
139
171
|
this.panelEventListeners || {}
|
|
140
|
-
)
|
|
141
|
-
.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
172
|
+
).forEach(([eventName, handlerName]) => {
|
|
173
|
+
const handler = this.cmpController[handlerName];
|
|
174
|
+
if (typeof handler === 'function') {
|
|
175
|
+
panel.on(eventName, handler, this.getCmp());
|
|
176
|
+
}
|
|
177
|
+
});
|
|
147
178
|
},
|
|
148
179
|
|
|
149
180
|
setInitArguments() {
|
|
@@ -153,10 +184,13 @@ Ext.define('Coon.uielement.plugin.OpenPanelPlugin', {
|
|
|
153
184
|
}
|
|
154
185
|
},
|
|
155
186
|
|
|
156
|
-
openPanel: function() {
|
|
157
|
-
const
|
|
158
|
-
const properties = Ext.apply(defaultProperties, this.properties);
|
|
187
|
+
openPanel: function(cmpProperties = {}) {
|
|
188
|
+
const properties = Ext.apply({}, cmpProperties, this.properties);
|
|
159
189
|
this.panelXType = this.getFromModel(this.panelXType);
|
|
190
|
+
if (!Ext.ClassManager.getByAlias(`widget.${this.panelXType}`)) {
|
|
191
|
+
Coon.log.error(`OpenPanelPlugin.openPanel: panelXType [${this.panelXType}] does not exist`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
160
194
|
const panel = Ext.widget(this.panelXType, properties);
|
|
161
195
|
|
|
162
196
|
this.setInitArguments();
|
package/src/version.js
CHANGED