ru.coon 2.7.3 → 2.7.5

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 (31) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +1 -1
  3. package/src/app/Readme.md +0 -0
  4. package/src/app/Router.js +44 -0
  5. package/src/app/component/CenterView.js +65 -0
  6. package/src/app/component/CenterViewController.js +152 -0
  7. package/src/app/viewPort/Main.js +76 -0
  8. package/src/app/viewPort/Main.scss +133 -0
  9. package/src/common/component/ChooseColorField.js +142 -0
  10. package/src/common/component/ColorPalette.js +151 -0
  11. package/src/common/component/ColorPalette.scss +102 -0
  12. package/src/common/component/ColorPaletteController.js +189 -0
  13. package/src/common/field/withDefault.js +3 -2
  14. package/src/nav/AppNavigationMenu.js +35 -44
  15. package/src/nav/AppNavigationMenuController.js +110 -56
  16. package/src/nav/AppNavigationToggleButton.js +9 -0
  17. package/src/nav/AppNavigationToggleButton.scss +6 -0
  18. package/src/nav/MenuEntity.js +35 -0
  19. package/src/nav/editor/menu/NavMenuTreeController.js +1 -0
  20. package/src/nav/editor/menu/form/NavMenuFormViewController.js +1 -0
  21. package/src/report/plugin/configPanel/GridEditorPluginConfig.js +3 -1
  22. package/src/report/plugin/configPanel/GridRowStylePluginConfig.js +130 -94
  23. package/src/report/plugin/configPanel/GridRowStylePluginConfigPropertyGrid.js +10 -15
  24. package/src/report/plugin/grid/GridEditorsPlugin.js +27 -21
  25. package/src/report/plugin/grid/GridRowStylePlugin.js +90 -0
  26. package/src/uielement/component/MenuItemList.js +35 -6
  27. package/src/uielement/component/formchips/Chip.js +2 -2
  28. package/src/uielement/component/formchips/FilterConditionToolbar.js +2 -1
  29. package/src/uielement/component/formchips/FilterConditionToolbarController.js +37 -60
  30. package/src/uielement/plugin/configPanel/executeCommand/ExecuteCommandPluginConfigPanelFormEditor.js +14 -11
  31. package/src/version.js +1 -1
@@ -1,43 +1,42 @@
1
1
  Ext.define('Coon.nav.AppNavigationMenu', {
2
2
  extend: 'Ext.Panel',
3
3
  xtype: 'AppNavigationMenu',
4
-
5
4
  // mixins: ['Coon.mixin.RelayMethods'],
6
-
7
5
  requires: [
8
6
  'Coon.nav.menu.WorkspaceMenuView',
9
7
  'Coon.nav.AppNavigationMenuController'
10
8
  ],
9
+ scrollable: 'y',
10
+ selectFirstOnLoad: true,
11
11
  controller: 'AppNavigationMenuController',
12
-
13
- cls: 'AppNavigationMenu',
14
-
15
- updateSelection: function(selection) {
16
- return this.getController().selectMenuItem(selection);
17
- },
18
-
19
- getMenuReady: function() {
20
- return this.getController().getMenuReady();
21
- },
22
-
23
- getFirstAvailable: function() {
24
- return this.getController().getFirstAvailable();
25
- },
26
-
27
- changeMicro: function(micro) {
28
- this.lookup('WorkspaceMenuView').setMicro(micro);
12
+ viewModel: {
13
+ data: {
14
+ workspace_descr: null,
15
+ workspace_list: null,
16
+ workspace_icon: null,
17
+ navCollapsed: false,
18
+ collapsedWidth: 44,
19
+ fullWidth: 260,
20
+ },
29
21
  },
30
-
31
- changeWorkspace: function(workspace, selectFirst) {
32
- return this.getController().changeWorkspace(workspace, selectFirst);
22
+ fullWidth: 260,
23
+ cls: 'AppNavigationMenu',
24
+ layout: {
25
+ type: 'vbox',
26
+ align: 'stretch',
33
27
  },
34
-
35
- initComponent: function() {
36
- this.layout = {
37
- type: 'vbox',
38
- align: 'stretch',
28
+ items: [
29
+ {
30
+ xtype: 'button',
31
+ textAlign: 'left',
32
+ bind: {
33
+ text: '{workspace_descr}',
34
+ menu: '{workspace_list}',
35
+ iconCls: '{workspace_icon}',
36
+ arrowVisible: '{!navCollapsed}',
37
+ },
39
38
  },
40
- this.workspaceMenuView = Ext.create({
39
+ {
41
40
  xtype: 'WorkspaceMenuView',
42
41
  reference: 'WorkspaceMenuView',
43
42
  store: {
@@ -46,23 +45,15 @@ Ext.define('Coon.nav.AppNavigationMenu', {
46
45
  children: null,
47
46
  },
48
47
  },
49
- });
50
- this.items = [
51
- {
52
- xtype: 'button',
53
- textAlign: 'left',
54
- bind: {
55
- text: '{workspace_descr}',
56
- menu: '{workspace_list}',
57
- iconCls: '{workspace_icon}',
58
- arrowVisible: '{!navCollapsed}',
59
- },
60
- },
61
- this.workspaceMenuView
62
- ];
63
- this.relayEvents(this.workspaceMenuView, ['selectionchange']);
64
- // this.relayMethods(this, ['getFirstAvailable', 'getMenuReady', 'updateSelection']);
48
+ }
49
+ ],
50
+
51
+ bind: {
52
+ width: `{!navCollapsed ? fullWidth : collapsedWidth}`,
53
+ },
54
+ initComponent: function() {
65
55
  this.callParent();
56
+ this.relayEvents(this.lookup('WorkspaceMenuView'), ['selectionchange']);
66
57
  },
67
58
 
68
59
  });
@@ -6,13 +6,52 @@ Ext.define('Coon.nav.AppNavigationMenuController', {
6
6
  data: null,
7
7
  },
8
8
  menuReady: false,
9
-
9
+ selectThenMenuReady: undefined,
10
+ addWorkspaceToUrl: false,
10
11
  init: function(view) {
12
+ view.updateSelection = this.updateSelection.bind(this);
13
+ view.getMenuReady = this.getMenuReady.bind(this);
14
+ view.getFirstAvailable = this.getFirstAvailable.bind(this);
15
+ view.changeMicro = this.changeMicro.bind(this);
16
+ view.changeWorkspace = this.changeWorkspace.bind(this);
17
+ this.view.on('selectionchange', this.onSelectMenuItem, this);
11
18
  this.loadMenu();
12
19
  view.getFirstAvailable = this.getFirstAvailable.bind(this);
20
+ Ext.on('route:initial', (route) => {
21
+ this.selectThenMenuReady = route.id;
22
+ });
23
+ Ext.on('route:change', (route) => this.selectMenuItem.call(this, route.id));
24
+ Ext.on('route:unmatched', () => this.goTo(this.getFirstAvailable()));
25
+ const vm = this.getViewModel();
26
+ Ext.on('nav:toggle', () => {
27
+ vm.set('navCollapsed', !vm.get('navCollapsed'));
28
+ vm.getParent().set('navCollapsed', vm.get('navCollapsed'));
29
+ this.changeMicro(vm.get('navCollapsed'));
30
+ });
31
+ Ext.on('nav:reload', () => this.updateMenu());
32
+ },
33
+ initViewModel(vm) {
34
+ vm.set('fullWidth', this.getView().fullWidth);
35
+ },
36
+ onMenuReady() {
37
+ const ws = this.locals.data.ws.entries().next().value.at(0);
38
+ this.changeWorkspace(ws, false);
39
+ if (this.selectThenMenuReady) {
40
+ this.selectMenuItem(this.selectThenMenuReady);
41
+ } else {
42
+ this.view.selectFirstOnLoad && this.goTo(this.getFirstAvailable(), true);
43
+ }
44
+ },
45
+ updateSelection: function(selection) {
46
+ return this.selectMenuItem(selection);
47
+ },
48
+
49
+ changeMicro: function(micro) {
50
+ this.lookup('WorkspaceMenuView').setMicro(micro);
13
51
  },
14
52
 
15
53
  updateMenu: function() {
54
+ Coon.nav.MenuEntity.menuItems = null;
16
55
  this.loadMenu();
17
56
  },
18
57
 
@@ -74,6 +113,21 @@ Ext.define('Coon.nav.AppNavigationMenuController', {
74
113
  return Object.values(menu);
75
114
  },
76
115
 
116
+ goTo(id, force = false) {
117
+ if (id) {
118
+ let prefix = '';
119
+ if (this.addWorkspaceToUrl) {
120
+ const ws = this.getViewModel().get('workspace') || this.getFirstAvailable().ws.ws;
121
+ prefix = ws && ws + '/';
122
+ }
123
+ this.redirectTo(prefix + id, {force});
124
+ }
125
+ },
126
+
127
+ onSelectMenuItem: function(navCmp, item) {
128
+ this.goTo(item && item.get('UI_ELEMENT_CD'));
129
+ },
130
+
77
131
  selectMenuItem: function(uiElementCd) {
78
132
  if (!this.menuReady) {
79
133
  return;
@@ -90,6 +144,7 @@ Ext.define('Coon.nav.AppNavigationMenuController', {
90
144
 
91
145
  if (!menuItem) {
92
146
  console.error('unmatchedRoute: ' + uiElementCd);
147
+ this.goTo(this.getFirstAvailable());
93
148
  return;
94
149
  }
95
150
 
@@ -111,65 +166,64 @@ Ext.define('Coon.nav.AppNavigationMenuController', {
111
166
  this.fireViewEvent('select', node);
112
167
  return node;
113
168
  },
114
- loadMenu: function() {
115
- return Coon.util.promisifyCmd('command.GetDynamicReportDataCommand', 'MENU_ALLITEMS')
116
- .then((data) => {
117
- if (Array.isArray(data.list)) {
118
- const transformData = data.list.map((el) => {
119
- return Coon.Function.convertObjectByMapping(el, {
120
- MENU_ENTRY_ICON: 'iconCls',
121
- MENU_ENTRY_DESCR: 'text',
122
- });
169
+ loadMenu() {
170
+ Coon.nav.MenuEntity.get().then((menu) => {
171
+ if (Array.isArray(menu)) {
172
+ const dataList = this.prepareMenuData(menu);
173
+ const transformData = dataList.map((el) => {
174
+ return Coon.Function.convertObjectByMapping(el, {
175
+ MENU_ENTRY_ICON: 'iconCls',
176
+ MENU_ENTRY_DESCR: 'text',
177
+ });
178
+ });
179
+ this.locals.data = transformData.reduce((acc, el) => {
180
+ acc.ws.set(el.WORKSPACE_CD, {
181
+ ws: el.WORKSPACE_CD,
182
+ text: el.WORKSPACE_DESCR,
183
+ iconCls: el.WORKSPACE_ICON,
123
184
  });
124
- this.locals.data = transformData.reduce((acc, el) => {
125
- acc.ws.set(el.WORKSPACE_CD, {
126
- ws: el.WORKSPACE_CD,
127
- text: el.WORKSPACE_DESCR,
128
- iconCls: el.WORKSPACE_ICON,
129
- });
130
- acc.items[el.WORKSPACE_CD] = acc.items[el.WORKSPACE_CD] || {};
131
- acc.items[el.WORKSPACE_CD][el.MENU_ENTRY_CD] = el;
132
- acc.menu.push(el);
133
- return acc;
134
- }, {ws: new Map(), items: {}, menu: []});
135
-
136
- const items = [];
137
- const me = this;
138
- this.locals.data.ws.forEach((item) => {
139
- items.push({
140
- text: item.text,
141
- width: 260,
142
- value: item.ws,
143
- iconCls: item.iconCls,
144
- handler: function() {
145
- me.changeWorkspace(this.value, true);
146
- },
147
- });
185
+ acc.items[el.WORKSPACE_CD] = acc.items[el.WORKSPACE_CD] || {};
186
+ acc.items[el.WORKSPACE_CD][el.MENU_ENTRY_CD] = el;
187
+ acc.menu.push(el);
188
+ return acc;
189
+ }, {ws: new Map(), items: {}, menu: []});
190
+
191
+ const items = [];
192
+ const me = this;
193
+ this.locals.data.ws.forEach((item) => {
194
+ items.push({
195
+ text: item.text,
196
+ width: this.getView().fullWidth,
197
+ value: item.ws,
198
+ iconCls: item.iconCls,
199
+ handler: function() {
200
+ me.changeWorkspace(this.value, true);
201
+ },
148
202
  });
149
- this.getViewModel().set('workspace_list', items);
150
-
151
- Object.entries(this.locals.data.items).forEach(function(workspace) {
152
- const [workspaceId, workspaceItems] = workspace;
153
- Object.values(workspaceItems).forEach(function(el) {
154
- el.leaf = el.LEAF_SW === 'Y';
155
- if (el.PARENT_MENU_ENTRY_CD) { // значит вложенный
156
- const parent = this.locals.data.items[workspaceId][el.PARENT_MENU_ENTRY_CD];
157
- if (parent) {
158
- parent.children = parent.children || [];
159
- parent.children.push(el);
160
- }
203
+ });
204
+ this.getViewModel().set('workspace_list', items);
205
+
206
+ Object.entries(this.locals.data.items).forEach(function(workspace) {
207
+ const [workspaceId, workspaceItems] = workspace;
208
+ Object.values(workspaceItems).forEach(function(el) {
209
+ el.leaf = el.LEAF_SW === 'Y';
210
+ if (el.PARENT_MENU_ENTRY_CD) { // значит вложенный
211
+ const parent = this.locals.data.items[workspaceId][el.PARENT_MENU_ENTRY_CD];
212
+ if (parent) {
213
+ parent.children = parent.children || [];
214
+ parent.children.push(el);
161
215
  }
162
- }, this);
216
+ }
163
217
  }, this);
164
- this.menuReady = true;
165
- this.fireViewEvent('menuReady');
166
- } else {
167
- Ext.Msg.alert('ошибка', 'некорректный формат ответа или нет данных');
168
- }
169
- });
218
+ }, this);
219
+ this.menuReady = true;
220
+ this.fireViewEvent('menuReady');
221
+ Ext.fireEvent('nav:ready');
222
+ this.onMenuReady();
223
+ }
224
+ });
170
225
  },
171
-
172
- onToggleNavigationSize: function(micro) {
173
- this.getViewModel().set('micro', micro);
226
+ prepareMenuData(data) {
227
+ return data;
174
228
  },
175
229
  });
@@ -0,0 +1,9 @@
1
+ Ext.define('Coon.nav.AppNavigationToggleButton', {
2
+ extend: 'Ext.button.Button',
3
+ xtype: 'AppNavigationToggleButton',
4
+ cls: 'AppNavigationToggleButton',
5
+ iconCls: 'svg-icon svg-icon-menu-open',
6
+ handler() {
7
+ Ext.fireEvent('nav:toggle');
8
+ },
9
+ });
@@ -0,0 +1,6 @@
1
+ .AppNavigationToggleButton{
2
+ .x-btn-icon-el.svg-icon{
3
+ width: 33px;
4
+ height: 24px;
5
+ }
6
+ }
@@ -0,0 +1,35 @@
1
+ Ext.define('Coon.nav.MenuEntity', {
2
+ singleton: true,
3
+ menuItems: null,
4
+ isLoading: false,
5
+ promise: null,
6
+ get() {
7
+ if (typeof this.menuItems === 'object' && Array.isArray(this.menuItems) && this.isLoading === false) {
8
+ return new Promise((resolve) => {
9
+ resolve(this.menuItems);
10
+ });
11
+ } else if (!this.promise) {
12
+ this.isLoading = true;
13
+ this.promise = Coon.util.promisifyCmd('command.GetDynamicReportDataCommand', 'MENU_ALLITEMS')
14
+ .then((data) => {
15
+ if (Array.isArray(data.list)) {
16
+ this.menuItems = data.list;
17
+ } else {
18
+ Ext.Msg.alert('ошибка', 'некорректный формат ответа или нет данных');
19
+ }
20
+ this.isLoading = false;
21
+ return this.menuItems;
22
+ }).finally(() => {
23
+ this.promise = null;
24
+ });
25
+ }
26
+ return this.promise;
27
+ },
28
+
29
+ isValid(uiElement) {
30
+ return this.get().then((data) => {
31
+ return !!data.find((i) => i.UI_ELEMENT_CD === uiElement);
32
+ });
33
+ },
34
+
35
+ });
@@ -188,6 +188,7 @@ Ext.define('Coon.nav.editor.menu.NavMenuTreeController', {
188
188
  Coon.util.promisifyCmd('command.DeleteMenuCommand', menu)
189
189
  .then(() => {
190
190
  this.reloadMenu();
191
+ Ext.fireEvent('nav:reload');
191
192
  Ext.Msg.alert('Сообщение', 'Меню успешно удалено');
192
193
  })
193
194
  .catch((error) => {
@@ -96,6 +96,7 @@ Ext.define('Coon.nav.editor.menu.form.NavMenuFormViewController', {
96
96
  .then((menuBean) => {
97
97
  vm.set('menu', menuBean);
98
98
  this.getView().close();
99
+ Ext.fireEvent('nav:reload');
99
100
  })
100
101
  .catch((error) => {
101
102
  Coon.log.debug(error);
@@ -140,11 +140,13 @@ Ext.define('Coon.report.plugin.configPanel.GridEditorPluginConfig', {
140
140
  xtype: 'fieldset',
141
141
  title: 'Конфиг',
142
142
  height: 200,
143
+ flex: 1,
144
+ layout: 'fit',
145
+ scrollable: true,
143
146
  items: [
144
147
  {
145
148
  xtype: 'UiAceEditor',
146
149
  useLinter: true,
147
- scrollable: 'y',
148
150
  name: ns.$mask,
149
151
  value: {},
150
152
  }