@abaplint/runtime 2.7.129 → 2.7.131
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.
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WriteStatement = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
+
const NO_DEICMAL_CURRENCIES = ["HUF", "KRW", "JPY"];
|
|
5
6
|
class WriteStatement {
|
|
6
7
|
constructor(context) {
|
|
7
8
|
this.context = context;
|
|
8
9
|
}
|
|
9
10
|
write(source, options) {
|
|
10
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
|
+
let right = false;
|
|
11
13
|
if ((options === null || options === void 0 ? void 0 : options.skipLine) === true) {
|
|
12
14
|
this.context.console.add("\n");
|
|
13
15
|
}
|
|
@@ -39,13 +41,30 @@ class WriteStatement {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
else if (source instanceof types_1.Packed) {
|
|
42
|
-
|
|
44
|
+
let num = source.get();
|
|
45
|
+
let decimals = source.getDecimals();
|
|
46
|
+
if (NO_DEICMAL_CURRENCIES.includes(((_b = options === null || options === void 0 ? void 0 : options.currency) === null || _b === void 0 ? void 0 : _b.get()) || "")) {
|
|
47
|
+
// todo, more work needed here,
|
|
48
|
+
num = num * 100;
|
|
49
|
+
decimals = 0;
|
|
50
|
+
}
|
|
51
|
+
result = num.toFixed(decimals).replace(".", ",");
|
|
52
|
+
right = true;
|
|
43
53
|
}
|
|
44
54
|
else {
|
|
45
55
|
result = source.get().toString();
|
|
46
56
|
}
|
|
57
|
+
if ((options === null || options === void 0 ? void 0 : options.noSign) === true) {
|
|
58
|
+
result = result.replace("-", "");
|
|
59
|
+
}
|
|
47
60
|
if (options === null || options === void 0 ? void 0 : options.target) {
|
|
48
|
-
|
|
61
|
+
if (right === true) {
|
|
62
|
+
const len = options.target.get().length;
|
|
63
|
+
options.target.set(" ".repeat(len - result.length) + result);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
options.target.set(result);
|
|
67
|
+
}
|
|
49
68
|
}
|
|
50
69
|
else {
|
|
51
70
|
this.context.console.add(result);
|