ru.coon 2.6.5 → 2.6.7
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 +25 -0
- package/index.js +0 -1
- package/package.json +2 -2
- package/src/Function.js +1 -1
- package/src/common/component/characteristic/characteristicGroup/EditorOptionsWindow.js +150 -0
- package/src/common/component/characteristic/characteristicGroup/EditorOptionsWindowController.js +174 -0
- package/src/common/component/characteristic/characteristicGroup/EntityGroupCharacteristicEditor.js +23 -0
- package/src/common/component/characteristic/characteristicGroup/EntityGroupCharacteristicEditorController.js +38 -0
- package/src/common/component/editor/CharacteristicGridEditor.js +3 -0
- package/src/common/component/editor/TypedCharacteristicEditor.js +0 -5
- package/src/common/component/editor/creators/BaseEditorCreator.js +0 -3
- package/src/common/component/editor/creators/ByReportEditorCreator.js +0 -3
- package/src/common/component/editor/creators/CustomPanelEditorCreator.js +0 -3
- package/src/common/component/editor/creators/ForeignKeyEditorCreator.js +0 -3
- package/src/common/component/editor/creators/NoteEditorCreator.js +0 -3
- package/src/common/component/editor/creators/NumberEditorCreator.js +17 -4
- package/src/common/component/editor/creators/SimpleReportEditorCreator.js +0 -3
- package/src/common/component/editor/creators/TriggerFieldEditorCreator.js +0 -3
- package/src/common/component/formeditor/UiCFCard.js +86 -0
- package/src/common/component/formeditor/UiCFCardsGrid.js +69 -0
- package/src/common/component/formeditor/UiCFCell.js +12 -0
- package/src/common/component/formeditor/UiCFCellController.js +236 -0
- package/src/common/component/formeditor/UiCFCheckboxGroup.js +53 -0
- package/src/common/component/formeditor/UiCFContainer.js +15 -0
- package/src/common/component/formeditor/UiCFContainerController.js +217 -0
- package/src/common/component/formeditor/UiCFFieldsConfig.js +342 -0
- package/src/common/component/formeditor/UiCFRadioGrid.js +70 -0
- package/src/common/component/formeditor/UiCFRadioGroup.js +53 -0
- package/src/common/component/formeditor/UiCFReportField.js +48 -0
- package/src/common/component/formeditor/UiCFRow.js +13 -0
- package/src/common/component/formeditor/UiCFRowController.js +155 -0
- package/src/common/component/formeditor/UiCFSegmentedButton.js +62 -0
- package/src/common/component/formeditor/UiCFSegmentedButtonGrid.js +70 -0
- package/src/common/component/formeditor/UiCFSettingsWindow.js +62 -0
- package/src/common/component/formeditor/UiCFSpacer.js +8 -0
- package/src/common/component/formeditor/UiCFTab.js +51 -0
- package/src/common/component/formeditor/UiCustomForm.js +33 -0
- package/src/common/component/formeditor/UiCustomFormController.js +6 -0
- package/src/common/component/formeditor/UiCustomFormEditor.js +191 -0
- package/src/common/component/formeditor/UiCustomFormEditor.scss +13 -0
- package/src/common/component/formeditor/UiCustomFormEditorController.js +654 -0
- package/src/common/component/formeditor/UiCustomFormEditorView.js +7 -0
- package/src/report/component/settings/plugin/ReportFormPluginPanelController.js +1 -1
- package/src/report/plugin/grid/ReportColumnStatePlugin.js +18 -2
- package/src/uielement/component/SearchByPropCombo.js +53 -0
- package/src/uielement/plugin/UnifiedButtonToolbarPlugin.js +19 -2
- package/src/uielement/plugin/configPanel/MethodChainPluginConfigPanelFormEditor.js +10 -6
- package/src/uielement/plugin/configPanel/UnifiedButtonToolbarPluginConfigPanelFormEditor.js +34 -46
- package/src/version.js +1 -1
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
Ext.define('Coon.common.component.formeditor.UiCustomFormEditorController', {
|
|
2
|
+
extend: 'Ext.app.ViewController',
|
|
3
|
+
alias: 'controller.UiCustomFormEditorController',
|
|
4
|
+
pinned: false,
|
|
5
|
+
uiElement: {
|
|
6
|
+
xtype: 'UiCustomForm',
|
|
7
|
+
id: null,
|
|
8
|
+
description: null,
|
|
9
|
+
},
|
|
10
|
+
activeResizer: null,
|
|
11
|
+
paramsList: {},
|
|
12
|
+
init(view) {
|
|
13
|
+
this.getViewModel().bind('{viewMode}', 'changeViewMode', this);
|
|
14
|
+
this.getViewModel().bind('{description}', (description) => {
|
|
15
|
+
const window = this.getView().up('WindowWrap');
|
|
16
|
+
if (window) {
|
|
17
|
+
window.setTitle(description ? 'Редактирование формы '+ description : 'Создание новой формы');
|
|
18
|
+
}
|
|
19
|
+
}, this);
|
|
20
|
+
this.getViewModel().bind('{focusedField}', 'loadSettingsForm', this);
|
|
21
|
+
this.getViewModel().bind('{focusedFieldXType}', 'showXTypeSettingsForm', this);
|
|
22
|
+
const params = view.initialConfig && view.initialConfig.launchConfig ? view.initialConfig.launchConfig.params : {};
|
|
23
|
+
const inputParamsArr = Object.keys(params).map(function(item) {
|
|
24
|
+
return {name: item};
|
|
25
|
+
});
|
|
26
|
+
this.inputParameters = function() {
|
|
27
|
+
return inputParamsArr && inputParamsArr.length ? inputParamsArr : [
|
|
28
|
+
{name: 'UiCustomForm'},
|
|
29
|
+
{name: 'mode'}
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getParamsList(params) {
|
|
34
|
+
const list = {};
|
|
35
|
+
this.inputParameters().map((item, index) => {
|
|
36
|
+
list[item['name']] = params[index];
|
|
37
|
+
});
|
|
38
|
+
return list;
|
|
39
|
+
},
|
|
40
|
+
doInit(...params) {
|
|
41
|
+
this.showWindowWrapTools();
|
|
42
|
+
this.paramsList = this.getParamsList(params);
|
|
43
|
+
if (this.paramsList['UiCustomForm']) {
|
|
44
|
+
this.getViewModel().set('UI_ELEMENT_CD', this.paramsList['UiCustomForm']);
|
|
45
|
+
const command = Ext.create('Coon.uielement.command.GetUIElementCommand');
|
|
46
|
+
command.on('complete', function(response) {
|
|
47
|
+
if (response) {
|
|
48
|
+
this.getViewModel().set('description', response['description']);
|
|
49
|
+
const data = response.propertyData !== '{}' ? JSON.parse(response.propertyData) : null;
|
|
50
|
+
if (data) {
|
|
51
|
+
this.getView().down('UiCFContainer').add(data.items || []);
|
|
52
|
+
}
|
|
53
|
+
this.uiElement = response;
|
|
54
|
+
}
|
|
55
|
+
}, this);
|
|
56
|
+
command.execute(this.paramsList['UiCustomForm']);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
onSettingsClick() {
|
|
60
|
+
const vm = this.getViewModel();
|
|
61
|
+
if (!this.settingsWindow) {
|
|
62
|
+
this.settingsWindow = Ext.create({xtype: 'UiCFSettingsWindow'});
|
|
63
|
+
this.settingsWindow.on('applySettings', this.applySettingsUi, this);
|
|
64
|
+
}
|
|
65
|
+
this.settingsWindow.loadFormData({UI_ELEMENT_CD: vm.get('UI_ELEMENT_CD'), description: vm.get('description')});
|
|
66
|
+
this.settingsWindow.show();
|
|
67
|
+
},
|
|
68
|
+
applySettingsUi(params) {
|
|
69
|
+
this.getViewModel().set(params);
|
|
70
|
+
},
|
|
71
|
+
showWindowWrapTools() {
|
|
72
|
+
const me = this;
|
|
73
|
+
if (this.getView().up().xtype === 'WindowWrap') {
|
|
74
|
+
const header = this.getView().up().header;
|
|
75
|
+
Ext.ComponentQuery.query('[dataType=widgetPanelBtn]', header).map((item) => {
|
|
76
|
+
item.destroy();
|
|
77
|
+
});
|
|
78
|
+
this.getView().up().header.insert(1, {
|
|
79
|
+
xtype: 'tool',
|
|
80
|
+
tooltip: 'Сохранить',
|
|
81
|
+
dataType: 'widgetPanelBtn',
|
|
82
|
+
reference: 'saveToolButton',
|
|
83
|
+
handler: me.saveForm.bind(me),
|
|
84
|
+
iconCls: 'svg-icon-tool svg-icon-save-view',
|
|
85
|
+
});
|
|
86
|
+
this.getView().up().header.insert(2, {
|
|
87
|
+
xtype: 'tool',
|
|
88
|
+
dataType: 'widgetPanelBtn',
|
|
89
|
+
tooltip: 'Настройки',
|
|
90
|
+
handler: me.onSettingsClick.bind(me),
|
|
91
|
+
iconCls: 'svg-icon-tool svg-icon-settings',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
applySettings() {
|
|
96
|
+
const field = this.getViewModel().get('focusedField');
|
|
97
|
+
if (!field) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const cfg = this.getMergedCfg(field, true);
|
|
101
|
+
if (this.getViewModel().get('viewMode') === true) {
|
|
102
|
+
if (cfg.hidden) {
|
|
103
|
+
cfg.hiddenFake = true;
|
|
104
|
+
delete cfg['hidden'];
|
|
105
|
+
}
|
|
106
|
+
if (cfg.disabled) {
|
|
107
|
+
cfg.disabledFake = true;
|
|
108
|
+
delete cfg['disabled'];
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
if (cfg.hidden) {
|
|
112
|
+
field.up('UiCFCell').setHidden(true);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const UiCFCell = field.up('UiCFCell');
|
|
117
|
+
UiCFCell.removeAll();
|
|
118
|
+
UiCFCell.add(cfg);
|
|
119
|
+
const cmp = UiCFCell.down();
|
|
120
|
+
if (cmp) {
|
|
121
|
+
const vm = this.getViewModel();
|
|
122
|
+
const currentField = vm.get('focusedField');
|
|
123
|
+
if (currentField && currentField.el && currentField.el.dom) {
|
|
124
|
+
currentField.removeCls('selectedField');
|
|
125
|
+
}
|
|
126
|
+
vm.set('focusedField', cmp);
|
|
127
|
+
cmp.addCls('selectedField');
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
getMergedCfg(field, applyFormValues) {
|
|
131
|
+
if (!field) {
|
|
132
|
+
return {};
|
|
133
|
+
}
|
|
134
|
+
const cfg = Object.keys(Coon.UiCFFieldsConfig.getFieldCfg(field.xtype));
|
|
135
|
+
const userCfgFields = Object.keys(Coon.UiCFFieldsConfig.getFieldUserCfg(field.xtype));
|
|
136
|
+
const resCfg = {xtype: field.xtype, cls: userCfgFields.length ? 'componentTarget' : field.cls};
|
|
137
|
+
Ext.Array.unique(
|
|
138
|
+
cfg.concat(
|
|
139
|
+
userCfgFields
|
|
140
|
+
)).forEach((item) => {
|
|
141
|
+
if (typeof field[item] !== 'undefined') {
|
|
142
|
+
resCfg[item] = field[item];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (applyFormValues === true) {
|
|
146
|
+
const cardsSettingsGrid = this.lookup('settingsForm').down('UiCFCardsGrid');
|
|
147
|
+
if (cardsSettingsGrid) {
|
|
148
|
+
Ext.apply(resCfg, {countCards: cardsSettingsGrid.getFormData()});
|
|
149
|
+
}
|
|
150
|
+
const UiCFRadioGrid = this.lookup('settingsForm').down('UiCFRadioGrid');
|
|
151
|
+
if (UiCFRadioGrid) {
|
|
152
|
+
resCfg.countCards = UiCFRadioGrid.getFormData();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const UiCFSegmentedButtonGrid = this.lookup('settingsForm').down('UiCFSegmentedButtonGrid');
|
|
156
|
+
if (UiCFSegmentedButtonGrid) {
|
|
157
|
+
resCfg.countCards = UiCFSegmentedButtonGrid.getFormData();
|
|
158
|
+
}
|
|
159
|
+
Ext.apply(resCfg, Coon.Function.getDataFromForm(this.lookup('settingsForm')));
|
|
160
|
+
}
|
|
161
|
+
if (field.items && field.items.length) {
|
|
162
|
+
resCfg['items'] = field.items.items.map((item) => {
|
|
163
|
+
return this.getMergedCfg(item);
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
delete resCfg['items'];
|
|
167
|
+
}
|
|
168
|
+
if (field.plugins && field.plugins.length) {
|
|
169
|
+
resCfg['plugins'] = field.plugins.map((item) => {
|
|
170
|
+
return item.ptype;
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
delete resCfg['plugins'];
|
|
174
|
+
}
|
|
175
|
+
if (!resCfg.cls) {
|
|
176
|
+
delete resCfg['cls'];
|
|
177
|
+
}
|
|
178
|
+
if (resCfg.xtype === 'panel' && field.initialConfig.layout) {
|
|
179
|
+
resCfg.layout = field.initialConfig.layout;
|
|
180
|
+
} else {
|
|
181
|
+
delete resCfg['layout'];
|
|
182
|
+
}
|
|
183
|
+
if ((resCfg.xtype === 'panel' || resCfg.xtype === 'button' || resCfg.xtype === 'radiofield' || resCfg.xtype === 'radio' ||
|
|
184
|
+
resCfg.xtype === 'tabpanel' || resCfg.xtype === 'checkboxfield' || resCfg.xtype === 'checkbox') &&
|
|
185
|
+
field.initialConfig.itemId) {
|
|
186
|
+
resCfg.itemId = field.initialConfig.itemId;
|
|
187
|
+
}
|
|
188
|
+
if (resCfg.xtype === 'button') {
|
|
189
|
+
if (field.up().name) {
|
|
190
|
+
resCfg.name = field.up().name;
|
|
191
|
+
}
|
|
192
|
+
if (field.initialConfig.text) {
|
|
193
|
+
resCfg.text = field.initialConfig.text;
|
|
194
|
+
}
|
|
195
|
+
if (field.initialConfig.value) {
|
|
196
|
+
resCfg.value = field.initialConfig.value;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (resCfg.xtype === 'radiofield' || resCfg.xtype === 'checkboxfield' || resCfg.xtype === 'radio' || resCfg.xtype === 'checkbox') {
|
|
200
|
+
if (field.up().name) {
|
|
201
|
+
resCfg.name = field.up().name;
|
|
202
|
+
}
|
|
203
|
+
if (field.initialConfig.boxLabel) {
|
|
204
|
+
resCfg.boxLabel = field.initialConfig.boxLabel;
|
|
205
|
+
}
|
|
206
|
+
if (field.initialConfig.inputValue) {
|
|
207
|
+
resCfg.inputValue = field.initialConfig.inputValue;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (field.xtype === 'UiCFCell') {
|
|
211
|
+
resCfg.flex = field.flex;
|
|
212
|
+
if (field.hidden) {
|
|
213
|
+
resCfg.hidden = field.hidden;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return JSON.parse(JSON.stringify(resCfg));
|
|
217
|
+
},
|
|
218
|
+
getCfg(field) {
|
|
219
|
+
if (!field) {
|
|
220
|
+
return {};
|
|
221
|
+
}
|
|
222
|
+
const cfg = Object.keys(Coon.UiCFFieldsConfig.getFieldCfg(field.xtype));
|
|
223
|
+
const userCfgFields = Object.keys(Coon.UiCFFieldsConfig.getFieldUserCfg(field.xtype));
|
|
224
|
+
const resCfg = {xtype: field.xtype, cls: userCfgFields.length ? 'componentTarget' : field.cls};
|
|
225
|
+
Ext.Array.unique(
|
|
226
|
+
cfg.concat(
|
|
227
|
+
userCfgFields
|
|
228
|
+
)).forEach((item) => {
|
|
229
|
+
if (typeof field[item] !== 'undefined') {
|
|
230
|
+
resCfg[item] = field[item];
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
if (field.items && field.items.length) {
|
|
234
|
+
resCfg['items'] = field.items.items.map((item) => {
|
|
235
|
+
return this.getCfg(item);
|
|
236
|
+
});
|
|
237
|
+
} else {
|
|
238
|
+
delete resCfg['items'];
|
|
239
|
+
}
|
|
240
|
+
if (field.plugins && field.plugins.length) {
|
|
241
|
+
resCfg['plugins'] = field.plugins.map((item) => {
|
|
242
|
+
return item.ptype;
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
delete resCfg['plugins'];
|
|
246
|
+
}
|
|
247
|
+
if ((resCfg.xtype === 'panel' || resCfg.xtype === 'button' ||
|
|
248
|
+
resCfg.xtype === 'radiofield' || resCfg.xtype === 'radio' || resCfg.xtype === 'checkbox' ||
|
|
249
|
+
resCfg.xtype === 'checkboxfield' || resCfg.xtype === 'tabpanel') &&
|
|
250
|
+
field.initialConfig.itemId) {
|
|
251
|
+
resCfg.itemId = field.initialConfig.itemId;
|
|
252
|
+
}
|
|
253
|
+
if (resCfg.xtype === 'button') {
|
|
254
|
+
if (field.up().name) {
|
|
255
|
+
resCfg.name = field.up().name;
|
|
256
|
+
}
|
|
257
|
+
if (field.initialConfig.text) {
|
|
258
|
+
resCfg.text = field.initialConfig.text;
|
|
259
|
+
}
|
|
260
|
+
if (field.initialConfig.value) {
|
|
261
|
+
resCfg.value = field.initialConfig.value;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (resCfg.xtype === 'radiofield' || resCfg.xtype === 'checkboxfield' || resCfg.xtype === 'radio' || resCfg.xtype === 'checkbox') {
|
|
265
|
+
if (field.up().name) {
|
|
266
|
+
resCfg.name = field.up().name;
|
|
267
|
+
}
|
|
268
|
+
if (field.initialConfig.boxLabel) {
|
|
269
|
+
resCfg.boxLabel = field.initialConfig.boxLabel;
|
|
270
|
+
}
|
|
271
|
+
if (field.initialConfig.inputValue) {
|
|
272
|
+
resCfg.inputValue = field.initialConfig.inputValue;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (!resCfg.cls) {
|
|
276
|
+
delete resCfg['cls'];
|
|
277
|
+
}
|
|
278
|
+
delete resCfg['layout'];
|
|
279
|
+
if (field.xtype === 'UiCFCell') {
|
|
280
|
+
resCfg.flex = field.flex;
|
|
281
|
+
}
|
|
282
|
+
return JSON.parse(JSON.stringify(resCfg));
|
|
283
|
+
},
|
|
284
|
+
loadSettingsForm(field) {
|
|
285
|
+
const form = this.lookup('settingsForm');
|
|
286
|
+
form.removeAll();
|
|
287
|
+
if (field) {
|
|
288
|
+
field.up('UiCFCell').getController().setResizer();
|
|
289
|
+
this.getViewModel().set('focusedFieldXType', field.xtype);
|
|
290
|
+
const doForm = () => {
|
|
291
|
+
const cfg = Ext.apply(Coon.UiCFFieldsConfig.getFieldUserCfg(field.xtype), Coon.UiCFFieldsConfig.defaultCfg);
|
|
292
|
+
const viewMode = this.getViewModel().get('viewMode');
|
|
293
|
+
if (cfg) {
|
|
294
|
+
Object.keys(cfg).forEach((key) => {
|
|
295
|
+
const cmp = cfg[key];
|
|
296
|
+
let tmpKey = null;
|
|
297
|
+
if (viewMode === true) {
|
|
298
|
+
if (key === 'hidden') {
|
|
299
|
+
tmpKey = 'hiddenFake';
|
|
300
|
+
}
|
|
301
|
+
if (key === 'disabled') {
|
|
302
|
+
tmpKey = 'disabledFake';
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const fieldCfg = JSON.parse(JSON.stringify({
|
|
306
|
+
name: key,
|
|
307
|
+
value: field[tmpKey || key],
|
|
308
|
+
fieldLabel: cmp.description,
|
|
309
|
+
}));
|
|
310
|
+
switch (cmp.type) {
|
|
311
|
+
case 'text':
|
|
312
|
+
Ext.apply(fieldCfg, {
|
|
313
|
+
xtype: 'textfield',
|
|
314
|
+
value: field[key] === false || field[key] === 'false' ? '' : field[key],
|
|
315
|
+
});
|
|
316
|
+
break;
|
|
317
|
+
case 'dateFormat':
|
|
318
|
+
Ext.apply(fieldCfg, {
|
|
319
|
+
xtype: 'combo',
|
|
320
|
+
queryMode: 'local',
|
|
321
|
+
displayField: 'key',
|
|
322
|
+
valueField: 'key',
|
|
323
|
+
store: {
|
|
324
|
+
type: 'json',
|
|
325
|
+
data: [
|
|
326
|
+
{key: 'd.m.Y'},
|
|
327
|
+
{key: 'd M Y'},
|
|
328
|
+
{key: 'M Y'},
|
|
329
|
+
{key: 'd-m-Y'},
|
|
330
|
+
{key: 'Y-m-d'},
|
|
331
|
+
{key: 'Y.m.d'}
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
break;
|
|
336
|
+
case 'date':
|
|
337
|
+
Ext.apply(fieldCfg, {
|
|
338
|
+
xtype: 'datefield',
|
|
339
|
+
});
|
|
340
|
+
break;
|
|
341
|
+
case 'timeFormat':
|
|
342
|
+
Ext.apply(fieldCfg, {
|
|
343
|
+
xtype: 'combo',
|
|
344
|
+
queryMode: 'local',
|
|
345
|
+
displayField: 'key',
|
|
346
|
+
valueField: 'key',
|
|
347
|
+
store: {
|
|
348
|
+
type: 'json',
|
|
349
|
+
data: [
|
|
350
|
+
{key: 'g:i A'},
|
|
351
|
+
{key: 'H:i'}
|
|
352
|
+
],
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
break;
|
|
356
|
+
case 'timeTextFormat':
|
|
357
|
+
Ext.apply(fieldCfg, {
|
|
358
|
+
xtype: 'combo',
|
|
359
|
+
queryMode: 'local',
|
|
360
|
+
displayField: 'key',
|
|
361
|
+
valueField: 'key',
|
|
362
|
+
store: {
|
|
363
|
+
type: 'json',
|
|
364
|
+
data: [
|
|
365
|
+
{key: 'g:i A'},
|
|
366
|
+
{key: 'H:i'}
|
|
367
|
+
],
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
break;
|
|
371
|
+
|
|
372
|
+
case 'reportsList':
|
|
373
|
+
Ext.apply(fieldCfg, {
|
|
374
|
+
xtype: 'ReportLookupCombo',
|
|
375
|
+
itemId: 'reportsList',
|
|
376
|
+
reportId: 'REPORTS',
|
|
377
|
+
valueField: 'CM_REPORT_CD',
|
|
378
|
+
displayField: 'DESCR',
|
|
379
|
+
});
|
|
380
|
+
break;
|
|
381
|
+
case 'bool':
|
|
382
|
+
fieldCfg['boxLabel'] = fieldCfg.fieldLabel;
|
|
383
|
+
delete fieldCfg['fieldLabel'];
|
|
384
|
+
Ext.apply(fieldCfg, {
|
|
385
|
+
xtype: 'checkbox',
|
|
386
|
+
inputValue: true,
|
|
387
|
+
boxLabelAlign: 'before',
|
|
388
|
+
});
|
|
389
|
+
break;
|
|
390
|
+
case 'int':
|
|
391
|
+
Ext.apply(fieldCfg, {
|
|
392
|
+
xtype: 'numberfield',
|
|
393
|
+
value: Ext.isNumber(field[key]) && field[key].toString().length <= 10 ? field[key] : null,
|
|
394
|
+
});
|
|
395
|
+
break;
|
|
396
|
+
case 'cards':
|
|
397
|
+
Ext.apply(fieldCfg, {
|
|
398
|
+
xtype: 'UiCFCardsGrid',
|
|
399
|
+
});
|
|
400
|
+
break;
|
|
401
|
+
case 'radio':
|
|
402
|
+
Ext.apply(fieldCfg, {
|
|
403
|
+
xtype: 'UiCFRadioGrid',
|
|
404
|
+
});
|
|
405
|
+
break;
|
|
406
|
+
case 'segmented':
|
|
407
|
+
Ext.apply(fieldCfg, {
|
|
408
|
+
xtype: 'UiCFSegmentedButtonGrid',
|
|
409
|
+
});
|
|
410
|
+
break;
|
|
411
|
+
case 'reportField':
|
|
412
|
+
Ext.apply(fieldCfg, {
|
|
413
|
+
xtype: 'UiCFReportField',
|
|
414
|
+
});
|
|
415
|
+
break;
|
|
416
|
+
case 'allowedExtensions':
|
|
417
|
+
Ext.apply(fieldCfg, {
|
|
418
|
+
xtype: 'tagfield',
|
|
419
|
+
submitFormat: true,
|
|
420
|
+
queryMode: 'local',
|
|
421
|
+
displayField: 'key',
|
|
422
|
+
valueField: 'key',
|
|
423
|
+
store: {
|
|
424
|
+
type: 'json',
|
|
425
|
+
data: [
|
|
426
|
+
{key: 'xls'},
|
|
427
|
+
{key: 'xlsx'},
|
|
428
|
+
{key: 'doc'},
|
|
429
|
+
{key: 'docx'},
|
|
430
|
+
{key: 'pdf'},
|
|
431
|
+
{key: 'txt'},
|
|
432
|
+
{key: 'csv'},
|
|
433
|
+
{key: 'jpeg'},
|
|
434
|
+
{key: 'jpg'},
|
|
435
|
+
{key: 'png'},
|
|
436
|
+
{key: 'ico'}
|
|
437
|
+
],
|
|
438
|
+
},
|
|
439
|
+
});
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
form.add(fieldCfg);
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
if (!Coon.UiCFFieldsConfig.settingsIsLoaded) {
|
|
447
|
+
Coon.UiCFFieldsConfig.getCfgFromStorage().then((data) => {
|
|
448
|
+
doForm();
|
|
449
|
+
});
|
|
450
|
+
} else {
|
|
451
|
+
doForm();
|
|
452
|
+
}
|
|
453
|
+
} else {
|
|
454
|
+
this.getViewModel().set('focusedFieldXType', null);
|
|
455
|
+
if (this.activeResizer) {
|
|
456
|
+
this.activeResizer.destroy();
|
|
457
|
+
this.activeResizer = null;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
recursiveGetProps(field) {
|
|
462
|
+
if (!field || !field.self) {
|
|
463
|
+
return [];
|
|
464
|
+
}
|
|
465
|
+
return Object.getOwnPropertyNames(field.self.prototype).
|
|
466
|
+
concat(Object.getOwnPropertyNames(field.self), this.recursiveGetProps(field['__proto__']));
|
|
467
|
+
},
|
|
468
|
+
getAllProperties(xtype) {
|
|
469
|
+
if (Coon.UiCFFieldsConfig.propsCfg && Coon.UiCFFieldsConfig.propsCfg[xtype] && Coon.UiCFFieldsConfig.propsCfg[xtype].length) {
|
|
470
|
+
return Coon.UiCFFieldsConfig.propsCfg[xtype];
|
|
471
|
+
}
|
|
472
|
+
const field = Ext.create('widget.' + xtype, {checkOptions: true});
|
|
473
|
+
const exceptions = [
|
|
474
|
+
'superclass',
|
|
475
|
+
'defaultConfig',
|
|
476
|
+
'config',
|
|
477
|
+
'noClearOnDestroy',
|
|
478
|
+
'alias',
|
|
479
|
+
'alternateClassName',
|
|
480
|
+
'requires',
|
|
481
|
+
'componentLayout',
|
|
482
|
+
'ariaRole',
|
|
483
|
+
'xtype',
|
|
484
|
+
'xtypes',
|
|
485
|
+
'xtypesChain',
|
|
486
|
+
'xtypesMap',
|
|
487
|
+
'fakeSizeModel',
|
|
488
|
+
'successUserEditingOptions',
|
|
489
|
+
'defaultListenerScope',
|
|
490
|
+
'childEls'
|
|
491
|
+
];
|
|
492
|
+
const data = Ext.Array.unique(this.recursiveGetProps(field)).reduce((acc, item) => {
|
|
493
|
+
if (typeof field[item] !== 'function' && exceptions.indexOf(item) < 0 &&
|
|
494
|
+
item.indexOf('_') !== 0 && item.indexOf('$') !== 0) {
|
|
495
|
+
acc.push(item);
|
|
496
|
+
}
|
|
497
|
+
return acc;
|
|
498
|
+
}, []);
|
|
499
|
+
field.destroy();
|
|
500
|
+
Coon.UiCFFieldsConfig.propsCfg[xtype] = data;
|
|
501
|
+
return data;
|
|
502
|
+
},
|
|
503
|
+
detectPropertyType(val) {
|
|
504
|
+
if (Ext.isNumber(val)) {
|
|
505
|
+
return 'int';
|
|
506
|
+
} else if (Ext.isBoolean(val)) {
|
|
507
|
+
return 'bool';
|
|
508
|
+
} else {
|
|
509
|
+
return 'text';
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
applyXTypeSettings() {
|
|
513
|
+
const field = this.getViewModel().get('focusedField');
|
|
514
|
+
const props ={};
|
|
515
|
+
this.getViewModel().getStore('configStore').getFilters().removeAll();
|
|
516
|
+
this.getViewModel().getStore('configStore').getData().items.
|
|
517
|
+
filter((rec) => rec.get('visible') === true).
|
|
518
|
+
forEach((item) => {
|
|
519
|
+
props[item.get('property')] = {
|
|
520
|
+
type: item.get('type'),
|
|
521
|
+
description: item.get('title') ? item.get('title') : item.get('property'),
|
|
522
|
+
text: item.get('description'),
|
|
523
|
+
};
|
|
524
|
+
});
|
|
525
|
+
const setter = Coon.UiCFFieldsConfig.setFieldUserCfg(field.xtype, props);
|
|
526
|
+
if (setter !== false) {
|
|
527
|
+
setter.then(() => {
|
|
528
|
+
this.loadSettingsForm(field);
|
|
529
|
+
this.getViewModel().set('activeForm', 0);
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
showXTypeSettingsForm() {
|
|
534
|
+
const field = this.getViewModel().get('focusedField');
|
|
535
|
+
const store = this.getViewModel().getStore('configStore');
|
|
536
|
+
if (!field) {
|
|
537
|
+
store.removeAll();
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const doForm = () => {
|
|
542
|
+
const ownCfg = Coon.UiCFFieldsConfig.getOwnProperties(field.xtype);
|
|
543
|
+
const props = this.getAllProperties(field.xtype).concat(Object.keys(ownCfg));
|
|
544
|
+
const fieldCfg = Coon.UiCFFieldsConfig.getFieldUserCfg(field.xtype);
|
|
545
|
+
const data = props.sort().map((item) => {
|
|
546
|
+
return {
|
|
547
|
+
key: field.xtype,
|
|
548
|
+
visible: typeof fieldCfg[item] !== 'undefined' ? true : false,
|
|
549
|
+
property: item,
|
|
550
|
+
title: typeof fieldCfg[item] !== 'undefined' ? fieldCfg[item]['description'] :
|
|
551
|
+
typeof ownCfg[item] !== 'undefined' ? ownCfg[item]['description'] : '',
|
|
552
|
+
description: typeof fieldCfg[item] !== 'undefined' ? fieldCfg[item]['text'] :
|
|
553
|
+
typeof ownCfg[item] !== 'undefined' ? ownCfg[item]['text'] : '',
|
|
554
|
+
type: typeof fieldCfg[item] !== 'undefined' ? fieldCfg[item]['type'] :
|
|
555
|
+
typeof ownCfg[item] !== 'undefined' ? ownCfg[item]['type'] : this.detectPropertyType(field[item]),
|
|
556
|
+
};
|
|
557
|
+
});
|
|
558
|
+
store.loadData(data);
|
|
559
|
+
};
|
|
560
|
+
if (!Coon.UiCFFieldsConfig.settingsIsLoaded) {
|
|
561
|
+
Coon.UiCFFieldsConfig.getCfgFromStorage().then((data) => {
|
|
562
|
+
doForm();
|
|
563
|
+
});
|
|
564
|
+
} else {
|
|
565
|
+
doForm();
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
saveForm() {
|
|
569
|
+
const vm = this.getViewModel();
|
|
570
|
+
if (!vm.get('UI_ELEMENT_CD') || !vm.get('description')) {
|
|
571
|
+
this.onSettingsClick();
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
this.uiElement.id = vm.get('UI_ELEMENT_CD');
|
|
575
|
+
this.uiElement.description = vm.get('description');
|
|
576
|
+
this.uiElement.propertyData = JSON.stringify(this.getMergedCfg(this.getView().down('UiCFContainer')));
|
|
577
|
+
const command = Ext.create('command.SaveUIElementCommand');
|
|
578
|
+
command.on('complete', function(uiElementBean) {
|
|
579
|
+
Ext.Msg.alert('Успех', 'Данные успешно сохранены');
|
|
580
|
+
}, this);
|
|
581
|
+
command.execute(this.uiElement);
|
|
582
|
+
},
|
|
583
|
+
onSettingsRender(cmp) {
|
|
584
|
+
cmp.query('header').forEach((header) => {
|
|
585
|
+
header.setStyle({
|
|
586
|
+
cursor: 'pointer',
|
|
587
|
+
});
|
|
588
|
+
header.on('click', () => {
|
|
589
|
+
const panel = this.lookup('settingsPanel');
|
|
590
|
+
if (!this.getPinned()) {
|
|
591
|
+
panel.setCollapsed(!panel.getCollapsed());
|
|
592
|
+
}
|
|
593
|
+
}, this);
|
|
594
|
+
});
|
|
595
|
+
},
|
|
596
|
+
|
|
597
|
+
getPinned() {
|
|
598
|
+
return this.pinned;
|
|
599
|
+
},
|
|
600
|
+
setPinned(state) {
|
|
601
|
+
this.pinned = state;
|
|
602
|
+
const tool = this.lookup('settingsPanel').tools.find((el) => el.itemId === 'pinned');
|
|
603
|
+
if (tool) {
|
|
604
|
+
if (typeof tool.setType === 'function') {
|
|
605
|
+
tool.setType(state ? 'unpin' : 'pin');
|
|
606
|
+
} else {
|
|
607
|
+
tool.type = state ? 'unpin' : 'pin';
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
changeViewMode(viewMode) {
|
|
612
|
+
const saveBtns = Ext.ComponentQuery.query('[reference="saveToolButton"]', this.getView().up().header);
|
|
613
|
+
if (saveBtns.length) {
|
|
614
|
+
saveBtns[0].setHidden(viewMode === true);
|
|
615
|
+
}
|
|
616
|
+
const doAction = () => {
|
|
617
|
+
const panel = this.getView().down('UiCFContainer');
|
|
618
|
+
const hiddenElems = Ext.ComponentQuery.query(viewMode === true ? '[hidden=true]' : '[hiddenFake=true]', panel);
|
|
619
|
+
const disabledElems = Ext.ComponentQuery.query(viewMode === true ? '[disabled=true]' : '[disabledFake=true]', panel);
|
|
620
|
+
const fieldsNames = Coon.UiCFFieldsConfig.getFieldsNames();
|
|
621
|
+
hiddenElems.forEach((cmp) => {
|
|
622
|
+
if (fieldsNames.indexOf(cmp.xtype) >= 0) {
|
|
623
|
+
cmp.setHidden(viewMode !== true);
|
|
624
|
+
const UiCFCell = cmp.up();
|
|
625
|
+
if (UiCFCell.xtype === 'UiCFCell') {
|
|
626
|
+
UiCFCell.setHidden(viewMode !== true);
|
|
627
|
+
if (viewMode === true) {
|
|
628
|
+
cmp.hiddenFake = true;
|
|
629
|
+
} else {
|
|
630
|
+
delete cmp['hiddenFake'];
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
disabledElems.forEach((cmp) => {
|
|
636
|
+
if (fieldsNames.indexOf(cmp.xtype) >= 0) {
|
|
637
|
+
cmp.setDisabled(viewMode !== true);
|
|
638
|
+
if (viewMode === true) {
|
|
639
|
+
cmp.disabledFake = true;
|
|
640
|
+
} else {
|
|
641
|
+
delete cmp['disabledFake'];
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
if (!Coon.UiCFFieldsConfig.settingsIsLoaded) {
|
|
647
|
+
Coon.UiCFFieldsConfig.getCfgFromStorage().then((data) => {
|
|
648
|
+
doAction();
|
|
649
|
+
});
|
|
650
|
+
} else {
|
|
651
|
+
doAction();
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
});
|
|
@@ -107,7 +107,7 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanelControlle
|
|
|
107
107
|
Coon.report.plugin.util.getConfigPanelClassName(
|
|
108
108
|
xtype,
|
|
109
109
|
this.getViewModel().get('formEditor')
|
|
110
|
-
) || 'SpecificPluginConfig',
|
|
110
|
+
) || 'widget.SpecificPluginConfig',
|
|
111
111
|
{
|
|
112
112
|
readOnly: record.get('readOnly'),
|
|
113
113
|
isNew: record.get('isNew'),
|