ru.coon 2.6.6 → 2.6.8
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/.eslintrc.js +1 -0
- package/CHANGELOG.md +19 -0
- package/index.js +0 -1
- package/package.json +1 -1
- package/src/Function.js +1 -1
- package/src/common/component/editor/EditorFactory.js +2 -2
- package/src/common/component/editor/creators/TriggerFieldEditorCreator.js +13 -6
- 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/column/IconSvgColumn.js +14 -3
- package/src/report/component/settings/plugin/ReportFormPluginPanelController.js +1 -1
- package/src/report/plugin/grid/ReportColumnStatePlugin.js +18 -2
- package/src/version.js +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Ext.define('Coon.common.component.formeditor.UiCFContainerController', {
|
|
2
|
+
extend: 'Ext.app.ViewController',
|
|
3
|
+
alias: 'controller.UiCFContainerController',
|
|
4
|
+
readOnly: false,
|
|
5
|
+
init: function(view) {
|
|
6
|
+
this.initMouseEvents();
|
|
7
|
+
},
|
|
8
|
+
getCountElemsByXtype(xtype) {
|
|
9
|
+
return Ext.ComponentQuery.query('[xtype='+xtype+']', this.getUiCFEditorController().getView()).length;
|
|
10
|
+
},
|
|
11
|
+
initMouseEvents() {
|
|
12
|
+
if (this.readOnly) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
this.getView().on('render', (cmp) => {
|
|
16
|
+
cmp.getEl().on({
|
|
17
|
+
contextmenu: 'onMouseContextEvent',
|
|
18
|
+
scope: this,
|
|
19
|
+
destroyable: true,
|
|
20
|
+
priority: 2,
|
|
21
|
+
stopPropagation: true,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
cmp.getEl().on({
|
|
25
|
+
click: 'onMouseClickEvent',
|
|
26
|
+
scope: this,
|
|
27
|
+
destroyable: true,
|
|
28
|
+
stopPropagation: true,
|
|
29
|
+
});
|
|
30
|
+
}, this);
|
|
31
|
+
},
|
|
32
|
+
onMouseClickEvent(event) {
|
|
33
|
+
if (this.readOnly) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const el = this.getFieldByEl(event.target);
|
|
37
|
+
if (!el) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const cmp = Ext.getCmp(el.id);
|
|
41
|
+
if (cmp) {
|
|
42
|
+
const vm = this.getViewModel();
|
|
43
|
+
const currentField = vm.get('focusedField');
|
|
44
|
+
if (currentField && currentField.el && currentField.el.dom) {
|
|
45
|
+
currentField.removeCls('selectedField');
|
|
46
|
+
}
|
|
47
|
+
vm.set('focusedField', cmp);
|
|
48
|
+
cmp.addCls('selectedField');
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
getFieldByEl(el) {
|
|
53
|
+
const checkClass = (el) => {
|
|
54
|
+
return el && el.classList ? el.classList.contains('componentTarget') : false;
|
|
55
|
+
};
|
|
56
|
+
const isUiCFContainer = (el) => {
|
|
57
|
+
return el && el.classList ? el.classList.contains('UiCustomFormEditor') : false;
|
|
58
|
+
};
|
|
59
|
+
if (checkClass(el)) {
|
|
60
|
+
return Ext.getCmp(el.id);
|
|
61
|
+
} else {
|
|
62
|
+
if (isUiCFContainer(el.parentNode)) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return this.getFieldByEl(el.parentNode);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
onMouseContextEvent(event) {
|
|
70
|
+
if (this.readOnly) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const menu = this.getMenuItems();
|
|
74
|
+
const contextMenu = new Ext.menu.Menu({
|
|
75
|
+
closeAction: 'destroy',
|
|
76
|
+
items: menu[0]['menu'],
|
|
77
|
+
listeners: {
|
|
78
|
+
hide: function() {
|
|
79
|
+
const me = this;
|
|
80
|
+
Ext.defer(() => me.destroy(), 2000);
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
contextMenu.showAt(event.pageX, event.pageY);
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
return false;
|
|
87
|
+
},
|
|
88
|
+
moveRow(row, direction) {
|
|
89
|
+
const rowIndex = this.getRowIndex(row);
|
|
90
|
+
const view = this.getView();
|
|
91
|
+
const countRows = this.getCountRows();
|
|
92
|
+
if (countRows > 1) {
|
|
93
|
+
if (direction === 'up') {
|
|
94
|
+
view.moveBefore(row, view.items.getAt(rowIndex - 1));
|
|
95
|
+
} else {
|
|
96
|
+
view.moveAfter(row, view.items.getAt(rowIndex + 1));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
getCountRows() {
|
|
101
|
+
return this.getView().items.length;
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
getRows() {
|
|
105
|
+
return this.getView().items.getRange();
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
getRowIndex(row) {
|
|
109
|
+
return this.getView().items.indexOfKey(row.id);
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
removeRow(row) {
|
|
113
|
+
this.getView().remove(this.getRowIndex(row));
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
addRow(type) {
|
|
117
|
+
let cfg = null;
|
|
118
|
+
if (!Ext.isObject(type)) {
|
|
119
|
+
cfg = {
|
|
120
|
+
xtype: 'UiCFRow',
|
|
121
|
+
items: [{
|
|
122
|
+
xtype: 'UiCFCell',
|
|
123
|
+
items: [Ext.apply({
|
|
124
|
+
xtype: type,
|
|
125
|
+
name: type + '-' + (this.getCountElemsByXtype(type) + 1),
|
|
126
|
+
cls: 'componentTarget',
|
|
127
|
+
}, Coon.UiCFFieldsConfig.getFieldCfg(type))],
|
|
128
|
+
}],
|
|
129
|
+
};
|
|
130
|
+
} else {
|
|
131
|
+
cfg ={
|
|
132
|
+
xtype: 'UiCFRow',
|
|
133
|
+
items: [type],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
this.getView().add(cfg);
|
|
137
|
+
},
|
|
138
|
+
pasteCell() {
|
|
139
|
+
const cnt = this.getUiCFEditorController();
|
|
140
|
+
const cell = cnt.copyCell || cnt.cutCell;
|
|
141
|
+
if (cell) {
|
|
142
|
+
const cfg = cnt.getCfg(cell.getView());
|
|
143
|
+
if (cnt.copyCell) {
|
|
144
|
+
const mod = this.generateNewNames(cfg);
|
|
145
|
+
this.addRow(mod);
|
|
146
|
+
} else {
|
|
147
|
+
cell.getUiCFRowController().removeCell(cell.getView());
|
|
148
|
+
cnt.cutCell = null;
|
|
149
|
+
this.addRow(cfg);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
generateNewNames(cfg) {
|
|
154
|
+
const arr = ['UiCFSegmentedButton'];
|
|
155
|
+
if (cfg.items && cfg.items.length) {
|
|
156
|
+
cfg.items = cfg.items.map((item) => {
|
|
157
|
+
return this.generateNewNames(item);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (arr.indexOf(cfg.xtype) >= 0) {
|
|
161
|
+
cfg = this.changeItemIds(cfg);
|
|
162
|
+
}
|
|
163
|
+
if (cfg.name) {
|
|
164
|
+
cfg.name = cfg.xtype + '-' + (this.getCountElemsByXtype(cfg.xtype) + 1);
|
|
165
|
+
}
|
|
166
|
+
return cfg;
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
changeItemIds(cfg) {
|
|
170
|
+
if (cfg && cfg.countCards && cfg.countCards.length) {
|
|
171
|
+
cfg.countCards.forEach((cadrd, indexCard) => {
|
|
172
|
+
cfg.items.forEach((item, index) => {
|
|
173
|
+
if (cadrd['itemId'] === item['itemId']) {
|
|
174
|
+
const newId = cadrd['itemId'] + '_' + Ext.id().replace('-', '_');
|
|
175
|
+
cfg.countCards[indexCard]['itemId'] = newId;
|
|
176
|
+
cfg.items[index]['itemId'] = newId;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return cfg;
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
getUiCFEditorController() {
|
|
186
|
+
return this.getView().up('UiCustomFormEditor').getController();
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
getMenuItems(activeRow) {
|
|
190
|
+
const me = this;
|
|
191
|
+
const menuItems = [
|
|
192
|
+
{
|
|
193
|
+
text: 'добавить', iconCls: 'fa fa-plus',
|
|
194
|
+
menu: Coon.UiCFFieldsConfig.getFieldsTypes().map((item) => {
|
|
195
|
+
return {
|
|
196
|
+
text: item.description,
|
|
197
|
+
iconCls: '',
|
|
198
|
+
handler: () => {
|
|
199
|
+
me.addRow(item.type, activeRow);
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}),
|
|
203
|
+
}
|
|
204
|
+
];
|
|
205
|
+
const cnt = this.getUiCFEditorController();
|
|
206
|
+
const cell = cnt.copyCell || cnt.cutCell;
|
|
207
|
+
if (cell && cell.getView() && cell.getView().id !== this.getView().id) {
|
|
208
|
+
menuItems[0].menu.push({
|
|
209
|
+
text: 'вставить', iconCls: 'fa fa-paste',
|
|
210
|
+
handler: this.pasteCell.bind(this),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return menuItems;
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
});
|
|
@@ -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
|
+
});
|