@ryuzaki13/react-foundation-lib 1.1.12 → 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-DPMcERgh.js → formatters-CUJBLfgF.js} +3 -3
- package/dist/chunks/{formatters-DPMcERgh.js.map → formatters-CUJBLfgF.js.map} +1 -1
- package/dist/chunks/{odata-service-CEfjPsY9.js → odata-service-Ba6s7-gZ.js} +301 -264
- package/dist/chunks/odata-service-Ba6s7-gZ.js.map +1 -0
- package/dist/chunks/{validate-Ddyzk756.js → validate-1-8BDMGH.js} +2 -2
- package/dist/chunks/{validate-Ddyzk756.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-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,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) : [];
|
|
533
|
+
}))];
|
|
534
|
+
}
|
|
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, "") : [];
|
|
527
544
|
}))];
|
|
528
545
|
}
|
|
529
|
-
return
|
|
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,57 +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 (!e
|
|
616
|
-
let
|
|
617
|
-
|
|
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) {
|
|
618
654
|
case "segment":
|
|
619
655
|
t.push({
|
|
620
|
-
...
|
|
656
|
+
...r,
|
|
621
657
|
id: e,
|
|
622
|
-
ownerColumnId:
|
|
623
|
-
columnIds: [
|
|
624
|
-
componentId:
|
|
625
|
-
dictionaryCodeKey:
|
|
658
|
+
ownerColumnId: i,
|
|
659
|
+
columnIds: [i],
|
|
660
|
+
componentId: r.componentId === "select" ? "select" : "multi-select",
|
|
661
|
+
dictionaryCodeKey: P(r.dictionaryCodeKey, i)
|
|
626
662
|
});
|
|
627
663
|
break;
|
|
628
664
|
case "tree": {
|
|
629
|
-
let n = [...new Set(
|
|
665
|
+
let n = [...new Set(r.columnIds.map((e) => e.trim()).filter(Boolean))];
|
|
630
666
|
if (n.length < 2) break;
|
|
631
|
-
let a =
|
|
667
|
+
let a = r.componentId, o = a === "treeSelect" || a === "tree-select" ? "tree-select" : "tree-multi-select";
|
|
632
668
|
t.push({
|
|
633
|
-
...
|
|
669
|
+
...r,
|
|
634
670
|
id: e,
|
|
635
|
-
ownerColumnId: n.includes(
|
|
671
|
+
ownerColumnId: n.includes(i) ? i : n[0],
|
|
636
672
|
columnIds: n,
|
|
637
673
|
componentId: o
|
|
638
674
|
});
|
|
639
675
|
break;
|
|
640
676
|
}
|
|
641
677
|
case "local": {
|
|
642
|
-
let n = V(
|
|
678
|
+
let n = V(r.binding);
|
|
643
679
|
if (!n) break;
|
|
644
680
|
t.push({
|
|
645
|
-
...
|
|
681
|
+
...r,
|
|
646
682
|
id: e,
|
|
647
|
-
ownerColumnId:
|
|
648
|
-
columnIds:
|
|
683
|
+
ownerColumnId: i,
|
|
684
|
+
columnIds: j(n, i),
|
|
649
685
|
binding: n
|
|
650
686
|
});
|
|
651
687
|
break;
|
|
652
688
|
}
|
|
653
689
|
case "advanced":
|
|
654
690
|
t.push({
|
|
655
|
-
...
|
|
691
|
+
...r,
|
|
656
692
|
id: e,
|
|
657
|
-
ownerColumnId:
|
|
693
|
+
ownerColumnId: i
|
|
658
694
|
});
|
|
659
695
|
break;
|
|
660
696
|
case "column":
|
|
661
697
|
t.push({
|
|
662
|
-
...
|
|
698
|
+
...r,
|
|
663
699
|
id: e,
|
|
664
|
-
ownerColumnId:
|
|
700
|
+
ownerColumnId: i
|
|
665
701
|
});
|
|
666
702
|
break;
|
|
667
703
|
default:
|
|
@@ -685,11 +721,11 @@ function W(e) {
|
|
|
685
721
|
}
|
|
686
722
|
return t;
|
|
687
723
|
}
|
|
688
|
-
function
|
|
724
|
+
function $e(e, t, n) {
|
|
689
725
|
let r = { ...W(e) }, i = U(n);
|
|
690
726
|
return i === void 0 ? (delete r[t], r) : (r[t] = i, r);
|
|
691
727
|
}
|
|
692
|
-
function
|
|
728
|
+
function et(e, t, n) {
|
|
693
729
|
if (!e || Object.keys(e).length === 0) return {};
|
|
694
730
|
let r = {}, i = {};
|
|
695
731
|
for (let [e, t] of Object.entries(n)) for (let n of t) i[n.codeKey] = e;
|
|
@@ -714,61 +750,61 @@ function Qe(e, t, n) {
|
|
|
714
750
|
}
|
|
715
751
|
return r;
|
|
716
752
|
}
|
|
717
|
-
function
|
|
753
|
+
function tt(e, t) {
|
|
718
754
|
return F(t);
|
|
719
755
|
}
|
|
720
|
-
function
|
|
721
|
-
let r =
|
|
722
|
-
if (r
|
|
723
|
-
|
|
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,
|
|
724
762
|
operation: t.operation,
|
|
725
763
|
value: r
|
|
726
764
|
};
|
|
727
765
|
}
|
|
728
766
|
function G(e, t, n) {
|
|
729
767
|
if (!t?.conditions.length) return;
|
|
730
|
-
let r = t.conditions.map((t) =>
|
|
768
|
+
let r = t.conditions.map((t) => nt(e, t, n)).filter((e) => !!e);
|
|
731
769
|
if (r.length) return {
|
|
732
770
|
and: t.and === !1 ? void 0 : !0,
|
|
733
771
|
conditions: r
|
|
734
772
|
};
|
|
735
773
|
}
|
|
736
|
-
function
|
|
737
|
-
return
|
|
774
|
+
function rt(e) {
|
|
775
|
+
return k(e, !0);
|
|
738
776
|
}
|
|
739
777
|
function K(e, t) {
|
|
740
|
-
return
|
|
778
|
+
return k(e, t);
|
|
741
779
|
}
|
|
742
|
-
function
|
|
780
|
+
function it(e, t) {
|
|
743
781
|
let n = z(t);
|
|
744
782
|
if (!n) return;
|
|
745
783
|
let r = e.columnIds.map((e) => {
|
|
746
784
|
let t = n[e];
|
|
747
|
-
if (t?.length) return
|
|
785
|
+
if (t?.length) return k(e, t);
|
|
748
786
|
}).filter((e) => !!e);
|
|
749
787
|
if (r.length) return r.length === 1 ? r[0] : {
|
|
750
788
|
and: !0,
|
|
751
789
|
filters: r
|
|
752
790
|
};
|
|
753
791
|
}
|
|
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);
|
|
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
|
+
};
|
|
770
806
|
}
|
|
771
|
-
function
|
|
807
|
+
function ot(e, t) {
|
|
772
808
|
if (t !== void 0) switch (e.kind) {
|
|
773
809
|
case "segment": {
|
|
774
810
|
if (e.componentId === "select") {
|
|
@@ -778,11 +814,12 @@ function it(e, t) {
|
|
|
778
814
|
let n = L(t);
|
|
779
815
|
return n?.length ? K(e.ownerColumnId, n) : void 0;
|
|
780
816
|
}
|
|
781
|
-
case "tree": return
|
|
782
|
-
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) ?? (() => {
|
|
783
819
|
let n = F(t), r = L(t), i = n ?? r;
|
|
784
820
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
785
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;
|
|
786
823
|
case "column": {
|
|
787
824
|
let n = F(t), r = L(t), i = n ?? r;
|
|
788
825
|
return i === void 0 ? void 0 : K(e.ownerColumnId, i);
|
|
@@ -794,16 +831,16 @@ function it(e, t) {
|
|
|
794
831
|
default:
|
|
795
832
|
}
|
|
796
833
|
}
|
|
797
|
-
function
|
|
834
|
+
function st(e, t) {
|
|
798
835
|
let n = H(e), r = W(t);
|
|
799
836
|
if (!n.length || !Object.keys(r).length) return;
|
|
800
|
-
let i = n.map((e) =>
|
|
837
|
+
let i = n.map((e) => ot(e, r[e.id])).filter((e) => !!e);
|
|
801
838
|
if (i.length) return i.length === 1 ? i[0] : {
|
|
802
839
|
and: !0,
|
|
803
840
|
filters: i
|
|
804
841
|
};
|
|
805
842
|
}
|
|
806
|
-
function
|
|
843
|
+
function ct(e, t) {
|
|
807
844
|
let n = H(e), r = W(t), i = {};
|
|
808
845
|
for (let e of n) {
|
|
809
846
|
if (e.kind !== "segment" && e.kind !== "tree") continue;
|
|
@@ -822,21 +859,21 @@ function ot(e, t) {
|
|
|
822
859
|
}
|
|
823
860
|
//#endregion
|
|
824
861
|
//#region src/odata-service/parser.ts
|
|
825
|
-
var
|
|
826
|
-
function
|
|
862
|
+
var lt = /^(.+)(_txt|_text|_t)$/i, q = /* @__PURE__ */ new Set(["ZDIV", "ZCFO1"]);
|
|
863
|
+
function ut(e) {
|
|
827
864
|
return e.label || e.id;
|
|
828
865
|
}
|
|
829
|
-
function
|
|
866
|
+
function dt(e) {
|
|
830
867
|
return e ? q.has(e.toUpperCase()) : !1;
|
|
831
868
|
}
|
|
832
|
-
function
|
|
869
|
+
function ft(e) {
|
|
833
870
|
if (!e) return !1;
|
|
834
871
|
let t = e.toUpperCase();
|
|
835
872
|
if (q.has(t)) return !0;
|
|
836
873
|
let n = t.match(/^(.+)(_TXT|_TEXT|_T)$/);
|
|
837
874
|
return n ? q.has(n[1]) : !1;
|
|
838
875
|
}
|
|
839
|
-
function
|
|
876
|
+
function pt(e) {
|
|
840
877
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
841
878
|
}
|
|
842
879
|
function J(e) {
|
|
@@ -845,13 +882,13 @@ function J(e) {
|
|
|
845
882
|
function Y(e, t) {
|
|
846
883
|
if (t) return e[t.toUpperCase()];
|
|
847
884
|
}
|
|
848
|
-
function
|
|
885
|
+
function mt(e, t, n) {
|
|
849
886
|
let r = Y(n, e);
|
|
850
887
|
if (!r) return;
|
|
851
|
-
let i = RegExp(`^${
|
|
888
|
+
let i = RegExp(`^${pt(r)}(_txt|_text|_t)$`, "i");
|
|
852
889
|
for (let e of t) if (i.test(e.id)) return e.id;
|
|
853
890
|
}
|
|
854
|
-
function
|
|
891
|
+
function ht(e) {
|
|
855
892
|
let t = {}, n = {};
|
|
856
893
|
for (let r of e) t[r.id] = r, n[r.id.toUpperCase()] = r.id;
|
|
857
894
|
for (let t of e) {
|
|
@@ -859,7 +896,7 @@ function pt(e) {
|
|
|
859
896
|
t.semanticType = "none", t.linkedColumnId = void 0;
|
|
860
897
|
continue;
|
|
861
898
|
}
|
|
862
|
-
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";
|
|
863
900
|
let e = Y(n, t.linkedColumnId);
|
|
864
901
|
t.linkedColumnId = e && e !== t.id ? e : void 0;
|
|
865
902
|
}
|
|
@@ -870,7 +907,7 @@ function pt(e) {
|
|
|
870
907
|
let e = t[i];
|
|
871
908
|
!e || e.role !== "dimension" ? i = void 0 : e.semanticType = "text";
|
|
872
909
|
}
|
|
873
|
-
if (i ||=
|
|
910
|
+
if (i ||= mt(r.id, e, n), !i && dt(r.id) && (i = mt(r.id, e, n)), r.linkedColumnId = i, i) {
|
|
874
911
|
let e = t[i];
|
|
875
912
|
e && e.role === "dimension" && (e.semanticType = "text", e.linkedColumnId = r.id);
|
|
876
913
|
}
|
|
@@ -883,7 +920,7 @@ function pt(e) {
|
|
|
883
920
|
!n || n.role !== "dimension" ? e = void 0 : n.semanticType = "code";
|
|
884
921
|
}
|
|
885
922
|
if (!e) {
|
|
886
|
-
let i = Y(n, r.id.match(
|
|
923
|
+
let i = Y(n, r.id.match(lt)?.[1]);
|
|
887
924
|
i && t[i]?.role === "dimension" && (e = i);
|
|
888
925
|
}
|
|
889
926
|
if (r.linkedColumnId = e, e) {
|
|
@@ -893,7 +930,7 @@ function pt(e) {
|
|
|
893
930
|
}
|
|
894
931
|
return e;
|
|
895
932
|
}
|
|
896
|
-
function
|
|
933
|
+
function gt(e) {
|
|
897
934
|
switch (e) {
|
|
898
935
|
case "Edm.String": return "string";
|
|
899
936
|
case "Edm.Guid": return "guid";
|
|
@@ -913,7 +950,7 @@ function mt(e) {
|
|
|
913
950
|
}
|
|
914
951
|
}
|
|
915
952
|
function X(e) {
|
|
916
|
-
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;
|
|
917
954
|
return {
|
|
918
955
|
id: t,
|
|
919
956
|
label: s ?? t,
|
|
@@ -928,7 +965,7 @@ function X(e) {
|
|
|
928
965
|
...c === "mandatory" && { mandatory: !0 }
|
|
929
966
|
};
|
|
930
967
|
}
|
|
931
|
-
function
|
|
968
|
+
function _t(e) {
|
|
932
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;
|
|
933
970
|
return {
|
|
934
971
|
...l,
|
|
@@ -940,42 +977,42 @@ function ht(e) {
|
|
|
940
977
|
role: a
|
|
941
978
|
};
|
|
942
979
|
}
|
|
943
|
-
function
|
|
980
|
+
function vt(e) {
|
|
944
981
|
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
945
982
|
return !t || !J(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
946
983
|
}
|
|
947
|
-
function
|
|
984
|
+
function yt(e) {
|
|
948
985
|
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
949
986
|
return !t || !J(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
950
987
|
}
|
|
951
988
|
function Z(e) {
|
|
952
989
|
return Array.from(e.getElementsByTagName("Property"));
|
|
953
990
|
}
|
|
954
|
-
function
|
|
991
|
+
function bt(e) {
|
|
955
992
|
return Array.from(e.getElementsByTagName("PropertyRef"));
|
|
956
993
|
}
|
|
957
|
-
function
|
|
994
|
+
function xt(e) {
|
|
958
995
|
return Array.from(e.getElementsByTagName("NavigationProperty"));
|
|
959
996
|
}
|
|
960
|
-
function
|
|
961
|
-
return Z(e).filter(
|
|
997
|
+
function St(e) {
|
|
998
|
+
return Z(e).filter(vt).map(X);
|
|
962
999
|
}
|
|
963
|
-
function
|
|
964
|
-
let t = Z(e).filter(
|
|
1000
|
+
function Ct(e) {
|
|
1001
|
+
let t = Z(e).filter(vt), n = bt(e);
|
|
965
1002
|
return t.map((e) => {
|
|
966
1003
|
let t = X(e);
|
|
967
1004
|
return n.find((e) => e.getAttribute("Name") === t.id) && (t.mandatory = !0), t;
|
|
968
1005
|
});
|
|
969
1006
|
}
|
|
970
|
-
function
|
|
971
|
-
return
|
|
1007
|
+
function wt(e) {
|
|
1008
|
+
return ht(Z(e).filter(yt).map(_t));
|
|
972
1009
|
}
|
|
973
1010
|
function Q(e) {
|
|
974
1011
|
if (!e) return;
|
|
975
1012
|
let t = e.split(".");
|
|
976
1013
|
return t[t.length - 1] || void 0;
|
|
977
1014
|
}
|
|
978
|
-
function
|
|
1015
|
+
function Tt(e) {
|
|
979
1016
|
let t = e.getAttribute("Mode");
|
|
980
1017
|
if (t && t !== "In") {
|
|
981
1018
|
let n = e.getAttribute("Name") || "(unknown)";
|
|
@@ -989,19 +1026,19 @@ function Ct(e) {
|
|
|
989
1026
|
let r = X(e);
|
|
990
1027
|
return e.getAttribute("Nullable") === "false" && (r.mandatory = !0), r;
|
|
991
1028
|
}
|
|
992
|
-
function
|
|
1029
|
+
function Et(e) {
|
|
993
1030
|
return e.reduce((e, t) => {
|
|
994
1031
|
let n = t.getAttribute("Name");
|
|
995
1032
|
return n && (e[n] = t), e;
|
|
996
1033
|
}, {});
|
|
997
1034
|
}
|
|
998
|
-
function
|
|
1035
|
+
function Dt(e) {
|
|
999
1036
|
return Array.from(e.getElementsByTagName("EntitySet")).reduce((e, t) => {
|
|
1000
1037
|
let n = t.getAttribute("Name"), r = Q(t.getAttribute("EntityType"));
|
|
1001
1038
|
return !n || !r || (e[n] = r), e;
|
|
1002
1039
|
}, {});
|
|
1003
1040
|
}
|
|
1004
|
-
function
|
|
1041
|
+
function Ot(e) {
|
|
1005
1042
|
return Array.from(e.getElementsByTagName("AssociationSet")).reduce((e, t) => {
|
|
1006
1043
|
let n = t.getAttribute("Association");
|
|
1007
1044
|
if (!n) return e;
|
|
@@ -1017,8 +1054,8 @@ function Et(e) {
|
|
|
1017
1054
|
return i && (e[i] = r), e;
|
|
1018
1055
|
}, {});
|
|
1019
1056
|
}
|
|
1020
|
-
function
|
|
1021
|
-
for (let n of
|
|
1057
|
+
function kt(e, t) {
|
|
1058
|
+
for (let n of xt(e)) {
|
|
1022
1059
|
let e = n.getAttribute("Name");
|
|
1023
1060
|
if (e !== "Set" && e !== "Results") continue;
|
|
1024
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;
|
|
@@ -1028,34 +1065,34 @@ function Dt(e, t) {
|
|
|
1028
1065
|
};
|
|
1029
1066
|
}
|
|
1030
1067
|
}
|
|
1031
|
-
function
|
|
1068
|
+
function At(e, t, n) {
|
|
1032
1069
|
let r = /* @__PURE__ */ new Set();
|
|
1033
1070
|
for (let [i, a] of Object.entries(e)) {
|
|
1034
1071
|
let e = t[a];
|
|
1035
1072
|
if (!e) continue;
|
|
1036
|
-
let o =
|
|
1073
|
+
let o = kt(e, n);
|
|
1037
1074
|
o?.targetEntitySet && o.targetEntitySet !== i && r.add(o.targetEntitySet);
|
|
1038
1075
|
}
|
|
1039
1076
|
return r;
|
|
1040
1077
|
}
|
|
1041
|
-
function
|
|
1078
|
+
function jt(e, t, n, r) {
|
|
1042
1079
|
let i = t?.targetEntitySet ? n[t.targetEntitySet] : void 0;
|
|
1043
1080
|
return i && r[i] || e;
|
|
1044
1081
|
}
|
|
1045
|
-
function
|
|
1046
|
-
if (n) return
|
|
1047
|
-
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);
|
|
1048
1085
|
}
|
|
1049
|
-
function
|
|
1086
|
+
function Nt(e, t) {
|
|
1050
1087
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1051
1088
|
let n = Q(e);
|
|
1052
1089
|
if (!n) return /* @__PURE__ */ new Set();
|
|
1053
1090
|
let r = t[n];
|
|
1054
|
-
return r ? new Set(
|
|
1091
|
+
return r ? new Set(bt(r).map((e) => e.getAttribute("Name")).filter((e) => !!e)) : /* @__PURE__ */ new Set();
|
|
1055
1092
|
}
|
|
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 =
|
|
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);
|
|
1059
1096
|
return o.has(t.id) && (t.mandatory = !0), t;
|
|
1060
1097
|
});
|
|
1061
1098
|
return {
|
|
@@ -1069,22 +1106,22 @@ function Mt(e, t, n) {
|
|
|
1069
1106
|
...i && t[i] ? { resultEntity: i } : {}
|
|
1070
1107
|
};
|
|
1071
1108
|
}
|
|
1072
|
-
function
|
|
1073
|
-
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 = {};
|
|
1074
1111
|
for (let [e, t] of Object.entries(i)) {
|
|
1075
1112
|
if (s.has(e)) continue;
|
|
1076
1113
|
let n = a[t];
|
|
1077
1114
|
if (!n) continue;
|
|
1078
|
-
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);
|
|
1079
1116
|
c[e] = {
|
|
1080
|
-
title:
|
|
1081
|
-
columns:
|
|
1082
|
-
...
|
|
1117
|
+
title: ee,
|
|
1118
|
+
columns: u,
|
|
1119
|
+
...d?.length ? { parameters: d } : {},
|
|
1083
1120
|
...r ? { result: r.name } : {}
|
|
1084
1121
|
};
|
|
1085
1122
|
}
|
|
1086
1123
|
for (let e of r) {
|
|
1087
|
-
let t =
|
|
1124
|
+
let t = Pt(e, i, a);
|
|
1088
1125
|
l[t.name] = t;
|
|
1089
1126
|
}
|
|
1090
1127
|
return {
|
|
@@ -1094,30 +1131,30 @@ function Nt(e) {
|
|
|
1094
1131
|
}
|
|
1095
1132
|
//#endregion
|
|
1096
1133
|
//#region src/odata-service/sorts.ts
|
|
1097
|
-
function
|
|
1134
|
+
function It(e, t) {
|
|
1098
1135
|
return e.findIndex((e) => e.key === t);
|
|
1099
1136
|
}
|
|
1100
|
-
function
|
|
1137
|
+
function Lt(e) {
|
|
1101
1138
|
return e.map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`).join(",");
|
|
1102
1139
|
}
|
|
1103
|
-
function
|
|
1104
|
-
let r =
|
|
1140
|
+
function Rt(e, t, n) {
|
|
1141
|
+
let r = It(e, t), i = n ? [...e] : [...e.filter((e) => e.key === t)];
|
|
1105
1142
|
return r === -1 ? (i.push({ key: t }), i) : e[r].desc ? i.filter((e) => e.key !== t) : i.map((e) => e.key === t ? {
|
|
1106
1143
|
key: t,
|
|
1107
1144
|
desc: !0
|
|
1108
1145
|
} : e);
|
|
1109
1146
|
}
|
|
1110
|
-
function
|
|
1147
|
+
function zt(e, t) {
|
|
1111
1148
|
return t.length > 0 ? t.map((e) => ({
|
|
1112
1149
|
key: e.key,
|
|
1113
1150
|
desc: e.desc
|
|
1114
1151
|
})) : e.map((e) => ({ key: e }));
|
|
1115
1152
|
}
|
|
1116
|
-
function
|
|
1117
|
-
let n =
|
|
1153
|
+
function Bt(e, t) {
|
|
1154
|
+
let n = zt(e, t).map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`);
|
|
1118
1155
|
return n.length ? n.join(",") : void 0;
|
|
1119
1156
|
}
|
|
1120
|
-
function
|
|
1157
|
+
function Vt(e, t, n) {
|
|
1121
1158
|
let r = t.length > 0, i = e.indexOf(n);
|
|
1122
1159
|
if (!r && i !== -1) return {
|
|
1123
1160
|
active: !0,
|
|
@@ -1133,61 +1170,61 @@ function zt(e, t, n) {
|
|
|
1133
1170
|
}
|
|
1134
1171
|
//#endregion
|
|
1135
1172
|
//#region src/odata-service/sqlFilters.ts
|
|
1136
|
-
var
|
|
1137
|
-
function
|
|
1173
|
+
var Ht = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
1174
|
+
function Ut(e) {
|
|
1138
1175
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
1139
1176
|
}
|
|
1140
1177
|
function $(e) {
|
|
1141
|
-
if (!
|
|
1178
|
+
if (!Ht.test(e)) throw Error(`Некорректное имя поля SQL-фильтра: ${e}`);
|
|
1142
1179
|
}
|
|
1143
|
-
function
|
|
1180
|
+
function Wt(e, t) {
|
|
1144
1181
|
return {
|
|
1145
1182
|
fieldId: e,
|
|
1146
1183
|
operation: "eq",
|
|
1147
1184
|
value: t
|
|
1148
1185
|
};
|
|
1149
1186
|
}
|
|
1150
|
-
function
|
|
1187
|
+
function Gt(e, t) {
|
|
1151
1188
|
return {
|
|
1152
1189
|
fieldId: e,
|
|
1153
1190
|
operation: "in",
|
|
1154
1191
|
values: t
|
|
1155
1192
|
};
|
|
1156
1193
|
}
|
|
1157
|
-
function
|
|
1194
|
+
function Kt(e) {
|
|
1158
1195
|
if (e instanceof Date) throw Error("Дата должна быть отформатирована вызывающей стороной до формирования SQL-фильтра");
|
|
1159
|
-
if (!
|
|
1196
|
+
if (!Ut(e) || typeof e == "number" && !Number.isFinite(e)) return;
|
|
1160
1197
|
let t = String(e);
|
|
1161
1198
|
if (!(!t || t.trim() === "")) return `'${t.replaceAll("'", "''")}'`;
|
|
1162
1199
|
}
|
|
1163
|
-
function
|
|
1200
|
+
function qt(e) {
|
|
1164
1201
|
if (e.operation === "eq") {
|
|
1165
|
-
let t =
|
|
1202
|
+
let t = Kt(e.value);
|
|
1166
1203
|
return t ? ($(e.fieldId), `${e.fieldId}=${t}`) : void 0;
|
|
1167
1204
|
}
|
|
1168
|
-
let t = (e.values ?? []).map((e) =>
|
|
1205
|
+
let t = (e.values ?? []).map((e) => Kt(e)).filter((e) => !!e);
|
|
1169
1206
|
if (t.length !== 0) return $(e.fieldId), `${e.fieldId} IN (${t.join(", ")})`;
|
|
1170
1207
|
}
|
|
1171
|
-
function
|
|
1172
|
-
return e ? e.map((e) =>
|
|
1208
|
+
function Jt(e) {
|
|
1209
|
+
return e ? e.map((e) => qt(e)).filter((e) => !!e).join(" AND ") : "";
|
|
1173
1210
|
}
|
|
1174
1211
|
//#endregion
|
|
1175
1212
|
//#region src/odata-service/typesValidation.ts
|
|
1176
|
-
function
|
|
1213
|
+
function Yt(e) {
|
|
1177
1214
|
return e === "boolean";
|
|
1178
1215
|
}
|
|
1179
|
-
function
|
|
1216
|
+
function Xt(e) {
|
|
1180
1217
|
return e === "byte" || e === "int" || e === "long" || e === "float" || e === "decimal" || e === "double";
|
|
1181
1218
|
}
|
|
1182
|
-
function
|
|
1219
|
+
function Zt(e) {
|
|
1183
1220
|
return e === "byte" || e === "int" || e === "long";
|
|
1184
1221
|
}
|
|
1185
|
-
function
|
|
1222
|
+
function Qt(e) {
|
|
1186
1223
|
return e === "datetime" || e === "datetimeOffset" || e === "time";
|
|
1187
1224
|
}
|
|
1188
1225
|
//#endregion
|
|
1189
1226
|
//#region src/odata-service/unwrapODataQueryResult.ts
|
|
1190
|
-
function
|
|
1227
|
+
function $t(e) {
|
|
1191
1228
|
let t = e.data?.data, n = e.data?.totalCount;
|
|
1192
1229
|
return {
|
|
1193
1230
|
...e,
|
|
@@ -1197,30 +1234,30 @@ function Zt(e) {
|
|
|
1197
1234
|
}
|
|
1198
1235
|
//#endregion
|
|
1199
1236
|
//#region src/odata-service/utils.ts
|
|
1200
|
-
function
|
|
1201
|
-
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];
|
|
1202
1239
|
}
|
|
1203
|
-
function
|
|
1240
|
+
function tn(t) {
|
|
1204
1241
|
return t instanceof Date ? t : Array.isArray(t) || e(t) ? null : t;
|
|
1205
1242
|
}
|
|
1206
|
-
function
|
|
1243
|
+
function nn(e) {
|
|
1207
1244
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1208
1245
|
}
|
|
1209
1246
|
//#endregion
|
|
1210
1247
|
//#region src/odata-service/wrapParams.ts
|
|
1211
|
-
function
|
|
1248
|
+
function rn(e) {
|
|
1212
1249
|
if (!e) return {};
|
|
1213
1250
|
let t = {};
|
|
1214
1251
|
for (let n in e) t[n] = { value: e[n] };
|
|
1215
1252
|
return t;
|
|
1216
1253
|
}
|
|
1217
|
-
function
|
|
1254
|
+
function an(e) {
|
|
1218
1255
|
if (!e) return;
|
|
1219
1256
|
let t = {};
|
|
1220
1257
|
for (let n of Object.keys(e).sort()) t[n] = e[n]?.value ?? null;
|
|
1221
1258
|
return t;
|
|
1222
1259
|
}
|
|
1223
1260
|
//#endregion
|
|
1224
|
-
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 };
|
|
1225
1262
|
|
|
1226
|
-
//# sourceMappingURL=odata-service-
|
|
1263
|
+
//# sourceMappingURL=odata-service-Ba6s7-gZ.js.map
|