ru.coon 3.0.67 → 3.0.68

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 CHANGED
File without changes
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 3.0.68, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/4c8a28a5fc4878ff7e670c77d3bc794069ab7d2d)
2
+ * HT-14811: исправление редактирования характеристик FKV ([b5c035], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b5c0356d657071ecc5353a39be973d5b592f7648))
3
+ * update: CHANGELOG.md ([87a10f], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/87a10faa1d038191be9cec97076df7bcea165105))
4
+
1
5
  # Version 3.0.67, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d850ee12048246ba85557eef4475595043fc9d00)
2
6
  * HT-14811: исправление открытия редактора для характеристик FKV ([becf94], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/becf94689878553b8c8287c6260ca986a314b08e))
3
7
  * update: CHANGELOG.md ([ef54a3], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ef54a339c72c36ce13a27672dff3cf89e35ddded))
@@ -38,6 +42,12 @@
38
42
 
39
43
  * HT-13993 добавлена боковая панель фильтров для репортов ([e2d5c7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e2d5c7436900d232cd48c9389a685affbacf721a))
40
44
  * HT-14628 открытие компонента внутри репорта - закрытие через крестик ([fc4f4e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/fc4f4e9112a3ba1a85cb4a064d65d7a7cfb8cec1))
45
+ * update: CHANGELOG.md ([2ab856], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/2ab8566fb3c7400e91d3706a5bd8383d48060556))
46
+
47
+ # Version 3.0.60, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/b3ba3aeb89954b8e1650cb40e052a4509b4809fb)
48
+ * ## Fixes
49
+ * <span style='color:red'>fix validator, util.getByPath</span> ([608e70], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/608e7096603a0ed31656b0f45686bab7a4ee302b))
50
+
41
51
  * update: CHANGELOG.md ([e42a2a], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/e42a2a6fb8b511ba174ab5060fc84c683a046945))
42
52
 
43
53
  # Version 3.0.59, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/065a134b1f6c6211d56ef758b127778d5e104faa)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "3.0.67",
7
+ "version": "3.0.68",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -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 ((record.get('entity') === 'FKV') && record.get('mask')) {
250
- return false;
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 ((record.get('entity') === 'FKV') && record.get('mask')) {
300
- this.prepareType(record);
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
  },
@@ -57,6 +57,7 @@ Ext.define('Coon.report.component.reportpanel.ReportGrid', {
57
57
  try {
58
58
  this.addPlugin(plugin);
59
59
  } catch (e) {
60
+ console.error('plugin error', e);
60
61
  pluginErrors.push(e.message);
61
62
  }
62
63
  });
@@ -10,17 +10,17 @@ Ext.define('Coon.report.util', {
10
10
  path: 'fields',
11
11
  valid: 'array',
12
12
  rules: [
13
- {path: '[].description', valid: 'string, required'},
14
- {path: '[].reportFieldCd', valid: 'string, required'},
15
- {path: '[].visibleSwitch', valid: 'boolean'},
16
- {path: '[].reportFieldTypeLookup', valid: 'uppercase, required'},
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: '[].properties',
18
+ path: 'properties',
19
19
  valid: 'array',
20
20
  rules: [
21
- {path: '[].sequenceNumber', valid: 'number'},
22
- {path: '[].key', valid: 'type.string'},
23
- {path: '[].value', valid: '!type.undefined'}
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: '[].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'}
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: '[].key', valid: 'string, required'},
45
- {path: '[].value', valid: 'string, required'},
46
- {path: '[].sequenceNumber', valid: 'string, required'}
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: '[].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'},
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: '[].properties',
60
+ path: 'properties',
61
61
  valid: 'array',
62
62
  rules: [
63
- {path: '[].key', valid: 'string, required'},
64
- {path: '[].value', valid: 'string, required'},
65
- {path: '[].sequenceNumber', valid: 'number'}
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
- validators[name](value, ...args)
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 = (obj, rules) => {
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(obj, rule.path);
100
+ const value = Coon.util.getByPath(src, rule.path);
84
101
  const validTags = getValid(rule.valid) || [];
85
- let subErrors;
86
- let isInvalid = typeof valid === 'function' ?
87
- validTags(value) :
88
- checkValidity(validTags, value);
102
+ let subResult;
103
+ const isValid = checkValidity(validTags, value);
89
104
  if (
90
- !Ext.isEmpty(value) &&
91
- !isInvalid &&
105
+ isValid &&
92
106
  Array.isArray(rule.rules) &&
93
107
  rule.rules.length
94
108
  ) {
95
- const subResult = getErrors(value, rule.rules);
96
- if (!subResult.valid) {
97
- isInvalid = false;
98
- subErrors = subResult.errors.join('\n');
99
- }
109
+ subResult = getErrors(value, rule.rules);
100
110
  }
101
- if (isInvalid) {
102
- rule.msg = rule.msg || `[by path: ${rule.path}], value [${value}] is invalid`;
103
- if (subErrors) {
104
- rule.msg = rule.msg + '\n' + subErrors;
105
- }
106
- return rule.msg;
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
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '3.0.67',
3
+ number: '3.0.68',
4
4
  });