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