ru.coon 2.8.65 → 3.0.2

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.
Files changed (130) hide show
  1. package/CHANGELOG.md +319 -6
  2. package/package.json +1 -1
  3. package/src/Function.js +1 -1
  4. package/src/VisualLinker.js +610 -0
  5. package/src/VisualLinker.scss +219 -0
  6. package/src/app/Application.js +1 -0
  7. package/src/app/ApplicationSettings.js +49 -0
  8. package/src/app/Config.js +60 -0
  9. package/src/app/Router.js +37 -21
  10. package/src/app/viewPort/CVWrapperPanel.js +53 -0
  11. package/src/app/viewPort/CenterView.js +153 -46
  12. package/src/app/viewPort/CenterView.scss +151 -0
  13. package/src/app/viewPort/ComponentContextManager.js +24 -0
  14. package/src/app/viewPort/Main.js +4 -1
  15. package/src/app/viewPort/Routing.d2 +23 -0
  16. package/src/app/viewPort/TabHistory.js +81 -0
  17. package/src/common/ComponentFactory.js +167 -0
  18. package/src/common/button/DropdownContentButton.js +146 -0
  19. package/src/common/button/DropdownContentButton.scss +92 -0
  20. package/src/common/button/DropdownContentButtonController.js +60 -0
  21. package/src/common/component/editor/EditorFactory.js +3 -1
  22. package/src/common/component/formeditor/UiCustomFilterForm.scss +0 -1
  23. package/src/common/component/settings/modules/settingClosePageConfirmation.js +1 -3
  24. package/src/common/component/settings/modules/settingFavoritePanelShow.js +21 -0
  25. package/src/common/component/settings/modules/settingReportCalculator.js +22 -0
  26. package/src/common/component/settings/modules/settingShowNeedReloadMessage.js +1 -3
  27. package/src/common/component/settings/modules/settingwindowHolder.js +2 -3
  28. package/src/common/panel/WindowWrap.js +19 -11
  29. package/src/common/tree/BaseContextMenu.js +4 -3
  30. package/src/log.js +4 -5
  31. package/src/nav/AppNavCalcButton.js +23 -0
  32. package/src/nav/AppNavCalcButton.scss +6 -0
  33. package/src/nav/AppNavigationBar.js +1 -1
  34. package/src/nav/AppNavigationMenuController.js +2 -2
  35. package/src/nav/AppNavigationMenuMinimized.js +61 -0
  36. package/src/nav/AppNavigationPanel.js +115 -0
  37. package/src/nav/AppNavigationPanel.scss +178 -0
  38. package/src/nav/AppNavigationPanelController.js +386 -0
  39. package/src/nav/FavoriteCfg.js +18 -0
  40. package/src/nav/MenuEntity.js +23 -15
  41. package/src/nav/MenuFavoritesBar.js +100 -0
  42. package/src/nav/MenuFavoritesBar.scss +92 -0
  43. package/src/nav/editor/NavigateElementEditorView.js +2 -2
  44. package/src/nav/editor/workspace/NavWorkspaceListView.js +1 -4
  45. package/src/nav/menu/WorkspaceMenuViewMinimized.js +22 -0
  46. package/src/overrides/panel/TabPanel.js +36 -0
  47. package/src/overrides/panel/TabPanel.scss +65 -0
  48. package/src/report/component/ClearFiltersButton.js +4 -1
  49. package/src/report/component/CopyCellValueMenuItem.js +18 -0
  50. package/src/report/component/ReportFieldMap.js +274 -0
  51. package/src/report/component/ReportPanel.js +73 -44
  52. package/src/report/component/ReportPanel.scss +2 -2
  53. package/src/report/component/ReportTagLookup.js +59 -2
  54. package/src/report/component/calculator/ReportCalculatorController.js +266 -0
  55. package/src/report/component/calculator/ReportCalculatorField.js +47 -0
  56. package/src/report/component/calculator/ReportCalculatorHistoryPlugin.js +128 -0
  57. package/src/report/component/calculator/ReportCalculatorHistoryPlugin.scss +33 -0
  58. package/src/report/component/calculator/ReportCalculatorMenuItem.js +101 -0
  59. package/src/report/component/calculator/ReportCalculatorMenuItem.scss +41 -0
  60. package/src/report/component/calculator/ReportCalculatorPanel.js +363 -0
  61. package/src/report/component/calculator/ReportCalculatorPanel.scss +86 -0
  62. package/src/report/component/reportpanel/CopyReportPanelController.js +1 -1
  63. package/src/report/component/reportpanel/FilterPanel.js +13 -15
  64. package/src/report/component/reportpanel/FilterPanel.scss +5 -1
  65. package/src/report/component/reportpanel/FormFieldFocusPlugin.js +157 -0
  66. package/src/report/component/reportpanel/FormFieldFocusPlugin.scss +14 -0
  67. package/src/report/component/reportpanel/NorthPanel.js +16 -17
  68. package/src/report/component/reportpanel/NorthPanel.scss +1 -1
  69. package/src/report/component/reportpanel/ReportContextMenu.js +219 -0
  70. package/src/report/component/reportpanel/ReportGrid.js +1 -0
  71. package/src/report/component/reportpanel/ReportGrid.scss +4 -0
  72. package/src/report/component/settings/field/ReportFormFieldsGrid.js +2 -2
  73. package/src/report/component/settings/field/ReportFormFieldsGridController.js +2 -2
  74. package/src/report/component/settings/property/ReportPropertiesPanelController.js +1 -1
  75. package/src/report/component/settings/property/ReportPropertyDictionary.js +7 -0
  76. package/src/report/plugin/configPanel/AddFilterConditionPluginConfigPanel.js +34 -11
  77. package/src/report/plugin/configPanel/GridFiltersPluginConfigPanelFiltersGrid.js +3 -2
  78. package/src/report/plugin/configPanel/openCustomPanelButtonPlugin/OpenCustomPanelButtonPluginConfigPanel.js +274 -255
  79. package/src/report/plugin/configPanel/openCustomPanelButtonPlugin/OpenCustomPanelButtonPluginConfigPanel.scss +17 -0
  80. package/src/report/plugin/grid/AddFilterConditionPlugin.js +530 -87
  81. package/src/report/plugin/grid/CalculatorPlugin.js +90 -0
  82. package/src/report/plugin/grid/GridContextMenu.js +12 -10
  83. package/src/report/plugin/grid/GridRowCountPlugin.js +0 -1
  84. package/src/report/plugin/grid/GridToolbarButtonPlugin.js +11 -2
  85. package/src/report/plugin/grid/OpenCustomPanelButtonPlugin.js +126 -89
  86. package/src/report/plugin/grid/ReportCharacteristicBindPlugin.js +6 -4
  87. package/src/report/plugin/grid/ReportColumnStatePlugin.js +15 -3
  88. package/src/report/plugin/grid/SetSingleParameterPlugin.js +1 -1
  89. package/src/report/plugin/grid/ToolbarButtonPlugin.js +1 -1
  90. package/src/report/plugin/grid/addFilterConditionPlugin/AdvancedSearchPanel.js +55 -0
  91. package/src/report/plugin/grid/addFilterConditionPlugin/AdvancedSearchPanelController.js +226 -0
  92. package/src/report/plugin/grid/addFilterConditionPlugin/FilterConfigMixin.js +138 -0
  93. package/src/report/plugin/grid/addFilterConditionPlugin/FilterFieldFactory.js +223 -0
  94. package/src/report/plugin/grid/addFilterConditionPlugin/FilterItem.js +164 -0
  95. package/src/report/plugin/grid/addFilterConditionPlugin/FilterItem.scss +21 -0
  96. package/src/report/plugin/grid/addFilterConditionPlugin/FilterMenu.js +29 -0
  97. package/src/report/plugin/grid/addFilterConditionPlugin/FilterWrapPanel.js +53 -0
  98. package/src/report/plugin/grid/addFilterConditionPlugin/FilterWrapPanelController.js +57 -0
  99. package/src/report/plugin/grid/addFilterConditionPlugin/InfoMenuItem.js +111 -0
  100. package/src/report/plugin/grid/addFilterConditionPlugin/InfoMenuItem.scss +83 -0
  101. package/src/report/plugin/grid/addFilterConditionPlugin/SelectColumnPanel.js +102 -0
  102. package/src/report/selectionModels/MixedRowSelectionModel.js +36 -45
  103. package/src/report/toolbar/dropdown/ToolbarOverflowButton.js +16 -5
  104. package/src/report/toolbar/dropdown/ToolbarOverflowPanel.scss +26 -14
  105. package/src/report/toolbar/layout/ReportToolbarOverflow.js +5 -2
  106. package/src/ringBuffer.js +7 -3
  107. package/src/uielement/command/GetUIElementCommand.js +0 -1
  108. package/src/uielement/component/UiCPWrapper.js +26 -36
  109. package/src/uielement/component/UiCustomController.js +7 -0
  110. package/src/uielement/component/UiCustomPanel.js +46 -2
  111. package/src/uielement/component/settings/UiCustomPanelEditorController.js +35 -29
  112. package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.js +146 -33
  113. package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.scss +28 -0
  114. package/src/uielement/component/settings/plugin/UiCustomPanelPluginGridController.js +366 -22
  115. package/src/uielement/component/settings/plugin/UiCustomPanelPluginModel.js +1 -0
  116. package/src/uielement/component/settings/plugin/UiCustomPanelPluginPanel.js +10 -4
  117. package/src/uielement/component/settings/plugin/UiCustomPanelPluginPanelController.js +28 -30
  118. package/src/uielement/plugin/UnifiedButtonToolbarPlugin.js +203 -22
  119. package/src/uielement/plugin/configPanel/ExecuteFunctionPluginConfigPanelFormEditor.js +4 -36
  120. package/src/uielement/plugin/configPanel/FireEventPluginConfigPanelFormEditor.js +5 -36
  121. package/src/uielement/plugin/configPanel/MethodChainPluginConfigPanelFormEditor.js +4 -36
  122. package/src/uielement/plugin/configPanel/OpenPanelPluginConfigPanelFormEditor.js +2 -38
  123. package/src/uielement/plugin/configPanel/PrintPdfPluginConfigPanelFormEditor.js +2 -35
  124. package/src/uielement/plugin/configPanel/UiCPPluginFormPanel.js +54 -0
  125. package/src/uielement/plugin/configPanel/UnifiedButtonToolbarPluginConfigPanelFormEditor.js +28 -18
  126. package/src/userSettings.js +1 -0
  127. package/src/util/ContextManager.js +109 -0
  128. package/src/util.js +96 -15
  129. package/src/version.js +1 -1
  130. package/src/app/viewPort/CenterViewController.js +0 -158
@@ -3,6 +3,32 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
3
3
  alias: 'controller.UiCustomPanelPluginGridController',
4
4
 
5
5
  lastCellContext: undefined,
6
+ isForcedSelection: false,
7
+ historyMaxLength: 15,
8
+ favoritesMaxLength: 5,
9
+
10
+ bindings: {
11
+ switchFormDisable: '{favoriteButtonPressed}',
12
+ },
13
+
14
+ control: {
15
+ '#': {
16
+ select: 'saveHistory',
17
+ },
18
+ '#searchInPlugins': {
19
+ change: 'searchInPlugins',
20
+ },
21
+ '#clearHistoryButton': {
22
+ click: 'clearHistory',
23
+ },
24
+ '#historyButton': {
25
+ click: 'showHistory',
26
+ },
27
+ '#favoriteButton': {
28
+ toggle: 'switchFavoritesFilter',
29
+ arrowclick: 'showFavorites',
30
+ },
31
+ },
6
32
 
7
33
  init: function(view) {
8
34
  this.getViewModel().set('formEditor', this.getView().formEditor === true);
@@ -11,8 +37,24 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
11
37
  r.sortable = true;
12
38
  });
13
39
  }
14
- this.getView().getStore().on('endupdate', this.setHandlers, this);
40
+ view.getStore().on({
41
+ endupdate: this.setHandlers,
42
+ remove: this.removePluginFromFavorites,
43
+ scope: this,
44
+ });
15
45
  this.getViewModel().bind('{unusedHandlers}', this.highlightUnusedHandlers, this);
46
+ this.pluginNavHistory = {
47
+ buffer: Ext.create('Coon.ringBuffer', {length: this.historyMaxLength}),
48
+ cursor: -1,
49
+ };
50
+ this.favoritePlugins = {
51
+ items: {},
52
+ count: 0,
53
+ };
54
+ },
55
+
56
+ getAllPlugins() {
57
+ return this.getView().getStore().getDataSource().getRange();
16
58
  },
17
59
 
18
60
  highlightUnusedHandlers() {
@@ -25,13 +67,81 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
25
67
  });
26
68
  },
27
69
 
70
+ validateHandlerNames(plugins) {
71
+ const names = new Map();
72
+
73
+ plugins.forEach((plugin) => {
74
+ if (!plugin.get('isHandlerRequired')) {
75
+ return;
76
+ }
77
+
78
+ if (plugin.get('isDeleted')) {
79
+ plugin.set('hasInvalidName', false);
80
+ return;
81
+ }
82
+
83
+ const handlerName = plugin.get('handlerName').trim();
84
+
85
+ if (handlerName.length === 0 || handlerName === '-/-') {
86
+ plugin.set('hasInvalidName', true);
87
+ return;
88
+ }
89
+
90
+ const value = names.get(handlerName);
91
+
92
+ if (value) {
93
+ if (Array.isArray(value)) {
94
+ value.push(plugin);
95
+ } else {
96
+ names.set(handlerName, [value, plugin]);
97
+ }
98
+ } else {
99
+ names.set(handlerName, plugin);
100
+ }
101
+ });
102
+
103
+ for (const value of names.values()) {
104
+ if (Array.isArray(value)) {
105
+ value.forEach((plugin) => plugin.set('hasInvalidName', true));
106
+ } else {
107
+ value.set('hasInvalidName', false);
108
+ }
109
+ }
110
+ },
111
+
28
112
  searchInPlugins(field, value) {
29
- const filterByText = (plugin) => JSON.stringify(plugin.get('jsonProperties')).includes(value);
30
- const store = this.getView().getStore();
31
- if (value) {
32
- store.addFilter(filterByText);
113
+ const filters = this.getView().getStore().getFilters();
114
+
115
+ if (!value) {
116
+ filters.removeByKey('textFilter');
117
+ return;
118
+ }
119
+
120
+ if (filters.getByKey('textFilter')) {
121
+ filters.removeByKey('textFilter');
122
+ }
123
+
124
+ const textFilter = new Ext.util.Filter({
125
+ id: 'textFilter',
126
+ filterFn: (plugin) => JSON.stringify(plugin.get('jsonProperties')).includes(value),
127
+ });
128
+
129
+ this.getView().getStore().addFilter(textFilter);
130
+ },
131
+
132
+ switchFavoritesFilter(bt, pressed) {
133
+ const favoriteIds = Object.keys(this.favoritePlugins.items);
134
+
135
+ if (pressed) {
136
+ const favoritesFilter = new Ext.util.Filter({
137
+ id: 'favoritesFilter',
138
+ property: 'id',
139
+ value: favoriteIds,
140
+ operator: 'in',
141
+ });
142
+ this.getView().getStore().addFilter(favoritesFilter);
33
143
  } else {
34
- store.clearFilter();
144
+ this.getView().getStore().getFilters().removeByKey('favoritesFilter');
35
145
  }
36
146
  },
37
147
 
@@ -60,6 +170,11 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
60
170
  return pClass && pClass.prototype && pClass.prototype[prop];
61
171
  },
62
172
 
173
+ isPluginPropExisting(ptype, prop) {
174
+ const pClass = Ext.ClassManager.getByAlias(`plugin.${ptype}`);
175
+ return pClass && pClass.prototype && pClass.prototype.getInitialConfig().hasOwnProperty(prop);
176
+ },
177
+
63
178
  addHandler: function(ptype) {
64
179
  const view = this.getView();
65
180
  const existInGrid = view.getStore().findRecord('ptype', ptype);
@@ -68,11 +183,13 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
68
183
  return;
69
184
  }
70
185
  const isSingle = this.getPluginClassProp(ptype, 'isSingle');
186
+ const isHandlerRequired = this.isPluginPropExisting(ptype, 'handlerName');
71
187
  const plugin = Ext.create('Coon.uielement.component.settings.plugin.UiCustomPanelPluginModel', {
72
188
  isNew: true,
73
189
  properties: [],
74
190
  jsonProperties: [],
75
191
  isSingle,
192
+ isHandlerRequired,
76
193
  ptype,
77
194
  });
78
195
  view.getStore().add(plugin);
@@ -109,47 +226,66 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
109
226
  deleteHandler: function(pluginInfoHeader) {
110
227
  const view = this.getView();
111
228
  const record = view.getSelectionModel().getLastSelected();
112
- if (record) {
113
- if (record.get('isNew')) {
114
- view.getStore().remove(record);
115
- } else {
116
- record.set('isDeleted', !record.get('isDeleted'));
117
- pluginInfoHeader.fireEvent(
118
- record.get('isDeleted') ? 'restoreaction' : 'deleteaction',
119
- pluginInfoHeader
120
- );
229
+ const deleteOrRestoreRecord = () => {
230
+ if (record) {
231
+ if (record.get('isNew')) {
232
+ view.getStore().remove(record);
233
+ } else {
234
+ record.set('isDeleted', !record.get('isDeleted'));
235
+ pluginInfoHeader.fireEvent(
236
+ record.get('isDeleted') ? 'restoreaction' : 'deleteaction',
237
+ pluginInfoHeader
238
+ );
239
+ }
240
+ view.publishState('data', view.getData());
121
241
  }
122
- view.publishState('data', view.getData());
242
+ };
243
+ if (!record.get('isDeleted')) {
244
+ Ext.Msg.show({
245
+ title: 'Подтвердите',
246
+ msg: 'Удалить плагин?',
247
+ fn: (btn) => {
248
+ if (btn === 'no') {
249
+ return;
250
+ }
251
+ deleteOrRestoreRecord();
252
+ },
253
+ buttons: Ext.MessageBox.YESNO,
254
+ scope: this,
255
+ width: 300,
256
+ });
257
+ return;
123
258
  }
259
+ deleteOrRestoreRecord();
124
260
  },
125
261
 
126
262
  cloneHandler: function() {
127
263
  const view = this.getView();
128
- const record = view.getSelectionModel().getSelection()[0].copy();
264
+ const record = view.getSelectionModel().getSelection()[0].copy(null);
129
265
  const data = record.data;
130
266
  const isSingle = this.getPluginClassProp(data.ptype, 'isSingle');
131
267
  if (isSingle) {
132
268
  Ext.Msg.alert('Ошибка', 'этот плагин нельзя добавить дважды!');
133
269
  return;
134
270
  }
135
- data['id'] = this.getNextIDSeq();
136
271
  data['isNew'] = true;
137
272
  data['sortSequence'] = this.getNextSeq();
138
273
  data['sequenceNumber'] = this.getNextIDSeq();
139
274
  const copyFunction = (btn) => {
140
- if (btn === 'cancel') {
275
+ if (btn === 'no') {
141
276
  return;
142
277
  }
143
278
  if (data) {
144
279
  view.getStore().add(data);
145
280
  view.publishState('data', view.getData());
281
+ view.getSelectionModel().select(view.getStore().getCount() -1);
146
282
  }
147
283
  };
148
284
  Ext.Msg.show({
149
285
  title: 'Подтвердите',
150
- msg: 'Копировать с правами?',
286
+ msg: 'Копировать плагин?',
151
287
  fn: copyFunction,
152
- buttons: Ext.MessageBox.YESNOCANCEL,
288
+ buttons: Ext.MessageBox.YESNO,
153
289
  scope: this,
154
290
  width: 300,
155
291
  });
@@ -209,7 +345,215 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginGridCont
209
345
  },
210
346
 
211
347
  setHandlers() {
348
+ const plugins = this.getAllPlugins();
349
+ this.getViewModel().set('handlerList', plugins);
350
+ this.validateHandlerNames(plugins);
351
+ },
352
+
353
+ saveHistory(_, record) {
354
+ if (this.isForcedSelection) {
355
+ this.isForcedSelection = false;
356
+ return;
357
+ }
358
+
359
+ this.pluginNavHistory.buffer.push(record);
360
+ this.pluginNavHistory.cursor = this.pluginNavHistory.buffer.getBuffer().length - 1;
361
+
362
+ this.getView().down('#historyButton').setDisabled(false);
363
+ this.getView().down('#clearHistoryButton').setDisabled(false);
364
+ },
365
+
366
+ forcePluginSelection(record, newIndex) {
367
+ const selModel = this.getView().getSelectionModel();
368
+
369
+ if (Number.isInteger(newIndex)) {
370
+ this.pluginNavHistory.cursor = newIndex;
371
+ }
372
+
373
+ this.isForcedSelection = true;
374
+ selModel.deselectAll();
375
+ selModel.select(record);
376
+
377
+ const selection = selModel.getSelection();
378
+
379
+ if (!selection.includes(record)) {
380
+ this.isForcedSelection = false;
381
+ return;
382
+ }
383
+ },
384
+
385
+ clearHistory() {
386
+ const clearFn = (btn) => {
387
+ if (btn === 'no') {
388
+ return;
389
+ }
390
+
391
+ this.pluginNavHistory.cursor = -1;
392
+ this.pluginNavHistory.buffer.reset();
393
+ this.getView().down('#historyButton').setDisabled(true);
394
+ this.getView().down('#clearHistoryButton').setDisabled(true);
395
+ this.getView().getSelectionModel().deselectAll();
396
+ };
397
+
398
+ Ext.Msg.show({
399
+ title: 'Подтвердите',
400
+ msg: 'Очистить историю?',
401
+ fn: clearFn,
402
+ buttons: Ext.MessageBox.YESNO,
403
+ scope: this,
404
+ width: 300,
405
+ });
406
+ },
407
+
408
+ onMenuItemClick(menu, menuItem, e) {
409
+ if (!menuItem) {
410
+ return;
411
+ }
412
+
413
+ const hasSelection = this.getView().getSelection().length;
414
+
415
+ if (hasSelection && menuItem.historyIndex === this.pluginNavHistory.cursor) {
416
+ return;
417
+ }
418
+
419
+ const gridRecord = this.getAllPlugins().find((item) => item.getId() === menuItem.pluginId);
420
+ this.forcePluginSelection(gridRecord, menuItem.historyIndex);
421
+ },
422
+
423
+ setButtonMenu(btn, menuItems) {
424
+ btn.setMenu({
425
+ items: menuItems.reverse(),
426
+ cls: 'UICustomPanelPluginMenu',
427
+ });
428
+
429
+ const menu = btn.getMenu();
430
+ menu.on('click', this.onMenuItemClick, this);
431
+ return menu;
432
+ },
433
+
434
+ showHistory(historyBtn) {
435
+ const historyItems = this.pluginNavHistory.buffer.get();
436
+
437
+ if (!historyItems.length && historyBtn.getMenu()) {
438
+ historyBtn.getMenu().destroy();
439
+ return;
440
+ }
441
+
442
+ const newMenuItems = historyItems.map((item, index) => {
443
+ let classes = 'menuPluginItem';
444
+ const abbr = item.el.get('ptype').split('').filter(Coon.util.isUpperLetter).join('');
445
+ const isPluginExisting = this.getAllPlugins().includes(item.el);
446
+ const tooltipText = !isPluginExisting ? '(Удален)' : item.el.get('isDeleted') ? '(Помечен на удаление)' : '';
447
+
448
+ const menuItem = {
449
+ pluginId: item.el.get('id'),
450
+ historyIndex: index,
451
+ text: `${index + 1} - ${item.el.get('handlerName')} (${abbr}) ${tooltipText}`,
452
+ };
453
+
454
+ if (!isPluginExisting) {
455
+ menuItem.disabled = true;
456
+ }
457
+
458
+ if (index === this.pluginNavHistory.cursor) {
459
+ classes = `${classes} menuPluginItemCurrent`;
460
+ }
461
+
462
+ menuItem.cls = classes;
463
+ return menuItem;
464
+ });
465
+
466
+ const menu = this.setButtonMenu(historyBtn, newMenuItems);
467
+ menu.showBy(historyBtn);
468
+ },
469
+
470
+ removePluginFromFavorites(_, records) {
471
+ const pluginId = records[0].getId();
472
+
473
+ if (this.favoritePlugins.items[pluginId]) {
474
+ delete this.favoritePlugins.items[pluginId];
475
+ this.favoritePlugins.count--;
476
+ }
477
+
478
+ if (!this.favoritePlugins.count) {
479
+ this.getView().down('#favoriteButton').setDisabled(true);
480
+ }
481
+ },
482
+
483
+ showFavorites(favoritesBtn) {
484
+ if (!this.favoritePlugins.count && favoritesBtn.getMenu()) {
485
+ favoritesBtn.getMenu().destroy();
486
+ return;
487
+ }
488
+
489
+ const newMenuItems = [];
490
+
491
+ for (const recordId in this.favoritePlugins.items) {
492
+ const plugin = this.favoritePlugins.items[recordId];
493
+ const abbr = plugin.get('ptype').split('').filter(Coon.util.isUpperLetter).join('');
494
+ const tooltipText = plugin.get('isDeleted') ? '(Помечен на удаление)' : '';
495
+
496
+ const menuItem = {
497
+ pluginId: recordId,
498
+ text: `${plugin.get('handlerName')} (${abbr}) ${tooltipText}`,
499
+ };
500
+
501
+ let classes = 'menuPluginItem';
502
+ const selected = this.getView().getSelectionModel().getSelection();
503
+ if (selected.length && (recordId === selected[0].getId())) {
504
+ classes = `${classes} menuPluginItemCurrent`;
505
+ }
506
+ menuItem.cls = classes;
507
+ newMenuItems.push(menuItem);
508
+ }
509
+
510
+ const menu = this.setButtonMenu(favoritesBtn, newMenuItems);
511
+ menu.showBy(favoritesBtn);
512
+ },
513
+
514
+ toggleFavoriteState(grid, rowIndex, colIndex, item, e, record) {
212
515
  const vm = this.getViewModel();
213
- vm.set('handlerList', this.getView().getStore().getData().getRange());
516
+ const isFavoritesBtnPressed = vm.get('favoriteButtonPressed');
517
+ const recordId = record.getId();
518
+
519
+ if (record.get('hasInvalidName')) {
520
+ return;
521
+ }
522
+
523
+ if (!this.favoritePlugins.items[recordId]) {
524
+ if (this.favoritePlugins.count === this.favoritesMaxLength) {
525
+ Ext.toast(`Достигнуто максимальное количество плагинов в избранном (${this.favoritesMaxLength})`);
526
+ return;
527
+ }
528
+ this.favoritePlugins.items[recordId] = record;
529
+ this.favoritePlugins.count++;
530
+ } else {
531
+ delete this.favoritePlugins.items[recordId];
532
+ this.switchFavoritesFilter(null, isFavoritesBtnPressed);
533
+ this.favoritePlugins.count--;
534
+ }
535
+ this.updateFavoriteBtnState();
536
+ this.getView().getView().refresh();
537
+ },
538
+
539
+ updateFavoriteBtnState() {
540
+ const favoriteBtn = this.getView().down('#favoriteButton');
541
+
542
+ if (!this.favoritePlugins.count) {
543
+ favoriteBtn.setPressed(false);
544
+ favoriteBtn.setDisabled(true);
545
+ } else {
546
+ favoriteBtn.setDisabled(false);
547
+ }
548
+ },
549
+
550
+ switchFormDisable(isFavoritesPressed) {
551
+ const pluginForm = this.getView().up('UiCustomPanelPluginPanel').lookup('pluginForm');
552
+
553
+ if (isFavoritesPressed) {
554
+ pluginForm.mask();
555
+ } else {
556
+ pluginForm.unmask();
557
+ }
214
558
  },
215
559
  });
@@ -4,6 +4,7 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginModel',
4
4
 
5
5
  fields: [
6
6
  {name: 'isSingle', type: 'boolean'},
7
+ {name: 'isHandlerRequired', type: 'boolean'},
7
8
  {name: 'isNew', type: 'boolean'},
8
9
  {name: 'sequenceNumber', type: 'number'},
9
10
  {name: 'sortSequence', type: 'number'},
@@ -61,16 +61,22 @@ Ext.define('Coon.report.component.settings.plugin.UiCustomPanelPluginPanel', {
61
61
  },
62
62
  {
63
63
  xtype: 'button',
64
- iconCls: 'x-fa fa-trash-alt',
64
+ iconCls: 'svg-fa svg-fa-trash-can',
65
65
  reference: 'deleteButton',
66
66
  itemId: 'deleteButton',
67
+ bind: {
68
+ disabled: '{!pluginGrid.selection}',
69
+ },
67
70
  },
68
71
  {
69
72
  xtype: 'button',
70
73
  tooltip: 'Клонировать',
71
74
  reference: 'cloneButton',
72
75
  itemId: 'cloneButton',
73
- iconCls: 'x-fa fa-clone',
76
+ iconCls: 'svg-fa svg-fa-clone',
77
+ bind: {
78
+ disabled: '{!pluginGrid.selection}',
79
+ },
74
80
  }
75
81
  ],
76
82
  listeners: {
@@ -81,7 +87,7 @@ Ext.define('Coon.report.component.settings.plugin.UiCustomPanelPluginPanel', {
81
87
  });
82
88
  ct.down('#cloneButton').disable();
83
89
  const btn = ct.down('button#deleteButton');
84
- btn.setIconCls('x-fa fa-trash-restore');
90
+ btn.setIconCls('svg-fa svg-fa-trash-arrow-up');
85
91
  btn.setTooltip('восстановить плагин?');
86
92
  },
87
93
  deleteaction: function(ct) {
@@ -91,7 +97,7 @@ Ext.define('Coon.report.component.settings.plugin.UiCustomPanelPluginPanel', {
91
97
  });
92
98
  ct.down('#cloneButton').enable();
93
99
  const btn = ct.down('button#deleteButton');
94
- btn.setIconCls('x-fa fa-trash-alt');
100
+ btn.setIconCls('svg-fa svg-fa-trash-can');
95
101
  btn.setTooltip('пометить на удаление плагин?');
96
102
  },
97
103
  },
@@ -51,38 +51,36 @@ Ext.define('Coon.uielement.component.settings.plugin.UiCustomPanelPluginPanelCon
51
51
  },
52
52
 
53
53
  saveState: function() {
54
- if (this.activeRecord && this.activePanel) {
55
- if (
56
- this.activePanel.xtype === 'ExecuteFunctionPluginConfigPanelFormEditor' &&
57
- !this.activeRecord.data._skipErrors
58
- ) {
59
- const editor = this.activePanel.down('UiAceEditor');
60
- const me = this;
61
- if (editor.hasErrors()) {
62
- Ext.Msg.show({
63
- title: 'Обнаружены ошибки в функции,подтвердите чтобы пропустить проверку в следующий раз',
64
- message: 'Пропустить проверку?',
65
- buttons: Ext.Msg.YESNO,
66
- icon: Ext.Msg.WARNING,
67
- fn: function(btn) {
68
- if (btn === 'yes') {
69
- me.activeRecord.data._skipErrors = true;
70
- // me.activePanel.down('UiAceEditor').setValue(me.activeRecord.get('fnBody'));
71
- }
72
- },
73
- });
74
- return false;
75
- }
76
- }
77
- this.activeRecord.data._skipErrors = false;
78
- this.activeRecord.set({
79
- modified: true,
80
- jsonProperties: this.activePanel.getData(),
81
- });
82
- if (this.activePanel.xtype === 'ExecuteFunctionPluginConfigPanelFormEditor') {
83
- this.fireViewEvent('ExecuteFunctionPluginChange');
54
+ if (!this.activeRecord || !this.activePanel) {
55
+ return;
56
+ }
57
+ if (
58
+ this.activePanel.xtype === 'ExecuteFunctionPluginConfigPanelFormEditor' &&
59
+ !this.activeRecord.data._skipErrors
60
+ ) {
61
+ const editor = this.activePanel.down('UiAceEditor');
62
+ const me = this;
63
+ if (editor.hasErrors()) {
64
+ Ext.Msg.show({
65
+ title: 'Обнаружены ошибки в функции,подтвердите чтобы пропустить проверку в следующий раз',
66
+ message: 'Пропустить проверку?',
67
+ buttons: Ext.Msg.YESNO,
68
+ icon: Ext.Msg.WARNING,
69
+ fn: function(btn) {
70
+ if (btn === 'yes') {
71
+ me.activeRecord.data._skipErrors = true;
72
+ // me.activePanel.down('UiAceEditor').setValue(me.activeRecord.get('fnBody'));
73
+ }
74
+ },
75
+ });
76
+ return false;
84
77
  }
85
78
  }
79
+ this.activeRecord.data._skipErrors = false;
80
+ this.activeRecord.set({
81
+ modified: true,
82
+ jsonProperties: this.activePanel.getData(),
83
+ });
86
84
  },
87
85
 
88
86
  selectPlugin(plugin) {