@ryuzaki13/react-foundation-lib 1.1.11 → 1.1.13
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-ByJmJx4k.js → formatters-CUJBLfgF.js} +3 -3
- package/dist/chunks/{formatters-ByJmJx4k.js.map → formatters-CUJBLfgF.js.map} +1 -1
- package/dist/chunks/{odata-service-DNcNP2RM.js → odata-service-Ba6s7-gZ.js} +307 -267
- package/dist/chunks/odata-service-Ba6s7-gZ.js.map +1 -0
- package/dist/chunks/{validate-ChUa-TYM.js → validate-1-8BDMGH.js} +2 -2
- package/dist/chunks/{validate-ChUa-TYM.js.map → validate-1-8BDMGH.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/filterDefinitions.d.ts +16 -1
- package/dist/odata-service/filterDefinitions.d.ts.map +1 -1
- package/dist/odata-service/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/odata-service-DNcNP2RM.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,80 @@ 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
|
-
let e = c ? c(s) :
|
|
299
|
-
return
|
|
298
|
+
let e = c ? c(s) : h(r, s);
|
|
299
|
+
return ke(e, i), [n, e];
|
|
300
300
|
} catch (e) {
|
|
301
301
|
throw Error(`Ошибка форматирования параметра ${n}: ${String(e)}`);
|
|
302
302
|
}
|
|
303
303
|
}).filter((e) => e !== null) : [];
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
let n =
|
|
305
|
+
function S(e, t) {
|
|
306
|
+
let n = x(e, t);
|
|
307
307
|
return n.length ? `(${n.map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join(",")})` : "";
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function C(e, t) {
|
|
310
310
|
let n = new URLSearchParams();
|
|
311
|
-
for (let [r, i] of
|
|
311
|
+
for (let [r, i] of x(e, t)) n.set(r, i);
|
|
312
312
|
return n;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ae(e, t, n, r) {
|
|
315
315
|
let i = `/${t.service}/${t.target}`;
|
|
316
|
-
return r === "create" ? i : r === "query" ? e.result ?
|
|
316
|
+
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
317
|
}
|
|
318
|
-
function
|
|
319
|
-
let r =
|
|
318
|
+
function je(e, t, n) {
|
|
319
|
+
let r = C(e, n).toString(), i = `/${t.service}/${t.target}`;
|
|
320
320
|
return r ? `${i}?${r}` : i;
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
let r =
|
|
322
|
+
function w(e, t, n) {
|
|
323
|
+
let r = S(e, n), i = e.result ? `/${e.result}` : "";
|
|
324
324
|
return `/${t.service}/${t.target}${r}${i}`;
|
|
325
325
|
}
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region src/odata-service/columns.ts
|
|
328
|
-
function
|
|
328
|
+
function T(e) {
|
|
329
329
|
return e.filter((e) => e.semanticType === "code" && e.filterable);
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
return new Set(
|
|
331
|
+
function Me(e) {
|
|
332
|
+
return new Set(T(e).map((e) => e.id));
|
|
333
333
|
}
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region src/odata-service/filters.ts
|
|
336
|
-
var
|
|
336
|
+
var Ne = Object.freeze({
|
|
337
337
|
eq: "eq",
|
|
338
338
|
ne: "ne",
|
|
339
339
|
gt: "gt",
|
|
@@ -343,7 +343,7 @@ var Me = Object.freeze({
|
|
|
343
343
|
startswith: "startswith",
|
|
344
344
|
endswith: "endswith",
|
|
345
345
|
contains: "contains"
|
|
346
|
-
}),
|
|
346
|
+
}), Pe = Object.freeze(Object.values(Ne)), Fe = Object.freeze({
|
|
347
347
|
eq: "равно",
|
|
348
348
|
ne: "не равно",
|
|
349
349
|
gt: "больше",
|
|
@@ -353,14 +353,14 @@ var Me = Object.freeze({
|
|
|
353
353
|
startswith: "начинается с",
|
|
354
354
|
endswith: "заканчивается на",
|
|
355
355
|
contains: "содержит"
|
|
356
|
-
}),
|
|
357
|
-
function Ie(e) {
|
|
358
|
-
return typeof e == "string" && Fe.has(e);
|
|
359
|
-
}
|
|
356
|
+
}), Ie = new Set(Pe);
|
|
360
357
|
function Le(e) {
|
|
361
|
-
return
|
|
358
|
+
return typeof e == "string" && Ie.has(e);
|
|
362
359
|
}
|
|
363
360
|
function Re(e) {
|
|
361
|
+
return Fe[e];
|
|
362
|
+
}
|
|
363
|
+
function ze(e) {
|
|
364
364
|
switch (typeof e) {
|
|
365
365
|
case "bigint":
|
|
366
366
|
case "number": return "int";
|
|
@@ -369,17 +369,17 @@ function Re(e) {
|
|
|
369
369
|
}
|
|
370
370
|
return "string";
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
let { key: t, operation: n = "eq", value: r, type: i } = e, a =
|
|
372
|
+
function E(e) {
|
|
373
|
+
let { key: t, operation: n = "eq", value: r, type: i } = e, a = h(i ?? ze(r), r);
|
|
374
374
|
return n === "contains" ? `substringof(${a},${String(t)})` : n === "startswith" || n === "endswith" ? `${n}(${String(t)}, ${a})` : `${String(t)} ${n} ${a}`;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Be(e) {
|
|
377
377
|
return "conditions" in e && e.conditions !== void 0;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Ve(e) {
|
|
380
380
|
return "filters" in e && e.filters !== void 0;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function He(e, t) {
|
|
383
383
|
let n = [];
|
|
384
384
|
for (let r of e) {
|
|
385
385
|
let e = t(r);
|
|
@@ -387,46 +387,46 @@ function ze(e, t) {
|
|
|
387
387
|
}
|
|
388
388
|
return n;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function D(e) {
|
|
391
391
|
if (!e) return "";
|
|
392
|
-
if (
|
|
392
|
+
if (Be(e)) {
|
|
393
393
|
let { conditions: t, and: n = !1 } = e;
|
|
394
394
|
if (t.length === 0) return "";
|
|
395
|
-
if (t.length === 1) return
|
|
395
|
+
if (t.length === 1) return E(t[0]);
|
|
396
396
|
let r = n ? "and" : "or";
|
|
397
|
-
return `(${t.map(
|
|
397
|
+
return `(${t.map(E).join(` ${r} `)})`;
|
|
398
398
|
}
|
|
399
|
-
if (
|
|
399
|
+
if (Ve(e)) {
|
|
400
400
|
let { filters: t, and: n = !1 } = e;
|
|
401
401
|
if (t.length === 0) return "";
|
|
402
|
-
if (t.length === 1) return
|
|
403
|
-
let r = n ? "and" : "or", i =
|
|
402
|
+
if (t.length === 1) return D(t[0]);
|
|
403
|
+
let r = n ? "and" : "or", i = He(t, D);
|
|
404
404
|
return i.length === 0 ? "" : i.length === 1 ? i[0] : `(${i.join(` ${r} `)})`;
|
|
405
405
|
}
|
|
406
406
|
throw Error("Некорректное выражение фильтра");
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Ue(e) {
|
|
409
409
|
let t = (e) => {
|
|
410
410
|
if (!e) return "";
|
|
411
|
-
if (
|
|
411
|
+
if (Be(e)) {
|
|
412
412
|
let { conditions: t, and: n = !1 } = e;
|
|
413
413
|
if (t.length === 0) return "";
|
|
414
|
-
if (t.length === 1) return
|
|
414
|
+
if (t.length === 1) return E(t[0]);
|
|
415
415
|
let r = n ? "and" : "or";
|
|
416
|
-
return `(${t.map(
|
|
416
|
+
return `(${t.map(E).join(` ${r} `)})`;
|
|
417
417
|
}
|
|
418
|
-
if (
|
|
418
|
+
if (Ve(e)) {
|
|
419
419
|
let { filters: n, and: r = !1 } = e;
|
|
420
420
|
if (n.length === 0) return "";
|
|
421
421
|
if (n.length === 1) return t(n[0]);
|
|
422
|
-
let i = r ? "and" : "or", a =
|
|
422
|
+
let i = r ? "and" : "or", a = He(n, t).map((e) => e.includes(" ") ? `(${e})` : e);
|
|
423
423
|
return a.length === 0 ? "" : a.length === 1 ? a[0] : `(${a.join(` ${i} `)})`;
|
|
424
424
|
}
|
|
425
425
|
return "";
|
|
426
426
|
};
|
|
427
427
|
return t(e);
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function O(e, t, n) {
|
|
430
430
|
if (t == null) return { conditions: [] };
|
|
431
431
|
if (Array.isArray(t)) {
|
|
432
432
|
let r = [];
|
|
@@ -443,7 +443,7 @@ function j(e, t, n) {
|
|
|
443
443
|
operation: n
|
|
444
444
|
}] };
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function We(e, t) {
|
|
447
447
|
if (!t) return { conditions: [] };
|
|
448
448
|
let n = t[0], r = t[1];
|
|
449
449
|
return n == null || r == null ? n ? { conditions: [{
|
|
@@ -467,16 +467,16 @@ function Ve(e, t) {
|
|
|
467
467
|
}]
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
470
|
+
function k(e, t) {
|
|
471
|
+
return O(e, t, "eq");
|
|
472
472
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
473
|
+
function Ge(e, t) {
|
|
474
|
+
return O(e, Array.isArray(t) ? t.map((e) => e || null) : t || null, "eq");
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
return
|
|
476
|
+
function Ke(e, t) {
|
|
477
|
+
return O(e, t, "contains");
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function qe(e, t) {
|
|
480
480
|
return e ? t ? {
|
|
481
481
|
and: !0,
|
|
482
482
|
filters: [e, t]
|
|
@@ -484,30 +484,36 @@ function We(e, t) {
|
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
486
486
|
//#region src/odata-service/filterDefinitions.ts
|
|
487
|
-
function
|
|
487
|
+
function Je(e) {
|
|
488
488
|
return e === "select" || e === "multi-select" || e === "checkbox" || e === "text-input" || e === "number-input";
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function A(e, t) {
|
|
491
491
|
return e?.conditions.length ? e.conditions.map((e) => e.columnId?.trim() || t).filter((e) => !!e) : [];
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
let n = e.kind === "list" ? e.options.flatMap((e) =>
|
|
495
|
-
return [...new Set(n.length ? n : [t])];
|
|
493
|
+
function j(e, t) {
|
|
494
|
+
let n = e.kind === "list" ? e.options.flatMap((e) => A(e.filter, t)) : e.kind === "boolean" ? A(e.trueFilter, t) : A(e.valueFilter, t);
|
|
495
|
+
return [...new Set(n.length ? n : t ? [t] : [])];
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
let n =
|
|
499
|
-
return n.length ? n : [t];
|
|
497
|
+
function M(e, t) {
|
|
498
|
+
let n = A(e, t);
|
|
499
|
+
return n.length ? n : t ? [t] : [];
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
|
|
501
|
+
function Ye(e) {
|
|
502
|
+
return e.kind === "registered" ? e.valueMode === "multiple" : e.componentId === "multi-select";
|
|
503
|
+
}
|
|
504
|
+
function Xe(e) {
|
|
505
|
+
return Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string").map((e) => e.trim()))] : [];
|
|
506
|
+
}
|
|
507
|
+
function N(e, t) {
|
|
508
|
+
if (Ye(e)) return Xe(t);
|
|
503
509
|
let n = F(t);
|
|
504
|
-
return typeof n == "string"
|
|
510
|
+
return typeof n == "string" ? [n] : [];
|
|
505
511
|
}
|
|
506
|
-
function
|
|
512
|
+
function Ze(e) {
|
|
507
513
|
let t = H([e])[0];
|
|
508
|
-
return t ? t.kind === "segment" || t.kind === "column" || t.kind === "advanced" ? [t.ownerColumnId] : [...t.columnIds] : [];
|
|
514
|
+
return t ? t.kind === "registered" ? [...t.columnIds] : t.kind === "segment" || t.kind === "column" || t.kind === "advanced" ? [t.ownerColumnId] : [...t.columnIds] : [];
|
|
509
515
|
}
|
|
510
|
-
function
|
|
516
|
+
function Qe(e, t) {
|
|
511
517
|
let n = H([e])[0], r = U(t);
|
|
512
518
|
if (!n || r === void 0) return [];
|
|
513
519
|
switch (n.kind) {
|
|
@@ -520,17 +526,29 @@ function Ye(e, t) {
|
|
|
520
526
|
}
|
|
521
527
|
case "local":
|
|
522
528
|
if (n.binding.kind === "list") {
|
|
523
|
-
let e =
|
|
529
|
+
let e = N(n, r);
|
|
524
530
|
return [...new Set(e.flatMap((e) => {
|
|
525
531
|
let t = n.binding.kind === "list" ? n.binding.options.find((t) => t.key === e) : void 0;
|
|
526
|
-
return t ?
|
|
532
|
+
return t ? M(t.filter, n.ownerColumnId) : [];
|
|
527
533
|
}))];
|
|
528
534
|
}
|
|
529
|
-
return n.binding.kind === "boolean" ? r === !0 ?
|
|
535
|
+
return n.binding.kind === "boolean" ? r === !0 ? M(n.binding.trueFilter, n.ownerColumnId) : [] : M(n.binding.valueFilter, n.ownerColumnId);
|
|
536
|
+
case "registered": {
|
|
537
|
+
let e = n.binding;
|
|
538
|
+
if (!e) return [];
|
|
539
|
+
if (e.kind === "list") {
|
|
540
|
+
let t = N(n, r);
|
|
541
|
+
return [...new Set(t.flatMap((t) => {
|
|
542
|
+
let n = e.options.find((e) => e.key === t);
|
|
543
|
+
return n ? M(n.filter, "") : [];
|
|
544
|
+
}))];
|
|
545
|
+
}
|
|
546
|
+
return e.kind === "boolean" ? r === !0 ? M(e.trueFilter, "") : [] : M(e.valueFilter, "");
|
|
547
|
+
}
|
|
530
548
|
default: return [];
|
|
531
549
|
}
|
|
532
550
|
}
|
|
533
|
-
function
|
|
551
|
+
function P(e, t) {
|
|
534
552
|
let n = e?.trim();
|
|
535
553
|
return n && n !== t ? n : void 0;
|
|
536
554
|
}
|
|
@@ -593,10 +611,13 @@ function V(e) {
|
|
|
593
611
|
filter: B(n.filter)
|
|
594
612
|
});
|
|
595
613
|
}
|
|
596
|
-
|
|
614
|
+
if (!t.length) return;
|
|
615
|
+
let n = e.and === !0 ? !0 : e.and === !1 ? !1 : void 0;
|
|
616
|
+
return {
|
|
597
617
|
kind: "list",
|
|
618
|
+
...n === void 0 ? {} : { and: n },
|
|
598
619
|
options: t
|
|
599
|
-
}
|
|
620
|
+
};
|
|
600
621
|
}
|
|
601
622
|
return e.kind === "boolean" ? {
|
|
602
623
|
kind: "boolean",
|
|
@@ -611,54 +632,72 @@ function H(e) {
|
|
|
611
632
|
if (!e?.length) return [];
|
|
612
633
|
let t = [];
|
|
613
634
|
for (let n of e) {
|
|
614
|
-
let e = n.id.trim()
|
|
615
|
-
if (!
|
|
635
|
+
let e = n.id.trim();
|
|
636
|
+
if (!e) continue;
|
|
637
|
+
let r = { ...n };
|
|
638
|
+
if (r.kind === "odata-segment" && (r.kind = "segment"), r.kind === "odata-tree" && (r.kind = "tree"), r.kind === "registered") {
|
|
639
|
+
let n = r.componentId.trim(), i = r.valueMode;
|
|
640
|
+
if (!n || i !== "single" && i !== "multiple") continue;
|
|
641
|
+
let a = V(r.binding);
|
|
642
|
+
t.push({
|
|
643
|
+
...r,
|
|
644
|
+
id: e,
|
|
645
|
+
componentId: n,
|
|
646
|
+
valueMode: i,
|
|
647
|
+
columnIds: a ? j(a, "") : [],
|
|
648
|
+
binding: a
|
|
649
|
+
});
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
let i = r.ownerColumnId.trim();
|
|
653
|
+
if (i) switch (r.kind) {
|
|
616
654
|
case "segment":
|
|
617
655
|
t.push({
|
|
618
|
-
...
|
|
656
|
+
...r,
|
|
619
657
|
id: e,
|
|
620
|
-
ownerColumnId:
|
|
621
|
-
columnIds: [
|
|
622
|
-
componentId:
|
|
623
|
-
dictionaryCodeKey:
|
|
658
|
+
ownerColumnId: i,
|
|
659
|
+
columnIds: [i],
|
|
660
|
+
componentId: r.componentId === "select" ? "select" : "multi-select",
|
|
661
|
+
dictionaryCodeKey: P(r.dictionaryCodeKey, i)
|
|
624
662
|
});
|
|
625
663
|
break;
|
|
626
664
|
case "tree": {
|
|
627
|
-
let
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
|
|
665
|
+
let n = [...new Set(r.columnIds.map((e) => e.trim()).filter(Boolean))];
|
|
666
|
+
if (n.length < 2) break;
|
|
667
|
+
let a = r.componentId, o = a === "treeSelect" || a === "tree-select" ? "tree-select" : "tree-multi-select";
|
|
668
|
+
t.push({
|
|
669
|
+
...r,
|
|
631
670
|
id: e,
|
|
632
|
-
ownerColumnId:
|
|
633
|
-
columnIds:
|
|
634
|
-
componentId:
|
|
671
|
+
ownerColumnId: n.includes(i) ? i : n[0],
|
|
672
|
+
columnIds: n,
|
|
673
|
+
componentId: o
|
|
635
674
|
});
|
|
636
675
|
break;
|
|
637
676
|
}
|
|
638
677
|
case "local": {
|
|
639
|
-
let
|
|
640
|
-
if (!
|
|
678
|
+
let n = V(r.binding);
|
|
679
|
+
if (!n) break;
|
|
641
680
|
t.push({
|
|
642
|
-
...
|
|
681
|
+
...r,
|
|
643
682
|
id: e,
|
|
644
|
-
ownerColumnId:
|
|
645
|
-
columnIds:
|
|
646
|
-
binding:
|
|
683
|
+
ownerColumnId: i,
|
|
684
|
+
columnIds: j(n, i),
|
|
685
|
+
binding: n
|
|
647
686
|
});
|
|
648
687
|
break;
|
|
649
688
|
}
|
|
650
689
|
case "advanced":
|
|
651
690
|
t.push({
|
|
652
|
-
...
|
|
691
|
+
...r,
|
|
653
692
|
id: e,
|
|
654
|
-
ownerColumnId:
|
|
693
|
+
ownerColumnId: i
|
|
655
694
|
});
|
|
656
695
|
break;
|
|
657
696
|
case "column":
|
|
658
697
|
t.push({
|
|
659
|
-
...
|
|
698
|
+
...r,
|
|
660
699
|
id: e,
|
|
661
|
-
ownerColumnId:
|
|
700
|
+
ownerColumnId: i
|
|
662
701
|
});
|
|
663
702
|
break;
|
|
664
703
|
default:
|
|
@@ -682,11 +721,11 @@ function W(e) {
|
|
|
682
721
|
}
|
|
683
722
|
return t;
|
|
684
723
|
}
|
|
685
|
-
function
|
|
724
|
+
function $e(e, t, n) {
|
|
686
725
|
let r = { ...W(e) }, i = U(n);
|
|
687
726
|
return i === void 0 ? (delete r[t], r) : (r[t] = i, r);
|
|
688
727
|
}
|
|
689
|
-
function
|
|
728
|
+
function et(e, t, n) {
|
|
690
729
|
if (!e || Object.keys(e).length === 0) return {};
|
|
691
730
|
let r = {}, i = {};
|
|
692
731
|
for (let [e, t] of Object.entries(n)) for (let n of t) i[n.codeKey] = e;
|
|
@@ -711,61 +750,61 @@ function Qe(e, t, n) {
|
|
|
711
750
|
}
|
|
712
751
|
return r;
|
|
713
752
|
}
|
|
714
|
-
function
|
|
753
|
+
function tt(e, t) {
|
|
715
754
|
return F(t);
|
|
716
755
|
}
|
|
717
|
-
function
|
|
718
|
-
let r =
|
|
719
|
-
if (r
|
|
720
|
-
|
|
756
|
+
function nt(e, t, n) {
|
|
757
|
+
let r = tt(t.valueSource, t.valueSource === "input" ? n : t.value);
|
|
758
|
+
if (r === void 0) return;
|
|
759
|
+
let i = t.columnId?.trim() || e;
|
|
760
|
+
if (i) return {
|
|
761
|
+
key: i,
|
|
721
762
|
operation: t.operation,
|
|
722
763
|
value: r
|
|
723
764
|
};
|
|
724
765
|
}
|
|
725
766
|
function G(e, t, n) {
|
|
726
767
|
if (!t?.conditions.length) return;
|
|
727
|
-
let r = t.conditions.map((t) =>
|
|
768
|
+
let r = t.conditions.map((t) => nt(e, t, n)).filter((e) => !!e);
|
|
728
769
|
if (r.length) return {
|
|
729
770
|
and: t.and === !1 ? void 0 : !0,
|
|
730
771
|
conditions: r
|
|
731
772
|
};
|
|
732
773
|
}
|
|
733
|
-
function
|
|
734
|
-
return
|
|
774
|
+
function rt(e) {
|
|
775
|
+
return k(e, !0);
|
|
735
776
|
}
|
|
736
777
|
function K(e, t) {
|
|
737
|
-
return
|
|
778
|
+
return k(e, t);
|
|
738
779
|
}
|
|
739
|
-
function
|
|
780
|
+
function it(e, t) {
|
|
740
781
|
let n = z(t);
|
|
741
782
|
if (!n) return;
|
|
742
783
|
let r = e.columnIds.map((e) => {
|
|
743
784
|
let t = n[e];
|
|
744
|
-
if (t?.length) return
|
|
785
|
+
if (t?.length) return k(e, t);
|
|
745
786
|
}).filter((e) => !!e);
|
|
746
787
|
if (r.length) return r.length === 1 ? r[0] : {
|
|
747
788
|
and: !0,
|
|
748
789
|
filters: r
|
|
749
790
|
};
|
|
750
791
|
}
|
|
751
|
-
function
|
|
752
|
-
if (e.binding.kind !== "list") return;
|
|
753
|
-
let n = e.binding;
|
|
754
|
-
if (
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
let i = n.options.find((e) => e.key === r);
|
|
766
|
-
if (i) return G(e.ownerColumnId, i.filter) ?? K(e.ownerColumnId, i.key);
|
|
792
|
+
function at(e, t) {
|
|
793
|
+
if (!e.binding || e.binding.kind !== "list") return;
|
|
794
|
+
let n = e.binding, r = N(e, t);
|
|
795
|
+
if (!r.length) return;
|
|
796
|
+
let i = e.kind === "local" ? e.ownerColumnId : "", a = r.map((t) => {
|
|
797
|
+
let r = n.options.find((e) => e.key === t);
|
|
798
|
+
if (!r) return;
|
|
799
|
+
let a = G(i, r.filter);
|
|
800
|
+
return a || e.kind === "registered" ? a : K(e.ownerColumnId, r.key);
|
|
801
|
+
}).filter((e) => !!e);
|
|
802
|
+
if (a.length) return a.length === 1 ? a[0] : {
|
|
803
|
+
and: n.and === !0 ? !0 : void 0,
|
|
804
|
+
filters: a
|
|
805
|
+
};
|
|
767
806
|
}
|
|
768
|
-
function
|
|
807
|
+
function ot(e, t) {
|
|
769
808
|
if (t !== void 0) switch (e.kind) {
|
|
770
809
|
case "segment": {
|
|
771
810
|
if (e.componentId === "select") {
|
|
@@ -775,11 +814,12 @@ function it(e, t) {
|
|
|
775
814
|
let n = L(t);
|
|
776
815
|
return n?.length ? K(e.ownerColumnId, n) : void 0;
|
|
777
816
|
}
|
|
778
|
-
case "tree": return
|
|
779
|
-
case "local": return e.binding.kind === "list" ?
|
|
817
|
+
case "tree": return it(e, t);
|
|
818
|
+
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) ?? (() => {
|
|
780
819
|
let n = F(t), r = L(t), i = n ?? r;
|
|
781
820
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
782
821
|
})();
|
|
822
|
+
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;
|
|
783
823
|
case "column": {
|
|
784
824
|
let n = F(t), r = L(t), i = n ?? r;
|
|
785
825
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
@@ -791,16 +831,16 @@ function it(e, t) {
|
|
|
791
831
|
default:
|
|
792
832
|
}
|
|
793
833
|
}
|
|
794
|
-
function
|
|
834
|
+
function st(e, t) {
|
|
795
835
|
let n = H(e), r = W(t);
|
|
796
836
|
if (!n.length || !Object.keys(r).length) return;
|
|
797
|
-
let i = n.map((e) =>
|
|
837
|
+
let i = n.map((e) => ot(e, r[e.id])).filter((e) => !!e);
|
|
798
838
|
if (i.length) return i.length === 1 ? i[0] : {
|
|
799
839
|
and: !0,
|
|
800
840
|
filters: i
|
|
801
841
|
};
|
|
802
842
|
}
|
|
803
|
-
function
|
|
843
|
+
function ct(e, t) {
|
|
804
844
|
let n = H(e), r = W(t), i = {};
|
|
805
845
|
for (let e of n) {
|
|
806
846
|
if (e.kind !== "segment" && e.kind !== "tree") continue;
|
|
@@ -819,21 +859,21 @@ function ot(e, t) {
|
|
|
819
859
|
}
|
|
820
860
|
//#endregion
|
|
821
861
|
//#region src/odata-service/parser.ts
|
|
822
|
-
var
|
|
823
|
-
function
|
|
862
|
+
var lt = /^(.+)(_txt|_text|_t)$/i, q = /* @__PURE__ */ new Set(["ZDIV", "ZCFO1"]);
|
|
863
|
+
function ut(e) {
|
|
824
864
|
return e.label || e.id;
|
|
825
865
|
}
|
|
826
|
-
function
|
|
866
|
+
function dt(e) {
|
|
827
867
|
return e ? q.has(e.toUpperCase()) : !1;
|
|
828
868
|
}
|
|
829
|
-
function
|
|
869
|
+
function ft(e) {
|
|
830
870
|
if (!e) return !1;
|
|
831
871
|
let t = e.toUpperCase();
|
|
832
872
|
if (q.has(t)) return !0;
|
|
833
873
|
let n = t.match(/^(.+)(_TXT|_TEXT|_T)$/);
|
|
834
874
|
return n ? q.has(n[1]) : !1;
|
|
835
875
|
}
|
|
836
|
-
function
|
|
876
|
+
function pt(e) {
|
|
837
877
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
838
878
|
}
|
|
839
879
|
function J(e) {
|
|
@@ -842,13 +882,13 @@ function J(e) {
|
|
|
842
882
|
function Y(e, t) {
|
|
843
883
|
if (t) return e[t.toUpperCase()];
|
|
844
884
|
}
|
|
845
|
-
function
|
|
885
|
+
function mt(e, t, n) {
|
|
846
886
|
let r = Y(n, e);
|
|
847
887
|
if (!r) return;
|
|
848
|
-
let i = RegExp(`^${
|
|
888
|
+
let i = RegExp(`^${pt(r)}(_txt|_text|_t)$`, "i");
|
|
849
889
|
for (let e of t) if (i.test(e.id)) return e.id;
|
|
850
890
|
}
|
|
851
|
-
function
|
|
891
|
+
function ht(e) {
|
|
852
892
|
let t = {}, n = {};
|
|
853
893
|
for (let r of e) t[r.id] = r, n[r.id.toUpperCase()] = r.id;
|
|
854
894
|
for (let t of e) {
|
|
@@ -856,7 +896,7 @@ function pt(e) {
|
|
|
856
896
|
t.semanticType = "none", t.linkedColumnId = void 0;
|
|
857
897
|
continue;
|
|
858
898
|
}
|
|
859
|
-
t.role = "dimension", t.sortable = !0, t.filterable = !0, t.semanticType =
|
|
899
|
+
t.role = "dimension", t.sortable = !0, t.filterable = !0, t.semanticType = lt.test(t.id) ? "text" : "code";
|
|
860
900
|
let e = Y(n, t.linkedColumnId);
|
|
861
901
|
t.linkedColumnId = e && e !== t.id ? e : void 0;
|
|
862
902
|
}
|
|
@@ -867,7 +907,7 @@ function pt(e) {
|
|
|
867
907
|
let e = t[i];
|
|
868
908
|
!e || e.role !== "dimension" ? i = void 0 : e.semanticType = "text";
|
|
869
909
|
}
|
|
870
|
-
if (i ||=
|
|
910
|
+
if (i ||= mt(r.id, e, n), !i && dt(r.id) && (i = mt(r.id, e, n)), r.linkedColumnId = i, i) {
|
|
871
911
|
let e = t[i];
|
|
872
912
|
e && e.role === "dimension" && (e.semanticType = "text", e.linkedColumnId = r.id);
|
|
873
913
|
}
|
|
@@ -880,7 +920,7 @@ function pt(e) {
|
|
|
880
920
|
!n || n.role !== "dimension" ? e = void 0 : n.semanticType = "code";
|
|
881
921
|
}
|
|
882
922
|
if (!e) {
|
|
883
|
-
let i = Y(n, r.id.match(
|
|
923
|
+
let i = Y(n, r.id.match(lt)?.[1]);
|
|
884
924
|
i && t[i]?.role === "dimension" && (e = i);
|
|
885
925
|
}
|
|
886
926
|
if (r.linkedColumnId = e, e) {
|
|
@@ -890,7 +930,7 @@ function pt(e) {
|
|
|
890
930
|
}
|
|
891
931
|
return e;
|
|
892
932
|
}
|
|
893
|
-
function
|
|
933
|
+
function gt(e) {
|
|
894
934
|
switch (e) {
|
|
895
935
|
case "Edm.String": return "string";
|
|
896
936
|
case "Edm.Guid": return "guid";
|
|
@@ -910,7 +950,7 @@ function mt(e) {
|
|
|
910
950
|
}
|
|
911
951
|
}
|
|
912
952
|
function X(e) {
|
|
913
|
-
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "", r =
|
|
953
|
+
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;
|
|
914
954
|
return {
|
|
915
955
|
id: t,
|
|
916
956
|
label: s ?? t,
|
|
@@ -925,7 +965,7 @@ function X(e) {
|
|
|
925
965
|
...c === "mandatory" && { mandatory: !0 }
|
|
926
966
|
};
|
|
927
967
|
}
|
|
928
|
-
function
|
|
968
|
+
function _t(e) {
|
|
929
969
|
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;
|
|
930
970
|
return {
|
|
931
971
|
...l,
|
|
@@ -937,42 +977,42 @@ function ht(e) {
|
|
|
937
977
|
role: a
|
|
938
978
|
};
|
|
939
979
|
}
|
|
940
|
-
function
|
|
980
|
+
function vt(e) {
|
|
941
981
|
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
942
982
|
return !t || !J(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
943
983
|
}
|
|
944
|
-
function
|
|
984
|
+
function yt(e) {
|
|
945
985
|
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
946
986
|
return !t || !J(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
947
987
|
}
|
|
948
988
|
function Z(e) {
|
|
949
989
|
return Array.from(e.getElementsByTagName("Property"));
|
|
950
990
|
}
|
|
951
|
-
function
|
|
991
|
+
function bt(e) {
|
|
952
992
|
return Array.from(e.getElementsByTagName("PropertyRef"));
|
|
953
993
|
}
|
|
954
|
-
function
|
|
994
|
+
function xt(e) {
|
|
955
995
|
return Array.from(e.getElementsByTagName("NavigationProperty"));
|
|
956
996
|
}
|
|
957
|
-
function
|
|
958
|
-
return Z(e).filter(
|
|
997
|
+
function St(e) {
|
|
998
|
+
return Z(e).filter(vt).map(X);
|
|
959
999
|
}
|
|
960
|
-
function
|
|
961
|
-
let t = Z(e).filter(
|
|
1000
|
+
function Ct(e) {
|
|
1001
|
+
let t = Z(e).filter(vt), n = bt(e);
|
|
962
1002
|
return t.map((e) => {
|
|
963
1003
|
let t = X(e);
|
|
964
1004
|
return n.find((e) => e.getAttribute("Name") === t.id) && (t.mandatory = !0), t;
|
|
965
1005
|
});
|
|
966
1006
|
}
|
|
967
|
-
function
|
|
968
|
-
return
|
|
1007
|
+
function wt(e) {
|
|
1008
|
+
return ht(Z(e).filter(yt).map(_t));
|
|
969
1009
|
}
|
|
970
1010
|
function Q(e) {
|
|
971
1011
|
if (!e) return;
|
|
972
1012
|
let t = e.split(".");
|
|
973
1013
|
return t[t.length - 1] || void 0;
|
|
974
1014
|
}
|
|
975
|
-
function
|
|
1015
|
+
function Tt(e) {
|
|
976
1016
|
let t = e.getAttribute("Mode");
|
|
977
1017
|
if (t && t !== "In") {
|
|
978
1018
|
let n = e.getAttribute("Name") || "(unknown)";
|
|
@@ -986,19 +1026,19 @@ function Ct(e) {
|
|
|
986
1026
|
let r = X(e);
|
|
987
1027
|
return e.getAttribute("Nullable") === "false" && (r.mandatory = !0), r;
|
|
988
1028
|
}
|
|
989
|
-
function
|
|
1029
|
+
function Et(e) {
|
|
990
1030
|
return e.reduce((e, t) => {
|
|
991
1031
|
let n = t.getAttribute("Name");
|
|
992
1032
|
return n && (e[n] = t), e;
|
|
993
1033
|
}, {});
|
|
994
1034
|
}
|
|
995
|
-
function
|
|
1035
|
+
function Dt(e) {
|
|
996
1036
|
return Array.from(e.getElementsByTagName("EntitySet")).reduce((e, t) => {
|
|
997
1037
|
let n = t.getAttribute("Name"), r = Q(t.getAttribute("EntityType"));
|
|
998
1038
|
return !n || !r || (e[n] = r), e;
|
|
999
1039
|
}, {});
|
|
1000
1040
|
}
|
|
1001
|
-
function
|
|
1041
|
+
function Ot(e) {
|
|
1002
1042
|
return Array.from(e.getElementsByTagName("AssociationSet")).reduce((e, t) => {
|
|
1003
1043
|
let n = t.getAttribute("Association");
|
|
1004
1044
|
if (!n) return e;
|
|
@@ -1014,8 +1054,8 @@ function Et(e) {
|
|
|
1014
1054
|
return i && (e[i] = r), e;
|
|
1015
1055
|
}, {});
|
|
1016
1056
|
}
|
|
1017
|
-
function
|
|
1018
|
-
for (let n of
|
|
1057
|
+
function kt(e, t) {
|
|
1058
|
+
for (let n of xt(e)) {
|
|
1019
1059
|
let e = n.getAttribute("Name");
|
|
1020
1060
|
if (e !== "Set" && e !== "Results") continue;
|
|
1021
1061
|
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;
|
|
@@ -1025,34 +1065,34 @@ function Dt(e, t) {
|
|
|
1025
1065
|
};
|
|
1026
1066
|
}
|
|
1027
1067
|
}
|
|
1028
|
-
function
|
|
1068
|
+
function At(e, t, n) {
|
|
1029
1069
|
let r = /* @__PURE__ */ new Set();
|
|
1030
1070
|
for (let [i, a] of Object.entries(e)) {
|
|
1031
1071
|
let e = t[a];
|
|
1032
1072
|
if (!e) continue;
|
|
1033
|
-
let o =
|
|
1073
|
+
let o = kt(e, n);
|
|
1034
1074
|
o?.targetEntitySet && o.targetEntitySet !== i && r.add(o.targetEntitySet);
|
|
1035
1075
|
}
|
|
1036
1076
|
return r;
|
|
1037
1077
|
}
|
|
1038
|
-
function
|
|
1078
|
+
function jt(e, t, n, r) {
|
|
1039
1079
|
let i = t?.targetEntitySet ? n[t.targetEntitySet] : void 0;
|
|
1040
1080
|
return i && r[i] || e;
|
|
1041
1081
|
}
|
|
1042
|
-
function
|
|
1043
|
-
if (n) return
|
|
1044
|
-
if (!t.endsWith("Type")) return
|
|
1082
|
+
function Mt(e, t, n) {
|
|
1083
|
+
if (n) return St(e);
|
|
1084
|
+
if (!t.endsWith("Type")) return Ct(e);
|
|
1045
1085
|
}
|
|
1046
|
-
function
|
|
1086
|
+
function Nt(e, t) {
|
|
1047
1087
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1048
1088
|
let n = Q(e);
|
|
1049
1089
|
if (!n) return /* @__PURE__ */ new Set();
|
|
1050
1090
|
let r = t[n];
|
|
1051
|
-
return r ? new Set(
|
|
1091
|
+
return r ? new Set(bt(r).map((e) => e.getAttribute("Name")).filter((e) => !!e)) : /* @__PURE__ */ new Set();
|
|
1052
1092
|
}
|
|
1053
|
-
function
|
|
1054
|
-
let r = e.getAttribute("Name") || "", i = e.getAttribute("EntitySet") || void 0, a = e.getAttribute("sap:action-for") || void 0, o =
|
|
1055
|
-
let t =
|
|
1093
|
+
function Pt(e, t, n) {
|
|
1094
|
+
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) => {
|
|
1095
|
+
let t = Tt(e);
|
|
1056
1096
|
return o.has(t.id) && (t.mandatory = !0), t;
|
|
1057
1097
|
});
|
|
1058
1098
|
return {
|
|
@@ -1066,22 +1106,22 @@ function Mt(e, t, n) {
|
|
|
1066
1106
|
...i && t[i] ? { resultEntity: i } : {}
|
|
1067
1107
|
};
|
|
1068
1108
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let t = new DOMParser().parseFromString(e, "application/xml"), n = Array.from(t.getElementsByTagName("EntityType")), r = Array.from(t.getElementsByTagName("FunctionImport")), i =
|
|
1109
|
+
function Ft(e) {
|
|
1110
|
+
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 = {};
|
|
1071
1111
|
for (let [e, t] of Object.entries(i)) {
|
|
1072
1112
|
if (s.has(e)) continue;
|
|
1073
1113
|
let n = a[t];
|
|
1074
1114
|
if (!n) continue;
|
|
1075
|
-
let r =
|
|
1115
|
+
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);
|
|
1076
1116
|
c[e] = {
|
|
1077
|
-
title:
|
|
1078
|
-
columns:
|
|
1079
|
-
...
|
|
1117
|
+
title: ee,
|
|
1118
|
+
columns: u,
|
|
1119
|
+
...d?.length ? { parameters: d } : {},
|
|
1080
1120
|
...r ? { result: r.name } : {}
|
|
1081
1121
|
};
|
|
1082
1122
|
}
|
|
1083
1123
|
for (let e of r) {
|
|
1084
|
-
let t =
|
|
1124
|
+
let t = Pt(e, i, a);
|
|
1085
1125
|
l[t.name] = t;
|
|
1086
1126
|
}
|
|
1087
1127
|
return {
|
|
@@ -1091,30 +1131,30 @@ function Nt(e) {
|
|
|
1091
1131
|
}
|
|
1092
1132
|
//#endregion
|
|
1093
1133
|
//#region src/odata-service/sorts.ts
|
|
1094
|
-
function
|
|
1134
|
+
function It(e, t) {
|
|
1095
1135
|
return e.findIndex((e) => e.key === t);
|
|
1096
1136
|
}
|
|
1097
|
-
function
|
|
1137
|
+
function Lt(e) {
|
|
1098
1138
|
return e.map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`).join(",");
|
|
1099
1139
|
}
|
|
1100
|
-
function
|
|
1101
|
-
let r =
|
|
1140
|
+
function Rt(e, t, n) {
|
|
1141
|
+
let r = It(e, t), i = n ? [...e] : [...e.filter((e) => e.key === t)];
|
|
1102
1142
|
return r === -1 ? (i.push({ key: t }), i) : e[r].desc ? i.filter((e) => e.key !== t) : i.map((e) => e.key === t ? {
|
|
1103
1143
|
key: t,
|
|
1104
1144
|
desc: !0
|
|
1105
1145
|
} : e);
|
|
1106
1146
|
}
|
|
1107
|
-
function
|
|
1147
|
+
function zt(e, t) {
|
|
1108
1148
|
return t.length > 0 ? t.map((e) => ({
|
|
1109
1149
|
key: e.key,
|
|
1110
1150
|
desc: e.desc
|
|
1111
1151
|
})) : e.map((e) => ({ key: e }));
|
|
1112
1152
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let n =
|
|
1153
|
+
function Bt(e, t) {
|
|
1154
|
+
let n = zt(e, t).map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`);
|
|
1115
1155
|
return n.length ? n.join(",") : void 0;
|
|
1116
1156
|
}
|
|
1117
|
-
function
|
|
1157
|
+
function Vt(e, t, n) {
|
|
1118
1158
|
let r = t.length > 0, i = e.indexOf(n);
|
|
1119
1159
|
if (!r && i !== -1) return {
|
|
1120
1160
|
active: !0,
|
|
@@ -1130,61 +1170,61 @@ function zt(e, t, n) {
|
|
|
1130
1170
|
}
|
|
1131
1171
|
//#endregion
|
|
1132
1172
|
//#region src/odata-service/sqlFilters.ts
|
|
1133
|
-
var
|
|
1134
|
-
function
|
|
1173
|
+
var Ht = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
1174
|
+
function Ut(e) {
|
|
1135
1175
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
1136
1176
|
}
|
|
1137
1177
|
function $(e) {
|
|
1138
|
-
if (!
|
|
1178
|
+
if (!Ht.test(e)) throw Error(`Некорректное имя поля SQL-фильтра: ${e}`);
|
|
1139
1179
|
}
|
|
1140
|
-
function
|
|
1180
|
+
function Wt(e, t) {
|
|
1141
1181
|
return {
|
|
1142
1182
|
fieldId: e,
|
|
1143
1183
|
operation: "eq",
|
|
1144
1184
|
value: t
|
|
1145
1185
|
};
|
|
1146
1186
|
}
|
|
1147
|
-
function
|
|
1187
|
+
function Gt(e, t) {
|
|
1148
1188
|
return {
|
|
1149
1189
|
fieldId: e,
|
|
1150
1190
|
operation: "in",
|
|
1151
1191
|
values: t
|
|
1152
1192
|
};
|
|
1153
1193
|
}
|
|
1154
|
-
function
|
|
1194
|
+
function Kt(e) {
|
|
1155
1195
|
if (e instanceof Date) throw Error("Дата должна быть отформатирована вызывающей стороной до формирования SQL-фильтра");
|
|
1156
|
-
if (!
|
|
1196
|
+
if (!Ut(e) || typeof e == "number" && !Number.isFinite(e)) return;
|
|
1157
1197
|
let t = String(e);
|
|
1158
1198
|
if (!(!t || t.trim() === "")) return `'${t.replaceAll("'", "''")}'`;
|
|
1159
1199
|
}
|
|
1160
|
-
function
|
|
1200
|
+
function qt(e) {
|
|
1161
1201
|
if (e.operation === "eq") {
|
|
1162
|
-
let t =
|
|
1202
|
+
let t = Kt(e.value);
|
|
1163
1203
|
return t ? ($(e.fieldId), `${e.fieldId}=${t}`) : void 0;
|
|
1164
1204
|
}
|
|
1165
|
-
let t = (e.values ?? []).map((e) =>
|
|
1205
|
+
let t = (e.values ?? []).map((e) => Kt(e)).filter((e) => !!e);
|
|
1166
1206
|
if (t.length !== 0) return $(e.fieldId), `${e.fieldId} IN (${t.join(", ")})`;
|
|
1167
1207
|
}
|
|
1168
|
-
function
|
|
1169
|
-
return e ? e.map((e) =>
|
|
1208
|
+
function Jt(e) {
|
|
1209
|
+
return e ? e.map((e) => qt(e)).filter((e) => !!e).join(" AND ") : "";
|
|
1170
1210
|
}
|
|
1171
1211
|
//#endregion
|
|
1172
1212
|
//#region src/odata-service/typesValidation.ts
|
|
1173
|
-
function
|
|
1213
|
+
function Yt(e) {
|
|
1174
1214
|
return e === "boolean";
|
|
1175
1215
|
}
|
|
1176
|
-
function
|
|
1216
|
+
function Xt(e) {
|
|
1177
1217
|
return e === "byte" || e === "int" || e === "long" || e === "float" || e === "decimal" || e === "double";
|
|
1178
1218
|
}
|
|
1179
|
-
function
|
|
1219
|
+
function Zt(e) {
|
|
1180
1220
|
return e === "byte" || e === "int" || e === "long";
|
|
1181
1221
|
}
|
|
1182
|
-
function
|
|
1222
|
+
function Qt(e) {
|
|
1183
1223
|
return e === "datetime" || e === "datetimeOffset" || e === "time";
|
|
1184
1224
|
}
|
|
1185
1225
|
//#endregion
|
|
1186
1226
|
//#region src/odata-service/unwrapODataQueryResult.ts
|
|
1187
|
-
function
|
|
1227
|
+
function $t(e) {
|
|
1188
1228
|
let t = e.data?.data, n = e.data?.totalCount;
|
|
1189
1229
|
return {
|
|
1190
1230
|
...e,
|
|
@@ -1194,30 +1234,30 @@ function Zt(e) {
|
|
|
1194
1234
|
}
|
|
1195
1235
|
//#endregion
|
|
1196
1236
|
//#region src/odata-service/utils.ts
|
|
1197
|
-
function
|
|
1198
|
-
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [
|
|
1237
|
+
function en(e) {
|
|
1238
|
+
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [nn(e) ? e ?? null : null, null];
|
|
1199
1239
|
}
|
|
1200
|
-
function
|
|
1240
|
+
function tn(t) {
|
|
1201
1241
|
return t instanceof Date ? t : Array.isArray(t) || e(t) ? null : t;
|
|
1202
1242
|
}
|
|
1203
|
-
function
|
|
1243
|
+
function nn(e) {
|
|
1204
1244
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1205
1245
|
}
|
|
1206
1246
|
//#endregion
|
|
1207
1247
|
//#region src/odata-service/wrapParams.ts
|
|
1208
|
-
function
|
|
1248
|
+
function rn(e) {
|
|
1209
1249
|
if (!e) return {};
|
|
1210
1250
|
let t = {};
|
|
1211
1251
|
for (let n in e) t[n] = { value: e[n] };
|
|
1212
1252
|
return t;
|
|
1213
1253
|
}
|
|
1214
|
-
function
|
|
1254
|
+
function an(e) {
|
|
1215
1255
|
if (!e) return;
|
|
1216
1256
|
let t = {};
|
|
1217
1257
|
for (let n of Object.keys(e).sort()) t[n] = e[n]?.value ?? null;
|
|
1218
1258
|
return t;
|
|
1219
1259
|
}
|
|
1220
1260
|
//#endregion
|
|
1221
|
-
export {
|
|
1261
|
+
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 };
|
|
1222
1262
|
|
|
1223
|
-
//# sourceMappingURL=odata-service-
|
|
1263
|
+
//# sourceMappingURL=odata-service-Ba6s7-gZ.js.map
|