@sapui5/sap.fe.base 1.148.1 → 1.148.2
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.
|
@@ -2491,6 +2491,63 @@ export function concat(...inExpressions: ExpressionOrPrimitive<string>[]): Bindi
|
|
|
2491
2491
|
};
|
|
2492
2492
|
}
|
|
2493
2493
|
|
|
2494
|
+
/**
|
|
2495
|
+
* Concatenate multiple expressions with a separator.
|
|
2496
|
+
* @param separator The separator to insert between expressions
|
|
2497
|
+
* @param inExpressions Expressions to concatenate
|
|
2498
|
+
* @returns The concatenated expression
|
|
2499
|
+
*/
|
|
2500
|
+
export function concatWithSeparator(
|
|
2501
|
+
separator: string,
|
|
2502
|
+
...inExpressions: ExpressionOrPrimitive<string>[]
|
|
2503
|
+
): BindingToolkitExpression<string> {
|
|
2504
|
+
const expressions = inExpressions.map(wrapPrimitive);
|
|
2505
|
+
if (hasUnresolvableExpression(...expressions)) {
|
|
2506
|
+
return unresolvableExpression;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
const separatorConstant = constant(separator);
|
|
2510
|
+
|
|
2511
|
+
if (expressions.every(isConstant)) {
|
|
2512
|
+
return constant(
|
|
2513
|
+
expressions.reduce((concatenated: string, value, index) => {
|
|
2514
|
+
const constantValue = value;
|
|
2515
|
+
if (constantValue.value !== undefined && constantValue.value !== null) {
|
|
2516
|
+
const prefix = index > 0 ? separator : "";
|
|
2517
|
+
return concatenated + prefix + constantValue.value.toString();
|
|
2518
|
+
}
|
|
2519
|
+
return concatenated;
|
|
2520
|
+
}, "")
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
// Interleave separator constants between expressions
|
|
2525
|
+
const expressionsWithSeparators: BindingToolkitExpression<string>[] = [];
|
|
2526
|
+
expressions.forEach((expr, index) => {
|
|
2527
|
+
if (index > 0) {
|
|
2528
|
+
expressionsWithSeparators.push(separatorConstant);
|
|
2529
|
+
}
|
|
2530
|
+
expressionsWithSeparators.push(expr);
|
|
2531
|
+
});
|
|
2532
|
+
|
|
2533
|
+
if (expressionsWithSeparators.some(isComplexTypeExpression)) {
|
|
2534
|
+
let pathIdx = 0;
|
|
2535
|
+
const myConcatExpression = formatResult(expressionsWithSeparators, "._formatters.StandardFormatter#concat", undefined, true);
|
|
2536
|
+
const allParts = [];
|
|
2537
|
+
transformRecursively(myConcatExpression, "PathInModel", (constantPath: PathInModelExpression<unknown>) => {
|
|
2538
|
+
allParts.push(constantPath);
|
|
2539
|
+
return pathInModel(`$${pathIdx++}`, "$");
|
|
2540
|
+
});
|
|
2541
|
+
allParts.unshift(constant(JSON.stringify(myConcatExpression)));
|
|
2542
|
+
return formatResult(allParts, "._formatters.StandardFormatter.bind($control)#evaluateComplexExpression", undefined, true);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
return {
|
|
2546
|
+
_type: "Concat",
|
|
2547
|
+
expressions: expressionsWithSeparators
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2494
2551
|
type ExpressionTypeToExpression<T extends ExpressionType, V> = T extends "Constant"
|
|
2495
2552
|
? ConstantExpression<V>
|
|
2496
2553
|
: T extends "PathInModel"
|
|
@@ -22,7 +22,7 @@ sap.ui.define(["sap/ui/core/Lib"], function (Library) {
|
|
|
22
22
|
controls: [],
|
|
23
23
|
elements: [],
|
|
24
24
|
// eslint-disable-next-line no-template-curly-in-string
|
|
25
|
-
version: "1.148.
|
|
25
|
+
version: "1.148.2",
|
|
26
26
|
noLibraryCSS: true
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
});
|