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