ru.coon 2.5.49 → 2.5.51

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,4 +1,25 @@
1
+ # Version 2.5.51, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/86e7f44d186c08b70ff00747e70cbb182686afd7)
2
+ * ## Features
3
+ * <span style='color:green'>feat: Добавлен вывод информации о количестве отчетов, в которых используются настройки экземпляра плагина. Closes HT-7432.</span> ([ccd4b9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ccd4b9d8f5be9a7e9fb9edb4f7cc9c642a26c3a7))
4
+
5
+ * ## Fixes
6
+ * <span style='color:red'>Fix:HT-7717 check fieldEnd available in DatePickerPresetsField</span> ([6e6b33], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6e6b3308d04afa2692997d71a3d62330f64d67d6))
7
+ * <span style='color:red'> HT-7346: fix file name</span> ([01983d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/01983d80a30d5fd27892cb7c6e6900b27aebdf1f))
8
+
9
+ * update: CHANGELOG.md ([538bf4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/538bf4e7fc238603638f833a7fe3f5ef28bdf513))
10
+
11
+ # Version 2.5.50, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b79597948d4412d8613b028e5e07e49cfb173eb4)
12
+ * ## Features
13
+ * <span style='color:green'>feat: HT-7346: rename plugin</span> ([e06f2c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e06f2cd09c83890ca955c6a11d3071a8d31a1528))
14
+
15
+ * update: CHANGELOG.md ([9ca215], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/9ca2159b8222b4953516c7720fc9f5dbe03e4337))
16
+
1
17
  # Version 2.5.49, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/322a8954fd81ce96ca3e60a23d7b46b4659f839b)
18
+ * ## Features
19
+ * <span style='color:green'>feat: HT-7346: select dock position (top or bottom)</span> ([45db87], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/45db8784c5594ea4add6dc701cd5deb0a2e592e3))
20
+ * <span style='color:green'>feat: HT-7346: add plugin</span> ([614610], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6146105ce74a3c4ab946da32dac3ab16aac848af))
21
+ * <span style='color:green'>feat: HT-7346: add plugin</span> ([e27670], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e27670eb8953cde6b5825b123d0f03d553c097a4))
22
+
2
23
  * ## Fixes
3
24
  * <span style='color:red'>fix Coon.util.promisifyCmd
4
25
  fix ReportPanel.loadData - abort previous request</span> ([03cfbd], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/03cfbdf8eabc0a6fde879fa2ce52bd5126a823ee))
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.5.49",
7
+ "version": "2.5.51",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -160,6 +160,9 @@ Ext.define('Coon.common.field.DatePickerPresetsField', {
160
160
  });
161
161
  },
162
162
  getEndField() {
163
+ if (!this.getConfig('periodEnd')) {
164
+ return null;
165
+ };
163
166
  const ownerCmp = this.up('FilterPanel') || this.up('[dataId=FilterPanel]') || this.up();
164
167
  let cmpQuery = [];
165
168
  if (ownerCmp) {
@@ -243,12 +246,12 @@ Ext.define('Coon.common.field.DatePickerPresetsField', {
243
246
  change: function() {
244
247
  const startDate = this.getValue();
245
248
  const fieldEndDate = this.getEndField();
246
- const endDate = fieldEndDate.getValue();
247
-
248
- fieldEndDate.setMinValue(startDate);
249
-
250
- if (startDate > endDate) {
251
- fieldEndDate.setValue(startDate);
249
+ if (fieldEndDate && startDate) {
250
+ const endDate = fieldEndDate.getValue();
251
+ fieldEndDate.setMinValue(startDate);
252
+ if (startDate > endDate) {
253
+ fieldEndDate.setValue(startDate);
254
+ }
252
255
  }
253
256
  },
254
257
  },
@@ -104,7 +104,7 @@ Ext.define('Coon.report.component.settings.ReportFormEditPanelController', {
104
104
  return data;
105
105
  }, this);
106
106
  }
107
- const command = Ext.create('Coon.report.command.SaveReportSettingsCommand', {
107
+ const command = Ext.create('command.SaveReportSettingsCommand', {
108
108
  activeComponent: view.rendered ? view : Coon.Function.getComponentForMasking(this.getView()),
109
109
  });
110
110
  command.on('complete', function(data) {
@@ -254,6 +254,7 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginGrid', {
254
254
  ptype: 'cellediting', clicksToEdit: 2,
255
255
  listeners: {
256
256
  beforeEdit: 'beforeCellEditHandler',
257
+ edit: 'cellEditHandler',
257
258
  },
258
259
  },
259
260
  {ptype: 'CopyRowsFromGrid'}
@@ -3,9 +3,40 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginGridController
3
3
  alias: 'controller.reportformplugingridcontroller',
4
4
 
5
5
  lastCellContext: undefined,
6
-
6
+ dependentReportsReportId: 'UI_ELEMENT_USED_TABLES',
7
+ constructor() {
8
+ this.callParent(arguments);
9
+ this.dependentReportsCommand = Ext.create('command.GetDynamicReportDataCommand', {
10
+ processError: true,
11
+ listeners: {
12
+ complete: this.onLoadDependentReports.bind(this),
13
+ failure: this.onFailLoadDependentReports.bind(this),
14
+ },
15
+ });
16
+ },
17
+ onLoadDependentReports(data) {
18
+ const reportList = data.list.map((item) => item['DESCR'].replace('report: ', ''));
19
+ const vm = this.getViewModel();
20
+ vm.set(
21
+ {
22
+ dependentReports: reportList.filter((reportId) => reportId !== vm.get('report.reportId')),
23
+ dependentReportsLoadError: null,
24
+ }
25
+ );
26
+ },
27
+ onFailLoadDependentReports(response) {
28
+ this.getViewModel().set(
29
+ {
30
+ dependentReports: [],
31
+ dependentReportsLoadError: response.message,
32
+ }
33
+ );
34
+ },
7
35
  init: function(view) {
8
- view.getSelectionModel().on('selectionchange', this.onSelectionChange, this);
36
+ view.getSelectionModel().on({
37
+ 'selectionchange': this.onSelectionChange.bind(this),
38
+ 'deselect': () => this.getViewModel().set('dependentReports', []),
39
+ });
9
40
  this.getViewModel().set('formEditor', this.getView().formEditor === true);
10
41
  if (this.getView().formEditor) {
11
42
  view.columnManager.getColumns().forEach((r) => {
@@ -21,6 +52,22 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginGridController
21
52
  this.lookup('cloneButton').setDisabled(Ext.isEmpty(selection));
22
53
  deleteButton.setText(!Ext.isEmpty(selection) ?
23
54
  (selection[0].get('isDeleted') ? 'Восстановить' : initialText) : initialText);
55
+ if (!Ext.isEmpty(selection)) {
56
+ this.updateDependentReports(selection[0].get('uiElement'));
57
+ } else {
58
+ this.getViewModel().set('dependentReports', []);
59
+ }
60
+ },
61
+
62
+ updateDependentReports(uiElement) {
63
+ this.dependentReportsCommand.execute(
64
+ this.dependentReportsReportId,
65
+ [
66
+ {
67
+ type: 'UI_ELEMENT_CD', value: uiElement,
68
+ }
69
+ ]
70
+ );
24
71
  },
25
72
 
26
73
  addHandler: function(xtype) {
@@ -159,6 +206,12 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginGridController
159
206
  this.lastCellContext = cellContext;
160
207
  },
161
208
 
209
+ cellEditHandler(editor, context) {
210
+ if (typeof context.record.modified.uiElement === 'string') {
211
+ this.updateDependentReports(context.record.get('uiElement'));
212
+ }
213
+ },
214
+
162
215
  selectUiElementHandler: function(editorField) {
163
216
  const getListUiElementCd = function(value) {
164
217
  Coon.util.promisifyCmd('command.GetDynamicReportDataCommand', 'UI_ELEMENTS_LIST',
@@ -2,12 +2,25 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanel', {
2
2
  extend: 'Ext.panel.Panel',
3
3
  alias: 'widget.ReportFormPluginPanel',
4
4
  uses: [],
5
- requires: [],
5
+ requires: [
6
+ 'Coon.report.component.settings.plugin.ReportFormPluginGrid',
7
+ 'Coon.util'
8
+ ],
6
9
  alternateClassName: [
7
10
  'Sigma.common.components.report.settings.plugins.ReportFormPluginPanel',
8
11
  'Sigma.component.report.settings.ReportFormPluginPanel'
9
12
  ],
10
13
  controller: 'reportformpluginpanelcontroller',
14
+ viewModel: {
15
+ data: {
16
+ dependentReportsLoadError: null,
17
+ dependentReports: [],
18
+ reportCountTextStyle: 'color:inherit;text-decoration: underline;text-underline-offset: 4px',
19
+ },
20
+ formulas: {
21
+ reportsCountText: (get) => Coon.util.pluralize(get('dependentReports.length'), ['отчет', 'отчета', 'отчетов']),
22
+ },
23
+ },
11
24
  title: 'Плагины',
12
25
  layout: 'border',
13
26
  items: [
@@ -34,6 +47,66 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanel', {
34
47
  bind: {
35
48
  title: 'Параметры плагина {pluginsGrid.selection.xtype}: {pluginsGrid.selection.uiElement}',
36
49
  },
50
+ tbar: {
51
+ padding: 0,
52
+ layout: {
53
+ type: 'hbox',
54
+ align: 'stretch',
55
+ },
56
+ hidden: true,
57
+ bind: {
58
+ hidden: '{!dependentReports.length && !dependentReportsLoadError}',
59
+ },
60
+ items: [
61
+ {
62
+ xtype: 'displayfield',
63
+ style: {
64
+ fontSize: '1rem',
65
+ padding: '10px',
66
+ background: 'var(--alert-color)',
67
+ color: 'white',
68
+ fontWeight: 500,
69
+ },
70
+ bind: {
71
+ html: 'ВНИМАНИЕ:',
72
+ },
73
+ },
74
+ {
75
+ xtype: 'displayfield',
76
+ style: {
77
+ fontSize: '1rem',
78
+ color: 'var(--alert-color)',
79
+ padding: '10px 10px 10px 0',
80
+ },
81
+ hidden: true,
82
+ bind: {
83
+ html: `
84
+ Изменение параметров плагина затронет еще
85
+ <a class="clickTarget" href="#" style="{reportCountTextStyle}">
86
+ {reportsCountText}
87
+ <i class="clickTarget fas fa-external-link-alt"></i>
88
+ </a>`,
89
+ hidden: '{!dependentReports.length}',
90
+ },
91
+ listeners: {
92
+ render: 'onReportsCountTextRender',
93
+ },
94
+ },
95
+ {
96
+ xtype: 'displayfield',
97
+ style: {
98
+ fontSize: '1rem',
99
+ color: 'var(--alert-color)',
100
+ padding: '10px 10px 10px 0',
101
+ },
102
+ hidden: true,
103
+ bind: {
104
+ html: 'Невозможно проверить зависимые отчеты: {dependentReportsLoadError}',
105
+ hidden: '{!dependentReportsLoadError}',
106
+ },
107
+ }
108
+ ],
109
+ },
37
110
  }
38
111
  ],
39
112
  });
@@ -16,6 +16,11 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanelControlle
16
16
 
17
17
  saveState: function() {
18
18
  if (this.activeRecord && this.activePanel) {
19
+ this.activePanel.isModified().then((isModified) => {
20
+ if (isModified) {
21
+ // TODO show message
22
+ }
23
+ });
19
24
  const data = this.activePanel.getData();
20
25
  if (data instanceof Promise) {
21
26
  const currentRecord = this.lookup('pluginsGrid').getStore().getById(this.activeRecord.get('id'));
@@ -149,7 +154,7 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanelControlle
149
154
  }
150
155
 
151
156
 
152
- if (this.activePanel) {
157
+ if (this.activePanel && !this.activePanel.destroyed) {
153
158
  paramPanel.add(this.activePanel);
154
159
 
155
160
  // this.activePanel.doInit(this.buildPropertyObj(record[0]));
@@ -325,4 +330,46 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanelControlle
325
330
  }
326
331
  return propertyObj;
327
332
  },
333
+ onReportsCountTextRender(field) {
334
+ const vm = this.getViewModel();
335
+ field.el.on('click', (e) => {
336
+ if (e.target.classList.contains('clickTarget')) {
337
+ e.preventDefault();
338
+ Ext.widget('WindowWrap', {
339
+ autoShow: true,
340
+ scrollable: true,
341
+ title: 'Параметры этого плагина используют ' + vm.get('reportsCountText'),
342
+ layout: 'fit',
343
+ items: [
344
+ {
345
+ xtype: 'grid',
346
+ width: 600,
347
+ maxHeight: 600,
348
+ minHeight: 300,
349
+ store: Ext.create('Ext.data.ArrayStore', {
350
+ autoload: true,
351
+ sorters: ['reportId'],
352
+ fields: ['reportId'],
353
+ proxy: {
354
+ type: 'memory',
355
+ },
356
+ data: vm.get('dependentReports').map((item) => [item]),
357
+ }),
358
+ columns: [
359
+ {
360
+ xtype: 'rownumberer',
361
+ width: 30,
362
+ },
363
+ {
364
+ header: 'CM_REPORT_CD',
365
+ dataIndex: 'reportId',
366
+ flex: 1,
367
+ }
368
+ ],
369
+ }
370
+ ],
371
+ });
372
+ }
373
+ });
374
+ },
328
375
  });
@@ -6,6 +6,7 @@ Ext.define('Coon.report.component.settings.plugin.ReportFormPluginSettings', {
6
6
  ],
7
7
  xtype: 'ReportFormPluginSettings',
8
8
  autoShow: true,
9
+ maximizable: false,
9
10
  selection: null,
10
11
  viewModel: {
11
12
  data: {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Базовый класс предназначеный для работы с конфигурацией (параметрами) плангинов репортов
3
- * Вновь создаваемые конфигурационые классы должны создаваться в папке report/plugin/configPanel
2
+ * Базовый класс предназначенный для работы с конфигурацией (параметрами) плагинов репортов
3
+ * Вновь создаваемые конфигурационные классы должны создаваться в папке report/plugin/configPanel
4
4
  * и заканчиваться сочетанием "наименование плагина" + ConfigPanel.js.
5
5
  * Наименование плагинов должно быть осмысленным и отображать его суть
6
6
  * Дочерние классы должны содержать в себе методы:
@@ -76,6 +76,11 @@ Ext.define('Coon.report.plugin.configPanel.BasePluginConfig', {
76
76
  if (typeof this.getDefaults === 'function') {
77
77
  this.setDefaultValues(data);
78
78
  }
79
+ if (typeof this.initialState === 'undefined') {
80
+ Promise.resolve(this.getConfiguration()).then((state) => {
81
+ this.initialState = state;
82
+ });
83
+ }
79
84
  },
80
85
  /**
81
86
  * Инициализация базового интерфейса
@@ -88,7 +93,7 @@ Ext.define('Coon.report.plugin.configPanel.BasePluginConfig', {
88
93
 
89
94
  this.items = this.createItems();
90
95
  this.callParent();
91
- this.on('beforedestroy', (panel) => {
96
+ this.on('beforedestroy', () => {
92
97
  const tool = this.parent.down('[itemId="show-description-tool"]');
93
98
  if (tool) {
94
99
  tool.destroy();
@@ -105,23 +110,23 @@ Ext.define('Coon.report.plugin.configPanel.BasePluginConfig', {
105
110
  }, this);
106
111
  },
107
112
  /**
108
- * фунлция для переопределения в дочернем классе которая расширяет базовый итерфейс
113
+ * функция для переопределения в дочернем классе которая расширяет базовый интерфейс
109
114
  */
110
115
  createItems: function() {
111
116
  return [];
112
117
  },
113
118
  /**
114
- * фунлция для переопределения в дочернем классе которая позволяет
119
+ * функция для переопределения в дочернем классе которая позволяет
115
120
  * произвести манипуляции с данными и загрузить их в интерфейс
116
- * @param properties {Object} данные для закгрузки в интерфейс
121
+ * @param properties {Object} данные для загрузки в интерфейс
117
122
  */
118
123
  doInit: function(properties) {
119
124
  this.fillConfigForm(properties);
120
125
  },
121
126
  /**
122
- * фунлция для переопределения в дочернем классе которая позволяет
127
+ * функция для переопределения в дочернем классе которая позволяет
123
128
  * произвести манипуляции с данными и загрузить их в интерфейс
124
- * @param properties {Object} данные для закгрузки в интерфейс
129
+ * @param properties {Object} данные для загрузки в интерфейс
125
130
  */
126
131
  fillConfigForm: function(properties) {
127
132
  Coon.Function.fillFormFields(this, properties);
@@ -146,7 +151,7 @@ Ext.define('Coon.report.plugin.configPanel.BasePluginConfig', {
146
151
  }
147
152
  },
148
153
  /**
149
- * фунлция для переопределения в дочернем классе которая позволяет произвести манипуляции с данными, полученными из
154
+ * функция для переопределения в дочернем классе которая позволяет произвести манипуляции с данными, полученными из
150
155
  * интерфейса дочернего класса перед их сохранением
151
156
  * @returns {object} сохраняемые данные
152
157
  */
@@ -241,8 +246,8 @@ Ext.define('Coon.report.plugin.configPanel.BasePluginConfig', {
241
246
  },
242
247
  /**
243
248
  * конвертирует данные для загрузки в интерфейс
244
- * @param properties {Object|String}
245
249
  * @returns {Object}
250
+ * @param parameters
246
251
  */
247
252
  convertParameters: function(parameters) {
248
253
  if (Ext.isString(parameters)) {
@@ -253,4 +258,19 @@ Ext.define('Coon.report.plugin.configPanel.BasePluginConfig', {
253
258
  }
254
259
  return parameters;
255
260
  },
261
+
262
+ async isModified() {
263
+ if (!this.initialState) {
264
+ return false;
265
+ }
266
+ const configuration = await this.getConfiguration();
267
+ return !Coon.util.objectsIsEqual(
268
+ this.initialState,
269
+ Object.assign({}, this.initialState, configuration)
270
+ );
271
+ },
272
+
273
+ resetState() {
274
+ this.setData(this.initialState);
275
+ },
256
276
  });
@@ -17,7 +17,7 @@ Ext.define('Coon.report.plugin.configPanel.FitColumnPluginConfigPanel', {
17
17
  ],
18
18
  },
19
19
  },
20
-
20
+ scrollable: true,
21
21
  createItems: function() {
22
22
  return [
23
23
  {
@@ -25,10 +25,8 @@ Ext.define('Coon.report.plugin.configPanel.FitColumnPluginConfigPanel', {
25
25
  defaults: {
26
26
  width: 500,
27
27
  },
28
- labelWidth: 130,
29
28
  items: [
30
29
  {
31
- layout: 'vbox',
32
30
  items: [
33
31
  this.createDependsOnGridRow(),
34
32
  this.createAddButtonOnToolbarCheckBox()
@@ -0,0 +1,99 @@
1
+ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
2
+ extend: 'Ext.AbstractPlugin',
3
+ alias: 'plugin.UnifiedButtonToolbarPlugin',
4
+ uses: [],
5
+ controller: null,
6
+ windowClose: false,
7
+ compareCash: false,
8
+ configurePanelWizardForFormEditor: 'UnifiedButtonToolbarPluginConfigPanelFormEditor',
9
+
10
+ init: function(view) {
11
+ this.controller = view && view.getController();
12
+ this.controller.on('generateHash', this.generateHash, this);
13
+ this.controller.callDialog = this.callDialog.bind(this);
14
+ const window = view.up('WindowWrap');
15
+ if (window) {
16
+ window.on('beforeclose', this.onBeforeCloseWindow, this);
17
+ }
18
+ this.controller.unifiedButtonToolbar = Ext.create('Ext.toolbar.Toolbar', {
19
+ dock: this.dock,
20
+ items: [
21
+ '->',
22
+ {
23
+ xtype: 'button',
24
+ reference: 'standardSaveButton',
25
+ text: 'Сохранить',
26
+ handler: this.save.bind(this, false),
27
+ }
28
+ ],
29
+ });
30
+ if (this.dock === 'bottom') {
31
+ view.dockedItems.add(this.controller.unifiedButtonToolbar);
32
+ } else {
33
+ view.dockedItems.insert(0, this.controller.unifiedButtonToolbar);
34
+ }
35
+ },
36
+ onBeforeCloseWindow() {
37
+ this.save(true);
38
+ },
39
+ callDialog() {
40
+ Ext.Msg.show({
41
+ title: 'Сохранить изменения?',
42
+ message: 'Были обнаружены изменения, сохранить их?',
43
+ buttons: Ext.Msg.YESNOCANCEL,
44
+ icon: Ext.Msg.QUESTION,
45
+ fn: function(btn) {
46
+ if (btn === 'yes') {
47
+ this.callSaveHandler(true);
48
+ } else if (btn === 'no') {
49
+ this.closeWindow();
50
+ }
51
+ },
52
+ });
53
+ },
54
+ closeWindow() {
55
+ this.controller.getView().up('WindowWrap').close();
56
+ },
57
+ save(windowClose) {
58
+ this.windowClose = windowClose;
59
+ if (this.prepareBeanHandlerName &&
60
+ this.controller[this.prepareBeanHandlerName] &&
61
+ typeof this.controller[this.prepareBeanHandlerName] === 'function') {
62
+ this.compareCash = true;
63
+ this.controller[this.prepareBeanHandlerName].call();
64
+ }
65
+ },
66
+ generateHash(params) {
67
+ if (params && Ext.isObject(params)) {
68
+ if (this.compareCash === true) {
69
+ this.compareCash = false;
70
+ const currentHash = Coon.util.generateHashFromObj(params);
71
+ if (this.controller.savedDataHash !== currentHash) {
72
+ if (this.windowClose) {
73
+ this.callDialog();
74
+ } else {
75
+ this.callSaveHandler();
76
+ }
77
+ }
78
+ } else {
79
+ this.controller.savedDataHash = Coon.util.generateHashFromObj(params);
80
+ }
81
+ }
82
+ },
83
+ async callSaveHandler(closeAfterSave) {
84
+ if (
85
+ this.saveHandlerName &&
86
+ this.controller[this.saveHandlerName] &&
87
+ typeof this.controller[this.saveHandlerName] === 'function'
88
+ ) {
89
+ if (this.controller[this.saveHandlerName] instanceof Promise) {
90
+ await this.controller[this.saveHandlerName].call(this.controller);
91
+ } else {
92
+ this.controller[this.saveHandlerName].call(this.controller);
93
+ }
94
+ if (closeAfterSave) {
95
+ this.closeWindow();
96
+ }
97
+ }
98
+ },
99
+ });
@@ -0,0 +1,100 @@
1
+ Ext.define('Coon.uielement.plugin.configPanel.UnifiedButtonToolbarPluginConfigPanelFormEditor', {
2
+ extend: 'Ext.panel.Panel',
3
+ alias: 'widget.UnifiedButtonToolbarPluginConfigPanelFormEditor',
4
+ description: 'Добавляет стандартный тулбар',
5
+ viewModel: {
6
+ data: {
7
+ saveHandlerName: '',
8
+ prepareBeanHandlerName: '',
9
+ dock: 'bottom',
10
+ },
11
+ },
12
+ layout: {
13
+ type: 'vbox',
14
+ align: 'stretch',
15
+ },
16
+ items: [
17
+ {
18
+ xtype: 'pluginDescriptionLabel',
19
+ bind: {
20
+ value: '{description}',
21
+ },
22
+ },
23
+ {
24
+ xtype: 'comboBtnWrapper',
25
+ combobox: {
26
+ xtype: 'BaseComboBox',
27
+ fieldLabel: 'Функция сохранения данных',
28
+ labelWidth: 60,
29
+ flex: 1,
30
+ loadOnRender: false,
31
+ hideMode: 'offsets',
32
+ allowBlank: false,
33
+ store: 'codeHandlers',
34
+ bind: {
35
+ value: '{saveHandlerName}',
36
+ },
37
+ valueField: 'id',
38
+ displayField: 'id',
39
+ },
40
+ },
41
+ {
42
+ xtype: 'comboBtnWrapper',
43
+ combobox: {
44
+ xtype: 'BaseComboBox',
45
+ fieldLabel: 'Функция подготовки данных для сохранения',
46
+ labelWidth: 60,
47
+ flex: 1,
48
+ loadOnRender: false,
49
+ hideMode: 'offsets',
50
+ allowBlank: false,
51
+ store: 'codeHandlers',
52
+ bind: {
53
+ value: '{prepareBeanHandlerName}',
54
+ },
55
+ valueField: 'id',
56
+ displayField: 'id',
57
+ },
58
+ },
59
+ {
60
+ xtype: 'segmentedbutton',
61
+ allowMultiple: false,
62
+ reference: 'segmentDock',
63
+ bind: {
64
+ value: '{dock}',
65
+ },
66
+ items: [{
67
+ text: 'Отобразить внизу',
68
+ value: 'bottom',
69
+ }, {
70
+ text: 'Отобразить вверху',
71
+ value: 'top',
72
+ }],
73
+ }
74
+ ],
75
+ getData: function() {
76
+ return this.getConfiguration();
77
+ },
78
+ setData: function(data) {
79
+ data && this.doInit(data);
80
+ },
81
+ doInit: function(config) {
82
+ this.getViewModel().set('description', this.description);
83
+ for (const parameterName in config) {
84
+ if (!config.hasOwnProperty(parameterName) || parameterName === 'ptype') {
85
+ continue;
86
+ }
87
+ this.getViewModel().set(parameterName, config[parameterName]);
88
+ }
89
+ },
90
+ getConfiguration: function() {
91
+ const result = {};
92
+ const vm = this.getViewModel();
93
+ ['saveHandlerName', 'prepareBeanHandlerName', 'dock'].forEach((el) => {
94
+ if (vm.get(el)) {
95
+ result[el] = vm.get(el);
96
+ }
97
+ });
98
+ return result;
99
+ },
100
+ });
package/src/util.js CHANGED
@@ -600,5 +600,23 @@ Ext.define('Coon.util', {
600
600
  link.click();
601
601
  window.URL.revokeObjectURL(blob);
602
602
  },
603
-
603
+ /**
604
+ * Plural forms for russian words
605
+ * @param {Integer} count quantity for word
606
+ * @param {Array} words Array of words. Example: ['депутат', 'депутата', 'депутатов'], ['комментарий', 'комментария', 'комментариев']
607
+ * @return {String} Count + plural form for word
608
+ */
609
+ pluralize(count, words) {
610
+ const cases = [2, 0, 1, 1, 1, 2];
611
+ return count + ' ' + words[(count % 100 > 4 && count % 100 < 20) ? 2 : cases[Math.min(count % 10, 5)]];
612
+ },
613
+ /**
614
+ * Сравнивает два объекта путем генерации и сравнения их хешей
615
+ * @param obj1 {object}
616
+ * @param obj2 {object}
617
+ * @returns {boolean}
618
+ */
619
+ objectsIsEqual(obj1 = {}, obj2 = {}) {
620
+ return Coon.util.generateHashFromObj(obj1) === Coon.util.generateHashFromObj(obj2);
621
+ },
604
622
  });
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.5.49',
3
+ number: '2.5.51',
4
4
  });