ru.coon 3.0.67 → 3.0.69
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.
- package/.husky/pre-commit +0 -0
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/common/AbstractPlugin.js +17 -0
- package/src/common/component/editor/CharacteristicGridEditor.js +7 -2
- package/src/common/component/editor/TypedCharacteristicEditor.js +6 -2
- package/src/common/field/FieldsHelper.js +0 -0
- package/src/common/panel/WindowWrap.js +0 -0
- package/src/report/component/ReportPanel.js +5 -0
- package/src/report/component/reportpanel/ReportGrid.js +5 -0
- package/src/report/component/reportpanel/ReportGrid.scss +5 -0
- package/src/report/component/settings/property/PropertyDescriptionPanel.js +12 -0
- package/src/report/component/settings/property/PropertyDescriptionPanel.scss +38 -0
- package/src/report/component/settings/property/PropertySelectPanel.js +15 -14
- package/src/report/component/settings/property/ReportPropertiesPanel.js +64 -32
- package/src/report/component/settings/property/ReportPropertiesPanel.scss +1 -22
- package/src/report/component/settings/property/ReportPropertyDictionary.js +96 -65
- package/src/report/component/settings/property/ReportPropertyForm.js +2 -10
- package/src/report/util.js +27 -27
- package/src/util.js +7 -9
- package/src/validator.js +33 -22
- package/src/version.js +1 -1
package/.husky/pre-commit
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# Version 3.0.69, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/01e9715d7b9ff10d4898cdf49adc51e10f59ab9b)
|
|
2
|
+
* HT-14867 feat: Черезполосная расцветка строк репорта. Исправление работы со свойствами репорта. ([d91a8e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d91a8ef5f74369009e220fee35e12b485cb27cbb))
|
|
3
|
+
* update: CHANGELOG.md ([62d169], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/62d1691d0a2292271bd17353bae0e5eb3fd1ad11))
|
|
4
|
+
|
|
5
|
+
# Version 3.0.68, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4c8a28a5fc4878ff7e670c77d3bc794069ab7d2d)
|
|
6
|
+
* HT-14811: исправление редактирования характеристик FKV ([b5c035], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b5c0356d657071ecc5353a39be973d5b592f7648))
|
|
7
|
+
* update: CHANGELOG.md ([87a10f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/87a10faa1d038191be9cec97076df7bcea165105))
|
|
8
|
+
|
|
1
9
|
# Version 3.0.67, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d850ee12048246ba85557eef4475595043fc9d00)
|
|
2
10
|
* HT-14811: исправление открытия редактора для характеристик FKV ([becf94], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/becf94689878553b8c8287c6260ca986a314b08e))
|
|
3
11
|
* update: CHANGELOG.md ([ef54a3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ef54a339c72c36ce13a27672dff3cf89e35ddded))
|
|
@@ -38,6 +46,12 @@
|
|
|
38
46
|
|
|
39
47
|
* HT-13993 добавлена боковая панель фильтров для репортов ([e2d5c7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e2d5c7436900d232cd48c9389a685affbacf721a))
|
|
40
48
|
* HT-14628 открытие компонента внутри репорта - закрытие через крестик ([fc4f4e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/fc4f4e9112a3ba1a85cb4a064d65d7a7cfb8cec1))
|
|
49
|
+
* update: CHANGELOG.md ([2ab856], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2ab8566fb3c7400e91d3706a5bd8383d48060556))
|
|
50
|
+
|
|
51
|
+
# Version 3.0.60, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b3ba3aeb89954b8e1650cb40e052a4509b4809fb)
|
|
52
|
+
* ## Fixes
|
|
53
|
+
* <span style='color:red'>fix validator, util.getByPath</span> ([608e70], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/608e7096603a0ed31656b0f45686bab7a4ee302b))
|
|
54
|
+
|
|
41
55
|
* update: CHANGELOG.md ([e42a2a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e42a2a6fb8b511ba174ab5060fc84c683a046945))
|
|
42
56
|
|
|
43
57
|
# Version 3.0.59, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/065a134b1f6c6211d56ef758b127778d5e104faa)
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Ext.define('Coon.common.AbstractPlugin', {
|
|
2
|
+
extend: 'Ext.AbstractPlugin',
|
|
3
|
+
|
|
4
|
+
constructor(config) {
|
|
5
|
+
Ext.apply(this, config || {});
|
|
6
|
+
|
|
7
|
+
if (Array.isArray(this.validConfig)) {
|
|
8
|
+
const state = Coon.validator.isObjectValid(this.pluginConfig.properties, this.validConfig);
|
|
9
|
+
if (!state.valid) {
|
|
10
|
+
console.error(`Invalid configuration for plugin ${this.pluginConfig.name}:\n${state.errors}`);
|
|
11
|
+
}
|
|
12
|
+
this.pluginConfig.validity = state;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
this.callParent([config]);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -245,9 +245,14 @@ Ext.define('Coon.common.component.editor.CharacteristicGridEditor', {
|
|
|
245
245
|
}
|
|
246
246
|
return Coon.format.withHint(visibleValue, visibleValue || tooltip);
|
|
247
247
|
},
|
|
248
|
+
|
|
248
249
|
getEditor: function(record) {
|
|
249
|
-
if (
|
|
250
|
-
|
|
250
|
+
if (record.get('entity') === 'FKV') {
|
|
251
|
+
const mask = record.get('mask');
|
|
252
|
+
const maskText = mask.match(/link:"(.*?)"/);
|
|
253
|
+
if (maskText) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
251
256
|
}
|
|
252
257
|
return Ext.create('Ext.grid.CellEditor', {
|
|
253
258
|
field: Ext.create('Ext.form.field.Text', {
|
|
@@ -296,8 +296,12 @@ Ext.define('Coon.common.component.editor.TypedCharacteristicEditor', {
|
|
|
296
296
|
|
|
297
297
|
cellclickHandler(cmp, td, cellIndex, record) {
|
|
298
298
|
if (this.isEditableChar(record)) {
|
|
299
|
-
if (
|
|
300
|
-
|
|
299
|
+
if (record.get('entity') === 'FKV') {
|
|
300
|
+
const mask = record.get('mask');
|
|
301
|
+
const maskText = mask.match(/link:"(.*?)"/);
|
|
302
|
+
if (maskText) {
|
|
303
|
+
this.prepareType(record);
|
|
304
|
+
}
|
|
301
305
|
}
|
|
302
306
|
}
|
|
303
307
|
},
|
|
File without changes
|
|
File without changes
|
|
@@ -866,6 +866,11 @@ Ext.define('Coon.report.component.ReportPanel', {
|
|
|
866
866
|
}
|
|
867
867
|
config[prefix + 'type'] = plugin[ns.$uiElement].xtype || plugin[ns.$xtype];
|
|
868
868
|
config[ns.$sortSequence] = plugin[ns.$sortSequence] || null;
|
|
869
|
+
config.pluginConfig = {
|
|
870
|
+
properties: Object.assign({}, config),
|
|
871
|
+
type,
|
|
872
|
+
name: prefix + 'type',
|
|
873
|
+
};
|
|
869
874
|
return config;
|
|
870
875
|
});
|
|
871
876
|
},
|
|
@@ -25,6 +25,10 @@ Ext.define('Coon.report.component.reportpanel.ReportGrid', {
|
|
|
25
25
|
},
|
|
26
26
|
url: '/ReportFormData/get',
|
|
27
27
|
contextMenuItemsAdded: false,
|
|
28
|
+
/**
|
|
29
|
+
* Черезполосная раскраска строк
|
|
30
|
+
*/
|
|
31
|
+
bodyCls: 'enable-striped-rows',
|
|
28
32
|
|
|
29
33
|
initComponent: function() {
|
|
30
34
|
this.store = Ext.create('Coon.report.component.reportpanel.ReportStore', {
|
|
@@ -57,6 +61,7 @@ Ext.define('Coon.report.component.reportpanel.ReportGrid', {
|
|
|
57
61
|
try {
|
|
58
62
|
this.addPlugin(plugin);
|
|
59
63
|
} catch (e) {
|
|
64
|
+
console.error('plugin error', e);
|
|
60
65
|
pluginErrors.push(e.message);
|
|
61
66
|
}
|
|
62
67
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Ext.define('Coon.report.component.settings.property.PropertyDescriptionPanel', {
|
|
2
|
+
extend: 'Ext.panel.Panel',
|
|
3
|
+
xtype: 'PropertyDescriptionPanel',
|
|
4
|
+
cls: 'PropertyDescriptionPanel',
|
|
5
|
+
frame: true,
|
|
6
|
+
bodyStyle: {
|
|
7
|
+
fontSize: '16px',
|
|
8
|
+
lineHeight: '1.2',
|
|
9
|
+
color: 'gray',
|
|
10
|
+
wordBreak: 'break-word',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.PropertyDescriptionPanel {
|
|
2
|
+
padding: 8px;
|
|
3
|
+
.deprecated {
|
|
4
|
+
color: red;
|
|
5
|
+
font-weight: bold;
|
|
6
|
+
font-size: 1.2em;
|
|
7
|
+
padding: 0 4px;
|
|
8
|
+
text-transform: underline;
|
|
9
|
+
text-align: center
|
|
10
|
+
}
|
|
11
|
+
.description {
|
|
12
|
+
color: gray;
|
|
13
|
+
}
|
|
14
|
+
.unknown {
|
|
15
|
+
color: darkolivegreen;
|
|
16
|
+
font-weight: bold;
|
|
17
|
+
font-size: 1.2em;
|
|
18
|
+
padding: 0 4px;
|
|
19
|
+
text-align: center
|
|
20
|
+
}
|
|
21
|
+
.exclude {
|
|
22
|
+
padding-top: 10px;
|
|
23
|
+
.exclude-prop-key {
|
|
24
|
+
font-weight: bold;
|
|
25
|
+
}
|
|
26
|
+
.exclude-onval {
|
|
27
|
+
font-style: italic;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.description-default-value {
|
|
32
|
+
padding-top: 8px;
|
|
33
|
+
.default-value {
|
|
34
|
+
font-style: italic;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -2,14 +2,16 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
2
2
|
extend: 'Ext.panel.Panel',
|
|
3
3
|
xtype: 'PropertySelectPanel',
|
|
4
4
|
uses: [],
|
|
5
|
-
requires: [
|
|
5
|
+
requires: [
|
|
6
|
+
'Coon.report.component.settings.property.PropertyDescriptionPanel'
|
|
7
|
+
],
|
|
6
8
|
referenceHolder: true,
|
|
7
9
|
defaultListenerScope: true,
|
|
8
10
|
|
|
9
11
|
viewModel: {
|
|
10
12
|
},
|
|
11
13
|
|
|
12
|
-
width:
|
|
14
|
+
width: 1000,
|
|
13
15
|
height: 500,
|
|
14
16
|
|
|
15
17
|
layout: {
|
|
@@ -19,6 +21,7 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
19
21
|
buttons: [
|
|
20
22
|
{
|
|
21
23
|
text: 'подтвердить',
|
|
24
|
+
ui: 'green-button',
|
|
22
25
|
reference: 'submitBtn',
|
|
23
26
|
handler: 'onSubmit',
|
|
24
27
|
disabled: true,
|
|
@@ -75,9 +78,8 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
75
78
|
},
|
|
76
79
|
items: [
|
|
77
80
|
{
|
|
78
|
-
width: 300,
|
|
79
|
-
frame: 1,
|
|
80
81
|
xtype: 'treepanel',
|
|
82
|
+
width: 400,
|
|
81
83
|
padding: '8 0',
|
|
82
84
|
layout: 'fit',
|
|
83
85
|
reference: 'propertyGrid',
|
|
@@ -95,7 +97,7 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
95
97
|
xtype: 'treecolumn',
|
|
96
98
|
text: 'Свойство',
|
|
97
99
|
dataIndex: 'id',
|
|
98
|
-
|
|
100
|
+
flex: 1,
|
|
99
101
|
menuDisabled: true,
|
|
100
102
|
renderer(val, meta, record) {
|
|
101
103
|
return val ? `${val}`:`${(record.get('children') && record.get('propTag')) || record.get('key') || ''}`;
|
|
@@ -125,11 +127,9 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
125
127
|
},
|
|
126
128
|
},
|
|
127
129
|
{
|
|
128
|
-
xtype: '
|
|
129
|
-
|
|
130
|
-
reference: 'descriptionField',
|
|
130
|
+
xtype: 'PropertyDescriptionPanel',
|
|
131
|
+
reference: 'propDescriptionPanel',
|
|
131
132
|
flex: 1,
|
|
132
|
-
bodyPadding: '16px',
|
|
133
133
|
}
|
|
134
134
|
],
|
|
135
135
|
}
|
|
@@ -147,9 +147,11 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
147
147
|
},
|
|
148
148
|
|
|
149
149
|
onSelectItem(_, record) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
this.lookup('propDescriptionPanel').setHtml(
|
|
151
|
+
record.isLeaf() ?
|
|
152
|
+
Coon.report.component.settings.property.ReportPropertyDictionary.makePropDescription(record.get('key')) :
|
|
153
|
+
''
|
|
154
|
+
);
|
|
153
155
|
},
|
|
154
156
|
|
|
155
157
|
filter: function(_, value) {
|
|
@@ -163,8 +165,7 @@ Ext.define('Coon.report.component.settings.property.PropertySelectPanel', {
|
|
|
163
165
|
if (!record.isLeaf()) {
|
|
164
166
|
return true;
|
|
165
167
|
}
|
|
166
|
-
|
|
167
|
-
return result;
|
|
168
|
+
return record.get('key') && record.get('key').toLowerCase().startsWith(value);
|
|
168
169
|
}, this);
|
|
169
170
|
},
|
|
170
171
|
|
|
@@ -64,26 +64,79 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
|
|
|
64
64
|
|
|
65
65
|
addNewPropRecord(record) {
|
|
66
66
|
if (typeof record === 'string') {
|
|
67
|
-
record = {key: record, value:
|
|
67
|
+
record = {key: record, value: undefined};
|
|
68
68
|
} else {
|
|
69
|
-
record.value = record.
|
|
69
|
+
record.value = record.defaultValue !== null ?
|
|
70
|
+
record.defaultValue : '';
|
|
70
71
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
72
|
+
const grid = this.lookup('reportPropertyGrid');
|
|
73
|
+
const store = grid.getStore();
|
|
74
|
+
const conflictedProperty = this.checkConflict(record);
|
|
75
|
+
if (conflictedProperty) {
|
|
76
|
+
Ext.Msg.alert('!', `Новое свойство ${record.key}, конфликтует со свойством ${conflictedProperty}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (record.singleValue) {
|
|
73
80
|
if (store.getRange().find((el) => el.get('key') === record.key)) {
|
|
74
|
-
Ext.Msg.alert('!', '
|
|
81
|
+
Ext.Msg.alert('!', 'Свойство уже добавлено');
|
|
75
82
|
return;
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
85
|
const idx = Number.parseInt(
|
|
79
86
|
store.max('sequenceNumber')
|
|
80
87
|
);
|
|
81
|
-
store.add({
|
|
88
|
+
const newRecord = store.add({
|
|
82
89
|
key: record.key,
|
|
83
90
|
value: record.value,
|
|
84
91
|
sequenceNumber: idx + 1,
|
|
85
92
|
isNew: true,
|
|
86
93
|
});
|
|
94
|
+
|
|
95
|
+
if (Ext.isDefined(record.value)) {
|
|
96
|
+
this.syncProperties();
|
|
97
|
+
store.on('refresh', () => {
|
|
98
|
+
const newRecord = store.findRecord('key', record.key);
|
|
99
|
+
newRecord && grid.getSelectionModel().select(newRecord);
|
|
100
|
+
}, this, {single: true});
|
|
101
|
+
} else {
|
|
102
|
+
grid.getSelectionModel().select(newRecord);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param {Object} newProperty - новое свойство. Объект key: value
|
|
108
|
+
* @returns {boolean}
|
|
109
|
+
*/
|
|
110
|
+
checkConflict(newProperty) {
|
|
111
|
+
const propertyConfig = this.getPropertyDict(newProperty.key);
|
|
112
|
+
if (!propertyConfig) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
const convert = (value) => {
|
|
116
|
+
if (Ext.isString(value) && Coon.format.isBoolean(value)) {
|
|
117
|
+
return value === 'true';
|
|
118
|
+
}
|
|
119
|
+
return value;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const store = this.lookup('reportPropertyGrid').getStore();
|
|
123
|
+
if (propertyConfig.exclude) {
|
|
124
|
+
for (const [key, value] of Object.entries(propertyConfig.exclude)) {
|
|
125
|
+
const found = store.findRecord('key', key);
|
|
126
|
+
if (found && convert(found.get('value')) === convert(value.onVal.toString())) {
|
|
127
|
+
return key;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const propertyMap = Coon.report.component.settings.property.ReportPropertyDictionary.getPropertyMap();
|
|
133
|
+
for (const [key, value] of propertyMap.entries()) {
|
|
134
|
+
const isExcluded = Ext.isObject(value.exclude) && convert(value.exclude[newProperty.key]?.onVal) === convert(newProperty.value);
|
|
135
|
+
if (isExcluded && store.findRecord('key', key)) {
|
|
136
|
+
return key;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
87
140
|
},
|
|
88
141
|
|
|
89
142
|
onAddProperty(btn) {
|
|
@@ -106,7 +159,6 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
|
|
|
106
159
|
}
|
|
107
160
|
],
|
|
108
161
|
});
|
|
109
|
-
return;
|
|
110
162
|
} else {
|
|
111
163
|
const win = Ext.widget('WindowWrap', {
|
|
112
164
|
width: 400,
|
|
@@ -136,7 +188,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
|
|
|
136
188
|
}
|
|
137
189
|
},
|
|
138
190
|
|
|
139
|
-
onRemoveProp(
|
|
191
|
+
onRemoveProp() {
|
|
140
192
|
const record = this.lookup('reportPropertyGrid').getSelection()[0];
|
|
141
193
|
const isDeleted = !record.get('isDeleted');
|
|
142
194
|
record.set('isDeleted', isDeleted);
|
|
@@ -151,31 +203,15 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
|
|
|
151
203
|
this.publishState('data', this.getData());
|
|
152
204
|
},
|
|
153
205
|
|
|
154
|
-
makePropDescription(key) {
|
|
155
|
-
const dict = this.getPropertyDict(key);
|
|
156
|
-
let description;
|
|
157
|
-
if (dict) {
|
|
158
|
-
description = dict.description;
|
|
159
|
-
if (dict.deprecated) {
|
|
160
|
-
description =
|
|
161
|
-
`<div class="deprecated">
|
|
162
|
-
использование свойства не рекомендуется
|
|
163
|
-
</div>
|
|
164
|
-
<div class="description">${description}</div>`;
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
description = '<div class="unknown">неизвестное свойство</div>';
|
|
168
|
-
}
|
|
169
|
-
return description;
|
|
170
|
-
},
|
|
171
|
-
|
|
172
206
|
onSelectProperty(grid, record) {
|
|
173
207
|
this.lookup('propForm').record = record;
|
|
174
208
|
const field = this.lookup('propForm').down('textarea');
|
|
175
|
-
this.getViewModel().set('locals.originalPropValue', record.get('value'));
|
|
209
|
+
this.getViewModel().set('locals.originalPropValue', record.get('isNew') ? null : record.get('value'));
|
|
176
210
|
field.setValue(record.get('value'));
|
|
177
211
|
this.lookup('propDescriptionPanel')
|
|
178
|
-
.setHtml(
|
|
212
|
+
.setHtml(
|
|
213
|
+
Coon.report.component.settings.property.ReportPropertyDictionary.makePropDescription(record.get('key'))
|
|
214
|
+
);
|
|
179
215
|
},
|
|
180
216
|
|
|
181
217
|
getData() {
|
|
@@ -205,10 +241,6 @@ Ext.define('Coon.report.component.settings.property.ReportPropertiesPanel', {
|
|
|
205
241
|
|
|
206
242
|
setData(data) {
|
|
207
243
|
this.data = (data || []).map(this.getOnlyPropValue, this);
|
|
208
|
-
// this.data.forEach((prop) => {
|
|
209
|
-
// const dict = this.getPropertyDict(prop.key);
|
|
210
|
-
// prop.description = dict && dict.description;
|
|
211
|
-
// });
|
|
212
244
|
if (!this.rendered) {
|
|
213
245
|
this.lookup('reportPropertyGrid').on('render', function() {
|
|
214
246
|
this.lookup('reportPropertyGrid').getStore().loadData(this.data);
|
|
@@ -27,25 +27,4 @@
|
|
|
27
27
|
border-bottom: 1px dotted lightcoral!important;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
padding: 8px;
|
|
32
|
-
.deprecated {
|
|
33
|
-
color: red;
|
|
34
|
-
font-weight: bold;
|
|
35
|
-
font-size: 1.2em;
|
|
36
|
-
padding: 0 4px;
|
|
37
|
-
text-transform: underline;
|
|
38
|
-
text-align: center
|
|
39
|
-
}
|
|
40
|
-
.description {
|
|
41
|
-
color: gray;
|
|
42
|
-
}
|
|
43
|
-
.unknown {
|
|
44
|
-
color: darkolivegreen;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
font-size: 1.2em;
|
|
47
|
-
padding: 0 4px;
|
|
48
|
-
text-align: center
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
30
|
+
}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Справочник свойств отчета.
|
|
3
|
+
* Представлены в виде дерева (schema).
|
|
4
|
+
* Узлы представлены в виде объектов.
|
|
5
|
+
* Если узел дерева - это какая-то категория свойств отчета (для более понятной картины свойства отчета в дереве сгруппированы по папкам), то
|
|
6
|
+
* в узле leaf: false.
|
|
7
|
+
* Описание некоторых свойств узла дерева:
|
|
8
|
+
* {
|
|
9
|
+
* id: 'fixedTitle', // идентификатор свойства
|
|
10
|
+
* defaultValue: true, // значение свойства при добавлении, используемое по умолчанию.
|
|
11
|
+
* description: 'Пусто', // описание свойства для пользователя
|
|
12
|
+
* singleValue: true, // необязательное свойство. По умолчанию имеет значение true. Если false, то свойство можно
|
|
13
|
+
* // завести несколько раз
|
|
14
|
+
* },
|
|
15
|
+
*/
|
|
1
16
|
Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
2
17
|
singleton: true,
|
|
3
18
|
|
|
@@ -11,14 +26,16 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
11
26
|
if (!node.id) {
|
|
12
27
|
throw new Error(' [ERROR]ReportPropertyDictionary: node.id cant be empty');
|
|
13
28
|
}
|
|
14
|
-
node.path = path || 'root';
|
|
15
|
-
node.key = node.id;
|
|
16
|
-
if (node.singleValue) {
|
|
17
|
-
node.value = true;
|
|
18
|
-
}
|
|
19
29
|
if (this.propertyMap.has(node.id)) {
|
|
20
30
|
throw new Error(` [ERROR]ReportPropertyDictionary: node.id [${node.id}] is not unique`);
|
|
21
31
|
}
|
|
32
|
+
node.path = path || 'root';
|
|
33
|
+
node.key = node.id;
|
|
34
|
+
node.singleValue = !Ext.isDefined(node.singleValue) ? true : node.singleValue;
|
|
35
|
+
if (Ext.isDefined(node.defaultValue)) {
|
|
36
|
+
node.value = node.defaultValue;
|
|
37
|
+
}
|
|
38
|
+
node.description = node.leaf && !node.description ? this._notDescribed : node.description;
|
|
22
39
|
this.propertyMap.set(node.id, node);
|
|
23
40
|
if (Array.isArray(node.children) && node.children.length) {
|
|
24
41
|
node.children.forEach((el) => processNode(el, node.path + '.' + node.id));
|
|
@@ -28,26 +45,54 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
28
45
|
return this;
|
|
29
46
|
},
|
|
30
47
|
|
|
31
|
-
getPropById(id) {
|
|
32
|
-
const prop = this.propertyMap.get(id);
|
|
33
|
-
if (prop) {
|
|
34
|
-
prop.name = prop.id;
|
|
35
|
-
prop.leaf = !prop.children;
|
|
36
|
-
return Ext.clone(prop);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
48
|
getPropertyMap() {
|
|
41
49
|
const acc = new Map();
|
|
42
50
|
this.propertyMap.forEach((v, k) => acc.set(k, Object.assign({}, v, {children: false})));
|
|
43
51
|
return acc;
|
|
44
52
|
},
|
|
45
53
|
|
|
46
|
-
|
|
47
54
|
getSchema() {
|
|
48
55
|
return Ext.clone(this.schema);
|
|
49
56
|
},
|
|
50
57
|
|
|
58
|
+
makePropDescription(key) {
|
|
59
|
+
const dict = this.getPropertyMap().get(key);
|
|
60
|
+
let description;
|
|
61
|
+
if (dict) {
|
|
62
|
+
description = dict.description;
|
|
63
|
+
if (dict.deprecated) {
|
|
64
|
+
description =
|
|
65
|
+
`<div class="deprecated">
|
|
66
|
+
использование свойства не рекомендуется
|
|
67
|
+
</div>
|
|
68
|
+
<div class="description">${description}</div>`;
|
|
69
|
+
}
|
|
70
|
+
if (Ext.isObject(dict.exclude)) {
|
|
71
|
+
description += this.getExcludeDescription(dict.exclude);
|
|
72
|
+
}
|
|
73
|
+
if (Ext.isDefined(dict.defaultValue)) {
|
|
74
|
+
description += `<div class="description-default-value">
|
|
75
|
+
Значение по умолчанию: <span class="default-value"> ${dict.defaultValue}</span>
|
|
76
|
+
</div>`;
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
description = '<div class="unknown">неизвестное свойство</div>';
|
|
80
|
+
}
|
|
81
|
+
return description;
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
getExcludeDescription(exclude) {
|
|
85
|
+
let html = '<div class="exclude">Недопустимо при наличии свойств:';
|
|
86
|
+
for (const [key, value] of Object.entries(exclude)) {
|
|
87
|
+
html += `<br>
|
|
88
|
+
<span class="exclude-prop-key">${key}</span> - со значением
|
|
89
|
+
<span class="exclude-onval">${value.onVal}</span>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
html += '</div>';
|
|
93
|
+
return html;
|
|
94
|
+
},
|
|
95
|
+
|
|
51
96
|
schema: [
|
|
52
97
|
{
|
|
53
98
|
id: 'CLIENT',
|
|
@@ -57,30 +102,29 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
57
102
|
id: 'gridProperties',
|
|
58
103
|
leaf: true,
|
|
59
104
|
deprecated: true,
|
|
105
|
+
defaultValue: '{}',
|
|
60
106
|
description: 'свойство позволяет настроить таблицу репорта',
|
|
61
107
|
},
|
|
62
108
|
{
|
|
63
109
|
id: 'isReportEngineUsed',
|
|
64
110
|
leaf: true,
|
|
65
|
-
|
|
66
|
-
description: 'Пусто',
|
|
111
|
+
defaultValue: true,
|
|
67
112
|
},
|
|
68
113
|
{
|
|
69
114
|
id: 'fixedTitle',
|
|
70
115
|
leaf: true,
|
|
71
|
-
|
|
72
|
-
description: 'Пусто',
|
|
116
|
+
defaultValue: true,
|
|
73
117
|
},
|
|
74
118
|
{
|
|
75
119
|
id: 'autoFilter',
|
|
76
120
|
leaf: true,
|
|
77
|
-
|
|
121
|
+
defaultValue: true,
|
|
78
122
|
description: 'Свойство позволяет репорту делать автоматическую фильтрацию значений при загрузке или при изменении фильтров.',
|
|
79
123
|
},
|
|
80
124
|
{
|
|
81
125
|
id: 'hideFilterPanel',
|
|
82
126
|
leaf: true,
|
|
83
|
-
|
|
127
|
+
defaultValue: true,
|
|
84
128
|
description: 'Свойство скрывает всю панель фильтрации у репорта.',
|
|
85
129
|
exclude: {
|
|
86
130
|
hideFilterButtons: {
|
|
@@ -99,7 +143,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
99
143
|
},
|
|
100
144
|
{
|
|
101
145
|
id: 'hideFilterButtons',
|
|
102
|
-
|
|
146
|
+
defaultValue: true,
|
|
103
147
|
description: 'Свойство скрывает кнопки взаимодействия в панели фильтрации.',
|
|
104
148
|
leaf: true,
|
|
105
149
|
exclude: {
|
|
@@ -114,91 +158,87 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
114
158
|
{
|
|
115
159
|
id: 'autoScroll',
|
|
116
160
|
leaf: true,
|
|
117
|
-
|
|
118
|
-
description: 'Пусто',
|
|
161
|
+
defaultValue: true,
|
|
119
162
|
},
|
|
120
163
|
{
|
|
121
164
|
id: 'activeComponent',
|
|
122
165
|
leaf: true,
|
|
123
|
-
|
|
124
|
-
description: 'Пусто',
|
|
166
|
+
defaultValue: null,
|
|
125
167
|
},
|
|
126
168
|
{
|
|
127
169
|
id: 'headerOnGrid',
|
|
128
170
|
leaf: true,
|
|
129
|
-
|
|
171
|
+
defaultValue: true,
|
|
130
172
|
description: 'Устанавливает заголовок репорта над таблицей.',
|
|
131
173
|
},
|
|
132
174
|
{
|
|
133
175
|
id: 'clearButtonConfig',
|
|
134
176
|
leaf: true,
|
|
135
|
-
|
|
177
|
+
defaultValue: '{}',
|
|
136
178
|
description: 'Свойства, передаваемые кнопке очистки в панели фильтрации.',
|
|
137
179
|
},
|
|
138
180
|
{
|
|
139
181
|
id: 'findButtonConfig',
|
|
140
182
|
leaf: true,
|
|
141
|
-
|
|
183
|
+
defaultValue: '{}',
|
|
142
184
|
description: 'Свойства, передаваемые кнопке поиска в панели фильтрации.',
|
|
143
185
|
},
|
|
144
186
|
{
|
|
145
187
|
id: 'enableAutoSize',
|
|
146
188
|
leaf: true,
|
|
147
|
-
|
|
189
|
+
defaultValue: true,
|
|
148
190
|
description: 'Позволяет репорту автоматически рассчитать ширину колонок при загрузке.',
|
|
149
191
|
},
|
|
150
192
|
{
|
|
151
193
|
id: 'enableSummaryFeature',
|
|
152
194
|
leaf: true,
|
|
153
|
-
|
|
195
|
+
defaultValue: true,
|
|
154
196
|
description: 'Свойство позволяет добавить результирующую строку вниз таблицы.',
|
|
155
197
|
},
|
|
156
198
|
{
|
|
157
199
|
id: 'enableGroupingFeature',
|
|
158
200
|
leaf: true,
|
|
159
|
-
|
|
201
|
+
defaultValue: true,
|
|
160
202
|
description: 'Добавляет к таблице возможность группировки полей.',
|
|
161
203
|
},
|
|
162
204
|
{
|
|
163
205
|
id: 'startCollapsed',
|
|
164
206
|
leaf: true,
|
|
165
|
-
|
|
166
|
-
description: 'Пусто',
|
|
207
|
+
defaultValue: true,
|
|
167
208
|
},
|
|
168
209
|
{
|
|
169
210
|
id: 'enableTextSelection',
|
|
170
211
|
leaf: true,
|
|
171
|
-
|
|
212
|
+
defaultValue: true,
|
|
172
213
|
description: 'Параметр задает возможность выделять текст внутри ячеек таблицы.',
|
|
173
214
|
},
|
|
174
215
|
{
|
|
175
216
|
id: 'isTree',
|
|
176
217
|
leaf: true,
|
|
177
|
-
|
|
218
|
+
defaultValue: true,
|
|
178
219
|
description: 'Параметр задает вид репорта в виде дерева.',
|
|
179
220
|
},
|
|
180
221
|
{
|
|
181
222
|
id: 'selectOnlyLeaf',
|
|
182
223
|
leaf: true,
|
|
183
|
-
|
|
224
|
+
defaultValue: true,
|
|
184
225
|
description: 'Параметр задает в дереве выбор/не выбор каталогов в качестве передаваемой записи.',
|
|
185
226
|
},
|
|
186
227
|
{
|
|
187
228
|
id: 'groupSortFunc',
|
|
188
229
|
leaf: true,
|
|
189
|
-
|
|
190
|
-
description: 'Пусто',
|
|
230
|
+
defaultValue: null,
|
|
191
231
|
},
|
|
192
232
|
{
|
|
193
233
|
id: 'toggleFilterPanel',
|
|
194
234
|
leaf: true,
|
|
195
|
-
|
|
235
|
+
defaultValue: true,
|
|
196
236
|
description: 'Свойство даёт возможность скрывать/показывать фильтры панели по кнопке.',
|
|
197
237
|
},
|
|
198
238
|
{
|
|
199
239
|
id: 'enableChipToolbar',
|
|
200
240
|
leaf: true,
|
|
201
|
-
|
|
241
|
+
defaultValue: true,
|
|
202
242
|
description: 'Свойство включает видимость тулбара с чипами. В чипах отображаются критерии поиска. ' +
|
|
203
243
|
'<a href="https://confluence.sigma-it.ru/pages/viewpage.action?pageId=636874446" target="_blank"> ' +
|
|
204
244
|
'Описание <i class="fas fa-external-link-alt"></i></a>',
|
|
@@ -206,13 +246,12 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
206
246
|
{
|
|
207
247
|
id: 'enableHighlightingRequiredFields',
|
|
208
248
|
leaf: true,
|
|
209
|
-
|
|
249
|
+
defaultValue: true,
|
|
210
250
|
description: 'Свойство даёт возможность скрывать/показывать признак обязательности заполнения полей.',
|
|
211
251
|
},
|
|
212
252
|
{
|
|
213
253
|
id: 'filterItemsOnRow',
|
|
214
254
|
leaf: true,
|
|
215
|
-
defaultVal: null,
|
|
216
255
|
description: `Кол-во параметров в 1 строке (по умолчанию равен 4).
|
|
217
256
|
Порядок следования параметров определяется свойством orderSq.</br>
|
|
218
257
|
number
|
|
@@ -221,7 +260,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
221
260
|
{
|
|
222
261
|
id: 'formFieldFocusPluginConfig',
|
|
223
262
|
leaf: true,
|
|
224
|
-
|
|
263
|
+
defaultValue: '{disabled: false, defaultFocusFirstField: true}',
|
|
225
264
|
description: 'Свойства, передаваемые плагину formFieldFocusPlugin, используемому в фильтр панели репорта ',
|
|
226
265
|
propertyValueType: 'object',
|
|
227
266
|
}
|
|
@@ -234,7 +273,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
234
273
|
{
|
|
235
274
|
id: 'REPORT_LOGGER_ENABLE',
|
|
236
275
|
leaf: true,
|
|
237
|
-
|
|
276
|
+
defaultValue: true,
|
|
238
277
|
description: `
|
|
239
278
|
Если свойство принимает значение true,
|
|
240
279
|
то результирующий запрос, построенный при помощи шаблонизатора, будет отражен в Loki-логах. </br>
|
|
@@ -244,7 +283,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
244
283
|
{
|
|
245
284
|
id: 'FETCH_SIZE',
|
|
246
285
|
leaf: true,
|
|
247
|
-
|
|
286
|
+
defaultValue: null,
|
|
248
287
|
description: `
|
|
249
288
|
Количество строк, извлекаемых из базы данных за один раз. </br>
|
|
250
289
|
number`,
|
|
@@ -252,7 +291,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
252
291
|
{
|
|
253
292
|
id: 'REPORT_DATA_MODE',
|
|
254
293
|
leaf: true,
|
|
255
|
-
|
|
294
|
+
defaultValue: null,
|
|
256
295
|
description: `
|
|
257
296
|
Параметр задает режим работы отчета.
|
|
258
297
|
По умолчанию принимает значение SWE.
|
|
@@ -262,8 +301,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
262
301
|
{
|
|
263
302
|
id: 'WITH_CUSTOM_JDBC_CODE',
|
|
264
303
|
leaf: true,
|
|
265
|
-
|
|
266
|
-
defaultVal: null,
|
|
304
|
+
defaultValue: true,
|
|
267
305
|
description: `
|
|
268
306
|
Пусто. </br>
|
|
269
307
|
boolean
|
|
@@ -272,7 +310,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
272
310
|
{
|
|
273
311
|
id: 'timeout',
|
|
274
312
|
leaf: true,
|
|
275
|
-
|
|
313
|
+
defaultValue: null,
|
|
276
314
|
description: `
|
|
277
315
|
Параметр задает время в мсек.
|
|
278
316
|
если запрос к БД работает дольше,
|
|
@@ -283,7 +321,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
283
321
|
{
|
|
284
322
|
id: 'DATA_SOURCE_NAME',
|
|
285
323
|
leaf: true,
|
|
286
|
-
|
|
324
|
+
defaultValue: null,
|
|
287
325
|
description: `
|
|
288
326
|
Источник данных (JDBC URL). </br>
|
|
289
327
|
string
|
|
@@ -296,13 +334,13 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
296
334
|
{
|
|
297
335
|
id: 'ACCESS_CONTEXT_PATH',
|
|
298
336
|
leaf: true,
|
|
299
|
-
|
|
337
|
+
defaultValue: null,
|
|
300
338
|
description: 'Путь до политики',
|
|
301
339
|
},
|
|
302
340
|
{
|
|
303
341
|
id: 'ACCESS_FIELD_NAME',
|
|
304
342
|
leaf: true,
|
|
305
|
-
|
|
343
|
+
defaultValue: null,
|
|
306
344
|
description: 'Поле в репорте, по которому фильтровать строки репорта.',
|
|
307
345
|
propertyValueType: 'combo',
|
|
308
346
|
}
|
|
@@ -311,8 +349,8 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
311
349
|
{
|
|
312
350
|
id: 'TAG',
|
|
313
351
|
leaf: true,
|
|
314
|
-
|
|
315
|
-
|
|
352
|
+
defaultValue: null,
|
|
353
|
+
singleValue: false,
|
|
316
354
|
description: `
|
|
317
355
|
Свойство позволяет добавить еще один параметр поиска отчета в списке отчетов. </br>
|
|
318
356
|
string
|
|
@@ -321,22 +359,16 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
321
359
|
{
|
|
322
360
|
id: 'TEMPLATE',
|
|
323
361
|
leaf: true,
|
|
324
|
-
|
|
362
|
+
defaultValue: null,
|
|
325
363
|
description: `
|
|
326
364
|
Свойство задает использование определенного шаблонизатора (на данный момент используется только FREEMARKER). </br>
|
|
327
365
|
string
|
|
328
366
|
`,
|
|
329
|
-
exclude: {
|
|
330
|
-
REPORT_LOGGER_ENABLE: {
|
|
331
|
-
onVal: '',
|
|
332
|
-
},
|
|
333
|
-
},
|
|
334
367
|
},
|
|
335
368
|
{
|
|
336
369
|
id: 'cached',
|
|
337
370
|
leaf: true,
|
|
338
|
-
|
|
339
|
-
defaultVal: null,
|
|
371
|
+
defaultValue: true,
|
|
340
372
|
description: `
|
|
341
373
|
Включает кэширование репортов. </br>
|
|
342
374
|
boolean
|
|
@@ -345,7 +377,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
345
377
|
{
|
|
346
378
|
id: 'timeToLive',
|
|
347
379
|
leaf: true,
|
|
348
|
-
|
|
380
|
+
defaultValue: null,
|
|
349
381
|
description: `
|
|
350
382
|
Время жизни кэша. </br>
|
|
351
383
|
number (minutes)
|
|
@@ -354,5 +386,4 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyDictionary', {
|
|
|
354
386
|
],
|
|
355
387
|
}
|
|
356
388
|
],
|
|
357
|
-
|
|
358
389
|
});
|
|
@@ -19,18 +19,9 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyForm', {
|
|
|
19
19
|
},
|
|
20
20
|
items: [
|
|
21
21
|
{
|
|
22
|
-
xtype: '
|
|
22
|
+
xtype: 'PropertyDescriptionPanel',
|
|
23
23
|
reference: 'propDescriptionPanel',
|
|
24
|
-
cls: 'propDescriptionPanel',
|
|
25
24
|
flex: 1,
|
|
26
|
-
frame: true,
|
|
27
|
-
bodyStyle: {
|
|
28
|
-
fontSize: '16px',
|
|
29
|
-
padding: '8px',
|
|
30
|
-
lineHeight: '1.2',
|
|
31
|
-
color: 'gray',
|
|
32
|
-
wordBreak: 'break-word',
|
|
33
|
-
},
|
|
34
25
|
},
|
|
35
26
|
{
|
|
36
27
|
xtype: 'textarea',
|
|
@@ -57,6 +48,7 @@ Ext.define('Coon.report.component.settings.property.ReportPropertyForm', {
|
|
|
57
48
|
},
|
|
58
49
|
{
|
|
59
50
|
text: 'подтвердить',
|
|
51
|
+
ui: 'green-button',
|
|
60
52
|
disabled: true,
|
|
61
53
|
itemId: 'submit',
|
|
62
54
|
handler: 'onChangeValue',
|
package/src/report/util.js
CHANGED
|
@@ -10,17 +10,17 @@ Ext.define('Coon.report.util', {
|
|
|
10
10
|
path: 'fields',
|
|
11
11
|
valid: 'array',
|
|
12
12
|
rules: [
|
|
13
|
-
{path: '
|
|
14
|
-
{path: '
|
|
15
|
-
{path: '
|
|
16
|
-
{path: '
|
|
13
|
+
{path: 'description', valid: 'string, required'},
|
|
14
|
+
{path: 'reportFieldCd', valid: 'string, required'},
|
|
15
|
+
{path: 'visibleSwitch', valid: 'boolean'},
|
|
16
|
+
{path: 'reportFieldTypeLookup', valid: 'uppercase, required'},
|
|
17
17
|
{
|
|
18
|
-
path: '
|
|
18
|
+
path: 'properties',
|
|
19
19
|
valid: 'array',
|
|
20
20
|
rules: [
|
|
21
|
-
{path: '
|
|
22
|
-
{path: '
|
|
23
|
-
{path: '
|
|
21
|
+
{path: 'sequenceNumber', valid: 'number'},
|
|
22
|
+
{path: 'key', valid: 'type.string'},
|
|
23
|
+
{path: 'value', valid: '!type.undefined'}
|
|
24
24
|
],
|
|
25
25
|
}
|
|
26
26
|
],
|
|
@@ -29,40 +29,40 @@ Ext.define('Coon.report.util', {
|
|
|
29
29
|
path: 'plugins',
|
|
30
30
|
valid: 'array',
|
|
31
31
|
rules: [
|
|
32
|
-
{path: '
|
|
33
|
-
{path: '
|
|
34
|
-
{path: '
|
|
35
|
-
{path: '
|
|
36
|
-
{path: '
|
|
37
|
-
{path: '
|
|
32
|
+
{path: 'xtype', valid: 'string, required'},
|
|
33
|
+
{path: 'type', valid: 'string, required'},
|
|
34
|
+
{path: 'uiElement', valid: 'string, required'},
|
|
35
|
+
{path: 'jsonProperties', valid: 'string, required'},
|
|
36
|
+
{path: 'sequenceNumber', valid: 'number, required'},
|
|
37
|
+
{path: 'sortSequence', valid: 'number, required'}
|
|
38
38
|
],
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
path: 'properties',
|
|
42
42
|
valid: 'array',
|
|
43
43
|
rules: [
|
|
44
|
-
{path: '
|
|
45
|
-
{path: '
|
|
46
|
-
{path: '
|
|
44
|
+
{path: 'key', valid: 'string, required'},
|
|
45
|
+
{path: 'value', valid: 'string, required'},
|
|
46
|
+
{path: 'sequenceNumber', valid: 'string, required'}
|
|
47
47
|
],
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
path: 'parameters',
|
|
51
51
|
valid: 'array',
|
|
52
52
|
rules: [
|
|
53
|
-
{path: '
|
|
54
|
-
{path: '
|
|
55
|
-
{path: '
|
|
56
|
-
{path: '
|
|
57
|
-
{path: '
|
|
58
|
-
{path: '
|
|
53
|
+
{path: 'requiredSwitch', valid: 'boolean'},
|
|
54
|
+
{path: 'visibleSwitch', valid: 'boolean'},
|
|
55
|
+
{path: 'notUsedInSQLSwitch', valid: 'boolean'},
|
|
56
|
+
{path: 'description', valid: 'string, required'},
|
|
57
|
+
{path: 'reportParameterCd', valid: 'string, required'},
|
|
58
|
+
{path: 'reportParameterTypeLookup', valid: 'string, required, uppercase'},
|
|
59
59
|
{
|
|
60
|
-
path: '
|
|
60
|
+
path: 'properties',
|
|
61
61
|
valid: 'array',
|
|
62
62
|
rules: [
|
|
63
|
-
{path: '
|
|
64
|
-
{path: '
|
|
65
|
-
{path: '
|
|
63
|
+
{path: 'key', valid: 'string, required'},
|
|
64
|
+
{path: 'value', valid: 'string, required'},
|
|
65
|
+
{path: 'sequenceNumber', valid: 'number'}
|
|
66
66
|
],
|
|
67
67
|
}
|
|
68
68
|
],
|
package/src/util.js
CHANGED
|
@@ -73,19 +73,17 @@ Ext.define('Coon.util', {
|
|
|
73
73
|
}
|
|
74
74
|
return path.reduce((acc, pathProp) => {
|
|
75
75
|
if (acc) {
|
|
76
|
+
if (pathProp.startsWith('[') && pathProp.endsWith(']')) {
|
|
77
|
+
pathProp = pathProp.slice(1, -1) || 0;
|
|
78
|
+
if (Number.isInteger(parseInt(pathProp))) {
|
|
79
|
+
acc = acc[parseInt(pathProp)];
|
|
80
|
+
return acc;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
76
83
|
if (Ext.isObject(acc)) {
|
|
77
84
|
acc = acc[pathProp];
|
|
78
85
|
return acc;
|
|
79
86
|
}
|
|
80
|
-
if (Array.isArray(acc)) {
|
|
81
|
-
if (pathProp.startsWith('[') && pathProp.endsWith(']')) {
|
|
82
|
-
pathProp = pathProp.slice(1, -1) || 0;
|
|
83
|
-
if (Number.isInteger(parseInt(pathProp))) {
|
|
84
|
-
acc = acc[parseInt(pathProp)];
|
|
85
|
-
return acc;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
87
|
} else {
|
|
90
88
|
path = [];
|
|
91
89
|
acc = defaultValue;
|
package/src/validator.js
CHANGED
|
@@ -58,6 +58,12 @@ Ext.define('Coon.validator', {
|
|
|
58
58
|
* ]
|
|
59
59
|
*/
|
|
60
60
|
isObjectValid(obj, rules) {
|
|
61
|
+
if (!Ext.isObject(obj)) {
|
|
62
|
+
return {
|
|
63
|
+
valid: false,
|
|
64
|
+
errors: ['object is not valid'],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
61
67
|
const getValid = (valid) => {
|
|
62
68
|
if (typeof valid === 'string') {
|
|
63
69
|
return valid.split(',').map((el) => el.trim());
|
|
@@ -69,42 +75,47 @@ Ext.define('Coon.validator', {
|
|
|
69
75
|
const checkValidity = (validProps, value) => validProps.find((prop) => {
|
|
70
76
|
const [name, ...args] = prop.split('.');
|
|
71
77
|
if (typeof validators[name] === 'function') {
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
);
|
|
78
|
+
return validators[name](value, ...args);
|
|
79
|
+
} else {
|
|
80
|
+
console.error(`validator [${name}] is not exist!`);
|
|
81
|
+
return false;
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
84
|
const validators = this.getValidators();
|
|
78
|
-
const getErrors = (
|
|
85
|
+
const getErrors = (src, rules) => {
|
|
86
|
+
if (Array.isArray(src)) {
|
|
87
|
+
for (const el of src) {
|
|
88
|
+
const state = getErrors(el, rules);
|
|
89
|
+
if (!state.valid) {
|
|
90
|
+
return state;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {valid: true, errors: []};
|
|
94
|
+
}
|
|
79
95
|
const errors = Coon.util.filterMap(rules, (rule) => {
|
|
96
|
+
let errorMessage = '';
|
|
80
97
|
if (!rule.path) {
|
|
81
98
|
return;
|
|
82
99
|
}
|
|
83
|
-
const value = Coon.util.getByPath(
|
|
100
|
+
const value = Coon.util.getByPath(src, rule.path);
|
|
84
101
|
const validTags = getValid(rule.valid) || [];
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
validTags(value) :
|
|
88
|
-
checkValidity(validTags, value);
|
|
102
|
+
let subResult;
|
|
103
|
+
const isValid = checkValidity(validTags, value);
|
|
89
104
|
if (
|
|
90
|
-
|
|
91
|
-
!isInvalid &&
|
|
105
|
+
isValid &&
|
|
92
106
|
Array.isArray(rule.rules) &&
|
|
93
107
|
rule.rules.length
|
|
94
108
|
) {
|
|
95
|
-
|
|
96
|
-
if (!subResult.valid) {
|
|
97
|
-
isInvalid = false;
|
|
98
|
-
subErrors = subResult.errors.join('\n');
|
|
99
|
-
}
|
|
109
|
+
subResult = getErrors(value, rule.rules);
|
|
100
110
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
if (!isValid) {
|
|
112
|
+
errorMessage += rule.msg ||
|
|
113
|
+
`The property on the path "${rule.path}" with the value ${value} is invalid, validity check: ${rule.valid}`;
|
|
114
|
+
}
|
|
115
|
+
if (subResult && !subResult.valid) {
|
|
116
|
+
errorMessage += '\n---\n ' + subResult.errors.join('\n ');
|
|
107
117
|
}
|
|
118
|
+
return errorMessage || false;
|
|
108
119
|
});
|
|
109
120
|
return {
|
|
110
121
|
valid: !errors.length,
|
package/src/version.js
CHANGED