@ryuzaki13/react-foundation-lib 1.1.12 → 1.1.14
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-DPMcERgh.js → formatters-CqOO2pwH.js} +3 -3
- package/dist/chunks/{formatters-DPMcERgh.js.map → formatters-CqOO2pwH.js.map} +1 -1
- package/dist/chunks/{odata-service-CEfjPsY9.js → odata-service-CDYp5CIE.js} +302 -264
- package/dist/chunks/odata-service-CDYp5CIE.js.map +1 -0
- package/dist/chunks/{validate-Ddyzk756.js → validate-Cxg_lLUY.js} +2 -2
- package/dist/chunks/{validate-Ddyzk756.js.map → validate-Cxg_lLUY.js.map} +1 -1
- package/dist/error-report/index.js +1 -1
- package/dist/excel/index.js +2 -2
- package/dist/formatters/index.js +3 -3
- package/dist/odata-service/builder.d.ts +1 -1
- package/dist/odata-service/builder.d.ts.map +1 -1
- package/dist/odata-service/filterDefinitions.d.ts +16 -1
- package/dist/odata-service/filterDefinitions.d.ts.map +1 -1
- package/dist/odata-service/index.js +1 -1
- package/dist/odata-service/types.d.ts +12 -4
- package/dist/odata-service/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/odata-service-CEfjPsY9.js.map +0 -1
|
@@ -35,36 +35,36 @@ function c(e) {
|
|
|
35
35
|
function l(e) {
|
|
36
36
|
return c(e) ?? 0;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function ee(e) {
|
|
39
39
|
let t = c(e);
|
|
40
40
|
return t ? t > 0 : !1;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function u(e) {
|
|
43
43
|
let t = c(e);
|
|
44
44
|
if (!(t === void 0 || !Number.isInteger(t) || t <= 0)) return t;
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/odata-service/baseTypes.ts
|
|
48
|
-
var
|
|
48
|
+
var d = Object.freeze([
|
|
49
49
|
"string",
|
|
50
50
|
"number",
|
|
51
51
|
"boolean",
|
|
52
52
|
"date"
|
|
53
|
-
]),
|
|
53
|
+
]), te = new Set(d), ne = Object.freeze({
|
|
54
54
|
string: "строка",
|
|
55
55
|
number: "число",
|
|
56
56
|
boolean: "boolean",
|
|
57
57
|
date: "дата"
|
|
58
58
|
});
|
|
59
|
-
function ne(e) {
|
|
60
|
-
return typeof e == "string" && ee.has(e);
|
|
61
|
-
}
|
|
62
59
|
function re(e) {
|
|
63
|
-
return te
|
|
60
|
+
return typeof e == "string" && te.has(e);
|
|
61
|
+
}
|
|
62
|
+
function ie(e) {
|
|
63
|
+
return ne[e];
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/odata-service/schema.ts
|
|
67
|
-
var
|
|
67
|
+
var f = {
|
|
68
68
|
string: a.string(),
|
|
69
69
|
guid: a.uuid().or(a.string().regex(/^[0-9a-fA-F-]+$/, "Invalid GUID")),
|
|
70
70
|
boolean: a.boolean(),
|
|
@@ -79,24 +79,24 @@ var p = {
|
|
|
79
79
|
binary: a.string(),
|
|
80
80
|
byte: a.number().int().min(0).max(255)
|
|
81
81
|
};
|
|
82
|
-
function
|
|
82
|
+
function p(e, t) {
|
|
83
83
|
return t.safeParse(e).success;
|
|
84
84
|
}
|
|
85
|
-
function ie(e) {
|
|
86
|
-
return m(e, p.string);
|
|
87
|
-
}
|
|
88
85
|
function ae(e) {
|
|
89
|
-
return
|
|
86
|
+
return p(e, f.string);
|
|
90
87
|
}
|
|
91
88
|
function oe(e) {
|
|
92
|
-
return
|
|
89
|
+
return p(e, f.float);
|
|
93
90
|
}
|
|
94
91
|
function se(e) {
|
|
95
|
-
return
|
|
92
|
+
return p(e, f.boolean);
|
|
93
|
+
}
|
|
94
|
+
function ce(e) {
|
|
95
|
+
return p(e, f.datetime);
|
|
96
96
|
}
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/odata-service/formatters.ts
|
|
99
|
-
function
|
|
99
|
+
function m(e, t) {
|
|
100
100
|
switch (e) {
|
|
101
101
|
case "string": return `'${String(t).replace(/'/g, "''")}'`;
|
|
102
102
|
case "guid": return `guid'${String(t)}'`;
|
|
@@ -116,12 +116,12 @@ function h(e, t) {
|
|
|
116
116
|
default: throw Error(`Неподдерживаемый тип: ${e}`);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
let n =
|
|
119
|
+
function h(e, t) {
|
|
120
|
+
let n = f[e].safeParse(t);
|
|
121
121
|
if (!n.success) throw Error(`Некорректное значение для типа '${e}': ${n.error.issues[0]?.message ?? t}`);
|
|
122
|
-
return
|
|
122
|
+
return m(e, n.data);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function le(e) {
|
|
125
125
|
if (typeof e == "boolean") return e;
|
|
126
126
|
if (typeof e == "number") return e === 1 ? !0 : e === 0 ? !1 : void 0;
|
|
127
127
|
if (typeof e != "string") return;
|
|
@@ -131,13 +131,13 @@ function ce(e) {
|
|
|
131
131
|
if (t === "true" || t === "1") return !0;
|
|
132
132
|
if (t === "false" || t === "0") return !1;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
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 de(e, n) {
|
|
139
139
|
switch (e) {
|
|
140
|
-
case "boolean": return
|
|
140
|
+
case "boolean": return le(n) ?? n;
|
|
141
141
|
case "int":
|
|
142
142
|
case "long":
|
|
143
143
|
case "float":
|
|
@@ -150,14 +150,14 @@ function ue(e, n) {
|
|
|
150
150
|
default: return String(n);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function fe(e, t) {
|
|
154
154
|
if (e.abapBooleanLike) {
|
|
155
|
-
let e =
|
|
155
|
+
let e = ue(t);
|
|
156
156
|
if (e !== void 0) return e;
|
|
157
157
|
}
|
|
158
|
-
return
|
|
158
|
+
return de(e.type, t);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function pe(e) {
|
|
161
161
|
switch (e) {
|
|
162
162
|
case "boolean": return !1;
|
|
163
163
|
case "int":
|
|
@@ -172,7 +172,7 @@ function fe(e) {
|
|
|
172
172
|
default: return "";
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function me(e) {
|
|
176
176
|
switch (e) {
|
|
177
177
|
case "boolean": return !1;
|
|
178
178
|
case "number": return 0;
|
|
@@ -180,72 +180,72 @@ function pe(e) {
|
|
|
180
180
|
default: return "";
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function g(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
|
|
192
|
-
}
|
|
193
|
-
function me(e) {
|
|
194
|
-
return _(a.array(a.string()), e);
|
|
190
|
+
function _(e) {
|
|
191
|
+
return g(a.array(a.boolean()), e);
|
|
195
192
|
}
|
|
196
193
|
function he(e) {
|
|
197
|
-
return
|
|
194
|
+
return g(a.array(a.string()), e);
|
|
198
195
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
196
|
+
function ge(e) {
|
|
197
|
+
return g(a.array(a.number()), e);
|
|
201
198
|
}
|
|
202
|
-
|
|
199
|
+
function v(e) {
|
|
200
|
+
return g(a.array(a.date()), e);
|
|
201
|
+
}
|
|
202
|
+
var _e = v(r.datetime), ve = v(r.datetimeOffset), ye = v(r.time), be = v((e) => m("string", n(e))), xe = _((e) => m("boolean", e)), Se = _((e) => m("string", Number(e))), Ce = _((e) => m("byte", Number(e))), we = he((e) => m("string", e)), y = {
|
|
203
203
|
date: {
|
|
204
204
|
base: {
|
|
205
205
|
label: "Базовый datetime",
|
|
206
206
|
description: "Используется для параметров OData с типом данных datetime",
|
|
207
|
-
fn:
|
|
207
|
+
fn: _e
|
|
208
208
|
},
|
|
209
209
|
datetimeOffset: {
|
|
210
210
|
label: "Базовый datetimeoffset",
|
|
211
211
|
description: "Используется для параметров OData с типом данных datetimeoffset",
|
|
212
|
-
fn:
|
|
212
|
+
fn: ve
|
|
213
213
|
},
|
|
214
214
|
time: {
|
|
215
215
|
label: "Базовый time",
|
|
216
216
|
description: "Используется для параметров OData с типом данных time",
|
|
217
|
-
fn:
|
|
217
|
+
fn: ye
|
|
218
218
|
},
|
|
219
219
|
stringAbapDate: {
|
|
220
220
|
label: "Дата ABAP YYYYMMDD",
|
|
221
221
|
description: "Используется для параметров OData с типом данных string(8)",
|
|
222
|
-
fn:
|
|
222
|
+
fn: be
|
|
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: xe
|
|
230
230
|
},
|
|
231
231
|
asChar: {
|
|
232
232
|
label: "Как символ",
|
|
233
233
|
description: "Преобразование булево в символы '0' или '1'",
|
|
234
|
-
fn:
|
|
234
|
+
fn: Se
|
|
235
235
|
},
|
|
236
236
|
asByte: {
|
|
237
237
|
label: "Как цифра",
|
|
238
238
|
description: "Преобразование булево в цифру 0 или 1",
|
|
239
|
-
fn:
|
|
239
|
+
fn: Ce
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
242
|
string: { base: {
|
|
243
243
|
label: "Базовая строка",
|
|
244
244
|
description: "",
|
|
245
|
-
fn:
|
|
245
|
+
fn: we
|
|
246
246
|
} }
|
|
247
247
|
};
|
|
248
|
-
function
|
|
248
|
+
function b(e) {
|
|
249
249
|
switch (e) {
|
|
250
250
|
case "boolean": return "boolean";
|
|
251
251
|
case "int":
|
|
@@ -260,80 +260,81 @@ function x(e) {
|
|
|
260
260
|
default: return "string";
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
let t = b
|
|
263
|
+
function Te(e) {
|
|
264
|
+
let t = y[b(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 Ee(e) {
|
|
271
|
+
let t = y[e];
|
|
272
272
|
return t ? Object.entries(t).map(([e, t]) => ({
|
|
273
273
|
id: e,
|
|
274
274
|
...t
|
|
275
275
|
})) : [];
|
|
276
276
|
}
|
|
277
|
-
function Ee(e, t) {
|
|
278
|
-
return b[x(e)]?.[t];
|
|
279
|
-
}
|
|
280
277
|
function De(e, t) {
|
|
281
|
-
return b
|
|
278
|
+
return y[b(e)]?.[t];
|
|
279
|
+
}
|
|
280
|
+
function Oe(e, t) {
|
|
281
|
+
return y[e]?.[t];
|
|
282
282
|
}
|
|
283
283
|
//#endregion
|
|
284
284
|
//#region src/odata-service/builder.ts
|
|
285
|
-
function
|
|
285
|
+
function ke(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 x(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}`);
|
|
296
296
|
if (s == null) return null;
|
|
297
297
|
try {
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
if (Array.isArray(s) && !c) throw Error("Массив значений OData-параметра требует custom formatter");
|
|
299
|
+
let e = c ? c(s) : h(r, s);
|
|
300
|
+
return ke(e, i), [n, e];
|
|
300
301
|
} catch (e) {
|
|
301
302
|
throw Error(`Ошибка форматирования параметра ${n}: ${String(e)}`);
|
|
302
303
|
}
|
|
303
304
|
}).filter((e) => e !== null) : [];
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
-
let n =
|
|
306
|
+
function S(e, t) {
|
|
307
|
+
let n = x(e, t);
|
|
307
308
|
return n.length ? `(${n.map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join(",")})` : "";
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
+
function C(e, t) {
|
|
310
311
|
let n = new URLSearchParams();
|
|
311
|
-
for (let [r, i] of
|
|
312
|
+
for (let [r, i] of x(e, t)) n.set(r, i);
|
|
312
313
|
return n;
|
|
313
314
|
}
|
|
314
|
-
function
|
|
315
|
+
function Ae(e, t, n, r) {
|
|
315
316
|
let i = `/${t.service}/${t.target}`;
|
|
316
|
-
return r === "create" ? i : r === "query" ? e.result ?
|
|
317
|
+
return r === "create" ? i : r === "query" ? e.result ? w(e, t, n) : (__DEV__ && Object.keys(n).length > 0 && console.warn(`Параметры для query-запроса '/${t.service}/${t.target}' проигнорированы: target не поддерживает parameterized query.`), i) : `${i}${S(e, n)}`;
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
-
let r =
|
|
319
|
+
function je(e, t, n) {
|
|
320
|
+
let r = C(e, n).toString(), i = `/${t.service}/${t.target}`;
|
|
320
321
|
return r ? `${i}?${r}` : i;
|
|
321
322
|
}
|
|
322
|
-
function
|
|
323
|
-
let r =
|
|
323
|
+
function w(e, t, n) {
|
|
324
|
+
let r = S(e, n), i = e.result ? `/${e.result}` : "";
|
|
324
325
|
return `/${t.service}/${t.target}${r}${i}`;
|
|
325
326
|
}
|
|
326
327
|
//#endregion
|
|
327
328
|
//#region src/odata-service/columns.ts
|
|
328
|
-
function
|
|
329
|
+
function T(e) {
|
|
329
330
|
return e.filter((e) => e.semanticType === "code" && e.filterable);
|
|
330
331
|
}
|
|
331
|
-
function
|
|
332
|
-
return new Set(
|
|
332
|
+
function Me(e) {
|
|
333
|
+
return new Set(T(e).map((e) => e.id));
|
|
333
334
|
}
|
|
334
335
|
//#endregion
|
|
335
336
|
//#region src/odata-service/filters.ts
|
|
336
|
-
var
|
|
337
|
+
var Ne = Object.freeze({
|
|
337
338
|
eq: "eq",
|
|
338
339
|
ne: "ne",
|
|
339
340
|
gt: "gt",
|
|
@@ -343,7 +344,7 @@ var Me = Object.freeze({
|
|
|
343
344
|
startswith: "startswith",
|
|
344
345
|
endswith: "endswith",
|
|
345
346
|
contains: "contains"
|
|
346
|
-
}),
|
|
347
|
+
}), Pe = Object.freeze(Object.values(Ne)), Fe = Object.freeze({
|
|
347
348
|
eq: "равно",
|
|
348
349
|
ne: "не равно",
|
|
349
350
|
gt: "больше",
|
|
@@ -353,14 +354,14 @@ var Me = Object.freeze({
|
|
|
353
354
|
startswith: "начинается с",
|
|
354
355
|
endswith: "заканчивается на",
|
|
355
356
|
contains: "содержит"
|
|
356
|
-
}),
|
|
357
|
-
function Ie(e) {
|
|
358
|
-
return typeof e == "string" && Fe.has(e);
|
|
359
|
-
}
|
|
357
|
+
}), Ie = new Set(Pe);
|
|
360
358
|
function Le(e) {
|
|
361
|
-
return
|
|
359
|
+
return typeof e == "string" && Ie.has(e);
|
|
362
360
|
}
|
|
363
361
|
function Re(e) {
|
|
362
|
+
return Fe[e];
|
|
363
|
+
}
|
|
364
|
+
function ze(e) {
|
|
364
365
|
switch (typeof e) {
|
|
365
366
|
case "bigint":
|
|
366
367
|
case "number": return "int";
|
|
@@ -369,17 +370,17 @@ function Re(e) {
|
|
|
369
370
|
}
|
|
370
371
|
return "string";
|
|
371
372
|
}
|
|
372
|
-
function
|
|
373
|
-
let { key: t, operation: n = "eq", value: r, type: i } = e, a =
|
|
373
|
+
function E(e) {
|
|
374
|
+
let { key: t, operation: n = "eq", value: r, type: i } = e, a = h(i ?? ze(r), r);
|
|
374
375
|
return n === "contains" ? `substringof(${a},${String(t)})` : n === "startswith" || n === "endswith" ? `${n}(${String(t)}, ${a})` : `${String(t)} ${n} ${a}`;
|
|
375
376
|
}
|
|
376
|
-
function
|
|
377
|
+
function Be(e) {
|
|
377
378
|
return "conditions" in e && e.conditions !== void 0;
|
|
378
379
|
}
|
|
379
|
-
function
|
|
380
|
+
function Ve(e) {
|
|
380
381
|
return "filters" in e && e.filters !== void 0;
|
|
381
382
|
}
|
|
382
|
-
function
|
|
383
|
+
function He(e, t) {
|
|
383
384
|
let n = [];
|
|
384
385
|
for (let r of e) {
|
|
385
386
|
let e = t(r);
|
|
@@ -387,46 +388,46 @@ function ze(e, t) {
|
|
|
387
388
|
}
|
|
388
389
|
return n;
|
|
389
390
|
}
|
|
390
|
-
function
|
|
391
|
+
function D(e) {
|
|
391
392
|
if (!e) return "";
|
|
392
|
-
if (
|
|
393
|
+
if (Be(e)) {
|
|
393
394
|
let { conditions: t, and: n = !1 } = e;
|
|
394
395
|
if (t.length === 0) return "";
|
|
395
|
-
if (t.length === 1) return
|
|
396
|
+
if (t.length === 1) return E(t[0]);
|
|
396
397
|
let r = n ? "and" : "or";
|
|
397
|
-
return `(${t.map(
|
|
398
|
+
return `(${t.map(E).join(` ${r} `)})`;
|
|
398
399
|
}
|
|
399
|
-
if (
|
|
400
|
+
if (Ve(e)) {
|
|
400
401
|
let { filters: t, and: n = !1 } = e;
|
|
401
402
|
if (t.length === 0) return "";
|
|
402
|
-
if (t.length === 1) return
|
|
403
|
-
let r = n ? "and" : "or", i =
|
|
403
|
+
if (t.length === 1) return D(t[0]);
|
|
404
|
+
let r = n ? "and" : "or", i = He(t, D);
|
|
404
405
|
return i.length === 0 ? "" : i.length === 1 ? i[0] : `(${i.join(` ${r} `)})`;
|
|
405
406
|
}
|
|
406
407
|
throw Error("Некорректное выражение фильтра");
|
|
407
408
|
}
|
|
408
|
-
function
|
|
409
|
+
function Ue(e) {
|
|
409
410
|
let t = (e) => {
|
|
410
411
|
if (!e) return "";
|
|
411
|
-
if (
|
|
412
|
+
if (Be(e)) {
|
|
412
413
|
let { conditions: t, and: n = !1 } = e;
|
|
413
414
|
if (t.length === 0) return "";
|
|
414
|
-
if (t.length === 1) return
|
|
415
|
+
if (t.length === 1) return E(t[0]);
|
|
415
416
|
let r = n ? "and" : "or";
|
|
416
|
-
return `(${t.map(
|
|
417
|
+
return `(${t.map(E).join(` ${r} `)})`;
|
|
417
418
|
}
|
|
418
|
-
if (
|
|
419
|
+
if (Ve(e)) {
|
|
419
420
|
let { filters: n, and: r = !1 } = e;
|
|
420
421
|
if (n.length === 0) return "";
|
|
421
422
|
if (n.length === 1) return t(n[0]);
|
|
422
|
-
let i = r ? "and" : "or", a =
|
|
423
|
+
let i = r ? "and" : "or", a = He(n, t).map((e) => e.includes(" ") ? `(${e})` : e);
|
|
423
424
|
return a.length === 0 ? "" : a.length === 1 ? a[0] : `(${a.join(` ${i} `)})`;
|
|
424
425
|
}
|
|
425
426
|
return "";
|
|
426
427
|
};
|
|
427
428
|
return t(e);
|
|
428
429
|
}
|
|
429
|
-
function
|
|
430
|
+
function O(e, t, n) {
|
|
430
431
|
if (t == null) return { conditions: [] };
|
|
431
432
|
if (Array.isArray(t)) {
|
|
432
433
|
let r = [];
|
|
@@ -443,7 +444,7 @@ function j(e, t, n) {
|
|
|
443
444
|
operation: n
|
|
444
445
|
}] };
|
|
445
446
|
}
|
|
446
|
-
function
|
|
447
|
+
function We(e, t) {
|
|
447
448
|
if (!t) return { conditions: [] };
|
|
448
449
|
let n = t[0], r = t[1];
|
|
449
450
|
return n == null || r == null ? n ? { conditions: [{
|
|
@@ -467,16 +468,16 @@ function Ve(e, t) {
|
|
|
467
468
|
}]
|
|
468
469
|
};
|
|
469
470
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
471
|
+
function k(e, t) {
|
|
472
|
+
return O(e, t, "eq");
|
|
472
473
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
474
|
+
function Ge(e, t) {
|
|
475
|
+
return O(e, Array.isArray(t) ? t.map((e) => e || null) : t || null, "eq");
|
|
475
476
|
}
|
|
476
|
-
function
|
|
477
|
-
return
|
|
477
|
+
function Ke(e, t) {
|
|
478
|
+
return O(e, t, "contains");
|
|
478
479
|
}
|
|
479
|
-
function
|
|
480
|
+
function qe(e, t) {
|
|
480
481
|
return e ? t ? {
|
|
481
482
|
and: !0,
|
|
482
483
|
filters: [e, t]
|
|
@@ -484,30 +485,36 @@ function We(e, t) {
|
|
|
484
485
|
}
|
|
485
486
|
//#endregion
|
|
486
487
|
//#region src/odata-service/filterDefinitions.ts
|
|
487
|
-
function
|
|
488
|
+
function Je(e) {
|
|
488
489
|
return e === "select" || e === "multi-select" || e === "checkbox" || e === "text-input" || e === "number-input";
|
|
489
490
|
}
|
|
490
|
-
function
|
|
491
|
+
function A(e, t) {
|
|
491
492
|
return e?.conditions.length ? e.conditions.map((e) => e.columnId?.trim() || t).filter((e) => !!e) : [];
|
|
492
493
|
}
|
|
493
|
-
function
|
|
494
|
-
let n = e.kind === "list" ? e.options.flatMap((e) =>
|
|
495
|
-
return [...new Set(n.length ? n : [t])];
|
|
494
|
+
function j(e, t) {
|
|
495
|
+
let n = e.kind === "list" ? e.options.flatMap((e) => A(e.filter, t)) : e.kind === "boolean" ? A(e.trueFilter, t) : A(e.valueFilter, t);
|
|
496
|
+
return [...new Set(n.length ? n : t ? [t] : [])];
|
|
496
497
|
}
|
|
497
|
-
function
|
|
498
|
-
let n =
|
|
499
|
-
return n.length ? n : [t];
|
|
498
|
+
function M(e, t) {
|
|
499
|
+
let n = A(e, t);
|
|
500
|
+
return n.length ? n : t ? [t] : [];
|
|
500
501
|
}
|
|
501
|
-
function
|
|
502
|
-
|
|
502
|
+
function Ye(e) {
|
|
503
|
+
return e.kind === "registered" ? e.valueMode === "multiple" : e.componentId === "multi-select";
|
|
504
|
+
}
|
|
505
|
+
function Xe(e) {
|
|
506
|
+
return Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string").map((e) => e.trim()))] : [];
|
|
507
|
+
}
|
|
508
|
+
function N(e, t) {
|
|
509
|
+
if (Ye(e)) return Xe(t);
|
|
503
510
|
let n = F(t);
|
|
504
|
-
return typeof n == "string"
|
|
511
|
+
return typeof n == "string" ? [n] : [];
|
|
505
512
|
}
|
|
506
|
-
function
|
|
513
|
+
function Ze(e) {
|
|
507
514
|
let t = H([e])[0];
|
|
508
|
-
return t ? t.kind === "segment" || t.kind === "column" || t.kind === "advanced" ? [t.ownerColumnId] : [...t.columnIds] : [];
|
|
515
|
+
return t ? t.kind === "registered" ? [...t.columnIds] : t.kind === "segment" || t.kind === "column" || t.kind === "advanced" ? [t.ownerColumnId] : [...t.columnIds] : [];
|
|
509
516
|
}
|
|
510
|
-
function
|
|
517
|
+
function Qe(e, t) {
|
|
511
518
|
let n = H([e])[0], r = U(t);
|
|
512
519
|
if (!n || r === void 0) return [];
|
|
513
520
|
switch (n.kind) {
|
|
@@ -520,17 +527,29 @@ function Ye(e, t) {
|
|
|
520
527
|
}
|
|
521
528
|
case "local":
|
|
522
529
|
if (n.binding.kind === "list") {
|
|
523
|
-
let e =
|
|
530
|
+
let e = N(n, r);
|
|
524
531
|
return [...new Set(e.flatMap((e) => {
|
|
525
532
|
let t = n.binding.kind === "list" ? n.binding.options.find((t) => t.key === e) : void 0;
|
|
526
|
-
return t ?
|
|
533
|
+
return t ? M(t.filter, n.ownerColumnId) : [];
|
|
534
|
+
}))];
|
|
535
|
+
}
|
|
536
|
+
return n.binding.kind === "boolean" ? r === !0 ? M(n.binding.trueFilter, n.ownerColumnId) : [] : M(n.binding.valueFilter, n.ownerColumnId);
|
|
537
|
+
case "registered": {
|
|
538
|
+
let e = n.binding;
|
|
539
|
+
if (!e) return [];
|
|
540
|
+
if (e.kind === "list") {
|
|
541
|
+
let t = N(n, r);
|
|
542
|
+
return [...new Set(t.flatMap((t) => {
|
|
543
|
+
let n = e.options.find((e) => e.key === t);
|
|
544
|
+
return n ? M(n.filter, "") : [];
|
|
527
545
|
}))];
|
|
528
546
|
}
|
|
529
|
-
return
|
|
547
|
+
return e.kind === "boolean" ? r === !0 ? M(e.trueFilter, "") : [] : M(e.valueFilter, "");
|
|
548
|
+
}
|
|
530
549
|
default: return [];
|
|
531
550
|
}
|
|
532
551
|
}
|
|
533
|
-
function
|
|
552
|
+
function P(e, t) {
|
|
534
553
|
let n = e?.trim();
|
|
535
554
|
return n && n !== t ? n : void 0;
|
|
536
555
|
}
|
|
@@ -593,10 +612,13 @@ function V(e) {
|
|
|
593
612
|
filter: B(n.filter)
|
|
594
613
|
});
|
|
595
614
|
}
|
|
596
|
-
|
|
615
|
+
if (!t.length) return;
|
|
616
|
+
let n = e.and === !0 ? !0 : e.and === !1 ? !1 : void 0;
|
|
617
|
+
return {
|
|
597
618
|
kind: "list",
|
|
619
|
+
...n === void 0 ? {} : { and: n },
|
|
598
620
|
options: t
|
|
599
|
-
}
|
|
621
|
+
};
|
|
600
622
|
}
|
|
601
623
|
return e.kind === "boolean" ? {
|
|
602
624
|
kind: "boolean",
|
|
@@ -611,57 +633,72 @@ function H(e) {
|
|
|
611
633
|
if (!e?.length) return [];
|
|
612
634
|
let t = [];
|
|
613
635
|
for (let n of e) {
|
|
614
|
-
let e = n.id.trim()
|
|
615
|
-
if (!e
|
|
616
|
-
let
|
|
617
|
-
|
|
636
|
+
let e = n.id.trim();
|
|
637
|
+
if (!e) continue;
|
|
638
|
+
let r = { ...n };
|
|
639
|
+
if (r.kind === "odata-segment" && (r.kind = "segment"), r.kind === "odata-tree" && (r.kind = "tree"), r.kind === "registered") {
|
|
640
|
+
let n = r.componentId.trim(), i = r.valueMode;
|
|
641
|
+
if (!n || i !== "single" && i !== "multiple") continue;
|
|
642
|
+
let a = V(r.binding);
|
|
643
|
+
t.push({
|
|
644
|
+
...r,
|
|
645
|
+
id: e,
|
|
646
|
+
componentId: n,
|
|
647
|
+
valueMode: i,
|
|
648
|
+
columnIds: a ? j(a, "") : [],
|
|
649
|
+
binding: a
|
|
650
|
+
});
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
let i = r.ownerColumnId.trim();
|
|
654
|
+
if (i) switch (r.kind) {
|
|
618
655
|
case "segment":
|
|
619
656
|
t.push({
|
|
620
|
-
...
|
|
657
|
+
...r,
|
|
621
658
|
id: e,
|
|
622
|
-
ownerColumnId:
|
|
623
|
-
columnIds: [
|
|
624
|
-
componentId:
|
|
625
|
-
dictionaryCodeKey:
|
|
659
|
+
ownerColumnId: i,
|
|
660
|
+
columnIds: [i],
|
|
661
|
+
componentId: r.componentId === "select" ? "select" : "multi-select",
|
|
662
|
+
dictionaryCodeKey: P(r.dictionaryCodeKey, i)
|
|
626
663
|
});
|
|
627
664
|
break;
|
|
628
665
|
case "tree": {
|
|
629
|
-
let n = [...new Set(
|
|
666
|
+
let n = [...new Set(r.columnIds.map((e) => e.trim()).filter(Boolean))];
|
|
630
667
|
if (n.length < 2) break;
|
|
631
|
-
let a =
|
|
668
|
+
let a = r.componentId, o = a === "treeSelect" || a === "tree-select" ? "tree-select" : "tree-multi-select";
|
|
632
669
|
t.push({
|
|
633
|
-
...
|
|
670
|
+
...r,
|
|
634
671
|
id: e,
|
|
635
|
-
ownerColumnId: n.includes(
|
|
672
|
+
ownerColumnId: n.includes(i) ? i : n[0],
|
|
636
673
|
columnIds: n,
|
|
637
674
|
componentId: o
|
|
638
675
|
});
|
|
639
676
|
break;
|
|
640
677
|
}
|
|
641
678
|
case "local": {
|
|
642
|
-
let n = V(
|
|
679
|
+
let n = V(r.binding);
|
|
643
680
|
if (!n) break;
|
|
644
681
|
t.push({
|
|
645
|
-
...
|
|
682
|
+
...r,
|
|
646
683
|
id: e,
|
|
647
|
-
ownerColumnId:
|
|
648
|
-
columnIds:
|
|
684
|
+
ownerColumnId: i,
|
|
685
|
+
columnIds: j(n, i),
|
|
649
686
|
binding: n
|
|
650
687
|
});
|
|
651
688
|
break;
|
|
652
689
|
}
|
|
653
690
|
case "advanced":
|
|
654
691
|
t.push({
|
|
655
|
-
...
|
|
692
|
+
...r,
|
|
656
693
|
id: e,
|
|
657
|
-
ownerColumnId:
|
|
694
|
+
ownerColumnId: i
|
|
658
695
|
});
|
|
659
696
|
break;
|
|
660
697
|
case "column":
|
|
661
698
|
t.push({
|
|
662
|
-
...
|
|
699
|
+
...r,
|
|
663
700
|
id: e,
|
|
664
|
-
ownerColumnId:
|
|
701
|
+
ownerColumnId: i
|
|
665
702
|
});
|
|
666
703
|
break;
|
|
667
704
|
default:
|
|
@@ -685,11 +722,11 @@ function W(e) {
|
|
|
685
722
|
}
|
|
686
723
|
return t;
|
|
687
724
|
}
|
|
688
|
-
function
|
|
725
|
+
function $e(e, t, n) {
|
|
689
726
|
let r = { ...W(e) }, i = U(n);
|
|
690
727
|
return i === void 0 ? (delete r[t], r) : (r[t] = i, r);
|
|
691
728
|
}
|
|
692
|
-
function
|
|
729
|
+
function et(e, t, n) {
|
|
693
730
|
if (!e || Object.keys(e).length === 0) return {};
|
|
694
731
|
let r = {}, i = {};
|
|
695
732
|
for (let [e, t] of Object.entries(n)) for (let n of t) i[n.codeKey] = e;
|
|
@@ -714,61 +751,61 @@ function Qe(e, t, n) {
|
|
|
714
751
|
}
|
|
715
752
|
return r;
|
|
716
753
|
}
|
|
717
|
-
function
|
|
754
|
+
function tt(e, t) {
|
|
718
755
|
return F(t);
|
|
719
756
|
}
|
|
720
|
-
function
|
|
721
|
-
let r =
|
|
722
|
-
if (r
|
|
723
|
-
|
|
757
|
+
function nt(e, t, n) {
|
|
758
|
+
let r = tt(t.valueSource, t.valueSource === "input" ? n : t.value);
|
|
759
|
+
if (r === void 0) return;
|
|
760
|
+
let i = t.columnId?.trim() || e;
|
|
761
|
+
if (i) return {
|
|
762
|
+
key: i,
|
|
724
763
|
operation: t.operation,
|
|
725
764
|
value: r
|
|
726
765
|
};
|
|
727
766
|
}
|
|
728
767
|
function G(e, t, n) {
|
|
729
768
|
if (!t?.conditions.length) return;
|
|
730
|
-
let r = t.conditions.map((t) =>
|
|
769
|
+
let r = t.conditions.map((t) => nt(e, t, n)).filter((e) => !!e);
|
|
731
770
|
if (r.length) return {
|
|
732
771
|
and: t.and === !1 ? void 0 : !0,
|
|
733
772
|
conditions: r
|
|
734
773
|
};
|
|
735
774
|
}
|
|
736
|
-
function
|
|
737
|
-
return
|
|
775
|
+
function rt(e) {
|
|
776
|
+
return k(e, !0);
|
|
738
777
|
}
|
|
739
778
|
function K(e, t) {
|
|
740
|
-
return
|
|
779
|
+
return k(e, t);
|
|
741
780
|
}
|
|
742
|
-
function
|
|
781
|
+
function it(e, t) {
|
|
743
782
|
let n = z(t);
|
|
744
783
|
if (!n) return;
|
|
745
784
|
let r = e.columnIds.map((e) => {
|
|
746
785
|
let t = n[e];
|
|
747
|
-
if (t?.length) return
|
|
786
|
+
if (t?.length) return k(e, t);
|
|
748
787
|
}).filter((e) => !!e);
|
|
749
788
|
if (r.length) return r.length === 1 ? r[0] : {
|
|
750
789
|
and: !0,
|
|
751
790
|
filters: r
|
|
752
791
|
};
|
|
753
792
|
}
|
|
754
|
-
function
|
|
755
|
-
if (e.binding.kind !== "list") return;
|
|
756
|
-
let n = e.binding;
|
|
757
|
-
if (
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
let i = n.options.find((e) => e.key === r);
|
|
769
|
-
if (i) return G(e.ownerColumnId, i.filter) ?? K(e.ownerColumnId, i.key);
|
|
793
|
+
function at(e, t) {
|
|
794
|
+
if (!e.binding || e.binding.kind !== "list") return;
|
|
795
|
+
let n = e.binding, r = N(e, t);
|
|
796
|
+
if (!r.length) return;
|
|
797
|
+
let i = e.kind === "local" ? e.ownerColumnId : "", a = r.map((t) => {
|
|
798
|
+
let r = n.options.find((e) => e.key === t);
|
|
799
|
+
if (!r) return;
|
|
800
|
+
let a = G(i, r.filter);
|
|
801
|
+
return a || e.kind === "registered" ? a : K(e.ownerColumnId, r.key);
|
|
802
|
+
}).filter((e) => !!e);
|
|
803
|
+
if (a.length) return a.length === 1 ? a[0] : {
|
|
804
|
+
and: n.and === !0 ? !0 : void 0,
|
|
805
|
+
filters: a
|
|
806
|
+
};
|
|
770
807
|
}
|
|
771
|
-
function
|
|
808
|
+
function ot(e, t) {
|
|
772
809
|
if (t !== void 0) switch (e.kind) {
|
|
773
810
|
case "segment": {
|
|
774
811
|
if (e.componentId === "select") {
|
|
@@ -778,11 +815,12 @@ function it(e, t) {
|
|
|
778
815
|
let n = L(t);
|
|
779
816
|
return n?.length ? K(e.ownerColumnId, n) : void 0;
|
|
780
817
|
}
|
|
781
|
-
case "tree": return
|
|
782
|
-
case "local": return e.binding.kind === "list" ?
|
|
818
|
+
case "tree": return it(e, t);
|
|
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) ?? (() => {
|
|
783
820
|
let n = F(t), r = L(t), i = n ?? r;
|
|
784
821
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
785
822
|
})();
|
|
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;
|
|
786
824
|
case "column": {
|
|
787
825
|
let n = F(t), r = L(t), i = n ?? r;
|
|
788
826
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
@@ -794,16 +832,16 @@ function it(e, t) {
|
|
|
794
832
|
default:
|
|
795
833
|
}
|
|
796
834
|
}
|
|
797
|
-
function
|
|
835
|
+
function st(e, t) {
|
|
798
836
|
let n = H(e), r = W(t);
|
|
799
837
|
if (!n.length || !Object.keys(r).length) return;
|
|
800
|
-
let i = n.map((e) =>
|
|
838
|
+
let i = n.map((e) => ot(e, r[e.id])).filter((e) => !!e);
|
|
801
839
|
if (i.length) return i.length === 1 ? i[0] : {
|
|
802
840
|
and: !0,
|
|
803
841
|
filters: i
|
|
804
842
|
};
|
|
805
843
|
}
|
|
806
|
-
function
|
|
844
|
+
function ct(e, t) {
|
|
807
845
|
let n = H(e), r = W(t), i = {};
|
|
808
846
|
for (let e of n) {
|
|
809
847
|
if (e.kind !== "segment" && e.kind !== "tree") continue;
|
|
@@ -822,21 +860,21 @@ function ot(e, t) {
|
|
|
822
860
|
}
|
|
823
861
|
//#endregion
|
|
824
862
|
//#region src/odata-service/parser.ts
|
|
825
|
-
var
|
|
826
|
-
function
|
|
863
|
+
var lt = /^(.+)(_txt|_text|_t)$/i, q = /* @__PURE__ */ new Set(["ZDIV", "ZCFO1"]);
|
|
864
|
+
function ut(e) {
|
|
827
865
|
return e.label || e.id;
|
|
828
866
|
}
|
|
829
|
-
function
|
|
867
|
+
function dt(e) {
|
|
830
868
|
return e ? q.has(e.toUpperCase()) : !1;
|
|
831
869
|
}
|
|
832
|
-
function
|
|
870
|
+
function ft(e) {
|
|
833
871
|
if (!e) return !1;
|
|
834
872
|
let t = e.toUpperCase();
|
|
835
873
|
if (q.has(t)) return !0;
|
|
836
874
|
let n = t.match(/^(.+)(_TXT|_TEXT|_T)$/);
|
|
837
875
|
return n ? q.has(n[1]) : !1;
|
|
838
876
|
}
|
|
839
|
-
function
|
|
877
|
+
function pt(e) {
|
|
840
878
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
841
879
|
}
|
|
842
880
|
function J(e) {
|
|
@@ -845,13 +883,13 @@ function J(e) {
|
|
|
845
883
|
function Y(e, t) {
|
|
846
884
|
if (t) return e[t.toUpperCase()];
|
|
847
885
|
}
|
|
848
|
-
function
|
|
886
|
+
function mt(e, t, n) {
|
|
849
887
|
let r = Y(n, e);
|
|
850
888
|
if (!r) return;
|
|
851
|
-
let i = RegExp(`^${
|
|
889
|
+
let i = RegExp(`^${pt(r)}(_txt|_text|_t)$`, "i");
|
|
852
890
|
for (let e of t) if (i.test(e.id)) return e.id;
|
|
853
891
|
}
|
|
854
|
-
function
|
|
892
|
+
function ht(e) {
|
|
855
893
|
let t = {}, n = {};
|
|
856
894
|
for (let r of e) t[r.id] = r, n[r.id.toUpperCase()] = r.id;
|
|
857
895
|
for (let t of e) {
|
|
@@ -859,7 +897,7 @@ function pt(e) {
|
|
|
859
897
|
t.semanticType = "none", t.linkedColumnId = void 0;
|
|
860
898
|
continue;
|
|
861
899
|
}
|
|
862
|
-
t.role = "dimension", t.sortable = !0, t.filterable = !0, t.semanticType =
|
|
900
|
+
t.role = "dimension", t.sortable = !0, t.filterable = !0, t.semanticType = lt.test(t.id) ? "text" : "code";
|
|
863
901
|
let e = Y(n, t.linkedColumnId);
|
|
864
902
|
t.linkedColumnId = e && e !== t.id ? e : void 0;
|
|
865
903
|
}
|
|
@@ -870,7 +908,7 @@ function pt(e) {
|
|
|
870
908
|
let e = t[i];
|
|
871
909
|
!e || e.role !== "dimension" ? i = void 0 : e.semanticType = "text";
|
|
872
910
|
}
|
|
873
|
-
if (i ||=
|
|
911
|
+
if (i ||= mt(r.id, e, n), !i && dt(r.id) && (i = mt(r.id, e, n)), r.linkedColumnId = i, i) {
|
|
874
912
|
let e = t[i];
|
|
875
913
|
e && e.role === "dimension" && (e.semanticType = "text", e.linkedColumnId = r.id);
|
|
876
914
|
}
|
|
@@ -883,7 +921,7 @@ function pt(e) {
|
|
|
883
921
|
!n || n.role !== "dimension" ? e = void 0 : n.semanticType = "code";
|
|
884
922
|
}
|
|
885
923
|
if (!e) {
|
|
886
|
-
let i = Y(n, r.id.match(
|
|
924
|
+
let i = Y(n, r.id.match(lt)?.[1]);
|
|
887
925
|
i && t[i]?.role === "dimension" && (e = i);
|
|
888
926
|
}
|
|
889
927
|
if (r.linkedColumnId = e, e) {
|
|
@@ -893,7 +931,7 @@ function pt(e) {
|
|
|
893
931
|
}
|
|
894
932
|
return e;
|
|
895
933
|
}
|
|
896
|
-
function
|
|
934
|
+
function gt(e) {
|
|
897
935
|
switch (e) {
|
|
898
936
|
case "Edm.String": return "string";
|
|
899
937
|
case "Edm.Guid": return "guid";
|
|
@@ -913,7 +951,7 @@ function mt(e) {
|
|
|
913
951
|
}
|
|
914
952
|
}
|
|
915
953
|
function X(e) {
|
|
916
|
-
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "", r =
|
|
954
|
+
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "", r = gt(n), i = e.hasAttribute("MaxLength") ? Number(e.getAttribute("MaxLength")) : void 0, a = e.hasAttribute("Precision") ? Number(e.getAttribute("Precision")) : void 0, o = e.hasAttribute("Scale") ? Number(e.getAttribute("Scale")) : void 0, s = e.getAttribute("sap:label") || void 0, c = e.getAttribute("sap:parameter") || void 0, l = e.getAttribute("Nullable") === "false" ? void 0 : !0;
|
|
917
955
|
return {
|
|
918
956
|
id: t,
|
|
919
957
|
label: s ?? t,
|
|
@@ -928,7 +966,7 @@ function X(e) {
|
|
|
928
966
|
...c === "mandatory" && { mandatory: !0 }
|
|
929
967
|
};
|
|
930
968
|
}
|
|
931
|
-
function
|
|
969
|
+
function _t(e) {
|
|
932
970
|
let t = X(e), n = e.getAttribute("sap:text") || void 0, r = e.getAttribute("sap:sortable") !== "false", i = e.getAttribute("sap:filterable") !== "false", a = e.getAttribute("sap:aggregation-role") === "measure" ? "measure" : "dimension", o = e.getAttribute("sap:label") || void 0, { nullable: s, mandatory: c, ...l } = t;
|
|
933
971
|
return {
|
|
934
972
|
...l,
|
|
@@ -940,42 +978,42 @@ function ht(e) {
|
|
|
940
978
|
role: a
|
|
941
979
|
};
|
|
942
980
|
}
|
|
943
|
-
function
|
|
981
|
+
function vt(e) {
|
|
944
982
|
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
945
983
|
return !t || !J(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
946
984
|
}
|
|
947
|
-
function
|
|
985
|
+
function yt(e) {
|
|
948
986
|
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
949
987
|
return !t || !J(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
950
988
|
}
|
|
951
989
|
function Z(e) {
|
|
952
990
|
return Array.from(e.getElementsByTagName("Property"));
|
|
953
991
|
}
|
|
954
|
-
function
|
|
992
|
+
function bt(e) {
|
|
955
993
|
return Array.from(e.getElementsByTagName("PropertyRef"));
|
|
956
994
|
}
|
|
957
|
-
function
|
|
995
|
+
function xt(e) {
|
|
958
996
|
return Array.from(e.getElementsByTagName("NavigationProperty"));
|
|
959
997
|
}
|
|
960
|
-
function
|
|
961
|
-
return Z(e).filter(
|
|
998
|
+
function St(e) {
|
|
999
|
+
return Z(e).filter(vt).map(X);
|
|
962
1000
|
}
|
|
963
|
-
function
|
|
964
|
-
let t = Z(e).filter(
|
|
1001
|
+
function Ct(e) {
|
|
1002
|
+
let t = Z(e).filter(vt), n = bt(e);
|
|
965
1003
|
return t.map((e) => {
|
|
966
1004
|
let t = X(e);
|
|
967
1005
|
return n.find((e) => e.getAttribute("Name") === t.id) && (t.mandatory = !0), t;
|
|
968
1006
|
});
|
|
969
1007
|
}
|
|
970
|
-
function
|
|
971
|
-
return
|
|
1008
|
+
function wt(e) {
|
|
1009
|
+
return ht(Z(e).filter(yt).map(_t));
|
|
972
1010
|
}
|
|
973
1011
|
function Q(e) {
|
|
974
1012
|
if (!e) return;
|
|
975
1013
|
let t = e.split(".");
|
|
976
1014
|
return t[t.length - 1] || void 0;
|
|
977
1015
|
}
|
|
978
|
-
function
|
|
1016
|
+
function Tt(e) {
|
|
979
1017
|
let t = e.getAttribute("Mode");
|
|
980
1018
|
if (t && t !== "In") {
|
|
981
1019
|
let n = e.getAttribute("Name") || "(unknown)";
|
|
@@ -989,19 +1027,19 @@ function Ct(e) {
|
|
|
989
1027
|
let r = X(e);
|
|
990
1028
|
return e.getAttribute("Nullable") === "false" && (r.mandatory = !0), r;
|
|
991
1029
|
}
|
|
992
|
-
function
|
|
1030
|
+
function Et(e) {
|
|
993
1031
|
return e.reduce((e, t) => {
|
|
994
1032
|
let n = t.getAttribute("Name");
|
|
995
1033
|
return n && (e[n] = t), e;
|
|
996
1034
|
}, {});
|
|
997
1035
|
}
|
|
998
|
-
function
|
|
1036
|
+
function Dt(e) {
|
|
999
1037
|
return Array.from(e.getElementsByTagName("EntitySet")).reduce((e, t) => {
|
|
1000
1038
|
let n = t.getAttribute("Name"), r = Q(t.getAttribute("EntityType"));
|
|
1001
1039
|
return !n || !r || (e[n] = r), e;
|
|
1002
1040
|
}, {});
|
|
1003
1041
|
}
|
|
1004
|
-
function
|
|
1042
|
+
function Ot(e) {
|
|
1005
1043
|
return Array.from(e.getElementsByTagName("AssociationSet")).reduce((e, t) => {
|
|
1006
1044
|
let n = t.getAttribute("Association");
|
|
1007
1045
|
if (!n) return e;
|
|
@@ -1017,8 +1055,8 @@ function Et(e) {
|
|
|
1017
1055
|
return i && (e[i] = r), e;
|
|
1018
1056
|
}, {});
|
|
1019
1057
|
}
|
|
1020
|
-
function
|
|
1021
|
-
for (let n of
|
|
1058
|
+
function kt(e, t) {
|
|
1059
|
+
for (let n of xt(e)) {
|
|
1022
1060
|
let e = n.getAttribute("Name");
|
|
1023
1061
|
if (e !== "Set" && e !== "Results") continue;
|
|
1024
1062
|
let r = n.getAttribute("Relationship"), i = r ? t[r] : void 0, a = n.getAttribute("ToRole"), o = n.getAttribute("FromRole"), s = i?.ends.find((e) => e.role === a)?.entitySet;
|
|
@@ -1028,34 +1066,34 @@ function Dt(e, t) {
|
|
|
1028
1066
|
};
|
|
1029
1067
|
}
|
|
1030
1068
|
}
|
|
1031
|
-
function
|
|
1069
|
+
function At(e, t, n) {
|
|
1032
1070
|
let r = /* @__PURE__ */ new Set();
|
|
1033
1071
|
for (let [i, a] of Object.entries(e)) {
|
|
1034
1072
|
let e = t[a];
|
|
1035
1073
|
if (!e) continue;
|
|
1036
|
-
let o =
|
|
1074
|
+
let o = kt(e, n);
|
|
1037
1075
|
o?.targetEntitySet && o.targetEntitySet !== i && r.add(o.targetEntitySet);
|
|
1038
1076
|
}
|
|
1039
1077
|
return r;
|
|
1040
1078
|
}
|
|
1041
|
-
function
|
|
1079
|
+
function jt(e, t, n, r) {
|
|
1042
1080
|
let i = t?.targetEntitySet ? n[t.targetEntitySet] : void 0;
|
|
1043
1081
|
return i && r[i] || e;
|
|
1044
1082
|
}
|
|
1045
|
-
function
|
|
1046
|
-
if (n) return
|
|
1047
|
-
if (!t.endsWith("Type")) return
|
|
1083
|
+
function Mt(e, t, n) {
|
|
1084
|
+
if (n) return St(e);
|
|
1085
|
+
if (!t.endsWith("Type")) return Ct(e);
|
|
1048
1086
|
}
|
|
1049
|
-
function
|
|
1087
|
+
function Nt(e, t) {
|
|
1050
1088
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1051
1089
|
let n = Q(e);
|
|
1052
1090
|
if (!n) return /* @__PURE__ */ new Set();
|
|
1053
1091
|
let r = t[n];
|
|
1054
|
-
return r ? new Set(
|
|
1092
|
+
return r ? new Set(bt(r).map((e) => e.getAttribute("Name")).filter((e) => !!e)) : /* @__PURE__ */ new Set();
|
|
1055
1093
|
}
|
|
1056
|
-
function
|
|
1057
|
-
let r = e.getAttribute("Name") || "", i = e.getAttribute("EntitySet") || void 0, a = e.getAttribute("sap:action-for") || void 0, o =
|
|
1058
|
-
let t =
|
|
1094
|
+
function Pt(e, t, n) {
|
|
1095
|
+
let r = e.getAttribute("Name") || "", i = e.getAttribute("EntitySet") || void 0, a = e.getAttribute("sap:action-for") || void 0, o = Nt(a, n), s = Array.from(e.getElementsByTagName("Parameter")).map((e) => {
|
|
1096
|
+
let t = Tt(e);
|
|
1059
1097
|
return o.has(t.id) && (t.mandatory = !0), t;
|
|
1060
1098
|
});
|
|
1061
1099
|
return {
|
|
@@ -1069,22 +1107,22 @@ function Mt(e, t, n) {
|
|
|
1069
1107
|
...i && t[i] ? { resultEntity: i } : {}
|
|
1070
1108
|
};
|
|
1071
1109
|
}
|
|
1072
|
-
function
|
|
1073
|
-
let t = new DOMParser().parseFromString(e, "application/xml"), n = Array.from(t.getElementsByTagName("EntityType")), r = Array.from(t.getElementsByTagName("FunctionImport")), i =
|
|
1110
|
+
function Ft(e) {
|
|
1111
|
+
let t = new DOMParser().parseFromString(e, "application/xml"), n = Array.from(t.getElementsByTagName("EntityType")), r = Array.from(t.getElementsByTagName("FunctionImport")), i = Dt(t), a = Et(n), o = Ot(t), s = At(i, a, o), c = {}, l = {};
|
|
1074
1112
|
for (let [e, t] of Object.entries(i)) {
|
|
1075
1113
|
if (s.has(e)) continue;
|
|
1076
1114
|
let n = a[t];
|
|
1077
1115
|
if (!n) continue;
|
|
1078
|
-
let r =
|
|
1116
|
+
let r = kt(n, o), l = jt(n, r, i, a), ee = n.getAttribute("sap:label") || l.getAttribute("sap:label") || "", u = wt(l), d = Mt(n, t, r);
|
|
1079
1117
|
c[e] = {
|
|
1080
|
-
title:
|
|
1081
|
-
columns:
|
|
1082
|
-
...
|
|
1118
|
+
title: ee,
|
|
1119
|
+
columns: u,
|
|
1120
|
+
...d?.length ? { parameters: d } : {},
|
|
1083
1121
|
...r ? { result: r.name } : {}
|
|
1084
1122
|
};
|
|
1085
1123
|
}
|
|
1086
1124
|
for (let e of r) {
|
|
1087
|
-
let t =
|
|
1125
|
+
let t = Pt(e, i, a);
|
|
1088
1126
|
l[t.name] = t;
|
|
1089
1127
|
}
|
|
1090
1128
|
return {
|
|
@@ -1094,30 +1132,30 @@ function Nt(e) {
|
|
|
1094
1132
|
}
|
|
1095
1133
|
//#endregion
|
|
1096
1134
|
//#region src/odata-service/sorts.ts
|
|
1097
|
-
function
|
|
1135
|
+
function It(e, t) {
|
|
1098
1136
|
return e.findIndex((e) => e.key === t);
|
|
1099
1137
|
}
|
|
1100
|
-
function
|
|
1138
|
+
function Lt(e) {
|
|
1101
1139
|
return e.map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`).join(",");
|
|
1102
1140
|
}
|
|
1103
|
-
function
|
|
1104
|
-
let r =
|
|
1141
|
+
function Rt(e, t, n) {
|
|
1142
|
+
let r = It(e, t), i = n ? [...e] : [...e.filter((e) => e.key === t)];
|
|
1105
1143
|
return r === -1 ? (i.push({ key: t }), i) : e[r].desc ? i.filter((e) => e.key !== t) : i.map((e) => e.key === t ? {
|
|
1106
1144
|
key: t,
|
|
1107
1145
|
desc: !0
|
|
1108
1146
|
} : e);
|
|
1109
1147
|
}
|
|
1110
|
-
function
|
|
1148
|
+
function zt(e, t) {
|
|
1111
1149
|
return t.length > 0 ? t.map((e) => ({
|
|
1112
1150
|
key: e.key,
|
|
1113
1151
|
desc: e.desc
|
|
1114
1152
|
})) : e.map((e) => ({ key: e }));
|
|
1115
1153
|
}
|
|
1116
|
-
function
|
|
1117
|
-
let n =
|
|
1154
|
+
function Bt(e, t) {
|
|
1155
|
+
let n = zt(e, t).map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`);
|
|
1118
1156
|
return n.length ? n.join(",") : void 0;
|
|
1119
1157
|
}
|
|
1120
|
-
function
|
|
1158
|
+
function Vt(e, t, n) {
|
|
1121
1159
|
let r = t.length > 0, i = e.indexOf(n);
|
|
1122
1160
|
if (!r && i !== -1) return {
|
|
1123
1161
|
active: !0,
|
|
@@ -1133,61 +1171,61 @@ function zt(e, t, n) {
|
|
|
1133
1171
|
}
|
|
1134
1172
|
//#endregion
|
|
1135
1173
|
//#region src/odata-service/sqlFilters.ts
|
|
1136
|
-
var
|
|
1137
|
-
function
|
|
1174
|
+
var Ht = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
1175
|
+
function Ut(e) {
|
|
1138
1176
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
1139
1177
|
}
|
|
1140
1178
|
function $(e) {
|
|
1141
|
-
if (!
|
|
1179
|
+
if (!Ht.test(e)) throw Error(`Некорректное имя поля SQL-фильтра: ${e}`);
|
|
1142
1180
|
}
|
|
1143
|
-
function
|
|
1181
|
+
function Wt(e, t) {
|
|
1144
1182
|
return {
|
|
1145
1183
|
fieldId: e,
|
|
1146
1184
|
operation: "eq",
|
|
1147
1185
|
value: t
|
|
1148
1186
|
};
|
|
1149
1187
|
}
|
|
1150
|
-
function
|
|
1188
|
+
function Gt(e, t) {
|
|
1151
1189
|
return {
|
|
1152
1190
|
fieldId: e,
|
|
1153
1191
|
operation: "in",
|
|
1154
1192
|
values: t
|
|
1155
1193
|
};
|
|
1156
1194
|
}
|
|
1157
|
-
function
|
|
1195
|
+
function Kt(e) {
|
|
1158
1196
|
if (e instanceof Date) throw Error("Дата должна быть отформатирована вызывающей стороной до формирования SQL-фильтра");
|
|
1159
|
-
if (!
|
|
1197
|
+
if (!Ut(e) || typeof e == "number" && !Number.isFinite(e)) return;
|
|
1160
1198
|
let t = String(e);
|
|
1161
1199
|
if (!(!t || t.trim() === "")) return `'${t.replaceAll("'", "''")}'`;
|
|
1162
1200
|
}
|
|
1163
|
-
function
|
|
1201
|
+
function qt(e) {
|
|
1164
1202
|
if (e.operation === "eq") {
|
|
1165
|
-
let t =
|
|
1203
|
+
let t = Kt(e.value);
|
|
1166
1204
|
return t ? ($(e.fieldId), `${e.fieldId}=${t}`) : void 0;
|
|
1167
1205
|
}
|
|
1168
|
-
let t = (e.values ?? []).map((e) =>
|
|
1206
|
+
let t = (e.values ?? []).map((e) => Kt(e)).filter((e) => !!e);
|
|
1169
1207
|
if (t.length !== 0) return $(e.fieldId), `${e.fieldId} IN (${t.join(", ")})`;
|
|
1170
1208
|
}
|
|
1171
|
-
function
|
|
1172
|
-
return e ? e.map((e) =>
|
|
1209
|
+
function Jt(e) {
|
|
1210
|
+
return e ? e.map((e) => qt(e)).filter((e) => !!e).join(" AND ") : "";
|
|
1173
1211
|
}
|
|
1174
1212
|
//#endregion
|
|
1175
1213
|
//#region src/odata-service/typesValidation.ts
|
|
1176
|
-
function
|
|
1214
|
+
function Yt(e) {
|
|
1177
1215
|
return e === "boolean";
|
|
1178
1216
|
}
|
|
1179
|
-
function
|
|
1217
|
+
function Xt(e) {
|
|
1180
1218
|
return e === "byte" || e === "int" || e === "long" || e === "float" || e === "decimal" || e === "double";
|
|
1181
1219
|
}
|
|
1182
|
-
function
|
|
1220
|
+
function Zt(e) {
|
|
1183
1221
|
return e === "byte" || e === "int" || e === "long";
|
|
1184
1222
|
}
|
|
1185
|
-
function
|
|
1223
|
+
function Qt(e) {
|
|
1186
1224
|
return e === "datetime" || e === "datetimeOffset" || e === "time";
|
|
1187
1225
|
}
|
|
1188
1226
|
//#endregion
|
|
1189
1227
|
//#region src/odata-service/unwrapODataQueryResult.ts
|
|
1190
|
-
function
|
|
1228
|
+
function $t(e) {
|
|
1191
1229
|
let t = e.data?.data, n = e.data?.totalCount;
|
|
1192
1230
|
return {
|
|
1193
1231
|
...e,
|
|
@@ -1197,30 +1235,30 @@ function Zt(e) {
|
|
|
1197
1235
|
}
|
|
1198
1236
|
//#endregion
|
|
1199
1237
|
//#region src/odata-service/utils.ts
|
|
1200
|
-
function
|
|
1201
|
-
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [
|
|
1238
|
+
function en(e) {
|
|
1239
|
+
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [nn(e) ? e ?? null : null, null];
|
|
1202
1240
|
}
|
|
1203
|
-
function
|
|
1241
|
+
function tn(t) {
|
|
1204
1242
|
return t instanceof Date ? t : Array.isArray(t) || e(t) ? null : t;
|
|
1205
1243
|
}
|
|
1206
|
-
function
|
|
1244
|
+
function nn(e) {
|
|
1207
1245
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1208
1246
|
}
|
|
1209
1247
|
//#endregion
|
|
1210
1248
|
//#region src/odata-service/wrapParams.ts
|
|
1211
|
-
function
|
|
1249
|
+
function rn(e) {
|
|
1212
1250
|
if (!e) return {};
|
|
1213
1251
|
let t = {};
|
|
1214
1252
|
for (let n in e) t[n] = { value: e[n] };
|
|
1215
1253
|
return t;
|
|
1216
1254
|
}
|
|
1217
|
-
function
|
|
1255
|
+
function an(e) {
|
|
1218
1256
|
if (!e) return;
|
|
1219
1257
|
let t = {};
|
|
1220
1258
|
for (let n of Object.keys(e).sort()) t[n] = e[n]?.value ?? null;
|
|
1221
1259
|
return t;
|
|
1222
1260
|
}
|
|
1223
1261
|
//#endregion
|
|
1224
|
-
export {
|
|
1262
|
+
export { Me as $, Je as A, ee as At, Pe as B, ft as C, oe as Ct, et as D, ne as Dt, ut as E, d as Et, V as F, s as Ft, We as G, D as H, B as I, Ge as J, Ke as K, H as L, P as M, c as Mt, Qe as N, u as Nt, st as O, re as Ot, Ze as P, o as Pt, T as Q, U as R, q as S, ce as St, Ft as T, f as Tt, Ue as U, Ne as V, O as W, qe as X, Le as Y, Re as Z, Bt as _, Ee as _t, en as a, x as at, zt as b, fe as bt, Qt as c, g as ct, $ as d, me as dt, Ae as et, Jt as f, pe as ft, Lt as g, Te as gt, Ut as h, Oe as ht, tn as i, je as it, $e as j, l as jt, ct as k, ie as kt, Zt as l, ge as lt, Gt as m, De as mt, rn as n, w as nt, $t as o, _ as ot, Wt as p, b as pt, k as q, nn as r, C as rt, Yt as s, v as st, an as t, S as tt, Xt as u, he as ut, It as v, h as vt, dt as w, ae as wt, Rt as x, se as xt, Vt as y, de as yt, W as z };
|
|
1225
1263
|
|
|
1226
|
-
//# sourceMappingURL=odata-service-
|
|
1264
|
+
//# sourceMappingURL=odata-service-CDYp5CIE.js.map
|