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
@@ -0,0 +1,90 @@
1
+ Ext.define('Coon.report.plugin.grid.CalculatorPlugin', {
2
+ extend: 'Ext.AbstractPlugin',
3
+ alias: 'plugin.CalculatorPlugin',
4
+ uses: [],
5
+ requires: [
6
+ 'Ext.grid.Panel'
7
+ ],
8
+
9
+ init: function(grid) {
10
+ this.grid = grid;
11
+ grid.on('added', function(grid) {
12
+ this.contextMenu = grid.contextMenu;
13
+ this.calculatorButtons = Ext.widget('ReportCalculatorMenuItem', {
14
+ contextIndependent: true,
15
+ order: 1000,
16
+ });
17
+ this.calculatorButtons.on({
18
+ openCalculator: this.openCalculator,
19
+ setMemory: this.setCalcOperation,
20
+ subtractMemory: this.setCalcOperation,
21
+ addMemory: this.setCalcOperation,
22
+ scope: this,
23
+ });
24
+ this.contextMenu.addCalcMenuItem(this.calculatorButtons);
25
+ }, this);
26
+ grid.contextMenu.on('requestMenuItems', this.onShowMenu, this);
27
+ },
28
+
29
+ onShowMenu({record, cellIndex}) {
30
+ const showReportCalculator = Coon.setup.get('showReportCalculator');
31
+ this.calculatorButtons.setHidden(!showReportCalculator);
32
+ const columns = this.grid.getColumns();
33
+ const column = columns.length && columns[cellIndex];
34
+ let isVisibleMemoryButtons = false;
35
+ if (column) {
36
+ this.column = column;
37
+ this.columnValue = record.get(column.dataIndex);
38
+ isVisibleMemoryButtons = this.canBeingNumber(this.columnValue)!==false;
39
+ }
40
+ if (showReportCalculator) {
41
+ this.calculatorButtons.setHiddenMemoryButtons(!isVisibleMemoryButtons);
42
+ }
43
+ },
44
+
45
+ canBeingNumber(cellValue) {
46
+ if (typeof cellValue === 'number' && !isNaN(cellValue)) {
47
+ return cellValue;
48
+ }
49
+ if (!cellValue) {
50
+ return false;
51
+ }
52
+ if (Ext.isString(cellValue)) {
53
+ const numb = Number(cellValue.replace(',', '.').replaceAll(' ', ''));
54
+ if (numb || numb === 0) {
55
+ return numb;
56
+ } else {
57
+ return false;
58
+ }
59
+ } else {
60
+ return false;
61
+ }
62
+ },
63
+ setCalcOperation(text) {
64
+ const vm = Coon.report.component.calculator.ReportCalculatorPanel.getViewModel();
65
+ const cellValue = Ext.isString(this.columnValue) ? Number(this.columnValue.replace(',', '.').replaceAll(' ', '')):
66
+ this.columnValue;
67
+ const memory = vm.get('memory') || 0;
68
+ switch (text) {
69
+ case 'M=':
70
+ vm.set('memory', cellValue);
71
+ break;
72
+ case 'M+':
73
+ vm.set('memory', window.Decimal(memory).plus(window.Decimal(cellValue)));
74
+ break;
75
+ case 'M-':
76
+ vm.set('memory', window.Decimal(memory).minus(window.Decimal(cellValue)));
77
+ break;
78
+ }
79
+ this.closeMenu();
80
+ },
81
+
82
+ openCalculator() {
83
+ Coon.report.component.calculator.ReportCalculatorPanel.open();
84
+ this.closeMenu();
85
+ },
86
+
87
+ closeMenu() {
88
+ this.contextMenu.hide();
89
+ },
90
+ });
@@ -15,21 +15,21 @@ Ext.define('Coon.report.plugin.grid.GridContextMenu', {
15
15
  return;
16
16
  }
17
17
  this.grid = component;
18
- this.grid.getView().on({
18
+ this.grid.on({
19
19
  cellcontextmenu: {
20
20
  fn: this.cellContextMenuHandler,
21
21
  scope: this,
22
22
  },
23
23
  containercontextmenu: {
24
24
  fn: function(view, event) {
25
- this.showContextMenu({event, view});
25
+ this.showContextMenu({event, view, hasContext: false});
26
26
  event.preventDefault();
27
27
  },
28
28
  scope: this,
29
29
  },
30
30
  });
31
31
 
32
- this.grid.contextMenu = Ext.create('Coon.common.tree.BaseContextMenu', {items: this.items});
32
+ this.grid.contextMenu = Ext.widget('ReportContextMenu', {items: this.items});
33
33
  this.grid.contextMenu.on('show', this.displacementContextMenu, this);
34
34
  this.grid.contextMenu.on('hide', this.restoreCellQtip, this);
35
35
  this.grid.getSelectionModel().on('selectionchange', this.updateContext, this);
@@ -49,8 +49,10 @@ Ext.define('Coon.report.plugin.grid.GridContextMenu', {
49
49
  return;
50
50
  }
51
51
  const cell = this.grid.getView().getCell(contextMenu.record, column);
52
- this.qtipSpan = cell.querySelector('[data-qtip]');
53
- this.qtipSpan && this.qtipSpan.removeAttribute('data-qtip');
52
+ if (cell) {
53
+ this.qtipSpan = cell.querySelector('[data-qtip]');
54
+ this.qtipSpan && this.qtipSpan.removeAttribute('data-qtip');
55
+ }
54
56
 
55
57
  // contextMenu.alignTo(cell, 'tl-bl');
56
58
 
@@ -86,17 +88,17 @@ Ext.define('Coon.report.plugin.grid.GridContextMenu', {
86
88
  cellContextMenuHandler: function(view, td, cellIndex, record, tr, rowIndex, event) {
87
89
  this.grid.getSelectionModel().select(rowIndex);
88
90
  if (record) {
89
- this.showContextMenu({view, td, cellIndex, record, tr, rowIndex, event});
91
+ this.showContextMenu({view, td, cellIndex, record, tr, rowIndex, event, hasContext: true});
90
92
  }
91
- return false;
92
93
  },
93
94
 
94
- showContextMenu: function({view, td, cellIndex, record, tr, rowIndex, event}) {
95
+ showContextMenu: function(options) {
96
+ const {view, td, cellIndex, record, tr, rowIndex, event, hasContext} = options;
95
97
  const contextMenu = this.grid.contextMenu;
96
98
  if (record) {
97
99
  contextMenu.record = record;
98
100
  }
99
- contextMenu.context = {view, td, cellIndex, record, tr, rowIndex, event},
101
+ contextMenu.context = {view, td, cellIndex, record, tr, rowIndex, event, hasContext};
100
102
  cellIndex && (contextMenu.cellIndex = cellIndex);
101
103
  const store = this.grid.getStore();
102
104
  let params;
@@ -106,7 +108,7 @@ Ext.define('Coon.report.plugin.grid.GridContextMenu', {
106
108
  params = store.lastOptions && store.lastOptions.params;
107
109
  }
108
110
  contextMenu.params = params && params.parameterList && Coon.Function.convertProperties(Ext.decode(params.parameterList));
109
- contextMenu.fireEvent('requestMenuItems', {view, td, cellIndex, record, tr, rowIndex, event});
111
+ contextMenu.fireEvent('requestMenuItems', options);
110
112
  const showMenu = contextMenu.items &&
111
113
  contextMenu.items.getRange().find((item) => !item.hidden);
112
114
  if (showMenu) {
@@ -25,7 +25,6 @@ Ext.define('Coon.report.plugin.grid.GridRowCountPlugin', {
25
25
  datachanged: this.recalculate,
26
26
  selectionchange: this.recalculate,
27
27
  updatecheckedrecords: this.recalculate,
28
- // mixedrowselectionchange: this.recalculate,
29
28
  scope: this,
30
29
  });
31
30
  },
@@ -188,15 +188,24 @@ Ext.define('Coon.report.plugin.grid.GridToolbarButtonPlugin', {
188
188
  },
189
189
 
190
190
  addToContextMenuHandler: function(config) {
191
+ if (!this.component) {
192
+ return;
193
+ }
191
194
  const menu = this.component.contextMenu;
195
+ const contextMenuItemsAdded = this.component.contextMenuItemsAdded;
192
196
  if (this.buttonUI && !config['ui']) {
193
197
  config['ui'] = this.buttonUI;
194
198
  }
195
- menu && menu.add(new Ext.menu.Item({
199
+ if (menu && !contextMenuItemsAdded) {
200
+ this.component.contextMenuItemsAdded = true;
201
+ }
202
+ menu && menu.addPluginButton(new Ext.menu.Item({
203
+ sortSequence: this.sortSequence,
196
204
  text: this.buttonText,
197
205
  iconCls: this.buttonIconCls,
198
206
  ui: this.buttonUI,
199
- isValid: Ext.bind(() => !this.computeState().disabled, this),
207
+ isItemDisabled: Ext.bind(() => this.computeState().disabled, this),
208
+ isItemHidden: Ext.bind(() => this.computeState().hidden, this),
200
209
  handler: Ext.Function.createSequence(Ext.bind(this.handler, this), function() {
201
210
  menu.hide();
202
211
  }),
@@ -4,7 +4,8 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
4
4
  uses: [],
5
5
  requires: [
6
6
  'Coon.setup',
7
- 'Coon.eventBus'
7
+ 'Coon.eventBus',
8
+ 'Coon.util.ContextManager'
8
9
  ],
9
10
  alternateClassName: [
10
11
  'Sigma.common.grid.plugin.OpenCustomPanelButtonPlugin',
@@ -34,6 +35,8 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
34
35
  sendDataOnSelect: false,
35
36
  createChangeSelectionButton: false,
36
37
 
38
+ openInWindow: false,
39
+
37
40
  displacedView: undefined,
38
41
  centerView: undefined,
39
42
  previousView: undefined,
@@ -66,37 +69,37 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
66
69
  }
67
70
  if (Ext.isEmpty(this.effectiveXTypeObject.effectiveXType) && !this.effectiveXTypeObject.deferred) {
68
71
  Ext.Msg.alert('Сообщение системы', 'Для плагина OpenCustomPanelButtonPlugin не определен тип панели (xtype) для открытия');
69
- } else {
70
- if (this.xtypeSelector === 'UI_LIST') {
71
- if (!this.getUIElement()) {
72
- Coon.log.log('UIElement не указан');
72
+ return;
73
+ }
74
+ if (this.xtypeSelector === 'UI_LIST') {
75
+ if (!this.getUIElement()) {
76
+ Coon.log.log('UIElement не указан');
77
+ return;
78
+ }
79
+ const command = Ext.create('command.GetUIElementCommand');
80
+ command.on('complete', function(uIElementBean) {
81
+ if (!uIElementBean || !uIElementBean.xtype) {
82
+ Coon.log.error('UIElement dont exist or invalid');
73
83
  return;
74
84
  }
75
- const command = Ext.create('command.GetUIElementCommand');
76
- command.on('complete', function(uIElementBean) {
77
- if (!uIElementBean || !uIElementBean.xtype) {
78
- Coon.log.error('UIElement dont exist or invalid');
79
- return;
80
- }
81
- const exists = Ext.ClassManager.getByAlias('widget.' + uIElementBean.xtype);
82
- if (!exists) {
83
- Coon.log.log(uIElementBean.xtype + ' does not exist');
84
- return;
85
- }
86
- this.effectiveXTypeObject.effectiveXType = uIElementBean.xtype;
87
- this.effectiveXTypeObject.properties =
85
+ const exists = Ext.ClassManager.getByAlias('widget.' + uIElementBean.xtype);
86
+ if (!exists) {
87
+ Coon.log.log(uIElementBean.xtype + ' does not exist');
88
+ return;
89
+ }
90
+ this.effectiveXTypeObject.effectiveXType = uIElementBean.xtype;
91
+ this.effectiveXTypeObject.properties =
88
92
  this.effectiveXTypeObject.effectiveXType === 'UiCustomPanel' ?
89
93
  JSON5.parse(uIElementBean.propertyData) :
90
94
  (
91
95
  Ext.decode(uIElementBean.propertyData) ||
92
96
  Coon.Function.convertAdvancedProperties(uIElementBean.properties)
93
97
  );
94
- this.component.getContextManager().executeFunction(Ext.bind(this.openPanel, this), this.parameters);
95
- }, this);
96
- command.execute(this.getUIElement());
97
- } else {
98
98
  this.component.getContextManager().executeFunction(Ext.bind(this.openPanel, this), this.parameters);
99
- }
99
+ }, this);
100
+ command.execute(this.getUIElement());
101
+ } else {
102
+ this.component.getContextManager().executeFunction(Ext.bind(this.openPanel, this), this.parameters);
100
103
  }
101
104
  },
102
105
 
@@ -127,13 +130,94 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
127
130
  }
128
131
  },
129
132
 
133
+ getCenterView() {
134
+ if (!this.centerView) {
135
+ this.centerView = this.centerView || this.component.up('centerview');
136
+ }
137
+ return this.centerView;
138
+ },
139
+
140
+ hasInCenterView(componentContextId) {
141
+ return !!this.centerView.findComponent(componentContextId);
142
+ },
143
+
144
+ isCenterViewMode() {
145
+ this.displacedMode = !this.openInWindow;
146
+ return this.displacedMode &&
147
+ !this.isInWindow() &&
148
+ !this.oldFrame &&
149
+ !this.openInReport;
150
+ },
151
+
152
+ buildContext(properties, params) {
153
+ const ctx = {
154
+ record: this.getCmp().selection && this.getCmp().selection.getData(),
155
+ records: typeof this.getCmp().getSelection === 'function' && this.getCmp().getSelection().map((el) => el.getData()),
156
+ };
157
+ const parent = this.getCmp().up('[componentContextId]');
158
+ if (parent && parent.componentContextId) {
159
+ const uniqueContext = Object.assign(
160
+ {},
161
+ params,
162
+ {
163
+ uiElementCd: properties.uiElementCd,
164
+ xtype: properties.xtype,
165
+ }
166
+ );
167
+
168
+ properties.ctxMgr = Coon.util.ContextManager;
169
+ properties.componentContextId = properties.ctxMgr.createContext(
170
+ parent.componentContextId,
171
+ Object.assign(ctx, uniqueContext),
172
+ uniqueContext
173
+ );
174
+ };
175
+ },
176
+
177
+ configureCustomPanel(params) {
178
+ const properties = this.prepareProperties(
179
+ this.getCmp().up('ReportPanel') ||
180
+ this.getCmp()
181
+ );
182
+ properties.xtype = 'UiCustomPanel';
183
+ return properties;
184
+ },
185
+
130
186
  openPanel: function(params) {
131
187
  const xtype = this.oldFrame ? 'uxiframe' : this.effectiveXTypeObject.effectiveXType;
132
188
  if (!xtype) {
133
189
  return;
134
190
  }
191
+
192
+ if (xtype === 'UiCustomPanel') {
193
+ this.configureCustomPanel(params);
194
+ }
195
+
135
196
  const ownerComponent = this.getOwnerComponent();
136
197
  const properties = this.prepareProperties(ownerComponent);
198
+ properties.xtype = xtype;
199
+
200
+ const componentContextId = Coon.util.ContextManager.generateKey(
201
+ Object.assign(
202
+ {},
203
+ params,
204
+ {
205
+ uiElementCd: properties.uiElementCd,
206
+ xtype,
207
+ }
208
+ )
209
+ );
210
+
211
+ if (this.isCenterViewMode() && !this.getCenterView()) {
212
+ Coon.log.error('couldn\'t find parent component "centerview"');
213
+ return;
214
+ }
215
+
216
+ if (this.isCenterViewMode() && this.hasInCenterView(componentContextId)) {
217
+ this.centerView.setActiveComponent({componentContextId});
218
+ return;
219
+ }
220
+
137
221
  const windowProperties = this.prepareWindowProperties(properties, xtype, ownerComponent);
138
222
 
139
223
  if (xtype === 'ReportPanel' || xtype === 'DynamicReportForm' || /.*FormPanel.*/.test(xtype)) {
@@ -148,8 +232,22 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
148
232
  source: 'OpenCustomPanelButtonPlugin',
149
233
  params: params,
150
234
  };
151
- const panel = Ext.widget(xtype, properties);
152
- Coon.log.debug('OCPB.openPanel', xtype, properties.uiElementCd, {properties, params, panel});
235
+
236
+
237
+ properties.componentContextId = componentContextId;
238
+ properties.componentConfig = {
239
+ parentComponent: this.getCmp(),
240
+ context: Object.assign(
241
+ {},
242
+ params,
243
+ {
244
+ uiElementCd: properties.uiElementCd,
245
+ }
246
+ ),
247
+ };
248
+
249
+ this.buildContext(properties, params);
250
+ const panel = Ext.create(properties);
153
251
  let parentWidget = panel;
154
252
 
155
253
  Coon.eventBus.emit(
@@ -158,18 +256,10 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
158
256
  params
159
257
  );
160
258
 
161
- if ((this.displacedMode || Coon.setup.get('overrides.displacedMode')) && !this.isInWindow() && !this.oldFrame) {
259
+ if (this.isCenterViewMode()) {
260
+ this.centerView.setActiveComponent(panel);
162
261
  Coon.Function.executeComponentDoInit(panel, params);
163
- this.displacedView = panel;
164
- this.changeViewInCentralComponent();
165
- panel.on('close', function() {
166
- this.displacedView.removeListener('displace', this.doDisplace, this);
167
- this.previousView.removeListener('beforeactivate', this.preventActive, this);
168
- this.changeViewInCentralComponent(true);
169
- this.displacedView = undefined;
170
- this.previousView = undefined;
171
- this.centerView = undefined;
172
- }, this);
262
+ panel.setClosable(true);
173
263
  panel.on('afterlayout', function(panel) {
174
264
  panel.focus();
175
265
  }, this, {single: true});
@@ -199,21 +289,7 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
199
289
  };
200
290
  Ext.apply(defaultWindowConfig, windowProperties);
201
291
 
202
- const canHold = Coon.userSettings.get('windowHolder') || Coon.setup.get('overrides.windowHolderMode');
203
- const uniqueID = canHold &&
204
- Coon.util.generateHashFromObj(
205
- Object.assign(params, {uiElementCd: properties.uiElementCd}),
206
- {algorithm: 'md5'}
207
- ) ||
208
- Ext.id();
209
-
210
- if (canHold && Coon.nav.windowHolder.checkHoldedWindow({uniqueID})) {
211
- return;
212
- }
213
-
214
292
  const openWindow = Ext.widget('WindowWrap', Ext.applyIf({
215
- canHold,
216
- uniqueID,
217
293
  items: panel,
218
294
  }, Ext.apply({}, windowProperties || {}, defaultWindowConfig || {})));
219
295
 
@@ -312,45 +388,6 @@ Ext.define('Coon.report.plugin.grid.OpenCustomPanelButtonPlugin', {
312
388
  }
313
389
  },
314
390
 
315
- changeViewInCentralComponent: function(revert) {
316
- this.centerView = this.centerView || this.component.up('centerview');
317
- if (this.centerView) {
318
- if (revert) {
319
- if (this.previousView) {
320
- this.centerView.setActiveItem(this.previousView);
321
- }
322
- if (this.displacedView) {
323
- this.centerView.remove(this.displacedView, 'detach');
324
- }
325
- } else {
326
- const displacerComponent = this.centerView.getComponent(this.displacedView.getXType());
327
- if (!displacerComponent) {
328
- this.centerView.add(this.displacedView);
329
- }
330
- this.previousView = this.centerView.getLayout().getActiveItem();
331
-
332
- if (this.displacedView) {
333
- this.centerView.setActiveItem(this.displacedView);
334
- this.previousView.on('beforeactivate', this.preventActive, this);
335
- this.displacedView.on('displace', this.doDisplace, this, this.displacedView);
336
- }
337
- }
338
- } else {
339
- Coon.log.log('couldn\'t find parent component "centerview"');
340
- }
341
- },
342
-
343
- doDisplace: function(displacer) {
344
- this.centerView.setActiveItem(displacer);
345
- },
346
-
347
- preventActive: function(viewToActive, viewIsActive) {
348
- if (this.displacedView && (this.displacedView !== this.previousView)) {
349
- this.displacedView.fireEvent('displace');
350
- }
351
- return !(this.previousView.getXType() === viewToActive.getXType());
352
- },
353
-
354
391
  isInWindow() {
355
392
  return Ext.isDefined(this.component.up('window'));
356
393
  },
@@ -302,16 +302,18 @@ Ext.define('Coon.report.plugin.grid.ReportCharacteristicBindPlugin', {
302
302
  },
303
303
 
304
304
  beforeselectHandler(selectionModel, newRecord) {
305
- const callbackFn = function() {
306
- this.fireEvent('needReload', this.updateParentReport);
307
- selectionModel.view.setSelection(newRecord);
305
+ const callbackFn = () => {
306
+ this.grid.fireEvent('needReload', this.updateParentReport);
307
+ this.grid.on('load', function() {
308
+ selectionModel.select(newRecord);
309
+ }, this, {single: true});
308
310
  };
309
311
 
310
312
  if (Object.keys(this.initialCharData).length === 0) {
311
313
  return true;
312
314
  }
313
315
  if (!this.deepEquals(this.initialCharData, this.chars.getFullList(), {exclude: [this.ns.$valueDescription]})) {
314
- Ext.Msg.prompt({
316
+ Ext.Msg.show({
315
317
  title: 'Сообщение системы',
316
318
  msg: 'Характеристики не были сохранены. Сохранить?',
317
319
  buttons: Ext.Msg.YESNO,
@@ -64,10 +64,17 @@ Ext.define('Coon.report.plugin.grid.ReportColumnStatePlugin', {
64
64
  },
65
65
 
66
66
  applySavedState() {
67
+ if (this.getCmp().destroyed || !this.getCmp().rendered) {
68
+ return;
69
+ }
67
70
  const savedState = localStorage.getItem('reportsState');
68
71
  const columns = this.grid.getColumns();
69
72
  const columnHeader = this.grid.headerCt;
70
73
 
74
+ if (!Array.isArray(columns)) {
75
+ return;
76
+ }
77
+
71
78
  if (savedState) {
72
79
  let deserializedState; let currentReportState;
73
80
  try {
@@ -82,13 +89,18 @@ Ext.define('Coon.report.plugin.grid.ReportColumnStatePlugin', {
82
89
  const stateMap = new Map();
83
90
  currentReportState.forEach((e) => stateMap.set(e.columnId, e));
84
91
 
85
- columns.forEach((column, i) => {
86
- if (column.hidden) {
92
+ columns.forEach((column) => {
93
+ if (column.isHidden()) {
87
94
  return;
88
95
  }
89
96
  const state = stateMap.get(column.dataIndex);
90
97
  if (state) {
91
- column.setHidden(state.hidden);
98
+ if (!column.up().getMenu().child('#columnItem')) {
99
+ return;
100
+ }
101
+ if (state.hidden && column.isHideable() && !column.isHidden()) {
102
+ column.setVisible(false);
103
+ }
92
104
  column.setWidth(state.width ? state.width : 100);
93
105
  columnHeader.moveBefore(column, columnHeader.getComponent(state.position));
94
106
  }
@@ -41,7 +41,7 @@ Ext.define('Coon.report.plugin.grid.SetSingleParameterPlugin', {
41
41
  filterValue = filterValue === filter.checkedValue ? true : false;
42
42
  }
43
43
 
44
- if (this.separateAction.getValue() === filterValue) {
44
+ if (!this.separateAction || this.separateAction.getValue() === filterValue) {
45
45
  return;
46
46
  }
47
47
 
@@ -82,7 +82,7 @@ Ext.define('Coon.report.plugin.grid.ToolbarButtonPlugin', {
82
82
  if (this.buttonUI && !config['ui']) {
83
83
  config['ui'] = this.buttonUI;
84
84
  }
85
- menu && menu.add(new Ext.menu.Item({
85
+ menu && menu.addPluginButton(new Ext.menu.Item({
86
86
  text: this.buttonText,
87
87
  iconCls: this.buttonIconCls,
88
88
  ui: this.buttonUI,
@@ -0,0 +1,55 @@
1
+ Ext.define('Coon.report.plugin.grid.addFilterConditionPlugin.AdvancedSearchPanel', {
2
+ extend: 'Ext.panel.Panel',
3
+ maxHeight: 500,
4
+ scrollable: true,
5
+ alias: 'widget.AdvancedSearchPanel',
6
+ controller: 'AdvancedSearchPanelController',
7
+ title: 'Расширенный поиск',
8
+ viewModel: {
9
+ data: {
10
+ filter: {},
11
+ isFiltersValid: true,
12
+ },
13
+ },
14
+ config: {
15
+ reportGrid: undefined,
16
+ },
17
+ layout: {
18
+ type: 'vbox', align: 'stretch',
19
+ },
20
+ padding: '4 0 0 0',
21
+
22
+ items: [
23
+ ],
24
+
25
+ buttons: [
26
+ {
27
+ text: 'Добавить',
28
+ ui: 'green-button',
29
+ handler: 'onAddNewFilterClick',
30
+ },
31
+ '->',
32
+ {
33
+ text: 'Поиск',
34
+ ui: 'orange-button',
35
+ handler: 'filterHandler',
36
+ bind: {
37
+ disabled: '{!isFiltersValid}',
38
+ },
39
+ },
40
+ {
41
+ text: 'Применить',
42
+ ui: 'green-button',
43
+ handler: 'applyHandler',
44
+ bind: {
45
+ disabled: '{!isFiltersValid}',
46
+ },
47
+ }
48
+ ],
49
+
50
+ updateReportGrid(grid) {
51
+ if (grid) {
52
+ this.getController().report = grid.up('ReportPanel');
53
+ }
54
+ },
55
+ });