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
package/.eslintrc.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# Version 2.6.8, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/93e8208b4895493b8ad13ac0910a75fc2a2b4531)
|
|
2
|
+
* update: CHANGELOG.md ([367797], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/367797afa5241e6fd9eff7af17f4a28f2e1043ce))
|
|
3
|
+
|
|
4
|
+
# Version 2.6.7, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6802942bc71e923767f61cfc703ea6385d7f932e)
|
|
5
|
+
* ## Features
|
|
6
|
+
* <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))
|
|
7
|
+
|
|
8
|
+
* ## Fixes
|
|
9
|
+
* <span style='color:red'> HT-7489 убрана лишняя зависимость mode-sql</span> ([f8ae6d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f8ae6d20e8285ddeaaa9063f1e9f5524ed0832d5))
|
|
10
|
+
|
|
11
|
+
* BFL-11343 fix: creating SpecificPluginConfig widget ([f9a765], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f9a765b241ac2b44d0e12a4cc1c10acff765c4e7))
|
|
12
|
+
* update: CHANGELOG.md ([1ab75d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1ab75dc59921e43812349bf8bf38432c35d62fc1))
|
|
13
|
+
|
|
1
14
|
# Version 2.6.6, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5a18af0bcc182d756427e1fd5e522dab51f5f6ca)
|
|
2
15
|
* ## Features
|
|
3
16
|
* <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))
|
|
@@ -284,6 +297,7 @@ fix ExecuteCommandPlugin - remove reject on failure if command hasnt erorHandler
|
|
|
284
297
|
* BFL-8607 Доработка редактора характеристики типа "Дата" ([6b2ee8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6b2ee8c52c6f89799f0de52b30b78179650f518c))
|
|
285
298
|
* BFL-8607 Доработка редактора характеристики типа "Дата" ([20c221], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/20c2210c3c15817168bf0a3465a219fe49f7d2fe))
|
|
286
299
|
* BFL-8607 Доработка редактора характеристики типа "Дата" ([0c7529], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0c752984e1e82cdf68d9aa25413375319adfe30e))
|
|
300
|
+
* Merge with develop ([2f0b72], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2f0b7296a4764645e248dfe2f2e4d5399f695dc4))
|
|
287
301
|
* update: CHANGELOG.md ([892608], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/892608eb6ddd2ef85d205ba9e1e857aa27672320))
|
|
288
302
|
|
|
289
303
|
# Version 2.5.42, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a6256f14a891eda0974a2af1ee2c108c8904feab)
|
|
@@ -299,6 +313,7 @@ fix ExecuteCommandPlugin - remove reject on failure if command hasnt erorHandler
|
|
|
299
313
|
|
|
300
314
|
# Version 2.5.41, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/612fb7573419ad9857649f7211c8d7a56e52cdb4)
|
|
301
315
|
* ## Features
|
|
316
|
+
* <span style='color:green'>feat: Перенесен ShowReportEditorCreator из ISWE. Closes BFL-9446.</span> ([1d7ee3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1d7ee326527f9d14d332bb115bd68a15a7e9c22e))
|
|
302
317
|
* <span style='color:green'>feat: BFL-9521: init dependent form params anytime</span> ([2e5aa1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2e5aa16eeace7205cff9e01295f43d0f4ce956c6))
|
|
303
318
|
|
|
304
319
|
* ## Fixes
|
|
@@ -433,6 +448,7 @@ fix ExecuteCommandPlugin - remove reject on failure if command hasnt erorHandler
|
|
|
433
448
|
# Version 2.5.26, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/da7767ea8d5507d8b2081aeaf13f46c21010f0d2)
|
|
434
449
|
* ## Features
|
|
435
450
|
* <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([ced608], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ced608b24610366e2fac65f7a9b546d31b6b34b8))
|
|
451
|
+
* <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
452
|
* <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
453
|
* <span style='color:green'>feat: TR-67310 исправление ситуации когда defaultFocus на поле в состоянии disabled приводит к возврату фокуса на предыдущий элемент</span> ([335b93], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/335b9374874e2406e6f5c80daada6ba49eef05dc))
|
|
438
454
|
|
|
@@ -488,6 +504,7 @@ isolate lastValue from native ComboBox logic</span> ([57078e], [link](http://git
|
|
|
488
504
|
* update: CHANGELOG.md ([473997], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4739978f7ebb8564b5b233c496ce9c98d977c1c6))
|
|
489
505
|
|
|
490
506
|
# Version 2.5.21, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/dc202083a949169e0203fa47bf2defa312201a33)
|
|
507
|
+
* CRM-7662 Управление выравниванием xtype = iconSvgColumn в ячейке ([064e19], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/064e191cd27cd45f0293bb30c9938325722b4837))
|
|
491
508
|
* update: CHANGELOG.md ([e1a4d6], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e1a4d65ec93284adeab64eb21ab51e737c229df7))
|
|
492
509
|
|
|
493
510
|
# Version 2.5.20, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a884bf408a15fd41a3b62aa7f11301df69e99fc1)
|
|
@@ -513,6 +530,8 @@ fix ReportPropertiesPanelController</span> ([e2b928], [link](http://gitlab-dbr.s
|
|
|
513
530
|
* <span style='color:red'> HT-6314 change icon and master widget style</span> ([ac9da8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ac9da82d4f00015e52da554cb985b4f2bdf2a1fe))
|
|
514
531
|
* <span style='color:red'> HT-6314 change icon and master widget style</span> ([6b03cc], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6b03ccc5600c2d757b811bad43b790a85633d844))
|
|
515
532
|
|
|
533
|
+
* CRM-7662 Управление выравниванием xtype = iconSvgColumn в ячейке ([8065d1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8065d124ffdbfe46177d5ea710e14183257a9494))
|
|
534
|
+
* CRM-7662 Управление выравниванием xtype = iconSvgColumn в ячейке ([cfd31c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cfd31c9d0e148c37a26e8d924abeff30b8a404b2))
|
|
516
535
|
* update: CHANGELOG.md ([ff88bb], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ff88bb739914adacf1bbfa5284b31f603e480795))
|
|
517
536
|
|
|
518
537
|
# Version 2.5.18, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b13b1b683795ffae10f8d406829a96bd7850553f)
|
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];
|
|
@@ -59,7 +59,7 @@ Ext.define('Coon.common.component.editor.EditorFactory', {
|
|
|
59
59
|
Ext.decode(mask, true) : {});
|
|
60
60
|
if (type === Coon.common.component.editor.CharacteristicEditorTypes.FOREIGN ||
|
|
61
61
|
type === Coon.common.component.editor.CharacteristicEditorTypes.FILE ||
|
|
62
|
-
!Ext.isEmpty(record.get(Coon.report.model.CharacteristicBeanFields.$editor))) {
|
|
62
|
+
!Ext.isEmpty(record.get(Coon.report.model.CharacteristicBeanFields.$editor).trim())) {
|
|
63
63
|
return new Coon.common.component.editor.CustomTypeEditor({
|
|
64
64
|
record: record,
|
|
65
65
|
context: context,
|
|
@@ -453,7 +453,7 @@ Ext.define('Coon.common.component.editor.CustomTypeEditor', {
|
|
|
453
453
|
const ns = Coon.report.model.CharacteristicBeanFields;
|
|
454
454
|
|
|
455
455
|
let field = null;
|
|
456
|
-
const editorCode = record.get(ns.$editor);
|
|
456
|
+
const editorCode = record.get(ns.$editor).trim();
|
|
457
457
|
if (!Ext.isEmpty(editorCode)) {
|
|
458
458
|
if (Ext.ClassManager.getByAlias('widget.' + editorCode)) {
|
|
459
459
|
let editor = null;
|
|
@@ -43,7 +43,7 @@ Ext.define('Coon.common.component.editor.creators.TriggerFieldEditorCreator', {
|
|
|
43
43
|
|
|
44
44
|
showPanel: function(record, parent) {
|
|
45
45
|
const ns = Coon.report.model.CharacteristicBeanFields;
|
|
46
|
-
const props = this.parseMask(record.get(ns.$mask));
|
|
46
|
+
const props = this.parseMask(record.get(ns.$mask).trim());
|
|
47
47
|
this.value = record.get(ns.$value);
|
|
48
48
|
|
|
49
49
|
const panel = Ext.create({
|
|
@@ -55,10 +55,13 @@ Ext.define('Coon.common.component.editor.creators.TriggerFieldEditorCreator', {
|
|
|
55
55
|
const win = Ext.widget('WindowWrap', {
|
|
56
56
|
items: panel,
|
|
57
57
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
if (props) {
|
|
59
|
+
const parameter = {};
|
|
60
|
+
parameter[props.parameterName] = this.field.ID;
|
|
61
|
+
win.doInit(props.reportId, Object.assign(parameter, this.context), true);
|
|
62
|
+
} else {
|
|
63
|
+
Coon.log.error('Не задана маска характеристики');
|
|
64
|
+
}
|
|
62
65
|
panel.on('gridReady', function() {
|
|
63
66
|
if (this.doubleClickHandler) {
|
|
64
67
|
panel.grid.on('rowdblclick', function(grid, record) {
|
|
@@ -104,7 +107,11 @@ Ext.define('Coon.common.component.editor.creators.TriggerFieldEditorCreator', {
|
|
|
104
107
|
|
|
105
108
|
win.show();
|
|
106
109
|
},
|
|
107
|
-
|
|
110
|
+
/**
|
|
111
|
+
* @example
|
|
112
|
+
* 'REPORTS:CM_REPORT_CD' -> reportId: REPORTS, valueColumn: CM_REPORT_CD
|
|
113
|
+
* @param {string} mask
|
|
114
|
+
*/
|
|
108
115
|
parseMask: function(mask) {
|
|
109
116
|
let result;
|
|
110
117
|
if (mask.match(/[\w-]*:[\w-]*/)) {
|
|
@@ -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
|
+
});
|