@ryuzaki13/react-foundation-lib 2.21.0 → 2.23.0
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/analytical-table/buildAnalyticalTableModel.d.ts +5 -2
- package/dist/analytical-table/buildAnalyticalTableModel.d.ts.map +1 -1
- package/dist/analytical-table/{calculations.d.ts → definition/calculations.d.ts} +1 -1
- package/dist/analytical-table/definition/calculations.d.ts.map +1 -0
- package/dist/analytical-table/definition/compileAnalyticalTableDefinition.d.ts +4 -0
- package/dist/analytical-table/definition/compileAnalyticalTableDefinition.d.ts.map +1 -0
- package/dist/analytical-table/definition/types.d.ts +70 -0
- package/dist/analytical-table/definition/types.d.ts.map +1 -0
- package/dist/analytical-table/definition/validateAnalyticalView.d.ts +5 -0
- package/dist/analytical-table/definition/validateAnalyticalView.d.ts.map +1 -0
- package/dist/analytical-table/{dateColumns.d.ts → dynamic-columns/dateColumns.d.ts} +2 -1
- package/dist/analytical-table/dynamic-columns/dateColumns.d.ts.map +1 -0
- package/dist/analytical-table/dynamic-columns/index.d.ts +3 -0
- package/dist/analytical-table/dynamic-columns/index.d.ts.map +1 -0
- package/dist/analytical-table/{dateColumnTypes.d.ts → dynamic-columns/types.d.ts} +3 -3
- package/dist/analytical-table/dynamic-columns/types.d.ts.map +1 -0
- package/dist/analytical-table/index.d.ts +7 -5
- package/dist/analytical-table/index.d.ts.map +1 -1
- package/dist/analytical-table/index.js +362 -201
- package/dist/analytical-table/index.js.map +1 -1
- package/dist/analytical-table/projections/expansion.d.ts +4 -0
- package/dist/analytical-table/projections/expansion.d.ts.map +1 -0
- package/dist/analytical-table/{exportProjection.d.ts → projections/exportProjection.d.ts} +1 -1
- package/dist/analytical-table/projections/exportProjection.d.ts.map +1 -0
- package/dist/analytical-table/projections/indexAnalyticalRows.d.ts +4 -0
- package/dist/analytical-table/projections/indexAnalyticalRows.d.ts.map +1 -0
- package/dist/analytical-table/projections/resolveRowsProjection.d.ts +4 -0
- package/dist/analytical-table/projections/resolveRowsProjection.d.ts.map +1 -0
- package/dist/analytical-table/{exportTypes.d.ts → projections/types.d.ts} +2 -2
- package/dist/analytical-table/projections/types.d.ts.map +1 -0
- package/dist/analytical-table/{aggregation.d.ts → runtime/aggregation.d.ts} +1 -1
- package/dist/analytical-table/runtime/aggregation.d.ts.map +1 -0
- package/dist/analytical-table/runtime/buildGroupedModel.d.ts +11 -0
- package/dist/analytical-table/runtime/buildGroupedModel.d.ts.map +1 -0
- package/dist/analytical-table/runtime/createAnalyticalTableRuntime.d.ts +10 -0
- package/dist/analytical-table/runtime/createAnalyticalTableRuntime.d.ts.map +1 -0
- package/dist/analytical-table/runtime/filtering.d.ts +7 -0
- package/dist/analytical-table/runtime/filtering.d.ts.map +1 -0
- package/dist/analytical-table/runtime/grouping.d.ts +10 -0
- package/dist/analytical-table/runtime/grouping.d.ts.map +1 -0
- package/dist/analytical-table/runtime/hierarchy.d.ts +20 -0
- package/dist/analytical-table/runtime/hierarchy.d.ts.map +1 -0
- package/dist/analytical-table/runtime/sorting.d.ts +5 -0
- package/dist/analytical-table/runtime/sorting.d.ts.map +1 -0
- package/dist/analytical-table/runtime/totals.d.ts +12 -0
- package/dist/analytical-table/runtime/totals.d.ts.map +1 -0
- package/dist/analytical-table/runtime/types.d.ts +71 -0
- package/dist/analytical-table/runtime/types.d.ts.map +1 -0
- package/dist/analytical-table/{valueComparison.d.ts → runtime/valueComparison.d.ts} +1 -1
- package/dist/analytical-table/runtime/valueComparison.d.ts.map +1 -0
- package/dist/analytical-table/types.d.ts +4 -7
- package/dist/analytical-table/types.d.ts.map +1 -1
- package/dist/chunks/{formatters-CEltML3y.js → formatters-D1ob2OkI.js} +501 -451
- package/dist/chunks/formatters-D1ob2OkI.js.map +1 -0
- package/dist/chunks/{odata-service-CWkHASdw.js → odata-service-tp2U5yIr.js} +415 -415
- package/dist/chunks/{odata-service-CWkHASdw.js.map → odata-service-tp2U5yIr.js.map} +1 -1
- package/dist/chunks/{validate-M2zPiLXn.js → validate-C8cQm_9m.js} +2 -2
- package/dist/chunks/{validate-M2zPiLXn.js.map → validate-C8cQm_9m.js.map} +1 -1
- package/dist/error-report/index.js +2 -2
- package/dist/excel/index.js +18 -18
- package/dist/formatters/formatFileSize.d.ts +7 -0
- package/dist/formatters/formatFileSize.d.ts.map +1 -0
- package/dist/formatters/index.d.ts +1 -0
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +5 -5
- package/dist/odata-service/formatters.d.ts +2 -2
- package/dist/odata-service/index.js +1 -1
- package/dist/table/index.js.map +1 -1
- package/dist/table/useTableRowSelection.d.ts +1 -1
- package/dist/table/useTableRowSelection.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/analytical-table/README.mdx +232 -143
- package/src/formatters/README.mdx +8 -0
- package/dist/analytical-table/aggregation.d.ts.map +0 -1
- package/dist/analytical-table/calculationTypes.d.ts +0 -11
- package/dist/analytical-table/calculationTypes.d.ts.map +0 -1
- package/dist/analytical-table/calculations.d.ts.map +0 -1
- package/dist/analytical-table/columnTypes.d.ts +0 -30
- package/dist/analytical-table/columnTypes.d.ts.map +0 -1
- package/dist/analytical-table/dataTypes.d.ts +0 -14
- package/dist/analytical-table/dataTypes.d.ts.map +0 -1
- package/dist/analytical-table/dateColumnTypes.d.ts.map +0 -1
- package/dist/analytical-table/dateColumns.d.ts.map +0 -1
- package/dist/analytical-table/expansion.d.ts +0 -4
- package/dist/analytical-table/expansion.d.ts.map +0 -1
- package/dist/analytical-table/exportProjection.d.ts.map +0 -1
- package/dist/analytical-table/exportTypes.d.ts.map +0 -1
- package/dist/analytical-table/filtering.d.ts +0 -4
- package/dist/analytical-table/filtering.d.ts.map +0 -1
- package/dist/analytical-table/indexAnalyticalRows.d.ts +0 -4
- package/dist/analytical-table/indexAnalyticalRows.d.ts.map +0 -1
- package/dist/analytical-table/modelTypes.d.ts +0 -43
- package/dist/analytical-table/modelTypes.d.ts.map +0 -1
- package/dist/analytical-table/valueComparison.d.ts.map +0 -1
- package/dist/analytical-table/viewTypes.d.ts +0 -24
- package/dist/analytical-table/viewTypes.d.ts.map +0 -1
- package/dist/chunks/formatters-CEltML3y.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { _ as e, r as t, x as n } from "./array-D-_yMMUK.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { S as d, _ as f, c as ee, d as p, g as m, n as te, o as ne, p as re, t as h, v as ie } from "./validate-
|
|
2
|
+
import { compileTableFormula as r } from "../formulas/index.js";
|
|
3
|
+
import { i } from "./isRecord-DXDTW-jA.js";
|
|
4
|
+
import { It as a, Mn as o, _t as s, ln as c, mn as l, vn as u } from "./odata-service-tp2U5yIr.js";
|
|
5
|
+
import { S as d, _ as f, c as ee, d as p, g as m, n as te, o as ne, p as re, t as h, v as ie } from "./validate-C8cQm_9m.js";
|
|
6
6
|
import { t as ae } from "./string-comparison-BKT7PXmq.js";
|
|
7
7
|
import { isSafe as oe } from "../validators/index.js";
|
|
8
8
|
import { uuidv4 as se } from "../crypto/index.js";
|
|
9
9
|
//#region src/formatters/strings/formatRussianPlural.ts
|
|
10
10
|
var ce = new Intl.PluralRules("ru-RU");
|
|
11
|
-
function
|
|
11
|
+
function g(e, t) {
|
|
12
12
|
if (!Number.isFinite(e)) throw RangeError("Количество должно быть конечным числом.");
|
|
13
13
|
switch (ce.select(e)) {
|
|
14
14
|
case "one": return t.one;
|
|
@@ -17,18 +17,18 @@ function le(e, t) {
|
|
|
17
17
|
default: return t.other ?? t.few;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return `${e} ${
|
|
20
|
+
function le(e, t) {
|
|
21
|
+
return `${e} ${g(e, t)}`;
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/formatters/strings/startsWithIgnoringZeros.ts
|
|
25
|
-
function
|
|
25
|
+
function ue(e, t) {
|
|
26
26
|
let n = (e || "").toLowerCase().replace(/^0+/, ""), r = (t || "").toLowerCase().replace(/^0+/, "");
|
|
27
27
|
return n.startsWith(r);
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/formatters/strings/stripInnerSpaces.ts
|
|
31
|
-
function
|
|
31
|
+
function _(e) {
|
|
32
32
|
let t = "", n = !1;
|
|
33
33
|
for (let r = 0; r < e.length; r++) {
|
|
34
34
|
let i = e.charCodeAt(r);
|
|
@@ -42,7 +42,7 @@ function fe(e) {
|
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/formatters/strings/stripLeadingZeros.ts
|
|
45
|
-
function
|
|
45
|
+
function de(e) {
|
|
46
46
|
if (e == null) return "";
|
|
47
47
|
let t = e.trim();
|
|
48
48
|
if (t === "") return "0";
|
|
@@ -53,249 +53,479 @@ function pe(e) {
|
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/formatters/strings/truncateText.ts
|
|
56
|
-
function
|
|
56
|
+
function fe(t, n) {
|
|
57
57
|
let r = e(t);
|
|
58
58
|
if (r) return r.length > n ? `${r.slice(0, n)}...` : r;
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/formatters/boolean/toAbapBoolean.ts
|
|
62
|
-
function
|
|
62
|
+
function pe(e) {
|
|
63
63
|
return typeof e == "string" && (e = e !== "0"), e ? "X" : " ";
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/formatters/formatName.ts
|
|
67
|
-
function
|
|
67
|
+
function me(e) {
|
|
68
68
|
if (!e) return "";
|
|
69
69
|
let t = e.trim().replace(/\s+/g, " ").replace(/\s*\./, " ").replace(/\s*\.\s*/g, ". ").toLowerCase().split(" ");
|
|
70
70
|
if (t.length === 0) return "";
|
|
71
|
-
let n =
|
|
71
|
+
let n = v(t[0]);
|
|
72
72
|
if (t.length === 1) return n;
|
|
73
|
-
let r = t[1].includes(".") ?
|
|
74
|
-
return t.length === 2 ? `${n} ${r}` : `${n} ${r} ${t[2].includes(".") ?
|
|
73
|
+
let r = t[1].includes(".") ? ge(t[1]) : v(t[1]);
|
|
74
|
+
return t.length === 2 ? `${n} ${r}` : `${n} ${r} ${t[2].includes(".") ? ge(t[2]) : v(t[2])}`;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function he(e) {
|
|
77
77
|
if (!e) return "";
|
|
78
78
|
let t = e.trim().replace(/\s+/g, " ").replace(/\s*\.\s*/g, ".").toLowerCase().split(" ");
|
|
79
79
|
if (t.length === 0) return "";
|
|
80
|
-
let n =
|
|
80
|
+
let n = v(t[0]);
|
|
81
81
|
if (t.length === 1) return n;
|
|
82
82
|
let r = t[1].startsWith(".") ? t[1][1] : t[1][0];
|
|
83
83
|
if (t.length === 2) return t[1].includes("."), `${n} ${r.toUpperCase()}.`;
|
|
84
84
|
let i = t[2].startsWith(".") ? t[2][1] : t[2][0];
|
|
85
85
|
return `${n} ${r.toUpperCase()}.${i.toUpperCase()}.`;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function v(e) {
|
|
88
88
|
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
90
|
+
function ge(e) {
|
|
91
|
+
return v(e);
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/formatters/number/compact.ts
|
|
95
|
+
var _e = [
|
|
96
|
+
{
|
|
97
|
+
value: 0xe8d4a51000,
|
|
98
|
+
suffix: "трлн"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
value: 1e9,
|
|
102
|
+
suffix: "млрд"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: 1e6,
|
|
106
|
+
suffix: "млн"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
value: 1e3,
|
|
110
|
+
suffix: "тыс"
|
|
111
|
+
}
|
|
112
|
+
], y = {
|
|
113
|
+
minCompactValue: 1e3,
|
|
114
|
+
roundingMode: "trunc",
|
|
115
|
+
suffixSeparator: " "
|
|
116
|
+
}, ve = ",";
|
|
117
|
+
function ye(e, t) {
|
|
118
|
+
switch (t) {
|
|
119
|
+
case "round": return Math.round(e);
|
|
120
|
+
case "floor": return Math.floor(e);
|
|
121
|
+
case "ceil": return Math.ceil(e);
|
|
122
|
+
case "trunc": return Math.trunc(e);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function be(e, t, n) {
|
|
126
|
+
if (t === 0) return ye(e, n);
|
|
127
|
+
let r = 10 ** t;
|
|
128
|
+
return ye(e * r, n) / r;
|
|
129
|
+
}
|
|
130
|
+
function xe(e) {
|
|
131
|
+
return e >= 10 ? 0 : 1;
|
|
132
|
+
}
|
|
133
|
+
function Se(e, t) {
|
|
134
|
+
if (t === 0) return 0;
|
|
135
|
+
let n = e.toFixed(t), r = n.indexOf(".");
|
|
136
|
+
return r === -1 ? 0 : n.slice(r + 1).replace(/0+$/, "").length;
|
|
137
|
+
}
|
|
138
|
+
function Ce(e, t) {
|
|
139
|
+
return t.findIndex((t) => e >= t.value);
|
|
140
|
+
}
|
|
141
|
+
function we(e, t) {
|
|
142
|
+
return {
|
|
143
|
+
name: e.name,
|
|
144
|
+
decimals: t,
|
|
145
|
+
decimalSeparator: t > 0 ? e.decimalSeparator || ve : e.decimalSeparator,
|
|
146
|
+
grouping: e.grouping,
|
|
147
|
+
groupingSeparator: e.groupingSeparator,
|
|
148
|
+
groupingSize: e.groupingSize
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function Te(e, t, n, r, i) {
|
|
152
|
+
let a = n.units[t];
|
|
153
|
+
if (!a) return i(e, r);
|
|
154
|
+
let o = e / a.value, s = n.maxDecimals ?? xe(o), c = be(o, s, n.roundingMode);
|
|
155
|
+
return c >= 1e3 && t > 0 ? Te(e, t - 1, n, r, i) : `${i(c, we(r, Se(c, s)))}${n.suffixSeparator}${a.suffix}`;
|
|
156
|
+
}
|
|
157
|
+
function Ee(e) {
|
|
158
|
+
let { minCompactValue: t = y.minCompactValue, roundingMode: n = y.roundingMode, suffixSeparator: r = y.suffixSeparator, maxDecimals: i, units: a = _e } = e.options, o = Math.abs(e.value);
|
|
159
|
+
if (o < t) return e.formatPlainNumber(e.value, e.preset);
|
|
160
|
+
let s = Ce(o, a);
|
|
161
|
+
return s === -1 ? e.formatPlainNumber(e.value, e.preset) : `${e.value < 0 ? "-" : ""}${Te(o, s, {
|
|
162
|
+
roundingMode: n,
|
|
163
|
+
suffixSeparator: r,
|
|
164
|
+
maxDecimals: i,
|
|
165
|
+
units: a
|
|
166
|
+
}, e.preset, e.formatPlainNumber)}`;
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/formatters/number/isZeroValue.ts
|
|
170
|
+
function b(e) {
|
|
171
|
+
let t = o(e);
|
|
172
|
+
return typeof t == "number" ? t === 0 : typeof t == "bigint" && t === 0n;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/formatters/number/formatNumber.ts
|
|
176
|
+
var x = /* @__PURE__ */ new Map();
|
|
177
|
+
function De(e, t) {
|
|
178
|
+
if (t === 0) return Math.trunc(e);
|
|
179
|
+
let n = 10 ** t;
|
|
180
|
+
return Math.trunc(e * n) / n;
|
|
181
|
+
}
|
|
182
|
+
function S(e, t) {
|
|
183
|
+
let n = `${e}:${+!!t}`, r = x.get(n);
|
|
184
|
+
return r || (r = new Intl.NumberFormat("ru-RU", {
|
|
185
|
+
minimumFractionDigits: e,
|
|
186
|
+
maximumFractionDigits: e,
|
|
187
|
+
useGrouping: t
|
|
188
|
+
}), x.set(n, r)), r;
|
|
189
|
+
}
|
|
190
|
+
function Oe(e) {
|
|
191
|
+
return e.groupingSize === 3 && (e.groupingSeparator === f.groupingSeparator || !e.grouping) && (e.decimalSeparator === "," || e.decimals === 0);
|
|
192
|
+
}
|
|
193
|
+
function ke(e, t, n) {
|
|
194
|
+
return S(t, n).format(e);
|
|
195
|
+
}
|
|
196
|
+
function Ae(e, t) {
|
|
197
|
+
let n = S(t.decimals, t.grouping).formatToParts(e), r = "";
|
|
198
|
+
for (let e of n) e.type === "group" ? r += t.groupingSeparator : e.type === "decimal" ? r += t.decimalSeparator : r += e.value;
|
|
199
|
+
return r;
|
|
200
|
+
}
|
|
201
|
+
function je(e, t) {
|
|
202
|
+
let n = S(t.decimals, !1).format(e), r = n.indexOf(","), i = r === -1 ? n : n.slice(0, r), a = r === -1 ? null : n.slice(r + 1), o = i.startsWith("-"), s = o ? i.slice(1) : i, c = t.groupingSize, l = [];
|
|
203
|
+
for (let e = s.length; e > 0; e -= c) l.unshift(s.slice(Math.max(0, e - c), e));
|
|
204
|
+
let u = (o ? "-" : "") + l.join(t.groupingSeparator);
|
|
205
|
+
return a !== null && (u += t.decimalSeparator + a), u;
|
|
206
|
+
}
|
|
207
|
+
function C(e, t) {
|
|
208
|
+
return Oe(t) ? ke(e, t.decimals, t.grouping) : t.groupingSize === 3 || !t.grouping ? Ae(e, t) : je(e, t);
|
|
209
|
+
}
|
|
210
|
+
function w(e, t) {
|
|
211
|
+
if (typeof e == "string" && e.trim() === "") return "0";
|
|
212
|
+
let n = Number(e);
|
|
213
|
+
if (!Number.isFinite(n)) return "0";
|
|
214
|
+
let r = d(t);
|
|
215
|
+
return r.compact ? Ee({
|
|
216
|
+
value: n,
|
|
217
|
+
preset: r,
|
|
218
|
+
options: r.compact,
|
|
219
|
+
formatPlainNumber: C
|
|
220
|
+
}) : C(n, r);
|
|
221
|
+
}
|
|
222
|
+
function Me(e) {
|
|
223
|
+
return w(e, m.integer);
|
|
224
|
+
}
|
|
225
|
+
function Ne(e) {
|
|
226
|
+
return w(e, m.currency);
|
|
227
|
+
}
|
|
228
|
+
function Pe(e) {
|
|
229
|
+
return w(e, m.decimal);
|
|
230
|
+
}
|
|
231
|
+
function Fe(e) {
|
|
232
|
+
return w(e, m.decimal2);
|
|
233
|
+
}
|
|
234
|
+
function Ie(e) {
|
|
235
|
+
return w(e, m.decimal3);
|
|
236
|
+
}
|
|
237
|
+
function Le(e) {
|
|
238
|
+
return w(e, m.percent);
|
|
239
|
+
}
|
|
240
|
+
function Re(e) {
|
|
241
|
+
return w(e, m.price);
|
|
242
|
+
}
|
|
243
|
+
function ze(e) {
|
|
244
|
+
return w(e, m.tonnage);
|
|
245
|
+
}
|
|
246
|
+
function Be(e) {
|
|
247
|
+
return b(e) ? "" : w(e, m.integer);
|
|
248
|
+
}
|
|
249
|
+
function Ve(e) {
|
|
250
|
+
return b(e) ? "" : w(e, m.currency);
|
|
251
|
+
}
|
|
252
|
+
function He(e) {
|
|
253
|
+
return b(e) ? "" : w(e, m.decimal);
|
|
254
|
+
}
|
|
255
|
+
function Ue(e) {
|
|
256
|
+
return b(e) ? "" : w(e, m.decimal2);
|
|
257
|
+
}
|
|
258
|
+
function We(e) {
|
|
259
|
+
return b(e) ? "" : w(e, m.decimal3);
|
|
260
|
+
}
|
|
261
|
+
function Ge(e) {
|
|
262
|
+
return b(e) ? "" : w(e, m.percent);
|
|
263
|
+
}
|
|
264
|
+
function Ke(e) {
|
|
265
|
+
return b(e) ? "" : w(e, m.price);
|
|
266
|
+
}
|
|
267
|
+
function qe(e) {
|
|
268
|
+
return b(e) ? "" : w(e, m.tonnage);
|
|
269
|
+
}
|
|
270
|
+
function Je() {
|
|
271
|
+
x.clear();
|
|
272
|
+
}
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/formatters/formatFileSize.ts
|
|
275
|
+
var T = 1024, E = {
|
|
276
|
+
...f,
|
|
277
|
+
name: "file-size",
|
|
278
|
+
decimals: 0,
|
|
279
|
+
compact: {
|
|
280
|
+
minCompactValue: 1,
|
|
281
|
+
maxDecimals: 2,
|
|
282
|
+
roundingMode: "round",
|
|
283
|
+
units: [
|
|
284
|
+
{
|
|
285
|
+
value: T ** 5,
|
|
286
|
+
suffix: "ПиБ"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
value: T ** 4,
|
|
290
|
+
suffix: "ТиБ"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
value: T ** 3,
|
|
294
|
+
suffix: "ГиБ"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
value: T ** 2,
|
|
298
|
+
suffix: "МиБ"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
value: T,
|
|
302
|
+
suffix: "КиБ"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
value: 1,
|
|
306
|
+
suffix: "Б"
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
function Ye(e) {
|
|
312
|
+
if (!Number.isSafeInteger(e) || e < 0) throw RangeError("Размер файла должен быть неотрицательным безопасным целым числом.");
|
|
313
|
+
if (e === 0) return "0 Б";
|
|
314
|
+
let t = E.compact?.units?.find(({ value: t }) => e >= t);
|
|
315
|
+
return w(e, {
|
|
316
|
+
...E,
|
|
317
|
+
compact: {
|
|
318
|
+
...E.compact,
|
|
319
|
+
units: t ? [t] : []
|
|
320
|
+
}
|
|
321
|
+
});
|
|
92
322
|
}
|
|
93
323
|
//#endregion
|
|
94
324
|
//#region src/formatters/formatPhone.ts
|
|
95
|
-
function
|
|
96
|
-
let t =
|
|
325
|
+
function Xe(e) {
|
|
326
|
+
let t = D(e).match(/^(\+7)(\d{3})(\d{3})(\d{2})(\d{2})$/);
|
|
97
327
|
return t ? `+7 (${t[2]}) ${t[3]}-${t[4]}-${t[5]}` : e;
|
|
98
328
|
}
|
|
99
|
-
function
|
|
329
|
+
function D(e) {
|
|
100
330
|
return `+7${e.replace(/\D/g, "").slice(0, 11).replace(/^(7|8)/, "")}`;
|
|
101
331
|
}
|
|
102
332
|
//#endregion
|
|
103
333
|
//#region src/formatters/date/calendarDate.ts
|
|
104
|
-
function
|
|
334
|
+
function O(e, t, n, r = 0, i = 0, a = 0, o = 0) {
|
|
105
335
|
return new Date(e, t, n, r, i, a, o);
|
|
106
336
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
337
|
+
function k(e) {
|
|
338
|
+
return O(e.getFullYear(), e.getMonth(), e.getDate(), 0, 0, 0, 0);
|
|
109
339
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
340
|
+
function A(e) {
|
|
341
|
+
return O(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59, 0);
|
|
112
342
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
343
|
+
function j(e) {
|
|
344
|
+
return O(e.getFullYear(), e.getMonth(), 1, 0, 0, 0, 0);
|
|
115
345
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
346
|
+
function M(e) {
|
|
347
|
+
return O(e.getFullYear(), 0, 1, 0, 0, 0, 0);
|
|
118
348
|
}
|
|
119
|
-
function
|
|
120
|
-
let n = Number.isInteger(t) ? (t % 7 + 7) % 7 : 1, r =
|
|
121
|
-
return
|
|
349
|
+
function N(e, t = 1) {
|
|
350
|
+
let n = Number.isInteger(t) ? (t % 7 + 7) % 7 : 1, r = k(e);
|
|
351
|
+
return P(r, -((r.getDay() - n + 7) % 7));
|
|
122
352
|
}
|
|
123
|
-
function
|
|
124
|
-
return
|
|
353
|
+
function P(e, t) {
|
|
354
|
+
return O(e.getFullYear(), e.getMonth(), e.getDate() + t, 0, 0, 0, 0);
|
|
125
355
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
356
|
+
function Ze(e, t) {
|
|
357
|
+
return O(e.getFullYear(), e.getMonth() + t, e.getDate(), 0, 0, 0, 0);
|
|
128
358
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
359
|
+
function Qe(e, t) {
|
|
360
|
+
return O(e.getFullYear() + t, e.getMonth(), e.getDate(), 0, 0, 0, 0);
|
|
131
361
|
}
|
|
132
|
-
function
|
|
362
|
+
function $e(e, t) {
|
|
133
363
|
return !(e instanceof Date) || !(t instanceof Date) ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
134
364
|
}
|
|
135
365
|
//#endregion
|
|
136
366
|
//#region src/formatters/date/calendarPeriod.ts
|
|
137
|
-
var
|
|
367
|
+
var et = {
|
|
138
368
|
friday: 4,
|
|
139
369
|
saturday: 5,
|
|
140
370
|
sunday: 6
|
|
141
371
|
};
|
|
142
|
-
function
|
|
372
|
+
function tt(e) {
|
|
143
373
|
return e instanceof Date && Number.isFinite(e.getTime());
|
|
144
374
|
}
|
|
145
|
-
function
|
|
375
|
+
function nt(e) {
|
|
146
376
|
return e ?? "sunday";
|
|
147
377
|
}
|
|
148
|
-
function
|
|
378
|
+
function rt(e) {
|
|
149
379
|
return e ?? "day";
|
|
150
380
|
}
|
|
151
|
-
function
|
|
152
|
-
if (!
|
|
153
|
-
switch (
|
|
381
|
+
function it(e, t = {}) {
|
|
382
|
+
if (!tt(e)) return null;
|
|
383
|
+
switch (rt(t.selectionMode)) {
|
|
154
384
|
case "day": return {
|
|
155
|
-
start:
|
|
156
|
-
end:
|
|
385
|
+
start: k(e),
|
|
386
|
+
end: A(e)
|
|
157
387
|
};
|
|
158
388
|
case "week": {
|
|
159
|
-
let n =
|
|
389
|
+
let n = N(e), r = et[nt(t.weekEndDay)];
|
|
160
390
|
return {
|
|
161
391
|
start: n,
|
|
162
|
-
end:
|
|
392
|
+
end: A(P(n, r))
|
|
163
393
|
};
|
|
164
394
|
}
|
|
165
395
|
case "month": return {
|
|
166
|
-
start:
|
|
167
|
-
end:
|
|
396
|
+
start: j(e),
|
|
397
|
+
end: A(O(e.getFullYear(), e.getMonth() + 1, 0))
|
|
168
398
|
};
|
|
169
399
|
case "year": return {
|
|
170
|
-
start:
|
|
171
|
-
end:
|
|
400
|
+
start: M(e),
|
|
401
|
+
end: A(O(e.getFullYear(), 11, 31))
|
|
172
402
|
};
|
|
173
403
|
default: return null;
|
|
174
404
|
}
|
|
175
405
|
}
|
|
176
|
-
function
|
|
177
|
-
if (!
|
|
178
|
-
let n =
|
|
406
|
+
function at(e, t) {
|
|
407
|
+
if (!tt(e) || !t) return !1;
|
|
408
|
+
let n = k(e).getTime();
|
|
179
409
|
return n >= t.start.getTime() && n <= t.end.getTime();
|
|
180
410
|
}
|
|
181
|
-
function
|
|
182
|
-
return !(!e || t.minDate && e.start.getTime() <
|
|
411
|
+
function ot(e, t = {}) {
|
|
412
|
+
return !(!e || t.minDate && e.start.getTime() < k(t.minDate).getTime() || t.maxDate && e.end.getTime() > A(t.maxDate).getTime());
|
|
183
413
|
}
|
|
184
414
|
//#endregion
|
|
185
415
|
//#region src/formatters/date/dateRange.ts
|
|
186
|
-
var
|
|
187
|
-
function
|
|
416
|
+
var st = 864e5;
|
|
417
|
+
function F(e) {
|
|
188
418
|
return e instanceof Date && Number.isFinite(e.getTime());
|
|
189
419
|
}
|
|
190
|
-
function
|
|
420
|
+
function ct(e) {
|
|
191
421
|
return Array.isArray(e);
|
|
192
422
|
}
|
|
193
|
-
function
|
|
423
|
+
function I(e) {
|
|
194
424
|
return new Date(e.getTime());
|
|
195
425
|
}
|
|
196
|
-
function
|
|
426
|
+
function L(e, t) {
|
|
197
427
|
return e.getTime() <= t.getTime() ? [e, t] : [t, e];
|
|
198
428
|
}
|
|
199
|
-
function
|
|
200
|
-
if (
|
|
201
|
-
let [t, n] = e, r =
|
|
202
|
-
return r && i ?
|
|
429
|
+
function lt(e) {
|
|
430
|
+
if (ct(e)) {
|
|
431
|
+
let [t, n] = e, r = F(t), i = F(n);
|
|
432
|
+
return r && i ? L(t, n) : r ? [t, t] : i ? [n, n] : null;
|
|
203
433
|
}
|
|
204
|
-
return
|
|
434
|
+
return F(e) ? [e, e] : null;
|
|
205
435
|
}
|
|
206
|
-
function
|
|
207
|
-
let n =
|
|
436
|
+
function R(e, t = {}) {
|
|
437
|
+
let n = lt(e);
|
|
208
438
|
if (!n) return null;
|
|
209
439
|
let [r, i] = n;
|
|
210
|
-
return t.timeMode === "preserve" ? [
|
|
440
|
+
return t.timeMode === "preserve" ? [I(r), I(i)] : [k(r), A(i)];
|
|
211
441
|
}
|
|
212
|
-
function
|
|
213
|
-
let n =
|
|
442
|
+
function ut(e, t) {
|
|
443
|
+
let n = R(e, t);
|
|
214
444
|
if (!n) throw Error("Диапазон дат не задан");
|
|
215
445
|
return n;
|
|
216
446
|
}
|
|
217
|
-
function
|
|
447
|
+
function dt(e) {
|
|
218
448
|
return Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
|
|
219
449
|
}
|
|
220
|
-
function
|
|
221
|
-
let t =
|
|
450
|
+
function ft(e) {
|
|
451
|
+
let t = R(e);
|
|
222
452
|
if (!t) return null;
|
|
223
453
|
let [n, r] = t;
|
|
224
|
-
return Math.floor((
|
|
454
|
+
return Math.floor((dt(r) - dt(n)) / st) + 1;
|
|
225
455
|
}
|
|
226
456
|
//#endregion
|
|
227
457
|
//#region src/formatters/date/educationDate.ts
|
|
228
|
-
var
|
|
229
|
-
function
|
|
458
|
+
var pt = /^(\d{4})-(\d{2})-(\d{2})$/, mt = /^(\d{2}):(\d{2})(?::(\d{2}))?$/, ht = 8, gt = 1, _t = 7, vt = 31, yt = 6;
|
|
459
|
+
function z(e, t) {
|
|
230
460
|
return Number.isInteger(e) && e >= 0 && e <= t;
|
|
231
461
|
}
|
|
232
|
-
function
|
|
233
|
-
let t = e?.match(
|
|
462
|
+
function B(e) {
|
|
463
|
+
let t = e?.match(pt);
|
|
234
464
|
if (!t) return null;
|
|
235
|
-
let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]), a =
|
|
465
|
+
let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]), a = O(n, r - 1, i);
|
|
236
466
|
return a.getFullYear() === n && a.getMonth() === r - 1 && a.getDate() === i ? a : null;
|
|
237
467
|
}
|
|
238
|
-
function
|
|
468
|
+
function V(e) {
|
|
239
469
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
240
470
|
}
|
|
241
|
-
function
|
|
471
|
+
function bt(e) {
|
|
242
472
|
return `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
|
|
243
473
|
}
|
|
244
|
-
function
|
|
245
|
-
let n =
|
|
474
|
+
function xt(e, t) {
|
|
475
|
+
let n = B(e), r = t.match(mt);
|
|
246
476
|
if (!n || !r) return null;
|
|
247
477
|
let i = Number(r[1]), a = Number(r[2]), o = Number(r[3] ?? 0);
|
|
248
|
-
return !
|
|
478
|
+
return !z(i, 23) || !z(a, 59) || !z(o, 59) ? null : O(n.getFullYear(), n.getMonth(), n.getDate(), i, a, o);
|
|
249
479
|
}
|
|
250
|
-
function
|
|
251
|
-
return e.getMonth() <
|
|
480
|
+
function St(e = /* @__PURE__ */ new Date()) {
|
|
481
|
+
return e.getMonth() < ht ? e.getFullYear() - 1 : e.getFullYear();
|
|
252
482
|
}
|
|
253
|
-
function
|
|
254
|
-
let t =
|
|
483
|
+
function Ct(e = /* @__PURE__ */ new Date()) {
|
|
484
|
+
let t = St(e);
|
|
255
485
|
return {
|
|
256
486
|
year: t,
|
|
257
|
-
start:
|
|
258
|
-
end:
|
|
487
|
+
start: O(t, ht, gt),
|
|
488
|
+
end: O(t + 1, _t, vt)
|
|
259
489
|
};
|
|
260
490
|
}
|
|
261
|
-
function
|
|
262
|
-
let n =
|
|
491
|
+
function H(e, t = /* @__PURE__ */ new Date()) {
|
|
492
|
+
let n = k(e), { start: r, end: i } = Ct(t);
|
|
263
493
|
return n >= r && n <= i;
|
|
264
494
|
}
|
|
265
|
-
function
|
|
266
|
-
let t =
|
|
267
|
-
return
|
|
495
|
+
function U(e) {
|
|
496
|
+
let t = k(e), n = (t.getDay() + 6) % 7;
|
|
497
|
+
return P(t, n === 6 ? 1 : -n);
|
|
268
498
|
}
|
|
269
|
-
function
|
|
270
|
-
let t =
|
|
499
|
+
function wt(e) {
|
|
500
|
+
let t = U(e);
|
|
271
501
|
return {
|
|
272
502
|
start: t,
|
|
273
|
-
end:
|
|
503
|
+
end: P(t, 5)
|
|
274
504
|
};
|
|
275
505
|
}
|
|
276
|
-
function
|
|
277
|
-
let t = typeof e == "string" ?
|
|
278
|
-
return Array.from({ length:
|
|
506
|
+
function Tt(e) {
|
|
507
|
+
let t = typeof e == "string" ? B(e) ?? U(/* @__PURE__ */ new Date()) : U(e);
|
|
508
|
+
return Array.from({ length: yt }, (e, n) => V(P(t, n)));
|
|
279
509
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
510
|
+
function W(e = /* @__PURE__ */ new Date()) {
|
|
511
|
+
return V(U(e));
|
|
282
512
|
}
|
|
283
|
-
function
|
|
284
|
-
let n =
|
|
285
|
-
if (!n || !
|
|
286
|
-
let r =
|
|
287
|
-
return
|
|
513
|
+
function Et(e, t = /* @__PURE__ */ new Date()) {
|
|
514
|
+
let n = B(e);
|
|
515
|
+
if (!n || !H(n, t)) return;
|
|
516
|
+
let r = U(n);
|
|
517
|
+
return H(r, t) ? V(r) : void 0;
|
|
288
518
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
519
|
+
function Dt(e, t = /* @__PURE__ */ new Date()) {
|
|
520
|
+
return Et(e, t) ?? W(t);
|
|
291
521
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
522
|
+
function Ot(e, t = /* @__PURE__ */ new Date()) {
|
|
523
|
+
return Dt(e, t) === W(t);
|
|
294
524
|
}
|
|
295
525
|
//#endregion
|
|
296
526
|
//#region src/formatters/date/formatInstantDateTime.ts
|
|
297
|
-
function
|
|
298
|
-
let n =
|
|
527
|
+
function kt(e, t) {
|
|
528
|
+
let n = l(e), r = t.fallback ?? "";
|
|
299
529
|
if (!n || n.kind !== "date-time") return r;
|
|
300
530
|
try {
|
|
301
531
|
return new Intl.DateTimeFormat(t.locale ?? "ru-RU", {
|
|
@@ -309,212 +539,32 @@ function Xe(e, t) {
|
|
|
309
539
|
}
|
|
310
540
|
//#endregion
|
|
311
541
|
//#region src/formatters/date/relativeRanges.ts
|
|
312
|
-
function
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
function Ze({ referenceDate: e }) {
|
|
316
|
-
let t = L(e), n = x(t), r = S(t, -1);
|
|
317
|
-
return [n, b(r < n ? n : r)];
|
|
318
|
-
}
|
|
319
|
-
function Qe({ referenceDate: e }) {
|
|
320
|
-
let t = L(e);
|
|
321
|
-
return [x(t), b(t)];
|
|
322
|
-
}
|
|
323
|
-
function $e({ referenceDate: e }) {
|
|
324
|
-
let t = L(e);
|
|
325
|
-
return [t, b(t)];
|
|
326
|
-
}
|
|
327
|
-
function et({ referenceDate: e }) {
|
|
328
|
-
let t = S(L(e), -1);
|
|
329
|
-
return [t, b(t)];
|
|
330
|
-
}
|
|
331
|
-
function tt({ referenceDate: e }) {
|
|
332
|
-
let t = L(e);
|
|
333
|
-
return [y(C(t, -1)), b(t)];
|
|
334
|
-
}
|
|
335
|
-
//#endregion
|
|
336
|
-
//#region src/formatters/number/compact.ts
|
|
337
|
-
var nt = [
|
|
338
|
-
{
|
|
339
|
-
value: 0xe8d4a51000,
|
|
340
|
-
suffix: "трлн"
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
value: 1e9,
|
|
344
|
-
suffix: "млрд"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
value: 1e6,
|
|
348
|
-
suffix: "млн"
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
value: 1e3,
|
|
352
|
-
suffix: "тыс"
|
|
353
|
-
}
|
|
354
|
-
], R = {
|
|
355
|
-
minCompactValue: 1e3,
|
|
356
|
-
roundingMode: "trunc",
|
|
357
|
-
suffixSeparator: " "
|
|
358
|
-
}, rt = ",";
|
|
359
|
-
function z(e, t) {
|
|
360
|
-
switch (t) {
|
|
361
|
-
case "round": return Math.round(e);
|
|
362
|
-
case "floor": return Math.floor(e);
|
|
363
|
-
case "ceil": return Math.ceil(e);
|
|
364
|
-
case "trunc": return Math.trunc(e);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
function it(e, t, n) {
|
|
368
|
-
if (t === 0) return z(e, n);
|
|
369
|
-
let r = 10 ** t;
|
|
370
|
-
return z(e * r, n) / r;
|
|
371
|
-
}
|
|
372
|
-
function at(e) {
|
|
373
|
-
return e >= 10 ? 0 : 1;
|
|
374
|
-
}
|
|
375
|
-
function ot(e, t) {
|
|
376
|
-
if (t === 0) return 0;
|
|
377
|
-
let n = e.toFixed(t), r = n.indexOf(".");
|
|
378
|
-
return r === -1 ? 0 : n.slice(r + 1).replace(/0+$/, "").length;
|
|
379
|
-
}
|
|
380
|
-
function st(e, t) {
|
|
381
|
-
return t.findIndex((t) => e >= t.value);
|
|
382
|
-
}
|
|
383
|
-
function ct(e, t) {
|
|
384
|
-
return {
|
|
385
|
-
name: e.name,
|
|
386
|
-
decimals: t,
|
|
387
|
-
decimalSeparator: t > 0 ? e.decimalSeparator || rt : e.decimalSeparator,
|
|
388
|
-
grouping: e.grouping,
|
|
389
|
-
groupingSeparator: e.groupingSeparator,
|
|
390
|
-
groupingSize: e.groupingSize
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
function B(e, t, n, r, i) {
|
|
394
|
-
let a = n.units[t];
|
|
395
|
-
if (!a) return i(e, r);
|
|
396
|
-
let o = e / a.value, s = n.maxDecimals ?? at(o), c = it(o, s, n.roundingMode);
|
|
397
|
-
return c >= 1e3 && t > 0 ? B(e, t - 1, n, r, i) : `${i(c, ct(r, ot(c, s)))}${n.suffixSeparator}${a.suffix}`;
|
|
398
|
-
}
|
|
399
|
-
function lt(e) {
|
|
400
|
-
let { minCompactValue: t = R.minCompactValue, roundingMode: n = R.roundingMode, suffixSeparator: r = R.suffixSeparator, maxDecimals: i, units: a = nt } = e.options, o = Math.abs(e.value);
|
|
401
|
-
if (o < t) return e.formatPlainNumber(e.value, e.preset);
|
|
402
|
-
let s = st(o, a);
|
|
403
|
-
return s === -1 ? e.formatPlainNumber(e.value, e.preset) : `${e.value < 0 ? "-" : ""}${B(o, s, {
|
|
404
|
-
roundingMode: n,
|
|
405
|
-
suffixSeparator: r,
|
|
406
|
-
maxDecimals: i,
|
|
407
|
-
units: a
|
|
408
|
-
}, e.preset, e.formatPlainNumber)}`;
|
|
409
|
-
}
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/formatters/number/isZeroValue.ts
|
|
412
|
-
function V(e) {
|
|
413
|
-
let t = o(e);
|
|
414
|
-
return typeof t == "number" ? t === 0 : typeof t == "bigint" && t === 0n;
|
|
415
|
-
}
|
|
416
|
-
//#endregion
|
|
417
|
-
//#region src/formatters/number/formatNumber.ts
|
|
418
|
-
var H = /* @__PURE__ */ new Map();
|
|
419
|
-
function ut(e, t) {
|
|
420
|
-
if (t === 0) return Math.trunc(e);
|
|
421
|
-
let n = 10 ** t;
|
|
422
|
-
return Math.trunc(e * n) / n;
|
|
423
|
-
}
|
|
424
|
-
function U(e, t) {
|
|
425
|
-
let n = `${e}:${+!!t}`, r = H.get(n);
|
|
426
|
-
return r || (r = new Intl.NumberFormat("ru-RU", {
|
|
427
|
-
minimumFractionDigits: e,
|
|
428
|
-
maximumFractionDigits: e,
|
|
429
|
-
useGrouping: t
|
|
430
|
-
}), H.set(n, r)), r;
|
|
431
|
-
}
|
|
432
|
-
function dt(e) {
|
|
433
|
-
return e.groupingSize === 3 && (e.groupingSeparator === f.groupingSeparator || !e.grouping) && (e.decimalSeparator === "," || e.decimals === 0);
|
|
434
|
-
}
|
|
435
|
-
function ft(e, t, n) {
|
|
436
|
-
return U(t, n).format(e);
|
|
437
|
-
}
|
|
438
|
-
function pt(e, t) {
|
|
439
|
-
let n = U(t.decimals, t.grouping).formatToParts(e), r = "";
|
|
440
|
-
for (let e of n) e.type === "group" ? r += t.groupingSeparator : e.type === "decimal" ? r += t.decimalSeparator : r += e.value;
|
|
441
|
-
return r;
|
|
442
|
-
}
|
|
443
|
-
function mt(e, t) {
|
|
444
|
-
let n = U(t.decimals, !1).format(e), r = n.indexOf(","), i = r === -1 ? n : n.slice(0, r), a = r === -1 ? null : n.slice(r + 1), o = i.startsWith("-"), s = o ? i.slice(1) : i, c = t.groupingSize, l = [];
|
|
445
|
-
for (let e = s.length; e > 0; e -= c) l.unshift(s.slice(Math.max(0, e - c), e));
|
|
446
|
-
let u = (o ? "-" : "") + l.join(t.groupingSeparator);
|
|
447
|
-
return a !== null && (u += t.decimalSeparator + a), u;
|
|
448
|
-
}
|
|
449
|
-
function ht(e, t) {
|
|
450
|
-
return dt(t) ? ft(e, t.decimals, t.grouping) : t.groupingSize === 3 || !t.grouping ? pt(e, t) : mt(e, t);
|
|
451
|
-
}
|
|
452
|
-
function W(e, t) {
|
|
453
|
-
if (typeof e == "string" && e.trim() === "") return "0";
|
|
454
|
-
let n = Number(e);
|
|
455
|
-
if (!Number.isFinite(n)) return "0";
|
|
456
|
-
let r = d(t);
|
|
457
|
-
return r.compact ? lt({
|
|
458
|
-
value: n,
|
|
459
|
-
preset: r,
|
|
460
|
-
options: r.compact,
|
|
461
|
-
formatPlainNumber: ht
|
|
462
|
-
}) : ht(n, r);
|
|
463
|
-
}
|
|
464
|
-
function gt(e) {
|
|
465
|
-
return W(e, m.integer);
|
|
466
|
-
}
|
|
467
|
-
function _t(e) {
|
|
468
|
-
return W(e, m.currency);
|
|
469
|
-
}
|
|
470
|
-
function vt(e) {
|
|
471
|
-
return W(e, m.decimal);
|
|
472
|
-
}
|
|
473
|
-
function yt(e) {
|
|
474
|
-
return W(e, m.decimal2);
|
|
475
|
-
}
|
|
476
|
-
function bt(e) {
|
|
477
|
-
return W(e, m.decimal3);
|
|
478
|
-
}
|
|
479
|
-
function xt(e) {
|
|
480
|
-
return W(e, m.percent);
|
|
481
|
-
}
|
|
482
|
-
function St(e) {
|
|
483
|
-
return W(e, m.price);
|
|
484
|
-
}
|
|
485
|
-
function Ct(e) {
|
|
486
|
-
return W(e, m.tonnage);
|
|
487
|
-
}
|
|
488
|
-
function wt(e) {
|
|
489
|
-
return V(e) ? "" : W(e, m.integer);
|
|
490
|
-
}
|
|
491
|
-
function Tt(e) {
|
|
492
|
-
return V(e) ? "" : W(e, m.currency);
|
|
493
|
-
}
|
|
494
|
-
function Et(e) {
|
|
495
|
-
return V(e) ? "" : W(e, m.decimal);
|
|
496
|
-
}
|
|
497
|
-
function Dt(e) {
|
|
498
|
-
return V(e) ? "" : W(e, m.decimal2);
|
|
542
|
+
function G(e) {
|
|
543
|
+
return k(e);
|
|
499
544
|
}
|
|
500
|
-
function
|
|
501
|
-
|
|
545
|
+
function At({ referenceDate: e }) {
|
|
546
|
+
let t = G(e), n = j(t), r = P(t, -1);
|
|
547
|
+
return [n, A(r < n ? n : r)];
|
|
502
548
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
549
|
+
function jt({ referenceDate: e }) {
|
|
550
|
+
let t = G(e);
|
|
551
|
+
return [j(t), A(t)];
|
|
505
552
|
}
|
|
506
|
-
function
|
|
507
|
-
|
|
553
|
+
function Mt({ referenceDate: e }) {
|
|
554
|
+
let t = G(e);
|
|
555
|
+
return [t, A(t)];
|
|
508
556
|
}
|
|
509
|
-
function
|
|
510
|
-
|
|
557
|
+
function Nt({ referenceDate: e }) {
|
|
558
|
+
let t = P(G(e), -1);
|
|
559
|
+
return [t, A(t)];
|
|
511
560
|
}
|
|
512
|
-
function
|
|
513
|
-
|
|
561
|
+
function Pt({ referenceDate: e }) {
|
|
562
|
+
let t = G(e);
|
|
563
|
+
return [k(Ze(t, -1)), A(t)];
|
|
514
564
|
}
|
|
515
565
|
//#endregion
|
|
516
566
|
//#region src/formatters/normalizeLeadingZeros.ts
|
|
517
|
-
function
|
|
567
|
+
function Ft(e, t) {
|
|
518
568
|
let n = typeof e == "number" ? e : Number(e);
|
|
519
569
|
if (!Number.isFinite(n)) return e;
|
|
520
570
|
let r = String(n);
|
|
@@ -528,11 +578,11 @@ function Nt(e, t) {
|
|
|
528
578
|
}
|
|
529
579
|
return r;
|
|
530
580
|
}
|
|
531
|
-
function
|
|
581
|
+
function It(e, t) {
|
|
532
582
|
if (!t || !Number.isFinite(t)) return e;
|
|
533
583
|
if (typeof e == "number") {
|
|
534
584
|
if (!Number.isFinite(e)) return e;
|
|
535
|
-
let n =
|
|
585
|
+
let n = Lt(String(e), t), r = Number(n);
|
|
536
586
|
return Number.isFinite(r) ? r : e;
|
|
537
587
|
}
|
|
538
588
|
if (typeof e == "string") {
|
|
@@ -544,11 +594,11 @@ function Pt(e, t) {
|
|
|
544
594
|
break;
|
|
545
595
|
}
|
|
546
596
|
}
|
|
547
|
-
return !n || o(e) === void 0 ? e :
|
|
597
|
+
return !n || o(e) === void 0 ? e : Lt(e, t);
|
|
548
598
|
}
|
|
549
599
|
return e;
|
|
550
600
|
}
|
|
551
|
-
function
|
|
601
|
+
function Lt(e, t) {
|
|
552
602
|
let n = e.trim();
|
|
553
603
|
if (!n) return e;
|
|
554
604
|
let r = 0, i = "", a = n.charCodeAt(0);
|
|
@@ -562,7 +612,7 @@ function Ft(e, t) {
|
|
|
562
612
|
}
|
|
563
613
|
}
|
|
564
614
|
let s = o === -1 ? n.length : o, c = o === -1 ? "" : n.slice(o), l = n.slice(r, s);
|
|
565
|
-
l =
|
|
615
|
+
l = _(l), l.length === 0 && (l = "0");
|
|
566
616
|
let u = t | 0;
|
|
567
617
|
if (u <= 0) {
|
|
568
618
|
let e = 0;
|
|
@@ -576,7 +626,7 @@ function Ft(e, t) {
|
|
|
576
626
|
}
|
|
577
627
|
//#endregion
|
|
578
628
|
//#region src/formatters/pipeline/dependencies.ts
|
|
579
|
-
function
|
|
629
|
+
function Rt(e) {
|
|
580
630
|
let n = h(e);
|
|
581
631
|
if (!n.ok || !n.plan) return [];
|
|
582
632
|
let r = [], i = /* @__PURE__ */ new Set();
|
|
@@ -595,7 +645,7 @@ function It(e) {
|
|
|
595
645
|
}
|
|
596
646
|
return r;
|
|
597
647
|
}
|
|
598
|
-
function
|
|
648
|
+
function zt(e, n) {
|
|
599
649
|
let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = (e) => {
|
|
600
650
|
let s = e?.trim();
|
|
601
651
|
if (s) {
|
|
@@ -610,7 +660,7 @@ function Lt(e, n) {
|
|
|
610
660
|
let e = n[t];
|
|
611
661
|
if (e) {
|
|
612
662
|
for (let t of Object.values(e.cellRenderer?.bindings ?? {})) s(t);
|
|
613
|
-
for (let t of
|
|
663
|
+
for (let t of Rt(e.formattersPipeline)) s(t);
|
|
614
664
|
}
|
|
615
665
|
}
|
|
616
666
|
return {
|
|
@@ -620,47 +670,47 @@ function Lt(e, n) {
|
|
|
620
670
|
}
|
|
621
671
|
//#endregion
|
|
622
672
|
//#region src/formatters/valueState/valueStateRegistry.ts
|
|
623
|
-
var
|
|
624
|
-
function
|
|
673
|
+
var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
|
|
674
|
+
function Bt(e) {
|
|
625
675
|
let t = 5381;
|
|
626
676
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) >>> 0;
|
|
627
677
|
return "id_" + t.toString(36);
|
|
628
678
|
}
|
|
629
|
-
function
|
|
630
|
-
let n =
|
|
679
|
+
function J(e, t) {
|
|
680
|
+
let n = q.get(e);
|
|
631
681
|
if (n) return {
|
|
632
682
|
id: n,
|
|
633
683
|
isNew: !1
|
|
634
684
|
};
|
|
635
|
-
let r =
|
|
636
|
-
return
|
|
685
|
+
let r = Bt(e), i = t();
|
|
686
|
+
return K.set(r, i), q.set(e, r), {
|
|
637
687
|
id: r,
|
|
638
688
|
isNew: !0
|
|
639
689
|
};
|
|
640
690
|
}
|
|
641
|
-
function
|
|
642
|
-
let t =
|
|
643
|
-
if (t) return
|
|
691
|
+
function Y(e) {
|
|
692
|
+
let t = q.get(e);
|
|
693
|
+
if (t) return K.get(t);
|
|
644
694
|
}
|
|
645
|
-
function
|
|
646
|
-
let n =
|
|
695
|
+
function X(e, t) {
|
|
696
|
+
let n = K.get(e);
|
|
647
697
|
return n ? n(t) : "none";
|
|
648
698
|
}
|
|
649
|
-
function
|
|
650
|
-
return
|
|
699
|
+
function Vt(e) {
|
|
700
|
+
return K.get(e);
|
|
651
701
|
}
|
|
652
|
-
function
|
|
653
|
-
return Array.from(
|
|
702
|
+
function Ht() {
|
|
703
|
+
return Array.from(K.keys());
|
|
654
704
|
}
|
|
655
|
-
function
|
|
656
|
-
|
|
705
|
+
function Ut() {
|
|
706
|
+
K.clear(), q.clear();
|
|
657
707
|
}
|
|
658
708
|
//#endregion
|
|
659
709
|
//#region src/formatters/valueState/fixedValueStateResolver.ts
|
|
660
|
-
function
|
|
710
|
+
function Wt(e, t) {
|
|
661
711
|
return `fixed|${e.map(([e, t]) => `${e}:${t}`).join(",")}|${t}`;
|
|
662
712
|
}
|
|
663
|
-
function
|
|
713
|
+
function Gt(e, t) {
|
|
664
714
|
let n = new Map(Object.entries(e));
|
|
665
715
|
return (e) => {
|
|
666
716
|
if (e == null) return t;
|
|
@@ -668,25 +718,25 @@ function Ut(e, t) {
|
|
|
668
718
|
return n.get(r) ?? t;
|
|
669
719
|
};
|
|
670
720
|
}
|
|
671
|
-
function
|
|
672
|
-
let t = e.fallbackState ?? "none", n =
|
|
721
|
+
function Kt(e) {
|
|
722
|
+
let t = e.fallbackState ?? "none", n = Wt(Object.entries(e.entries).sort(([e], [t]) => ae(e, t)), t);
|
|
673
723
|
return {
|
|
674
724
|
entries: e.entries,
|
|
675
725
|
fallbackState: t,
|
|
676
726
|
canonicalKey: n
|
|
677
727
|
};
|
|
678
728
|
}
|
|
679
|
-
function
|
|
680
|
-
let { entries: t, fallbackState: n, canonicalKey: r } =
|
|
729
|
+
function qt(e) {
|
|
730
|
+
let { entries: t, fallbackState: n, canonicalKey: r } = Kt(e), { id: i } = J(r, () => Gt(t, n));
|
|
681
731
|
return i;
|
|
682
732
|
}
|
|
683
|
-
function
|
|
684
|
-
let { entries: t, fallbackState: n, canonicalKey: r } =
|
|
685
|
-
return
|
|
733
|
+
function Jt(e) {
|
|
734
|
+
let { entries: t, fallbackState: n, canonicalKey: r } = Kt(e);
|
|
735
|
+
return Y(r) || (J(r, () => Gt(t, n)), Y(r));
|
|
686
736
|
}
|
|
687
737
|
//#endregion
|
|
688
738
|
//#region src/formatters/valueState/thresholdValueStateResolver.ts
|
|
689
|
-
function
|
|
739
|
+
function Yt(e) {
|
|
690
740
|
return typeof e == "number" ? {
|
|
691
741
|
value: e,
|
|
692
742
|
boundary: "upper"
|
|
@@ -695,15 +745,15 @@ function qt(e) {
|
|
|
695
745
|
boundary: e.boundary ?? "upper"
|
|
696
746
|
};
|
|
697
747
|
}
|
|
698
|
-
function
|
|
748
|
+
function Xt(e, t, n) {
|
|
699
749
|
return `threshold|${e.map((e) => `${e.value}:${e.boundary}`).join(",")}|${t.join(",")}|${n}`;
|
|
700
750
|
}
|
|
701
|
-
function
|
|
751
|
+
function Zt(e, t) {
|
|
702
752
|
if (t.length !== e.length + 1) throw Error(`Количество состояний (${t.length}) должно быть равно количеству порогов + 1 (${e.length + 1})`);
|
|
703
753
|
let n = /* @__PURE__ */ new Set();
|
|
704
754
|
for (let t of e) n.has(t.value) && console.warn(`Дублирующееся пороговое значение: ${t.value}`), n.add(t.value);
|
|
705
755
|
}
|
|
706
|
-
function
|
|
756
|
+
function Qt(e, t, n) {
|
|
707
757
|
let r = e.map((e) => e.value), i = e.map((e) => e.boundary === "lower"), a = [...t];
|
|
708
758
|
return (e) => {
|
|
709
759
|
if (e === "" || e == null) return n;
|
|
@@ -713,46 +763,46 @@ function Xt(e, t, n) {
|
|
|
713
763
|
return a[a.length - 1];
|
|
714
764
|
};
|
|
715
765
|
}
|
|
716
|
-
function
|
|
717
|
-
let t = e.invalidState ?? "none", n = e.thresholds.map(
|
|
718
|
-
return
|
|
766
|
+
function $t(e) {
|
|
767
|
+
let t = e.invalidState ?? "none", n = e.thresholds.map(Yt).sort((e, t) => e.value - t.value);
|
|
768
|
+
return Zt(n, e.states), {
|
|
719
769
|
sortedThresholds: n,
|
|
720
770
|
invalidState: t,
|
|
721
|
-
canonicalKey:
|
|
771
|
+
canonicalKey: Xt(n, e.states, t),
|
|
722
772
|
states: e.states
|
|
723
773
|
};
|
|
724
774
|
}
|
|
725
|
-
function
|
|
726
|
-
let { sortedThresholds: t, invalidState: n, canonicalKey: r, states: i } =
|
|
775
|
+
function en(e) {
|
|
776
|
+
let { sortedThresholds: t, invalidState: n, canonicalKey: r, states: i } = $t(e), { id: a } = J(r, () => Qt(t, i, n));
|
|
727
777
|
return a;
|
|
728
778
|
}
|
|
729
|
-
function
|
|
730
|
-
let { sortedThresholds: t, invalidState: n, canonicalKey: r, states: i } =
|
|
731
|
-
return
|
|
779
|
+
function tn(e) {
|
|
780
|
+
let { sortedThresholds: t, invalidState: n, canonicalKey: r, states: i } = $t(e);
|
|
781
|
+
return Y(r) || (J(r, () => Qt(t, i, n)), Y(r));
|
|
732
782
|
}
|
|
733
783
|
//#endregion
|
|
734
784
|
//#region src/formatters/pipeline/execute.ts
|
|
735
|
-
var
|
|
785
|
+
var nn = Object.freeze({
|
|
736
786
|
number: "decimal",
|
|
737
787
|
date: "date"
|
|
738
788
|
});
|
|
739
|
-
function
|
|
789
|
+
function Z(e, t, r) {
|
|
740
790
|
if (!oe(e)) return "";
|
|
741
|
-
let i =
|
|
791
|
+
let i = s(t.type);
|
|
742
792
|
if (i === "number") {
|
|
743
793
|
let t = r?.numberPresetName?.trim();
|
|
744
|
-
return
|
|
794
|
+
return w(e, t && ie(t) ? t : nn.number);
|
|
745
795
|
}
|
|
746
796
|
if (i === "date") {
|
|
747
|
-
let t = r?.datePresetName?.trim(), n = t &&
|
|
748
|
-
return a(
|
|
797
|
+
let t = r?.datePresetName?.trim(), n = t && u(t) ? t : nn.date;
|
|
798
|
+
return a(c(e), n);
|
|
749
799
|
}
|
|
750
800
|
return n(e);
|
|
751
801
|
}
|
|
752
|
-
function
|
|
802
|
+
function rn(e) {
|
|
753
803
|
if (e === "success" || e === "warning" || e === "error" || e === "information") return e;
|
|
754
804
|
}
|
|
755
|
-
function
|
|
805
|
+
function an(e, t) {
|
|
756
806
|
switch (e.rowKind) {
|
|
757
807
|
case "group":
|
|
758
808
|
case "plain":
|
|
@@ -760,7 +810,7 @@ function nn(e, t) {
|
|
|
760
810
|
case "totals": return t === "formula";
|
|
761
811
|
}
|
|
762
812
|
}
|
|
763
|
-
function
|
|
813
|
+
function on(e) {
|
|
764
814
|
let t = h(e.config);
|
|
765
815
|
if (!t.ok || !t.plan) return t.errors.some((e) => e.code === "step_value_state_formula_not_found") ? {
|
|
766
816
|
ok: !1,
|
|
@@ -772,7 +822,7 @@ function Z(e) {
|
|
|
772
822
|
ok: !1,
|
|
773
823
|
reason: "pipeline_invalid"
|
|
774
824
|
};
|
|
775
|
-
let { steps: n } = t.plan,
|
|
825
|
+
let { steps: n } = t.plan, i = n.some((e) => e.type === "rowBasedOverride"), a = n.some((e) => e.type === "typedValueFormat"), o = n.find((e) => e.type === "resolveValueState"), s = o?.config.valueSource, c = s?.kind === "formula" ? r({
|
|
776
826
|
formulaId: s.formulaId,
|
|
777
827
|
keys: s.dependencyIds
|
|
778
828
|
}) : void 0;
|
|
@@ -780,10 +830,10 @@ function Z(e) {
|
|
|
780
830
|
ok: !1,
|
|
781
831
|
reason: "value_state_formula_not_found"
|
|
782
832
|
};
|
|
783
|
-
let l = o?.config.resolver.kind === "fixed" ?
|
|
833
|
+
let l = o?.config.resolver.kind === "fixed" ? qt({
|
|
784
834
|
entries: o.config.resolver.entries,
|
|
785
835
|
fallbackState: o.config.resolver.fallbackState
|
|
786
|
-
}) : o?.config.resolver.kind === "threshold" ?
|
|
836
|
+
}) : o?.config.resolver.kind === "threshold" ? en({
|
|
787
837
|
thresholds: o.config.resolver.thresholds,
|
|
788
838
|
states: o.config.resolver.states,
|
|
789
839
|
invalidState: o.config.resolver.invalidState
|
|
@@ -794,16 +844,16 @@ function Z(e) {
|
|
|
794
844
|
} : {
|
|
795
845
|
ok: !0,
|
|
796
846
|
executor: {
|
|
797
|
-
hasRowBasedOverride:
|
|
847
|
+
hasRowBasedOverride: i,
|
|
798
848
|
hasTypedValueFormat: a,
|
|
799
849
|
execute: (t) => {
|
|
800
850
|
let r = t.value, i = "none", o = !1, u = !0, f = "left", p;
|
|
801
851
|
for (let a of n) switch (a.type) {
|
|
802
852
|
case "normalizeLeadingZeros":
|
|
803
|
-
r =
|
|
853
|
+
r = Ft(r, a.config?.fixed);
|
|
804
854
|
break;
|
|
805
855
|
case "rowBasedOverride":
|
|
806
|
-
if (!
|
|
856
|
+
if (!an(t, a.config.mode)) break;
|
|
807
857
|
if (a.config.mode === "field") {
|
|
808
858
|
let e = t.rowData[a.config.fieldKey];
|
|
809
859
|
if (e == null && a.config.fallbackToRaw !== !1) break;
|
|
@@ -828,11 +878,11 @@ function Z(e) {
|
|
|
828
878
|
if (!l) break;
|
|
829
879
|
if (s?.kind === "formula") {
|
|
830
880
|
let e = t.valueStateFormulaRowData ?? t.rowData, n = s.dependencyIds.every((t) => Object.hasOwn(e, t) && e[t] != null && (typeof e[t] != "string" || e[t].trim() !== "")) && c?.ok ? c.execute(e) : void 0;
|
|
831
|
-
i = n?.ok ?
|
|
832
|
-
} else i =
|
|
833
|
-
o = a.config.icon?.enabled ?? !1, u = a.config.icon?.showValue ?? !0, f = a.config.icon?.position ?? "left", p = o ?
|
|
881
|
+
i = n?.ok ? X(l, n.value) : "none";
|
|
882
|
+
} else i = X(l, r);
|
|
883
|
+
o = a.config.icon?.enabled ?? !1, u = a.config.icon?.showValue ?? !0, f = a.config.icon?.position ?? "left", p = o ? rn(i) : void 0, s?.kind === "formula" && i === "none" && (o = !1);
|
|
834
884
|
break;
|
|
835
|
-
case "typedValueFormat": r =
|
|
885
|
+
case "typedValueFormat": r = Z(r, e.column, a.config);
|
|
836
886
|
}
|
|
837
887
|
return {
|
|
838
888
|
value: r,
|
|
@@ -849,7 +899,7 @@ function Z(e) {
|
|
|
849
899
|
}
|
|
850
900
|
//#endregion
|
|
851
901
|
//#region src/formatters/pipeline/normalize.ts
|
|
852
|
-
var
|
|
902
|
+
var sn = [
|
|
853
903
|
"",
|
|
854
904
|
"none",
|
|
855
905
|
"information",
|
|
@@ -858,55 +908,55 @@ var rn = [
|
|
|
858
908
|
"error"
|
|
859
909
|
];
|
|
860
910
|
function Q(e) {
|
|
861
|
-
return typeof e == "string" &&
|
|
911
|
+
return typeof e == "string" && sn.some((t) => t === e);
|
|
862
912
|
}
|
|
863
913
|
function $(e) {
|
|
864
914
|
return e === void 0 || typeof e == "boolean";
|
|
865
915
|
}
|
|
866
|
-
function an(e) {
|
|
867
|
-
return e === void 0 || typeof e == "string";
|
|
868
|
-
}
|
|
869
|
-
function on(e) {
|
|
870
|
-
return e === void 0 ? !0 : r(e) ? an(e.numberPresetName) && an(e.datePresetName) : !1;
|
|
871
|
-
}
|
|
872
|
-
function sn(e) {
|
|
873
|
-
return r(e) ? e.mode === "field" ? typeof e.fieldKey == "string" && $(e.fallbackToRaw) : e.mode === "formula" && typeof e.formulaId == "string" && (e.dependencyIds === void 0 || Array.isArray(e.dependencyIds) && e.dependencyIds.every((e) => typeof e == "string")) && $(e.fallbackToRaw) : !1;
|
|
874
|
-
}
|
|
875
916
|
function cn(e) {
|
|
876
|
-
return
|
|
917
|
+
return e === void 0 || typeof e == "string";
|
|
877
918
|
}
|
|
878
919
|
function ln(e) {
|
|
879
|
-
|
|
880
|
-
let { resolver: t, icon: n } = e, i = e.valueSource, a = i === void 0 || r(i) && (i.kind === "value" || i.kind === "formula" && typeof i.formulaId == "string" && Array.isArray(i.dependencyIds) && i.dependencyIds.every((e) => typeof e == "string"));
|
|
881
|
-
return !(n === void 0 || r(n) && $(n.enabled) && $(n.showValue) && (n.position === void 0 || n.position === "left" || n.position === "right")) || !a ? !1 : t.kind === "fixed" ? r(t.entries) && Object.values(t.entries).every(Q) && (t.fallbackState === void 0 || Q(t.fallbackState)) : t.kind === "threshold" && Array.isArray(t.thresholds) && t.thresholds.every(cn) && Array.isArray(t.states) && t.states.every(Q) && (t.invalidState === void 0 || Q(t.invalidState));
|
|
920
|
+
return e === void 0 ? !0 : i(e) ? cn(e.numberPresetName) && cn(e.datePresetName) : !1;
|
|
882
921
|
}
|
|
883
922
|
function un(e) {
|
|
884
|
-
return
|
|
923
|
+
return i(e) ? e.mode === "field" ? typeof e.fieldKey == "string" && $(e.fallbackToRaw) : e.mode === "formula" && typeof e.formulaId == "string" && (e.dependencyIds === void 0 || Array.isArray(e.dependencyIds) && e.dependencyIds.every((e) => typeof e == "string")) && $(e.fallbackToRaw) : !1;
|
|
885
924
|
}
|
|
886
925
|
function dn(e) {
|
|
887
|
-
return
|
|
926
|
+
return typeof e == "number" || i(e) && typeof e.value == "number" && (e.boundary === void 0 || e.boundary === "lower" || e.boundary === "upper");
|
|
888
927
|
}
|
|
889
928
|
function fn(e) {
|
|
890
|
-
|
|
929
|
+
if (!i(e) || !i(e.resolver)) return !1;
|
|
930
|
+
let { resolver: t, icon: n } = e, r = e.valueSource, a = r === void 0 || i(r) && (r.kind === "value" || r.kind === "formula" && typeof r.formulaId == "string" && Array.isArray(r.dependencyIds) && r.dependencyIds.every((e) => typeof e == "string"));
|
|
931
|
+
return !(n === void 0 || i(n) && $(n.enabled) && $(n.showValue) && (n.position === void 0 || n.position === "left" || n.position === "right")) || !a ? !1 : t.kind === "fixed" ? i(t.entries) && Object.values(t.entries).every(Q) && (t.fallbackState === void 0 || Q(t.fallbackState)) : t.kind === "threshold" && Array.isArray(t.thresholds) && t.thresholds.every(dn) && Array.isArray(t.states) && t.states.every(Q) && (t.invalidState === void 0 || Q(t.invalidState));
|
|
891
932
|
}
|
|
892
933
|
function pn(e) {
|
|
893
|
-
return !
|
|
934
|
+
return !i(e) || typeof e.id != "string" ? !1 : e.type === "normalizeLeadingZeros" ? e.config === void 0 || i(e.config) && (e.config.fixed === void 0 || typeof e.config.fixed == "number") : e.type === "rowBasedOverride" ? un(e.config) : e.type === "resolveValueState" ? fn(e.config) : e.type === "typedValueFormat" && ln(e.config);
|
|
894
935
|
}
|
|
895
936
|
function mn(e) {
|
|
896
|
-
return
|
|
937
|
+
return i(e) && Array.isArray(e.steps) && e.steps.every(pn);
|
|
897
938
|
}
|
|
898
939
|
function hn(e) {
|
|
899
|
-
return
|
|
940
|
+
return i(e) && typeof e.x == "number" && typeof e.y == "number";
|
|
900
941
|
}
|
|
901
942
|
function gn(e) {
|
|
902
|
-
return
|
|
943
|
+
return !i(e) || typeof e.id != "string" || !hn(e.position) ? !1 : e.type === "source" || e.type === "sink" || pn(e);
|
|
903
944
|
}
|
|
904
945
|
function _n(e) {
|
|
905
|
-
|
|
946
|
+
return i(e) && typeof e.id == "string" && typeof e.source == "string" && typeof e.target == "string";
|
|
947
|
+
}
|
|
948
|
+
function vn(e) {
|
|
949
|
+
return i(e) && Array.isArray(e.nodes) && e.nodes.every(gn) && Array.isArray(e.edges) && e.edges.every(_n);
|
|
950
|
+
}
|
|
951
|
+
function yn(e) {
|
|
952
|
+
return i(e) && e.version === 1 && (e.plan === void 0 || mn(e.plan)) && (e.graph === void 0 || vn(e.graph)) && (mn(e.plan) || vn(e.graph));
|
|
953
|
+
}
|
|
954
|
+
function bn(e) {
|
|
955
|
+
if (yn(e) && h(e).ok) return p(e);
|
|
906
956
|
}
|
|
907
957
|
//#endregion
|
|
908
958
|
//#region src/formatters/pipeline/definitions.ts
|
|
909
|
-
var
|
|
959
|
+
var xn = Object.freeze([
|
|
910
960
|
{
|
|
911
961
|
id: "normalizeLeadingZeros",
|
|
912
962
|
name: "Нормализация ведущих нулей",
|
|
@@ -927,19 +977,19 @@ var vn = Object.freeze([
|
|
|
927
977
|
name: "Типизированное форматирование",
|
|
928
978
|
description: "Формирует итоговый внешний вид значения по типу и роли столбца."
|
|
929
979
|
}
|
|
930
|
-
]),
|
|
931
|
-
function
|
|
932
|
-
return
|
|
980
|
+
]), Sn = new Map(xn.map((e) => [e.id, e]));
|
|
981
|
+
function Cn() {
|
|
982
|
+
return xn;
|
|
933
983
|
}
|
|
934
|
-
function
|
|
935
|
-
return
|
|
984
|
+
function wn(e) {
|
|
985
|
+
return Sn.get(e);
|
|
936
986
|
}
|
|
937
987
|
//#endregion
|
|
938
988
|
//#region src/formatters/pipeline/rekey.ts
|
|
939
|
-
function
|
|
989
|
+
function Tn(e) {
|
|
940
990
|
return e.type === "source" || e.type === "sink";
|
|
941
991
|
}
|
|
942
|
-
function
|
|
992
|
+
function En(e, t) {
|
|
943
993
|
switch (e.type) {
|
|
944
994
|
case "source":
|
|
945
995
|
case "sink": return {
|
|
@@ -976,21 +1026,21 @@ function Cn(e, t) {
|
|
|
976
1026
|
};
|
|
977
1027
|
}
|
|
978
1028
|
}
|
|
979
|
-
function
|
|
1029
|
+
function Dn(e, t) {
|
|
980
1030
|
let n = /* @__PURE__ */ new Map();
|
|
981
|
-
for (let r of e.nodes) n.set(r.id,
|
|
1031
|
+
for (let r of e.nodes) n.set(r.id, Tn(r) ? r.id : t());
|
|
982
1032
|
let r = e.edges.map((e) => ({
|
|
983
1033
|
id: t(),
|
|
984
1034
|
source: n.get(e.source) ?? e.source,
|
|
985
1035
|
target: n.get(e.target) ?? e.target
|
|
986
1036
|
}));
|
|
987
1037
|
return {
|
|
988
|
-
nodes: e.nodes.map((e) =>
|
|
1038
|
+
nodes: e.nodes.map((e) => En(e, n.get(e.id) ?? e.id)),
|
|
989
1039
|
edges: r,
|
|
990
1040
|
viewport: e.viewport ? { ...e.viewport } : void 0
|
|
991
1041
|
};
|
|
992
1042
|
}
|
|
993
|
-
function
|
|
1043
|
+
function On(e, t) {
|
|
994
1044
|
return { steps: e.steps.map((e) => {
|
|
995
1045
|
switch (e.type) {
|
|
996
1046
|
case "typedValueFormat": return {
|
|
@@ -1019,22 +1069,22 @@ function Tn(e, t) {
|
|
|
1019
1069
|
}
|
|
1020
1070
|
}) };
|
|
1021
1071
|
}
|
|
1022
|
-
function
|
|
1072
|
+
function kn(e, t = se) {
|
|
1023
1073
|
if (!e) return;
|
|
1024
|
-
let n = e.graph ?
|
|
1074
|
+
let n = e.graph ? Dn(e.graph, t) : void 0, r = n ? te(n) : void 0;
|
|
1025
1075
|
return {
|
|
1026
1076
|
version: e.version,
|
|
1027
1077
|
graph: n,
|
|
1028
|
-
plan: r?.ok && r.plan ? r.plan : e.plan ?
|
|
1078
|
+
plan: r?.ok && r.plan ? r.plan : e.plan ? On(e.plan, t) : void 0
|
|
1029
1079
|
};
|
|
1030
1080
|
}
|
|
1031
1081
|
//#endregion
|
|
1032
1082
|
//#region src/formatters/pipeline/runtime.ts
|
|
1033
|
-
var
|
|
1083
|
+
var An = () => ({
|
|
1034
1084
|
ok: !1,
|
|
1035
1085
|
reason: "formula_not_found"
|
|
1036
1086
|
});
|
|
1037
|
-
function
|
|
1087
|
+
function jn(e, t) {
|
|
1038
1088
|
return {
|
|
1039
1089
|
value: e,
|
|
1040
1090
|
state: "none",
|
|
@@ -1044,18 +1094,18 @@ function On(e, t) {
|
|
|
1044
1094
|
overflowTooltip: t
|
|
1045
1095
|
};
|
|
1046
1096
|
}
|
|
1047
|
-
function
|
|
1048
|
-
return t ?
|
|
1097
|
+
function Mn(e, t) {
|
|
1098
|
+
return t ? Z(e, t) : n(e);
|
|
1049
1099
|
}
|
|
1050
|
-
function
|
|
1100
|
+
function Nn(e) {
|
|
1051
1101
|
if (!e.formulaId) return;
|
|
1052
|
-
let t =
|
|
1102
|
+
let t = r({
|
|
1053
1103
|
formulaId: e.formulaId,
|
|
1054
1104
|
keys: e.formulaDependencies
|
|
1055
1105
|
});
|
|
1056
|
-
return t.ok ? t.execute :
|
|
1106
|
+
return t.ok ? t.execute : An;
|
|
1057
1107
|
}
|
|
1058
|
-
function
|
|
1108
|
+
function Pn(e, t, n) {
|
|
1059
1109
|
if (!n.formulaId) return {
|
|
1060
1110
|
value: e,
|
|
1061
1111
|
shouldRenderEmpty: !1
|
|
@@ -1073,9 +1123,9 @@ function jn(e, t, n) {
|
|
|
1073
1123
|
shouldRenderEmpty: n.purelyDerived === !0
|
|
1074
1124
|
};
|
|
1075
1125
|
}
|
|
1076
|
-
function
|
|
1126
|
+
function Fn(e, t, n) {
|
|
1077
1127
|
let r = n.formattersPipelineExecutor;
|
|
1078
|
-
if (!r) return
|
|
1128
|
+
if (!r) return jn(Mn(t, n), n.overflowTooltip === !0);
|
|
1079
1129
|
let i = r.execute({
|
|
1080
1130
|
value: t,
|
|
1081
1131
|
rowData: e.rowData,
|
|
@@ -1088,7 +1138,7 @@ function Mn(e, t, n) {
|
|
|
1088
1138
|
columnId: n.id
|
|
1089
1139
|
});
|
|
1090
1140
|
return {
|
|
1091
|
-
value: i.hasTypedValueFormat ? i.value :
|
|
1141
|
+
value: i.hasTypedValueFormat ? i.value : Mn(i.value, n),
|
|
1092
1142
|
state: i.state,
|
|
1093
1143
|
icon: i.icon,
|
|
1094
1144
|
showIcon: i.showIcon,
|
|
@@ -1097,40 +1147,40 @@ function Mn(e, t, n) {
|
|
|
1097
1147
|
overflowTooltip: n.overflowTooltip === !0
|
|
1098
1148
|
};
|
|
1099
1149
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return t.shouldRenderEmpty || n.emptyWhenZero &&
|
|
1150
|
+
function In(e, t, n) {
|
|
1151
|
+
return t.shouldRenderEmpty || n.emptyWhenZero && b(t.value) ? {
|
|
1102
1152
|
...e,
|
|
1103
1153
|
value: ""
|
|
1104
1154
|
} : e;
|
|
1105
1155
|
}
|
|
1106
|
-
function
|
|
1107
|
-
let t =
|
|
1156
|
+
function Ln(e) {
|
|
1157
|
+
let t = Nn(e);
|
|
1108
1158
|
if (t ? e.formulaExecutor = t : delete e.formulaExecutor, !e.formattersPipeline) return delete e.formattersPipelineExecutor, e;
|
|
1109
|
-
let n =
|
|
1159
|
+
let n = on({
|
|
1110
1160
|
config: e.formattersPipeline,
|
|
1111
1161
|
column: e
|
|
1112
1162
|
});
|
|
1113
1163
|
return n.ok ? e.formattersPipelineExecutor = n.executor : delete e.formattersPipelineExecutor, e;
|
|
1114
1164
|
}
|
|
1115
|
-
function
|
|
1165
|
+
function Rn(e) {
|
|
1116
1166
|
let t = {};
|
|
1117
|
-
for (let [n, r] of Object.entries(e)) r && (t[n] =
|
|
1167
|
+
for (let [n, r] of Object.entries(e)) r && (t[n] = Ln(r));
|
|
1118
1168
|
return t;
|
|
1119
1169
|
}
|
|
1120
|
-
function
|
|
1121
|
-
if (!e.field) return
|
|
1122
|
-
let t =
|
|
1123
|
-
return
|
|
1170
|
+
function zn(e) {
|
|
1171
|
+
if (!e.field) return jn(n(e.rawValue), !1);
|
|
1172
|
+
let t = Pn(e.rawValue, e.rowData, e.field);
|
|
1173
|
+
return In(Fn(e, t.value, e.field), t, e.field);
|
|
1124
1174
|
}
|
|
1125
1175
|
//#endregion
|
|
1126
1176
|
//#region src/formatters/valueState/presentation.ts
|
|
1127
|
-
var
|
|
1177
|
+
var Bn = [
|
|
1128
1178
|
"none",
|
|
1129
1179
|
"information",
|
|
1130
1180
|
"success",
|
|
1131
1181
|
"warning",
|
|
1132
1182
|
"error"
|
|
1133
|
-
],
|
|
1183
|
+
], Vn = {
|
|
1134
1184
|
"": "transparent",
|
|
1135
1185
|
none: "var(--content-1)",
|
|
1136
1186
|
information: "var(--info-text)",
|
|
@@ -1140,7 +1190,7 @@ var Ln = [
|
|
|
1140
1190
|
};
|
|
1141
1191
|
//#endregion
|
|
1142
1192
|
//#region src/formatters/valueState/resolveValueStateClassName.ts
|
|
1143
|
-
function
|
|
1193
|
+
function Hn(e, t) {
|
|
1144
1194
|
switch (e) {
|
|
1145
1195
|
case "success": return "statusSuccess";
|
|
1146
1196
|
case "warning": return "statusWarning";
|
|
@@ -1150,6 +1200,6 @@ function zn(e, t) {
|
|
|
1150
1200
|
}
|
|
1151
1201
|
}
|
|
1152
1202
|
//#endregion
|
|
1153
|
-
export {
|
|
1203
|
+
export { R as $, jt as A, Be as At, wt as B, he as Bt, X as C, Pe as Ct, It as D, We as Dt, Ft as E, Ie as Et, xt as F, ze as Ft, H as G, ue as Gt, St as H, fe as Ht, V as I, qe as It, Dt as J, Et as K, le as Kt, bt as L, De as Lt, Mt as M, Ge as Mt, Nt as N, Re as Nt, G as O, He as Ot, kt as P, Ke as Pt, F as Q, W as R, b as Rt, Ut as S, Ve as St, zt as T, Ue as Tt, Ct as U, de as Ut, U as V, pe as Vt, Ot as W, _ as Wt, ft as X, I as Y, ct as Z, Bt as _, Xe as _t, Rn as a, at, Ht as b, w as bt, wn as c, Qe as ct, on as d, k as dt, L as et, Z as f, j as ft, qt as g, D as gt, Jt as h, $e as ht, Ln as i, ot as it, At as j, Le as jt, Pt as k, Me as kt, Cn as l, O as lt, en as m, M as mt, Bn as n, lt as nt, zn as o, P as ot, tn as p, N as pt, B as q, g as qt, Vn as r, it as rt, kn as s, Ze as st, Hn as t, ut as tt, bn as u, A as ut, Y as v, Ye as vt, Rt as w, Fe as wt, J as x, Ne as xt, Vt as y, Je as yt, Tt as z, me as zt };
|
|
1154
1204
|
|
|
1155
|
-
//# sourceMappingURL=formatters-
|
|
1205
|
+
//# sourceMappingURL=formatters-D1ob2OkI.js.map
|