ru.coon 2.5.32 → 2.5.34

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,14 +1,31 @@
1
+ # Version 2.5.34, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/83a61a9400eca79d2a71c3e7d0b2e834c6df1cec)
2
+ * ## Fixes
3
+ * <span style='color:red'> BFL-8646: fix object value and assign object params</span> ([15d3e8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/15d3e8515a3ecefa750c06b85387d57f101e24fe))
4
+
5
+ * update: CHANGELOG.md ([a4612b], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a4612b5a0e83714c0bf5ab766458cdf0949f1daa))
6
+
7
+ # Version 2.5.33, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3c703020664a8b7ecc9b4fdbc0d82e6121769531)
8
+ * ## Fixes
9
+ * <span style='color:red'> CRM-7853 ParameterizedReportCombo исправлена логика работы при включенном parseParameters</span> ([bf36ba], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bf36ba56567b934fe6d2cd1ac809e3d66cf3041f))
10
+
11
+ * HT-6956 refactoring ([8299b8], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8299b8595ec257d77af8b0a8fd70e585db4049be))
12
+ * update: CHANGELOG.md ([e05890], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e05890df52732c73a6f8d7be5b54a40ca212bc7a))
13
+
1
14
  # Version 2.5.32, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/de81a198b0ffcbe7ea296f9568023ab135bdb832)
2
15
  * update: CHANGELOG.md ([79085d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/79085d7c621b2ebeb592dbff958a4a29d276aa90))
3
16
 
4
17
  # Version 2.5.31, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/51eafa59b0b64087dacaafd66b754c04ada7e027)
5
18
  * ## Features
19
+ * <span style='color:green'>feat: HT-6956 add SQL beautifier</span> ([a3968b], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a3968bb98d16fbc294d355930b53f5e707d52ad7))
20
+ * <span style='color:green'>feat: BFL-8598 добавлена возможность скрытия легенды обязательных полей</span> ([1ac031], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1ac031674684a282c769ea74bc9bd1b0f04484bc))
6
21
  * <span style='color:green'>feat: HT-4550 changed to Ext.ajax</span> ([3a4af5], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3a4af588bb24b481c427749ca8d658edc9d42a57))
7
22
  * <span style='color:green'>feat: Replace 'require' with 'import', cleanup dependencies. Related to TR-67434.</span> ([3ee407], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3ee40770a402547fa72a1cc5d1bc20e297186ebb))
23
+ * <span style='color:green'>feat: BFL-8598 добавлена возможность скрытия легенды обязательных полей</span> ([653e77], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/653e77bea52407f1f713aa015e5862ccae9f26c6))
8
24
  * <span style='color:green'>feat: HT-4550 add new Coon.util method, fetch instead of XMLHttpRequest</span> ([748421], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7484218eddd0e2b2e0863e88bb595aa79c8c0009))
9
25
 
10
26
  * ## Fixes
11
27
  * <span style='color:red'> HT-4550 refactor</span> ([b87c1b], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b87c1b54d15ea311968f8fe5ed1c15afd41391c2))
28
+ * <span style='color:red'> BFL-8598 рефакторинг FilterPanel</span> ([e71eb6], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e71eb655d3d35e50f200d3b0aafe4955c5dc583f))
12
29
  * <span style='color:red'> Update Coon.log.isProduction</span> ([9c7f2d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9c7f2db552b265a203ca60d79205149b863760a2))
13
30
  * <span style='color:red'> Removed obsolete dependencies. Related to TR-67434.</span> ([1229d5], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1229d5fc23c6c754acde1b62bed531630d7b67cf))
14
31
 
@@ -30,6 +47,12 @@
30
47
  * update: CHANGELOG.md ([104edb], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/104edb305212754136d1ae57beaec1e9052dac80))
31
48
 
32
49
  # Version 2.5.28, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/1234c97e665cf63c2ab2a4a0048f26b99c815f04)
50
+ * ## Features
51
+ * <span style='color:green'>feat: BFL-8383 fix</span> ([ddf6d3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ddf6d3e1817d1a0ab2750c2048f7af92fc042d25))
52
+ * <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([f2a79c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f2a79ccb4e435a3644f6fa958734c634b9bb0956))
53
+ * <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([6de2bc], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6de2bcdd4fe34aefde78f20a843ed90b9964ee36))
54
+ * <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([e466a9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e466a978e0ee25633c5f87ee480ae3b3a30d9f95))
55
+
33
56
  * ## Fixes
34
57
  * <span style='color:red'> TR-67140 method renamed</span> ([129cb9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/129cb965f9c1be60ca5ba877f35eedbead2dc815))
35
58
 
@@ -44,6 +67,8 @@
44
67
 
45
68
  # Version 2.5.26, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/da7767ea8d5507d8b2081aeaf13f46c21010f0d2)
46
69
  * ## Features
70
+ * <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([ced608], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ced608b24610366e2fac65f7a9b546d31b6b34b8))
71
+ * <span style='color:green'>feat: HT-6956 add SQL beautifier</span> ([c8e391], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c8e391e07989f4e04dc5229ba8a1671ea84f9027))
47
72
  * <span style='color:green'>feat: TR-67310 исправление ситуации когда defaultFocus на поле в состоянии disabled приводит к возврату фокуса на предыдущий элемент</span> ([335b93], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/335b9374874e2406e6f5c80daada6ba49eef05dc))
48
73
 
49
74
  * ## Fixes
@@ -55,11 +80,13 @@
55
80
  # Version 2.5.25, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/598185e8f86f9268fd2b75354a0807450368af05)
56
81
  * ## Features
57
82
  * <span style='color:green'>feat: HT-6865 доработка сервиса начитывания репортов</span> ([d5204c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d5204c0e6470e9f4858b800da4bfb779bd9d3d6a))
83
+ * <span style='color:green'>feat: BFL-8383 механизм сравнения конфигураций кастомных панелей</span> ([4514f1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4514f131b714942a8314d772726ce33989d334fa))
58
84
 
59
85
  * ## Fixes
60
86
  * <span style='color:red'> HT-4550 fix excel file download</span> ([b81e8d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b81e8d28b762e38362624149ddaaf9d9b5daa272))
61
87
  * <span style='color:red'> HT-4550 fix excel file download</span> ([e4844c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e4844c0511d5401d1659be45539fe390bc50aa16))
62
88
  * <span style='color:red'> HT-4550 fix excel file download</span> ([a7b080], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a7b080f4a12fc6c0abd31fc06f623fc5122d4951))
89
+ * <span style='color:red'>Fix:TR-67289 fix keymap on GenerateTokenPanel</span> ([e28741], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e2874137ce85818e6f9c71f91b397a17e0eb4d72))
63
90
 
64
91
  * CRM-7619 Доработка ReportLookupCombo дефолтными параметрами ([b9ddb1], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b9ddb10c22f857d4bf33a3f66ec0ee46d8ea2add))
65
92
  * update: CHANGELOG.md ([e8d820], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e8d82018b4cb33252c4bc997473449a4bf9d94a0))
@@ -70,6 +97,7 @@
70
97
 
71
98
  # Version 2.5.23, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2bd9602f16f9aec3aedc7bff149d7c7357afb558)
72
99
  * ## Features
100
+ * <span style='color:green'>feat: HT-6956 add SQL beautifier</span> ([8d7883], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/8d7883cdcda181c7e6cfa3da73276059242fafee))
73
101
  * <span style='color:green'>feat: Добавить возможность выполнять репорт без кеша. Closes BFL-8384.</span> ([0ef6d5], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/0ef6d559e8fca3f626747a8d60a21a0c1c6cc076))
74
102
 
75
103
  * ## Fixes
package/index.js CHANGED
@@ -7,6 +7,7 @@ import xAceJson from 'ace-builds/src-noconflict/mode-json5';
7
7
  import xAceLangTool from 'ace-builds/src-noconflict/ext-language_tools';
8
8
  import xAceSnippets from 'ace-builds/src-noconflict/snippets/snippets';
9
9
  import JSON5 from 'json5';
10
+ import {format as formatSQL} from 'sql-formatter';
10
11
  import 'extjs_iconpack';
11
12
  import 'ace-diff/dist/ace-diff.min.css';
12
13
  import 'ace-builds/src-noconflict/worker-json';
@@ -33,4 +34,5 @@ Object.assign(Ext || {}, {
33
34
  xAceJson,
34
35
  xAceLangTool,
35
36
  xAceSnippets,
37
+ formatSQL
36
38
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.5.32",
7
+ "version": "2.5.34",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -29,7 +29,8 @@
29
29
  "extjs_iconpack": "1.3.15",
30
30
  "json5": "2.2.3",
31
31
  "object-hash": "^3.0.0",
32
- "sigma-printjs": "^1.0.1"
32
+ "sigma-printjs": "^1.0.1",
33
+ "sql-formatter": "^13.0.0"
33
34
  },
34
35
  "devDependencies": {
35
36
  "eslint": "^8.15.0",
@@ -1,44 +1,76 @@
1
+ /**
2
+ * @param {boolean} parseParameters включает возможность задавать правила фильтрации для репортов
3
+ * внутри ParameterizedReportCombo и его наследников
4
+ * @param {Array<object>} searchParams список параметров фильтрации для используемого репорта и их правила
5
+ * @example
6
+ * regExp и fn задают правила, по которым сопоставляется value с параметром, по которому будет запущен поиск в репорте.
7
+ * regExp и fn - не обязательные, в случае их отсуствия поиск будет выполняться по указанному параметру.
8
+ * {
9
+ * xtype: 'SimplestReportCombo',
10
+ * valueField: 'PERSON_ID',
11
+ * displayField: 'CONTACT_NAME',
12
+ * reportId: 'CLIENT_CONTACTS',
13
+ * listConfig: {
14
+ * itemCls: 'tablecell',
15
+ * tpl:
16
+ * '<div>' +
17
+ * '<tpl for=".">' +
18
+ * '<div class="tablecell">' +
19
+ * '<div class="customer">{CONTACT_NAME}</div>' +
20
+ * '<div class="headname"> </div>' +
21
+ * '<div class="address">{ADDRESS}</div>' +
22
+ * '</div>' +
23
+ * '</tpl>' +
24
+ * '</div>',
25
+ * },
26
+ * searchParams: [
27
+ * {
28
+ * fieldName: 'PER_INN', // репорт будет запушен по этому параметру, если value не подойдет ни под одно из правил
29
+ * label: 'ИНН',
30
+ * },
31
+ * {
32
+ * fieldName: 'DOG_NUM',
33
+ * label: '№ договора ЭС',
34
+ * regExp: /(^[0-9]{6}$)|(^[0-9]{14}$)/,
35
+ * },
36
+ * {
37
+ * fieldName: 'PER_FULL_NAME',
38
+ * label: 'Наименование',
39
+ * fn: function(value, lastValue) {
40
+ * return lastValue ? lastValue + ' ' + value : value;
41
+ * }
42
+ * }
43
+ * ]
44
+ * }
45
+ *
46
+ */
1
47
  Ext.define('Coon.report.component.ParameterizedReportCombo', {
2
48
  extend: 'Coon.common.field.combo.BaseComboBox',
3
49
  alias: 'widget.ParameterizedReportCombo',
4
50
  cls: 'ParameterizedReportCombo',
5
51
  uses: [],
6
52
  config: {
7
- settings: [
8
- {
9
- fieldName: 'PER_INN',
10
- label: 'ИНН',
11
- regExp: /(^[0-9]{10,12}$)/,
12
- }, {
13
- fieldName: 'DOG_NUM',
14
- label: '№ договора ЭС',
15
- regExp: /(^[0-9]{6}$)|(^[0-9]{14}$)/,
16
- }, {
17
- fieldName: 'PHONE_NUMBER',
18
- label: 'Телефон',
19
- regExp: /^(([1-9]){3}-([0-9]){2}-([0-9]){2})$|^((\+7|7|8)+([0-9]){10})$/,
20
- },
21
- /* {
22
- fieldName: 'DPS_NUM',
23
- label: '№ договора ДПС',
24
- regExp : /^[0-9]{14}$/
25
- },*/{
26
- fieldName: 'PER_FULL_NAME',
27
- label: 'Наименование',
28
- fn: function(value, lastValue) {
29
- return lastValue ? lastValue + ' ' + value : value;
30
- },
31
- }
32
- ],
33
-
34
53
  fieldSplitter: ' ',
35
54
  parseParameters: true,
36
55
  checkChangeBuffer: 700,
37
56
  memberFn: {},
57
+ searchParams: [],
58
+ },
59
+
60
+ statics: {
61
+ searchRules: [],
62
+ setSearchRules: function(params) {
63
+ this.searchRules = params;
64
+ },
38
65
  },
39
66
 
40
67
  initComponent: function() {
41
68
  if (this.parseParameters) {
69
+ if (!Ext.isEmpty(this.settings)) {
70
+ const params = Array.isArray(this.settings) ? this.settings : [this.settings];
71
+ this.setSearchParams(params);
72
+ }
73
+
42
74
  const templateString =
43
75
  '<div class="header">' +
44
76
  '<tpl if="this.hasParams()">' +
@@ -66,8 +98,11 @@ Ext.define('Coon.report.component.ParameterizedReportCombo', {
66
98
  const memberFn = Ext.applyIf(this.memberFn || {}, {
67
99
  getLastOptions: function() {
68
100
  const data = [];
69
- for (let i = 0; i < this.combo.settings.length; i++) {
70
- const obj = this.combo.settings[i];
101
+ const searchParamsConfig = !Ext.isEmpty(this.getSearchParams()) ?
102
+ this.getSearchParams() :
103
+ Coon.report.component.ParameterizedReportCombo.searchRules;
104
+ for (let i = 0; i < searchParamsConfig.length; i++) {
105
+ const obj = searchParamsConfig[i];
71
106
  if (this.combo.lastOptions[obj['fieldName']]) {
72
107
  data.push({LABEL: obj.label, VALUE: this.combo.lastOptions[obj['fieldName']]});
73
108
  }
@@ -93,42 +128,103 @@ Ext.define('Coon.report.component.ParameterizedReportCombo', {
93
128
  this.callParent();
94
129
  if (this.parseParameters) {
95
130
  this.on('change', function(combo, value) {
96
- if ((value === this.getRawValue() || !value)&& this.getRawValue() != '') {
131
+ if ((value === this.getRawValue() || !value)&& this.getRawValue() !== '') {
97
132
  this.parseParams(value);
98
133
  }
99
134
  }, this);
135
+
136
+ this.store.on('load', this.expand, this, {single: true});
100
137
  }
101
138
  },
102
139
 
103
- parseParams: function(searchString) {
104
- if (searchString) {
105
- const params = {};
106
- const searchArray = searchString.split(this.fieldSplitter);
107
- for (let i=0; i < searchArray.length; i++) {
108
- for (let j=0; j < this.settings.length; j++) {
109
- const rule = this.settings[j];
110
- const name = rule.fieldName;
111
- if (!name) {
112
- return;
113
- }
114
- if (!Ext.isEmpty(rule.regExp) && searchArray[i].search(rule.regExp) !== -1) {
115
- params[name] = searchArray[i];
116
- break;
117
- } else if (!Ext.isEmpty(rule.fn)) {
118
- params[name] = rule.fn(searchArray[i], params[name]);
119
- break;
120
- } else if (Ext.isEmpty(rule.fn) && Ext.isEmpty(rule.regExp)) {
121
- params[name] = params[name] ? params[name] + ' ' + searchArray[i] : searchArray[i];
122
- }
140
+ defineSearchParams() {
141
+ const params = {};
142
+ const searchString = this.getRawValue();
143
+ const searchArray = searchString.split(this.fieldSplitter);
144
+ for (let i=0; i < searchArray.length; i++) {
145
+ const searchParamsConfig = !Ext.isEmpty(this.getSearchParams()) ?
146
+ this.getSearchParams() :
147
+ Coon.report.component.ParameterizedReportCombo.searchRules;
148
+ for (let j=0; j < searchParamsConfig.length; j++) {
149
+ const rule = searchParamsConfig[j];
150
+ const name = rule.fieldName;
151
+ if (!name) {
152
+ return;
153
+ }
154
+ if (!Ext.isEmpty(rule.regExp) && searchArray[i].search(rule.regExp) !== -1) {
155
+ params[name] = searchArray[i];
156
+ break;
157
+ } else if (!Ext.isEmpty(rule.fn)) {
158
+ params[name] = rule.fn(searchArray[i], params[name]);
159
+ break;
160
+ } else if (Ext.isEmpty(rule.fn) && Ext.isEmpty(rule.regExp)) {
161
+ params[name] = params[name] ? params[name] + ' ' + searchArray[i] : searchArray[i];
123
162
  }
124
163
  }
125
- this.lastOptions = params;
164
+ }
165
+ return params;
166
+ },
167
+
168
+ parseParams: function(searchString) {
169
+ if (searchString) {
170
+ this.lastOptions = this.defineSearchParams();
126
171
  } else {
127
172
  this.lastOptions = undefined;
128
173
  }
129
- this.on('load', this.expand, this, {single: true});
130
174
  this.doInit(this.lastOptions);
131
175
  },
132
176
 
177
+ doLocalQuery: function(queryPlan) {
178
+ const me = this;
179
+ const queryString = queryPlan.query;
180
+ const store = me.getStore();
181
+ let value = queryString;
182
+
183
+ me.clearLocalFilter();
184
+
185
+ // Querying by a string...
186
+ if (queryString !== null) {
187
+ // User can be typing a regex in here, if it's invalid
188
+ // just swallow the exception and move on
189
+ if (me.enableRegEx) {
190
+ try {
191
+ value = new RegExp(value);
192
+ } catch (e) {
193
+ value = null;
194
+ }
195
+ }
196
+
197
+ if (!this.parseParameters) {
198
+ // Must set changingFilters flag for this.checkValueOnChange.
199
+ // the suppressEvents flag does not affect the filterchange event
200
+ me.changingFilters = true;
201
+ const filter = me.queryFilter = new Ext.util.Filter({
202
+ id: me.id + '-filter',
203
+ anyMatch: me.anyMatch,
204
+ caseSensitive: me.caseSensitive,
205
+ root: 'data',
206
+ property: me.displayField,
207
+ value: value,
208
+ });
209
+
210
+ store.addFilter(filter, true);
211
+ me.changingFilters = false;
212
+ }
213
+ }
214
+
215
+ // Expand after adjusting the filter if there are records or if emptyText is configured.
216
+ if (me.store.getCount() || me.getPicker().emptyText) {
217
+ // The filter changing was done with events suppressed, so
218
+ // refresh the picker DOM while hidden and it will layout on show.
219
+ me.getPicker().refresh();
220
+ me.expand();
221
+ } else {
222
+ me.collapse();
223
+ }
224
+
225
+ me.afterQuery(queryPlan);
226
+ },
227
+
228
+
133
229
  doInit: Ext.emptyFn,
134
230
  });
@@ -240,11 +240,20 @@ Ext.define('Coon.report.component.ReportLookupCombo', {
240
240
  * @param {string} value
241
241
  */
242
242
  loadReportData(value) {
243
+ if (Ext.isObject(value)) {
244
+ if (typeof value.isModel === 'function' && value.isModel() && this.valueField) {
245
+ value = value.get(this.valueField);
246
+ } else {
247
+ Coon.log.error('ReportLookupCombo has an object value param in loadReportData function!');
248
+ return false;
249
+ }
250
+ }
243
251
  if (value && this._cachedValue === value && this.getStore().getData().length) {
244
252
  this.selectRecordByValue(value);
245
253
  return;
246
254
  }
247
255
  const parameters = Object.assign(
256
+ {},
248
257
  this.getFilterDefaults(),
249
258
  this.params,
250
259
  {
@@ -335,7 +344,7 @@ Ext.define('Coon.report.component.ReportLookupCombo', {
335
344
  this.setViewModelValue(record);
336
345
  }
337
346
  this.store.loadData([record]);
338
- this.select(record);
347
+ this.setValue(record[this.valueField]);
339
348
  },
340
349
 
341
350
  /**
@@ -386,6 +395,7 @@ Ext.define('Coon.report.component.ReportLookupCombo', {
386
395
  });
387
396
  win.show();
388
397
  const parameters = Object.assign(
398
+ {},
389
399
  this.getFilterDefaults(),
390
400
  this.params || {}
391
401
  );
@@ -27,6 +27,7 @@ Ext.define('Coon.report.component.reportpanel.FilterPanel', {
27
27
  border: false,
28
28
  },
29
29
  enableHighlightingRequiredFields: false,
30
+ hiddenLegend: false,
30
31
  },
31
32
  initComponent: function() {
32
33
  this.layout = {
@@ -104,7 +105,7 @@ Ext.define('Coon.report.component.reportpanel.FilterPanel', {
104
105
  this.items.push(currentLayout);
105
106
  }
106
107
 
107
- if (this.enableHighlightingRequiredFields && this.hasVisibleAndRequired()) {
108
+ if (this.isLegendHidden()) {
108
109
  this.legend = this.buildLegend();
109
110
  height += this.legend.height;
110
111
  this.items.push(this.legend);
@@ -113,16 +114,20 @@ Ext.define('Coon.report.component.reportpanel.FilterPanel', {
113
114
  this.height = Math.max(height, 50);
114
115
  },
115
116
 
117
+ isLegendHidden: function() {
118
+ return this.enableHighlightingRequiredFields && this.hasRequired() && !this.hiddenLegend;
119
+ },
120
+
116
121
  /**
117
122
  * Проверка наличия в репорте обязательных видимых параметров.
118
123
  * @returns {boolean|T}
119
124
  */
120
- hasVisibleAndRequired() {
125
+ hasRequired() {
121
126
  const ns = Coon.report.model.ReportParameterBeanFields;
122
127
  if (!this.configurationList.length) {
123
128
  return false;
124
129
  }
125
- return (this.configurationList || []).find((configuration) =>
130
+ return (this.configurationList).find((configuration) =>
126
131
  configuration[ns.$requiredSwitch] === true && configuration[ns.$visibleSwitch] === true);
127
132
  },
128
133
 
@@ -306,15 +311,11 @@ Ext.define('Coon.report.component.reportpanel.FilterPanel', {
306
311
  * @param {string} msg сообщение о невалидности
307
312
  */
308
313
  searchButtonToggle(isValid, msg) {
309
- if (this.enableHighlightingRequiredFields) {
310
- if (this.hasVisibleAndRequired()) {
311
- if (this.legend) {
312
- this.legend.setTooltipMsg(isValid ? '': msg);
313
- this.legend.fireEvent('validitychange', isValid);
314
- }
315
- this.fireEvent('searchbuttontoggle', isValid, 'Обязательные поля не заполнены!');
316
- }
314
+ if (this.isLegendHidden()) {
315
+ this.legend.setTooltipMsg(isValid ? '': msg);
316
+ this.legend.fireEvent('validitychange', isValid);
317
317
  }
318
+ this.fireEvent('searchbuttontoggle', isValid, 'Обязательные поля не заполнены!');
318
319
  },
319
320
 
320
321
  /**
@@ -96,13 +96,14 @@ Ext.define('Coon.report.component.report.NorthPanel', {
96
96
  confirmHandler: this.reportPanel ? Ext.bind(this.reportPanel.filterHandler, this.reportPanel): Ext.emptyFn,
97
97
  });
98
98
 
99
- const enableHighlightingRequiredFields = this.isEnableHighlightingRequiredFields(reportFormBean.plugins, properties);
99
+ const [enableHighlightingRequiredFields, hiddenLegend] = this.hasPropertiesFilterPanel(reportFormBean.plugins, properties);
100
100
 
101
101
  const filterPanel = Ext.widget('FilterPanel', {
102
102
  configurationList: reportFormBean[ns.$parameters],
103
103
  itemsOnRow: properties['filterItemsOnRow'] || 2,
104
104
  enableHighlightingRequiredFields: enableHighlightingRequiredFields,
105
105
  plugins: this.filterPlugins,
106
+ hiddenLegend: hiddenLegend,
106
107
  });
107
108
  filterPanel.on('searchbuttontoggle', function(isValid, errorMessage) {
108
109
  this.searchButton.setDisabled(!isValid);
@@ -128,18 +129,20 @@ Ext.define('Coon.report.component.report.NorthPanel', {
128
129
  },
129
130
 
130
131
  /**
131
- * Определение свойства, регулирующего применение плагина RequiredFlagPlugin.
132
+ * Определение свойств, регулирующего применение плагина RequiredFlagPlugin и скрытия легенды.
132
133
  * @param {Array} plugins
133
134
  * @param {Object} properties
134
135
  * @returns {*|boolean|boolean}
135
136
  */
136
- isEnableHighlightingRequiredFields: function(plugins, properties) {
137
+ hasPropertiesFilterPanel: function(plugins, properties) {
137
138
  const isValidationPlugin = (plugins || []).find((item) => item.uiElement.xtype === 'ReportGroupsFieldValidationPlugin');
138
139
  // При наличии плагина валидации параметров по группам обязательно используем RequiredFlagPlugin
139
140
  if (isValidationPlugin) {
140
- return true;
141
+ const hiddenLegend = JSON.parse(isValidationPlugin.uiElement.propertyData).hiddenLegend;
142
+ return [true, hiddenLegend];
141
143
  }
142
- return this.enableHighlightingRequiredFields || properties.enableHighlightingRequiredFields;
144
+ const enableHighlightingRequiredFields = this.enableHighlightingRequiredFields || properties.enableHighlightingRequiredFields;
145
+ return [enableHighlightingRequiredFields, false];
143
146
  },
144
147
 
145
148
  clear() {
@@ -109,11 +109,12 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanel', {
109
109
  text: 'Предпросмотр SQL',
110
110
  ui: 'blue-text-button-border',
111
111
  handler: 'sqlPreviewHandler',
112
+ margin: '0 0 0 20px',
112
113
  },
113
114
  {
114
115
  xtype: 'segmentedbutton',
115
116
  stateId: 'ReportFormCommonPanel.sqlmode',
116
- margin: '0 0 0 50px',
117
+ margin: '0 0 0 20px',
117
118
  items: [
118
119
  {
119
120
  itemId: 'sql',
@@ -127,6 +128,20 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanel', {
127
128
  handler: 'chooseSqlMode',
128
129
  }
129
130
  ],
131
+ },
132
+ {
133
+ xtype: 'splitbutton',
134
+ margin: '0 0 0 20px',
135
+ ui: 'blue-text-button-border',
136
+ text: 'Украсить SQL',
137
+ handler: 'beautifySQL',
138
+ menu: [
139
+ {
140
+ xtype: 'menuitem',
141
+ text: 'Настройка форматирования',
142
+ handler: 'openBeautifierSettings',
143
+ }
144
+ ],
130
145
  }
131
146
  ],
132
147
  },
@@ -1,10 +1,28 @@
1
1
  Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelController', {
2
2
  extend: 'Ext.app.ViewController',
3
3
  alias: 'controller.ReportFormCommonPanelController',
4
+ defaultBeautifierConfig: {
5
+ language: 'plsql',
6
+ keywordCase: 'upper',
7
+ logicalOperatorNewline: 'before',
8
+ denseOperators: false,
9
+ useTabs: false,
10
+ tabWidth: 1,
11
+ newlineBeforeSemicolon: false,
12
+ indentStyle: 'standard',
13
+ },
14
+
15
+ init() {
16
+ this.beautifierConfig = Ext.apply({}, this.defaultBeautifierConfig);
17
+ },
4
18
 
5
19
  chooseSqlMode: function(button) {
20
+ const vm = this.getViewModel();
6
21
  const editor = this.lookup('reportSQLField').editor;
22
+ const language = button.itemId === 'sql' ? 'plsql' : 'postgresql';
7
23
  editor.session.setMode(`ace/mode/${button.itemId}`);
24
+ this.defaultBeautifierConfig.language = language;
25
+ vm.set('language', language);
8
26
  },
9
27
 
10
28
  reportTypeChangeHandler: function(field) {
@@ -27,7 +45,6 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelControlle
27
45
  return Coon.Function.validateAllFieldsOnForm(this.getView());
28
46
  },
29
47
 
30
-
31
48
  clear: function() {
32
49
  Coon.Function.clearAllFieldsOnForm(this);
33
50
  },
@@ -41,8 +58,66 @@ Ext.define('Coon.report.component.settings.common.ReportFormCommonPanelControlle
41
58
  items: panel,
42
59
  });
43
60
  win.show();
44
- win.content.doInit(
45
- this.getViewModel().get('report')
46
- );
61
+ win.content.doInit(this.getViewModel().get('report'));
62
+ },
63
+
64
+ 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
+ }]});
84
+ this.setBeautifierConfigFieldsData(win);
85
+ win.show();
86
+ },
87
+
88
+ saveBeautifierConfig: function(win) {
89
+ const newBeautifierConfig = this.getBeautifierConfigFieldsData(win);
90
+ this.beautifierConfig = newBeautifierConfig;
91
+ win.close();
92
+ },
93
+
94
+ setBeautifierConfigFieldsData: function(win) {
95
+ Object.keys(this.beautifierConfig).map((key) => {
96
+ const field = win.down(`#${key}`);
97
+ if (field) {
98
+ field.setValue(this.beautifierConfig[key]);
99
+ }
100
+ });
101
+ },
102
+
103
+ getBeautifierConfigFieldsData: function(win) {
104
+ const config = {};
105
+ Object.keys(this.beautifierConfig).map((key) => {
106
+ const field = win.down(`#${key}`);
107
+ if (field) {
108
+ config[key] = field.getValue();
109
+ }
110
+ });
111
+ return config;
112
+ },
113
+
114
+ beautifySQL: function() {
115
+ try {
116
+ const editor = this.lookup('reportSQLField').editor;
117
+ this.beautifierConfig.language = this.defaultBeautifierConfig.language;
118
+ editor.getSession().setValue(Ext.formatSQL(editor.getSession().getValue(), this.beautifierConfig));
119
+ } catch (e) {
120
+ Coon.log.error(e);
121
+ }
47
122
  },
48
123
  });
@@ -0,0 +1,85 @@
1
+ Ext.define('Coon.report.component.settings.common.ReportSqlBeautifierPanel', {
2
+ extend: 'Ext.panel.Panel',
3
+ alias: 'widget.ReportSqlBeautifierPanel',
4
+ xtype: 'ReportSqlBeautifierPanel',
5
+ header: false,
6
+
7
+ title: 'Настройка форматирования',
8
+ minWidth: 400,
9
+ layout: {
10
+ type: 'vbox',
11
+ align: 'stretch',
12
+ },
13
+
14
+ items: [
15
+ {
16
+ xtype: 'ConstantList',
17
+ margin: '10px',
18
+ fieldLabel: 'Регистр операторов',
19
+ itemId: 'keywordCase',
20
+ data: [
21
+ ['upper', 'Прописные'],
22
+ ['lower', 'Строчные']
23
+ ],
24
+ },
25
+ {
26
+ xtype: 'ConstantList',
27
+ margin: '10px',
28
+ fieldLabel: 'Перенос на новую строку OR/AND',
29
+ itemId: 'logicalOperatorNewline',
30
+ data: [
31
+ ['before', 'Перенести до OR/AND'],
32
+ ['after', 'Перенести после OR/AND']
33
+ ],
34
+ },
35
+ {
36
+ xtype: 'ConstantList',
37
+ margin: '10px',
38
+ fieldLabel: 'Стиль арифметических операторов',
39
+ itemId: 'denseOperators',
40
+ data: [
41
+ [false, 'Пробелы вокруг оператора'],
42
+ [true, 'Без пробелов']
43
+ ],
44
+ },
45
+ {
46
+ xtype: 'checkbox',
47
+ boxLabel: 'Использовать таб вместо пробелов',
48
+ itemId: 'useTabs',
49
+ bind: {
50
+ value: '{beautifier.useTabs}',
51
+ },
52
+ margin: '10px',
53
+ },
54
+ {
55
+ xtype: 'numberfield',
56
+ fieldLabel: 'Количество пробелов в отступе',
57
+ itemId: 'tabWidth',
58
+ bind: {
59
+ disabled: '{beautifier.useTabs}',
60
+ },
61
+ margin: '10px',
62
+ },
63
+ {
64
+ xtype: 'ConstantList',
65
+ margin: '10px',
66
+ itemId: 'newlineBeforeSemicolon',
67
+ fieldLabel: 'Положение точки с запятой',
68
+ data: [
69
+ [false, 'Не переносить на новую строку'],
70
+ [true, 'С новой строки']
71
+ ],
72
+ },
73
+ {
74
+ xtype: 'ConstantList',
75
+ margin: '10px',
76
+ fieldLabel: 'Общий стиль форматирования',
77
+ itemId: 'indentStyle',
78
+ data: [
79
+ ['standard', 'Стандартный'],
80
+ ['tabularLeft', 'Выровнять по левой стороне'],
81
+ ['tabularRight', 'Выровнять по правой стороне']
82
+ ],
83
+ }
84
+ ],
85
+ });
@@ -36,6 +36,12 @@ Ext.define('Coon.report.plugin.configPanel.reportGroupsFieldValidationPlugin.Rep
36
36
  margin: '20 0 20 20',
37
37
  });
38
38
 
39
+ this.hiddenLegend = Ext.create('Ext.form.field.Checkbox', {
40
+ boxLabel: 'Убрать легенду',
41
+ name: 'hiddenLegend',
42
+ margin: '0 0 0 20',
43
+ });
44
+
39
45
  this.parameterTree = Ext.widget('UnusedParametersTree', {
40
46
  itemId: 'parameterTree',
41
47
  flex: 1,
@@ -48,8 +54,13 @@ Ext.define('Coon.report.plugin.configPanel.reportGroupsFieldValidationPlugin.Rep
48
54
 
49
55
  return [
50
56
  {
57
+ layout: {
58
+ type: 'vbox',
59
+ align: 'stretch',
60
+ },
51
61
  items: [
52
- this.groupRelationCheckbox
62
+ this.groupRelationCheckbox,
63
+ this.hiddenLegend
53
64
  ],
54
65
  },
55
66
  {
@@ -134,6 +145,7 @@ Ext.define('Coon.report.plugin.configPanel.reportGroupsFieldValidationPlugin.Rep
134
145
  });
135
146
  config['validationGroups'] = groups;
136
147
  config['groupsRelationType'] = this.groupRelationCheckbox.getValue();
148
+ config['hiddenLegend'] = this.hiddenLegend.getValue();
137
149
  return config;
138
150
  },
139
151
  });
@@ -25,6 +25,7 @@ Ext.define('Coon.report.plugin.form.ReportGroupsFieldValidationPlugin', {
25
25
  config: {
26
26
  groupsRelationType: '',
27
27
  validationGroups: [],
28
+ hiddenLegend: false,
28
29
  },
29
30
  isSingle: true,
30
31
  customAllowBlankName: 'validateBlankByPlugin',
@@ -14,7 +14,16 @@ Ext.define('Coon.security.GenerateTokenPanel', {
14
14
  pending: true,
15
15
  },
16
16
  },
17
-
17
+ keyMapEnabled: true,
18
+ keyMap: {
19
+ Enter: {
20
+ handler() {
21
+ if (Coon.Function.validateAllFieldsOnForm(this.getComponent('form'))) {
22
+ this.getController().handler();
23
+ }
24
+ },
25
+ },
26
+ },
18
27
  width: 520,
19
28
  height: 240,
20
29
  bodyPadding: 20,
@@ -23,14 +32,6 @@ Ext.define('Coon.security.GenerateTokenPanel', {
23
32
  xtype: 'form',
24
33
  itemId: 'form',
25
34
  bodyPadding: 10,
26
- keyMapEnabled: true,
27
- keyMap: {
28
- Enter: {
29
- handler() {
30
- this.handler();
31
- },
32
- },
33
- },
34
35
  layout: 'anchor',
35
36
  defaults: {
36
37
  anchor: '100%',
@@ -15,6 +15,7 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditor', {
15
15
  'Coon.uielement.component.settings.config.UiCPConfigPanel'
16
16
  ],
17
17
  controller: 'UiCustomPanelEditorController',
18
+ cls: 'UiCustomPanelEditor',
18
19
  viewModel: {
19
20
  type: 'UiCustomEditorViewModel',
20
21
  },
@@ -198,9 +199,50 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditor', {
198
199
  {
199
200
  fieldLabel: 'Description',
200
201
  reference: 'description',
201
- allowOnlyWhitespace: false,
202
202
  xtype: 'textfield',
203
+ allowOnlyWhitespace: false,
203
204
  bind: '{uiElement.description}',
205
+ },
206
+ {
207
+ xtype: 'fieldset',
208
+ title: 'Сравнение содержимого панелей',
209
+ collapsible: true,
210
+ collapsed: true,
211
+ layout: 'hbox',
212
+ items: [
213
+ {
214
+ xtype: 'button',
215
+ ui: 'blue-text-button-border',
216
+ text: 'Скопировать hash',
217
+ reference: 'copyHash',
218
+ handler: 'copyHash',
219
+ margin: '0 0 0 10',
220
+ },
221
+ {
222
+ xtype: 'textfield',
223
+ tooltip: 'Вставить hash для проверки',
224
+ reference: 'insertHash',
225
+ margin: '0 0 0 20',
226
+ width: 400,
227
+ listeners: {
228
+ change: 'checkEqualuty',
229
+ },
230
+ triggers: {
231
+ clear: {
232
+ cls: 'svg-icon svg-icon-cancel-small',
233
+ tooltip: 'Очистить поле',
234
+ hidden: false,
235
+ handler: 'clearTrigger',
236
+ },
237
+ },
238
+ },
239
+ {
240
+ xtype: 'component',
241
+ reference: 'iconComponent',
242
+ margin: '6 0 0 0',
243
+ html: '',
244
+ }
245
+ ],
204
246
  }
205
247
  ],
206
248
  }
@@ -0,0 +1,10 @@
1
+ .UiCustomPanelEditor {
2
+ .good-hash {
3
+ color: #64AA2B;
4
+ font-size: 19px;
5
+ }
6
+ .bad-hash {
7
+ color: red;
8
+ font-size: 19px;
9
+ }
10
+ }
@@ -8,7 +8,6 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
8
8
  'Coon.report.component.EXTJSUiPanelImportJsonForm',
9
9
  'Coon.uielement.component.settings.UiCustomPanelAnnotationWindow'
10
10
  ],
11
-
12
11
  control: {
13
12
  'button#searchHandlerBtn': {
14
13
  click: 'onSearchHandler',
@@ -153,6 +152,8 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
153
152
  const plugins = [];
154
153
  const aceEditorPlugins = [];
155
154
  const parsed = JSON5.parse(UIElementBean.propertyData);
155
+ const uiElementHash = Coon.util.generateHashFromObj(UIElementBean.propertyData);
156
+ this.getViewModel().set('uiElementHash', uiElementHash);
156
157
  if (parsed.plugins && Ext.isArray(parsed.plugins)) {
157
158
  this.updateHandlersStore(parsed.plugins);
158
159
  parsed.plugins.forEach(function(plugin) {
@@ -298,6 +299,7 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
298
299
  command.on('complete', function(uiElementBean) {
299
300
  this.initialPropertyData = uiElementBean.propertyData;
300
301
  vm.set('uiElement', uiElementBean);
302
+ vm.set('uiElementHash', Coon.util.generateHashFromObj(uiElementBean.propertyData));
301
303
  Ext.Msg.alert('Сообщение системы', 'Данные сохранены');
302
304
  }, this);
303
305
  command.execute(vm.get('uiElement'));
@@ -482,4 +484,33 @@ Ext.define('Coon.uielement.component.settings.UiCustomPanelEditorController', {
482
484
  },
483
485
  });
484
486
  },
487
+ copyHash: function() {
488
+ const hash = this.getViewModel().get('uiElementHash');
489
+ Coon.util.copyToClipboard(hash);
490
+ },
491
+ checkEqualuty: function() {
492
+ const field = this.lookup('insertHash');
493
+ const hash = field.getValue();
494
+ field.setValue(hash.replace(/[^A-Za-z0-9]/g, '').trim());
495
+ const uiElementHash = this.getViewModel().get('uiElementHash');
496
+ const iconComponent = this.lookup('iconComponent');
497
+
498
+ if (hash === uiElementHash) {
499
+ iconComponent.setHtml(
500
+ `<i class="fas fa-check-circle good-hash"
501
+ data-qtip="Введённый хэш идентичен хэшу текущей панели">
502
+ </i>`
503
+ );
504
+ } else {
505
+ iconComponent.setHtml(
506
+ `<i class="fas fa-times-circle bad-hash"
507
+ data-qtip="Введённый хэш не совпадает с хэшем текущей панели!">
508
+ </i>`
509
+ );
510
+ }
511
+ },
512
+ clearTrigger: function(field) {
513
+ field.clear();
514
+ this.lookup('iconComponent').setHtml('');
515
+ },
485
516
  });
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.5.32',
3
+ number: '2.5.34',
4
4
  });