ru.coon 2.7.53 → 2.7.55

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 (28) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +1 -1
  3. package/src/report/component/ReportPanel.js +53 -5
  4. package/src/report/component/reportpanel/ReportGrid.js +3 -5
  5. package/src/report/component/reportpanel/ReportTree.js +3 -5
  6. package/src/report/component/settings/plugin/PluginSelectWindow.js +1 -1
  7. package/src/report/component/settings/plugin/ReportFormPluginPanelController.js +4 -1
  8. package/src/report/component/settings/plugin/ReportToolbarFunctions.js +176 -0
  9. package/src/report/plugin/configPanel/ReportToolbarPluginConfigPanel.js +195 -0
  10. package/src/report/plugin/grid/ExportReportDataToFilePlugin.js +7 -0
  11. package/src/report/plugin/grid/GroupButtonsPlugin.js +4 -1
  12. package/src/report/plugin/grid/ToolbarItemPlugin.js +5 -4
  13. package/src/report/plugin/report/ReportToolbarPlugin.js +66 -0
  14. package/src/report/toolbar/ButtonsByType.scss +168 -0
  15. package/src/report/toolbar/ReportGridToolbar.js +248 -0
  16. package/src/report/toolbar/ReportGridToolbar.scss +9 -0
  17. package/src/report/toolbar/dropdown/ToolbarConfigurationPanel.js +234 -0
  18. package/src/report/toolbar/dropdown/ToolbarConfigurationPanel.scss +13 -0
  19. package/src/report/toolbar/dropdown/ToolbarOverflowButton.js +113 -0
  20. package/src/report/toolbar/dropdown/ToolbarOverflowButton.scss +94 -0
  21. package/src/report/toolbar/dropdown/ToolbarOverflowPanel.js +188 -0
  22. package/src/report/toolbar/dropdown/ToolbarOverflowPanel.scss +37 -0
  23. package/src/report/toolbar/layout/ReportToolbarOverflow.js +374 -0
  24. package/src/uielement/component/settings/UiAceEditor.js +3 -0
  25. package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.js +6 -31
  26. package/src/uielement/component/settings/plugin/UiCustomPanelPluginModel.js +30 -0
  27. package/src/uielement/component/settings/plugin/UiCustomPanelPluginStore.js +5 -0
  28. package/src/version.js +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # Version 2.7.55, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ffc9e1be5d88576d1e55c01cfd0af5f6dbbfb2aa)
2
+ * ## Fixes
3
+ * <span style='color:red'> У AceEditor в mode:javascript отключена загрузка web-worker в production режиме.</span> ([b2e0f4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b2e0f4b4c427e79fd4826fdb6b95b775b6bdc6b3))
4
+
5
+ * update: CHANGELOG.md ([68f517], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/68f517a04d7c7e0c2e58044a615c94945f0e2cbf))
6
+
7
+ # Version 2.7.54, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a19441b9743262927cddd105cae2ada2813cd1d5)
8
+ * ## Fixes
9
+ * <span style='color:red'> HT-9400 Исправление ошибок фильтрации списка плагинов в кастомной панели</span> ([b2b26e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b2b26e284939d93431e62980f5e5b97dc9a35e0a))
10
+
11
+ * update: CHANGELOG.md ([51f898], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/51f89806fc1f770ac00a25ab1a7a3a992e851dc0))
12
+
1
13
  # Version 2.7.53, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/694dce77cf290d786cc594c9d55532556a33ca31)
2
14
  * ## Fixes
3
15
  * <span style='color:red'> HT-9805 excel export checkbox column</span> ([00b75d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/00b75d185f59e6d26aad753e649a94117d2db076))
@@ -35,6 +47,9 @@ This reverts commit b3524303e203486f1c393f2174967c652d2f8c33.</span> ([0bfe61],
35
47
  * update: CHANGELOG.md ([2f020b], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2f020b8a2b6d2e2150329164ac7cef4d686de162))
36
48
 
37
49
  # Version 2.7.49, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f1191865e9e52331596a93e7bcf3ba36c85940f6)
50
+ * ## Features
51
+ * <span style='color:green'>feat: TR-69015: css</span> ([ecd879], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ecd87930a535ff13b0ad42eba28df9d1ed91cd2a))
52
+
38
53
  * ## Fixes
39
54
  * <span style='color:red'> HT-9084 ReportColumnStatePlugin column width</span> ([b10a75], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b10a75f78f92262543be268863961fda1113d9d5))
40
55
 
@@ -46,11 +61,17 @@ This reverts commit b3524303e203486f1c393f2174967c652d2f8c33.</span> ([0bfe61],
46
61
  * update: CHANGELOG.md ([e32b02], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e32b025afe52cc55930d04bccba9fd19be5905b9))
47
62
 
48
63
  # Version 2.7.46, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/236b6e13be06add8fe0eeab8b079e086e1d8b524)
64
+ * ## Features
65
+ * <span style='color:green'>feat: TR-69015: css</span> ([a2f2b9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/a2f2b9ba72b21e13e6ef30394e72af12f7e3811f))
66
+ * <span style='color:green'>feat: TR-69015: toolbar overflow panel on change overflow size hide/show buttons</span> ([d3540e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d3540e57ae3db0c52e02a0604c176f46cc411654))
67
+
49
68
  * :feat HT-8890 update extjs_iconpack to 1.3.27 ([108b17], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/108b17bbd73ed4064b884baa8633b0ceb9981048))
50
69
  * update: CHANGELOG.md ([c2d8dd], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c2d8dde1d050e900e2cd6fec5ded2c94c38050f0))
51
70
 
52
71
  # Version 2.7.46, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/19e7bc15c819e0dda639b962060e1993b1f29b6b)
53
72
  * ## Features
73
+ * <span style='color:green'>feat: TR-69015: css toolbar overflow panel</span> ([02e557], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/02e557e27dee1856c7d79d112bc36aacffb9a146))
74
+ * <span style='color:green'>feat: TR-69015: css toolbar overflow panel</span> ([af4b4f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/af4b4f895eb300ebaba1226c93af7eabf565916a))
54
75
  * <span style='color:green'>feat: extjs_iconpack version 1.3.26. Related to HT-8076.</span> ([4800c2], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4800c23beff6959619ff467bbcb6c7fc30afb188))
55
76
 
56
77
  * upd ([b76ef9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b76ef97561c257ff2c4956cebd21a69813219c2a))
@@ -58,6 +79,12 @@ This reverts commit b3524303e203486f1c393f2174967c652d2f8c33.</span> ([0bfe61],
58
79
  * update: CHANGELOG.md ([c9af96], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/c9af967e425b3f60570f9bf2198c105c7480f8e6))
59
80
 
60
81
  # Version 2.7.45, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/6d09543c991b7ecfb2ea0f7e4369298dbfd2327f)
82
+ * ## Features
83
+ * <span style='color:green'>feat: TR-69015: fix menu rendering problem after change parent panel</span> ([7f17ea], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/7f17ea3eebc99c044831a3fbeadab3f1c8a358a4))
84
+ * <span style='color:green'>feat: TR-69015: refactoring</span> ([96f8a4], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/96f8a4b10c77c3ab50be18ed82d4def80e6039b8))
85
+ * <span style='color:green'>feat: TR-69015: create new plugin</span> ([bc5a5c], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/bc5a5c7b3440a0a3965c589b519d63f6dc473c94))
86
+ * <span style='color:green'>feat: TR-69015: create new plugin</span> ([4a5f92], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4a5f92c2f8ee5d8c3cb141572867bb50c8f7423f))
87
+
61
88
  * ## Fixes
62
89
  * <span style='color:red'> Added required deps. Related to TR-68743, TR-63848.</span> ([27be06], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/27be06f608741d363f0c7e8521e94aefb2e9ba81))
63
90
 
@@ -105,6 +132,8 @@ fix: restore version of custom panel in editor</span> ([53a300], [link](http://g
105
132
 
106
133
  # Version 2.7.38, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3e9d06de2b191d41e62cc8ecb0fa9bf29863d57f)
107
134
  * ## Features
135
+ * <span style='color:green'>feat: TR-69015: create new plugin</span> ([ee863e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ee863e9df28954347719fde3d8141fd021f88bea))
136
+ * <span style='color:green'>feat: TR-69015: create new plugin</span> ([5231c9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5231c90f995574078ccdd61357dc4a92b3fac31d))
108
137
  * <span style='color:green'>feat: Added markClean fn, added initial value support. Related to TR-68743.</span> ([832572], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/83257261caf417563e7e698e1679da7266660fc5))
109
138
  * <span style='color:green'>feat: Added isDirty fn. Related to TR-68743.</span> ([eb0069], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/eb006993c46e4bab039e74703afc942ea1ca86e8))
110
139
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.7.53",
7
+ "version": "2.7.55",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -475,9 +475,59 @@ Ext.define('Coon.report.component.ReportPanel', {
475
475
  ];
476
476
  },
477
477
 
478
+ getGridTopToolbar() {
479
+ return this.gridTopToolbar;
480
+ },
481
+ getGridBottomToolbar() {
482
+ return this.gridBottomToolbar;
483
+ },
484
+ getGridFooterToolbar() {
485
+ return this.gridFooterToolbar;
486
+ },
487
+
488
+
489
+ createGridToolbars(grid) {
490
+ grid.tbar = this.createTopToolbar(grid.tbar);
491
+ grid.bbar = this.createBottomToolbar(grid.bbar);
492
+ grid.fbar = this.createFooterToolbar(grid.fbar);
493
+ },
494
+
495
+ createTopToolbar(items) {
496
+ return this.gridTopToolbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(items || [])});
497
+ },
498
+ createBottomToolbar(items) {
499
+ return this.gridBottomToolbar =Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(items || [])});
500
+ },
501
+ createFooterToolbar(items) {
502
+ return this.gridFooterToolbar =Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(items || [])});
503
+ },
504
+
505
+ getGridButtonsOrder() {
506
+ return false;
507
+ },
508
+
509
+ addToolbarPlugin(plugin) {
510
+ const ns = Coon.report.model.ReportPluginBeanFields;
511
+ const config = {pluginId: plugin[ns.$uiElement] && plugin[ns.$uiElement].id};
512
+ if (plugin[ns.$uiElement].propertyData) {
513
+ Ext.apply(config, Coon.Function.convertAdvancedProperties(Ext.decode(plugin[ns.$uiElement].propertyData)));
514
+ } else {
515
+ Ext.apply(config, Coon.Function.convertAdvancedProperties(plugin[ns.$uiElement].properties || plugin[ns.$properties]));
516
+ }
517
+ config['ptype'] = plugin[ns.$uiElement].xtype || plugin[ns.$xtype];
518
+ config[ns.$sortSequence] = plugin[ns.$sortSequence] || null;
519
+ this.addPlugin(config);
520
+ },
521
+
478
522
  preprocessPlugins(plugins) {
479
523
  return plugins.reduce((acc, plugin) => {
480
- plugin = this.preprocessPluginConfig(plugin, plugin.uiElement && plugin.uiElement.xtype);
524
+ if (plugin.uiElement.xtype === 'ReportToolbarPlugin') {
525
+ this.addToolbarPlugin(Object.assign({}, plugin));
526
+ plugin = false;
527
+ }
528
+ if (typeof this.preprocessPluginConfig === 'function') {
529
+ plugin = this.preprocessPluginConfig(plugin, plugin.uiElement && plugin.uiElement.xtype);
530
+ }
481
531
  plugin && acc.push(plugin);
482
532
  return acc;
483
533
  }, []);
@@ -487,10 +537,7 @@ Ext.define('Coon.report.component.ReportPanel', {
487
537
  this.clear();
488
538
  const command = Ext.create('command.LoadReportConfig', {activeComponent: this.activeComponent});
489
539
  command.on('complete', function(response) {
490
- if (typeof this.preprocessPluginConfig === 'function') {
491
- response.plugins = this.preprocessPlugins(response.plugins);
492
- }
493
- // response.plugins = this.checkPluginsCompatibility(response.plugins);
540
+ response.plugins = this.preprocessPlugins(response.plugins);
494
541
  this.build(response);
495
542
  this.fireEvent('configured', response, this);
496
543
  this.grid.fireEvent('configured', response, this);
@@ -762,6 +809,7 @@ Ext.define('Coon.report.component.ReportPanel', {
762
809
  groupSortFunc: this.groupSortFunc,
763
810
  enableAutoSize: this.enableAutoSize,
764
811
  fields: [],
812
+ reportPanel: this,
765
813
  url: this.url || '/ReportFormData/get',
766
814
  timeout: this.timeout || undefined,
767
815
  pageSize: this.pageSize || reportBean[ns.$rowCountPerPageValue],
@@ -45,11 +45,9 @@ Ext.define('Coon.report.component.reportpanel.ReportGrid', {
45
45
  }, this);
46
46
  this.store.on('beforeload', () => this.getView().setEmptyText(''));
47
47
  }, this, {single: true});
48
-
49
- this.tbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(this.tbar || [])});
50
- this.bbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(this.bbar || [])});
51
- this.fbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(this.fbar || [])});
52
-
48
+ if (this.reportPanel) {
49
+ this.reportPanel.createGridToolbars(this);
50
+ }
53
51
  const plugins = this.plugins;
54
52
  delete this.plugins;
55
53
  const pluginErrors = [];
@@ -102,11 +102,9 @@ Ext.define('Coon.report.component.reportpanel.ReportTree', {
102
102
  }
103
103
  }
104
104
  }
105
-
106
- this.tbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(this.tbar||[])});
107
- this.bbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(this.bbar||[])});
108
- this.fbar = Ext.create({xtype: 'toolbar', hidden: true, enableOverflow: true, items: [].concat(this.fbar||[])});
109
-
105
+ if (this.reportPanel) {
106
+ this.reportPanel.createGridToolbars(this);
107
+ }
110
108
  this.callParent();
111
109
  this.relayEvents(this.getStore(), ['datachanged', 'load']);
112
110
  },
@@ -9,7 +9,7 @@ Ext.define('Coon.report.component.settings.plugin.PluginSelectWindow', {
9
9
  ],
10
10
 
11
11
  width: 1050,
12
- height: 700,
12
+ height: '95%',
13
13
  closeAction: 'hide',
14
14
  title: 'Выбор плагина',
15
15
 
@@ -1,7 +1,10 @@
1
1
  Ext.define('Coon.report.component.settings.plugin.ReportFormPluginPanelController', {
2
2
  extend: 'Ext.app.ViewController',
3
3
  alias: 'controller.reportformpluginpanelcontroller',
4
- requires: ['Coon.report.plugin.util'],
4
+ requires: ['Coon.report.plugin.util', 'Coon.report.component.settings.plugin.ReportToolbarFunctions'],
5
+ mixins: {
6
+ reportToolbarFunctions: 'Coon.report.component.settings.plugin.ReportToolbarFunctions',
7
+ },
5
8
  init: function(view) {
6
9
  this.getViewModel().bind({bindTo: '{pluginsGrid.selection}'}, this.selectionChange, this);
7
10
  this.getViewModel().bind({bindTo: '{report.fields}', deep: true}, this.updateContext, this);
@@ -0,0 +1,176 @@
1
+ Ext.define('Coon.report.component.settings.plugin.ReportToolbarFunctions', {
2
+ extend: 'Ext.Mixin',
3
+ mixinConfig: {
4
+ after: {
5
+ saveState: 'updateUBFState',
6
+ },
7
+ },
8
+ getInstance(obj) {
9
+ if (!obj || obj.$className === 'Ext.plugin.Abstract') {
10
+ return false;
11
+ }
12
+ return obj.$className === 'Coon.report.plugin.grid.ToolbarItemPlugin' ||
13
+ obj.$className === 'Coon.report.plugin.grid.GroupButtonsPlugin' ||
14
+ this.getInstance(obj.superclass) ? true : false;
15
+ },
16
+
17
+ compareItems(items, cfg) {
18
+ cfg && cfg.cfg && cfg.cfg.forEach((cfgItem) => {
19
+ items.forEach((item) => {
20
+ if (item.uiElement === cfgItem.id) {
21
+ item.buttonType = cfgItem.buttonType;
22
+ item.index = cfgItem.index;
23
+ } else if (item.xtype === 'GroupButtonsPlugin' && item.jsonProperties && item.jsonProperties.groupButtonsConfig) {
24
+ item.jsonProperties.groupButtonsConfig.forEach((group) => {
25
+ if (group.groupButtonId === cfgItem.id) {
26
+ group.buttonType = cfgItem.buttonType;
27
+ group.index = cfgItem.index;
28
+ }
29
+ });
30
+ }
31
+ });
32
+ });
33
+ return items;
34
+ },
35
+
36
+ sortList(items, index) {
37
+ items.sort((a, b) => {
38
+ if (a[index] < b[index]) {
39
+ return -1;
40
+ }
41
+ if (a[index] > b[index]) {
42
+ return 1;
43
+ }
44
+ return 0;
45
+ });
46
+ },
47
+
48
+ getMaxIndex(items) {
49
+ let index = 0;
50
+ items.forEach((item) => {
51
+ if (item.index && item.index > index) {
52
+ index = item.index;
53
+ }
54
+ });
55
+ return index;
56
+ },
57
+
58
+ getTreeData(items) {
59
+ const data = [];
60
+ const indexes = [];
61
+ items.forEach((item, pos) => {
62
+ if (item.xtype === 'GroupButtonsPlugin' && item.jsonProperties && item.jsonProperties.groupButtonsConfig) {
63
+ item.jsonProperties.groupButtonsConfig.forEach((groupButton) => {
64
+ const group = {
65
+ id: groupButton.groupButtonId,
66
+ index: groupButton.index >= 0 ? groupButton.index : -1,
67
+ position: groupButton.position,
68
+ text: groupButton.text,
69
+ children: [],
70
+ pluginId: item.uiElement,
71
+ /* expanded: true,*/
72
+ buttonType: groupButton.buttonType || 0,
73
+ };
74
+ indexes.push(pos);
75
+ items.forEach((item, pos) => {
76
+ if (item && item.jsonProperties && item.jsonProperties.groupButtonId &&
77
+ item.jsonProperties.groupButtonId === groupButton.groupButtonId) {
78
+ group.children.push({
79
+ id: item.uiElement,
80
+ position: item.jsonProperties.position >= 0 ? item.jsonProperties.position : item.sortSequence,
81
+ text: item.jsonProperties.buttonText,
82
+ children: [],
83
+ buttonType: 0,
84
+ leaf: true,
85
+ });
86
+ indexes.push(pos);
87
+ }
88
+ });
89
+ this.sortList(group.children, 'position');
90
+ data.push(group);
91
+ });
92
+ }
93
+ });
94
+ let index = this.getMaxIndex(items) + 1;
95
+ items.forEach((item, pos) => {
96
+ if (indexes.indexOf(pos) < 0) {
97
+ if (item.jsonProperties.addButtonOnToolbar && item.jsonProperties.toolbar === 'Top') {
98
+ const btnType = item.buttonType >=0 ? item.buttonType : this.getDefaultButtonType(items, item);
99
+ data.push({
100
+ id: item.uiElement,
101
+ index: item.index >= 0 ? item.index : index++,
102
+ text: item.jsonProperties.buttonText,
103
+ children: [],
104
+ buttonType: btnType,
105
+ leaf: true,
106
+ });
107
+ item.buttonType = btnType;
108
+ }
109
+ }
110
+ });
111
+ data.forEach((item) => {
112
+ if (!(item.index >= 0)) {
113
+ item.index = index++;
114
+ }
115
+ });
116
+ this.sortList(data, 'index');
117
+ return data;
118
+ },
119
+ getDefaultButtonType(records, record) {
120
+ if (this.getSystemList().indexOf(record.xtype) < 0) {
121
+ return 0;
122
+ }
123
+ let flag = false;
124
+ records.forEach((rec) => {
125
+ if (rec.xtype === record.xtype && rec.uiElement !== record.uiElement && rec.buttonType === 3) {
126
+ flag = true;
127
+ return true;
128
+ }
129
+ });
130
+ return flag ? 0 : 3;
131
+ },
132
+ hasReportToolbarPlugin() {
133
+ let plugin = false;
134
+ this.getViewModel().get('report.plugins').forEach((el) => {
135
+ if (el.xtype === 'ReportToolbarPlugin') {
136
+ plugin = el;
137
+ }
138
+ });
139
+ return plugin;
140
+ },
141
+ getSystemList() {
142
+ return ['CopyRowsFromGrid', 'ExportReportDataToFilePlugin', 'ExporterPlugin', 'PrintPdfButtonPlugin'];
143
+ },
144
+ updateUBFState() {
145
+ const plugin = this.hasReportToolbarPlugin();
146
+ const pluginRecord = this.lookup('pluginsGrid').getStore().getById(plugin['id']);
147
+ if (pluginRecord) {
148
+ if (plugin !== false && (!this.activeRecord || this.activeRecord.get('xtype') !== 'ReportToolbarPlugin')) {
149
+ const items = [];
150
+ this.getViewModel().get('report.plugins').forEach((el) => {
151
+ if (this.getInstance(Ext.ClassManager.getByAlias(`plugin.${el.xtype}`))) {
152
+ items.push(el);
153
+ }
154
+ });
155
+ const data = this.getTreeData(this.compareItems(items, plugin.jsonProperties));
156
+ const savedData = [];
157
+ data.forEach((item) => {
158
+ savedData.push(this.getObject(item));
159
+ });
160
+ pluginRecord.set('jsonProperties', {cfg: savedData, useReportToolbar: plugin.jsonProperties.useReportToolbar});
161
+ }
162
+ }
163
+ },
164
+ getObject(item) {
165
+ return typeof item.get === 'function' ? {
166
+ id: item.get('id'),
167
+ index: item.get('index'),
168
+ buttonType: item.get('buttonType'),
169
+ } : {
170
+ id: item['id'],
171
+ index: item['index'],
172
+ buttonType: item['buttonType'],
173
+ };
174
+ },
175
+
176
+ });
@@ -0,0 +1,195 @@
1
+ Ext.define('Coon.report.plugin.configPanel.ReportToolbarPluginConfigPanel', {
2
+ extend: 'Coon.report.plugin.configPanel.BasePluginConfig',
3
+ alias: 'widget.ReportToolbarPluginConfigPanel',
4
+ description: 'Добавляет разделитель на панель инструментов отчета.',
5
+ tags: ['Отображение', 'Тулбар'],
6
+ flex: 1,
7
+ config: {
8
+ pluginTypeSettings: {
9
+ defaultType: 'PANEL_PLUGIN',
10
+ allowedTypes: [
11
+ 'PANEL_PLUGIN'
12
+ ],
13
+ },
14
+ },
15
+ viewModel: {
16
+ data: {
17
+ useReportToolbar: true,
18
+ },
19
+ },
20
+ doInit(properties) {
21
+ const panel = this.up('ReportFormEditPanel');
22
+ if (panel) {
23
+ const vm = panel.getViewModel();
24
+ const controller = this.up('ReportFormPluginPanel').getController();
25
+ const items = [];
26
+ vm.get('report.plugins').forEach((el) => {
27
+ if (controller.mixins.reportToolbarFunctions.getInstance(Ext.ClassManager.getByAlias(`plugin.${el.xtype}`))) {
28
+ items.push(el);
29
+ }
30
+ });
31
+ this.down('treepanel').getRootNode().appendChild(
32
+ controller.mixins.reportToolbarFunctions.getTreeData(
33
+ controller.mixins.reportToolbarFunctions.compareItems(items, properties)
34
+ )
35
+ );
36
+ this.getViewModel().set('useReportToolbar', typeof properties.useReportToolbar != 'undefined' ? properties.useReportToolbar : true);
37
+ }
38
+ },
39
+ createItems: function() {
40
+ const filterTypeEditor = Ext.create('Coon.common.field.combo.ConstantList', {
41
+ data: [
42
+ [0, 'Без категории'],
43
+ [1, 'Функциональные'],
44
+ [2, 'Информационные'],
45
+ [3, 'Системные']
46
+ ],
47
+ });
48
+ return [
49
+ {
50
+ xtype: 'checkbox',
51
+ boxLabel: 'Отобразить новый интерфейс',
52
+ bind: {
53
+ value: '{useReportToolbar}',
54
+ },
55
+ },
56
+ {
57
+ xtype: 'treepanel',
58
+ plugins: {
59
+ cellediting: {
60
+ clicksToEdit: 2,
61
+ listeners: {
62
+ beforeedit: function(editor, context) {
63
+ if (!context.record.parentNode.isRoot()) {
64
+ return false;
65
+ }
66
+ const mainPanel = context.grid.up('ReportFormPluginPanel');
67
+ const controller = mainPanel.getController();
68
+ const plugins = mainPanel.down('ReportFormPluginGrid');
69
+ const pos = plugins.getStore().find('uiElement',
70
+ context.record.get('pluginId') ? context.record.get('pluginId') : context.record.get('id')
71
+ );
72
+ const pluginRecord = plugins.getStore().getAt(pos);
73
+ const xtype = pluginRecord.get('xtype');
74
+
75
+ if (controller.mixins.reportToolbarFunctions.getSystemList().indexOf(xtype) >= 0 || xtype === 'GroupButtonsPlugin') {
76
+ filterTypeEditor.getStore().clearFilter();
77
+ } else {
78
+ if (!context.grid.getStore().filters.length) {
79
+ filterTypeEditor.getStore().addFilter({
80
+ property: 'value',
81
+ value: 3,
82
+ operator: '!=',
83
+ });
84
+ }
85
+ }
86
+ },
87
+ edit: function(editor, context) {
88
+ if (context.field !== 'buttonType' || context.record.get('buttonType') !== 3) {
89
+ return true;
90
+ }
91
+ context.grid.up('ReportToolbarPluginConfigPanel').updateTypes(context.record);
92
+ },
93
+ },
94
+
95
+ },
96
+ },
97
+ viewConfig: {
98
+ plugins: {
99
+ treeviewdragdrop: {
100
+ dragText: 'Задайте порядок отображения кнопок',
101
+ sortOnDrop: true,
102
+ allowParentInserts: false,
103
+ },
104
+ },
105
+ listeners: {
106
+ beforedrop: function(node, data, overModel, dropPosition, dropHandlers) {
107
+ dropHandlers.wait = true;
108
+ if (dropPosition === 'append' || !overModel.parentNode.isRoot() || !data.records[0].parentNode.isRoot()) {
109
+ dropHandlers.cancelDrop();
110
+ } else {
111
+ dropHandlers.processDrop();
112
+ }
113
+ },
114
+ },
115
+ },
116
+ store: {
117
+ root: {
118
+ expanded: true,
119
+ children: [],
120
+ },
121
+ type: 'tree',
122
+ },
123
+ rootVisible: false,
124
+ columns: [{
125
+ xtype: 'treecolumn',
126
+ text: 'Текст кнопки',
127
+ dataIndex: 'text',
128
+ flex: 1,
129
+ }, {
130
+ text: 'Тип кнопки',
131
+ dataIndex: 'buttonType',
132
+ flex: 1,
133
+ renderer: Coon.format.comboRenderer(filterTypeEditor),
134
+ editor: filterTypeEditor,
135
+
136
+ }, {
137
+ xtype: 'actioncolumn',
138
+ width: 50,
139
+ items: [{
140
+ iconCls: 'x-fa fa-search',
141
+ tooltip: 'Перейти',
142
+ handler: function(grid, rowIndex, colIndex) {
143
+ const rec = grid.getStore().getAt(rowIndex);
144
+ const plugins = this.up('ReportFormPluginPanel').down('ReportFormPluginGrid');
145
+ if (plugins) {
146
+ plugins.getSelectionModel().select(
147
+ plugins.getStore().find('uiElement', rec.get('pluginId') ? rec.get('pluginId') : rec.get('id'))
148
+ );
149
+ }
150
+ },
151
+ }],
152
+ }],
153
+ }
154
+ ];
155
+ },
156
+ updateTypes(record) {
157
+ const mainPanel = this.up('ReportFormPluginPanel');
158
+ const plugins = mainPanel.down('ReportFormPluginGrid');
159
+ const pos = plugins.getStore().find('uiElement',
160
+ record.get('pluginId') ? record.get('pluginId') : record.get('id')
161
+ );
162
+ const pluginRecord = plugins.getStore().getAt(pos);
163
+ const pluginsByXtype = [];
164
+ plugins.getStore().getRange().filter(
165
+ (rec) => rec.get('xtype') === pluginRecord.get('xtype')
166
+ ).forEach((rec) => {
167
+ if (rec.get('xtype') === 'GroupButtonsPlugin') {
168
+ if (rec.get('jsonProperties') && rec.get('jsonProperties').groupButtonsConfig) {
169
+ rec.get('jsonProperties').groupButtonsConfig.forEach((prop) => {
170
+ pluginsByXtype.push(prop.groupButtonId);
171
+ });
172
+ }
173
+ } else {
174
+ pluginsByXtype.push(rec.get('uiElement'));
175
+ }
176
+ });
177
+ // console.log(pluginsByXtype);
178
+ this.down('treepanel').getStore().getData().each((item) => {
179
+ if (item.id !== record.id && pluginsByXtype.indexOf(item.id) >= 0) {
180
+ item.set('buttonType', 0);
181
+ }
182
+ });
183
+ },
184
+ getConfiguration: function() {
185
+ const tree = this.down('treepanel');
186
+ const data = [];
187
+ if (tree) {
188
+ const controller = this.up('ReportFormPluginPanel').getController();
189
+ this.down('treepanel').getStore().getData().items.forEach((item) => {
190
+ data.push(controller.mixins.reportToolbarFunctions.getObject(item));
191
+ });
192
+ }
193
+ return {cfg: data, useReportToolbar: this.getViewModel().get('useReportToolbar')};
194
+ },
195
+ });
@@ -22,6 +22,13 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
22
22
  this.callParent(arguments);
23
23
  },
24
24
 
25
+
26
+ createToolbarItem: function(config) {
27
+ const tbItem = this.callParent([config]);
28
+ tbItem.exportFileFormat = this.exportFileFormat;
29
+ return tbItem;
30
+ },
31
+
25
32
  init(grid) {
26
33
  this.callParent([grid]);
27
34
  this.grid = grid;
@@ -36,14 +36,17 @@ Ext.define('Coon.report.plugin.grid.GroupButtonsPlugin', {
36
36
  const buttonsConfig = this.getGroupButtonsConfig();
37
37
  buttonsConfig.forEach(function(buttonConfig) {
38
38
  const cfg = Ext.create('Ext.button.Button', {
39
+ foldStateId: buttonConfig[ns.$groupButtonId],
39
40
  itemId: 'groupButton' + buttonConfig[ns.$groupButtonId],
40
41
  text: buttonConfig[ns.$text],
41
42
  iconCls: buttonConfig[ns.$iconCls],
42
43
  menu: [],
44
+ pType: 'GroupButtonsPlugin',
43
45
  });
44
46
  cfg[ns.$sortSequence] = this[ns.$sortSequence];
45
47
  const position = buttonConfig[ns.$position];
46
- if (position && !isNaN(Number(position)) && Number(position) > 0) {
48
+ if (position && !isNaN(Number(
49
+ position)) && Number(position) > 0) {
47
50
  cfg[ns.$position] = buttonConfig[ns.$position];
48
51
  } else {
49
52
  cfg[ns.$position] = this[ns.$sortSequence];
@@ -31,15 +31,15 @@ Ext.define('Coon.report.plugin.grid.ToolbarItemPlugin', {
31
31
  if (component instanceof Ext.panel.Panel) {
32
32
  Ext.apply(component, {
33
33
  getTopToolbar: function() {
34
- return this.getToolbar('toolbar[dock=top]');
34
+ return component.reportPanel ? component.reportPanel.getGridTopToolbar() : this.getToolbar('toolbar[dock=top]');
35
35
  },
36
36
 
37
37
  getBottomToolbar: function() {
38
- return this.getToolbar('toolbar[dock=bottom]');
38
+ return component.reportPanel ? component.reportPanel.getGridBottomToolbar() : this.getToolbar('toolbar[dock=bottom]');
39
39
  },
40
40
 
41
41
  getFooterToolbar: function() {
42
- return this.getToolbar('toolbar[dock=bottom][ui=footer]');
42
+ return component.reportPanel ? component.reportPanel.getGridFooterToolbar() : this.getToolbar('toolbar[dock=bottom][ui=footer]');
43
43
  },
44
44
 
45
45
  getToolbar: function(exp) {
@@ -98,17 +98,18 @@ Ext.define('Coon.report.plugin.grid.ToolbarItemPlugin', {
98
98
  const bar = toolbarGetter && toolbarGetter.call(this.component);
99
99
  if (bar) {
100
100
  const cfg = {
101
+ foldStateId: this.pluginId,
101
102
  groupButtonId: this.groupButtonId,
102
103
  hidden: this.invisibleByDefault,
103
104
  position: this.position,
104
105
  sortSequence: this.sortSequence,
106
+ pType: this.pluginConfig ? this.pluginConfig.ptype : '',
105
107
  };
106
108
  if (!this.position || isNaN(Number(this.position)) || Number(this.position) <= 0) {
107
109
  cfg.position = this.sortSequence;
108
110
  }
109
111
 
110
112
  const item = this.createToolbarItem(cfg);
111
-
112
113
  bar.insert(cfg.position, item);
113
114
  this.component.fireEvent('buttonIsAdded', {button: item, bar: bar});
114
115