@almadar/evaluator 2.3.0 → 2.3.1
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/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/operators/index.js +15 -1
- package/dist/operators/index.js.map +1 -1
- package/package.json +11 -9
package/dist/index.js
CHANGED
|
@@ -500,10 +500,23 @@ function evalCallService(args, evaluate2, ctx) {
|
|
|
500
500
|
console.error(`Service call ${service}.${method} failed:`, err);
|
|
501
501
|
});
|
|
502
502
|
}
|
|
503
|
+
function evaluateNestedProps(obj, evaluate2, ctx) {
|
|
504
|
+
const result = {};
|
|
505
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
506
|
+
if (Array.isArray(value) && value.length > 0 && typeof value[0] === "string") {
|
|
507
|
+
result[key] = evaluate2(value, ctx);
|
|
508
|
+
} else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
509
|
+
result[key] = evaluateNestedProps(value, evaluate2, ctx);
|
|
510
|
+
} else {
|
|
511
|
+
result[key] = value;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
503
516
|
function evalRenderUI(args, evaluate2, ctx) {
|
|
504
517
|
const slot = args[0];
|
|
505
518
|
const pattern = evaluate2(args[1], ctx);
|
|
506
|
-
const
|
|
519
|
+
const rawProps = args.length > 2 ? args[2] : void 0;
|
|
507
520
|
const priority = args.length > 3 ? evaluate2(args[3], ctx) : void 0;
|
|
508
521
|
if (!ctx.renderUI) {
|
|
509
522
|
console.warn("No renderUI handler in context for render-ui effect");
|
|
@@ -513,6 +526,7 @@ function evalRenderUI(args, evaluate2, ctx) {
|
|
|
513
526
|
ctx.renderUI(slot, { type: "clear" }, void 0, priority);
|
|
514
527
|
return;
|
|
515
528
|
}
|
|
529
|
+
const props = rawProps ? evaluateNestedProps(rawProps, evaluate2, ctx) : void 0;
|
|
516
530
|
ctx.renderUI(slot, pattern, props, priority);
|
|
517
531
|
}
|
|
518
532
|
function evalSetDynamic(args, evaluate2, ctx) {
|