@ryuzaki13/react-foundation-lib 1.2.6 → 1.2.8
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/array/index.js +1 -1
- package/dist/chunks/{array-BBSjoTRy.js → array-D-_yMMUK.js} +2 -2
- package/dist/chunks/{array-BBSjoTRy.js.map → array-D-_yMMUK.js.map} +1 -1
- package/dist/chunks/{formatters--mhLir82.js → formatters-CVj-3Vn0.js} +280 -269
- package/dist/chunks/formatters-CVj-3Vn0.js.map +1 -0
- package/dist/chunks/{odata-service-DnPlNGpU.js → odata-service-B5w4YBao.js} +13 -17
- package/dist/chunks/{odata-service-DnPlNGpU.js.map → odata-service-B5w4YBao.js.map} +1 -1
- package/dist/chunks/{validate-nWY_Mla5.js → validate-BzjCBUqb.js} +14 -18
- package/dist/chunks/{validate-nWY_Mla5.js.map → validate-BzjCBUqb.js.map} +1 -1
- package/dist/error-report/index.js +13 -13
- package/dist/excel/index.js +3 -3
- package/dist/excel/index.js.map +1 -1
- 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/dist/hooks/index.js +82 -81
- package/dist/hooks/index.js.map +1 -1
- package/dist/media/index.js +2 -1
- package/dist/media/index.js.map +1 -1
- package/dist/number-scale/index.js +1 -1
- package/dist/number-scale/index.js.map +1 -1
- package/dist/odata-service/index.js +1 -1
- package/dist/pwa/index.js +1 -1
- package/dist/pwa/index.js.map +1 -1
- package/dist/pwa/sw-cache-policy.js +3 -3
- package/dist/pwa/sw-cache-policy.js.map +1 -1
- package/dist/query-client/index.js +5 -5
- package/dist/query-client/index.js.map +1 -1
- package/dist/range-output/index.js +1 -1
- package/dist/range-output/index.js.map +1 -1
- package/dist/table/index.js +3 -3
- package/dist/table/index.js.map +1 -1
- package/dist/tree-table/index.js +1 -1
- package/package.json +33 -33
- package/src/docs/formatters.mdx +17 -0
- package/dist/chunks/formatters--mhLir82.js.map +0 -1
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import { _ as e, r as t, x as n } from "./array-
|
|
1
|
+
import { _ as e, r as t, x as n } from "./array-D-_yMMUK.js";
|
|
2
2
|
import { i as r } from "./isRecord-DXDTW-jA.js";
|
|
3
3
|
import { uuidv4 as i } from "../crypto/index.js";
|
|
4
|
-
import { Nt as a, mt as o } from "./odata-service-
|
|
4
|
+
import { Nt as a, mt as o } from "./odata-service-B5w4YBao.js";
|
|
5
5
|
import { R as s, k as c, n as l } from "./dateUtils-B5V5aXB-.js";
|
|
6
|
-
import { c as u, d, h as f, l as p, n as ee, o as te, t as m, u as ne } from "./validate-
|
|
6
|
+
import { c as u, d, h as f, l as p, n as ee, o as te, t as m, u as ne } from "./validate-BzjCBUqb.js";
|
|
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
|
-
end: x(t,
|
|
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,27 +350,27 @@ 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
|
|
@@ -364,13 +379,13 @@ function at(e, t) {
|
|
|
364
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 ? I(e, t - 1, n, r, i) : `${i(c,
|
|
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 =
|
|
388
|
+
let s = st(o, a);
|
|
374
389
|
return s === -1 ? e.formatPlainNumber(e.value, e.preset) : `${e.value < 0 ? "-" : ""}${I(o, s, {
|
|
375
390
|
roundingMode: n,
|
|
376
391
|
suffixSeparator: r,
|
|
@@ -382,12 +397,12 @@ function ot(e) {
|
|
|
382
397
|
//#region src/formatters/number/isZeroValue.ts
|
|
383
398
|
function L(e) {
|
|
384
399
|
let t = a(e);
|
|
385
|
-
return typeof t == "number" ? t === 0 : typeof t == "bigint"
|
|
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
404
|
var R = /* @__PURE__ */ new Map();
|
|
390
|
-
function
|
|
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;
|
|
@@ -400,92 +415,92 @@ function z(e, t) {
|
|
|
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
|
|
421
|
+
function ft(e, t, n) {
|
|
407
422
|
return z(t, n).format(e);
|
|
408
423
|
}
|
|
409
|
-
function
|
|
424
|
+
function pt(e, t) {
|
|
410
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
|
|
429
|
+
function mt(e, t) {
|
|
415
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
435
|
function B(e, t) {
|
|
421
|
-
return
|
|
436
|
+
return dt(t) ? ft(e, t.decimals, t.grouping) : t.groupingSize === 3 || !t.grouping ? pt(e, t) : mt(e, t);
|
|
422
437
|
}
|
|
423
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
447
|
formatPlainNumber: B
|
|
433
448
|
}) : B(n, r);
|
|
434
449
|
}
|
|
435
|
-
function
|
|
450
|
+
function ht(e) {
|
|
436
451
|
return V(e, p.integer);
|
|
437
452
|
}
|
|
438
|
-
function
|
|
453
|
+
function gt(e) {
|
|
439
454
|
return V(e, p.currency);
|
|
440
455
|
}
|
|
441
|
-
function
|
|
456
|
+
function _t(e) {
|
|
442
457
|
return V(e, p.decimal);
|
|
443
458
|
}
|
|
444
|
-
function
|
|
459
|
+
function vt(e) {
|
|
445
460
|
return V(e, p.decimal2);
|
|
446
461
|
}
|
|
447
|
-
function
|
|
462
|
+
function yt(e) {
|
|
448
463
|
return V(e, p.decimal3);
|
|
449
464
|
}
|
|
450
|
-
function
|
|
465
|
+
function bt(e) {
|
|
451
466
|
return V(e, p.percent);
|
|
452
467
|
}
|
|
453
|
-
function
|
|
468
|
+
function xt(e) {
|
|
454
469
|
return V(e, p.price);
|
|
455
470
|
}
|
|
456
|
-
function
|
|
471
|
+
function St(e) {
|
|
457
472
|
return V(e, p.tonnage);
|
|
458
473
|
}
|
|
459
|
-
function
|
|
474
|
+
function Ct(e) {
|
|
460
475
|
return L(e) ? "" : V(e, p.integer);
|
|
461
476
|
}
|
|
462
|
-
function
|
|
477
|
+
function wt(e) {
|
|
463
478
|
return L(e) ? "" : V(e, p.currency);
|
|
464
479
|
}
|
|
465
|
-
function
|
|
480
|
+
function Tt(e) {
|
|
466
481
|
return L(e) ? "" : V(e, p.decimal);
|
|
467
482
|
}
|
|
468
|
-
function
|
|
483
|
+
function Et(e) {
|
|
469
484
|
return L(e) ? "" : V(e, p.decimal2);
|
|
470
485
|
}
|
|
471
|
-
function
|
|
486
|
+
function Dt(e) {
|
|
472
487
|
return L(e) ? "" : V(e, p.decimal3);
|
|
473
488
|
}
|
|
474
|
-
function
|
|
489
|
+
function Ot(e) {
|
|
475
490
|
return L(e) ? "" : V(e, p.percent);
|
|
476
491
|
}
|
|
477
|
-
function
|
|
492
|
+
function kt(e) {
|
|
478
493
|
return L(e) ? "" : V(e, p.price);
|
|
479
494
|
}
|
|
480
|
-
function
|
|
495
|
+
function At(e) {
|
|
481
496
|
return L(e) ? "" : V(e, p.tonnage);
|
|
482
497
|
}
|
|
483
|
-
function
|
|
498
|
+
function jt() {
|
|
484
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 kt(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,
|
|
@@ -592,11 +607,10 @@ function Mt(e) {
|
|
|
592
607
|
...e,
|
|
593
608
|
config: G(e.config)
|
|
594
609
|
};
|
|
595
|
-
default:
|
|
596
610
|
}
|
|
597
611
|
throw Error(`Недопустимый тип '${e?.type}' для шага FormatterPipeline`);
|
|
598
612
|
}
|
|
599
|
-
function
|
|
613
|
+
function It(e, t) {
|
|
600
614
|
switch (e.type) {
|
|
601
615
|
case "typedValueFormat": return {
|
|
602
616
|
...e,
|
|
@@ -618,40 +632,39 @@ function Nt(e, t) {
|
|
|
618
632
|
position: { ...t },
|
|
619
633
|
config: G(e.config)
|
|
620
634
|
};
|
|
621
|
-
default:
|
|
622
635
|
}
|
|
623
636
|
throw Error(`Недопустимый тип '${e?.type}' для шага FormatterPipeline`);
|
|
624
637
|
}
|
|
625
|
-
function
|
|
638
|
+
function Lt(e) {
|
|
626
639
|
switch (e.type) {
|
|
627
640
|
case "source":
|
|
628
641
|
case "sink": return {
|
|
629
642
|
...e,
|
|
630
643
|
position: { ...e.position }
|
|
631
644
|
};
|
|
632
|
-
default: return
|
|
645
|
+
default: return It(e, e.position);
|
|
633
646
|
}
|
|
634
647
|
}
|
|
635
|
-
function
|
|
648
|
+
function Rt(e) {
|
|
636
649
|
return {
|
|
637
|
-
nodes: e.nodes.map(
|
|
650
|
+
nodes: e.nodes.map(Lt),
|
|
638
651
|
edges: e.edges.map((e) => ({ ...e })),
|
|
639
652
|
viewport: e.viewport ? { ...e.viewport } : void 0
|
|
640
653
|
};
|
|
641
654
|
}
|
|
642
|
-
function
|
|
643
|
-
return { steps: e.steps.map(
|
|
655
|
+
function zt(e) {
|
|
656
|
+
return { steps: e.steps.map(Ft) };
|
|
644
657
|
}
|
|
645
|
-
function
|
|
658
|
+
function Bt(e) {
|
|
646
659
|
if (e) return {
|
|
647
660
|
version: e.version,
|
|
648
|
-
graph: e.graph ?
|
|
649
|
-
plan: e.plan ?
|
|
661
|
+
graph: e.graph ? Rt(e.graph) : void 0,
|
|
662
|
+
plan: e.plan ? zt(e.plan) : void 0
|
|
650
663
|
};
|
|
651
664
|
}
|
|
652
665
|
//#endregion
|
|
653
666
|
//#region src/formatters/pipeline/dependencies.ts
|
|
654
|
-
function
|
|
667
|
+
function Vt(e) {
|
|
655
668
|
let n = m(e);
|
|
656
669
|
if (!n.ok || !n.plan) return [];
|
|
657
670
|
let r = [], i = /* @__PURE__ */ new Set();
|
|
@@ -664,7 +677,7 @@ function Rt(e) {
|
|
|
664
677
|
}
|
|
665
678
|
return r;
|
|
666
679
|
}
|
|
667
|
-
function
|
|
680
|
+
function Ht(e, n) {
|
|
668
681
|
let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = (e) => {
|
|
669
682
|
let s = e?.trim();
|
|
670
683
|
if (s) {
|
|
@@ -679,7 +692,7 @@ function zt(e, n) {
|
|
|
679
692
|
let e = n[t];
|
|
680
693
|
if (e) {
|
|
681
694
|
for (let t of Object.values(e.cellRenderer?.bindings ?? {})) s(t);
|
|
682
|
-
for (let t of
|
|
695
|
+
for (let t of Vt(e.formattersPipeline)) s(t);
|
|
683
696
|
}
|
|
684
697
|
}
|
|
685
698
|
return {
|
|
@@ -690,7 +703,7 @@ function zt(e, n) {
|
|
|
690
703
|
//#endregion
|
|
691
704
|
//#region src/formatters/valueState/valueStateRegistry.ts
|
|
692
705
|
var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
|
|
693
|
-
function
|
|
706
|
+
function Ut(e) {
|
|
694
707
|
let t = 5381;
|
|
695
708
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) >>> 0;
|
|
696
709
|
return "id_" + t.toString(36);
|
|
@@ -701,7 +714,7 @@ function J(e, t) {
|
|
|
701
714
|
id: n,
|
|
702
715
|
isNew: !1
|
|
703
716
|
};
|
|
704
|
-
let r =
|
|
717
|
+
let r = Ut(e), i = t();
|
|
705
718
|
return K.set(r, i), q.set(e, r), {
|
|
706
719
|
id: r,
|
|
707
720
|
isNew: !0
|
|
@@ -711,25 +724,25 @@ function Y(e) {
|
|
|
711
724
|
let t = q.get(e);
|
|
712
725
|
if (t) return K.get(t);
|
|
713
726
|
}
|
|
714
|
-
function
|
|
727
|
+
function Wt(e, t) {
|
|
715
728
|
let n = K.get(e);
|
|
716
729
|
return n ? n(t) : "none";
|
|
717
730
|
}
|
|
718
|
-
function
|
|
731
|
+
function Gt(e) {
|
|
719
732
|
return K.get(e);
|
|
720
733
|
}
|
|
721
|
-
function
|
|
734
|
+
function Kt() {
|
|
722
735
|
return Array.from(K.keys());
|
|
723
736
|
}
|
|
724
|
-
function
|
|
737
|
+
function qt() {
|
|
725
738
|
K.clear(), q.clear();
|
|
726
739
|
}
|
|
727
740
|
//#endregion
|
|
728
741
|
//#region src/formatters/valueState/fixedValueStateResolver.ts
|
|
729
|
-
function
|
|
742
|
+
function Jt(e, t) {
|
|
730
743
|
return `fixed|${e.map(([e, t]) => `${e}:${t}`).join(",")}|${t}`;
|
|
731
744
|
}
|
|
732
|
-
function
|
|
745
|
+
function Yt(e, t) {
|
|
733
746
|
let n = new Map(Object.entries(e));
|
|
734
747
|
return (e) => {
|
|
735
748
|
if (e == null) return t;
|
|
@@ -737,25 +750,25 @@ function Kt(e, t) {
|
|
|
737
750
|
return n.get(r) ?? t;
|
|
738
751
|
};
|
|
739
752
|
}
|
|
740
|
-
function
|
|
741
|
-
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);
|
|
742
755
|
return {
|
|
743
756
|
entries: e.entries,
|
|
744
757
|
fallbackState: t,
|
|
745
758
|
canonicalKey: n
|
|
746
759
|
};
|
|
747
760
|
}
|
|
748
|
-
function
|
|
749
|
-
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));
|
|
750
763
|
return i;
|
|
751
764
|
}
|
|
752
|
-
function
|
|
753
|
-
let { entries: t, fallbackState: n, canonicalKey: r } =
|
|
754
|
-
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));
|
|
755
768
|
}
|
|
756
769
|
//#endregion
|
|
757
770
|
//#region src/formatters/valueState/thresholdValueStateResolver.ts
|
|
758
|
-
function
|
|
771
|
+
function $t(e) {
|
|
759
772
|
return typeof e == "number" ? {
|
|
760
773
|
value: e,
|
|
761
774
|
boundary: "upper"
|
|
@@ -764,15 +777,15 @@ function Xt(e) {
|
|
|
764
777
|
boundary: e.boundary ?? "upper"
|
|
765
778
|
};
|
|
766
779
|
}
|
|
767
|
-
function
|
|
780
|
+
function en(e, t, n) {
|
|
768
781
|
return `threshold|${e.map((e) => `${e.value}:${e.boundary}`).join(",")}|${t.join(",")}|${n}`;
|
|
769
782
|
}
|
|
770
|
-
function
|
|
783
|
+
function tn(e, t) {
|
|
771
784
|
if (t.length !== e.length + 1) throw Error(`Количество состояний (${t.length}) должно быть равно количеству порогов + 1 (${e.length + 1})`);
|
|
772
785
|
let n = /* @__PURE__ */ new Set();
|
|
773
786
|
for (let t of e) n.has(t.value) && console.warn(`Дублирующееся пороговое значение: ${t.value}`), n.add(t.value);
|
|
774
787
|
}
|
|
775
|
-
function
|
|
788
|
+
function nn(e, t, n) {
|
|
776
789
|
let r = e.map((e) => e.value), i = e.map((e) => e.boundary === "lower"), a = [...t];
|
|
777
790
|
return (e) => {
|
|
778
791
|
if (e === "" || e == null) return n;
|
|
@@ -782,26 +795,26 @@ function $t(e, t, n) {
|
|
|
782
795
|
return a[a.length - 1];
|
|
783
796
|
};
|
|
784
797
|
}
|
|
785
|
-
function
|
|
786
|
-
let t = e.invalidState ?? "none", n = e.thresholds.map(
|
|
787
|
-
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), {
|
|
788
801
|
sortedThresholds: n,
|
|
789
802
|
invalidState: t,
|
|
790
|
-
canonicalKey:
|
|
803
|
+
canonicalKey: en(n, e.states, t),
|
|
791
804
|
states: e.states
|
|
792
805
|
};
|
|
793
806
|
}
|
|
794
|
-
function
|
|
795
|
-
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));
|
|
796
809
|
return a;
|
|
797
810
|
}
|
|
798
|
-
function
|
|
799
|
-
let { sortedThresholds: t, invalidState: n, canonicalKey: r, states: i } =
|
|
800
|
-
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));
|
|
801
814
|
}
|
|
802
815
|
//#endregion
|
|
803
816
|
//#region src/formatters/pipeline/execute.ts
|
|
804
|
-
var
|
|
817
|
+
var sn = Object.freeze({
|
|
805
818
|
number: "decimal",
|
|
806
819
|
date: "date"
|
|
807
820
|
});
|
|
@@ -810,18 +823,18 @@ function X(e, t, r) {
|
|
|
810
823
|
let i = o(t.type);
|
|
811
824
|
if (i === "number") {
|
|
812
825
|
let t = r?.numberPresetName?.trim();
|
|
813
|
-
return V(e, t && d(t) ? t :
|
|
826
|
+
return V(e, t && d(t) ? t : sn.number);
|
|
814
827
|
}
|
|
815
828
|
if (i === "date") {
|
|
816
|
-
let t = r?.datePresetName?.trim(), n = t && s(t) ? t :
|
|
829
|
+
let t = r?.datePresetName?.trim(), n = t && s(t) ? t : sn.date;
|
|
817
830
|
return l(c(e), n);
|
|
818
831
|
}
|
|
819
832
|
return n(e);
|
|
820
833
|
}
|
|
821
|
-
function
|
|
834
|
+
function cn(e) {
|
|
822
835
|
if (e === "success" || e === "warning" || e === "error" || e === "information") return e;
|
|
823
836
|
}
|
|
824
|
-
function
|
|
837
|
+
function ln(e, t) {
|
|
825
838
|
switch (e.rowKind) {
|
|
826
839
|
case "group":
|
|
827
840
|
case "plain":
|
|
@@ -829,7 +842,7 @@ function on(e, t) {
|
|
|
829
842
|
case "totals": return t === "formula";
|
|
830
843
|
}
|
|
831
844
|
}
|
|
832
|
-
function
|
|
845
|
+
function un(e) {
|
|
833
846
|
let t = m(e.config);
|
|
834
847
|
if (!t.ok || !t.plan) return t.errors.some((e) => e.code === "step_row_based_override_formula_not_found") ? {
|
|
835
848
|
ok: !1,
|
|
@@ -838,10 +851,10 @@ function sn(e) {
|
|
|
838
851
|
ok: !1,
|
|
839
852
|
reason: "pipeline_invalid"
|
|
840
853
|
};
|
|
841
|
-
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({
|
|
842
855
|
entries: a.config.resolver.entries,
|
|
843
856
|
fallbackState: a.config.resolver.fallbackState
|
|
844
|
-
}) : a?.config.resolver.kind === "threshold" ?
|
|
857
|
+
}) : a?.config.resolver.kind === "threshold" ? an({
|
|
845
858
|
thresholds: a.config.resolver.thresholds,
|
|
846
859
|
states: a.config.resolver.states,
|
|
847
860
|
invalidState: a.config.resolver.invalidState
|
|
@@ -858,10 +871,10 @@ function sn(e) {
|
|
|
858
871
|
let r = t.value, a = "none", s = !1, l = !0, d = "left", f;
|
|
859
872
|
for (let i of n) switch (i.type) {
|
|
860
873
|
case "normalizeLeadingZeros":
|
|
861
|
-
r =
|
|
874
|
+
r = Mt(r, i.config?.fixed);
|
|
862
875
|
break;
|
|
863
876
|
case "rowBasedOverride":
|
|
864
|
-
if (!
|
|
877
|
+
if (!ln(t, i.config.mode)) break;
|
|
865
878
|
if (i.config.mode === "field") {
|
|
866
879
|
let e = t.rowData[i.config.fieldKey];
|
|
867
880
|
if (e == null && i.config.fallbackToRaw !== !1) break;
|
|
@@ -884,11 +897,9 @@ function sn(e) {
|
|
|
884
897
|
break;
|
|
885
898
|
case "resolveValueState":
|
|
886
899
|
if (!o) break;
|
|
887
|
-
a =
|
|
888
|
-
break;
|
|
889
|
-
case "typedValueFormat":
|
|
890
|
-
r = X(r, e.column, i.config);
|
|
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;
|
|
891
901
|
break;
|
|
902
|
+
case "typedValueFormat": r = X(r, e.column, i.config);
|
|
892
903
|
}
|
|
893
904
|
return {
|
|
894
905
|
value: r,
|
|
@@ -905,7 +916,7 @@ function sn(e) {
|
|
|
905
916
|
}
|
|
906
917
|
//#endregion
|
|
907
918
|
//#region src/formatters/pipeline/normalize.ts
|
|
908
|
-
var
|
|
919
|
+
var dn = [
|
|
909
920
|
"",
|
|
910
921
|
"none",
|
|
911
922
|
"information",
|
|
@@ -914,55 +925,55 @@ var cn = [
|
|
|
914
925
|
"error"
|
|
915
926
|
];
|
|
916
927
|
function Z(e) {
|
|
917
|
-
return typeof e == "string" &&
|
|
928
|
+
return typeof e == "string" && dn.some((t) => t === e);
|
|
918
929
|
}
|
|
919
930
|
function Q(e) {
|
|
920
931
|
return e === void 0 || typeof e == "boolean";
|
|
921
932
|
}
|
|
922
|
-
function
|
|
933
|
+
function fn(e) {
|
|
923
934
|
return e === void 0 || typeof e == "string";
|
|
924
935
|
}
|
|
925
|
-
function
|
|
926
|
-
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;
|
|
927
938
|
}
|
|
928
|
-
function
|
|
929
|
-
return r(e) ? e.mode === "field" ? typeof e.fieldKey == "string" && Q(e.fallbackToRaw) : e.mode === "formula"
|
|
939
|
+
function mn(e) {
|
|
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;
|
|
930
941
|
}
|
|
931
|
-
function
|
|
942
|
+
function hn(e) {
|
|
932
943
|
return typeof e == "number" || r(e) && typeof e.value == "number" && (e.boundary === void 0 || e.boundary === "lower" || e.boundary === "upper");
|
|
933
944
|
}
|
|
934
|
-
function
|
|
945
|
+
function gn(e) {
|
|
935
946
|
if (!r(e) || !r(e.resolver)) return !1;
|
|
936
947
|
let { resolver: t, icon: n } = e;
|
|
937
|
-
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"
|
|
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;
|
|
938
949
|
}
|
|
939
|
-
function
|
|
940
|
-
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);
|
|
941
952
|
}
|
|
942
953
|
function $(e) {
|
|
943
|
-
return r(e) && Array.isArray(e.steps) && e.steps.every(
|
|
954
|
+
return r(e) && Array.isArray(e.steps) && e.steps.every(_n);
|
|
944
955
|
}
|
|
945
|
-
function
|
|
956
|
+
function vn(e) {
|
|
946
957
|
return r(e) && typeof e.x == "number" && typeof e.y == "number";
|
|
947
958
|
}
|
|
948
|
-
function
|
|
949
|
-
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);
|
|
950
961
|
}
|
|
951
|
-
function
|
|
962
|
+
function bn(e) {
|
|
952
963
|
return r(e) && typeof e.id == "string" && typeof e.source == "string" && typeof e.target == "string";
|
|
953
964
|
}
|
|
954
|
-
function
|
|
955
|
-
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);
|
|
956
967
|
}
|
|
957
|
-
function
|
|
958
|
-
return r(e) && e.version === 1 && (e.plan === void 0 || $(e.plan)) && (e.graph === 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));
|
|
959
970
|
}
|
|
960
|
-
function
|
|
961
|
-
if (
|
|
971
|
+
function Cn(e) {
|
|
972
|
+
if (Sn(e) && m(e).ok) return Bt(e);
|
|
962
973
|
}
|
|
963
974
|
//#endregion
|
|
964
975
|
//#region src/formatters/pipeline/definitions.ts
|
|
965
|
-
var
|
|
976
|
+
var wn = Object.freeze([
|
|
966
977
|
{
|
|
967
978
|
id: "normalizeLeadingZeros",
|
|
968
979
|
name: "Нормализация ведущих нулей",
|
|
@@ -983,19 +994,19 @@ var xn = Object.freeze([
|
|
|
983
994
|
name: "Типизированное форматирование",
|
|
984
995
|
description: "Формирует итоговый внешний вид значения по типу и роли столбца."
|
|
985
996
|
}
|
|
986
|
-
]),
|
|
987
|
-
function
|
|
988
|
-
return
|
|
997
|
+
]), Tn = new Map(wn.map((e) => [e.id, e]));
|
|
998
|
+
function En() {
|
|
999
|
+
return wn;
|
|
989
1000
|
}
|
|
990
|
-
function
|
|
991
|
-
return
|
|
1001
|
+
function Dn(e) {
|
|
1002
|
+
return Tn.get(e);
|
|
992
1003
|
}
|
|
993
1004
|
//#endregion
|
|
994
1005
|
//#region src/formatters/pipeline/rekey.ts
|
|
995
|
-
function
|
|
1006
|
+
function On(e) {
|
|
996
1007
|
return e.type === "source" || e.type === "sink";
|
|
997
1008
|
}
|
|
998
|
-
function
|
|
1009
|
+
function kn(e, t) {
|
|
999
1010
|
switch (e.type) {
|
|
1000
1011
|
case "source":
|
|
1001
1012
|
case "sink": return {
|
|
@@ -1044,21 +1055,21 @@ function En(e, t) {
|
|
|
1044
1055
|
};
|
|
1045
1056
|
}
|
|
1046
1057
|
}
|
|
1047
|
-
function
|
|
1058
|
+
function An(e, t) {
|
|
1048
1059
|
let n = /* @__PURE__ */ new Map();
|
|
1049
|
-
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());
|
|
1050
1061
|
let r = e.edges.map((e) => ({
|
|
1051
1062
|
id: t(),
|
|
1052
1063
|
source: n.get(e.source) ?? e.source,
|
|
1053
1064
|
target: n.get(e.target) ?? e.target
|
|
1054
1065
|
}));
|
|
1055
1066
|
return {
|
|
1056
|
-
nodes: e.nodes.map((e) =>
|
|
1067
|
+
nodes: e.nodes.map((e) => kn(e, n.get(e.id) ?? e.id)),
|
|
1057
1068
|
edges: r,
|
|
1058
1069
|
viewport: e.viewport ? { ...e.viewport } : void 0
|
|
1059
1070
|
};
|
|
1060
1071
|
}
|
|
1061
|
-
function
|
|
1072
|
+
function jn(e, t) {
|
|
1062
1073
|
return { steps: e.steps.map((e) => {
|
|
1063
1074
|
switch (e.type) {
|
|
1064
1075
|
case "typedValueFormat": return {
|
|
@@ -1099,22 +1110,22 @@ function On(e, t) {
|
|
|
1099
1110
|
}
|
|
1100
1111
|
}) };
|
|
1101
1112
|
}
|
|
1102
|
-
function
|
|
1113
|
+
function Mn(e, t = i) {
|
|
1103
1114
|
if (!e) return;
|
|
1104
|
-
let n = e.graph ?
|
|
1115
|
+
let n = e.graph ? An(e.graph, t) : void 0, r = n ? ee(n) : void 0;
|
|
1105
1116
|
return {
|
|
1106
1117
|
version: e.version,
|
|
1107
1118
|
graph: n,
|
|
1108
|
-
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
|
|
1109
1120
|
};
|
|
1110
1121
|
}
|
|
1111
1122
|
//#endregion
|
|
1112
1123
|
//#region src/formatters/pipeline/runtime.ts
|
|
1113
|
-
var
|
|
1124
|
+
var Nn = () => ({
|
|
1114
1125
|
ok: !1,
|
|
1115
1126
|
reason: "formula_not_found"
|
|
1116
1127
|
});
|
|
1117
|
-
function
|
|
1128
|
+
function Pn(e, t) {
|
|
1118
1129
|
return {
|
|
1119
1130
|
value: e,
|
|
1120
1131
|
state: "none",
|
|
@@ -1124,18 +1135,18 @@ function jn(e, t) {
|
|
|
1124
1135
|
overflowTooltip: t
|
|
1125
1136
|
};
|
|
1126
1137
|
}
|
|
1127
|
-
function
|
|
1138
|
+
function Fn(e, t) {
|
|
1128
1139
|
return t ? X(e, t) : n(e);
|
|
1129
1140
|
}
|
|
1130
|
-
function
|
|
1141
|
+
function In(e) {
|
|
1131
1142
|
if (!e.formulaId) return;
|
|
1132
1143
|
let t = ae({
|
|
1133
1144
|
formulaId: e.formulaId,
|
|
1134
1145
|
keys: e.formulaDependencies
|
|
1135
1146
|
});
|
|
1136
|
-
return t.ok ? t.execute :
|
|
1147
|
+
return t.ok ? t.execute : Nn;
|
|
1137
1148
|
}
|
|
1138
|
-
function
|
|
1149
|
+
function Ln(e, t, n) {
|
|
1139
1150
|
if (!n.formulaId) return {
|
|
1140
1151
|
value: e,
|
|
1141
1152
|
shouldRenderEmpty: !1
|
|
@@ -1153,9 +1164,9 @@ function Pn(e, t, n) {
|
|
|
1153
1164
|
shouldRenderEmpty: n.purelyDerived === !0
|
|
1154
1165
|
};
|
|
1155
1166
|
}
|
|
1156
|
-
function
|
|
1167
|
+
function Rn(e, t, n) {
|
|
1157
1168
|
let r = n.formattersPipelineExecutor;
|
|
1158
|
-
if (!r) return
|
|
1169
|
+
if (!r) return Pn(Fn(t, n), n.overflowTooltip === !0);
|
|
1159
1170
|
let i = r.execute({
|
|
1160
1171
|
value: t,
|
|
1161
1172
|
rowData: e.rowData,
|
|
@@ -1167,7 +1178,7 @@ function Fn(e, t, n) {
|
|
|
1167
1178
|
columnId: n.id
|
|
1168
1179
|
});
|
|
1169
1180
|
return {
|
|
1170
|
-
value: i.hasTypedValueFormat ? i.value :
|
|
1181
|
+
value: i.hasTypedValueFormat ? i.value : Fn(i.value, n),
|
|
1171
1182
|
state: i.state,
|
|
1172
1183
|
icon: i.icon,
|
|
1173
1184
|
showIcon: i.showIcon,
|
|
@@ -1176,40 +1187,40 @@ function Fn(e, t, n) {
|
|
|
1176
1187
|
overflowTooltip: n.overflowTooltip === !0
|
|
1177
1188
|
};
|
|
1178
1189
|
}
|
|
1179
|
-
function
|
|
1190
|
+
function zn(e, t, n) {
|
|
1180
1191
|
return t.shouldRenderEmpty || n.emptyWhenZero && L(t.value) ? {
|
|
1181
1192
|
...e,
|
|
1182
1193
|
value: ""
|
|
1183
1194
|
} : e;
|
|
1184
1195
|
}
|
|
1185
|
-
function
|
|
1186
|
-
let t =
|
|
1196
|
+
function Bn(e) {
|
|
1197
|
+
let t = In(e);
|
|
1187
1198
|
if (t ? e.formulaExecutor = t : delete e.formulaExecutor, !e.formattersPipeline) return delete e.formattersPipelineExecutor, e;
|
|
1188
|
-
let n =
|
|
1199
|
+
let n = un({
|
|
1189
1200
|
config: e.formattersPipeline,
|
|
1190
1201
|
column: e
|
|
1191
1202
|
});
|
|
1192
1203
|
return n.ok ? e.formattersPipelineExecutor = n.executor : delete e.formattersPipelineExecutor, e;
|
|
1193
1204
|
}
|
|
1194
|
-
function
|
|
1205
|
+
function Vn(e) {
|
|
1195
1206
|
let t = {};
|
|
1196
|
-
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));
|
|
1197
1208
|
return t;
|
|
1198
1209
|
}
|
|
1199
|
-
function
|
|
1200
|
-
if (!e.field) return
|
|
1201
|
-
let t =
|
|
1202
|
-
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);
|
|
1203
1214
|
}
|
|
1204
1215
|
//#endregion
|
|
1205
1216
|
//#region src/formatters/valueState/presentation.ts
|
|
1206
|
-
var
|
|
1217
|
+
var Un = [
|
|
1207
1218
|
"none",
|
|
1208
1219
|
"information",
|
|
1209
1220
|
"success",
|
|
1210
1221
|
"warning",
|
|
1211
1222
|
"error"
|
|
1212
|
-
],
|
|
1223
|
+
], Wn = {
|
|
1213
1224
|
"": "transparent",
|
|
1214
1225
|
none: "var(--content-1)",
|
|
1215
1226
|
information: "var(--status-info-text)",
|
|
@@ -1219,7 +1230,7 @@ var Bn = [
|
|
|
1219
1230
|
};
|
|
1220
1231
|
//#endregion
|
|
1221
1232
|
//#region src/formatters/valueState/resolveValueStateClassName.ts
|
|
1222
|
-
function
|
|
1233
|
+
function Gn(e, t) {
|
|
1223
1234
|
switch (e) {
|
|
1224
1235
|
case "success": return "statusSuccess";
|
|
1225
1236
|
case "warning": return "statusWarning";
|
|
@@ -1229,6 +1240,6 @@ function Hn(e, t) {
|
|
|
1229
1240
|
}
|
|
1230
1241
|
}
|
|
1231
1242
|
//#endregion
|
|
1232
|
-
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 };
|
|
1233
1244
|
|
|
1234
|
-
//# sourceMappingURL=formatters
|
|
1245
|
+
//# sourceMappingURL=formatters-CVj-3Vn0.js.map
|