ru.coon 2.5.63 → 2.5.64

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 CHANGED
@@ -1,8 +1,24 @@
1
+ # Version 2.5.64, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9f48777236abed76cf08cd5cef56e7f9be0dac63)
2
+ * ## Features
3
+ * <span style='color:green'>feat: HT-7955: focus CP before save action, set cell editing values in grids</span> ([4c6578], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4c6578c6873cd21c509de304494938276e7367a9))
4
+ * <span style='color:green'>feat: BFL-9365 move TimeEditorCreator and DeliveryTimeField from ISWE</span> ([12c3c7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/12c3c701ac9387f4d2918a9feb1840bf0f7fb3ea))
5
+ * <span style='color:green'>feat: HT-7281 GridEditorPlugin editor dependField</span> ([387052], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/38705228276f86858100b6b43c0e204bcc6f26b7))
6
+
7
+ * ## Fixes
8
+ * <span style='color:red'>Fix:HT-7887 fix filterItemsOnRow property in ReportFormParameterEditPanel</span> ([c10ca9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c10ca98610970df2f51ca39fe698e278db6fe719))
9
+ * <span style='color:red'> HT-7941: check if do not have saved data object then close window</span> ([0baf4e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0baf4ea72862a4a61230ffc3ac0af7f8b065d794))
10
+
11
+ * remove unnecessary filterItemsOnRow property ([772f61], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/772f6190df8b958bd6ff97e5731a59971c9a11fc))
12
+ * update: CHANGELOG.md ([2ec18c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2ec18ccddcb1d571ef6a1d00b9cde439355c8304))
13
+
1
14
  # Version 2.5.63, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/49035e56acea653959f01f96ea96a10d962b1424)
2
15
  * BFL-10644 ([e02d63], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e02d636d78004a9687ab5715ce2787fcf50abe5a))
3
16
  * update: CHANGELOG.md ([e3238f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e3238fb0cd5428b0f941440a297868db68ae4f69))
4
17
 
5
18
  # Version 2.5.62, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/aeeccacd770cc533281e3d05d7d840b35607ebf9)
19
+ * ## Features
20
+ * <span style='color:green'>feat: HT-7281 GridEditorPlugin editor dependField</span> ([cbf672], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cbf67227388b27e73167666922835d1689d88a0d))
21
+
6
22
  * ## Fixes
7
23
  * <span style='color:red'> HT-7718: add check - break chain when method return false in MethodChainPlugin. reject error on command complete failure in ExecuteCommandPlugin</span> ([293aae], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/293aae575e1abb231ecc07fc6707880eecba61ad))
8
24
 
@@ -10,6 +26,7 @@
10
26
 
11
27
  # Version 2.5.61, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8b05280ab5f9f1f4f80aa8f7bdff7755ff8d5cb1)
12
28
  * ## Features
29
+ * <span style='color:green'>feat: HT-7281 GridEditorPlugin editor dependField</span> ([cbc841], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/cbc84116414b7d52c8711e4085f8711707c15a24))
13
30
  * <span style='color:green'>Feat:HT-7506 Add search by substring in SimpleReportTag</span> ([44ed94], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/44ed94ddfeea30f605174f005ee314211d21a022))
14
31
 
15
32
  * ## Fixes
@@ -79,6 +96,7 @@
79
96
  * <span style='color:green'>feat: HT-7346: remove callback prepare data function</span> ([968a10], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/968a10cd85fb68fb13f4f3887d1785c73934e4cd))
80
97
  * <span style='color:green'>feat: BFL-10334: add export csv button</span> ([5c067e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5c067e688795ac9b4341be80ab0909572d899f90))
81
98
  * <span style='color:green'>feat: BFL-10334: add export csv button</span> ([afe199], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/afe199fc47b3587dc076debbc9b8e824c4421ed8))
99
+ * <span style='color:green'>feat: HT-7281 GridEditorPlugin editor dependField</span> ([b4b805], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b4b805ab85470c7af499b6f66d11de7746a847ca))
82
100
  * <span style='color:green'>feat: HT-7346: get save function return value for call close window functiion</span> ([f0bea7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f0bea74091a045b2477d8518d5d07c4ee2ae3fa1))
83
101
  * <span style='color:green'>feat: HT-7346: get save function return value for call close window functiion</span> ([86806d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/86806d51d6a38fce1a4754d3c8497a6957841e1d))
84
102
 
@@ -105,6 +123,7 @@
105
123
  # Version 2.5.50, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b79597948d4412d8613b028e5e07e49cfb173eb4)
106
124
  * ## Features
107
125
  * <span style='color:green'>feat: HT-7346: rename plugin</span> ([e06f2c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e06f2cd09c83890ca955c6a11d3071a8d31a1528))
126
+ * <span style='color:green'>feat: HT-7281 GridEditorPlugin editor dependField</span> ([8496f6], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8496f6811c6e744652641758f2af3b49c358c51c))
108
127
 
109
128
  * update: CHANGELOG.md ([9ca215], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9ca2159b8222b4953516c7720fc9f5dbe03e4337))
110
129
 
@@ -145,6 +164,9 @@ fix ExecuteCommandPlugin - remove reject on failure if command hasnt erorHandler
145
164
  * update: CHANGELOG.md ([4d5a2a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4d5a2ac3120c4aba6a672256fc7cc977014f3591))
146
165
 
147
166
  # Version 2.5.46, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a60918e34030d42d694153e8a86fa2c13c97e3a0)
167
+ * ## Fixes
168
+ * <span style='color:red'>fix ReportSqlPreviewPanel buttons</span> ([850095], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/850095956abc939ab8e45f18e19f4d50d3963e96))
169
+
148
170
  * Update src/util.js ([da9c30], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/da9c307688b60cfa198137929578f257e3d0645f))
149
171
  * HT-7570 Падает SelectionModelFeature ([df48e2], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/df48e24511eec0e5572d30984fbf6d24ec2e09cd))
150
172
  * HT-7570 Падает SelectionModelFeature ([09366e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/09366ee08c7700ba03ea46ebb5bc9461963ea9d3))
@@ -161,6 +183,9 @@ fix ExecuteCommandPlugin - remove reject on failure if command hasnt erorHandler
161
183
  * update: CHANGELOG.md ([8b0186], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8b0186d787ec77ad2a4dfc211e85c8ffadee6559))
162
184
 
163
185
  # Version 2.5.44, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0c4d4a663ae3451dec321c0d68bf1d5c8d70ff58)
186
+ * ## Features
187
+ * <span style='color:green'>feat: Добавлен просмотр шаблона запроса в сравнении с оригинальным текстом запроса. Closes HT-7489.</span> ([10ea27], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/10ea27c06ddbb48922272c25643da3a2a98c23f7))
188
+
164
189
  * ## Fixes
165
190
  * <span style='color:red'> HT-7469: commit store state on doInit action. This method remove all modified records from store state</span> ([34c025], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/34c02583013b66314a74c2fbc9512f04f218d85e))
166
191
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.5.63",
7
+ "version": "2.5.64",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -0,0 +1,14 @@
1
+ Ext.define('Coon.common.component.editor.creators.TimeEditorCreator', {
2
+ extend: 'Coon.common.component.editor.creators.BaseEditorCreator',
3
+ alias: 'widget.TimeEditorCreator',
4
+
5
+ createField: function(record, parent) {
6
+ const charNs = Coon.report.model.CharacteristicBeanFields;
7
+
8
+ return Ext.create({
9
+ xtype: 'DeliveryTimeField',
10
+ format: record.get(charNs.$mask).trim() || 'H:i',
11
+ increment: 60,
12
+ });
13
+ },
14
+ });
@@ -0,0 +1,30 @@
1
+ Ext.define('Coon.common.field.DeliveryTimeField', {
2
+ extend: 'Ext.form.field.Time',
3
+ alias: 'widget.DeliveryTimeField',
4
+ displayField: 'date',
5
+
6
+ initComponent: function() {
7
+ this.callParent();
8
+ this.bindStore(this.createStore(), false);
9
+ },
10
+
11
+ createStore: function() {
12
+ const initDate = [2008, 0, 1];
13
+ const times = [];
14
+ let min = new Date(initDate[0], initDate[1], initDate[2], 8);
15
+ const max = new Date(initDate[0], initDate[1], initDate[2] + 1, 7);
16
+
17
+ while (min <= max) {
18
+ times.push({
19
+ date: Ext.Date.format(min, this.format),
20
+ });
21
+ min = Ext.Date.add(min, 'mi', this.increment);
22
+ }
23
+
24
+ return times;
25
+ },
26
+
27
+ getValue: function() {
28
+ return this.rawValue;
29
+ },
30
+ });
@@ -16,4 +16,15 @@
16
16
  }
17
17
  }
18
18
  }
19
+
20
+ &:has(.hover-style:hover, .create-line-left:hover) .create-line-left::before{
21
+ content: " ";
22
+ background: #BDBDBD;
23
+ width: 3px;
24
+ height: 26px;
25
+ position: absolute;
26
+ top: 0;
27
+ bottom: 0;
28
+ margin: auto 0;
29
+ }
19
30
  }
@@ -22,6 +22,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanel', {
22
22
  collapseToolText: 'Свернуть',
23
23
  expandToolText: 'Развернуть',
24
24
  titlePosition: 1,
25
+ bodyPadding: 10,
25
26
  layout: {
26
27
  type: 'vbox',
27
28
  align: 'stretch',
@@ -89,7 +90,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanel', {
89
90
  items: [
90
91
  {
91
92
  xtype: 'button',
92
- text: 'Скопировать для "PL/SQL"',
93
+ text: 'Скопировать запрос',
93
94
  ui: 'blue-text-button-border',
94
95
  maxWidth: 200,
95
96
  copyData: undefined,
@@ -106,34 +107,16 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanel', {
106
107
  },
107
108
  {
108
109
  xtype: 'button',
109
- text: 'Предпросмотр SQL',
110
+ text: 'Посмотреть шаблон запроса...',
110
111
  ui: 'blue-text-button-border',
111
112
  handler: 'sqlPreviewHandler',
112
113
  margin: '0 0 0 20px',
113
114
  },
114
- {
115
- xtype: 'segmentedbutton',
116
- stateId: 'ReportFormCommonPanel.sqlmode',
117
- margin: '0 0 0 20px',
118
- items: [
119
- {
120
- itemId: 'sql',
121
- text: 'SQL',
122
- pressed: true,
123
- handler: 'chooseSqlMode',
124
- },
125
- {
126
- itemId: 'pgsql',
127
- text: 'PgSQL',
128
- handler: 'chooseSqlMode',
129
- }
130
- ],
131
- },
132
115
  {
133
116
  xtype: 'splitbutton',
134
117
  margin: '0 0 0 20px',
135
118
  ui: 'blue-text-button-border',
136
- text: 'Украсить SQL',
119
+ text: 'Форматировать запрос',
137
120
  handler: 'beautifySQL',
138
121
  menu: [
139
122
  {
@@ -147,7 +130,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanel', {
147
130
  },
148
131
  {
149
132
  xtype: 'UiAceEditor',
150
- mode: 'sql',
133
+ mode: 'pgsql',
151
134
  cls: 'textareastyle',
152
135
  reference: 'reportSQLField',
153
136
  flex: 1,
@@ -1,6 +1,7 @@
1
1
  Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelController', {
2
2
  extend: 'Ext.app.ViewController',
3
3
  alias: 'controller.ReportFormCommonPanelController',
4
+ requires: ['Coon.report.component.settings.common.ReportSqlBeautifierPanel'],
4
5
  defaultBeautifierConfig: {
5
6
  language: 'plsql',
6
7
  keywordCase: 'upper',
@@ -16,15 +17,6 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelControlle
16
17
  this.beautifierConfig = Ext.apply({}, this.defaultBeautifierConfig);
17
18
  },
18
19
 
19
- chooseSqlMode: function(button) {
20
- const vm = this.getViewModel();
21
- const editor = this.lookup('reportSQLField').editor;
22
- const language = button.itemId === 'sql' ? 'plsql' : 'postgresql';
23
- editor.session.setMode(`ace/mode/${button.itemId}`);
24
- this.defaultBeautifierConfig.language = language;
25
- vm.set('language', language);
26
- },
27
-
28
20
  reportTypeChangeHandler: function(field) {
29
21
  const pageSizeField = this.lookup('pageSizeField');
30
22
  const type = field.getValue();
@@ -50,11 +42,25 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelControlle
50
42
  },
51
43
 
52
44
  sqlPreviewHandler: function() {
53
- const panel = Ext.create('widget.ReportSqlPreviewPanel');
45
+ const reportProps = this.getViewModel().get('report.properties');
46
+ let isEnabled = false;
47
+ if (Array.isArray(reportProps)) {
48
+ isEnabled = reportProps.find((prop) => prop.key === 'TEMPLATE' && prop.value === 'FREEMARKER');
49
+ }
50
+ const sourceEditor = this.lookup('reportSQLField').editor;
51
+ if (sourceEditor.getValue() === '') {
52
+ Ext.MessageBox.alert('Ошибка', 'Пустой текст запроса.');
53
+ return;
54
+ }
55
+ if (!isEnabled) {
56
+ Ext.MessageBox.alert('Информация', 'Необходимо добавить свойство отчета "TEMPLATE" со значением "FREEMARKER".');
57
+ return;
58
+ }
59
+ const panel = Ext.create('widget.ReportSqlPreviewPanel', {sourceEditor});
54
60
  const win = Ext.widget('WindowWrap', {
55
61
  maximized: true,
56
62
  maximizable: false,
57
- title: 'Предпросмотр SQL запроса',
63
+ title: 'Шаблон запроса',
58
64
  items: panel,
59
65
  });
60
66
  win.show();
@@ -62,25 +68,29 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelControlle
62
68
  },
63
69
 
64
70
  openBeautifierSettings: function() {
65
- const win = Ext.create('widget.WindowWrap', {items: [{xtype: 'ReportSqlBeautifierPanel'}],
66
- dockedItems: [{
67
- xtype: 'toolbar',
68
- dock: 'bottom',
69
- items: ['->',
70
- {
71
- xtype: 'button',
72
- ui: 'orange-button',
73
- text: 'Сохранить',
74
- handler: () => this.saveBeautifierConfig(win),
75
- },
76
- {
77
- xtype: 'button',
78
- ui: 'orange-button',
79
- text: 'Отмена',
80
- handler: () => win.close(),
81
- }
82
- ],
83
- }]});
71
+ const win = Ext.create('widget.WindowWrap', {
72
+ items: [{xtype: 'ReportSqlBeautifierPanel', viewModel: true}],
73
+ dockedItems: [
74
+ {
75
+ xtype: 'toolbar',
76
+ dock: 'bottom',
77
+ items: [
78
+ '->',
79
+ {
80
+ xtype: 'button',
81
+ ui: 'orange-button',
82
+ text: 'Сохранить',
83
+ handler: () => this.saveBeautifierConfig(win),
84
+ },
85
+ {
86
+ xtype: 'button',
87
+ ui: 'orange-button',
88
+ text: 'Отмена',
89
+ handler: () => win.close(),
90
+ }
91
+ ],
92
+ }],
93
+ });
84
94
  this.setBeautifierConfigFieldsData(win);
85
95
  win.show();
86
96
  },
@@ -115,7 +125,7 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelControlle
115
125
  try {
116
126
  const editor = this.lookup('reportSQLField').editor;
117
127
  this.beautifierConfig.language = this.defaultBeautifierConfig.language;
118
- editor.getSession().setValue(Ext.formatSQL(editor.getSession().getValue(), this.beautifierConfig));
128
+ editor.setValue(Ext.formatSQL(editor.getSession().getValue(), this.beautifierConfig), -1);
119
129
  } catch (e) {
120
130
  Coon.log.error(e);
121
131
  }
@@ -9,38 +9,137 @@ Ext.define('Coon.report.component.settings.common.ReportSqlPreviewPanel', {
9
9
  type: 'vbox',
10
10
  align: 'stretch',
11
11
  },
12
-
13
12
  items: [
14
13
  {
15
14
  xtype: 'panel',
16
- id: 'filterPanelContainerId',
17
- scrollable: true,
18
- flex: 1,
19
- items: [],
20
- bbar: [{
21
- text: 'Обновить',
22
- ui: 'blue-text-button-border',
23
- itemId: 'showPreview',
24
- }],
15
+ layout: {
16
+ type: 'hbox',
17
+ align: 'stretch',
18
+ },
19
+ items: [
20
+ {
21
+ xtype: 'panel',
22
+ itemId: 'filterPanelContainer',
23
+ scrollable: true,
24
+ flex: 1,
25
+ bodyPadding: 20,
26
+ items: [],
27
+ },
28
+ {
29
+ xtype: 'container',
30
+ maxWidth: 200,
31
+ margin: '10 0',
32
+ autoHeight: true,
33
+ layout: {
34
+ type: 'hbox',
35
+ align: 'end',
36
+ },
37
+ defaults: {
38
+ margin: '0 16 0 0',
39
+ xtype: 'button',
40
+ },
41
+ items: [
42
+ {
43
+ text: 'Обновить шаблон',
44
+ ui: 'blue-text-button-border',
45
+ itemId: 'showPreview',
46
+ }
47
+ ],
48
+ }
49
+ ],
25
50
  },
26
51
  {
27
- xtype: 'textareafield',
28
- xtype: 'UiAceEditor',
29
- mode: 'sql',
30
- id: 'textareafieldId',
31
- cls: 'textareastyle',
32
- reference: 'reportSQLPreviewField',
33
- emptyText: 'Select * from...',
34
- scrollable: true,
52
+ xtype: 'container',
53
+ itemId: 'diffContainer',
35
54
  flex: 2,
36
55
  margin: 5,
37
- readOnly: true,
56
+ layout: {
57
+ type: 'vbox',
58
+ align: 'stretch',
59
+ },
60
+ items: [
61
+ {
62
+ xtype: 'container',
63
+ height: 30,
64
+ layout: {
65
+ type: 'hbox',
66
+ align: 'stretch',
67
+ },
68
+ items: [
69
+ {
70
+ xtype: 'displayfield',
71
+ value: 'Шаблон запроса',
72
+ style: 'text-align:center;',
73
+ flex: 1,
74
+ },
75
+ {
76
+ xtype: 'displayfield',
77
+ value: 'Текст запроса',
78
+ style: 'text-align:center;',
79
+ flex: 1,
80
+ }
81
+ ],
82
+ },
83
+ {
84
+ xtype: 'box',
85
+ flex: 1,
86
+ id: 'diffTarget',
87
+ }
88
+ ],
38
89
  }
39
90
  ],
40
91
 
41
92
  initComponent() {
42
93
  this.callParent();
43
94
  this.down('#showPreview').on('click', this.showPreview, this);
95
+ this.getComponent('diffContainer').on('render', this.renderDiff.bind(this));
96
+ this.on('beforedestroy', this.disposeDiff.bind(this));
97
+ },
98
+
99
+ disposeDiff() {
100
+ this.diff && this.diff.destroy();
101
+ },
102
+ renderDiff(container) {
103
+ if (!this.sourceEditor) {
104
+ Coon.log.error('Не передан параметр "sourceEditor"');
105
+ return;
106
+ }
107
+ this.leftEditor = {
108
+ id: 'ace-diff-left',
109
+ content: '',
110
+ editable: false,
111
+ copyLinkEnabled: false,
112
+ };
113
+ this.diff = new Ext.xAceDiff({
114
+ element: container.el.dom.querySelector('#diffTarget'),
115
+ left: this.leftEditor,
116
+ mode: this.sourceEditor.getSession().getMode()['$id'],
117
+ theme: this.sourceEditor.getTheme(),
118
+ right: {
119
+ id: 'ace-diff-right',
120
+ content: this.sourceEditor.getValue(),
121
+ editable: false,
122
+ copyLinkEnabled: false,
123
+ },
124
+ });
125
+ const left = this.diff.editors.left.ace;
126
+ const right = this.diff.editors.right.ace;
127
+ let rightScrolling = false;
128
+ let leftScrolling = false;
129
+ right.getSession().on('changeScrollTop', function(scroll) {
130
+ if (!rightScrolling) {
131
+ rightScrolling = true;
132
+ left.getSession().setScrollTop(scroll || 0);
133
+ }
134
+ rightScrolling = false;
135
+ });
136
+ left.getSession().on('changeScrollTop', function(scroll) {
137
+ if (!leftScrolling) {
138
+ leftScrolling = true;
139
+ right.getSession().setScrollTop(scroll || 0);
140
+ }
141
+ leftScrolling = false;
142
+ });
44
143
  },
45
144
 
46
145
  doInit(report) {
@@ -71,24 +170,28 @@ Ext.define('Coon.report.component.settings.common.ReportSqlPreviewPanel', {
71
170
  configurationList: configList,
72
171
  plugins: reportPlugins,
73
172
  });
74
- filterPanel.height += 10; // т.к. filterPanel.frame == true
75
-
76
- this.down('#filterPanelContainerId').add(filterPanel);
77
- this.down('#filterPanelContainerId').updateLayout();
173
+ const container = this.down('#filterPanelContainer');
174
+ container.add(filterPanel);
175
+ container.updateLayout();
176
+ this.showPreview();
78
177
  },
79
178
 
80
179
  showPreview() {
81
- const previewField = this.down('#textareafieldId');
82
- previewField.setValue('');
180
+ this.mask();
83
181
  fetch(this.getOptions())
84
- .then((response) => response.text())
85
- .then((text) => previewField.setValue(text))
86
- .catch(Coon.log.error);
182
+ .then((response) => response.text()).then((text) => {
183
+ this.unmask();
184
+ this.diff.editors.left.ace.setValue(text, -1);
185
+ Ext.toast('Шаблон загружен.');
186
+ }).catch((error) => {
187
+ this.unmask();
188
+ Coon.log.error(error);
189
+ });
87
190
  },
88
191
 
89
192
  getOptions() {
90
193
  const parameterList = [];
91
- const currentParamList = Coon.Function.getDataFromForm(this.down('#filterPanelContainerId'), false);
194
+ const currentParamList = Coon.Function.getDataFromForm(this.down('#filterPanelContainer'), false);
92
195
  for (const key in currentParamList) {
93
196
  if (currentParamList.hasOwnProperty(key)) {
94
197
  if (!Ext.isEmpty(currentParamList[key])) {
@@ -49,14 +49,16 @@ Ext.define('Coon.report.component.settings.parameter.ReportFormParameterEditPane
49
49
  filterPanelContainer.removeAll();
50
50
  this.highlightedFilterField = null;
51
51
  const northPanel = Ext.widget('NorthPanel', {
52
- filterItemsOnRow: reportProperties['filterItemsOnRow'] || 4,
53
52
  enableHighlightingRequiredFields: isValidationPlugin || reportProperties['enableHighlightingRequiredFields'],
54
53
  buttonsContainerConfig: {hidden: true},
55
54
  filterPlugins: reportPlugins,
56
55
  docked: 'top',
57
56
  header: false,
58
57
  });
59
- northPanel.configureFilterPanel({parameters: this.getConfigurationList()});
58
+ northPanel.configureFilterPanel({
59
+ parameters: this.getConfigurationList(),
60
+ properties: {filterItemsOnRow: reportProperties['filterItemsOnRow']},
61
+ });
60
62
  this.filterContainer = northPanel.filterContainer;
61
63
  filterPanelContainer.add(northPanel);
62
64
  filterPanelContainer.updateLayout();
@@ -202,11 +202,11 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanelControl
202
202
  }
203
203
  if (record.get('isNew')) {
204
204
  record.remove();
205
- this.lookup('descriptionField').reset();
206
- this.lookup('propertyValueContainer').removeAll();
207
205
  } else {
208
206
  record.set('isDeleted', !record.get('isDeleted'));
209
207
  }
208
+ this.lookup('descriptionField').reset();
209
+ this.lookup('propertyValueContainer').removeAll();
210
210
  },
211
211
 
212
212
  onAddHandler() {
@@ -21,33 +21,206 @@ Ext.define('Coon.report.plugin.configPanel.GridEditorPluginConfig', {
21
21
  },
22
22
 
23
23
  createItems: function() {
24
- this.grid = Ext.create('Coon.report.plugin.configPanel.GridEditorPluginConfigGrid', {
24
+ this.layout = 'fit';
25
+ this.fieldEditor = this.createFieldColumns({
26
+ hideLabel: true,
27
+ allowBlank: false,
28
+ });
29
+ const ns = Coon.report.model.CharacteristicBeanFields;
30
+ this.grid = Ext.create('Ext.grid.Panel', {
25
31
  flex: 1,
26
- fieldEditor: this.createFieldColumns({
27
- hideLabel: true,
28
- allowBlank: false,
29
- }),
32
+ region: 'center',
33
+ store: {
34
+ type: 'json',
35
+ data: [],
36
+ },
37
+ tbar: {
38
+ defaults: {
39
+ margin: 5,
40
+ },
41
+ items: [
42
+ {
43
+ xtype: 'button',
44
+ text: 'Добавить',
45
+ ui: 'blue-text-button-border',
46
+ handler: Ext.bind(this.addHandler, this),
47
+ },
48
+ {
49
+ xtype: 'button',
50
+ text: 'Удалить',
51
+ ui: 'blue-text-button-border',
52
+ handler: Ext.bind(this.deleteHandler, this),
53
+ }
54
+ ],
55
+ },
56
+ columns: [
57
+ {
58
+ header: 'Поле',
59
+ dataIndex: ns.$type,
60
+ xtype: 'hintColumn',
61
+ editor: this.fieldEditor,
62
+ flex: 1,
63
+ }
64
+ ],
65
+ plugins: [
66
+ {ptype: 'cellediting', clicksToEdit: 2}
67
+ ],
68
+ listeners: {
69
+ select: function(grid, record) {
70
+ Coon.Function.clearAllFieldsOnForm(this.editForm);
71
+ const recordConfig = this.editorConfig.find((el) => el.type === record.get(ns.$type));
72
+ Coon.Function.fillFormFields(this.editForm, recordConfig);
73
+ if (recordConfig[ns.$mask]) {
74
+ this.editForm.down('UiAceEditor').setValue(recordConfig[ns.$mask]);
75
+ }
76
+ this.editForm.setDisabled(!record);
77
+ }.bind(this),
78
+ deselect: this.setEditorConfig.bind(this),
79
+ },
30
80
  });
31
81
 
32
- return [
33
- this.grid
34
- ];
82
+ this.editForm = Ext.create({
83
+ xtype: 'form',
84
+ region: 'east',
85
+ header: {
86
+ title: 'Редактор',
87
+ height: 55,
88
+ },
89
+ disabled: true,
90
+ flex: 2,
91
+ defaults: {
92
+ margin: 10,
93
+ anchor: '100%',
94
+ },
95
+ items: [
96
+ {
97
+ fieldLabel: 'Тип редактора',
98
+ name: ns.$typeOfValue,
99
+ xtype: 'lookupCombo',
100
+ lookupId: 'ADHOC_CHAR_TYPE_FLG',
101
+ submitFormat: false,
102
+ allowBlank: false,
103
+ loadOnRender: false,
104
+ },
105
+ {
106
+ boxLabel: 'Значение обязательно',
107
+ name: ns.$required,
108
+ xtype: 'checkbox',
109
+ },
110
+ {
111
+ title: 'Редактировать в зависимости от поля',
112
+ xtype: 'fieldset',
113
+ checkboxName: 'dependsOnField',
114
+ checkboxToggle: true,
115
+ layout: {
116
+ type: 'vbox',
117
+ align: 'stretch',
118
+ },
119
+ defaults: {
120
+ flex: 1,
121
+ },
122
+ items: [
123
+ {
124
+ xtype: 'checkbox',
125
+ boxLabel: 'Редактировать если значение поля false/пусто',
126
+ name: 'invertValue',
127
+ },
128
+ this.createFieldColumns({
129
+ name: 'dependsOnFieldName',
130
+ }),
131
+ {
132
+ boxLabel: 'Выделить редактируемые ячейки',
133
+ name: 'highlightEditableCells',
134
+ xtype: 'checkbox',
135
+ }
136
+ ],
137
+ },
138
+ {
139
+ xtype: 'fieldset',
140
+ title: 'Конфиг',
141
+ height: 200,
142
+ items: [
143
+ {
144
+ xtype: 'UiAceEditor',
145
+ useLinter: true,
146
+ scrollable: 'y',
147
+ name: ns.$mask,
148
+ value: {},
149
+ }
150
+ ],
151
+ }
152
+ ],
153
+ });
154
+
155
+ return [{
156
+ frame: true,
157
+ align: 'stretch',
158
+ layout: 'border',
159
+ defaults: {
160
+ split: true,
161
+ border: false,
162
+ },
163
+ items: [
164
+ this.grid,
165
+ this.editForm
166
+ ],
167
+ }];
35
168
  },
36
169
 
37
170
  doInit: function(properties) {
38
171
  if (properties) {
39
- let editorConfig = properties['editorConfig'];
40
- if (Ext.isString(editorConfig)) {
41
- editorConfig = Ext.decode(editorConfig);
172
+ this.editorConfig = properties['editorConfig'];
173
+ if (Ext.isString(this.editorConfig)) {
174
+ this.editorConfig = Ext.decode(this.editorConfig);
42
175
  }
43
- this.grid.doInit(editorConfig);
176
+ if (!Ext.isEmpty(this.editorConfig) && !Ext.isArray(this.editorConfig)) {
177
+ this.editorConfig = [this.editorConfig];
178
+ }
179
+ this.grid.getStore().loadData(this.editorConfig || []);
44
180
  }
45
181
  },
46
182
 
47
- getConfiguration: function() {
48
- const config = Coon.Function.getDataFromForm(this);
49
- config['editorConfig'] = this.grid.getData();
183
+ addHandler: function() {
184
+ const ns = Coon.report.model.CharacteristicBeanFields;
185
+ const data = {};
186
+ data[ns.$entity] = 'ADV';
187
+ const newRecord = Ext.create('Coon.report.model.CharacteristicBean', data);
188
+ this.grid.getStore().add(newRecord);
189
+ const editor = this.grid.findPlugin('cellediting');
190
+ editor.startEditByPosition({row: this.grid.getStore().getCount() - 1, column: 0});
191
+ },
192
+
193
+ deleteHandler: function() {
194
+ const record = this.grid.getSelectionModel().getSelection()[0];
195
+ if (!record) {
196
+ return;
197
+ }
198
+ record.set('isDeleted', true);
199
+ const foundIndex = this.editorConfig.findIndex((el) => el.type === record.get('type'));
200
+ this.editorConfig.splice(foundIndex, 1);
201
+ Coon.Function.clearAllFieldsOnForm(this.editForm);
202
+ this.editForm.setDisabled(true);
203
+ this.grid.getStore().remove(record);
204
+ },
50
205
 
206
+ setEditorConfig: function() {
207
+ const ns = Coon.report.model.CharacteristicBeanFields;
208
+ const record = this.grid.getSelection()[0];
209
+ if (!record || record.get('isDeleted')) {
210
+ return;
211
+ }
212
+ record.set(ns.$mask, this.editForm.down('UiAceEditor').getValue());
213
+ const foundIndex = this.editorConfig.findIndex((el) => el.type === record.get(ns.$type));
214
+ const deleteCount = foundIndex === -1 ? 0 : 1;
215
+ const position = foundIndex === -1 ? this.editorConfig.length : foundIndex;
216
+ this.editorConfig.splice(position, deleteCount, Object.assign(
217
+ record.getData(),
218
+ Coon.Function.getDataFromForm(this.editForm)));
219
+ },
220
+
221
+ getConfiguration: function() {
222
+ this.setEditorConfig();
223
+ const config = {editorConfig: this.editorConfig};
51
224
  return config;
52
225
  },
53
226
  });
@@ -0,0 +1,22 @@
1
+ Ext.define('Coon.report.plugin.configPanel.GridEditorPluginConfigPanel', {
2
+ extend: 'Coon.report.plugin.configPanel.BasePluginConfig',
3
+ alias: 'widget.GridEditorPluginConfigPanel',
4
+ uses: [],
5
+ requires: [
6
+ 'Coon.Function'
7
+ ],
8
+ alternateClassName: 'Sigma.common.grid.plugin.configPanel.GridEditorPluginConfig',
9
+
10
+ description: 'Плагин позволяет задать редактор для столбцов',
11
+ tags: ['Редактирование'],
12
+
13
+ config: {
14
+ pluginTypeSettings: {
15
+ defaultType: 'GRID_PLUGIN',
16
+ allowedTypes: [
17
+ 'GRID_PLUGIN'
18
+ ],
19
+ },
20
+ },
21
+
22
+ });
@@ -1,7 +1,7 @@
1
1
  Ext.define('Coon.report.plugin.configPanel.selectionModelFeature.SelectionModelFeatureConfigPanel', {
2
2
  extend: 'Coon.report.plugin.configPanel.PluginDefaults',
3
3
  alias: 'widget.SelectionModelFeatureConfigPanel',
4
-
4
+ requires: ['Ext.selection.MixedRowSelectionModel'],
5
5
  pluginType: 'SelectionModelPlugin',
6
6
  description: 'Настройки SelectionModel',
7
7
  tags: ['Поведение', 'Выделение'],
@@ -58,6 +58,9 @@ Ext.define('Coon.report.plugin.grid.GridEditorsPlugin', {
58
58
  }
59
59
  }
60
60
  }
61
+ hasEditor.on('beforeedit', function(editor, context) {
62
+ return context.record.allowEditWithEditorPlugin;
63
+ }, this);
61
64
  },
62
65
 
63
66
  createEditorItem: function(configuration) {
@@ -134,6 +137,20 @@ Ext.define('Coon.report.plugin.grid.GridEditorsPlugin', {
134
137
  editor.on('beforeedit', function() {
135
138
  Ext.emptyFn();
136
139
  }, this);
140
+ let editable = true;
141
+ if (configuration['dependsOnField'] && configuration['dependsOnFieldName']) {
142
+ const editableColumn = this.grid.getColumns().find((col) => col.dataIndex === configuration[ns.$type]);
143
+ editableColumn.renderer = (value, metaData, record) => {
144
+ const dependsOnFieldName = configuration['dependsOnFieldName'];
145
+ const invertValue = configuration['invertValue'];
146
+ editable = invertValue === !record.get(dependsOnFieldName);
147
+ record.allowEditWithEditorPlugin = editable;
148
+ if (configuration['highlightEditableCells']) {
149
+ metaData.tdCls = editable ? 'create-line-left' : 'hover-style';
150
+ }
151
+ return value;
152
+ };
153
+ }
137
154
  return editor;
138
155
  },
139
156
  });
@@ -33,7 +33,11 @@ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
33
33
  });
34
34
  view.addDocked(this.controller.unifiedButtonToolbar, this.dock === 'bottom' ? null : 0);
35
35
  },
36
- onBeforeCloseWindow() {
36
+ onBeforeCloseWindow(win) {
37
+ const cp = win.down('UiCustomPanel');
38
+ if (cp) {
39
+ cp.focus();
40
+ }
37
41
  if (this.suspendBeforeCloseEvent) {
38
42
  this.suspendBeforeCloseEvent = false;
39
43
  return true;
@@ -83,6 +87,9 @@ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
83
87
  } else {
84
88
  this.controller.savedDataHash = Coon.util.generateHashFromObj(params);
85
89
  }
90
+ } else if (this.windowClose) {
91
+ this.suspendBeforeCloseEvent = true;
92
+ this.closeWindow();
86
93
  }
87
94
  },
88
95
  callPrepareBeanHandler(compareCash = true) {
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.5.63',
3
+ number: '2.5.64',
4
4
  });