ru.coon 2.6.8 → 2.6.9

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.
@@ -0,0 +1,108 @@
1
+ .UiCPVisualEditor {
2
+ .x-grid-cell-inner .x-btn {
3
+ padding: 0;
4
+ }
5
+
6
+ .widget-box {
7
+ border: 2px solid #e0e0e0;
8
+ margin: 10px 20px;
9
+ padding: 7px;
10
+ border-radius: 10px;
11
+ }
12
+
13
+ /*-------------*/
14
+ .borders {
15
+ margin: 0 3px 15px 3px !important;
16
+ box-shadow: 0 1px 6px 0 rgba(86, 112, 163, 0.2);
17
+ }
18
+
19
+ .borders > .x-panel-bodyWrap > .x-panel-body {
20
+ border: 1px solid #e0e0e0 !important;
21
+ border-radius: 0 0 5px 5px;
22
+ margin-top: -1px;
23
+ }
24
+
25
+ .no-header-panel .x-panel-bodyWrap > .x-panel-body {
26
+ border: 1px solid #e0e0e0 !important;
27
+ border-radius: 5px;
28
+ margin-top: 0;
29
+ }
30
+
31
+ .borders .x-panel-header {
32
+ border-radius: 5px 5px 0 0;
33
+ height: auto;
34
+ }
35
+
36
+ .draggable-element {
37
+ width: 100px;
38
+ height: 100px;
39
+ background-color: #e0e0e0;
40
+ }
41
+
42
+
43
+ .btn i {
44
+ color: #FFF;
45
+ font-style: normal;
46
+ }
47
+
48
+
49
+ .icon {
50
+ font-size: 18px;
51
+ display: block;
52
+ text-align: center;
53
+ margin-top: 6px;
54
+ }
55
+
56
+
57
+ .btn {
58
+ &:hover {
59
+ background-color: rgba(61, 103, 128, 1) !important;
60
+ }
61
+
62
+ width: 30px;
63
+ height: 30px;
64
+ background-color: rgba(61, 103, 128, 0.7);
65
+ border-radius: 18px;
66
+ cursor: pointer;
67
+ z-index: 999;
68
+ }
69
+
70
+ .center-btn {
71
+ position: absolute;
72
+ left: 50%;
73
+ top: 50%;
74
+ margin: -12px 0 0 -11px;
75
+ }
76
+
77
+ .right-top-btn {
78
+ position: absolute;
79
+ right: 0;
80
+ top: 0;
81
+ margin: 1px 0 0 0;
82
+ }
83
+
84
+ .hidden-btn {
85
+ display: none !important;
86
+ }
87
+
88
+ .borders-default {
89
+ border: 1px solid black;
90
+ }
91
+
92
+ .hover-item {
93
+ border: 1px solid red;
94
+ }
95
+
96
+ .tree-container .x-panel-body{
97
+ background-color: #f0f0f0;
98
+ }
99
+ }
100
+
101
+ .menu-tip .x-tool-close {
102
+ background-color: #111111 !important;
103
+ }
104
+
105
+ .svg-icon-tool {
106
+ background-color: white !important;
107
+ }
108
+
@@ -0,0 +1,303 @@
1
+ Ext.define('Coon.uielement.component.UiCPVisualEditorConfigWindow', {
2
+ extend: 'Ext.window.Window',
3
+ cls: 'UiCPVisualEditorConfigWindow',
4
+ alias: 'widget.UiCPVisualEditorConfigWindow',
5
+ xtype: 'UiCPVisualEditorConfigWindow',
6
+ title: 'Настройки компонента',
7
+ width: 500,
8
+ height: '80%',
9
+ layout: 'fit',
10
+ closeAction: 'destroy',
11
+ requires: [
12
+ 'Coon.uielement.component.settings.UiAceEditor'
13
+ ],
14
+ controller: {
15
+ parentCfgLocalState: {},
16
+
17
+ init: function(view) {
18
+ this.initParentCfgLocalState();
19
+ this.loadGrid();
20
+ },
21
+ initParentCfgLocalState: function() {
22
+ const view = this.getView();
23
+ view.parentPanel.successUserEditingOptions.map((option) => {
24
+ const valueObj = this.getOptionValue(option);
25
+ const value = Object.keys(valueObj).length ? valueObj[Object.keys(valueObj)[0]] : null;
26
+ if (value !== null && typeof value === 'object') {
27
+ if (typeof this.parentCfgLocalState[Object.keys(valueObj)[0]] !== 'object') {
28
+ this.parentCfgLocalState[Object.keys(valueObj)[0]] = {};
29
+ }
30
+ Ext.apply(this.parentCfgLocalState[Object.keys(valueObj)[0]], value);
31
+ } else {
32
+ if (value !== '' && value !== null && typeof value !== 'undefined') {
33
+ Ext.apply(this.parentCfgLocalState, valueObj);
34
+ }
35
+ }
36
+ });
37
+ Ext.applyIf(this.parentCfgLocalState, view.parentPanel.cmpParams);
38
+ delete this.parentCfgLocalState['dataId'];
39
+ },
40
+ loadGrid: function() {
41
+ const view = this.getView();
42
+ view.down('grid').getStore().loadData(view.parentPanel.successUserEditingOptions.map((option) => {
43
+ return Ext.apply({
44
+ 'id': option.name,
45
+ 'group': option.group || '',
46
+ 'description': option.description,
47
+ 'type': option.type,
48
+ 'options': this.getOptions(option),
49
+ }, this.getOptionValue(option, true));
50
+ }));
51
+ },
52
+ findDefaultOptionName: function(group) {
53
+ if (!group) {
54
+ return '';
55
+ }
56
+ const defaultOption = this.getView().parentPanel.successUserEditingOptions.find((item) => {
57
+ if (item.group === 'group' && item.defaultOption === true) {
58
+ return item;
59
+ }
60
+ });
61
+ return defaultOption ? defaultOption.name : false;
62
+ },
63
+ getOptionValue: function(option, local) {
64
+ const objCfg = local ? this.parentCfgLocalState : this.getView().parentPanel;
65
+ const returnVariable = local ? 'value' : option.name;
66
+ const returningObj = {};
67
+ let value = null;
68
+ let isGroupOption = false;
69
+ if (typeof option.group !== 'undefined' && option.group) {
70
+ isGroupOption = true;
71
+ if (typeof objCfg[option.group] === 'undefined') {
72
+ return {};
73
+ }
74
+ if (typeof objCfg[option.group][option.name] !== 'undefined') {
75
+ value = objCfg[option.group][option.name];
76
+ } else {
77
+ if (option.name === this.findDefaultOptionName(option.group)) {
78
+ value = objCfg[option.group];
79
+ } else {
80
+ return {};
81
+ }
82
+ }
83
+ } else {
84
+ if (typeof objCfg[option.name] === 'undefined') {
85
+ return {};
86
+ }
87
+ value = objCfg[option.name];
88
+ }
89
+ switch (option.type) {
90
+ case 'int':
91
+ case 'integer':
92
+ returningObj[returnVariable] = Math.round(value) || null;
93
+ break;
94
+ case 'number':
95
+ case 'float':
96
+ returningObj[returnVariable] = Number(value) || null;
97
+ break;
98
+ case 'combo':
99
+ returningObj[returnVariable] = value || null;
100
+ break;
101
+ default:
102
+ returningObj[returnVariable] = value;
103
+ }
104
+ if (isGroupOption && !local) {
105
+ const tmpObj = {};
106
+ tmpObj[option.group] = returningObj;
107
+ return tmpObj;
108
+ }
109
+ return returningObj;
110
+ },
111
+ getOptions: function(option) {
112
+ if (option.type === 'bool') {
113
+ return ['true', 'false'];
114
+ }
115
+ if (option.options && option.options.length) {
116
+ return option.options;
117
+ }
118
+ return [];
119
+ },
120
+ onClose: function() {
121
+ this.getView().close();
122
+ },
123
+ applyGridChanges: function() {
124
+ this.getView().down('grid').getStore().getModifiedRecords().map((record) => {
125
+ const value = record.get('value');
126
+ const key = record.get('id');
127
+ const group = record.get('group');
128
+ if (value === null || value === '' || typeof value === 'undefined') {
129
+ if (group) {
130
+ if (typeof this.parentCfgLocalState[group][key] !== 'undefined') {
131
+ delete this.parentCfgLocalState[group][key];
132
+ }
133
+ } else {
134
+ if (typeof this.parentCfgLocalState[key] !== 'undefined') {
135
+ delete this.parentCfgLocalState[key];
136
+ }
137
+ }
138
+ } else {
139
+ if (group) {
140
+ this.parentCfgLocalState[group][key] = value;
141
+ } else {
142
+ this.parentCfgLocalState[key] = value;
143
+ }
144
+ }
145
+ });
146
+ },
147
+ applyEditorChanges: function() {
148
+ const aceEditor = this.getView().down('UiAceEditor');
149
+ const value = aceEditor.getValue();
150
+ if (aceEditor.hasErrors()) {
151
+ Ext.Msg.alert('Ошибка', 'В редакторе присутствуют ошибки.');
152
+ return false;
153
+ }
154
+ if (!this.valueIsValidJson(value)) {
155
+ Ext.Msg.alert('Ошибка', 'Не корректный JSON объект');
156
+ return false;
157
+ }
158
+ this.parentCfgLocalState = this.getValueJson(value);
159
+ return true;
160
+ },
161
+ getValueJson: function(str) {
162
+ try {
163
+ return JSON5.parse(str);
164
+ } catch (e) {
165
+ return str;
166
+ }
167
+ },
168
+ valueIsValidJson: function(str) {
169
+ try {
170
+ return JSON5.parse(str);
171
+ } catch (e) {
172
+ return false;
173
+ }
174
+ },
175
+ onApply: function() {
176
+ const view = this.getView();
177
+ const tab = this.getView().down('tabpanel').getActiveTab();
178
+ if (tab.xtype === 'UiAceEditor') {
179
+ if (!this.applyEditorChanges()) {
180
+ return false;
181
+ }
182
+ } else {
183
+ this.applyGridChanges();
184
+ }
185
+ view.parentPanel.cmpParams = {'dataId': view.parentPanel.cmpParams['dataId']};
186
+ Ext.apply(view.parentPanel.cmpParams, this.parentCfgLocalState);
187
+ view.parentController.reloadView();
188
+ view.close();
189
+ },
190
+ onBeforeTabChange: function(tabPanel, newCard, oldCard, eOpts) {
191
+ if (newCard.xtype !== 'UiAceEditor') {
192
+ const aceEditor = tabPanel.down('UiAceEditor');
193
+ const value = aceEditor.getValue();
194
+ if (aceEditor.hasErrors()) {
195
+ Ext.Msg.alert('Ошибка', 'В редакторе присутствуют ошибки.');
196
+ return false;
197
+ }
198
+ if (!this.valueIsValidJson(value)) {
199
+ Ext.Msg.alert('Ошибка', 'Не корректный JSON объект');
200
+ return false;
201
+ }
202
+ }
203
+ },
204
+ onTabChange: function(panel, tab) {
205
+ if (tab.xtype === 'UiAceEditor') {
206
+ this.applyGridChanges();
207
+ tab.setValue(JSON.stringify(this.parentCfgLocalState, null, 2));
208
+ } else {
209
+ this.applyEditorChanges();
210
+ this.loadGrid();
211
+ }
212
+ },
213
+ },
214
+ items: [
215
+ {
216
+ xtype: 'tabpanel',
217
+ listeners: {
218
+ 'tabchange': 'onTabChange',
219
+ 'beforetabchange': 'onBeforeTabChange',
220
+ },
221
+ items: [
222
+ {
223
+ xtype: 'grid',
224
+ title: 'Таблица',
225
+ store: {
226
+ fields: ['id', 'description', 'type', 'options', 'value', 'group'],
227
+ groupField: 'group',
228
+ data: [],
229
+ },
230
+ features: [{ftype: 'grouping', groupHeaderTpl: '{name}', collapsible: false}],
231
+ columns: [
232
+ {dataIndex: 'description', text: 'Наименование', flex: 1, filter: {type: 'string'}},
233
+ {
234
+ dataIndex: 'value', text: 'Значение', flex: 1, getEditor: function(record) {
235
+ switch (record.get('type')) {
236
+ case 'bool':
237
+ case 'boolean':
238
+ return Ext.create('Ext.grid.CellEditor', {
239
+ field: Ext.create('Ext.form.field.ComboBox', {
240
+ forceSelection: true,
241
+ store: [[true, 'true'], [false, 'false']],
242
+ }),
243
+ });
244
+ break;
245
+ case 'int':
246
+ case 'integer':
247
+ return Ext.create('Ext.grid.CellEditor', {
248
+ field: Ext.create('Ext.form.field.Number', {
249
+ allowDecimals: false,
250
+ minValue: 0,
251
+ }),
252
+ });
253
+ break;
254
+ case 'number':
255
+ case 'float':
256
+ return Ext.create('Ext.grid.CellEditor', {
257
+ field: Ext.create('Ext.form.field.Number', {
258
+ allowDecimals: true,
259
+ minValue: 0,
260
+ }),
261
+ });
262
+ break;
263
+ case 'text':
264
+ case 'string':
265
+ return Ext.create('Ext.grid.CellEditor', {
266
+ field: Ext.create('Ext.form.field.Text', {}),
267
+ });
268
+ break;
269
+ case 'combo':
270
+ return Ext.create('Ext.grid.CellEditor', {
271
+ field: Ext.create('Ext.form.field.ComboBox', {
272
+ forceSelection: true,
273
+ store: record.get('options').map((option) => {
274
+ return [option, option];
275
+ }),
276
+ }),
277
+ });
278
+ break;
279
+ }
280
+ },
281
+ }
282
+ ],
283
+ plugins: {
284
+ cellediting: {
285
+ clicksToEdit: 2,
286
+ },
287
+ },
288
+ },
289
+ {
290
+ xtype: 'UiAceEditor',
291
+ flex: true,
292
+ scrollable: 'y',
293
+ title: 'PRO',
294
+ }
295
+ ],
296
+ }
297
+
298
+ ],
299
+ buttons: [
300
+ {text: 'Применить', handler: 'onApply'},
301
+ {text: 'Отмена', handler: 'onClose'}
302
+ ],
303
+ });
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.6.8',
3
+ number: '2.6.9',
4
4
  });
@@ -1,7 +0,0 @@
1
- **спецификация:**
2
-
3
- входные параметры:
4
-
5
- - exportFileFormat [xls/pdf]
6
- - allowUserSelectColumnsToUpload
7
- - addToSearchButton добавить в кнопку "поиск", в этом случае в качестве параметра отправляем текущие параметры из FilterPanel(useRawFilterParams: true)