@omnia/velcron 8.0.309-dev → 8.0.311-dev
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/internal-do-not-import-from-here/shared/models/HttpCommon.d.ts +1 -1
- package/models/Enums.d.ts +2 -1
- package/models/Enums.js +1 -0
- package/models/VelcronDefinitions.d.ts +1 -2
- package/package.json +1 -1
- package/parser/VelcronActions.js +3 -0
- package/parser/VelcronData.js +16 -0
- package/parser/VelcronDataBinder.js +18 -3
package/models/Enums.d.ts
CHANGED
package/models/Enums.js
CHANGED
|
@@ -10,6 +10,7 @@ var AssignOperators;
|
|
|
10
10
|
AssignOperators["plusPlus"] = "++";
|
|
11
11
|
AssignOperators["minusMinus"] = "--";
|
|
12
12
|
AssignOperators["equalsExclamation"] = "=!";
|
|
13
|
+
AssignOperators["equalsMinus"] = "=-";
|
|
13
14
|
})(AssignOperators || (exports.AssignOperators = AssignOperators = {}));
|
|
14
15
|
var VelcronActionTypes;
|
|
15
16
|
(function (VelcronActionTypes) {
|
|
@@ -409,8 +409,7 @@ export interface VelcronPropertyDefinition extends VelcronDefinitionWithEditMode
|
|
|
409
409
|
export interface VelcronCheckboxDefinition extends VelcronDefinition {
|
|
410
410
|
type: "checkbox";
|
|
411
411
|
label: VelcronBindableProp<string>;
|
|
412
|
-
value:
|
|
413
|
-
bind: VelcronBindableProp<string>;
|
|
412
|
+
value: VelcronBindableProp<boolean>;
|
|
414
413
|
disabled: VelcronBindableProp<boolean>;
|
|
415
414
|
events: VelcronOnUpdatedEvent;
|
|
416
415
|
}
|
package/package.json
CHANGED
package/parser/VelcronActions.js
CHANGED
|
@@ -195,6 +195,9 @@ class VelcronActions {
|
|
|
195
195
|
else if (partialTemplate.indexOf(models_1.AssignOperators.equalsPlus) > -1) {
|
|
196
196
|
assignOpIndex = partialTemplate.indexOf(models_1.AssignOperators.equalsPlus);
|
|
197
197
|
}
|
|
198
|
+
else if (partialTemplate.indexOf(models_1.AssignOperators.equalsMinus) > -1) {
|
|
199
|
+
assignOpIndex = partialTemplate.indexOf(models_1.AssignOperators.equalsMinus);
|
|
200
|
+
}
|
|
198
201
|
else if (partialTemplate.indexOf(models_1.AssignOperators.equalsQuestion) > -1) {
|
|
199
202
|
assignOpIndex = partialTemplate.indexOf(models_1.AssignOperators.equalsQuestion);
|
|
200
203
|
}
|
package/parser/VelcronData.js
CHANGED
|
@@ -298,6 +298,10 @@ class VelcronData {
|
|
|
298
298
|
assignOperator = models_1.AssignOperators.plusEquals;
|
|
299
299
|
path = path.substring(0, path.length - models_1.AssignOperators.plusEquals.length);
|
|
300
300
|
}
|
|
301
|
+
else if (path.endsWith(models_1.AssignOperators.equalsMinus)) {
|
|
302
|
+
assignOperator = models_1.AssignOperators.equalsMinus;
|
|
303
|
+
path = path.substring(0, path.length - models_1.AssignOperators.equalsMinus.length);
|
|
304
|
+
}
|
|
301
305
|
else if (path.endsWith(models_1.AssignOperators.equalsQuestion)) {
|
|
302
306
|
assignOperator = models_1.AssignOperators.equalsQuestion;
|
|
303
307
|
path = path.substring(0, path.length - models_1.AssignOperators.equalsQuestion.length);
|
|
@@ -457,6 +461,7 @@ class VelcronData {
|
|
|
457
461
|
template = assignOperator + path;
|
|
458
462
|
}
|
|
459
463
|
else if (assignOperator === models_1.AssignOperators.equalsPlus || assignOperator === models_1.AssignOperators.plusEquals) {
|
|
464
|
+
//Support adding items to array += unshifts or =+ pushes
|
|
460
465
|
if (Array.isArray(existingVal)) {
|
|
461
466
|
names.push("value");
|
|
462
467
|
obj.push(value);
|
|
@@ -469,6 +474,17 @@ class VelcronData {
|
|
|
469
474
|
}
|
|
470
475
|
}
|
|
471
476
|
}
|
|
477
|
+
else if (assignOperator === models_1.AssignOperators.equalsMinus) {
|
|
478
|
+
//Support removing items from array
|
|
479
|
+
if (Array.isArray(existingVal)) {
|
|
480
|
+
names.push("value");
|
|
481
|
+
obj.push(value);
|
|
482
|
+
template = `${path} = ${path}.filter(item => item !== value)`;
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
VelcronLogger_1.VelcronLogger.logDataError(`Attempted to remove value from a non-array property at path ${path}`);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
472
488
|
else if (assignOperator === models_1.AssignOperators.equalsQuestion) {
|
|
473
489
|
if (Array.isArray(existingVal)) {
|
|
474
490
|
//fix this
|
|
@@ -38,7 +38,7 @@ class VelcronDataBinder {
|
|
|
38
38
|
}
|
|
39
39
|
// String interpolation > {{ $state.title }} and {{ $state.description }}
|
|
40
40
|
// Computed String interpolation > {{@getName}}
|
|
41
|
-
return
|
|
41
|
+
return VelcronDataBinder.interpolateTokens(bindTo, renderContext);
|
|
42
42
|
}
|
|
43
43
|
static interpolateTokens(bindTo, renderContext) {
|
|
44
44
|
const tokens = VelcronData_1.VelcronData.getTokens(bindTo, false);
|
|
@@ -102,10 +102,25 @@ class VelcronDataBinder {
|
|
|
102
102
|
// Check if the case matches
|
|
103
103
|
if (switchValueStr in expression.cases) {
|
|
104
104
|
const caseValue = expression.cases[switchValueStr];
|
|
105
|
-
|
|
105
|
+
if (typeof caseValue === "string") {
|
|
106
|
+
// If caseValue is a string, interpolate tokens
|
|
107
|
+
return VelcronDataBinder.evaluateExpression(this.interpolateTokens(caseValue, renderContext), renderContext);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// If caseValue is an object, evaluate it directly
|
|
111
|
+
return VelcronDataBinder.evaluateExpression(caseValue, renderContext);
|
|
112
|
+
}
|
|
106
113
|
}
|
|
107
114
|
else if ("default" in expression) {
|
|
108
|
-
|
|
115
|
+
const defaultValue = expression.default;
|
|
116
|
+
if (typeof defaultValue === "string") {
|
|
117
|
+
// If defaultValue is a string, interpolate tokens
|
|
118
|
+
return VelcronDataBinder.evaluateExpression(this.interpolateTokens(defaultValue, renderContext), renderContext);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// If defaultValue is an object, evaluate it directly
|
|
122
|
+
return VelcronDataBinder.evaluateExpression(defaultValue, renderContext);
|
|
123
|
+
}
|
|
109
124
|
}
|
|
110
125
|
else {
|
|
111
126
|
return undefined;
|