@ryuzaki13/react-foundation-lib 1.1.14 → 1.1.16
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/chunks/{formatters-CqOO2pwH.js → formatters-DCx4jhka.js} +3 -3
- package/dist/chunks/{formatters-CqOO2pwH.js.map → formatters-DCx4jhka.js.map} +1 -1
- package/dist/chunks/{odata-service-CDYp5CIE.js → odata-service-DNYr2dDx.js} +158 -145
- package/dist/chunks/{odata-service-CDYp5CIE.js.map → odata-service-DNYr2dDx.js.map} +1 -1
- package/dist/chunks/{validate-Cxg_lLUY.js → validate-B_ITGoAs.js} +2 -2
- package/dist/chunks/{validate-Cxg_lLUY.js.map → validate-B_ITGoAs.js.map} +1 -1
- package/dist/error-report/index.js +1 -1
- package/dist/excel/index.js +2 -2
- package/dist/formatters/index.js +4 -4
- package/dist/odata-service/index.js +2 -2
- package/dist/odata-service/sqlFilters.d.ts +20 -1
- package/dist/odata-service/sqlFilters.d.ts.map +1 -1
- package/dist/odata-service/types.d.ts +1 -1
- package/dist/odata-service/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -135,7 +135,7 @@ function ue(e) {
|
|
|
135
135
|
if (e == null) return !1;
|
|
136
136
|
if (typeof e == "string" && (e === "X" || e === " " || e === "")) return o(e);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function g(e, n) {
|
|
139
139
|
switch (e) {
|
|
140
140
|
case "boolean": return le(n) ?? n;
|
|
141
141
|
case "int":
|
|
@@ -150,14 +150,14 @@ function de(e, n) {
|
|
|
150
150
|
default: return String(n);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function de(e, t) {
|
|
154
154
|
if (e.abapBooleanLike) {
|
|
155
155
|
let e = ue(t);
|
|
156
156
|
if (e !== void 0) return e;
|
|
157
157
|
}
|
|
158
|
-
return
|
|
158
|
+
return g(e.type, t);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function fe(e) {
|
|
161
161
|
switch (e) {
|
|
162
162
|
case "boolean": return !1;
|
|
163
163
|
case "int":
|
|
@@ -172,7 +172,7 @@ function pe(e) {
|
|
|
172
172
|
default: return "";
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function pe(e) {
|
|
176
176
|
switch (e) {
|
|
177
177
|
case "boolean": return !1;
|
|
178
178
|
case "number": return 0;
|
|
@@ -180,72 +180,72 @@ function me(e) {
|
|
|
180
180
|
default: return "";
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function _(e, t) {
|
|
184
184
|
return (...n) => {
|
|
185
185
|
let r = e.safeParse(n);
|
|
186
186
|
if (!r.success) throw Error(`Validation failed: ${r.error.message}`);
|
|
187
187
|
return t(...r.data);
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function v(e) {
|
|
191
|
+
return _(a.array(a.boolean()), e);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
193
|
+
function me(e) {
|
|
194
|
+
return _(a.array(a.string()), e);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
return
|
|
196
|
+
function he(e) {
|
|
197
|
+
return _(a.array(a.number()), e);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
199
|
+
function y(e) {
|
|
200
|
+
return _(a.array(a.date()), e);
|
|
201
201
|
}
|
|
202
|
-
var
|
|
202
|
+
var ge = y(r.datetime), _e = y(r.datetimeOffset), ve = y(r.time), ye = y((e) => m("string", n(e))), be = v((e) => m("boolean", e)), xe = v((e) => m("string", Number(e))), Se = v((e) => m("byte", Number(e))), Ce = me((e) => m("string", e)), b = {
|
|
203
203
|
date: {
|
|
204
204
|
base: {
|
|
205
205
|
label: "Базовый datetime",
|
|
206
206
|
description: "Используется для параметров OData с типом данных datetime",
|
|
207
|
-
fn:
|
|
207
|
+
fn: ge
|
|
208
208
|
},
|
|
209
209
|
datetimeOffset: {
|
|
210
210
|
label: "Базовый datetimeoffset",
|
|
211
211
|
description: "Используется для параметров OData с типом данных datetimeoffset",
|
|
212
|
-
fn:
|
|
212
|
+
fn: _e
|
|
213
213
|
},
|
|
214
214
|
time: {
|
|
215
215
|
label: "Базовый time",
|
|
216
216
|
description: "Используется для параметров OData с типом данных time",
|
|
217
|
-
fn:
|
|
217
|
+
fn: ve
|
|
218
218
|
},
|
|
219
219
|
stringAbapDate: {
|
|
220
220
|
label: "Дата ABAP YYYYMMDD",
|
|
221
221
|
description: "Используется для параметров OData с типом данных string(8)",
|
|
222
|
-
fn:
|
|
222
|
+
fn: ye
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
225
|
boolean: {
|
|
226
226
|
base: {
|
|
227
227
|
label: "Базовое ABAP булево",
|
|
228
228
|
description: "Стандартный формат abap_bool со значением 'X' для true и '' для false",
|
|
229
|
-
fn:
|
|
229
|
+
fn: be
|
|
230
230
|
},
|
|
231
231
|
asChar: {
|
|
232
232
|
label: "Как символ",
|
|
233
233
|
description: "Преобразование булево в символы '0' или '1'",
|
|
234
|
-
fn:
|
|
234
|
+
fn: xe
|
|
235
235
|
},
|
|
236
236
|
asByte: {
|
|
237
237
|
label: "Как цифра",
|
|
238
238
|
description: "Преобразование булево в цифру 0 или 1",
|
|
239
|
-
fn:
|
|
239
|
+
fn: Se
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
242
|
string: { base: {
|
|
243
243
|
label: "Базовая строка",
|
|
244
244
|
description: "",
|
|
245
|
-
fn:
|
|
245
|
+
fn: Ce
|
|
246
246
|
} }
|
|
247
247
|
};
|
|
248
|
-
function
|
|
248
|
+
function x(e) {
|
|
249
249
|
switch (e) {
|
|
250
250
|
case "boolean": return "boolean";
|
|
251
251
|
case "int":
|
|
@@ -260,36 +260,36 @@ function b(e) {
|
|
|
260
260
|
default: return "string";
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
let t =
|
|
263
|
+
function we(e) {
|
|
264
|
+
let t = b[x(e)];
|
|
265
265
|
return t ? Object.entries(t).map(([e, t]) => ({
|
|
266
266
|
id: e,
|
|
267
267
|
...t
|
|
268
268
|
})) : [];
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
let t =
|
|
270
|
+
function Te(e) {
|
|
271
|
+
let t = b[e];
|
|
272
272
|
return t ? Object.entries(t).map(([e, t]) => ({
|
|
273
273
|
id: e,
|
|
274
274
|
...t
|
|
275
275
|
})) : [];
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
return
|
|
277
|
+
function Ee(e, t) {
|
|
278
|
+
return b[x(e)]?.[t];
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
280
|
+
function De(e, t) {
|
|
281
|
+
return b[e]?.[t];
|
|
282
282
|
}
|
|
283
283
|
//#endregion
|
|
284
284
|
//#region src/odata-service/builder.ts
|
|
285
|
-
function
|
|
285
|
+
function Oe(e, t) {
|
|
286
286
|
if (!t || typeof t != "number") return;
|
|
287
287
|
let n = e.match(/^'(.*)'$/s);
|
|
288
288
|
if (!n) throw Error(`Значение должно быть заключено в одинарные кавычки: ${e}`);
|
|
289
289
|
let r = n[1];
|
|
290
290
|
if (r.length > t) throw Error(`Значение слишком длинное для maxLength=${t}: '${e}' (${r.length} символов внутри кавычек)`);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function S(e, t) {
|
|
293
293
|
return e.parameters ? e.parameters.map((e) => {
|
|
294
294
|
let { id: n, type: r, maxLength: i, mandatory: a } = e, o = t[n] ?? {}, s = o.value, c = o.formatter;
|
|
295
295
|
if (a && s == null) throw Error(`Отсутствует обязательный параметр: ${n}`);
|
|
@@ -297,44 +297,44 @@ function x(e, t) {
|
|
|
297
297
|
try {
|
|
298
298
|
if (Array.isArray(s) && !c) throw Error("Массив значений OData-параметра требует custom formatter");
|
|
299
299
|
let e = c ? c(s) : h(r, s);
|
|
300
|
-
return
|
|
300
|
+
return Oe(e, i), [n, e];
|
|
301
301
|
} catch (e) {
|
|
302
302
|
throw Error(`Ошибка форматирования параметра ${n}: ${String(e)}`);
|
|
303
303
|
}
|
|
304
304
|
}).filter((e) => e !== null) : [];
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
let n =
|
|
306
|
+
function C(e, t) {
|
|
307
|
+
let n = S(e, t);
|
|
308
308
|
return n.length ? `(${n.map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join(",")})` : "";
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function w(e, t) {
|
|
311
311
|
let n = new URLSearchParams();
|
|
312
|
-
for (let [r, i] of
|
|
312
|
+
for (let [r, i] of S(e, t)) n.set(r, i);
|
|
313
313
|
return n;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function ke(e, t, n, r) {
|
|
316
316
|
let i = `/${t.service}/${t.target}`;
|
|
317
|
-
return r === "create" ? i : r === "query" ? e.result ?
|
|
317
|
+
return r === "create" ? i : r === "query" ? e.result ? T(e, t, n) : (__DEV__ && Object.keys(n).length > 0 && console.warn(`Параметры для query-запроса '/${t.service}/${t.target}' проигнорированы: target не поддерживает parameterized query.`), i) : `${i}${C(e, n)}`;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
let r =
|
|
319
|
+
function Ae(e, t, n) {
|
|
320
|
+
let r = w(e, n).toString(), i = `/${t.service}/${t.target}`;
|
|
321
321
|
return r ? `${i}?${r}` : i;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
let r =
|
|
323
|
+
function T(e, t, n) {
|
|
324
|
+
let r = C(e, n), i = e.result ? `/${e.result}` : "";
|
|
325
325
|
return `/${t.service}/${t.target}${r}${i}`;
|
|
326
326
|
}
|
|
327
327
|
//#endregion
|
|
328
328
|
//#region src/odata-service/columns.ts
|
|
329
|
-
function
|
|
329
|
+
function E(e) {
|
|
330
330
|
return e.filter((e) => e.semanticType === "code" && e.filterable);
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
return new Set(
|
|
332
|
+
function je(e) {
|
|
333
|
+
return new Set(E(e).map((e) => e.id));
|
|
334
334
|
}
|
|
335
335
|
//#endregion
|
|
336
336
|
//#region src/odata-service/filters.ts
|
|
337
|
-
var
|
|
337
|
+
var Me = Object.freeze({
|
|
338
338
|
eq: "eq",
|
|
339
339
|
ne: "ne",
|
|
340
340
|
gt: "gt",
|
|
@@ -344,7 +344,7 @@ var Ne = Object.freeze({
|
|
|
344
344
|
startswith: "startswith",
|
|
345
345
|
endswith: "endswith",
|
|
346
346
|
contains: "contains"
|
|
347
|
-
}),
|
|
347
|
+
}), Ne = Object.freeze(Object.values(Me)), Pe = Object.freeze({
|
|
348
348
|
eq: "равно",
|
|
349
349
|
ne: "не равно",
|
|
350
350
|
gt: "больше",
|
|
@@ -354,14 +354,14 @@ var Ne = Object.freeze({
|
|
|
354
354
|
startswith: "начинается с",
|
|
355
355
|
endswith: "заканчивается на",
|
|
356
356
|
contains: "содержит"
|
|
357
|
-
}),
|
|
357
|
+
}), Fe = new Set(Ne);
|
|
358
|
+
function Ie(e) {
|
|
359
|
+
return typeof e == "string" && Fe.has(e);
|
|
360
|
+
}
|
|
358
361
|
function Le(e) {
|
|
359
|
-
return
|
|
362
|
+
return Pe[e];
|
|
360
363
|
}
|
|
361
364
|
function Re(e) {
|
|
362
|
-
return Fe[e];
|
|
363
|
-
}
|
|
364
|
-
function ze(e) {
|
|
365
365
|
switch (typeof e) {
|
|
366
366
|
case "bigint":
|
|
367
367
|
case "number": return "int";
|
|
@@ -370,17 +370,17 @@ function ze(e) {
|
|
|
370
370
|
}
|
|
371
371
|
return "string";
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
let { key: t, operation: n = "eq", value: r, type: i } = e, a = h(i ??
|
|
373
|
+
function D(e) {
|
|
374
|
+
let { key: t, operation: n = "eq", value: r, type: i } = e, a = h(i ?? Re(r), r);
|
|
375
375
|
return n === "contains" ? `substringof(${a},${String(t)})` : n === "startswith" || n === "endswith" ? `${n}(${String(t)}, ${a})` : `${String(t)} ${n} ${a}`;
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function ze(e) {
|
|
378
378
|
return "conditions" in e && e.conditions !== void 0;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function Be(e) {
|
|
381
381
|
return "filters" in e && e.filters !== void 0;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Ve(e, t) {
|
|
384
384
|
let n = [];
|
|
385
385
|
for (let r of e) {
|
|
386
386
|
let e = t(r);
|
|
@@ -388,46 +388,46 @@ function He(e, t) {
|
|
|
388
388
|
}
|
|
389
389
|
return n;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function O(e) {
|
|
392
392
|
if (!e) return "";
|
|
393
|
-
if (
|
|
393
|
+
if (ze(e)) {
|
|
394
394
|
let { conditions: t, and: n = !1 } = e;
|
|
395
395
|
if (t.length === 0) return "";
|
|
396
|
-
if (t.length === 1) return
|
|
396
|
+
if (t.length === 1) return D(t[0]);
|
|
397
397
|
let r = n ? "and" : "or";
|
|
398
|
-
return `(${t.map(
|
|
398
|
+
return `(${t.map(D).join(` ${r} `)})`;
|
|
399
399
|
}
|
|
400
|
-
if (
|
|
400
|
+
if (Be(e)) {
|
|
401
401
|
let { filters: t, and: n = !1 } = e;
|
|
402
402
|
if (t.length === 0) return "";
|
|
403
|
-
if (t.length === 1) return
|
|
404
|
-
let r = n ? "and" : "or", i =
|
|
403
|
+
if (t.length === 1) return O(t[0]);
|
|
404
|
+
let r = n ? "and" : "or", i = Ve(t, O);
|
|
405
405
|
return i.length === 0 ? "" : i.length === 1 ? i[0] : `(${i.join(` ${r} `)})`;
|
|
406
406
|
}
|
|
407
407
|
throw Error("Некорректное выражение фильтра");
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function He(e) {
|
|
410
410
|
let t = (e) => {
|
|
411
411
|
if (!e) return "";
|
|
412
|
-
if (
|
|
412
|
+
if (ze(e)) {
|
|
413
413
|
let { conditions: t, and: n = !1 } = e;
|
|
414
414
|
if (t.length === 0) return "";
|
|
415
|
-
if (t.length === 1) return
|
|
415
|
+
if (t.length === 1) return D(t[0]);
|
|
416
416
|
let r = n ? "and" : "or";
|
|
417
|
-
return `(${t.map(
|
|
417
|
+
return `(${t.map(D).join(` ${r} `)})`;
|
|
418
418
|
}
|
|
419
|
-
if (
|
|
419
|
+
if (Be(e)) {
|
|
420
420
|
let { filters: n, and: r = !1 } = e;
|
|
421
421
|
if (n.length === 0) return "";
|
|
422
422
|
if (n.length === 1) return t(n[0]);
|
|
423
|
-
let i = r ? "and" : "or", a =
|
|
423
|
+
let i = r ? "and" : "or", a = Ve(n, t).map((e) => e.includes(" ") ? `(${e})` : e);
|
|
424
424
|
return a.length === 0 ? "" : a.length === 1 ? a[0] : `(${a.join(` ${i} `)})`;
|
|
425
425
|
}
|
|
426
426
|
return "";
|
|
427
427
|
};
|
|
428
428
|
return t(e);
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function k(e, t, n) {
|
|
431
431
|
if (t == null) return { conditions: [] };
|
|
432
432
|
if (Array.isArray(t)) {
|
|
433
433
|
let r = [];
|
|
@@ -444,7 +444,7 @@ function O(e, t, n) {
|
|
|
444
444
|
operation: n
|
|
445
445
|
}] };
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function Ue(e, t) {
|
|
448
448
|
if (!t) return { conditions: [] };
|
|
449
449
|
let n = t[0], r = t[1];
|
|
450
450
|
return n == null || r == null ? n ? { conditions: [{
|
|
@@ -468,16 +468,16 @@ function We(e, t) {
|
|
|
468
468
|
}]
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
return
|
|
471
|
+
function A(e, t) {
|
|
472
|
+
return k(e, t, "eq");
|
|
473
|
+
}
|
|
474
|
+
function We(e, t) {
|
|
475
|
+
return k(e, Array.isArray(t) ? t.map((e) => e || null) : t || null, "eq");
|
|
473
476
|
}
|
|
474
477
|
function Ge(e, t) {
|
|
475
|
-
return
|
|
478
|
+
return k(e, t, "contains");
|
|
476
479
|
}
|
|
477
480
|
function Ke(e, t) {
|
|
478
|
-
return O(e, t, "contains");
|
|
479
|
-
}
|
|
480
|
-
function qe(e, t) {
|
|
481
481
|
return e ? t ? {
|
|
482
482
|
and: !0,
|
|
483
483
|
filters: [e, t]
|
|
@@ -485,36 +485,36 @@ function qe(e, t) {
|
|
|
485
485
|
}
|
|
486
486
|
//#endregion
|
|
487
487
|
//#region src/odata-service/filterDefinitions.ts
|
|
488
|
-
function
|
|
488
|
+
function qe(e) {
|
|
489
489
|
return e === "select" || e === "multi-select" || e === "checkbox" || e === "text-input" || e === "number-input";
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function j(e, t) {
|
|
492
492
|
return e?.conditions.length ? e.conditions.map((e) => e.columnId?.trim() || t).filter((e) => !!e) : [];
|
|
493
493
|
}
|
|
494
|
-
function
|
|
495
|
-
let n = e.kind === "list" ? e.options.flatMap((e) =>
|
|
494
|
+
function M(e, t) {
|
|
495
|
+
let n = e.kind === "list" ? e.options.flatMap((e) => j(e.filter, t)) : e.kind === "boolean" ? j(e.trueFilter, t) : j(e.valueFilter, t);
|
|
496
496
|
return [...new Set(n.length ? n : t ? [t] : [])];
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
let n =
|
|
498
|
+
function N(e, t) {
|
|
499
|
+
let n = j(e, t);
|
|
500
500
|
return n.length ? n : t ? [t] : [];
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function Je(e) {
|
|
503
503
|
return e.kind === "registered" ? e.valueMode === "multiple" : e.componentId === "multi-select";
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function Ye(e) {
|
|
506
506
|
return Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string").map((e) => e.trim()))] : [];
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
if (
|
|
510
|
-
let n =
|
|
508
|
+
function P(e, t) {
|
|
509
|
+
if (Je(e)) return Ye(t);
|
|
510
|
+
let n = I(t);
|
|
511
511
|
return typeof n == "string" ? [n] : [];
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function Xe(e) {
|
|
514
514
|
let t = H([e])[0];
|
|
515
515
|
return t ? t.kind === "registered" ? [...t.columnIds] : t.kind === "segment" || t.kind === "column" || t.kind === "advanced" ? [t.ownerColumnId] : [...t.columnIds] : [];
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Ze(e, t) {
|
|
518
518
|
let n = H([e])[0], r = U(t);
|
|
519
519
|
if (!n || r === void 0) return [];
|
|
520
520
|
switch (n.kind) {
|
|
@@ -527,67 +527,67 @@ function Qe(e, t) {
|
|
|
527
527
|
}
|
|
528
528
|
case "local":
|
|
529
529
|
if (n.binding.kind === "list") {
|
|
530
|
-
let e =
|
|
530
|
+
let e = P(n, r);
|
|
531
531
|
return [...new Set(e.flatMap((e) => {
|
|
532
532
|
let t = n.binding.kind === "list" ? n.binding.options.find((t) => t.key === e) : void 0;
|
|
533
|
-
return t ?
|
|
533
|
+
return t ? N(t.filter, n.ownerColumnId) : [];
|
|
534
534
|
}))];
|
|
535
535
|
}
|
|
536
|
-
return n.binding.kind === "boolean" ? r === !0 ?
|
|
536
|
+
return n.binding.kind === "boolean" ? r === !0 ? N(n.binding.trueFilter, n.ownerColumnId) : [] : N(n.binding.valueFilter, n.ownerColumnId);
|
|
537
537
|
case "registered": {
|
|
538
538
|
let e = n.binding;
|
|
539
539
|
if (!e) return [];
|
|
540
540
|
if (e.kind === "list") {
|
|
541
|
-
let t =
|
|
541
|
+
let t = P(n, r);
|
|
542
542
|
return [...new Set(t.flatMap((t) => {
|
|
543
543
|
let n = e.options.find((e) => e.key === t);
|
|
544
|
-
return n ?
|
|
544
|
+
return n ? N(n.filter, "") : [];
|
|
545
545
|
}))];
|
|
546
546
|
}
|
|
547
|
-
return e.kind === "boolean" ? r === !0 ?
|
|
547
|
+
return e.kind === "boolean" ? r === !0 ? N(e.trueFilter, "") : [] : N(e.valueFilter, "");
|
|
548
548
|
}
|
|
549
549
|
default: return [];
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function F(e, t) {
|
|
553
553
|
let n = e?.trim();
|
|
554
554
|
return n && n !== t ? n : void 0;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function I(e) {
|
|
557
557
|
if (e instanceof Date) return Number.isFinite(e.getTime()) ? e : void 0;
|
|
558
558
|
if (typeof e == "string") return e.trim();
|
|
559
559
|
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
560
560
|
if (typeof e == "boolean") return e;
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function L(e) {
|
|
563
563
|
return e instanceof Date ? `date:${e.toISOString()}` : `${typeof e}:${String(e)}`;
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function R(e) {
|
|
566
566
|
if (!Array.isArray(e)) return;
|
|
567
567
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
568
568
|
for (let r of e) {
|
|
569
|
-
let e =
|
|
569
|
+
let e = I(r);
|
|
570
570
|
if (e === void 0) continue;
|
|
571
|
-
let i =
|
|
571
|
+
let i = L(e);
|
|
572
572
|
t.has(i) || (t.add(i), n.push(e));
|
|
573
573
|
}
|
|
574
|
-
return n.sort((e, t) => i(
|
|
574
|
+
return n.sort((e, t) => i(L(e), L(t))), n.length ? n : void 0;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function Qe(e) {
|
|
577
577
|
if (!Array.isArray(e)) return;
|
|
578
578
|
let t = [...new Set(e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean))];
|
|
579
579
|
return t.length ? t : void 0;
|
|
580
580
|
}
|
|
581
581
|
function z(e) {
|
|
582
582
|
if (!e || typeof e != "object" || Array.isArray(e) || e instanceof Date) return;
|
|
583
|
-
let t = Object.fromEntries(Object.entries(e).map(([e, t]) => [e.trim(),
|
|
583
|
+
let t = Object.fromEntries(Object.entries(e).map(([e, t]) => [e.trim(), Qe(t)]).filter((e) => !!e[0] && !!e[1]?.length));
|
|
584
584
|
return Object.keys(t).length ? t : void 0;
|
|
585
585
|
}
|
|
586
586
|
function B(e) {
|
|
587
587
|
if (!e?.conditions?.length) return;
|
|
588
588
|
let t = [];
|
|
589
589
|
for (let n of e.conditions) {
|
|
590
|
-
let e =
|
|
590
|
+
let e = I(n.value);
|
|
591
591
|
n.valueSource === "static" && e === void 0 || t.push({
|
|
592
592
|
columnId: n.columnId?.trim() || void 0,
|
|
593
593
|
operation: n.operation,
|
|
@@ -645,7 +645,7 @@ function H(e) {
|
|
|
645
645
|
id: e,
|
|
646
646
|
componentId: n,
|
|
647
647
|
valueMode: i,
|
|
648
|
-
columnIds: a ?
|
|
648
|
+
columnIds: a ? M(a, "") : [],
|
|
649
649
|
binding: a
|
|
650
650
|
});
|
|
651
651
|
continue;
|
|
@@ -659,7 +659,7 @@ function H(e) {
|
|
|
659
659
|
ownerColumnId: i,
|
|
660
660
|
columnIds: [i],
|
|
661
661
|
componentId: r.componentId === "select" ? "select" : "multi-select",
|
|
662
|
-
dictionaryCodeKey:
|
|
662
|
+
dictionaryCodeKey: F(r.dictionaryCodeKey, i)
|
|
663
663
|
});
|
|
664
664
|
break;
|
|
665
665
|
case "tree": {
|
|
@@ -682,7 +682,7 @@ function H(e) {
|
|
|
682
682
|
...r,
|
|
683
683
|
id: e,
|
|
684
684
|
ownerColumnId: i,
|
|
685
|
-
columnIds:
|
|
685
|
+
columnIds: M(n, i),
|
|
686
686
|
binding: n
|
|
687
687
|
});
|
|
688
688
|
break;
|
|
@@ -708,8 +708,8 @@ function H(e) {
|
|
|
708
708
|
}
|
|
709
709
|
function U(e) {
|
|
710
710
|
if (e == null) return;
|
|
711
|
-
let t =
|
|
712
|
-
return t === void 0 ?
|
|
711
|
+
let t = I(e);
|
|
712
|
+
return t === void 0 ? R(e) || z(e) : t;
|
|
713
713
|
}
|
|
714
714
|
function W(e) {
|
|
715
715
|
if (!e) return {};
|
|
@@ -752,7 +752,7 @@ function et(e, t, n) {
|
|
|
752
752
|
return r;
|
|
753
753
|
}
|
|
754
754
|
function tt(e, t) {
|
|
755
|
-
return
|
|
755
|
+
return I(t);
|
|
756
756
|
}
|
|
757
757
|
function nt(e, t, n) {
|
|
758
758
|
let r = tt(t.valueSource, t.valueSource === "input" ? n : t.value);
|
|
@@ -773,17 +773,17 @@ function G(e, t, n) {
|
|
|
773
773
|
};
|
|
774
774
|
}
|
|
775
775
|
function rt(e) {
|
|
776
|
-
return
|
|
776
|
+
return A(e, !0);
|
|
777
777
|
}
|
|
778
778
|
function K(e, t) {
|
|
779
|
-
return
|
|
779
|
+
return A(e, t);
|
|
780
780
|
}
|
|
781
781
|
function it(e, t) {
|
|
782
782
|
let n = z(t);
|
|
783
783
|
if (!n) return;
|
|
784
784
|
let r = e.columnIds.map((e) => {
|
|
785
785
|
let t = n[e];
|
|
786
|
-
if (t?.length) return
|
|
786
|
+
if (t?.length) return A(e, t);
|
|
787
787
|
}).filter((e) => !!e);
|
|
788
788
|
if (r.length) return r.length === 1 ? r[0] : {
|
|
789
789
|
and: !0,
|
|
@@ -792,7 +792,7 @@ function it(e, t) {
|
|
|
792
792
|
}
|
|
793
793
|
function at(e, t) {
|
|
794
794
|
if (!e.binding || e.binding.kind !== "list") return;
|
|
795
|
-
let n = e.binding, r =
|
|
795
|
+
let n = e.binding, r = P(e, t);
|
|
796
796
|
if (!r.length) return;
|
|
797
797
|
let i = e.kind === "local" ? e.ownerColumnId : "", a = r.map((t) => {
|
|
798
798
|
let r = n.options.find((e) => e.key === t);
|
|
@@ -809,24 +809,24 @@ function ot(e, t) {
|
|
|
809
809
|
if (t !== void 0) switch (e.kind) {
|
|
810
810
|
case "segment": {
|
|
811
811
|
if (e.componentId === "select") {
|
|
812
|
-
let n =
|
|
812
|
+
let n = I(t);
|
|
813
813
|
return n === void 0 ? void 0 : K(e.ownerColumnId, n);
|
|
814
814
|
}
|
|
815
|
-
let n =
|
|
815
|
+
let n = R(t);
|
|
816
816
|
return n?.length ? K(e.ownerColumnId, n) : void 0;
|
|
817
817
|
}
|
|
818
818
|
case "tree": return it(e, t);
|
|
819
819
|
case "local": return e.binding.kind === "list" ? at(e, t) : e.binding.kind === "boolean" ? t === !0 ? G(e.ownerColumnId, e.binding.trueFilter) ?? rt(e.ownerColumnId) : void 0 : G(e.ownerColumnId, e.binding.valueFilter, t) ?? (() => {
|
|
820
|
-
let n =
|
|
820
|
+
let n = I(t), r = R(t), i = n ?? r;
|
|
821
821
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
822
822
|
})();
|
|
823
823
|
case "registered": return e.binding ? e.binding.kind === "list" ? at(e, t) : e.binding.kind === "boolean" ? t === !0 ? G("", e.binding.trueFilter) : void 0 : G("", e.binding.valueFilter, t) : void 0;
|
|
824
824
|
case "column": {
|
|
825
|
-
let n =
|
|
825
|
+
let n = I(t), r = R(t), i = n ?? r;
|
|
826
826
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
827
827
|
}
|
|
828
828
|
case "advanced": {
|
|
829
|
-
let n =
|
|
829
|
+
let n = R(t);
|
|
830
830
|
return n?.length ? K(e.ownerColumnId, n) : void 0;
|
|
831
831
|
}
|
|
832
832
|
default:
|
|
@@ -848,7 +848,7 @@ function ct(e, t) {
|
|
|
848
848
|
let t = r[e.id];
|
|
849
849
|
if (t === void 0) continue;
|
|
850
850
|
if (e.kind === "segment") {
|
|
851
|
-
let n = typeof t == "string" ? t : void 0, r =
|
|
851
|
+
let n = typeof t == "string" ? t : void 0, r = Qe(t), a = n ? [n] : r;
|
|
852
852
|
if (!a?.length) continue;
|
|
853
853
|
i[e.dictionaryCodeKey ?? e.ownerColumnId] = a;
|
|
854
854
|
continue;
|
|
@@ -1192,40 +1192,53 @@ function Gt(e, t) {
|
|
|
1192
1192
|
values: t
|
|
1193
1193
|
};
|
|
1194
1194
|
}
|
|
1195
|
-
function Kt(e) {
|
|
1195
|
+
function Kt(e, t) {
|
|
1196
|
+
return {
|
|
1197
|
+
operation: "group",
|
|
1198
|
+
conjunction: t,
|
|
1199
|
+
expressions: e
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
function qt(e) {
|
|
1196
1203
|
if (e instanceof Date) throw Error("Дата должна быть отформатирована вызывающей стороной до формирования SQL-фильтра");
|
|
1197
1204
|
if (!Ut(e) || typeof e == "number" && !Number.isFinite(e)) return;
|
|
1198
1205
|
let t = String(e);
|
|
1199
1206
|
if (!(!t || t.trim() === "")) return `'${t.replaceAll("'", "''")}'`;
|
|
1200
1207
|
}
|
|
1201
|
-
function
|
|
1208
|
+
function Jt(e) {
|
|
1209
|
+
if (e.operation === "group") {
|
|
1210
|
+
let t = e.expressions.map((e) => Jt(e)).filter((e) => !!e);
|
|
1211
|
+
if (!t.length) return;
|
|
1212
|
+
let n = e.conjunction === "or" ? " OR " : " AND ";
|
|
1213
|
+
return `(${t.join(n)})`;
|
|
1214
|
+
}
|
|
1202
1215
|
if (e.operation === "eq") {
|
|
1203
|
-
let t =
|
|
1216
|
+
let t = qt(e.value);
|
|
1204
1217
|
return t ? ($(e.fieldId), `${e.fieldId}=${t}`) : void 0;
|
|
1205
1218
|
}
|
|
1206
|
-
let t = (e.values ?? []).map((e) =>
|
|
1219
|
+
let t = (e.values ?? []).map((e) => qt(e)).filter((e) => !!e);
|
|
1207
1220
|
if (t.length !== 0) return $(e.fieldId), `${e.fieldId} IN (${t.join(", ")})`;
|
|
1208
1221
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return e ? e.map((e) =>
|
|
1222
|
+
function Yt(e) {
|
|
1223
|
+
return e ? e.map((e) => Jt(e)).filter((e) => !!e).join(" AND ") : "";
|
|
1211
1224
|
}
|
|
1212
1225
|
//#endregion
|
|
1213
1226
|
//#region src/odata-service/typesValidation.ts
|
|
1214
|
-
function
|
|
1227
|
+
function Xt(e) {
|
|
1215
1228
|
return e === "boolean";
|
|
1216
1229
|
}
|
|
1217
|
-
function
|
|
1230
|
+
function Zt(e) {
|
|
1218
1231
|
return e === "byte" || e === "int" || e === "long" || e === "float" || e === "decimal" || e === "double";
|
|
1219
1232
|
}
|
|
1220
|
-
function
|
|
1233
|
+
function Qt(e) {
|
|
1221
1234
|
return e === "byte" || e === "int" || e === "long";
|
|
1222
1235
|
}
|
|
1223
|
-
function
|
|
1236
|
+
function $t(e) {
|
|
1224
1237
|
return e === "datetime" || e === "datetimeOffset" || e === "time";
|
|
1225
1238
|
}
|
|
1226
1239
|
//#endregion
|
|
1227
1240
|
//#region src/odata-service/unwrapODataQueryResult.ts
|
|
1228
|
-
function
|
|
1241
|
+
function en(e) {
|
|
1229
1242
|
let t = e.data?.data, n = e.data?.totalCount;
|
|
1230
1243
|
return {
|
|
1231
1244
|
...e,
|
|
@@ -1235,30 +1248,30 @@ function $t(e) {
|
|
|
1235
1248
|
}
|
|
1236
1249
|
//#endregion
|
|
1237
1250
|
//#region src/odata-service/utils.ts
|
|
1238
|
-
function
|
|
1239
|
-
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [
|
|
1251
|
+
function tn(e) {
|
|
1252
|
+
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [rn(e) ? e ?? null : null, null];
|
|
1240
1253
|
}
|
|
1241
|
-
function
|
|
1254
|
+
function nn(t) {
|
|
1242
1255
|
return t instanceof Date ? t : Array.isArray(t) || e(t) ? null : t;
|
|
1243
1256
|
}
|
|
1244
|
-
function
|
|
1257
|
+
function rn(e) {
|
|
1245
1258
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1246
1259
|
}
|
|
1247
1260
|
//#endregion
|
|
1248
1261
|
//#region src/odata-service/wrapParams.ts
|
|
1249
|
-
function
|
|
1262
|
+
function an(e) {
|
|
1250
1263
|
if (!e) return {};
|
|
1251
1264
|
let t = {};
|
|
1252
1265
|
for (let n in e) t[n] = { value: e[n] };
|
|
1253
1266
|
return t;
|
|
1254
1267
|
}
|
|
1255
|
-
function
|
|
1268
|
+
function on(e) {
|
|
1256
1269
|
if (!e) return;
|
|
1257
1270
|
let t = {};
|
|
1258
1271
|
for (let n of Object.keys(e).sort()) t[n] = e[n]?.value ?? null;
|
|
1259
1272
|
return t;
|
|
1260
1273
|
}
|
|
1261
1274
|
//#endregion
|
|
1262
|
-
export {
|
|
1275
|
+
export { E as $, ct as A, ie as At, W as B, q as C, ce as Ct, ut as D, d as Dt, Ft as E, f as Et, Xe as F, o as Ft, k as G, Me as H, V as I, s as It, A as J, Ue as K, B as L, $e as M, l as Mt, F as N, c as Nt, et as O, ne as Ot, Ze as P, u as Pt, Le as Q, H as R, Rt as S, se as St, dt as T, ae as Tt, O as U, Ne as V, He as W, Ie as X, We as Y, Ke as Z, Lt as _, we as _t, tn as a, Ae as at, Vt as b, g as bt, $t as c, y as ct, $ as d, me as dt, je as et, Yt as f, pe as ft, Ut as g, De as gt, Gt as h, Ee as ht, nn as i, w as it, qe as j, ee as jt, st as k, re as kt, Qt as l, _ as lt, Kt as m, x as mt, an as n, C as nt, en as o, S as ot, Wt as p, fe as pt, Ge as q, rn as r, T as rt, Xt as s, v as st, on as t, ke as tt, Zt as u, he as ut, Bt as v, Te as vt, ft as w, oe as wt, zt as x, de as xt, It as y, h as yt, U as z };
|
|
1263
1276
|
|
|
1264
|
-
//# sourceMappingURL=odata-service-
|
|
1277
|
+
//# sourceMappingURL=odata-service-DNYr2dDx.js.map
|