Skip to content

Commit 2cb2657

Browse files
committed
Improve array management
1 parent 1316ea4 commit 2cb2657

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ function addProperties(model, Class, classId) {
744744
return result;
745745
}
746746

747-
if (Array.isArray(propertyType)) { // in case of array, return a sub array
747+
if (Array.isArray(propertyType) || propertyType === 'array') { // in case of array, return a sub array
748748
body = function body(position, value) {
749749
var search = [],
750750
component = null,
@@ -762,7 +762,7 @@ function addProperties(model, Class, classId) {
762762
'propertyName': propertyName,
763763
'readOnly': propertyReadOnly,
764764
'classId': classId,
765-
'type': propertyType[0],
765+
'type': propertyType === 'array' ? 'any' : propertyType[0],
766766
'arr': $db.store[classId][this.id()][propertyName]
767767
});
768768

src/workflow.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,11 @@ function validParamNumbers(className, state, action) {
496496
modelNumberParam = [2, 2];
497497
break;
498498
case isProperty:
499-
modelNumberParam = [1, 1];
499+
if ($metamodel.getModelPathType(className, state) === 'array') {
500+
modelNumberParam = [2, 2];
501+
} else {
502+
modelNumberParam = [1, 1];
503+
}
500504
break;
501505
case isLink:
502506
modelNumberParam = [1, 1];
@@ -565,7 +569,16 @@ function checkParams(params) {
565569
} else {
566570
paramsType = [$metamodel.getModel(componentClassName)[methodName].type];
567571
}
568-
paramsNumber = [1, 1];
572+
if ($metamodel.getModelPathType(componentClassName, methodName) === 'array') {
573+
if (args && args[1] && args[1] === 'reset') {
574+
paramsType = [['any'], 'string'];
575+
} else {
576+
paramsType = ['any', 'string'];
577+
}
578+
paramsNumber = [2, 2];
579+
} else {
580+
paramsNumber = [1, 1];
581+
}
569582
break;
570583
case isLink:
571584
paramsType = [$metamodel.getModel(componentClassName)[methodName].type];

0 commit comments

Comments
 (0)