ru.coon 2.6.6 → 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 +11 -0
- package/index.js +0 -1
- package/package.json +1 -1
- package/src/Function.js +1 -1
- 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/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# Version 2.6.7, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6802942bc71e923767f61cfc703ea6385d7f932e)
|
|
2
|
+
* ## Features
|
|
3
|
+
* <span style='color:green'>feat: HT-8060: if we have grid AutoSize option true and have saved grid columns config set it in false</span> ([2c6e2d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2c6e2d28a88cfbd383ea963e35cd7289e8412c49))
|
|
4
|
+
|
|
5
|
+
* ## Fixes
|
|
6
|
+
* <span style='color:red'> HT-7489 убрана лишняя зависимость mode-sql</span> ([f8ae6d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f8ae6d20e8285ddeaaa9063f1e9f5524ed0832d5))
|
|
7
|
+
|
|
8
|
+
* BFL-11343 fix: creating SpecificPluginConfig widget ([f9a765], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f9a765b241ac2b44d0e12a4cc1c10acff765c4e7))
|
|
9
|
+
* update: CHANGELOG.md ([1ab75d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1ab75dc59921e43812349bf8bf38432c35d62fc1))
|
|
10
|
+
|
|
1
11
|
# Version 2.6.6, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5a18af0bcc182d756427e1fd5e522dab51f5f6ca)
|
|
2
12
|
* ## Features
|
|
3
13
|
* <span style='color:green'>feat: HT-8006: Create cancel button, add search plugin by name form combo, change field labels</span> ([7dc802], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7dc8027771536eb1fcffd9d3f59a362699abf5c6))
|
|
@@ -433,6 +443,7 @@ fix ExecuteCommandPlugin - remove reject on failure if command hasnt erorHandler
|
|
|
433
443
|
# Version 2.5.26, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/da7767ea8d5507d8b2081aeaf13f46c21010f0d2)
|
|
434
444
|
* ## Features
|
|
435
445
|
* <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([ced608], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ced608b24610366e2fac65f7a9b546d31b6b34b8))
|
|
446
|
+
* <span style='color:green'>feat: TR-66759: create form editor</span> ([94e9ab], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/94e9ab0ca454e8835d36dcc88612702c74bad84d))
|
|
436
447
|
* <span style='color:green'>feat: HT-6956 add SQL beautifier</span> ([c8e391], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c8e391e07989f4e04dc5229ba8a1671ea84f9027))
|
|
437
448
|
* <span style='color:green'>feat: TR-67310 исправление ситуации когда defaultFocus на поле в состоянии disabled приводит к возврату фокуса на предыдущий элемент</span> ([335b93], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/335b9374874e2406e6f5c80daada6ba49eef05dc))
|
|
438
449
|
|
package/index.js
CHANGED
|
@@ -17,7 +17,6 @@ import 'ace-builds/src-noconflict/theme-xcode';
|
|
|
17
17
|
import 'ace-builds/src-noconflict/theme-iplastic';
|
|
18
18
|
import 'ace-builds/src-noconflict/ext-searchbox';
|
|
19
19
|
import 'ace-builds/src-noconflict/mode-javascript';
|
|
20
|
-
import 'ace-builds/src-noconflict/mode-sql';
|
|
21
20
|
import 'ace-builds/src-noconflict/mode-pgsql';
|
|
22
21
|
import 'ace-builds/src-noconflict/snippets/javascript';
|
|
23
22
|
import 'ace-builds/src-noconflict/snippets/sql';
|
package/package.json
CHANGED
package/src/Function.js
CHANGED
|
@@ -126,7 +126,7 @@ Ext.define('Coon.Function', {
|
|
|
126
126
|
*/
|
|
127
127
|
getDataFromForm: function(formPanel, valuesAsIs, dateFormat, excludeReadOnly, excludeDisabled) {
|
|
128
128
|
let fields = formPanel.query('field');
|
|
129
|
-
fields = (fields || []).concat(formPanel.query('fieldcontainer'));
|
|
129
|
+
fields = (fields || []).concat(formPanel.query('fieldcontainer')).concat(formPanel.query('UiCFSegmentedButton'));
|
|
130
130
|
const params = {};
|
|
131
131
|
for (let i = 0; i < fields.length; i++) {
|
|
132
132
|
const field = fields[i];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFCard', {
|
|
3
|
+
extend: 'Ext.panel.Panel',
|
|
4
|
+
xtype: 'UiCFCard',
|
|
5
|
+
layout: 'card',
|
|
6
|
+
bind: {
|
|
7
|
+
activeItem: '{activeItem}',
|
|
8
|
+
},
|
|
9
|
+
viewModel: {
|
|
10
|
+
data: {
|
|
11
|
+
activeItem: 0,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
controller: {
|
|
15
|
+
init(view) {
|
|
16
|
+
if (view.initialConfig && !view.initialConfig.checkOptions) {
|
|
17
|
+
if (view.initialConfig && view.initialConfig.countCards) {
|
|
18
|
+
view.initialConfig.countCards.forEach((setting, index) => {
|
|
19
|
+
let item = view.items.getAt(view.items.findIndex('itemId', setting.itemId));
|
|
20
|
+
if (!item) {
|
|
21
|
+
item = view.add({
|
|
22
|
+
xtype: 'panel',
|
|
23
|
+
layout: 'fit',
|
|
24
|
+
itemId: setting.itemId,
|
|
25
|
+
items: [{xtype: 'UiCFContainer'}],
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (setting.title) {
|
|
29
|
+
item.setTitle(setting.title);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (view.initialConfig.countCards.length < view.items.getCount()) {
|
|
33
|
+
const ids = view.initialConfig.countCards.map((item) => item.itemId);
|
|
34
|
+
view.items.items.forEach((item) => {
|
|
35
|
+
if (ids.indexOf(item.itemId) < 0) {
|
|
36
|
+
view.remove(item);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
const itemId = 'UiCFCard_' + Ext.id().replace('-', '_');
|
|
42
|
+
view.value = view.countCards = [
|
|
43
|
+
{
|
|
44
|
+
'title': '',
|
|
45
|
+
'itemId': itemId,
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
view.add({
|
|
49
|
+
xtype: 'panel',
|
|
50
|
+
layout: 'fit',
|
|
51
|
+
itemId: itemId,
|
|
52
|
+
items: [{xtype: 'UiCFContainer'}],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const vm = this.getViewModel();
|
|
56
|
+
vm.bind('{activeItem}', (activeItem) => {
|
|
57
|
+
this.lookup('backButton').setVisible(view.items.getCount() > 1 && Number(activeItem) > 0);
|
|
58
|
+
this.lookup('forwardButton').setVisible(view.items.getCount() > 1 && Number(activeItem) < view.items.items.length - 1);
|
|
59
|
+
}, this);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
back() {
|
|
63
|
+
const vm = this.getViewModel();
|
|
64
|
+
this.getViewModel().set('activeItem', Number(vm.get('activeItem'))-1);
|
|
65
|
+
},
|
|
66
|
+
forward() {
|
|
67
|
+
const vm = this.getViewModel();
|
|
68
|
+
if (Coon.Function.validateAllFieldsOnForm(this.getView().items.getAt(Number(vm.get('activeItem'))))) {
|
|
69
|
+
this.getViewModel().set('activeItem', Number(vm.get('activeItem'))+1);
|
|
70
|
+
} else {
|
|
71
|
+
Ext.Msg.show({
|
|
72
|
+
title: 'Ошибка',
|
|
73
|
+
message: 'Проверьте корректность заполнения полей формы',
|
|
74
|
+
icon: Ext.Msg.ERROR,
|
|
75
|
+
buttons: Ext.Msg.OK,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
minHeight: 100,
|
|
81
|
+
buttons: [
|
|
82
|
+
{text: 'Назад', reference: 'backButton', handler: 'back'},
|
|
83
|
+
{text: 'Вперед', reference: 'forwardButton', handler: 'forward'}
|
|
84
|
+
],
|
|
85
|
+
items: [],
|
|
86
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFCardsGrid', {
|
|
3
|
+
extend: 'Ext.grid.Panel',
|
|
4
|
+
xtype: 'UiCFCardsGrid',
|
|
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 {title: rec.get('title'), itemId: rec.get('itemId')};
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
addRow() {
|
|
25
|
+
this.getViewModel().getStore('cardsStore').add({itemId: 'UiCFCard_' + 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: ['title', 'itemId'],
|
|
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: 'title', text: 'Заголовок', flex: 1, editor: {xtype: 'textfield'}}
|
|
65
|
+
],
|
|
66
|
+
plugins: [
|
|
67
|
+
{ptype: 'cellediting'}
|
|
68
|
+
],
|
|
69
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFCell', {
|
|
3
|
+
extend: 'Ext.container.Container',
|
|
4
|
+
controller: 'UiCFCellController',
|
|
5
|
+
xtype: 'UiCFCell',
|
|
6
|
+
flex: 200,
|
|
7
|
+
collapsible: true,
|
|
8
|
+
margin: 5,
|
|
9
|
+
layout: 'fit',
|
|
10
|
+
items: [
|
|
11
|
+
],
|
|
12
|
+
});
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
Ext.define('Coon.common.component.formeditor.UiCFCellController', {
|
|
2
|
+
extend: 'Ext.app.ViewController',
|
|
3
|
+
alias: 'controller.UiCFCellController',
|
|
4
|
+
menuItems: {},
|
|
5
|
+
oldWidth: 0,
|
|
6
|
+
minCellWidth: 150,
|
|
7
|
+
readOnly: false,
|
|
8
|
+
init: function() {
|
|
9
|
+
this.setDefaultMenuItems();
|
|
10
|
+
this.initMouseEvents();
|
|
11
|
+
},
|
|
12
|
+
setDefaultMenuItems() {
|
|
13
|
+
const rowCnt = this.getUiCFRowController();
|
|
14
|
+
this.menuItems = {
|
|
15
|
+
left: {
|
|
16
|
+
text: 'влево', iconCls: 'fa fa-arrow-left',
|
|
17
|
+
handler: this.moveCellLeft.bind(this),
|
|
18
|
+
},
|
|
19
|
+
right: {
|
|
20
|
+
text: 'вправо', iconCls: 'fa fa-arrow-right',
|
|
21
|
+
handler: this.moveCellRight.bind(this),
|
|
22
|
+
},
|
|
23
|
+
copy: {
|
|
24
|
+
text: 'копировать', iconCls: 'fa fa-copy',
|
|
25
|
+
handler: this.copyCell.bind(this),
|
|
26
|
+
},
|
|
27
|
+
cut: {
|
|
28
|
+
text: 'вырезать', iconCls: 'fa fa-cut',
|
|
29
|
+
handler: this.cutCell.bind(this),
|
|
30
|
+
},
|
|
31
|
+
paste: {
|
|
32
|
+
text: 'вставить', iconCls: 'fa fa-paste',
|
|
33
|
+
handler: this.pasteCell.bind(this),
|
|
34
|
+
},
|
|
35
|
+
remove: {
|
|
36
|
+
text: 'удалить', iconCls: 'fa fa-trash',
|
|
37
|
+
handler: this.removeCell.bind(this),
|
|
38
|
+
},
|
|
39
|
+
layout: {
|
|
40
|
+
text: 'выравнивание', iconCls: 'fa fa-bars',
|
|
41
|
+
menu: [
|
|
42
|
+
{text: 'выравнять текущую строку', handler: rowCnt.layoutCellsInRow.bind(rowCnt)},
|
|
43
|
+
{text: 'выравнять по шаблону', handler: rowCnt.layoutByTemplate.bind(rowCnt)}
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
flexLayout: {
|
|
47
|
+
text: 'задать относительный размер', iconCls: 'fa fa-arrows-alt-v',
|
|
48
|
+
handler: rowCnt.setFlex.bind(rowCnt),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
setResizer() {
|
|
54
|
+
this.oldWidth = this.getView().getWidth();
|
|
55
|
+
const uiCFEditorController = this.getUiCFEditorController();
|
|
56
|
+
if (uiCFEditorController && uiCFEditorController.activeResizer) {
|
|
57
|
+
uiCFEditorController.activeResizer.destroy();
|
|
58
|
+
uiCFEditorController.activeResizer = null;
|
|
59
|
+
}
|
|
60
|
+
const rowController = this.getUiCFRowController();
|
|
61
|
+
const row = this.getView().up('UiCFRow');
|
|
62
|
+
const countCells = rowController.getCountCells();
|
|
63
|
+
const cellIndex = rowController.getCellIndexInRow(this.getView());
|
|
64
|
+
if (cellIndex !== countCells - 1) {
|
|
65
|
+
const currentItem = this.getView();
|
|
66
|
+
const nextItem = row.items.getAt(cellIndex + 1);
|
|
67
|
+
this.oldWidth = currentItem.getWidth();
|
|
68
|
+
if (uiCFEditorController) {
|
|
69
|
+
uiCFEditorController.activeResizer = Ext.create('Ext.resizer.Resizer', {
|
|
70
|
+
target: currentItem.getEl(),
|
|
71
|
+
handles: 'e',
|
|
72
|
+
minWidth: this.minCellWidth,
|
|
73
|
+
pinned: true,
|
|
74
|
+
listeners: {
|
|
75
|
+
resize: (cmp, width) => {
|
|
76
|
+
const dif = width - this.oldWidth;
|
|
77
|
+
const module = Math.abs(dif);
|
|
78
|
+
const percent = Ext.Number.parseInt(Ext.Number.toFixed(module/this.oldWidth, 2)*100);
|
|
79
|
+
const difFlex = Ext.Number.parseInt(currentItem.flex * percent / 100);
|
|
80
|
+
const minFlex = Ext.Number.parseInt(this.minCellWidth * nextItem.flex / nextItem.getWidth());
|
|
81
|
+
let nextSum = nextItem.flex - difFlex;
|
|
82
|
+
let curSum = currentItem.flex + difFlex;
|
|
83
|
+
if (dif > 0 && nextItem.flex - difFlex < minFlex) {
|
|
84
|
+
curSum -= minFlex - nextSum;
|
|
85
|
+
nextSum = minFlex;
|
|
86
|
+
}
|
|
87
|
+
nextItem.setFlex(dif > 0 ? nextSum : nextItem.flex + difFlex);
|
|
88
|
+
currentItem.setFlex(dif > 0 ? curSum : currentItem.flex - difFlex);
|
|
89
|
+
row.updateLayout();
|
|
90
|
+
this.oldWidth = currentItem.getWidth();
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
moveCellLeft() {
|
|
98
|
+
const rowController = this.getUiCFRowController();
|
|
99
|
+
rowController.moveCell(this.getView(), 'left');
|
|
100
|
+
this.setResizer();
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
moveCellRight() {
|
|
104
|
+
const rowController = this.getUiCFRowController();
|
|
105
|
+
rowController.moveCell(this.getView(), 'right');
|
|
106
|
+
this.setResizer();
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
copyCell() {
|
|
110
|
+
const cnt = this.getUiCFEditorController();
|
|
111
|
+
cnt.copyCell = this;
|
|
112
|
+
if (cnt.cutCell) {
|
|
113
|
+
cnt.cutCell.getView().removeCls('cutCell');
|
|
114
|
+
cnt.cutCell = null;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
pasteCell() {
|
|
119
|
+
const cnt = this.getUiCFEditorController();
|
|
120
|
+
const cell = cnt.copyCell || cnt.cutCell;
|
|
121
|
+
if (cell) {
|
|
122
|
+
const cfg = cnt.getCfg(cell.getView());
|
|
123
|
+
if (cnt.copyCell) {
|
|
124
|
+
this.getUiCFRowController().addCell(this.getUiCFContainerController().generateNewNames(cfg), this.getView());
|
|
125
|
+
} else {
|
|
126
|
+
cell.getUiCFRowController().removeCell(cell.getView());
|
|
127
|
+
cnt.cutCell = null;
|
|
128
|
+
this.getUiCFRowController().addCell(cfg, this.getView());
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
cutCell() {
|
|
134
|
+
const cnt = this.getUiCFEditorController();
|
|
135
|
+
this.getView().addCls('cutCell');
|
|
136
|
+
cnt.cutCell = this;
|
|
137
|
+
cnt.copyCell = null;
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
getUiCFEditorController() {
|
|
141
|
+
return this.getView().up('UiCustomFormEditor').getController();
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
removeCell() {
|
|
145
|
+
const rowController = this.getUiCFRowController();
|
|
146
|
+
rowController.removeCell(this.getView());
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
getField() {
|
|
150
|
+
return this.getView().items.find((el) => el.itemId === 'field');
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
initMouseEvents() {
|
|
154
|
+
if (!this.getUiCFContainerController() || this.readOnly) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.getView().on('render', (cmp) => {
|
|
158
|
+
const listeners = {
|
|
159
|
+
contextmenu: 'onMouseEvent',
|
|
160
|
+
scope: this,
|
|
161
|
+
destroyable: true,
|
|
162
|
+
priority: 1,
|
|
163
|
+
stopPropagation: true,
|
|
164
|
+
};
|
|
165
|
+
cmp.getEl().on(listeners);
|
|
166
|
+
}, this);
|
|
167
|
+
},
|
|
168
|
+
onMouseEvent(event) {
|
|
169
|
+
if (this.readOnly) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const contextMenu = new Ext.menu.Menu({
|
|
173
|
+
closeAction: 'destroy',
|
|
174
|
+
items: this.getMenuItems(),
|
|
175
|
+
listeners: {
|
|
176
|
+
hide: function() {
|
|
177
|
+
const me = this;
|
|
178
|
+
Ext.defer(() => me.destroy(), 2000);
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
contextMenu.showAt(event.pageX, event.pageY);
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
return false;
|
|
185
|
+
},
|
|
186
|
+
getCellIndexInRow() {
|
|
187
|
+
return this.getUiCFRowController().getCellIndexInRow(this.getView());
|
|
188
|
+
},
|
|
189
|
+
getCountCellsInRow() {
|
|
190
|
+
return this.getUiCFRowController().getCountCells();
|
|
191
|
+
},
|
|
192
|
+
getMenuItems() {
|
|
193
|
+
const count = this.getCountCellsInRow();
|
|
194
|
+
const mainC = this.getUiCFContainerController();
|
|
195
|
+
const rowC = this.getUiCFRowController();
|
|
196
|
+
let menuItems = [];
|
|
197
|
+
menuItems = menuItems.concat(mainC.getMenuItems(this.getRow()));
|
|
198
|
+
menuItems = menuItems.concat(rowC.getMenuItems(this.getView()));
|
|
199
|
+
if (count > 1) {
|
|
200
|
+
const index = this.getCellIndexInRow() + 1;
|
|
201
|
+
if (count > index) {
|
|
202
|
+
menuItems.push(this.menuItems.right);
|
|
203
|
+
}
|
|
204
|
+
if (index > 1) {
|
|
205
|
+
menuItems.push(this.menuItems.left);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const cnt = this.getUiCFEditorController();
|
|
209
|
+
const cell = cnt.copyCell || cnt.cutCell;
|
|
210
|
+
menuItems.push(this.menuItems.copy);
|
|
211
|
+
menuItems.push(this.menuItems.cut);
|
|
212
|
+
if (cell && cell.getView() && cell.getView().id !== this.getView().id) {
|
|
213
|
+
menuItems.push(this.menuItems.paste);
|
|
214
|
+
}
|
|
215
|
+
if (rowC.getCountCells() > 1) {
|
|
216
|
+
menuItems.push(this.menuItems.layout);
|
|
217
|
+
}
|
|
218
|
+
if (this.menuItems.flexLayout) {
|
|
219
|
+
const tmp = this.menuItems.flexLayout;
|
|
220
|
+
tmp.text = 'задать относительный размер' + (rowC.getView().flex > 0 ? ' (' + rowC.getView().flex + ')' : '');
|
|
221
|
+
menuItems.push(tmp);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
menuItems.push(this.menuItems.remove);
|
|
225
|
+
return menuItems;
|
|
226
|
+
},
|
|
227
|
+
getUiCFContainerController() {
|
|
228
|
+
return this.getView().up('UiCFContainer') ? this.getView().up('UiCFContainer').getController() : null;
|
|
229
|
+
},
|
|
230
|
+
getRow() {
|
|
231
|
+
return this.getView().up('UiCFRow');
|
|
232
|
+
},
|
|
233
|
+
getUiCFRowController() {
|
|
234
|
+
return this.getRow().getController();
|
|
235
|
+
},
|
|
236
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFCheckboxGroup', {
|
|
3
|
+
extend: 'Ext.form.CheckboxGroup',
|
|
4
|
+
xtype: 'UiCFCheckboxGroup',
|
|
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,15 @@
|
|
|
1
|
+
/* global Ext */
|
|
2
|
+
Ext.define('Coon.common.component.formeditor.UiCFContainer', {
|
|
3
|
+
extend: 'Ext.panel.Panel',
|
|
4
|
+
controller: 'UiCFContainerController',
|
|
5
|
+
xtype: 'UiCFContainer',
|
|
6
|
+
cls: 'UiCFContainer',
|
|
7
|
+
layout: {
|
|
8
|
+
type: 'vbox',
|
|
9
|
+
align: 'stretch',
|
|
10
|
+
},
|
|
11
|
+
minHeight: 30,
|
|
12
|
+
items: [
|
|
13
|
+
|
|
14
|
+
],
|
|
15
|
+
});
|