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,342 @@
|
|
|
1
|
+
Ext.define('Coon.common.component.formeditor.UiCFFieldsConfig', {
|
|
2
|
+
alternateClassName: 'Coon.UiCFFieldsConfig',
|
|
3
|
+
singleton: true,
|
|
4
|
+
storageElemId: 'UiCFFieldsCfg',
|
|
5
|
+
storageElem: null,
|
|
6
|
+
settingsIsLoaded: false,
|
|
7
|
+
propsCfg: {},
|
|
8
|
+
defaultCfg: {
|
|
9
|
+
name: {
|
|
10
|
+
type: 'text',
|
|
11
|
+
description: 'Name',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
applyDefaultCfg(cfg) {
|
|
15
|
+
if (cfg && Ext.isObject(cfg) && Object.keys(cfg).length) {
|
|
16
|
+
this.UiCFFieldsConfig = Ext.applyIf(cfg, this.UiCFFieldsConfig);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
getCfgFromStorage() {
|
|
20
|
+
return Coon.util.promisifyCmd('command.GetUIElementCommand', this.storageElemId).then((data) => {
|
|
21
|
+
this.storageElem = data;
|
|
22
|
+
this.applyDefaultCfg(data && data.propertyData ? JSON.parse(data.propertyData) :{});
|
|
23
|
+
this.settingsIsLoaded = true;
|
|
24
|
+
}).catch((error) => {
|
|
25
|
+
Coon.log.debug(error);
|
|
26
|
+
Ext.Msg.alert('Ошибка', error.toString());
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
setCfgToStorage(cfg) {
|
|
30
|
+
this.storageElem.propertyData = JSON.stringify(cfg || {});
|
|
31
|
+
return Coon.util.promisifyCmd('command.SaveUIElementCommand', this.storageElem).catch((error) => {
|
|
32
|
+
Coon.log.debug(error);
|
|
33
|
+
Ext.Msg.alert('Ошибка', error.toString());
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
UiCFFieldsConfig: {
|
|
37
|
+
textfield: {
|
|
38
|
+
description: 'Текстовое поле',
|
|
39
|
+
cfg: {
|
|
40
|
+
plugins: [
|
|
41
|
+
'RequiredFlagPlugin'
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
ownProperties: {
|
|
45
|
+
value: {
|
|
46
|
+
type: 'text',
|
|
47
|
+
description: 'Значение по умолчанию',
|
|
48
|
+
text: '',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
numberfield: {
|
|
53
|
+
description: 'Числовое поле',
|
|
54
|
+
cfg: {
|
|
55
|
+
plugins: [
|
|
56
|
+
'RequiredFlagPlugin'
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
ownProperties: {
|
|
60
|
+
value: {
|
|
61
|
+
type: 'text',
|
|
62
|
+
description: 'Значение по умолчанию',
|
|
63
|
+
text: '',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
datefield: {
|
|
69
|
+
description: 'Дата',
|
|
70
|
+
cfg: {
|
|
71
|
+
plugins: [
|
|
72
|
+
'RequiredFlagPlugin'
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
ownProperties: {
|
|
76
|
+
minValue: {
|
|
77
|
+
type: 'date',
|
|
78
|
+
description: 'Значение по умолчанию',
|
|
79
|
+
text: '',
|
|
80
|
+
},
|
|
81
|
+
maxValue: {
|
|
82
|
+
type: 'date',
|
|
83
|
+
description: 'Значение по умолчанию',
|
|
84
|
+
text: '',
|
|
85
|
+
},
|
|
86
|
+
value: {
|
|
87
|
+
type: 'date',
|
|
88
|
+
description: 'Значение по умолчанию',
|
|
89
|
+
text: '',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
timefield: {
|
|
94
|
+
description: 'Поле время',
|
|
95
|
+
cfg: {
|
|
96
|
+
plugins: [
|
|
97
|
+
'RequiredFlagPlugin'
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
checkbox: {
|
|
102
|
+
description: 'Чек',
|
|
103
|
+
cfg: {
|
|
104
|
+
plugins: [
|
|
105
|
+
'RequiredFlagPlugin'
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
textareafield: {
|
|
110
|
+
description: 'Текст',
|
|
111
|
+
cfg: {
|
|
112
|
+
plugins: [
|
|
113
|
+
'RequiredFlagPlugin'
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
htmleditor: {
|
|
118
|
+
description: 'HTML',
|
|
119
|
+
cfg: {
|
|
120
|
+
plugins: [
|
|
121
|
+
'RequiredFlagPlugin'
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
ExtFileUploadField: {
|
|
126
|
+
description: 'Загрузка файла',
|
|
127
|
+
cfg: {
|
|
128
|
+
plugins: [
|
|
129
|
+
'RequiredFlagPlugin'
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
fieldset: {
|
|
134
|
+
description: 'Панель',
|
|
135
|
+
cfg: {
|
|
136
|
+
items: [
|
|
137
|
+
{xtype: 'UiCFContainer'}
|
|
138
|
+
],
|
|
139
|
+
plugins: [
|
|
140
|
+
'RequiredFlagPlugin'
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
ownProperties: {
|
|
144
|
+
title: {
|
|
145
|
+
type: 'text',
|
|
146
|
+
description: 'Заголовок',
|
|
147
|
+
text: '',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
ReportLookupCombo: {
|
|
152
|
+
description: 'Выбор из отчета',
|
|
153
|
+
cfg: {
|
|
154
|
+
plugins: [
|
|
155
|
+
'RequiredFlagPlugin'
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
ownProperties: {
|
|
159
|
+
reportId: {
|
|
160
|
+
type: 'text',
|
|
161
|
+
description: 'Идентификатор отчета',
|
|
162
|
+
text: '',
|
|
163
|
+
},
|
|
164
|
+
displayField: {
|
|
165
|
+
type: 'text',
|
|
166
|
+
description: 'Поле для отображения',
|
|
167
|
+
text: '',
|
|
168
|
+
},
|
|
169
|
+
valueField: {
|
|
170
|
+
type: 'text',
|
|
171
|
+
description: 'Поле идентификатор',
|
|
172
|
+
text: '',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
SimplestReportCombo: {
|
|
177
|
+
description: 'Выпадающий список',
|
|
178
|
+
cfg: {
|
|
179
|
+
plugins: [
|
|
180
|
+
'RequiredFlagPlugin'
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
ownProperties: {
|
|
184
|
+
reportId: {
|
|
185
|
+
type: 'text',
|
|
186
|
+
description: 'Идентификатор отчета',
|
|
187
|
+
text: '',
|
|
188
|
+
},
|
|
189
|
+
displayField: {
|
|
190
|
+
type: 'text',
|
|
191
|
+
description: 'Поле для отображения',
|
|
192
|
+
text: '',
|
|
193
|
+
},
|
|
194
|
+
valueField: {
|
|
195
|
+
type: 'text',
|
|
196
|
+
description: 'Поле идентификатор',
|
|
197
|
+
text: '',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
ReportTagLookup: {
|
|
202
|
+
description: 'Мульти список',
|
|
203
|
+
cfg: {
|
|
204
|
+
plugins: [
|
|
205
|
+
'RequiredFlagPlugin'
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
ownProperties: {
|
|
209
|
+
reportId: {
|
|
210
|
+
type: 'text',
|
|
211
|
+
description: 'Идентификатор отчета',
|
|
212
|
+
text: '',
|
|
213
|
+
},
|
|
214
|
+
displayField: {
|
|
215
|
+
type: 'text',
|
|
216
|
+
description: 'Поле для отображения',
|
|
217
|
+
text: '',
|
|
218
|
+
},
|
|
219
|
+
valueField: {
|
|
220
|
+
type: 'text',
|
|
221
|
+
description: 'Поле идентификатор',
|
|
222
|
+
text: '',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
UiCFSpacer: {
|
|
227
|
+
description: 'spacer',
|
|
228
|
+
},
|
|
229
|
+
ReportPanel: {
|
|
230
|
+
description: 'Репорт',
|
|
231
|
+
ownProperties: {
|
|
232
|
+
reportId: {
|
|
233
|
+
type: 'text',
|
|
234
|
+
description: 'Идентификатор отчета',
|
|
235
|
+
text: '',
|
|
236
|
+
},
|
|
237
|
+
height: {
|
|
238
|
+
type: 'int',
|
|
239
|
+
description: 'Высота',
|
|
240
|
+
text: '',
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
UiCFCard: {
|
|
245
|
+
description: 'Card',
|
|
246
|
+
ownProperties: {
|
|
247
|
+
countCards: {
|
|
248
|
+
type: 'cards',
|
|
249
|
+
description: 'Вкладки',
|
|
250
|
+
text: '',
|
|
251
|
+
},
|
|
252
|
+
height: {
|
|
253
|
+
type: 'int',
|
|
254
|
+
description: 'Высота',
|
|
255
|
+
text: '',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
UiCFTab: {
|
|
260
|
+
description: 'Панель с вкладками',
|
|
261
|
+
ownProperties: {
|
|
262
|
+
countCards: {
|
|
263
|
+
type: 'cards',
|
|
264
|
+
description: 'Вкладки',
|
|
265
|
+
text: '',
|
|
266
|
+
},
|
|
267
|
+
height: {
|
|
268
|
+
type: 'int',
|
|
269
|
+
description: 'Высота',
|
|
270
|
+
text: '',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
UiCFSegmentedButton: {
|
|
275
|
+
description: 'Выбор значения',
|
|
276
|
+
ownProperties: {
|
|
277
|
+
countCards: {
|
|
278
|
+
type: 'segmented',
|
|
279
|
+
description: 'Вложеные кнопки',
|
|
280
|
+
text: '',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
UiCFRadioGroup: {
|
|
285
|
+
description: 'Radio',
|
|
286
|
+
ownProperties: {
|
|
287
|
+
countCards: {
|
|
288
|
+
type: 'radio',
|
|
289
|
+
description: 'Значения',
|
|
290
|
+
text: '',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
UiCFCheckboxGroup: {
|
|
295
|
+
description: 'Группа чекбоксов',
|
|
296
|
+
ownProperties: {
|
|
297
|
+
countCards: {
|
|
298
|
+
type: 'radio',
|
|
299
|
+
description: 'Значения',
|
|
300
|
+
text: '',
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
imagecomponent: {
|
|
305
|
+
description: 'Изображение',
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
getFieldsTypes() {
|
|
309
|
+
return Object.keys(this.UiCFFieldsConfig).map((key) => {
|
|
310
|
+
return {type: key, description: this.UiCFFieldsConfig[key]['description']};
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
getFieldsNames() {
|
|
314
|
+
return Object.keys(this.UiCFFieldsConfig);
|
|
315
|
+
},
|
|
316
|
+
getFieldDescription(field) {
|
|
317
|
+
return this.UiCFFieldsConfig[field] && this.UiCFFieldsConfig[field]['description'] ? this.UiCFFieldsConfig[field]['description'] : field;
|
|
318
|
+
},
|
|
319
|
+
getFieldCfg(field) {
|
|
320
|
+
return this.UiCFFieldsConfig[field] && this.UiCFFieldsConfig[field]['cfg'] ? this.UiCFFieldsConfig[field]['cfg'] : {
|
|
321
|
+
allowBlank: true,
|
|
322
|
+
fieldLabel: false,
|
|
323
|
+
};
|
|
324
|
+
},
|
|
325
|
+
getOwnPropertiesNames(field) {
|
|
326
|
+
return this.UiCFFieldsConfig[field] && this.UiCFFieldsConfig[field]['ownProperties'] ?
|
|
327
|
+
Object.keys(this.UiCFFieldsConfig[field]['ownProperties']) : [];
|
|
328
|
+
},
|
|
329
|
+
getOwnProperties(field) {
|
|
330
|
+
return this.UiCFFieldsConfig[field] && this.UiCFFieldsConfig[field]['ownProperties'] ? this.UiCFFieldsConfig[field]['ownProperties'] : {};
|
|
331
|
+
},
|
|
332
|
+
getFieldUserCfg(field) {
|
|
333
|
+
return this.UiCFFieldsConfig[field] && this.UiCFFieldsConfig[field]['userCfg'] ? this.UiCFFieldsConfig[field]['userCfg'] : {};
|
|
334
|
+
},
|
|
335
|
+
setFieldUserCfg(field, cfg) {
|
|
336
|
+
if (this.UiCFFieldsConfig[field]) {
|
|
337
|
+
this.UiCFFieldsConfig[field]['userCfg'] = Ext.isObject(cfg) ? Ext.apply(cfg, this.defaultCfg) : this.defaultCfg;
|
|
338
|
+
return this.setCfgToStorage(this.UiCFFieldsConfig);
|
|
339
|
+
}
|
|
340
|
+
return false;
|
|
341
|
+
},
|
|
342
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFRadioGrid', {
|
|
3
|
+
extend: 'Ext.grid.Panel',
|
|
4
|
+
xtype: 'UiCFRadioGrid',
|
|
5
|
+
flex: 1,
|
|
6
|
+
title: 'Значения',
|
|
7
|
+
minHeight: 100,
|
|
8
|
+
controller: {
|
|
9
|
+
init(view) {
|
|
10
|
+
const vm = this.getViewModel();
|
|
11
|
+
vm.getStore('cardsStore').on('datachanged', (store) => {
|
|
12
|
+
vm.set('dataCount', store.data.length);
|
|
13
|
+
}, this);
|
|
14
|
+
if (view.initialConfig && view.initialConfig.value) {
|
|
15
|
+
vm.getStore('cardsStore').loadData(view.initialConfig.value);
|
|
16
|
+
}
|
|
17
|
+
this.getView().getFormData = this.getFormData.bind(this);
|
|
18
|
+
},
|
|
19
|
+
getFormData() {
|
|
20
|
+
return this.getViewModel().getStore('cardsStore').getRange().map((rec) => {
|
|
21
|
+
return {boxLabel: rec.get('boxLabel'), itemId: rec.get('itemId'), inputValue: rec.get('inputValue')};
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
addRow() {
|
|
25
|
+
this.getViewModel().getStore('cardsStore').add({itemId: 'UiCFRadio_' + Ext.id().replace('-', '_')});
|
|
26
|
+
},
|
|
27
|
+
deleteRow() {
|
|
28
|
+
this.getViewModel().getStore('cardsStore').remove(this.getViewModel().get('selection'));
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
viewModel: {
|
|
32
|
+
data: {
|
|
33
|
+
selection: null,
|
|
34
|
+
dataCount: 1,
|
|
35
|
+
},
|
|
36
|
+
stores: {
|
|
37
|
+
cardsStore: {
|
|
38
|
+
type: 'json',
|
|
39
|
+
fields: ['boxLabel', 'itemId', 'inputValue'],
|
|
40
|
+
data: [
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
tbar: [
|
|
46
|
+
{
|
|
47
|
+
text: 'Добавить',
|
|
48
|
+
handler: 'addRow',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
text: 'Удалить',
|
|
52
|
+
handler: 'deleteRow',
|
|
53
|
+
bind: {
|
|
54
|
+
disabled: '{!selection || dataCount < 2}',
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
bind: {
|
|
59
|
+
store: '{cardsStore}',
|
|
60
|
+
selection: '{selection}',
|
|
61
|
+
},
|
|
62
|
+
columns: [
|
|
63
|
+
{xtype: 'rownumberer'},
|
|
64
|
+
{dataIndex: 'boxLabel', text: 'Заголовок', flex: 2, editor: {xtype: 'textfield'}},
|
|
65
|
+
{dataIndex: 'inputValue', text: 'Значение', flex: 1, editor: {xtype: 'textfield'}}
|
|
66
|
+
],
|
|
67
|
+
plugins: [
|
|
68
|
+
{ptype: 'cellediting'}
|
|
69
|
+
],
|
|
70
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFRadioGroup', {
|
|
3
|
+
extend: 'Ext.form.RadioGroup',
|
|
4
|
+
xtype: 'UiCFRadioGroup',
|
|
5
|
+
controller: {
|
|
6
|
+
init(view) {
|
|
7
|
+
let i = 1;
|
|
8
|
+
if (view.initialConfig && !view.initialConfig.checkOptions) {
|
|
9
|
+
if (view.initialConfig && view.initialConfig.countCards) {
|
|
10
|
+
view.initialConfig.countCards.forEach((setting, index) => {
|
|
11
|
+
let item = view.items.getAt(view.items.findIndex('itemId', setting.itemId));
|
|
12
|
+
if (!item) {
|
|
13
|
+
item = view.add({
|
|
14
|
+
itemId: setting.itemId,
|
|
15
|
+
inputValue: setting.inputValue,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (setting.boxLabel) {
|
|
19
|
+
item.setBoxLabel(setting.boxLabel);
|
|
20
|
+
}
|
|
21
|
+
if (setting.inputValue) {
|
|
22
|
+
item.inputValue = setting.inputValue;
|
|
23
|
+
} else {
|
|
24
|
+
item.inputValue = i++;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (view.initialConfig.countCards.length < view.items.getCount()) {
|
|
28
|
+
const ids = view.initialConfig.countCards.map((item) => item.itemId);
|
|
29
|
+
view.items.items.forEach((item) => {
|
|
30
|
+
if (ids.indexOf(item.itemId) < 0) {
|
|
31
|
+
view.remove(item);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
const itemId = 'UiCFRadio_' + Ext.id().replace('-', '_');
|
|
37
|
+
view.countCards = [
|
|
38
|
+
{
|
|
39
|
+
'itemId': itemId,
|
|
40
|
+
'inputValue': i,
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
view.add({
|
|
44
|
+
'itemId': itemId,
|
|
45
|
+
'inputValue': i,
|
|
46
|
+
});
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
items: [],
|
|
53
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Ext.define('Coon.common.component.formeditor.UiCFReportField', {
|
|
2
|
+
extend: 'Ext.form.field.ComboBox',
|
|
3
|
+
xtype: 'UiCFReportField',
|
|
4
|
+
controller: {
|
|
5
|
+
refField: null,
|
|
6
|
+
init(view) {
|
|
7
|
+
view.on('render', (view) => {
|
|
8
|
+
const form = view.up('[reference="settingsForm"]');
|
|
9
|
+
if (!form) {
|
|
10
|
+
Ext.Msg.alert('Ошибка', 'Не удалось найти форму');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const refField = form.down('[itemId="reportsList"]');
|
|
14
|
+
if (!refField) {
|
|
15
|
+
Ext.Msg.alert('Ошибка', 'Не удалось найти поле - список отчетов');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.refField = refField;
|
|
19
|
+
this.refField.on('change', this.onChangeRefField, this);
|
|
20
|
+
}, this);
|
|
21
|
+
},
|
|
22
|
+
onChangeRefField(field, value) {
|
|
23
|
+
const combo = this.getView();
|
|
24
|
+
combo.getStore().removeAll();
|
|
25
|
+
if (value) {
|
|
26
|
+
Coon.util.promisifyCmd('Coon.report.command.GetDynamicReportDataCommand',
|
|
27
|
+
'REPORT_FIELDS',
|
|
28
|
+
'[{"type":"REPORT_CD","value":"'+value+'"}]')
|
|
29
|
+
.then((data) => {
|
|
30
|
+
if (Ext.isArray(data.list)) {
|
|
31
|
+
combo.getStore().loadData(data.list);
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
.catch((error) => {
|
|
35
|
+
Coon.log.debug(error);
|
|
36
|
+
Ext.Msg.alert(error.toString());
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
queryMode: 'local',
|
|
42
|
+
displayField: 'DESCR',
|
|
43
|
+
valueField: 'REPORT_FIELD_CD',
|
|
44
|
+
store: {
|
|
45
|
+
type: 'json',
|
|
46
|
+
data: [],
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFRow', {
|
|
3
|
+
extend: 'Ext.container.Container',
|
|
4
|
+
controller: 'UiCFRowController',
|
|
5
|
+
xtype: 'UiCFRow',
|
|
6
|
+
minHeight: 20,
|
|
7
|
+
layout: {
|
|
8
|
+
type: 'hbox',
|
|
9
|
+
align: 'stretch',
|
|
10
|
+
},
|
|
11
|
+
items: [
|
|
12
|
+
],
|
|
13
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Ext.define('Coon.common.component.formeditor.UiCFRowController', {
|
|
2
|
+
extend: 'Ext.app.ViewController',
|
|
3
|
+
alias: 'controller.UiCFRowController',
|
|
4
|
+
menuItems: {},
|
|
5
|
+
|
|
6
|
+
init() {
|
|
7
|
+
this.setDefaultMenuItems();
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
setDefaultMenuItems() {
|
|
11
|
+
this.menuItems = {
|
|
12
|
+
up: {text: 'вверх', iconCls: 'fa fa-arrow-up', handler: this.moveRowUp.bind(this)},
|
|
13
|
+
down: {text: 'вниз', iconCls: 'fa fa-arrow-down', handler: this.moveRowDown.bind(this)},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
getCountRows() {
|
|
17
|
+
return this.getUiCFContainerController().getCountRows();
|
|
18
|
+
},
|
|
19
|
+
getRowIndex() {
|
|
20
|
+
return this.getUiCFContainerController().getRowIndex(this.getView());
|
|
21
|
+
},
|
|
22
|
+
getMenuItems(activeCell) {
|
|
23
|
+
const me = this;
|
|
24
|
+
const menuItems = [{
|
|
25
|
+
text: 'в строку', iconCls: 'fa fa-plus',
|
|
26
|
+
menu: Coon.UiCFFieldsConfig.getFieldsTypes().map((item) => {
|
|
27
|
+
return {
|
|
28
|
+
text: item.description,
|
|
29
|
+
iconCls: '',
|
|
30
|
+
handler: () => {
|
|
31
|
+
me.addCell(item.type, activeCell);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}),
|
|
35
|
+
}];
|
|
36
|
+
const count = this.getCountRows();
|
|
37
|
+
if (count > 1) {
|
|
38
|
+
const index = this.getRowIndex() + 1;
|
|
39
|
+
if (index > 1) {
|
|
40
|
+
menuItems.push(this.menuItems.up);
|
|
41
|
+
}
|
|
42
|
+
if (count > index) {
|
|
43
|
+
menuItems.push(this.menuItems.down);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return menuItems;
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
getUiCFContainerController() {
|
|
50
|
+
return this.getView().up('UiCFContainer').getController();
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
setFlex() {
|
|
54
|
+
const cntr = this;
|
|
55
|
+
Ext.Msg.prompt('Относительный размер', 'Укажите размер:', function(btn, text) {
|
|
56
|
+
if (btn == 'ok') {
|
|
57
|
+
if (text && Ext.isNumber(Number(text))) {
|
|
58
|
+
cntr.getView().setFlex(Number(text));
|
|
59
|
+
cntr.getView().up('UiCFContainer').updateLayout();
|
|
60
|
+
} else {
|
|
61
|
+
Ext.Msg.show({
|
|
62
|
+
title: 'Ошибка',
|
|
63
|
+
message: 'Значение должно быть числом от 0',
|
|
64
|
+
buttons: Ext.Msg.YES,
|
|
65
|
+
icon: Ext.Msg.ERROR,
|
|
66
|
+
});
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, this, false, this.getView().flex || 0);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
addCell(type, activeCell) {
|
|
74
|
+
let cfg = null;
|
|
75
|
+
if (!Ext.isObject(type)) {
|
|
76
|
+
cfg = {
|
|
77
|
+
xtype: 'UiCFCell',
|
|
78
|
+
items: [Ext.apply({
|
|
79
|
+
xtype: type,
|
|
80
|
+
name: type + '-' + (this.getUiCFContainerController().getCountElemsByXtype(type) + 1),
|
|
81
|
+
cls: 'componentTarget',
|
|
82
|
+
}, Coon.UiCFFieldsConfig.getFieldCfg(type))],
|
|
83
|
+
};
|
|
84
|
+
} else {
|
|
85
|
+
cfg = type;
|
|
86
|
+
}
|
|
87
|
+
const view = this.getView();
|
|
88
|
+
if (activeCell) {
|
|
89
|
+
view.insert(this.getCellIndexInRow(activeCell) + 1, cfg);
|
|
90
|
+
activeCell.getController().setResizer();
|
|
91
|
+
} else {
|
|
92
|
+
view.add(cfg);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
removeCell(cell) {
|
|
97
|
+
this.getViewModel().set('focusedField', null);
|
|
98
|
+
if (this.getCountCells() > 1) {
|
|
99
|
+
this.getView().remove(this.getCellIndexInRow(cell));
|
|
100
|
+
} else {
|
|
101
|
+
this.getUiCFContainerController().removeRow(this.getView());
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
moveRowUp(direction) {
|
|
106
|
+
this.getUiCFContainerController().moveRow(this.getView(), 'up');
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
moveRowDown(direction) {
|
|
110
|
+
this.getUiCFContainerController().moveRow(this.getView(), 'down');
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
moveCell(cell, direction) {
|
|
114
|
+
const cellIndexInRow = this.getCellIndexInRow(cell);
|
|
115
|
+
const view = this.getView();
|
|
116
|
+
const countCells = this.getCountCells();
|
|
117
|
+
if (countCells > 1) {
|
|
118
|
+
if (direction === 'left') {
|
|
119
|
+
view.moveBefore(cell, view.items.getAt(cellIndexInRow - 1));
|
|
120
|
+
} else {
|
|
121
|
+
view.moveAfter(cell, view.items.getAt(cellIndexInRow + 1));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
getCountCells() {
|
|
127
|
+
return this.getView().items.length;
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
getCellIndexInRow(cell) {
|
|
131
|
+
return this.getView().items.indexOfKey(cell.id);
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
getCells() {
|
|
135
|
+
return this.getView().items.getRange();
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
layoutCellsInRow() {
|
|
139
|
+
this.getCells().forEach((cell) => {
|
|
140
|
+
cell.setFlex(200);
|
|
141
|
+
});
|
|
142
|
+
this.getView().updateLayout();
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
layoutByTemplate() {
|
|
146
|
+
const uiCFContainerController = this.getUiCFContainerController();
|
|
147
|
+
const cells = this.getCells();
|
|
148
|
+
const flexMatrix = cells.map((cell) => cell.flex);
|
|
149
|
+
uiCFContainerController.getRows().filter(
|
|
150
|
+
(row) => row.items.length === cells.length && row.id !== this.getView().id
|
|
151
|
+
).forEach((row) => row.items.getRange().forEach((cell, index) => cell.setFlex(flexMatrix[index])));
|
|
152
|
+
this.getView().updateLayout();
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
});
|