ru.coon 2.7.3 → 2.7.4

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.
@@ -18,15 +18,14 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfig', {
18
18
  ],
19
19
  },
20
20
  },
21
-
22
21
  getDefaults() {
23
22
  return {
24
- selectBckColor: '#C0C0C0',
23
+ selectBckColor: 'rgba(192,192,192,1)',
25
24
  hoverBorderWidth: 1,
26
- hoverBorderColor: '#CBCBCB',
25
+ hoverBorderColor: 'rgba(203,203,203,1)',
27
26
  hoverTextShadow: true,
28
27
  hoverStyleEnable: true,
29
- hoverBackColor: false,
28
+ hoverBackColor: null,
30
29
  };
31
30
  },
32
31
 
@@ -40,12 +39,17 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfig', {
40
39
  },
41
40
  };
42
41
  },
43
-
42
+ onReadyChooseColorField(cmp) {
43
+ const props = cmp.up('ReportFormEditPanel').getViewModel().get('report.properties');
44
+ cmp.setHidden(!props.find((p) => p.key === 'isTree'));
45
+ },
44
46
  createItems: function() {
45
47
  this.grid = Ext.create('Coon.report.plugin.configPanel.GridRowStylePluginConfigPropertyGrid', {
46
48
  flex: 1,
47
49
  collapsible: true,
48
50
  titleCollapse: true,
51
+ maxHeight: 300,
52
+ title: 'Зависимости стилей от значения',
49
53
  });
50
54
 
51
55
  const fieldColumns = this.createFieldColumns({
@@ -92,48 +96,86 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfig', {
92
96
  }, this, {single: true});
93
97
 
94
98
  return [
95
- {
96
- layout: 'form',
97
- labelWidth: 90,
98
- items: [fieldColumns],
99
- },
100
99
  {
101
100
  xtype: 'panel',
102
- collapsible: true,
103
- titleCollapse: true,
104
- title: 'Стилизация статусов',
105
- bodyPadding: 8,
106
- layout: {
107
- type: 'vbox',
108
- align: 'stretch',
101
+ flex: 1,
102
+ layout: 'anchor',
103
+ defaults: {
104
+ anchor: '100%',
109
105
  },
110
- defaults: {margin: 8, flex: 1},
106
+ scrollable: 'y',
111
107
  items: [
112
108
  {
113
- xtype: 'withdefault',
114
- field: {
115
- xtype: 'colorfield',
116
- name: 'selectBckColor',
117
- format: 'rgba',
118
- labelAlign: 'top',
119
- fieldLabel: 'цвет фона выбранных строк',
109
+ xtype: 'fieldset',
110
+ checkboxToggle: true,
111
+ checked: true,
112
+ title: 'Стили строки в зависимости от поля и его значений',
113
+ layout: 'anchor',
114
+ defaults: {
115
+ anchor: '100%',
120
116
  },
121
- defaultValue: this.getDefaults().selectBckColor,
117
+ items: [
118
+ {
119
+ layout: 'form',
120
+ labelWidth: 90,
121
+ items: [fieldColumns],
122
+ },
123
+ this.grid
124
+ ],
125
+ },
126
+ {
127
+ xtype: 'container',
128
+ layout: {
129
+ type: 'hbox',
130
+ align: 'stretch',
131
+ },
132
+ margin: '10px 0 10px 10px',
133
+ items: [
134
+ {
135
+ xtype: 'withdefault',
136
+ flex: 1,
137
+
138
+ field: {
139
+ xtype: 'ChooseColorField',
140
+ hideClearTrigger: true,
141
+ flex: 1,
142
+ name: 'selectBckColor',
143
+ fieldLabel: 'Цвет фона выбранных строк',
144
+ },
145
+ defaultValue: this.getDefaults().selectBckColor,
146
+ },
147
+ {
148
+ xtype: 'ChooseColorField',
149
+ gradient: true,
150
+ // hidden: true,
151
+ flex: 1,
152
+ reference: 'treeNodesColors',
153
+ listeners: {
154
+ 'render': this.onReadyChooseColorField,
155
+ },
156
+ name: 'treeNodesColors',
157
+ fieldLabel: 'Цвета раскрытых узлов дерева',
158
+ }
159
+ ],
122
160
  },
161
+
123
162
  {
124
163
  xtype: 'fieldset',
125
164
  checkboxToggle: true,
126
165
  checkbox: {name: 'hoverStyleEnable'},
127
- title: 'стиль строки при наведении курсора мыши',
128
- layout: 'vbox',
166
+ title: 'Стили строки при наведении курсора мыши',
167
+ layout: {
168
+ type: 'vbox',
169
+ align: 'stretch',
170
+ },
171
+ defaults: {flex: 1},
129
172
  items: [
130
173
  {
131
174
  xtype: 'withdefault',
132
175
  field: {
133
- xtype: 'colorfield',
176
+ xtype: 'ChooseColorField',
177
+ flex: 1,
134
178
  name: 'hoverBackColor',
135
- format: 'rgba',
136
- labelAlign: 'top',
137
179
  fieldLabel: 'цвет фона',
138
180
  },
139
181
  defaultValue: this.getDefaults().hoverBackColor,
@@ -150,12 +192,13 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfig', {
150
192
  type: 'hbox',
151
193
  align: 'stretch',
152
194
  },
153
- defaults: {margin: '4 8', labelAlign: 'top'},
195
+ defaults: {margin: '4 8', labelAlign: 'top', flex: 1},
154
196
  items: [
155
197
  {
156
198
  xtype: 'withdefault',
157
199
  field: {
158
200
  xtype: 'numberfield',
201
+ flex: 1,
159
202
  name: 'hoverBorderWidth',
160
203
  minValue: 0,
161
204
  maxValue: 4,
@@ -167,10 +210,10 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfig', {
167
210
  {
168
211
  xtype: 'withdefault',
169
212
  field: {
170
- xtype: 'colorfield',
213
+ xtype: 'ChooseColorField',
214
+ flex: 1,
171
215
  name: 'hoverBorderColor',
172
- hideTrigger: true,
173
- format: 'rgba',
216
+ hideClearTrigger: true,
174
217
  fieldLabel: 'цвет рамки',
175
218
  },
176
219
  defaultValue: this.getDefaults().hoverBorderColor,
@@ -178,70 +221,63 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfig', {
178
221
  ],
179
222
  }
180
223
  ],
181
- }
182
- ],
183
- },
184
-
185
- this.grid,
186
-
187
- {
188
- xtype: 'grid',
189
- collapsible: true,
190
- titleCollapse: true,
191
- plugins: [
192
- {
193
- ptype: 'cellediting',
194
- clicksToEdit: 1,
195
- }
196
- ],
197
- title: 'Стилизация колонок',
198
- columns: [
199
- {
200
- header: 'Поле',
201
- dataIndex: 'columnName',
202
- editor: false,
203
- flex: 3,
204
- renderer(value, meta) {
205
- const {record} = meta;
206
- meta.tdStyle = pluginClass.getStyleString(record.getData());
207
- return value;
208
- },
209
224
  },
210
225
  {
211
- header: 'Цвет текста',
212
- dataIndex: 'txt',
213
- editor: {
214
- xtype: 'colorfield',
215
- allowBlank: true,
216
- triggers: {
217
- clear: this.getColorFieldClearTrigger(),
218
- picker: {
219
- hidden: true,
220
- },
221
- },
222
- format: 'rgba',
223
- },
224
- flex: 1,
225
- },
226
- {
227
- header: 'Цвет фона',
228
- dataIndex: 'bg',
229
- editor: {
230
- xtype: 'colorfield',
231
- allowBlank: true,
232
- triggers: {
233
- clear: this.getColorFieldClearTrigger(),
234
- picker: {
235
- hidden: true,
236
- },
237
- },
238
- format: 'rgba',
226
+ xtype: 'fieldset',
227
+ checkboxToggle: true,
228
+ checked: true,
229
+ title: 'Стили колонок',
230
+ layout: 'anchor',
231
+ defaults: {
232
+ anchor: '100%',
239
233
  },
240
- flex: 1,
234
+ items: [
235
+ {
236
+ xtype: 'grid',
237
+ maxHeight: 400,
238
+ plugins: [
239
+ {
240
+ ptype: 'cellediting',
241
+ clicksToEdit: 1,
242
+ }
243
+ ],
244
+ columns: [
245
+ {
246
+ header: 'Поле',
247
+ dataIndex: 'columnName',
248
+ editor: false,
249
+ flex: 3,
250
+ renderer(value, meta) {
251
+ const {record} = meta;
252
+ meta.tdStyle = pluginClass.getStyleString(record.getData());
253
+ return value;
254
+ },
255
+ },
256
+ {
257
+ header: 'Цвет текста',
258
+ dataIndex: 'txt',
259
+ editor: {
260
+ xtype: 'ChooseColorField',
261
+ allowBlank: true,
262
+ },
263
+ flex: 1,
264
+ },
265
+ {
266
+ header: 'Цвет фона',
267
+ dataIndex: 'bg',
268
+ editor: {
269
+ xtype: 'ChooseColorField',
270
+ allowBlank: true,
271
+ },
272
+ flex: 1,
273
+ }
274
+ ],
275
+ store: this.columnColorsStore,
276
+ }
277
+ ],
241
278
  }
279
+
242
280
  ],
243
- store: this.columnColorsStore,
244
- flex: 1,
245
281
  }
246
282
  ];
247
283
  },
@@ -15,7 +15,7 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfigPropertyGrid'
15
15
  initComponent: function() {
16
16
  this.plugins = [
17
17
  Ext.create('Coon.report.plugin.grid.CopyRowsFromGrid'),
18
- {ptype: 'cellediting', clicksToEdit: 1}
18
+ {ptype: 'cellediting', clicksToEdit: 2}
19
19
  ];
20
20
 
21
21
  this.dockedItems = [{
@@ -103,35 +103,30 @@ Ext.define('Coon.report.plugin.configPanel.GridRowStylePluginConfigPropertyGrid'
103
103
  });
104
104
 
105
105
  const colorField = {
106
- xtype: 'colorfield',
106
+ xtype: 'ChooseColorField',
107
107
  allowBlank: true,
108
- hideTrigger: true,
109
- bind: '{color}',
110
- format: 'rgba',
111
108
  };
112
109
 
113
110
  const backgroundField = {
114
- xtype: 'colorfield',
111
+ xtype: 'ChooseColorField',
115
112
  allowBlank: true,
116
- hideTrigger: true,
117
- bind: '{bgColor}',
118
- format: 'rgba',
119
113
  };
120
114
 
121
115
  this.columns = {
122
116
  items: [
123
- {header: 'Значение', dataIndex: ns.$value, xtype: 'hintColumn', editor: variableEditor},
124
- {header: 'Цвет', dataIndex: ns.$color, xtype: 'hintColumn', editor: colorField, width: 150},
125
- {header: 'Ссылки в цвет', dataIndex: ns.$linkColor, xtype: 'checkcolumn', editable: true,
126
- tooltip: 'Красит все ссылки строки в цвет текста'},
127
- {header: 'Фон', dataIndex: ns.$background, xtype: 'hintColumn', editor: backgroundField, width: 150},
117
+ {header: 'Значение', flex: 1, dataIndex: ns.$value, xtype: 'hintColumn', editor: variableEditor},
118
+ {header: 'Цвет', flex: 1, dataIndex: ns.$color, xtype: 'hintColumn', editor: colorField},
119
+ {
120
+ header: 'Ссылки в цвет', dataIndex: ns.$linkColor, xtype: 'checkcolumn', editable: true,
121
+ tooltip: 'Красит все ссылки строки в цвет текста',
122
+ },
123
+ {header: 'Фон', flex: 1, dataIndex: ns.$background, xtype: 'hintColumn', editor: backgroundField},
128
124
  {header: 'Жирным', dataIndex: ns.$bold, xtype: 'checkcolumn', editable: true},
129
125
  {header: 'Наклонно', dataIndex: ns.$italic, xtype: 'checkcolumn', editable: true},
130
126
  {header: 'С подчеркиванием', dataIndex: ns.$underline, xtype: 'checkcolumn', editable: true}
131
127
  ],
132
128
  defaults: {
133
129
  sortable: true,
134
- width: 100,
135
130
  },
136
131
  };
137
132
  this.callParent();
@@ -31,7 +31,6 @@ Ext.define('Coon.report.plugin.grid.GridEditorsPlugin', {
31
31
 
32
32
  init: function(grid) {
33
33
  this.grid = grid;
34
- this.grid.getStore().on('load', this.setEditors, this);
35
34
  this.grid.on('afterrender', this.setEditors, this);
36
35
  },
37
36
 
@@ -55,27 +54,34 @@ Ext.define('Coon.report.plugin.grid.GridEditorsPlugin', {
55
54
  }
56
55
  const dependsOnFieldName = editorObj['dependsOnField'] && editorObj['dependsOnFieldName'];
57
56
  const needComboRenderer = editor.isXType('BaseComboBox') && column.useComboRenderer !== false;
58
- const renderFunction = (value, metaData, record) => {
59
- let editable = true;
60
- if (editorObj['dependsOnField'] && editorObj['dependsOnFieldName']) {
61
- const dependsOnFieldName = editorObj['dependsOnFieldName'];
62
- const invertValue = editorObj['invertValue'];
63
- editable = invertValue === !record.get(dependsOnFieldName);
64
- record.allowEditWithEditorPlugin = editable;
65
- if (editorObj['highlightEditableCells']) {
66
- metaData.tdCls = editable ? 'editable-cell' : 'hover-cell';
67
- }
68
- }
69
- if (editor.isXType('BaseComboBox') && column.useComboRenderer !== false) {
70
- Coon.format.comboRenderer(editor, column.renderer && column.renderer.customStyle);
71
- }
72
- hasEditor.on('beforeedit', function(editor, context) {
73
- return context.record.allowEditWithEditorPlugin;
74
- }, this);
75
- return value;
76
- };
77
57
  if (dependsOnFieldName || needComboRenderer) {
78
- column.renderer = renderFunction;
58
+ const customStyle = column.renderer && column.renderer.customStyle;
59
+ column.renderer = (value, metaData, record) => {
60
+ let editable = true;
61
+ if (editorObj['dependsOnField'] && editorObj['dependsOnFieldName']) {
62
+ const dependsOnFieldName = editorObj['dependsOnFieldName'];
63
+ const invertValue = editorObj['invertValue'];
64
+ editable = invertValue === !record.get(dependsOnFieldName);
65
+ record.allowEditWithEditorPlugin = editable;
66
+ if (editorObj['highlightEditableCells']) {
67
+ metaData.tdCls = editable ? 'editable-cell' : 'hover-cell';
68
+ }
69
+ hasEditor.on('beforeedit', function(editor, context) {
70
+ return context.record.allowEditWithEditorPlugin;
71
+ }, this);
72
+ }
73
+ if (typeof customStyle === 'string') {
74
+ metaData.tdStyle = customStyle;
75
+ }
76
+ if (needComboRenderer) {
77
+ editor.store.clearFilter();
78
+ const editorRecord = editor.findRecord(editor.valueField, value);
79
+ return editorRecord ? editorRecord.get(editor.displayField) : editor.valueNotFoundText;
80
+ } else {
81
+ return value;
82
+ }
83
+ };
84
+ column.renderer.customStyle = customStyle;
79
85
  }
80
86
  }
81
87
  }
@@ -28,6 +28,7 @@ Ext.define('Coon.report.plugin.grid.GridRowStylePlugin', {
28
28
  hoverStyleEnable: false,
29
29
  hoverBorderColor: false,
30
30
  hoverBackColor: false,
31
+ treeNodesColors: false,
31
32
  },
32
33
 
33
34
  styleId: 'gridRowStylePluginCSS',
@@ -180,7 +181,87 @@ Ext.define('Coon.report.plugin.grid.GridRowStylePlugin', {
180
181
 
181
182
  classCache: new Map(),
182
183
 
184
+ getTreeFirstLevelElems() {
185
+ return this.grid.getRootNode().childNodes.filter((node) => node.isVisible && node.get('leaf') === false && node.isExpanded());
186
+ },
187
+ getLastLevelElems(node) {
188
+ let nodes = [];
189
+ if (node.get('leaf') === false && node.isExpanded()) {
190
+ if (node.hasChildNodes()) {
191
+ node.childNodes.forEach((item) => {
192
+ const lowLevelElems = this.getLastLevelElems(item);
193
+ if (Ext.isArray(lowLevelElems) && lowLevelElems.length) {
194
+ nodes = nodes.concat(lowLevelElems);
195
+ }
196
+ });
197
+ if (!nodes.length) {
198
+ nodes.push(node);
199
+ }
200
+ }
201
+ }
202
+ return nodes;
203
+ },
204
+ applyStylesOnCollapse(node) {
205
+ if (!node.isRoot()) {
206
+ const el = this.grid.getView().getRow(node);
207
+ el.style.backgroundColor = null;
208
+ }
209
+ },
210
+ getRootColor() {
211
+ return this.treeNodesColors[4];
212
+ },
213
+ getLastExpandedColor() {
214
+ return this.treeNodesColors[6];
215
+ },
216
+ applyStylesOnExpand(node) {
217
+ if (node.parentNode) {
218
+ if (node.parentNode.isRoot()) {
219
+ this.grid.getView().getRow(node).setAttribute('style', `background-color: ${this.getRootColor()};`);
220
+ if (node.hasChildNodes()) {
221
+ node.childNodes.forEach((item) => {
222
+ if (item.get('leaf') === false && item.isExpanded()) {
223
+ this.getLastLevelElems(item).forEach((rec) => {
224
+ this.grid.getView().getRow(rec).setAttribute('style', `background-color: ${this.getLastExpandedColor()};`);
225
+ });
226
+ }
227
+ });
228
+ }
229
+ } else {
230
+ if (node.hasChildNodes()) {
231
+ let hasLast = false;
232
+ node.childNodes.forEach((item) => {
233
+ if (item.get('leaf') === false && item.isExpanded()) {
234
+ this.getLastLevelElems(item).forEach((rec) => {
235
+ hasLast = true;
236
+ this.grid.getView().getRow(rec).setAttribute('style', `background-color: ${this.getLastExpandedColor()};`);
237
+ });
238
+ }
239
+ });
240
+ if (!hasLast) {
241
+ this.grid.getView().getRow(node).setAttribute('style', `background-color: ${this.getLastExpandedColor()};`);
242
+ }
243
+ }
244
+ }
245
+ }
246
+ },
247
+ applyStylesOnRefresh() {
248
+ const firstLevel = this.getTreeFirstLevelElems();
249
+ firstLevel.forEach((node) => {
250
+ this.grid.getView().getRow(node).setAttribute('style', `background-color: ${this.getRootColor()};`);
251
+ if (node.hasChildNodes()) {
252
+ node.childNodes.forEach((item) => {
253
+ if (item.get('leaf') === false && item.isExpanded()) {
254
+ this.getLastLevelElems(item).forEach((rec) => {
255
+ this.grid.getView().getRow(rec).setAttribute('style', `background-color: ${this.getLastExpandedColor()};`);
256
+ });
257
+ }
258
+ });
259
+ }
260
+ });
261
+ },
262
+
183
263
  init: function(grid) {
264
+ this.grid = grid;
184
265
  const uniqCls = this.getConfigValue('gridUniqId').value;
185
266
  if (typeof grid.addCls === 'function') {
186
267
  grid.addCls('gridrowstyleplugin');
@@ -189,6 +270,15 @@ Ext.define('Coon.report.plugin.grid.GridRowStylePlugin', {
189
270
  }
190
271
  grid.addCls('gridrowstyleplugin');
191
272
  }
273
+ if (this.treeNodesColors !== false) {
274
+ const proto = Ext.ClassManager.classes[Ext.ClassManager.aliasToName['widget.'+grid.xtype]].prototype;
275
+ if (proto && proto.xtypesMap && proto.xtypesMap.treepanel === true) {
276
+ grid.on('itemexpand', this.applyStylesOnExpand, this);
277
+ grid.getView().on('refresh', this.applyStylesOnRefresh, this);
278
+ grid.on('itemcollapse', this.applyStylesOnCollapse, this);
279
+ }
280
+ }
281
+
192
282
  if (this.getColumnName() && this.getValueConfig().length) {
193
283
  const rules = this.createRules();
194
284
 
@@ -20,7 +20,7 @@ Ext.define('Coon.uielement.component.formchips.Chip', {
20
20
  removeFilterCallback: undefined,
21
21
  },
22
22
  tpl: new Ext.XTemplate(
23
- '<span class="chip-value">{value}</span>',
23
+ '<span class="chip-value">{rawValue}</span>',
24
24
  '<span class="closebtn">&times;</span>'
25
25
  ),
26
26
 
@@ -31,7 +31,7 @@ Ext.define('Coon.uielement.component.formchips.Chip', {
31
31
 
32
32
  initComponent: function() {
33
33
  if (this.forRemoteSearch && this.data) {
34
- this.originalValue = this.data.value;
34
+ this.originalValue = this.data.rawValue;
35
35
  }
36
36
 
37
37
  this.configureCls();
@@ -72,9 +72,10 @@ Ext.define('Coon.uielement.component.formchips.FilterConditionToolbar', {
72
72
  layout: {
73
73
  type: 'hbox', align: 'stretch',
74
74
  },
75
+ dock: 'bottom',
75
76
  listeners: {
76
77
  beforerender: 'initToolbar',
77
- boxready: 'fillChipsHandler',
78
+ boxready: 'onReloadChipsHandler',
78
79
  show: 'fadeInHandler',
79
80
  },
80
81