@ryuzaki13/react-foundation-lib 1.4.1 → 1.4.3
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/README.md +154 -100
- package/dist/chunks/{formatters-CBgrBeSA.js → formatters-D33Uh3si.js} +7 -8
- package/dist/chunks/{formatters-CBgrBeSA.js.map → formatters-D33Uh3si.js.map} +1 -1
- package/dist/chunks/odata-service-CWkHASdw.js +2211 -0
- package/dist/chunks/odata-service-CWkHASdw.js.map +1 -0
- package/dist/chunks/{validate-BW-7BZy_.js → validate-DyzojM0w.js} +2 -2
- package/dist/chunks/{validate-BW-7BZy_.js.map → validate-DyzojM0w.js.map} +1 -1
- package/dist/error-report/index.js +2 -2
- package/dist/excel/index.js +20 -21
- package/dist/excel/index.js.map +1 -1
- package/dist/formatters/index.js +4 -5
- package/dist/{odata → odata-service}/buildSeparatedArrays.d.ts +1 -1
- package/dist/odata-service/buildSeparatedArrays.d.ts.map +1 -0
- package/dist/{odata/types.d.ts → odata-service/collectionTypes.d.ts} +1 -1
- package/dist/odata-service/collectionTypes.d.ts.map +1 -0
- package/dist/{odata → odata-service}/dateUtils.d.ts +1 -1
- package/dist/odata-service/dateUtils.d.ts.map +1 -0
- package/dist/{odata → odata-service}/findCollectionPairs.d.ts +1 -1
- package/dist/odata-service/findCollectionPairs.d.ts.map +1 -0
- package/dist/odata-service/index.d.ts +5 -0
- package/dist/odata-service/index.d.ts.map +1 -1
- package/dist/odata-service/index.js +2 -2
- package/dist/{odata/store.d.ts → odata-service/odataCollectionStore.d.ts} +1 -1
- package/dist/odata-service/odataCollectionStore.d.ts.map +1 -0
- package/dist/query-client/index.js.map +1 -1
- package/dist/query-client/queryClient.d.ts +1 -3
- package/dist/query-client/queryClient.d.ts.map +1 -1
- package/package.json +1 -5
- package/src/bounded-copy-stack/README.mdx +257 -0
- package/src/context-menu/README.mdx +326 -0
- package/src/currency/README.mdx +155 -0
- package/src/date-segments/README.mdx +319 -0
- package/src/error/README.mdx +95 -0
- package/src/error-report/README.mdx +612 -0
- package/src/excel/README.mdx +449 -0
- package/src/fingerprint/README.mdx +100 -0
- package/src/form/README.mdx +101 -0
- package/src/foundationLib.mdx +70 -54
- package/src/hooks/README.mdx +988 -0
- package/src/http/README.mdx +126 -0
- package/src/media/README.mdx +1853 -0
- package/src/notifications/README.mdx +323 -0
- package/src/number-scale/README.mdx +318 -0
- package/src/odata-service/README.mdx +2916 -0
- package/src/presets/README.mdx +136 -0
- package/src/pwa/README.mdx +394 -0
- package/src/query-client/README.mdx +2500 -0
- package/src/range-output/README.mdx +161 -0
- package/src/seo/README.mdx +279 -0
- package/src/session-storage/README.mdx +125 -0
- package/src/string-comparison/README.mdx +96 -0
- package/src/table/README.mdx +3106 -0
- package/src/three-scene/README.mdx +248 -0
- package/src/types/README.mdx +172 -0
- package/src/utils/README.mdx +1724 -0
- package/src/validators/README.mdx +239 -0
- package/src/virtualizer/README.mdx +138 -0
- package/src/xml/README.mdx +149 -0
- package/dist/chunks/dateUtils-B5V5aXB-.js +0 -847
- package/dist/chunks/dateUtils-B5V5aXB-.js.map +0 -1
- package/dist/chunks/odata-service-B6TxBSLm.js +0 -1277
- package/dist/chunks/odata-service-B6TxBSLm.js.map +0 -1
- package/dist/odata/buildSeparatedArrays.d.ts.map +0 -1
- package/dist/odata/dateUtils.d.ts.map +0 -1
- package/dist/odata/findCollectionPairs.d.ts.map +0 -1
- package/dist/odata/index.d.ts +0 -6
- package/dist/odata/index.d.ts.map +0 -1
- package/dist/odata/index.js +0 -102
- package/dist/odata/index.js.map +0 -1
- package/dist/odata/store.d.ts.map +0 -1
- package/dist/odata/types.d.ts.map +0 -1
- package/src/pwa/README.md +0 -638
- package/src/query-client/README.md +0 -565
|
@@ -0,0 +1,2211 @@
|
|
|
1
|
+
import { n as e } from "./isRecord-DXDTW-jA.js";
|
|
2
|
+
import { t } from "./string-comparison-BKT7PXmq.js";
|
|
3
|
+
import { z as n } from "zod";
|
|
4
|
+
import { create as r } from "zustand";
|
|
5
|
+
import { immer as i } from "zustand/middleware/immer";
|
|
6
|
+
//#region src/formatters/boolean/parseAbapBoolean.ts
|
|
7
|
+
function a(e) {
|
|
8
|
+
return !!(e && typeof e == "string" && e === "X");
|
|
9
|
+
}
|
|
10
|
+
function o(e) {
|
|
11
|
+
return e ? typeof e == "string" ? [
|
|
12
|
+
"true",
|
|
13
|
+
"x",
|
|
14
|
+
"1"
|
|
15
|
+
].includes(e.toLowerCase()) : !!e : !1;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/formatters/date/pattern.ts
|
|
19
|
+
var s = Object.freeze([
|
|
20
|
+
"dd",
|
|
21
|
+
"MM",
|
|
22
|
+
"yyyy",
|
|
23
|
+
"yy"
|
|
24
|
+
]), c = Object.freeze([
|
|
25
|
+
"HH",
|
|
26
|
+
"mm",
|
|
27
|
+
"ss"
|
|
28
|
+
]), l = Object.freeze([...s, ...c]), u = /(yyyy|yy|MM|dd|HH|mm|ss)/g, d = new Set(l), f = Object.freeze({
|
|
29
|
+
day: new Set(l),
|
|
30
|
+
month: /* @__PURE__ */ new Set([
|
|
31
|
+
"MM",
|
|
32
|
+
"yyyy",
|
|
33
|
+
"yy"
|
|
34
|
+
]),
|
|
35
|
+
year: /* @__PURE__ */ new Set(["yyyy", "yy"])
|
|
36
|
+
});
|
|
37
|
+
function p(e) {
|
|
38
|
+
return d.has(e);
|
|
39
|
+
}
|
|
40
|
+
function m(e, t) {
|
|
41
|
+
return t.some((t) => e.includes(t));
|
|
42
|
+
}
|
|
43
|
+
function ee(e) {
|
|
44
|
+
return u.lastIndex = 0, u.test(e);
|
|
45
|
+
}
|
|
46
|
+
function te(e) {
|
|
47
|
+
return f[e];
|
|
48
|
+
}
|
|
49
|
+
function h(e, t) {
|
|
50
|
+
if (t === "day") return e;
|
|
51
|
+
let n = te(t), r = [], i = "", a = !1, o = 0, s = 0, c;
|
|
52
|
+
for (u.lastIndex = 0; c = u.exec(e);) {
|
|
53
|
+
let t = e.slice(s, c.index), l = c[0];
|
|
54
|
+
a && (i += t), n.has(l) && (a && r.push(i), r.push(l), i = "", a = !0, o += 1), s = c.index + l.length;
|
|
55
|
+
}
|
|
56
|
+
return o === 0 ? e : r.join("");
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/formatters/date/presets.ts
|
|
60
|
+
var g = "ru-RU", _ = Object.freeze([
|
|
61
|
+
"short",
|
|
62
|
+
"medium",
|
|
63
|
+
"long"
|
|
64
|
+
]), ne = Object.freeze([
|
|
65
|
+
"day",
|
|
66
|
+
"month",
|
|
67
|
+
"year"
|
|
68
|
+
]), v = {
|
|
69
|
+
locale: g,
|
|
70
|
+
intlOptions: {
|
|
71
|
+
day: "2-digit",
|
|
72
|
+
month: "2-digit",
|
|
73
|
+
year: "numeric"
|
|
74
|
+
},
|
|
75
|
+
invalidFallback: ""
|
|
76
|
+
}, y = Object.freeze({
|
|
77
|
+
date: "date",
|
|
78
|
+
dateShort: "date-short",
|
|
79
|
+
dateMedium: "date-medium",
|
|
80
|
+
dateLong: "date-long",
|
|
81
|
+
monthShort: "month-short",
|
|
82
|
+
monthMedium: "month-medium",
|
|
83
|
+
monthLong: "month-long",
|
|
84
|
+
monthYearMedium: "month-year-medium",
|
|
85
|
+
monthYearLong: "month-year-long",
|
|
86
|
+
datetime: "datetime",
|
|
87
|
+
datetimeSeconds: "datetime-seconds",
|
|
88
|
+
datetimeShort: "datetime-short",
|
|
89
|
+
datetimeMedium: "datetime-medium",
|
|
90
|
+
datetimeLong: "datetime-long",
|
|
91
|
+
time: "time",
|
|
92
|
+
timeSeconds: "time-seconds",
|
|
93
|
+
timeShort: "time-short",
|
|
94
|
+
timeMedium: "time-medium",
|
|
95
|
+
timeLong: "time-long",
|
|
96
|
+
odataDate: "odata-date",
|
|
97
|
+
odataDatetime: "odata-datetime",
|
|
98
|
+
abapDatetime: "abap-datetime",
|
|
99
|
+
abapDate: "abap-date",
|
|
100
|
+
abapMonth: "abap-month",
|
|
101
|
+
abapYear: "abap-year"
|
|
102
|
+
}), re = Object.freeze({
|
|
103
|
+
short: y.dateShort,
|
|
104
|
+
medium: y.dateMedium,
|
|
105
|
+
long: y.dateLong
|
|
106
|
+
}), ie = /* @__PURE__ */ new Map(), ae = [
|
|
107
|
+
{
|
|
108
|
+
name: y.date,
|
|
109
|
+
intlOptions: {
|
|
110
|
+
day: "2-digit",
|
|
111
|
+
month: "2-digit",
|
|
112
|
+
year: "numeric"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: y.datetime,
|
|
117
|
+
intlDateOptions: {
|
|
118
|
+
day: "2-digit",
|
|
119
|
+
month: "2-digit",
|
|
120
|
+
year: "numeric"
|
|
121
|
+
},
|
|
122
|
+
intlTimeOptions: {
|
|
123
|
+
hour: "2-digit",
|
|
124
|
+
minute: "2-digit",
|
|
125
|
+
hourCycle: "h23"
|
|
126
|
+
},
|
|
127
|
+
intlJoiner: " "
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: y.datetimeSeconds,
|
|
131
|
+
intlDateOptions: {
|
|
132
|
+
day: "2-digit",
|
|
133
|
+
month: "2-digit",
|
|
134
|
+
year: "numeric"
|
|
135
|
+
},
|
|
136
|
+
intlTimeOptions: {
|
|
137
|
+
hour: "2-digit",
|
|
138
|
+
minute: "2-digit",
|
|
139
|
+
second: "2-digit",
|
|
140
|
+
hourCycle: "h23"
|
|
141
|
+
},
|
|
142
|
+
intlJoiner: " "
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: y.time,
|
|
146
|
+
intlOptions: {
|
|
147
|
+
hour: "2-digit",
|
|
148
|
+
minute: "2-digit",
|
|
149
|
+
hourCycle: "h23"
|
|
150
|
+
},
|
|
151
|
+
durationPattern: "HH:mm"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: y.timeSeconds,
|
|
155
|
+
intlOptions: {
|
|
156
|
+
hour: "2-digit",
|
|
157
|
+
minute: "2-digit",
|
|
158
|
+
second: "2-digit",
|
|
159
|
+
hourCycle: "h23"
|
|
160
|
+
},
|
|
161
|
+
durationPattern: "HH:mm:ss"
|
|
162
|
+
},
|
|
163
|
+
..._.map((e) => ({
|
|
164
|
+
name: `date-${e}`,
|
|
165
|
+
intlOptions: se(e)
|
|
166
|
+
})),
|
|
167
|
+
..._.map((e) => ({
|
|
168
|
+
name: `month-${e}`,
|
|
169
|
+
intlOptions: ce(e)
|
|
170
|
+
})),
|
|
171
|
+
{
|
|
172
|
+
name: y.monthYearMedium,
|
|
173
|
+
intlOptions: {
|
|
174
|
+
month: "short",
|
|
175
|
+
year: "numeric"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: y.monthYearLong,
|
|
180
|
+
intlOptions: {
|
|
181
|
+
month: "long",
|
|
182
|
+
year: "numeric"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
..._.map((e) => ({
|
|
186
|
+
name: `time-${e}`,
|
|
187
|
+
intlOptions: le(e),
|
|
188
|
+
durationPattern: e === "short" ? "HH:mm" : "HH:mm:ss"
|
|
189
|
+
})),
|
|
190
|
+
..._.map((e) => ({
|
|
191
|
+
name: `datetime-${e}`,
|
|
192
|
+
intlDateOptions: se(e),
|
|
193
|
+
intlTimeOptions: le(e),
|
|
194
|
+
intlJoiner: ", "
|
|
195
|
+
})),
|
|
196
|
+
{
|
|
197
|
+
name: y.odataDate,
|
|
198
|
+
pattern: "yyyy-MM-dd"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: y.odataDatetime,
|
|
202
|
+
pattern: "yyyy-MM-ddTHH:mm:ss"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: y.abapDatetime,
|
|
206
|
+
pattern: "yyyyMMddHHmmss"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: y.abapDate,
|
|
210
|
+
pattern: "yyyyMMdd"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: y.abapMonth,
|
|
214
|
+
pattern: "yyyyMM"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: y.abapYear,
|
|
218
|
+
pattern: "yyyy"
|
|
219
|
+
}
|
|
220
|
+
], oe = /* @__PURE__ */ new Map([[y.monthYearMedium, "short"], [y.monthYearLong, "long"]]), b = /* @__PURE__ */ new Map();
|
|
221
|
+
function x(e, t = 2) {
|
|
222
|
+
return String(e).padStart(t, "0");
|
|
223
|
+
}
|
|
224
|
+
function se(e, t = "day") {
|
|
225
|
+
return t === "year" ? { year: "numeric" } : t === "month" ? e === "short" ? {
|
|
226
|
+
month: "2-digit",
|
|
227
|
+
year: "numeric"
|
|
228
|
+
} : e === "medium" ? {
|
|
229
|
+
month: "short",
|
|
230
|
+
year: "numeric"
|
|
231
|
+
} : {
|
|
232
|
+
month: "long",
|
|
233
|
+
year: "numeric"
|
|
234
|
+
} : e === "short" ? {
|
|
235
|
+
day: "2-digit",
|
|
236
|
+
month: "2-digit",
|
|
237
|
+
year: "numeric"
|
|
238
|
+
} : e === "medium" ? {
|
|
239
|
+
day: "numeric",
|
|
240
|
+
month: "short",
|
|
241
|
+
year: "numeric"
|
|
242
|
+
} : {
|
|
243
|
+
day: "numeric",
|
|
244
|
+
month: "long",
|
|
245
|
+
year: "numeric"
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function ce(e) {
|
|
249
|
+
return e === "short" ? {
|
|
250
|
+
day: "2-digit",
|
|
251
|
+
month: "2-digit"
|
|
252
|
+
} : e === "medium" ? {
|
|
253
|
+
day: "numeric",
|
|
254
|
+
month: "short"
|
|
255
|
+
} : {
|
|
256
|
+
day: "numeric",
|
|
257
|
+
month: "long"
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function le(e) {
|
|
261
|
+
return e === "short" ? {
|
|
262
|
+
hour: "2-digit",
|
|
263
|
+
minute: "2-digit",
|
|
264
|
+
hourCycle: "h23"
|
|
265
|
+
} : {
|
|
266
|
+
hour: "2-digit",
|
|
267
|
+
minute: "2-digit",
|
|
268
|
+
second: "2-digit",
|
|
269
|
+
hourCycle: "h23"
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function ue(e) {
|
|
273
|
+
let { timeZone: t, timeZoneName: n, ...r } = e;
|
|
274
|
+
return r;
|
|
275
|
+
}
|
|
276
|
+
function de(e) {
|
|
277
|
+
return !!(e.dateStyle || e.year || e.month || e.day);
|
|
278
|
+
}
|
|
279
|
+
function fe(e, t) {
|
|
280
|
+
let n = ue(e);
|
|
281
|
+
return t === "day" || !de(n) ? n : n.dateStyle ? se(n.dateStyle === "short" || n.dateStyle === "medium" ? n.dateStyle : "long", t) : t === "year" ? { year: n.year ?? "numeric" } : {
|
|
282
|
+
month: n.month ?? "2-digit",
|
|
283
|
+
year: n.year ?? "numeric"
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function pe(e, t) {
|
|
287
|
+
let n = ue(t), r = /* @__PURE__ */ new Map();
|
|
288
|
+
if (n.timeStyle) {
|
|
289
|
+
let t = le(n.timeStyle === "short" ? "short" : "medium");
|
|
290
|
+
if (n.dateStyle) {
|
|
291
|
+
let i = new Intl.DateTimeFormat(e, { dateStyle: n.dateStyle }), a = new Intl.DateTimeFormat(e, t);
|
|
292
|
+
return (t, o = "day") => {
|
|
293
|
+
if (o === "day") return `${i.format(t)}, ${a.format(t)}`;
|
|
294
|
+
let s = fe({ dateStyle: n.dateStyle }, o), c = r.get(o);
|
|
295
|
+
return c || (c = new Intl.DateTimeFormat(e, s), r.set(o, c)), c.format(t);
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
return new Intl.DateTimeFormat(e, t).format;
|
|
299
|
+
}
|
|
300
|
+
let i = new Intl.DateTimeFormat(e, n);
|
|
301
|
+
return (t, a = "day") => {
|
|
302
|
+
if (a === "day") return i.format(t);
|
|
303
|
+
let o = r.get(a);
|
|
304
|
+
return o || (o = new Intl.DateTimeFormat(e, fe(n, a)), r.set(a, o)), o.format(t);
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function me(e, t) {
|
|
308
|
+
let n = String(t.getFullYear());
|
|
309
|
+
switch (e) {
|
|
310
|
+
case "yyyy": return n;
|
|
311
|
+
case "yy": return n.slice(-2);
|
|
312
|
+
case "MM": return x(t.getMonth() + 1);
|
|
313
|
+
case "dd": return x(t.getDate());
|
|
314
|
+
case "HH": return x(t.getHours());
|
|
315
|
+
case "mm": return x(t.getMinutes());
|
|
316
|
+
case "ss": return x(t.getSeconds());
|
|
317
|
+
default: return e;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function he(e) {
|
|
321
|
+
switch (e) {
|
|
322
|
+
case "yyyyMMdd": return (e) => `${e.getFullYear()}${x(e.getMonth() + 1)}${x(e.getDate())}`;
|
|
323
|
+
case "yyyyMMddHHmmss": return (e) => `${e.getFullYear()}${x(e.getMonth() + 1)}${x(e.getDate())}${x(e.getHours())}${x(e.getMinutes())}${x(e.getSeconds())}`;
|
|
324
|
+
case "yyyy-MM-dd": return (e) => `${e.getFullYear()}-${x(e.getMonth() + 1)}-${x(e.getDate())}`;
|
|
325
|
+
case "yyyy-MM-ddTHH:mm:ss": return (e) => `${e.getFullYear()}-${x(e.getMonth() + 1)}-${x(e.getDate())}T${x(e.getHours())}:${x(e.getMinutes())}:${x(e.getSeconds())}`;
|
|
326
|
+
default: return _e(e);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function ge(e) {
|
|
330
|
+
let t = /* @__PURE__ */ new Map();
|
|
331
|
+
return (n, r = "day") => {
|
|
332
|
+
let i = t.get(r);
|
|
333
|
+
return i || (i = he(h(e, r)), t.set(r, i)), i(n, "day");
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function _e(e) {
|
|
337
|
+
let t = [], n = 0, r;
|
|
338
|
+
for (u.lastIndex = 0; r = u.exec(e);) r.index > n && t.push(e.slice(n, r.index)), t.push(r[0]), n = r.index + r[0].length;
|
|
339
|
+
return n < e.length && t.push(e.slice(n)), (e) => {
|
|
340
|
+
let n = "";
|
|
341
|
+
for (let r of t) n += p(r) ? me(r, e) : r;
|
|
342
|
+
return n;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function ve(e, t, n) {
|
|
346
|
+
if (m(t, s) || !m(t, c)) return n;
|
|
347
|
+
let r = e < 0 ? "-" : "", i = Math.trunc(Math.abs(e) / 1e3), a = Math.trunc(i / 3600), o = Math.trunc(i % 3600 / 60), l = i % 60;
|
|
348
|
+
return t === "HH:mm" ? `${r}${x(a)}:${x(o)}` : t === "HH:mm:ss" ? `${r}${x(a)}:${x(o)}:${x(l)}` : r + t.replaceAll("HH", x(a)).replaceAll("mm", x(o)).replaceAll("ss", x(l));
|
|
349
|
+
}
|
|
350
|
+
function ye(e) {
|
|
351
|
+
let t = {
|
|
352
|
+
...v,
|
|
353
|
+
...e
|
|
354
|
+
}, n = be(t), r = t.durationPattern ?? t.pattern, i = {
|
|
355
|
+
...t,
|
|
356
|
+
formatDateTime: n
|
|
357
|
+
};
|
|
358
|
+
return r && (i.formatDuration = (e, t) => ve(e, r, t)), i;
|
|
359
|
+
}
|
|
360
|
+
function be(e) {
|
|
361
|
+
if (e.pattern) return ge(e.pattern);
|
|
362
|
+
if (e.intlDateOptions && e.intlTimeOptions) {
|
|
363
|
+
let t = pe(e.locale, e.intlDateOptions), n = pe(e.locale, e.intlTimeOptions), r = e.intlJoiner ?? " ";
|
|
364
|
+
return (e, i = "day") => i === "day" ? `${t(e)}${r}${n(e)}` : t(e, i);
|
|
365
|
+
}
|
|
366
|
+
return pe(e.locale, e.intlOptions ?? v.intlOptions);
|
|
367
|
+
}
|
|
368
|
+
function xe(e, t) {
|
|
369
|
+
let n = new Intl.DateTimeFormat(e, t === "short" ? {
|
|
370
|
+
day: "numeric",
|
|
371
|
+
month: t,
|
|
372
|
+
year: "numeric"
|
|
373
|
+
} : {
|
|
374
|
+
month: t,
|
|
375
|
+
year: "numeric"
|
|
376
|
+
}), r = new Intl.DateTimeFormat(e, { month: "long" }), i = new Intl.DateTimeFormat(e, { year: "numeric" });
|
|
377
|
+
return (e, a = "day") => {
|
|
378
|
+
let o = (a === "year" ? i : n).formatToParts(e), s = o.find((e) => e.type === "year")?.value ?? "";
|
|
379
|
+
if (a === "year") return s;
|
|
380
|
+
let c = o.find((e) => e.type === "month")?.value ?? "";
|
|
381
|
+
return `${t === "short" && !c.endsWith(".") ? r.formatToParts(e).find((e) => e.type === "month")?.value ?? c : c} ${s}`;
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function Se(e) {
|
|
385
|
+
let t = ye(e), n = oe.get(e.name);
|
|
386
|
+
return n ? {
|
|
387
|
+
...t,
|
|
388
|
+
formatDateTime: xe(t.locale, n)
|
|
389
|
+
} : t;
|
|
390
|
+
}
|
|
391
|
+
function Ce() {
|
|
392
|
+
for (let e of ae) b.set(e.name, Se(e));
|
|
393
|
+
}
|
|
394
|
+
Ce();
|
|
395
|
+
function S(e) {
|
|
396
|
+
return b.get(e);
|
|
397
|
+
}
|
|
398
|
+
function we(e) {
|
|
399
|
+
return b.get(e);
|
|
400
|
+
}
|
|
401
|
+
function Te() {
|
|
402
|
+
return Array.from(b.keys());
|
|
403
|
+
}
|
|
404
|
+
function Ee(e) {
|
|
405
|
+
return _.includes(e);
|
|
406
|
+
}
|
|
407
|
+
function De(e) {
|
|
408
|
+
return ne.includes(e);
|
|
409
|
+
}
|
|
410
|
+
function Oe(e, t = y.date) {
|
|
411
|
+
let n = e?.trim();
|
|
412
|
+
return n ? Ee(n) ? re[n] : n : t;
|
|
413
|
+
}
|
|
414
|
+
function ke(e, t, n, r) {
|
|
415
|
+
let i = `${t}\u0000${n}\u0000${r}\u0000${e}`, a = ie.get(i);
|
|
416
|
+
if (a) return a;
|
|
417
|
+
let o = {
|
|
418
|
+
name: `${t}:${e}`,
|
|
419
|
+
pattern: e,
|
|
420
|
+
locale: n,
|
|
421
|
+
invalidFallback: r
|
|
422
|
+
};
|
|
423
|
+
return ie.set(i, o), o;
|
|
424
|
+
}
|
|
425
|
+
function Ae(e, { defaultFormat: t = y.date, patternPresetName: n = "__date_pattern__", locale: r = g, invalidFallback: i = "" } = {}) {
|
|
426
|
+
let a = Oe(e, t);
|
|
427
|
+
return S(a) ? a : ke(a, n, r, i);
|
|
428
|
+
}
|
|
429
|
+
function je(e) {
|
|
430
|
+
let t = ye(e);
|
|
431
|
+
return b.set(t.name, t), t;
|
|
432
|
+
}
|
|
433
|
+
function Me() {
|
|
434
|
+
b.clear(), Ce();
|
|
435
|
+
}
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/formatters/date/parseDate.ts
|
|
438
|
+
var Ne = /^\/Date\((-?\d+)([+-]\d{4})?\)\/$/, Pe = /^(datetimeoffset|datetime)'(.+)'$/i, Fe = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2})(?::(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?)?)?$/, Ie = /(Z|([+-])(\d{2}):?(\d{2}))$/i, Le = /^\d{8}$/, Re = /^\d{14,}$/, ze = /^(\d{2})\.(\d{2})\.(\d{4})$/, Be = /^(\d{2})\/(\d{2})\/(\d{4})$/, Ve = /^([+-])?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)(?:\.(\d+))?S)?)?$/, He = /* @__PURE__ */ new Set([
|
|
439
|
+
"",
|
|
440
|
+
"null",
|
|
441
|
+
"undefined"
|
|
442
|
+
]), Ue = 1e3, We = 6e4, Ge = 36e5, Ke = 864e5, qe = 30, Je = 365, Ye = 70, C = "floating", Xe = Object.freeze({
|
|
443
|
+
[y.date]: Object.freeze(["dd.MM.yyyy"]),
|
|
444
|
+
[y.dateShort]: Object.freeze(["dd.MM.yyyy"]),
|
|
445
|
+
[y.datetime]: Object.freeze(["dd.MM.yyyy HH:mm"]),
|
|
446
|
+
[y.datetimeSeconds]: Object.freeze(["dd.MM.yyyy HH:mm:ss"]),
|
|
447
|
+
[y.datetimeShort]: Object.freeze(["dd.MM.yyyy, HH:mm"])
|
|
448
|
+
}), Ze = /^(\d{1,2})\s+([\p{L}.]+)\s+(\d{4})(?:\s*[\p{L}.]+)?(?:,?\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/iu, Qe = /^(\d{1,2})\.(\d{1,2})$/u, $e = /^(\d{1,2})\s+([\p{L}.]+)$/iu, et = /^([\p{L}.]+)\s+(\d{4})(?:\s*[\p{L}.]+)?$/iu, tt = /^(\d{4})(?:\s*[\p{L}.]+)?$/iu, nt = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Set([
|
|
449
|
+
y.monthShort,
|
|
450
|
+
y.monthMedium,
|
|
451
|
+
y.monthLong
|
|
452
|
+
]), it = /* @__PURE__ */ new Set([y.monthYearMedium, y.monthYearLong]);
|
|
453
|
+
function w(e, t, n, r = 0, i = 0, a = 0, o = 0) {
|
|
454
|
+
let s = new Date(e, t - 1, n, r, i, a, o);
|
|
455
|
+
return s.getFullYear() === e && s.getMonth() === t - 1 && s.getDate() === n && s.getHours() === r && s.getMinutes() === i && s.getSeconds() === a ? s : null;
|
|
456
|
+
}
|
|
457
|
+
function T(e, t) {
|
|
458
|
+
return e.toLocaleLowerCase(t).replace(/\.$/, "");
|
|
459
|
+
}
|
|
460
|
+
function at(e, t, n, r) {
|
|
461
|
+
e.set(T(t, r), n);
|
|
462
|
+
}
|
|
463
|
+
function ot(e, t, n, r, i) {
|
|
464
|
+
let a = t.formatToParts(n).find((e) => e.type === "month");
|
|
465
|
+
a && at(e, a.value, r, i);
|
|
466
|
+
}
|
|
467
|
+
function st(e) {
|
|
468
|
+
let t = nt.get(e);
|
|
469
|
+
if (t) return t;
|
|
470
|
+
let n = /* @__PURE__ */ new Map(), r = new Intl.DateTimeFormat(e, { month: "short" }), i = new Intl.DateTimeFormat(e, { month: "long" }), a = new Intl.DateTimeFormat(e, {
|
|
471
|
+
day: "numeric",
|
|
472
|
+
month: "short",
|
|
473
|
+
year: "numeric"
|
|
474
|
+
}), o = new Intl.DateTimeFormat(e, {
|
|
475
|
+
day: "numeric",
|
|
476
|
+
month: "long",
|
|
477
|
+
year: "numeric"
|
|
478
|
+
});
|
|
479
|
+
for (let t = 0; t < 12; t += 1) {
|
|
480
|
+
let s = new Date(2026, t, 1);
|
|
481
|
+
at(n, r.format(s), t, e), at(n, i.format(s), t, e), ot(n, a, s, t, e), ot(n, o, s, t, e);
|
|
482
|
+
}
|
|
483
|
+
return nt.set(e, n), n;
|
|
484
|
+
}
|
|
485
|
+
function ct(e, t) {
|
|
486
|
+
let n = Ze.exec(e.trim());
|
|
487
|
+
if (!n) return null;
|
|
488
|
+
let r = Number(n[1]), i = st(t).get(T(n[2], t)), a = Number(n[3]), o = Number(n[4] ?? 0), s = Number(n[5] ?? 0), c = Number(n[6] ?? 0);
|
|
489
|
+
if (i === void 0 || !Number.isFinite(r) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c)) return null;
|
|
490
|
+
let l = w(a, i + 1, r, o, s, c);
|
|
491
|
+
return l ? D(l, "iso-local") : null;
|
|
492
|
+
}
|
|
493
|
+
function lt(e, t, n) {
|
|
494
|
+
let r = Qe.exec(e.trim());
|
|
495
|
+
if (r) {
|
|
496
|
+
let e = Number(r[1]), t = w(n, Number(r[2]), e);
|
|
497
|
+
return t ? D(t, "iso-local") : null;
|
|
498
|
+
}
|
|
499
|
+
let i = $e.exec(e.trim());
|
|
500
|
+
if (!i) return null;
|
|
501
|
+
let a = Number(i[1]), o = st(t).get(T(i[2], t));
|
|
502
|
+
if (o === void 0 || !Number.isFinite(a)) return null;
|
|
503
|
+
let s = w(n, o + 1, a);
|
|
504
|
+
return s ? D(s, "iso-local") : null;
|
|
505
|
+
}
|
|
506
|
+
function ut(e, t) {
|
|
507
|
+
let n = et.exec(e.trim());
|
|
508
|
+
if (!n) return null;
|
|
509
|
+
let r = st(t).get(T(n[1], t)), i = Number(n[2]);
|
|
510
|
+
if (r === void 0 || !Number.isFinite(i)) return null;
|
|
511
|
+
let a = w(i, r + 1, 1);
|
|
512
|
+
return a ? D(a, "iso-local") : null;
|
|
513
|
+
}
|
|
514
|
+
function dt(e) {
|
|
515
|
+
let t = tt.exec(e.trim());
|
|
516
|
+
if (!t) return null;
|
|
517
|
+
let n = Number(t[1]);
|
|
518
|
+
if (!Number.isFinite(n)) return null;
|
|
519
|
+
let r = w(n, 1, 1);
|
|
520
|
+
return r ? D(r, "iso-local") : null;
|
|
521
|
+
}
|
|
522
|
+
function ft(e, t, n) {
|
|
523
|
+
return n === "year" ? dt(e) : n === "month" ? ut(e, t) : ct(e, t);
|
|
524
|
+
}
|
|
525
|
+
function pt(e) {
|
|
526
|
+
return rt.has(e);
|
|
527
|
+
}
|
|
528
|
+
function mt(e) {
|
|
529
|
+
return it.has(e);
|
|
530
|
+
}
|
|
531
|
+
function ht(e) {
|
|
532
|
+
return e instanceof Date && !Number.isNaN(e.getTime()) ? e.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear();
|
|
533
|
+
}
|
|
534
|
+
function gt(e) {
|
|
535
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds());
|
|
536
|
+
}
|
|
537
|
+
function E(e) {
|
|
538
|
+
return new Date(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes(), e.getUTCSeconds(), e.getUTCMilliseconds());
|
|
539
|
+
}
|
|
540
|
+
function D(e, t) {
|
|
541
|
+
return {
|
|
542
|
+
kind: "date-time",
|
|
543
|
+
source: t,
|
|
544
|
+
date: e
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
function _t(e, t = C) {
|
|
548
|
+
if (!Number.isFinite(e)) return null;
|
|
549
|
+
let n = Math.abs(e) < 0xe8d4a51000 ? e * 1e3 : e, r = new Date(n);
|
|
550
|
+
return Number.isNaN(r.getTime()) ? null : D(t === "instant" ? r : E(r), "timestamp");
|
|
551
|
+
}
|
|
552
|
+
function vt(e, t = C) {
|
|
553
|
+
let n = Ne.exec(e);
|
|
554
|
+
if (!n) return null;
|
|
555
|
+
let r = Number(n[1]);
|
|
556
|
+
if (!Number.isFinite(r)) return null;
|
|
557
|
+
if (t === "instant") {
|
|
558
|
+
let e = new Date(r);
|
|
559
|
+
return Number.isNaN(e.getTime()) ? null : D(e, "odata-ticks");
|
|
560
|
+
}
|
|
561
|
+
let i = n[2];
|
|
562
|
+
if (!i) return D(E(new Date(r)), "odata-ticks");
|
|
563
|
+
let a = i.startsWith("-") ? -1 : 1, o = Number(i.slice(1, 3)), s = Number(i.slice(3, 5));
|
|
564
|
+
if (!Number.isFinite(o) || !Number.isFinite(s)) return null;
|
|
565
|
+
let c = a * (o * Ge + s * We);
|
|
566
|
+
return D(E(new Date(r + c)), "odata-ticks");
|
|
567
|
+
}
|
|
568
|
+
function yt(e) {
|
|
569
|
+
let t = Fe.exec(e);
|
|
570
|
+
if (!t) return null;
|
|
571
|
+
let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]), a = Number(t[4] ?? 0), o = Number(t[5] ?? 0), s = Number(t[6] ?? 0), c = (t[7] ?? "").slice(0, 3).padEnd(3, "0"), l = w(n, r, i, a, o, s, Number(c || 0));
|
|
572
|
+
return l ? D(l, "iso-local") : null;
|
|
573
|
+
}
|
|
574
|
+
function bt(e) {
|
|
575
|
+
if (e[1].toUpperCase() === "Z") return 0;
|
|
576
|
+
let t = e[2] === "-" ? -1 : 1, n = Number(e[3]), r = Number(e[4]);
|
|
577
|
+
return !Number.isFinite(n) || !Number.isFinite(r) || n > 23 || r > 59 ? null : t * (n * Ge + r * We);
|
|
578
|
+
}
|
|
579
|
+
function xt(e, t = C) {
|
|
580
|
+
let n = Ie.exec(e);
|
|
581
|
+
if (!n) return null;
|
|
582
|
+
let r = yt(e.slice(0, n.index));
|
|
583
|
+
if (!r) return null;
|
|
584
|
+
if (t === "floating") return D(r.date, "iso-zoned");
|
|
585
|
+
let i = bt(n);
|
|
586
|
+
if (i === null) return null;
|
|
587
|
+
let a = r.date, o = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds(), a.getMilliseconds()) - i, s = new Date(o);
|
|
588
|
+
return Number.isNaN(s.getTime()) ? null : D(s, "iso-zoned");
|
|
589
|
+
}
|
|
590
|
+
function St(e) {
|
|
591
|
+
if (!Le.test(e)) return null;
|
|
592
|
+
let t = w(Number(e.slice(0, 4)), Number(e.slice(4, 6)), Number(e.slice(6, 8)));
|
|
593
|
+
return t ? D(t, "abap-compact") : null;
|
|
594
|
+
}
|
|
595
|
+
function Ct(e) {
|
|
596
|
+
if (!Re.test(e)) return null;
|
|
597
|
+
let t = w(Number(e.slice(0, 4)), Number(e.slice(4, 6)), Number(e.slice(6, 8)), Number(e.slice(8, 10)), Number(e.slice(10, 12)), Number(e.slice(12, 14)));
|
|
598
|
+
return t ? D(t, "abap-timestamp") : null;
|
|
599
|
+
}
|
|
600
|
+
function wt(e) {
|
|
601
|
+
let t = ze.exec(e);
|
|
602
|
+
if (!t) return null;
|
|
603
|
+
let n = Number(t[1]), r = Number(t[2]), i = w(Number(t[3]), r, n);
|
|
604
|
+
return i ? D(i, "abap-dotted") : null;
|
|
605
|
+
}
|
|
606
|
+
function Tt(e) {
|
|
607
|
+
let t = Be.exec(e);
|
|
608
|
+
if (!t) return null;
|
|
609
|
+
let n = Number(t[1]), r = Number(t[2]), i = w(Number(t[3]), n, r);
|
|
610
|
+
return i ? D(i, "slash-date") : null;
|
|
611
|
+
}
|
|
612
|
+
function Et(e, t = C) {
|
|
613
|
+
let n = Pe.exec(e);
|
|
614
|
+
return n ? Ot(n[2].trim(), "odata-literal", t) : null;
|
|
615
|
+
}
|
|
616
|
+
function Dt(e) {
|
|
617
|
+
let t = Ve.exec(e);
|
|
618
|
+
if (!t) return null;
|
|
619
|
+
let n = t[1] === "-" ? -1 : 1, r = Number(t[2] ?? 0), i = Number(t[3] ?? 0), a = Number(t[4] ?? 0), o = Number(t[5] ?? 0), s = Number(t[6] ?? 0), c = Number(t[7] ?? 0), l = (t[8] ?? "").slice(0, 3).padEnd(3, "0"), u = Number(l || 0);
|
|
620
|
+
return r || i || a || o || s || c || u ? {
|
|
621
|
+
kind: "duration",
|
|
622
|
+
source: "iso-duration",
|
|
623
|
+
durationMs: n * (r * Je * Ke + i * qe * Ke + a * Ke + o * Ge + s * We + c * Ue + u)
|
|
624
|
+
} : null;
|
|
625
|
+
}
|
|
626
|
+
function O(e, t) {
|
|
627
|
+
return t ? {
|
|
628
|
+
...e,
|
|
629
|
+
source: t
|
|
630
|
+
} : e;
|
|
631
|
+
}
|
|
632
|
+
function Ot(e, t, n = C) {
|
|
633
|
+
let r = xt(e, n);
|
|
634
|
+
if (r) return O(r, t);
|
|
635
|
+
let i = yt(e);
|
|
636
|
+
if (i) return O(i, t);
|
|
637
|
+
let a = wt(e);
|
|
638
|
+
if (a) return O(a, t);
|
|
639
|
+
let o = Tt(e);
|
|
640
|
+
if (o) return O(o, t);
|
|
641
|
+
let s = Ct(e);
|
|
642
|
+
if (s) return O(s, t);
|
|
643
|
+
let c = St(e);
|
|
644
|
+
if (c) return O(c, t);
|
|
645
|
+
let l = Number(e);
|
|
646
|
+
if (/^-?\d+$/.test(e) && Number.isFinite(l)) {
|
|
647
|
+
let e = _t(l, n);
|
|
648
|
+
if (e) return O(e, t);
|
|
649
|
+
}
|
|
650
|
+
return null;
|
|
651
|
+
}
|
|
652
|
+
function kt(e) {
|
|
653
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
654
|
+
}
|
|
655
|
+
function At(e) {
|
|
656
|
+
return e < Ye ? 2e3 + e : 1900 + e;
|
|
657
|
+
}
|
|
658
|
+
function jt(e, t = "dd.MM.yyyy", n = {}) {
|
|
659
|
+
if (typeof e != "string") return k(e);
|
|
660
|
+
let r = e.trim();
|
|
661
|
+
if (He.has(r.toLowerCase())) return null;
|
|
662
|
+
let i = n.precision ?? "day", a = h(t, i), o = [], s = 0, c = "^", l = null;
|
|
663
|
+
for (u.lastIndex = 0; (l = u.exec(a)) !== null;) c += kt(a.slice(s, l.index)), o.push(l[0]), l[0] === "yyyy" ? c += "(\\d{4})" : c += "(\\d{2})", s = l.index + l[0].length;
|
|
664
|
+
if (o.length === 0) return null;
|
|
665
|
+
c += `${kt(a.slice(s))}$`;
|
|
666
|
+
let d = new RegExp(c).exec(r);
|
|
667
|
+
if (!d) return null;
|
|
668
|
+
let f = null, p = null, m = null, ee = 0, te = 0, g = 0;
|
|
669
|
+
for (let e = 0; e < o.length; e += 1) {
|
|
670
|
+
let t = o[e], n = d[e + 1], r = Number(n);
|
|
671
|
+
if (!Number.isFinite(r)) return null;
|
|
672
|
+
t === "yyyy" && (f = r), t === "yy" && (f = At(r)), t === "MM" && (p = r), t === "dd" && (m = r), t === "HH" && (ee = r), t === "mm" && (te = r), t === "ss" && (g = r);
|
|
673
|
+
}
|
|
674
|
+
if (!f || i !== "year" && !p || i === "day" && !m) return null;
|
|
675
|
+
let _ = w(f, p ?? 1, m ?? 1, ee, te, g);
|
|
676
|
+
return _ ? D(_, "iso-local") : null;
|
|
677
|
+
}
|
|
678
|
+
function Mt(e, t) {
|
|
679
|
+
let n = S(e), r = Xe[e];
|
|
680
|
+
return n?.pattern ? [h(n.pattern, t)] : r ? r.map((e) => h(e, t)) : !n && ee(e) ? [h(e, t)] : [];
|
|
681
|
+
}
|
|
682
|
+
function Nt(e, t, n = {}) {
|
|
683
|
+
if (typeof e != "string") {
|
|
684
|
+
let t = k(e);
|
|
685
|
+
return t?.kind === "date-time" ? t : null;
|
|
686
|
+
}
|
|
687
|
+
let r = e.trim();
|
|
688
|
+
if (He.has(r.toLowerCase())) return null;
|
|
689
|
+
let i = n.precision ?? "day", a = Oe(t, n.defaultFormat ?? y.date);
|
|
690
|
+
for (let e of Mt(a, i)) {
|
|
691
|
+
let t = jt(r, e, { precision: i });
|
|
692
|
+
if (t?.kind === "date-time") return t;
|
|
693
|
+
}
|
|
694
|
+
if (i === "day") {
|
|
695
|
+
let e = k(r);
|
|
696
|
+
if (e?.kind === "date-time") return e;
|
|
697
|
+
}
|
|
698
|
+
let o = S(a)?.locale ?? n.locale ?? v.locale;
|
|
699
|
+
if (i === "day" && pt(a)) {
|
|
700
|
+
let e = lt(r, o, ht(n.referenceDate));
|
|
701
|
+
if (e) return e;
|
|
702
|
+
}
|
|
703
|
+
return i !== "year" && mt(a) ? ut(r, o) : ft(r, o, i);
|
|
704
|
+
}
|
|
705
|
+
function Pt(e, { mode: t = C } = {}) {
|
|
706
|
+
if (e == null) return null;
|
|
707
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : D(t === "instant" ? new Date(e.getTime()) : gt(e), "date-object");
|
|
708
|
+
if (typeof e == "number") return _t(e, t);
|
|
709
|
+
if (typeof e != "string") return null;
|
|
710
|
+
let n = e.trim();
|
|
711
|
+
return He.has(n.toLowerCase()) ? null : vt(n, t) || Et(n, t) || Dt(n) || Ot(n, void 0, t);
|
|
712
|
+
}
|
|
713
|
+
function k(e) {
|
|
714
|
+
return Pt(e);
|
|
715
|
+
}
|
|
716
|
+
function Ft(e) {
|
|
717
|
+
return Pt(e, { mode: "instant" });
|
|
718
|
+
}
|
|
719
|
+
function It(e) {
|
|
720
|
+
if (!e) return null;
|
|
721
|
+
if (e.kind === "date-time") return e.date;
|
|
722
|
+
let t = new Date(e.durationMs);
|
|
723
|
+
return Number.isNaN(t.getTime()) ? null : E(t);
|
|
724
|
+
}
|
|
725
|
+
function Lt(e) {
|
|
726
|
+
return It(k(e));
|
|
727
|
+
}
|
|
728
|
+
function Rt(e) {
|
|
729
|
+
return It(Ft(e));
|
|
730
|
+
}
|
|
731
|
+
//#endregion
|
|
732
|
+
//#region src/formatters/date/formatDate.ts
|
|
733
|
+
var zt = /* @__PURE__ */ new WeakMap();
|
|
734
|
+
function Bt(e) {
|
|
735
|
+
return String(e).padStart(2, "0");
|
|
736
|
+
}
|
|
737
|
+
function Vt(e) {
|
|
738
|
+
if (typeof e != "string") {
|
|
739
|
+
let t = zt.get(e);
|
|
740
|
+
if (t) return t;
|
|
741
|
+
let n = ye(e);
|
|
742
|
+
return zt.set(e, n), n;
|
|
743
|
+
}
|
|
744
|
+
let t = we(e);
|
|
745
|
+
if (!t) throw Error(`Предустановка даты "${e}" не найдена`);
|
|
746
|
+
return t;
|
|
747
|
+
}
|
|
748
|
+
function Ht(e, t) {
|
|
749
|
+
return t?.fallback ?? e.invalidFallback;
|
|
750
|
+
}
|
|
751
|
+
function Ut(e, t, n, r) {
|
|
752
|
+
return e.kind === "duration" ? t.formatDuration ? t.formatDuration(e.durationMs, n) : n : t.formatDateTime(e.date, r);
|
|
753
|
+
}
|
|
754
|
+
function A(e, t = y.date, n) {
|
|
755
|
+
let r = Vt(t), i = Ht(r, n), a = n?.precision ?? "day", o = k(e);
|
|
756
|
+
return o ? Ut(o, r, i, a) : i;
|
|
757
|
+
}
|
|
758
|
+
function Wt(e, t) {
|
|
759
|
+
return A(e, y.date, t);
|
|
760
|
+
}
|
|
761
|
+
function Gt(e, t) {
|
|
762
|
+
return A(e, y.datetime, t);
|
|
763
|
+
}
|
|
764
|
+
function Kt(e, t) {
|
|
765
|
+
return A(e, y.time, t);
|
|
766
|
+
}
|
|
767
|
+
function qt(e, t) {
|
|
768
|
+
return A(e, y.timeSeconds, t);
|
|
769
|
+
}
|
|
770
|
+
function Jt(e, t) {
|
|
771
|
+
return A(e, y.dateShort, t);
|
|
772
|
+
}
|
|
773
|
+
function Yt(e, t) {
|
|
774
|
+
return A(e, y.dateMedium, t);
|
|
775
|
+
}
|
|
776
|
+
function Xt(e, t) {
|
|
777
|
+
return A(e, y.dateLong, t);
|
|
778
|
+
}
|
|
779
|
+
function Zt(e, t) {
|
|
780
|
+
return A(e, y.monthShort, t);
|
|
781
|
+
}
|
|
782
|
+
function Qt(e, t) {
|
|
783
|
+
return A(e, y.monthMedium, t);
|
|
784
|
+
}
|
|
785
|
+
function $t(e, t) {
|
|
786
|
+
return A(e, y.monthLong, t);
|
|
787
|
+
}
|
|
788
|
+
function en(e, t) {
|
|
789
|
+
return A(e, y.monthYearMedium, t);
|
|
790
|
+
}
|
|
791
|
+
function tn(e, t) {
|
|
792
|
+
return A(e, y.monthYearLong, t);
|
|
793
|
+
}
|
|
794
|
+
function nn(e, t) {
|
|
795
|
+
return A(e, y.timeShort, t);
|
|
796
|
+
}
|
|
797
|
+
function rn(e, t) {
|
|
798
|
+
return A(e, y.timeMedium, t);
|
|
799
|
+
}
|
|
800
|
+
function an(e, t) {
|
|
801
|
+
return A(e, y.timeLong, t);
|
|
802
|
+
}
|
|
803
|
+
function on(e, t) {
|
|
804
|
+
return A(e, y.datetimeShort, t);
|
|
805
|
+
}
|
|
806
|
+
function sn(e, t) {
|
|
807
|
+
return A(e, y.datetimeMedium, t);
|
|
808
|
+
}
|
|
809
|
+
function cn(e, t) {
|
|
810
|
+
return A(e, y.datetimeLong, t);
|
|
811
|
+
}
|
|
812
|
+
function ln(e, t, n = y.date, r) {
|
|
813
|
+
let i = Vt(n), a = Ht(i, r), o = r?.precision ?? "day", s = k(e), c = k(t);
|
|
814
|
+
if (!s || !c) return a;
|
|
815
|
+
let l = Ut(s, i, a, o), u = Ut(c, i, a, o);
|
|
816
|
+
return !l || !u ? a : `${l} - ${u}`;
|
|
817
|
+
}
|
|
818
|
+
function un(e, t) {
|
|
819
|
+
return A(e, y.abapYear, t);
|
|
820
|
+
}
|
|
821
|
+
function dn(e, t) {
|
|
822
|
+
return A(e, y.abapMonth, t);
|
|
823
|
+
}
|
|
824
|
+
function fn(e, t) {
|
|
825
|
+
return A(e, y.abapDate, t);
|
|
826
|
+
}
|
|
827
|
+
function pn(e, t) {
|
|
828
|
+
return A(e, y.abapDatetime, t);
|
|
829
|
+
}
|
|
830
|
+
function mn(e, t) {
|
|
831
|
+
return A(e, y.odataDate, t);
|
|
832
|
+
}
|
|
833
|
+
function hn(e, t) {
|
|
834
|
+
return A(e, y.odataDatetime, t);
|
|
835
|
+
}
|
|
836
|
+
function gn(e, t) {
|
|
837
|
+
let n = t?.fallback ?? "", r = k(e);
|
|
838
|
+
if (!r) return n;
|
|
839
|
+
if (r.kind === "duration") {
|
|
840
|
+
let e = Vt(y.timeSeconds).formatDuration?.(r.durationMs, n) ?? n;
|
|
841
|
+
if (e === n) return n;
|
|
842
|
+
let [t = "00", i = "00", a = "00"] = e.split(":");
|
|
843
|
+
return `PT${t}H${i}M${a}S`;
|
|
844
|
+
}
|
|
845
|
+
let i = r.date;
|
|
846
|
+
return `PT${Bt(i.getHours())}H${Bt(i.getMinutes())}M${Bt(i.getSeconds())}S`;
|
|
847
|
+
}
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/formatters/number/parseNumber.ts
|
|
850
|
+
function _n(e) {
|
|
851
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
852
|
+
if (typeof e != "string") return;
|
|
853
|
+
let t = e.trim();
|
|
854
|
+
if (!t) return;
|
|
855
|
+
let n = Number(t);
|
|
856
|
+
if (Number.isFinite(n)) return n;
|
|
857
|
+
let r = "";
|
|
858
|
+
for (let e = 0; e < t.length; e++) {
|
|
859
|
+
let n = t.charCodeAt(e);
|
|
860
|
+
n !== 32 && n !== 160 && n !== 8239 && n !== 39 && (r += t[e]);
|
|
861
|
+
}
|
|
862
|
+
let i = r.indexOf(",") !== -1, a = r.indexOf(".") !== -1;
|
|
863
|
+
i && a ? r = r.replace(/,/g, "") : i && (r = r.replace(/,/g, "."));
|
|
864
|
+
let o = Number(r);
|
|
865
|
+
return Number.isFinite(o) ? o : void 0;
|
|
866
|
+
}
|
|
867
|
+
function vn(e) {
|
|
868
|
+
return _n(e) ?? 0;
|
|
869
|
+
}
|
|
870
|
+
function yn(e) {
|
|
871
|
+
let t = _n(e);
|
|
872
|
+
return t ? t > 0 : !1;
|
|
873
|
+
}
|
|
874
|
+
function bn(e) {
|
|
875
|
+
let t = _n(e);
|
|
876
|
+
if (!(t === void 0 || !Number.isInteger(t) || t <= 0)) return t;
|
|
877
|
+
}
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/odata-service/baseTypes.ts
|
|
880
|
+
var xn = Object.freeze([
|
|
881
|
+
"string",
|
|
882
|
+
"number",
|
|
883
|
+
"boolean",
|
|
884
|
+
"date"
|
|
885
|
+
]), Sn = new Set(xn), Cn = Object.freeze({
|
|
886
|
+
string: "строка",
|
|
887
|
+
number: "число",
|
|
888
|
+
boolean: "boolean",
|
|
889
|
+
date: "дата"
|
|
890
|
+
});
|
|
891
|
+
function wn(e) {
|
|
892
|
+
return typeof e == "string" && Sn.has(e);
|
|
893
|
+
}
|
|
894
|
+
function Tn(e) {
|
|
895
|
+
return Cn[e];
|
|
896
|
+
}
|
|
897
|
+
//#endregion
|
|
898
|
+
//#region src/odata-service/buildSeparatedArrays.ts
|
|
899
|
+
function En(e) {
|
|
900
|
+
let t = {};
|
|
901
|
+
return e.forEach((e) => {
|
|
902
|
+
t[e.codeKey] = [];
|
|
903
|
+
}), t;
|
|
904
|
+
}
|
|
905
|
+
function Dn(e, n, r = !0, i = !0) {
|
|
906
|
+
if (!e || e.length === 0) return En(n);
|
|
907
|
+
let a = /* @__PURE__ */ new Set(), o = e[0];
|
|
908
|
+
o && Object.keys(o).forEach((e) => {
|
|
909
|
+
a.add(e);
|
|
910
|
+
});
|
|
911
|
+
let s = n.filter((e) => a.has(e.codeKey) && a.has(e.textKey));
|
|
912
|
+
if (s.length === 0) return En(n);
|
|
913
|
+
let c = {}, l = /* @__PURE__ */ new Map();
|
|
914
|
+
for (let e of s) {
|
|
915
|
+
let t = e.codeKey;
|
|
916
|
+
l.set(t, {
|
|
917
|
+
codeKey: e.codeKey,
|
|
918
|
+
textKey: e.textKey,
|
|
919
|
+
uniqueSet: /* @__PURE__ */ new Set()
|
|
920
|
+
}), c[t] = [];
|
|
921
|
+
}
|
|
922
|
+
n.forEach((e) => {
|
|
923
|
+
let t = e.codeKey;
|
|
924
|
+
l.has(t) || (c[t] = []);
|
|
925
|
+
});
|
|
926
|
+
for (let t of e) for (let [e, n] of l) {
|
|
927
|
+
let { codeKey: i, textKey: a, uniqueSet: o } = n, s = String(t[i]), l = String(t[a]);
|
|
928
|
+
if (r && !l || s == null) continue;
|
|
929
|
+
let u = `${String(s)}|${String(l)}`;
|
|
930
|
+
o.has(u) || (o.add(u), c[e].push({
|
|
931
|
+
[i]: s,
|
|
932
|
+
[a]: l
|
|
933
|
+
}));
|
|
934
|
+
}
|
|
935
|
+
for (let [e, n] of l) {
|
|
936
|
+
let r = c[e];
|
|
937
|
+
if (r.length > 0) {
|
|
938
|
+
let e = i ? n.codeKey : n.textKey;
|
|
939
|
+
r.sort((n, r) => {
|
|
940
|
+
let i = n[e] || "", a = r[e] || "";
|
|
941
|
+
return t(String(i), String(a));
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
return c;
|
|
946
|
+
}
|
|
947
|
+
//#endregion
|
|
948
|
+
//#region src/odata-service/dateUtils.ts
|
|
949
|
+
var j = {
|
|
950
|
+
datetime(e) {
|
|
951
|
+
return `datetime'${hn(e)}'`;
|
|
952
|
+
},
|
|
953
|
+
datetimeOffset(e) {
|
|
954
|
+
return `datetimeoffset'${e.toISOString()}'`;
|
|
955
|
+
},
|
|
956
|
+
time(e) {
|
|
957
|
+
return `time'${gn(e)}'`;
|
|
958
|
+
}
|
|
959
|
+
}, M = {
|
|
960
|
+
string: n.string(),
|
|
961
|
+
guid: n.uuid().or(n.string().regex(/^[0-9a-fA-F-]+$/, "Invalid GUID")),
|
|
962
|
+
boolean: n.boolean(),
|
|
963
|
+
int: n.number().int(),
|
|
964
|
+
long: n.number().int(),
|
|
965
|
+
float: n.number(),
|
|
966
|
+
decimal: n.number(),
|
|
967
|
+
double: n.number(),
|
|
968
|
+
datetime: n.date(),
|
|
969
|
+
datetimeOffset: n.date(),
|
|
970
|
+
time: n.date(),
|
|
971
|
+
binary: n.string(),
|
|
972
|
+
byte: n.number().int().min(0).max(255)
|
|
973
|
+
};
|
|
974
|
+
function N(e, t) {
|
|
975
|
+
return t.safeParse(e).success;
|
|
976
|
+
}
|
|
977
|
+
function On(e) {
|
|
978
|
+
return N(e, M.string);
|
|
979
|
+
}
|
|
980
|
+
function kn(e) {
|
|
981
|
+
return N(e, M.float);
|
|
982
|
+
}
|
|
983
|
+
function An(e) {
|
|
984
|
+
return N(e, M.boolean);
|
|
985
|
+
}
|
|
986
|
+
function jn(e) {
|
|
987
|
+
return N(e, M.datetime);
|
|
988
|
+
}
|
|
989
|
+
//#endregion
|
|
990
|
+
//#region src/odata-service/formatters.ts
|
|
991
|
+
function P(e, t) {
|
|
992
|
+
switch (e) {
|
|
993
|
+
case "string": return `'${String(t).replace(/'/g, "''")}'`;
|
|
994
|
+
case "guid": return `guid'${String(t)}'`;
|
|
995
|
+
case "boolean": return t ? "'X'" : "' '";
|
|
996
|
+
case "long": return `${String(t)}L`;
|
|
997
|
+
case "float": return `${String(t)}F`;
|
|
998
|
+
case "decimal": return `${String(t)}M`;
|
|
999
|
+
case "double": return `${String(t)}D`;
|
|
1000
|
+
case "datetime":
|
|
1001
|
+
case "datetimeOffset":
|
|
1002
|
+
case "time":
|
|
1003
|
+
if (!(t instanceof Date)) throw Error(`Неверная дата для типа '${e}': ${t}`);
|
|
1004
|
+
return j[e](t);
|
|
1005
|
+
case "binary": return `binary'${t}'`;
|
|
1006
|
+
case "byte":
|
|
1007
|
+
case "int": return `${String(t)}`;
|
|
1008
|
+
default: throw Error(`Неподдерживаемый тип: ${e}`);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function Mn(e, t) {
|
|
1012
|
+
let n = M[e].safeParse(t);
|
|
1013
|
+
if (!n.success) throw Error(`Некорректное значение для типа '${e}': ${n.error.issues[0]?.message ?? t}`);
|
|
1014
|
+
return P(e, n.data);
|
|
1015
|
+
}
|
|
1016
|
+
function Nn(e) {
|
|
1017
|
+
if (typeof e == "boolean") return e;
|
|
1018
|
+
if (typeof e == "number") return e === 1 || e !== 0 && void 0;
|
|
1019
|
+
if (typeof e != "string") return;
|
|
1020
|
+
if (e === "X") return !0;
|
|
1021
|
+
if (e === " " || e === "") return !1;
|
|
1022
|
+
let t = e.trim().toLowerCase();
|
|
1023
|
+
if (t === "true" || t === "1") return !0;
|
|
1024
|
+
if (t === "false" || t === "0") return !1;
|
|
1025
|
+
}
|
|
1026
|
+
function Pn(e) {
|
|
1027
|
+
if (e == null) return !1;
|
|
1028
|
+
if (typeof e == "string" && (e === "X" || e === " " || e === "")) return a(e);
|
|
1029
|
+
}
|
|
1030
|
+
function Fn(e, t) {
|
|
1031
|
+
switch (e) {
|
|
1032
|
+
case "boolean": return Nn(t) ?? t;
|
|
1033
|
+
case "int":
|
|
1034
|
+
case "long":
|
|
1035
|
+
case "float":
|
|
1036
|
+
case "decimal":
|
|
1037
|
+
case "double":
|
|
1038
|
+
case "byte": return vn(t);
|
|
1039
|
+
case "datetime":
|
|
1040
|
+
case "datetimeOffset":
|
|
1041
|
+
case "time": return Lt(t);
|
|
1042
|
+
default: return String(t);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
function In(e, t) {
|
|
1046
|
+
if (e.abapBooleanLike) {
|
|
1047
|
+
let e = Pn(t);
|
|
1048
|
+
if (e !== void 0) return e;
|
|
1049
|
+
}
|
|
1050
|
+
return Fn(e.type, t);
|
|
1051
|
+
}
|
|
1052
|
+
function Ln(e) {
|
|
1053
|
+
switch (e) {
|
|
1054
|
+
case "boolean": return !1;
|
|
1055
|
+
case "int":
|
|
1056
|
+
case "long":
|
|
1057
|
+
case "float":
|
|
1058
|
+
case "decimal":
|
|
1059
|
+
case "double":
|
|
1060
|
+
case "byte": return 0;
|
|
1061
|
+
case "datetime":
|
|
1062
|
+
case "datetimeOffset":
|
|
1063
|
+
case "time": return /* @__PURE__ */ new Date();
|
|
1064
|
+
default: return "";
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
function Rn(e) {
|
|
1068
|
+
switch (e) {
|
|
1069
|
+
case "boolean": return !1;
|
|
1070
|
+
case "number": return 0;
|
|
1071
|
+
case "date": return /* @__PURE__ */ new Date();
|
|
1072
|
+
default: return "";
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
function F(e, t) {
|
|
1076
|
+
return (...n) => {
|
|
1077
|
+
let r = e.safeParse(n);
|
|
1078
|
+
if (!r.success) throw Error(`Validation failed: ${r.error.message}`);
|
|
1079
|
+
return t(...r.data);
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
function I(e) {
|
|
1083
|
+
return F(n.array(n.boolean()), e);
|
|
1084
|
+
}
|
|
1085
|
+
function zn(e) {
|
|
1086
|
+
return F(n.array(n.string()), e);
|
|
1087
|
+
}
|
|
1088
|
+
function Bn(e) {
|
|
1089
|
+
return F(n.array(n.number()), e);
|
|
1090
|
+
}
|
|
1091
|
+
function L(e) {
|
|
1092
|
+
return F(n.array(n.date()), e);
|
|
1093
|
+
}
|
|
1094
|
+
var Vn = L(j.datetime), Hn = L(j.datetimeOffset), Un = L(j.time), Wn = L((e) => P("string", fn(e))), Gn = I((e) => P("boolean", e)), Kn = I((e) => P("string", Number(e))), qn = I((e) => P("byte", Number(e))), Jn = zn((e) => P("string", e)), R = {
|
|
1095
|
+
date: {
|
|
1096
|
+
base: {
|
|
1097
|
+
label: "Базовый datetime",
|
|
1098
|
+
description: "Используется для параметров OData с типом данных datetime",
|
|
1099
|
+
fn: Vn
|
|
1100
|
+
},
|
|
1101
|
+
datetimeOffset: {
|
|
1102
|
+
label: "Базовый datetimeoffset",
|
|
1103
|
+
description: "Используется для параметров OData с типом данных datetimeoffset",
|
|
1104
|
+
fn: Hn
|
|
1105
|
+
},
|
|
1106
|
+
time: {
|
|
1107
|
+
label: "Базовый time",
|
|
1108
|
+
description: "Используется для параметров OData с типом данных time",
|
|
1109
|
+
fn: Un
|
|
1110
|
+
},
|
|
1111
|
+
stringAbapDate: {
|
|
1112
|
+
label: "Дата ABAP YYYYMMDD",
|
|
1113
|
+
description: "Используется для параметров OData с типом данных string(8)",
|
|
1114
|
+
fn: Wn
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
boolean: {
|
|
1118
|
+
base: {
|
|
1119
|
+
label: "Базовое ABAP булево",
|
|
1120
|
+
description: "Стандартный формат abap_bool со значением 'X' для true и '' для false",
|
|
1121
|
+
fn: Gn
|
|
1122
|
+
},
|
|
1123
|
+
asChar: {
|
|
1124
|
+
label: "Как символ",
|
|
1125
|
+
description: "Преобразование булево в символы '0' или '1'",
|
|
1126
|
+
fn: Kn
|
|
1127
|
+
},
|
|
1128
|
+
asByte: {
|
|
1129
|
+
label: "Как цифра",
|
|
1130
|
+
description: "Преобразование булево в цифру 0 или 1",
|
|
1131
|
+
fn: qn
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
string: { base: {
|
|
1135
|
+
label: "Базовая строка",
|
|
1136
|
+
description: "",
|
|
1137
|
+
fn: Jn
|
|
1138
|
+
} }
|
|
1139
|
+
};
|
|
1140
|
+
function Yn(e) {
|
|
1141
|
+
switch (e) {
|
|
1142
|
+
case "boolean": return "boolean";
|
|
1143
|
+
case "int":
|
|
1144
|
+
case "long":
|
|
1145
|
+
case "float":
|
|
1146
|
+
case "decimal":
|
|
1147
|
+
case "double":
|
|
1148
|
+
case "byte": return "number";
|
|
1149
|
+
case "datetime":
|
|
1150
|
+
case "datetimeOffset":
|
|
1151
|
+
case "time": return "date";
|
|
1152
|
+
default: return "string";
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
function Xn(e) {
|
|
1156
|
+
let t = R[Yn(e)];
|
|
1157
|
+
return t ? Object.entries(t).map(([e, t]) => ({
|
|
1158
|
+
id: e,
|
|
1159
|
+
...t
|
|
1160
|
+
})) : [];
|
|
1161
|
+
}
|
|
1162
|
+
function Zn(e) {
|
|
1163
|
+
let t = R[e];
|
|
1164
|
+
return t ? Object.entries(t).map(([e, t]) => ({
|
|
1165
|
+
id: e,
|
|
1166
|
+
...t
|
|
1167
|
+
})) : [];
|
|
1168
|
+
}
|
|
1169
|
+
function Qn(e, t) {
|
|
1170
|
+
return R[Yn(e)]?.[t];
|
|
1171
|
+
}
|
|
1172
|
+
function $n(e, t) {
|
|
1173
|
+
return R[e]?.[t];
|
|
1174
|
+
}
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region src/odata-service/builder.ts
|
|
1177
|
+
function er(e, t) {
|
|
1178
|
+
if (!t || typeof t != "number") return;
|
|
1179
|
+
let n = e.match(/^'(.*)'$/s);
|
|
1180
|
+
if (!n) throw Error(`Значение должно быть заключено в одинарные кавычки: ${e}`);
|
|
1181
|
+
let r = n[1];
|
|
1182
|
+
if (r.length > t) throw Error(`Значение слишком длинное для maxLength=${t}: '${e}' (${r.length} символов внутри кавычек)`);
|
|
1183
|
+
}
|
|
1184
|
+
function tr(e, t) {
|
|
1185
|
+
return e.parameters ? e.parameters.map((e) => {
|
|
1186
|
+
let { id: n, type: r, maxLength: i, mandatory: a } = e, o = t[n] ?? {}, s = o.value, c = o.formatter;
|
|
1187
|
+
if (a && s == null) throw Error(`Отсутствует обязательный параметр: ${n}`);
|
|
1188
|
+
if (s == null) return null;
|
|
1189
|
+
try {
|
|
1190
|
+
if (Array.isArray(s) && !c) throw Error("Массив значений OData-параметра требует custom formatter");
|
|
1191
|
+
let e = c ? c(s) : Mn(r, s);
|
|
1192
|
+
return er(e, i), [n, e];
|
|
1193
|
+
} catch (e) {
|
|
1194
|
+
throw Error(`Ошибка форматирования параметра ${n}: ${String(e)}`);
|
|
1195
|
+
}
|
|
1196
|
+
}).filter((e) => e !== null) : [];
|
|
1197
|
+
}
|
|
1198
|
+
function nr(e, t) {
|
|
1199
|
+
let n = tr(e, t);
|
|
1200
|
+
return n.length ? `(${n.map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join(",")})` : "";
|
|
1201
|
+
}
|
|
1202
|
+
function rr(e, t) {
|
|
1203
|
+
let n = new URLSearchParams();
|
|
1204
|
+
for (let [r, i] of tr(e, t)) n.set(r, i);
|
|
1205
|
+
return n;
|
|
1206
|
+
}
|
|
1207
|
+
function ir(e, t, n, r) {
|
|
1208
|
+
let i = `/${t.service}/${t.target}`;
|
|
1209
|
+
return r === "create" ? i : r === "query" ? e.result ? or(e, t, n) : (__DEV__ && Object.keys(n).length > 0 && console.warn(`Параметры для query-запроса '/${t.service}/${t.target}' проигнорированы: target не поддерживает parameterized query.`), i) : `${i}${nr(e, n)}`;
|
|
1210
|
+
}
|
|
1211
|
+
function ar(e, t, n) {
|
|
1212
|
+
let r = rr(e, n).toString(), i = `/${t.service}/${t.target}`;
|
|
1213
|
+
return r ? `${i}?${r}` : i;
|
|
1214
|
+
}
|
|
1215
|
+
function or(e, t, n) {
|
|
1216
|
+
let r = nr(e, n), i = e.result ? `/${e.result}` : "";
|
|
1217
|
+
return `/${t.service}/${t.target}${r}${i}`;
|
|
1218
|
+
}
|
|
1219
|
+
//#endregion
|
|
1220
|
+
//#region src/odata-service/columns.ts
|
|
1221
|
+
function sr(e) {
|
|
1222
|
+
return e.filter((e) => e.semanticType === "code" && e.filterable);
|
|
1223
|
+
}
|
|
1224
|
+
function cr(e) {
|
|
1225
|
+
return new Set(sr(e).map((e) => e.id));
|
|
1226
|
+
}
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/odata-service/filters.ts
|
|
1229
|
+
var lr = Object.freeze({
|
|
1230
|
+
eq: "eq",
|
|
1231
|
+
ne: "ne",
|
|
1232
|
+
gt: "gt",
|
|
1233
|
+
ge: "ge",
|
|
1234
|
+
lt: "lt",
|
|
1235
|
+
le: "le",
|
|
1236
|
+
startswith: "startswith",
|
|
1237
|
+
endswith: "endswith",
|
|
1238
|
+
contains: "contains"
|
|
1239
|
+
}), ur = Object.freeze(Object.values(lr)), dr = Object.freeze({
|
|
1240
|
+
eq: "равно",
|
|
1241
|
+
ne: "не равно",
|
|
1242
|
+
gt: "больше",
|
|
1243
|
+
ge: "больше или равно",
|
|
1244
|
+
lt: "меньше",
|
|
1245
|
+
le: "меньше или равно",
|
|
1246
|
+
startswith: "начинается с",
|
|
1247
|
+
endswith: "заканчивается на",
|
|
1248
|
+
contains: "содержит"
|
|
1249
|
+
}), fr = new Set(ur);
|
|
1250
|
+
function pr(e) {
|
|
1251
|
+
return typeof e == "string" && fr.has(e);
|
|
1252
|
+
}
|
|
1253
|
+
function mr(e) {
|
|
1254
|
+
return dr[e];
|
|
1255
|
+
}
|
|
1256
|
+
function hr(e) {
|
|
1257
|
+
switch (typeof e) {
|
|
1258
|
+
case "bigint":
|
|
1259
|
+
case "number": return "int";
|
|
1260
|
+
case "boolean": return "boolean";
|
|
1261
|
+
case "object": if (e instanceof Date) return "datetime";
|
|
1262
|
+
}
|
|
1263
|
+
return "string";
|
|
1264
|
+
}
|
|
1265
|
+
function z(e) {
|
|
1266
|
+
let { key: t, operation: n = "eq", value: r, type: i } = e, a = Mn(i ?? hr(r), r);
|
|
1267
|
+
return n === "contains" ? `substringof(${a},${String(t)})` : n === "startswith" || n === "endswith" ? `${n}(${String(t)}, ${a})` : `${String(t)} ${n} ${a}`;
|
|
1268
|
+
}
|
|
1269
|
+
function gr(e) {
|
|
1270
|
+
return "conditions" in e && e.conditions !== void 0;
|
|
1271
|
+
}
|
|
1272
|
+
function _r(e) {
|
|
1273
|
+
return "filters" in e && e.filters !== void 0;
|
|
1274
|
+
}
|
|
1275
|
+
function vr(e, t) {
|
|
1276
|
+
let n = [];
|
|
1277
|
+
for (let r of e) {
|
|
1278
|
+
let e = t(r);
|
|
1279
|
+
e && n.push(e);
|
|
1280
|
+
}
|
|
1281
|
+
return n;
|
|
1282
|
+
}
|
|
1283
|
+
function yr(e) {
|
|
1284
|
+
if (!e) return "";
|
|
1285
|
+
if (gr(e)) {
|
|
1286
|
+
let { conditions: t, and: n = !1 } = e;
|
|
1287
|
+
if (t.length === 0) return "";
|
|
1288
|
+
if (t.length === 1) return z(t[0]);
|
|
1289
|
+
let r = n ? "and" : "or";
|
|
1290
|
+
return `(${t.map(z).join(` ${r} `)})`;
|
|
1291
|
+
}
|
|
1292
|
+
if (_r(e)) {
|
|
1293
|
+
let { filters: t, and: n = !1 } = e;
|
|
1294
|
+
if (t.length === 0) return "";
|
|
1295
|
+
if (t.length === 1) return yr(t[0]);
|
|
1296
|
+
let r = n ? "and" : "or", i = vr(t, yr);
|
|
1297
|
+
return i.length === 0 ? "" : i.length === 1 ? i[0] : `(${i.join(` ${r} `)})`;
|
|
1298
|
+
}
|
|
1299
|
+
throw Error("Некорректное выражение фильтра");
|
|
1300
|
+
}
|
|
1301
|
+
function br(e) {
|
|
1302
|
+
let t = (e) => {
|
|
1303
|
+
if (!e) return "";
|
|
1304
|
+
if (gr(e)) {
|
|
1305
|
+
let { conditions: t, and: n = !1 } = e;
|
|
1306
|
+
if (t.length === 0) return "";
|
|
1307
|
+
if (t.length === 1) return z(t[0]);
|
|
1308
|
+
let r = n ? "and" : "or";
|
|
1309
|
+
return `(${t.map(z).join(` ${r} `)})`;
|
|
1310
|
+
}
|
|
1311
|
+
if (_r(e)) {
|
|
1312
|
+
let { filters: n, and: r = !1 } = e;
|
|
1313
|
+
if (n.length === 0) return "";
|
|
1314
|
+
if (n.length === 1) return t(n[0]);
|
|
1315
|
+
let i = r ? "and" : "or", a = vr(n, t).map((e) => e.includes(" ") ? `(${e})` : e);
|
|
1316
|
+
return a.length === 0 ? "" : a.length === 1 ? a[0] : `(${a.join(` ${i} `)})`;
|
|
1317
|
+
}
|
|
1318
|
+
return "";
|
|
1319
|
+
};
|
|
1320
|
+
return t(e);
|
|
1321
|
+
}
|
|
1322
|
+
function B(e, t, n) {
|
|
1323
|
+
if (t == null) return { conditions: [] };
|
|
1324
|
+
if (Array.isArray(t)) {
|
|
1325
|
+
let r = [];
|
|
1326
|
+
for (let i of t) i != null && r.push({
|
|
1327
|
+
key: e,
|
|
1328
|
+
value: i,
|
|
1329
|
+
operation: n
|
|
1330
|
+
});
|
|
1331
|
+
return { conditions: r };
|
|
1332
|
+
}
|
|
1333
|
+
return { conditions: [{
|
|
1334
|
+
key: e,
|
|
1335
|
+
value: t,
|
|
1336
|
+
operation: n
|
|
1337
|
+
}] };
|
|
1338
|
+
}
|
|
1339
|
+
function xr(e, t) {
|
|
1340
|
+
if (!t) return { conditions: [] };
|
|
1341
|
+
let n = t[0], r = t[1];
|
|
1342
|
+
return n == null || r == null ? n ? { conditions: [{
|
|
1343
|
+
key: e,
|
|
1344
|
+
value: n,
|
|
1345
|
+
operation: "ge"
|
|
1346
|
+
}] } : r ? { conditions: [{
|
|
1347
|
+
key: e,
|
|
1348
|
+
value: r,
|
|
1349
|
+
operation: "le"
|
|
1350
|
+
}] } : { conditions: [] } : {
|
|
1351
|
+
and: !0,
|
|
1352
|
+
conditions: [{
|
|
1353
|
+
key: e,
|
|
1354
|
+
value: n,
|
|
1355
|
+
operation: "ge"
|
|
1356
|
+
}, {
|
|
1357
|
+
key: e,
|
|
1358
|
+
value: r,
|
|
1359
|
+
operation: "le"
|
|
1360
|
+
}]
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
function V(e, t) {
|
|
1364
|
+
return B(e, t, "eq");
|
|
1365
|
+
}
|
|
1366
|
+
function Sr(e, t) {
|
|
1367
|
+
return B(e, Array.isArray(t) ? t.map((e) => e || null) : t || null, "eq");
|
|
1368
|
+
}
|
|
1369
|
+
function Cr(e, t) {
|
|
1370
|
+
return B(e, t, "contains");
|
|
1371
|
+
}
|
|
1372
|
+
function wr(e, t) {
|
|
1373
|
+
return e ? t ? {
|
|
1374
|
+
and: !0,
|
|
1375
|
+
filters: [e, t]
|
|
1376
|
+
} : e : t;
|
|
1377
|
+
}
|
|
1378
|
+
//#endregion
|
|
1379
|
+
//#region src/odata-service/filterDefinitions.ts
|
|
1380
|
+
function Tr(e) {
|
|
1381
|
+
return e === "select" || e === "multi-select" || e === "checkbox" || e === "text-input" || e === "number-input";
|
|
1382
|
+
}
|
|
1383
|
+
function H(e, t) {
|
|
1384
|
+
return e?.conditions.length ? e.conditions.map((e) => e.columnId?.trim() || t).filter((e) => !!e) : [];
|
|
1385
|
+
}
|
|
1386
|
+
function Er(e, t) {
|
|
1387
|
+
let n = e.kind === "list" ? e.options.flatMap((e) => H(e.filter, t)) : e.kind === "boolean" ? H(e.trueFilter, t) : H(e.valueFilter, t);
|
|
1388
|
+
return [...new Set(n.length ? n : t ? [t] : [])];
|
|
1389
|
+
}
|
|
1390
|
+
function U(e, t) {
|
|
1391
|
+
let n = H(e, t);
|
|
1392
|
+
return n.length ? n : t ? [t] : [];
|
|
1393
|
+
}
|
|
1394
|
+
function Dr(e) {
|
|
1395
|
+
return e.kind === "registered" ? e.valueMode === "multiple" : e.componentId === "multi-select";
|
|
1396
|
+
}
|
|
1397
|
+
function Or(e) {
|
|
1398
|
+
return Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string").map((e) => e.trim()))] : [];
|
|
1399
|
+
}
|
|
1400
|
+
function kr(e, t) {
|
|
1401
|
+
if (Dr(e)) return Or(t);
|
|
1402
|
+
let n = W(t);
|
|
1403
|
+
return typeof n == "string" ? [n] : [];
|
|
1404
|
+
}
|
|
1405
|
+
function Ar(e) {
|
|
1406
|
+
let t = J([e])[0];
|
|
1407
|
+
return t ? t.kind === "registered" ? [...t.columnIds] : t.kind === "segment" || t.kind === "column" || t.kind === "advanced" ? [t.ownerColumnId] : [...t.columnIds] : [];
|
|
1408
|
+
}
|
|
1409
|
+
function jr(e, t) {
|
|
1410
|
+
let n = J([e])[0], r = Y(t);
|
|
1411
|
+
if (!n || r === void 0) return [];
|
|
1412
|
+
switch (n.kind) {
|
|
1413
|
+
case "segment":
|
|
1414
|
+
case "column":
|
|
1415
|
+
case "advanced": return [n.ownerColumnId];
|
|
1416
|
+
case "tree": {
|
|
1417
|
+
let e = K(r);
|
|
1418
|
+
return e ? Object.keys(e).filter((e) => n.columnIds.includes(e)) : [];
|
|
1419
|
+
}
|
|
1420
|
+
case "local":
|
|
1421
|
+
if (n.binding.kind === "list") {
|
|
1422
|
+
let e = kr(n, r);
|
|
1423
|
+
return [...new Set(e.flatMap((e) => {
|
|
1424
|
+
let t = n.binding.kind === "list" ? n.binding.options.find((t) => t.key === e) : void 0;
|
|
1425
|
+
return t ? U(t.filter, n.ownerColumnId) : [];
|
|
1426
|
+
}))];
|
|
1427
|
+
}
|
|
1428
|
+
return n.binding.kind === "boolean" ? r === !0 ? U(n.binding.trueFilter, n.ownerColumnId) : [] : U(n.binding.valueFilter, n.ownerColumnId);
|
|
1429
|
+
case "registered": {
|
|
1430
|
+
let e = n.binding;
|
|
1431
|
+
if (!e) return [];
|
|
1432
|
+
if (e.kind === "list") {
|
|
1433
|
+
let t = kr(n, r);
|
|
1434
|
+
return [...new Set(t.flatMap((t) => {
|
|
1435
|
+
let n = e.options.find((e) => e.key === t);
|
|
1436
|
+
return n ? U(n.filter, "") : [];
|
|
1437
|
+
}))];
|
|
1438
|
+
}
|
|
1439
|
+
return e.kind === "boolean" ? r === !0 ? U(e.trueFilter, "") : [] : U(e.valueFilter, "");
|
|
1440
|
+
}
|
|
1441
|
+
default: return [];
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
function Mr(e, t) {
|
|
1445
|
+
let n = e?.trim();
|
|
1446
|
+
return n && n !== t ? n : void 0;
|
|
1447
|
+
}
|
|
1448
|
+
function W(e) {
|
|
1449
|
+
if (e instanceof Date) return Number.isFinite(e.getTime()) ? e : void 0;
|
|
1450
|
+
if (typeof e == "string") return e.trim();
|
|
1451
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
1452
|
+
if (typeof e == "boolean") return e;
|
|
1453
|
+
}
|
|
1454
|
+
function Nr(e) {
|
|
1455
|
+
return e instanceof Date ? `date:${e.toISOString()}` : `${typeof e}:${String(e)}`;
|
|
1456
|
+
}
|
|
1457
|
+
function G(e) {
|
|
1458
|
+
if (!Array.isArray(e)) return;
|
|
1459
|
+
let n = /* @__PURE__ */ new Set(), r = [];
|
|
1460
|
+
for (let t of e) {
|
|
1461
|
+
let e = W(t);
|
|
1462
|
+
if (e === void 0) continue;
|
|
1463
|
+
let i = Nr(e);
|
|
1464
|
+
n.has(i) || (n.add(i), r.push(e));
|
|
1465
|
+
}
|
|
1466
|
+
return r.sort((e, n) => t(Nr(e), Nr(n))), r.length ? r : void 0;
|
|
1467
|
+
}
|
|
1468
|
+
function Pr(e) {
|
|
1469
|
+
if (!Array.isArray(e)) return;
|
|
1470
|
+
let t = [...new Set(e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean))];
|
|
1471
|
+
return t.length ? t : void 0;
|
|
1472
|
+
}
|
|
1473
|
+
function K(e) {
|
|
1474
|
+
if (!e || typeof e != "object" || Array.isArray(e) || e instanceof Date) return;
|
|
1475
|
+
let t = Object.fromEntries(Object.entries(e).map(([e, t]) => [e.trim(), Pr(t)]).filter((e) => !!e[0] && !!e[1]?.length));
|
|
1476
|
+
return Object.keys(t).length ? t : void 0;
|
|
1477
|
+
}
|
|
1478
|
+
function q(e) {
|
|
1479
|
+
if (!e?.conditions?.length) return;
|
|
1480
|
+
let t = [];
|
|
1481
|
+
for (let n of e.conditions) {
|
|
1482
|
+
let e = W(n.value);
|
|
1483
|
+
(n.valueSource !== "static" || e !== void 0) && t.push({
|
|
1484
|
+
columnId: n.columnId?.trim() || void 0,
|
|
1485
|
+
operation: n.operation,
|
|
1486
|
+
valueSource: n.valueSource,
|
|
1487
|
+
value: e
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
if (t.length) return {
|
|
1491
|
+
and: e.and === !1 ? !1 : e.and ? !0 : void 0,
|
|
1492
|
+
conditions: t
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
function Fr(e) {
|
|
1496
|
+
if (e) {
|
|
1497
|
+
if (e.kind === "list") {
|
|
1498
|
+
let t = [];
|
|
1499
|
+
for (let n of e.options ?? []) {
|
|
1500
|
+
let e = n.key.trim();
|
|
1501
|
+
t.push({
|
|
1502
|
+
key: e,
|
|
1503
|
+
label: n.label.trim() || e,
|
|
1504
|
+
filter: q(n.filter)
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
if (!t.length) return;
|
|
1508
|
+
let n = e.and === !0 || e.and !== !1 && void 0;
|
|
1509
|
+
return {
|
|
1510
|
+
kind: "list",
|
|
1511
|
+
...n === void 0 ? {} : { and: n },
|
|
1512
|
+
options: t
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
return e.kind === "boolean" ? {
|
|
1516
|
+
kind: "boolean",
|
|
1517
|
+
trueFilter: q(e.trueFilter)
|
|
1518
|
+
} : {
|
|
1519
|
+
kind: "value",
|
|
1520
|
+
valueFilter: q(e.valueFilter)
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
function J(e) {
|
|
1525
|
+
if (!e?.length) return [];
|
|
1526
|
+
let t = [];
|
|
1527
|
+
for (let n of e) {
|
|
1528
|
+
let e = n.id.trim();
|
|
1529
|
+
if (!e) continue;
|
|
1530
|
+
let r = { ...n };
|
|
1531
|
+
if (r.kind === "odata-segment" && (r.kind = "segment"), r.kind === "odata-tree" && (r.kind = "tree"), r.kind === "registered") {
|
|
1532
|
+
let n = r.componentId.trim(), i = r.valueMode;
|
|
1533
|
+
if (!n || i !== "single" && i !== "multiple") continue;
|
|
1534
|
+
let a = Fr(r.binding);
|
|
1535
|
+
t.push({
|
|
1536
|
+
...r,
|
|
1537
|
+
id: e,
|
|
1538
|
+
componentId: n,
|
|
1539
|
+
valueMode: i,
|
|
1540
|
+
columnIds: a ? Er(a, "") : [],
|
|
1541
|
+
binding: a
|
|
1542
|
+
});
|
|
1543
|
+
continue;
|
|
1544
|
+
}
|
|
1545
|
+
let i = r.ownerColumnId.trim();
|
|
1546
|
+
if (i) switch (r.kind) {
|
|
1547
|
+
case "segment":
|
|
1548
|
+
t.push({
|
|
1549
|
+
...r,
|
|
1550
|
+
id: e,
|
|
1551
|
+
ownerColumnId: i,
|
|
1552
|
+
columnIds: [i],
|
|
1553
|
+
componentId: r.componentId === "select" ? "select" : "multi-select",
|
|
1554
|
+
dictionaryCodeKey: Mr(r.dictionaryCodeKey, i)
|
|
1555
|
+
});
|
|
1556
|
+
break;
|
|
1557
|
+
case "tree": {
|
|
1558
|
+
let n = [...new Set(r.columnIds.map((e) => e.trim()).filter(Boolean))];
|
|
1559
|
+
if (!n.length) break;
|
|
1560
|
+
let a = r.componentId, o = a === "treeSelect" || a === "tree-select" ? "tree-select" : "tree-multi-select";
|
|
1561
|
+
t.push({
|
|
1562
|
+
...r,
|
|
1563
|
+
id: e,
|
|
1564
|
+
ownerColumnId: n.includes(i) ? i : n[0],
|
|
1565
|
+
columnIds: n,
|
|
1566
|
+
componentId: o,
|
|
1567
|
+
levelOperator: r.levelOperator === "or" ? "or" : void 0
|
|
1568
|
+
});
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
case "local": {
|
|
1572
|
+
let n = Fr(r.binding);
|
|
1573
|
+
if (!n) break;
|
|
1574
|
+
t.push({
|
|
1575
|
+
...r,
|
|
1576
|
+
id: e,
|
|
1577
|
+
ownerColumnId: i,
|
|
1578
|
+
columnIds: Er(n, i),
|
|
1579
|
+
binding: n
|
|
1580
|
+
});
|
|
1581
|
+
break;
|
|
1582
|
+
}
|
|
1583
|
+
case "advanced":
|
|
1584
|
+
t.push({
|
|
1585
|
+
...r,
|
|
1586
|
+
id: e,
|
|
1587
|
+
ownerColumnId: i
|
|
1588
|
+
});
|
|
1589
|
+
break;
|
|
1590
|
+
case "column": t.push({
|
|
1591
|
+
...r,
|
|
1592
|
+
id: e,
|
|
1593
|
+
ownerColumnId: i
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
return t;
|
|
1598
|
+
}
|
|
1599
|
+
function Y(e) {
|
|
1600
|
+
if (e == null) return;
|
|
1601
|
+
let t = W(e);
|
|
1602
|
+
return t === void 0 ? G(e) || K(e) : t;
|
|
1603
|
+
}
|
|
1604
|
+
function X(e) {
|
|
1605
|
+
if (!e) return {};
|
|
1606
|
+
let t = {};
|
|
1607
|
+
for (let [n, r] of Object.entries(e)) {
|
|
1608
|
+
let e = n.trim();
|
|
1609
|
+
if (!e) continue;
|
|
1610
|
+
let i = Y(r);
|
|
1611
|
+
i !== void 0 && (t[e] = i);
|
|
1612
|
+
}
|
|
1613
|
+
return t;
|
|
1614
|
+
}
|
|
1615
|
+
function Ir(e, t, n) {
|
|
1616
|
+
let r = { ...X(e) }, i = Y(n);
|
|
1617
|
+
return i === void 0 ? (delete r[t], r) : (r[t] = i, r);
|
|
1618
|
+
}
|
|
1619
|
+
function Lr(e, t, n) {
|
|
1620
|
+
if (!e || Object.keys(e).length === 0) return {};
|
|
1621
|
+
let r = {}, i = {};
|
|
1622
|
+
for (let [e, t] of Object.entries(n)) for (let n of t) i[n.codeKey] = e;
|
|
1623
|
+
let a = {}, o = new Set(t);
|
|
1624
|
+
for (let [t, n] of Object.entries(e)) {
|
|
1625
|
+
let e = i[t], s = o.has(t);
|
|
1626
|
+
if (e && s && (Array.isArray(n) || typeof n == "string")) {
|
|
1627
|
+
a[e] = a[e] ?? [], a[e].push(t);
|
|
1628
|
+
continue;
|
|
1629
|
+
}
|
|
1630
|
+
r[t] = n;
|
|
1631
|
+
}
|
|
1632
|
+
for (let [t, i] of Object.entries(a)) {
|
|
1633
|
+
let a = n[t];
|
|
1634
|
+
if (!a) continue;
|
|
1635
|
+
let o = null;
|
|
1636
|
+
for (let { codeKey: e } of [...a].reverse()) if (i.includes(e)) {
|
|
1637
|
+
o = e;
|
|
1638
|
+
break;
|
|
1639
|
+
}
|
|
1640
|
+
o && e[o] !== void 0 && (r[o] = e[o]);
|
|
1641
|
+
}
|
|
1642
|
+
return r;
|
|
1643
|
+
}
|
|
1644
|
+
function Rr(e, t) {
|
|
1645
|
+
return W(t);
|
|
1646
|
+
}
|
|
1647
|
+
function zr(e, t, n) {
|
|
1648
|
+
let r = Rr(t.valueSource, t.valueSource === "input" ? n : t.value);
|
|
1649
|
+
if (r === void 0) return;
|
|
1650
|
+
let i = t.columnId?.trim() || e;
|
|
1651
|
+
if (i) return {
|
|
1652
|
+
key: i,
|
|
1653
|
+
operation: t.operation,
|
|
1654
|
+
value: r
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
function Z(e, t, n) {
|
|
1658
|
+
if (!t?.conditions.length) return;
|
|
1659
|
+
let r = t.conditions.map((t) => zr(e, t, n)).filter((e) => !!e);
|
|
1660
|
+
if (r.length) return {
|
|
1661
|
+
and: t.and !== !1 || void 0,
|
|
1662
|
+
conditions: r
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
function Br(e) {
|
|
1666
|
+
return V(e, !0);
|
|
1667
|
+
}
|
|
1668
|
+
function Q(e, t) {
|
|
1669
|
+
return V(e, t);
|
|
1670
|
+
}
|
|
1671
|
+
function Vr(e, t) {
|
|
1672
|
+
let n = K(t);
|
|
1673
|
+
if (!n) return;
|
|
1674
|
+
let r = e.columnIds.map((e) => {
|
|
1675
|
+
let t = n[e];
|
|
1676
|
+
if (t?.length) return V(e, t);
|
|
1677
|
+
}).filter((e) => !!e);
|
|
1678
|
+
if (r.length) return r.length === 1 ? r[0] : {
|
|
1679
|
+
and: e.levelOperator !== "or" || void 0,
|
|
1680
|
+
filters: r
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
function Hr(e, t) {
|
|
1684
|
+
if (!e.binding || e.binding.kind !== "list") return;
|
|
1685
|
+
let n = e.binding, r = kr(e, t);
|
|
1686
|
+
if (!r.length) return;
|
|
1687
|
+
let i = e.kind === "local" ? e.ownerColumnId : "", a = r.map((t) => {
|
|
1688
|
+
let r = n.options.find((e) => e.key === t);
|
|
1689
|
+
if (!r) return;
|
|
1690
|
+
let a = Z(i, r.filter);
|
|
1691
|
+
return a || e.kind === "registered" ? a : Q(e.ownerColumnId, r.key);
|
|
1692
|
+
}).filter((e) => !!e);
|
|
1693
|
+
if (a.length) return a.length === 1 ? a[0] : {
|
|
1694
|
+
and: n.and === !0 || void 0,
|
|
1695
|
+
filters: a
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
function Ur(e, t) {
|
|
1699
|
+
if (t !== void 0) switch (e.kind) {
|
|
1700
|
+
case "segment": {
|
|
1701
|
+
if (e.componentId === "select") {
|
|
1702
|
+
let n = W(t);
|
|
1703
|
+
return n === void 0 ? void 0 : Q(e.ownerColumnId, n);
|
|
1704
|
+
}
|
|
1705
|
+
let n = G(t);
|
|
1706
|
+
return n?.length ? Q(e.ownerColumnId, n) : void 0;
|
|
1707
|
+
}
|
|
1708
|
+
case "tree": return Vr(e, t);
|
|
1709
|
+
case "local": return e.binding.kind === "list" ? Hr(e, t) : e.binding.kind === "boolean" ? t === !0 ? Z(e.ownerColumnId, e.binding.trueFilter) ?? Br(e.ownerColumnId) : void 0 : Z(e.ownerColumnId, e.binding.valueFilter, t) ?? (() => {
|
|
1710
|
+
let n = W(t), r = G(t), i = n ?? r;
|
|
1711
|
+
return i === void 0 ? void 0 : Q(e.ownerColumnId, i);
|
|
1712
|
+
})();
|
|
1713
|
+
case "registered": return e.binding ? e.binding.kind === "list" ? Hr(e, t) : e.binding.kind === "boolean" ? t === !0 ? Z("", e.binding.trueFilter) : void 0 : Z("", e.binding.valueFilter, t) : void 0;
|
|
1714
|
+
case "column": {
|
|
1715
|
+
let n = W(t), r = G(t), i = n ?? r;
|
|
1716
|
+
return i === void 0 ? void 0 : Q(e.ownerColumnId, i);
|
|
1717
|
+
}
|
|
1718
|
+
case "advanced": {
|
|
1719
|
+
let n = G(t);
|
|
1720
|
+
return n?.length ? Q(e.ownerColumnId, n) : void 0;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
function Wr(e, t) {
|
|
1725
|
+
let n = J(e), r = X(t);
|
|
1726
|
+
if (!n.length || !Object.keys(r).length) return;
|
|
1727
|
+
let i = n.map((e) => Ur(e, r[e.id])).filter((e) => !!e);
|
|
1728
|
+
if (i.length) return i.length === 1 ? i[0] : {
|
|
1729
|
+
and: !0,
|
|
1730
|
+
filters: i
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
function Gr(e, t) {
|
|
1734
|
+
let n = J(e), r = X(t), i = {};
|
|
1735
|
+
for (let e of n) {
|
|
1736
|
+
if (e.kind !== "segment" && e.kind !== "tree") continue;
|
|
1737
|
+
let t = r[e.id];
|
|
1738
|
+
if (t === void 0) continue;
|
|
1739
|
+
if (e.kind === "segment") {
|
|
1740
|
+
let n = typeof t == "string" ? t : void 0, r = Pr(t), a = n ? [n] : r;
|
|
1741
|
+
if (!a?.length) continue;
|
|
1742
|
+
i[e.dictionaryCodeKey ?? e.ownerColumnId] = a;
|
|
1743
|
+
continue;
|
|
1744
|
+
}
|
|
1745
|
+
let n = K(t);
|
|
1746
|
+
if (n) for (let t of e.columnIds) {
|
|
1747
|
+
let e = n[t];
|
|
1748
|
+
e && e.length && (i[t] = e);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
return i;
|
|
1752
|
+
}
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region src/odata-service/findCollectionPairs.ts
|
|
1755
|
+
function Kr(e, t = {}) {
|
|
1756
|
+
let { textSuffixes: n = [
|
|
1757
|
+
"_txt",
|
|
1758
|
+
"_text",
|
|
1759
|
+
"_t",
|
|
1760
|
+
"_Text",
|
|
1761
|
+
"_TXT",
|
|
1762
|
+
"_T"
|
|
1763
|
+
], caseSensitive: r = !1, returnUnpaired: i = !1 } = t, a = Object.keys(e), o = [], s = {}, c = /* @__PURE__ */ new Set(), l = new Set(a), u = n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), d = RegExp(`(.*)(${u})$`, r ? "" : "i"), f = a.filter((e) => d.test(e));
|
|
1764
|
+
for (let e of f) {
|
|
1765
|
+
if (c.has(e)) continue;
|
|
1766
|
+
let t = e.match(d);
|
|
1767
|
+
if (t) {
|
|
1768
|
+
let n = t[1];
|
|
1769
|
+
a.includes(n) && !c.has(n) && (o.push({
|
|
1770
|
+
codeKey: n,
|
|
1771
|
+
textKey: e
|
|
1772
|
+
}), s[n] = e, c.add(n), c.add(e), l.delete(n), l.delete(e));
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
let p = {
|
|
1776
|
+
pairs: o,
|
|
1777
|
+
pairsMap: s
|
|
1778
|
+
};
|
|
1779
|
+
return i && (p.unpaired = Array.from(l)), p;
|
|
1780
|
+
}
|
|
1781
|
+
//#endregion
|
|
1782
|
+
//#region src/odata-service/odataCollectionStore.ts
|
|
1783
|
+
var $ = r()(i((e) => ({
|
|
1784
|
+
defaultMaxVisibleItems: 200,
|
|
1785
|
+
defaultMinSearchCodeLength: 3,
|
|
1786
|
+
defaultMinSearchTextLength: 1,
|
|
1787
|
+
defaultSearchDebounceDelay: 100,
|
|
1788
|
+
setDefaultMaxVisibleItems: (t) => e({ defaultMaxVisibleItems: t }),
|
|
1789
|
+
setDefaultMinSearchTextLength: (t) => e({ defaultMinSearchTextLength: t }),
|
|
1790
|
+
setDefaultMinSearchCodeLength: (t) => e({ defaultMinSearchCodeLength: t }),
|
|
1791
|
+
setDefaultSearchDebounceDelay: (t) => e({ defaultSearchDebounceDelay: t })
|
|
1792
|
+
}))), qr = {
|
|
1793
|
+
useMaxVisibleItems: () => $((e) => e.defaultMaxVisibleItems),
|
|
1794
|
+
useMinSearchCodeLength: () => $((e) => e.defaultMinSearchCodeLength),
|
|
1795
|
+
useMinSearchTextLength: () => $((e) => e.defaultMinSearchTextLength),
|
|
1796
|
+
useSearchDebounce: () => $((e) => e.defaultSearchDebounceDelay)
|
|
1797
|
+
}, Jr = /^(.+)(_txt|_text|_t)$/i, Yr = /* @__PURE__ */ new Set(["ZDIV", "ZCFO1"]);
|
|
1798
|
+
function Xr(e) {
|
|
1799
|
+
return e.label || e.id;
|
|
1800
|
+
}
|
|
1801
|
+
function Zr(e) {
|
|
1802
|
+
return e ? Yr.has(e.toUpperCase()) : !1;
|
|
1803
|
+
}
|
|
1804
|
+
function Qr(e) {
|
|
1805
|
+
if (!e) return !1;
|
|
1806
|
+
let t = e.toUpperCase();
|
|
1807
|
+
if (Yr.has(t)) return !0;
|
|
1808
|
+
let n = t.match(/^(.+)(_TXT|_TEXT|_T)$/);
|
|
1809
|
+
return n ? Yr.has(n[1]) : !1;
|
|
1810
|
+
}
|
|
1811
|
+
function $r(e) {
|
|
1812
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1813
|
+
}
|
|
1814
|
+
function ei(e) {
|
|
1815
|
+
return e.startsWith("Edm.");
|
|
1816
|
+
}
|
|
1817
|
+
function ti(e, t) {
|
|
1818
|
+
if (t) return e[t.toUpperCase()];
|
|
1819
|
+
}
|
|
1820
|
+
function ni(e, t, n) {
|
|
1821
|
+
let r = ti(n, e);
|
|
1822
|
+
if (!r) return;
|
|
1823
|
+
let i = RegExp(`^${$r(r)}(_txt|_text|_t)$`, "i");
|
|
1824
|
+
for (let e of t) if (i.test(e.id)) return e.id;
|
|
1825
|
+
}
|
|
1826
|
+
function ri(e) {
|
|
1827
|
+
let t = {}, n = {};
|
|
1828
|
+
for (let r of e) t[r.id] = r, n[r.id.toUpperCase()] = r.id;
|
|
1829
|
+
for (let t of e) {
|
|
1830
|
+
if (t.role === "measure") {
|
|
1831
|
+
t.semanticType = "none", t.linkedColumnId = void 0;
|
|
1832
|
+
continue;
|
|
1833
|
+
}
|
|
1834
|
+
t.role = "dimension", t.sortable = !0, t.filterable = !0, t.semanticType = Jr.test(t.id) ? "text" : "code";
|
|
1835
|
+
let e = ti(n, t.linkedColumnId);
|
|
1836
|
+
t.linkedColumnId = e && e !== t.id ? e : void 0;
|
|
1837
|
+
}
|
|
1838
|
+
for (let r of e) {
|
|
1839
|
+
if (r.role !== "dimension" || r.semanticType !== "code") continue;
|
|
1840
|
+
let i = r.linkedColumnId;
|
|
1841
|
+
if (i) {
|
|
1842
|
+
let e = t[i];
|
|
1843
|
+
!e || e.role !== "dimension" ? i = void 0 : e.semanticType = "text";
|
|
1844
|
+
}
|
|
1845
|
+
if (i ||= ni(r.id, e, n), !i && Zr(r.id) && (i = ni(r.id, e, n)), r.linkedColumnId = i, i) {
|
|
1846
|
+
let e = t[i];
|
|
1847
|
+
e && e.role === "dimension" && (e.semanticType = "text", e.linkedColumnId = r.id);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
for (let r of e) {
|
|
1851
|
+
if (r.role !== "dimension" || r.semanticType !== "text") continue;
|
|
1852
|
+
let e = r.linkedColumnId;
|
|
1853
|
+
if (e) {
|
|
1854
|
+
let n = t[e];
|
|
1855
|
+
!n || n.role !== "dimension" ? e = void 0 : n.semanticType = "code";
|
|
1856
|
+
}
|
|
1857
|
+
if (!e) {
|
|
1858
|
+
let i = ti(n, r.id.match(Jr)?.[1]);
|
|
1859
|
+
i && t[i]?.role === "dimension" && (e = i);
|
|
1860
|
+
}
|
|
1861
|
+
if (r.linkedColumnId = e, e) {
|
|
1862
|
+
let n = t[e];
|
|
1863
|
+
n && n.role === "dimension" && (n.semanticType = "code", n.linkedColumnId ||= r.id);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
return e;
|
|
1867
|
+
}
|
|
1868
|
+
function ii(e) {
|
|
1869
|
+
switch (e) {
|
|
1870
|
+
case "Edm.String": return "string";
|
|
1871
|
+
case "Edm.Guid": return "guid";
|
|
1872
|
+
case "Edm.Boolean": return "boolean";
|
|
1873
|
+
case "Edm.Int16":
|
|
1874
|
+
case "Edm.Int32": return "int";
|
|
1875
|
+
case "Edm.Int64": return "long";
|
|
1876
|
+
case "Edm.Single": return "float";
|
|
1877
|
+
case "Edm.Decimal": return "decimal";
|
|
1878
|
+
case "Edm.Double": return "double";
|
|
1879
|
+
case "Edm.DateTime": return "datetime";
|
|
1880
|
+
case "Edm.DateTimeOffset": return "datetimeOffset";
|
|
1881
|
+
case "Edm.Time": return "time";
|
|
1882
|
+
case "Edm.Binary": return "binary";
|
|
1883
|
+
case "Edm.Byte": return "byte";
|
|
1884
|
+
default: throw Error(`Неподдерживаемый тип данных ${e}`);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
function ai(e) {
|
|
1888
|
+
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "", r = ii(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;
|
|
1889
|
+
return {
|
|
1890
|
+
id: t,
|
|
1891
|
+
label: s ?? t,
|
|
1892
|
+
type: r,
|
|
1893
|
+
originalType: n,
|
|
1894
|
+
...r === "string" && i === 1 ? { abapBooleanLike: !0 } : {},
|
|
1895
|
+
...i !== void 0 && { maxLength: i },
|
|
1896
|
+
...a !== void 0 && { precision: a },
|
|
1897
|
+
...o !== void 0 && { scale: o },
|
|
1898
|
+
...c !== void 0 && { parameter: c },
|
|
1899
|
+
...l !== void 0 && { nullable: !0 },
|
|
1900
|
+
...c === "mandatory" && { mandatory: !0 }
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
function oi(e) {
|
|
1904
|
+
let t = ai(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;
|
|
1905
|
+
return {
|
|
1906
|
+
...l,
|
|
1907
|
+
...n !== void 0 && { linkedColumnId: n },
|
|
1908
|
+
...o !== void 0 && { label: o },
|
|
1909
|
+
semanticType: "none",
|
|
1910
|
+
sortable: r,
|
|
1911
|
+
filterable: i,
|
|
1912
|
+
role: a
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
function si(e) {
|
|
1916
|
+
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
1917
|
+
return !t || !ei(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
1918
|
+
}
|
|
1919
|
+
function ci(e) {
|
|
1920
|
+
let t = e.getAttribute("Name"), n = e.getAttribute("Type") || "";
|
|
1921
|
+
return !t || !ei(n) ? !1 : !(["CNT", "cnt"].includes(t) || /_F$/i.test(t));
|
|
1922
|
+
}
|
|
1923
|
+
function li(e) {
|
|
1924
|
+
return Array.from(e.getElementsByTagName("Property"));
|
|
1925
|
+
}
|
|
1926
|
+
function ui(e) {
|
|
1927
|
+
return Array.from(e.getElementsByTagName("PropertyRef"));
|
|
1928
|
+
}
|
|
1929
|
+
function di(e) {
|
|
1930
|
+
return Array.from(e.getElementsByTagName("NavigationProperty"));
|
|
1931
|
+
}
|
|
1932
|
+
function fi(e) {
|
|
1933
|
+
return li(e).filter(si).map(ai);
|
|
1934
|
+
}
|
|
1935
|
+
function pi(e) {
|
|
1936
|
+
let t = li(e).filter(si), n = ui(e);
|
|
1937
|
+
return t.map((e) => {
|
|
1938
|
+
let t = ai(e);
|
|
1939
|
+
return n.find((e) => e.getAttribute("Name") === t.id) && (t.mandatory = !0), t;
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
function mi(e) {
|
|
1943
|
+
return ri(li(e).filter(ci).map(oi));
|
|
1944
|
+
}
|
|
1945
|
+
function hi(e) {
|
|
1946
|
+
if (!e) return;
|
|
1947
|
+
let t = e.split(".");
|
|
1948
|
+
return t[t.length - 1] || void 0;
|
|
1949
|
+
}
|
|
1950
|
+
function gi(e) {
|
|
1951
|
+
let t = e.getAttribute("Mode");
|
|
1952
|
+
if (t && t !== "In") {
|
|
1953
|
+
let n = e.getAttribute("Name") || "(unknown)";
|
|
1954
|
+
throw Error(`FunctionImport parameter '${n}' uses unsupported Mode='${t}'`);
|
|
1955
|
+
}
|
|
1956
|
+
let n = e.getAttribute("Type") || "";
|
|
1957
|
+
if (!ei(n)) {
|
|
1958
|
+
let t = e.getAttribute("Name") || "(unknown)";
|
|
1959
|
+
throw Error(`FunctionImport parameter '${t}' uses unsupported Type='${n}'`);
|
|
1960
|
+
}
|
|
1961
|
+
let r = ai(e);
|
|
1962
|
+
return e.getAttribute("Nullable") === "false" && (r.mandatory = !0), r;
|
|
1963
|
+
}
|
|
1964
|
+
function _i(e) {
|
|
1965
|
+
return e.reduce((e, t) => {
|
|
1966
|
+
let n = t.getAttribute("Name");
|
|
1967
|
+
return n && (e[n] = t), e;
|
|
1968
|
+
}, {});
|
|
1969
|
+
}
|
|
1970
|
+
function vi(e) {
|
|
1971
|
+
return Array.from(e.getElementsByTagName("EntitySet")).reduce((e, t) => {
|
|
1972
|
+
let n = t.getAttribute("Name"), r = hi(t.getAttribute("EntityType"));
|
|
1973
|
+
return !n || !r || (e[n] = r), e;
|
|
1974
|
+
}, {});
|
|
1975
|
+
}
|
|
1976
|
+
function yi(e) {
|
|
1977
|
+
return Array.from(e.getElementsByTagName("AssociationSet")).reduce((e, t) => {
|
|
1978
|
+
let n = t.getAttribute("Association");
|
|
1979
|
+
if (!n) return e;
|
|
1980
|
+
let r = { ends: Array.from(t.getElementsByTagName("End")).map((e) => {
|
|
1981
|
+
let t = e.getAttribute("Role"), n = e.getAttribute("EntitySet");
|
|
1982
|
+
if (!(!t || !n)) return {
|
|
1983
|
+
role: t,
|
|
1984
|
+
entitySet: n
|
|
1985
|
+
};
|
|
1986
|
+
}).filter((e) => !!e) };
|
|
1987
|
+
e[n] = r;
|
|
1988
|
+
let i = hi(n);
|
|
1989
|
+
return i && (e[i] = r), e;
|
|
1990
|
+
}, {});
|
|
1991
|
+
}
|
|
1992
|
+
function bi(e, t) {
|
|
1993
|
+
for (let n of di(e)) {
|
|
1994
|
+
let e = n.getAttribute("Name");
|
|
1995
|
+
if (e !== "Set" && e !== "Results") continue;
|
|
1996
|
+
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;
|
|
1997
|
+
return !s && i && (s = i.ends.find((e) => e.role !== o)?.entitySet), {
|
|
1998
|
+
name: e,
|
|
1999
|
+
targetEntitySet: s
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
function xi(e, t, n) {
|
|
2004
|
+
let r = /* @__PURE__ */ new Set();
|
|
2005
|
+
for (let [i, a] of Object.entries(e)) {
|
|
2006
|
+
let e = t[a];
|
|
2007
|
+
if (!e) continue;
|
|
2008
|
+
let o = bi(e, n);
|
|
2009
|
+
o?.targetEntitySet && o.targetEntitySet !== i && r.add(o.targetEntitySet);
|
|
2010
|
+
}
|
|
2011
|
+
return r;
|
|
2012
|
+
}
|
|
2013
|
+
function Si(e, t, n, r) {
|
|
2014
|
+
let i = t?.targetEntitySet ? n[t.targetEntitySet] : void 0;
|
|
2015
|
+
return i && r[i] || e;
|
|
2016
|
+
}
|
|
2017
|
+
function Ci(e, t, n) {
|
|
2018
|
+
if (n) return fi(e);
|
|
2019
|
+
if (!t.endsWith("Type")) return pi(e);
|
|
2020
|
+
}
|
|
2021
|
+
function wi(e, t) {
|
|
2022
|
+
if (!e) return /* @__PURE__ */ new Set();
|
|
2023
|
+
let n = hi(e);
|
|
2024
|
+
if (!n) return /* @__PURE__ */ new Set();
|
|
2025
|
+
let r = t[n];
|
|
2026
|
+
return r ? new Set(ui(r).map((e) => e.getAttribute("Name")).filter((e) => !!e)) : /* @__PURE__ */ new Set();
|
|
2027
|
+
}
|
|
2028
|
+
function Ti(e, t, n) {
|
|
2029
|
+
let r = e.getAttribute("Name") || "", i = e.getAttribute("EntitySet") || void 0, a = e.getAttribute("sap:action-for") || void 0, o = wi(a, n), s = Array.from(e.getElementsByTagName("Parameter")).map((e) => {
|
|
2030
|
+
let t = gi(e);
|
|
2031
|
+
return o.has(t.id) && (t.mandatory = !0), t;
|
|
2032
|
+
});
|
|
2033
|
+
return {
|
|
2034
|
+
name: r,
|
|
2035
|
+
title: e.getAttribute("sap:label") || "",
|
|
2036
|
+
httpMethod: e.getAttribute("m:HttpMethod") || void 0,
|
|
2037
|
+
parameters: s.length ? s : void 0,
|
|
2038
|
+
returnType: e.getAttribute("ReturnType") || "",
|
|
2039
|
+
...i !== void 0 && { entitySet: i },
|
|
2040
|
+
...a !== void 0 && { actionFor: a },
|
|
2041
|
+
...i && t[i] ? { resultEntity: i } : {}
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
function Ei(e) {
|
|
2045
|
+
let t = new DOMParser().parseFromString(e, "application/xml"), n = Array.from(t.getElementsByTagName("EntityType")), r = Array.from(t.getElementsByTagName("FunctionImport")), i = vi(t), a = _i(n), o = yi(t), s = xi(i, a, o), c = {}, l = {};
|
|
2046
|
+
for (let [e, t] of Object.entries(i)) {
|
|
2047
|
+
if (s.has(e)) continue;
|
|
2048
|
+
let n = a[t];
|
|
2049
|
+
if (!n) continue;
|
|
2050
|
+
let r = bi(n, o), l = Si(n, r, i, a), u = n.getAttribute("sap:label") || l.getAttribute("sap:label") || "", d = mi(l), f = Ci(n, t, r);
|
|
2051
|
+
c[e] = {
|
|
2052
|
+
title: u,
|
|
2053
|
+
columns: d,
|
|
2054
|
+
...f?.length ? { parameters: f } : {},
|
|
2055
|
+
...r ? { result: r.name } : {}
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
for (let e of r) {
|
|
2059
|
+
let t = Ti(e, i, a);
|
|
2060
|
+
l[t.name] = t;
|
|
2061
|
+
}
|
|
2062
|
+
return {
|
|
2063
|
+
entities: c,
|
|
2064
|
+
functionImports: l
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
//#endregion
|
|
2068
|
+
//#region src/odata-service/sorts.ts
|
|
2069
|
+
function Di(e, t) {
|
|
2070
|
+
return e.findIndex((e) => e.key === t);
|
|
2071
|
+
}
|
|
2072
|
+
function Oi(e) {
|
|
2073
|
+
return e.map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`).join(",");
|
|
2074
|
+
}
|
|
2075
|
+
function ki(e, t, n) {
|
|
2076
|
+
let r = Di(e, t), i = n ? [...e] : [...e.filter((e) => e.key === t)];
|
|
2077
|
+
return r === -1 ? (i.push({ key: t }), i) : e[r].desc ? i.filter((e) => e.key !== t) : i.map((e) => e.key === t ? {
|
|
2078
|
+
key: t,
|
|
2079
|
+
desc: !0
|
|
2080
|
+
} : e);
|
|
2081
|
+
}
|
|
2082
|
+
function Ai(e, t) {
|
|
2083
|
+
return t.length > 0 ? t.map((e) => ({
|
|
2084
|
+
key: e.key,
|
|
2085
|
+
desc: e.desc
|
|
2086
|
+
})) : e.map((e) => ({ key: e }));
|
|
2087
|
+
}
|
|
2088
|
+
function ji(e, t) {
|
|
2089
|
+
let n = Ai(e, t).map((e) => `${String(e.key)} ${e.desc ? "desc" : "asc"}`);
|
|
2090
|
+
return n.length ? n.join(",") : void 0;
|
|
2091
|
+
}
|
|
2092
|
+
function Mi(e, t, n) {
|
|
2093
|
+
let r = t.length > 0, i = e.indexOf(n);
|
|
2094
|
+
if (!r && i !== -1) return {
|
|
2095
|
+
active: !0,
|
|
2096
|
+
order: i + 1,
|
|
2097
|
+
lockedByGrouping: !0
|
|
2098
|
+
};
|
|
2099
|
+
let a = t.findIndex((e) => e.key === n);
|
|
2100
|
+
return a === -1 ? { active: !1 } : {
|
|
2101
|
+
active: !0,
|
|
2102
|
+
desc: t[a]?.desc,
|
|
2103
|
+
order: a + 1
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
//#endregion
|
|
2107
|
+
//#region src/odata-service/sqlFilters.ts
|
|
2108
|
+
var Ni = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
2109
|
+
function Pi(e) {
|
|
2110
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
2111
|
+
}
|
|
2112
|
+
function Fi(e) {
|
|
2113
|
+
if (!Ni.test(e)) throw Error(`Некорректное имя поля SQL-фильтра: ${e}`);
|
|
2114
|
+
}
|
|
2115
|
+
function Ii(e, t) {
|
|
2116
|
+
return {
|
|
2117
|
+
fieldId: e,
|
|
2118
|
+
operation: "eq",
|
|
2119
|
+
value: t
|
|
2120
|
+
};
|
|
2121
|
+
}
|
|
2122
|
+
function Li(e, t) {
|
|
2123
|
+
return {
|
|
2124
|
+
fieldId: e,
|
|
2125
|
+
operation: "in",
|
|
2126
|
+
values: t
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
function Ri(e, t) {
|
|
2130
|
+
return {
|
|
2131
|
+
operation: "group",
|
|
2132
|
+
conjunction: t,
|
|
2133
|
+
expressions: e
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
function zi(e) {
|
|
2137
|
+
if (e instanceof Date) throw Error("Дата должна быть отформатирована вызывающей стороной до формирования SQL-фильтра");
|
|
2138
|
+
if (!Pi(e) || typeof e == "number" && !Number.isFinite(e)) return;
|
|
2139
|
+
let t = String(e);
|
|
2140
|
+
if (!(!t || t.trim() === "")) return `'${t.replaceAll("'", "''")}'`;
|
|
2141
|
+
}
|
|
2142
|
+
function Bi(e) {
|
|
2143
|
+
if (e.operation === "group") {
|
|
2144
|
+
let t = e.expressions.map((e) => Bi(e)).filter((e) => !!e);
|
|
2145
|
+
if (!t.length) return;
|
|
2146
|
+
let n = e.conjunction === "or" ? " OR " : " AND ";
|
|
2147
|
+
return `(${t.join(n)})`;
|
|
2148
|
+
}
|
|
2149
|
+
if (e.operation === "eq") {
|
|
2150
|
+
let t = zi(e.value);
|
|
2151
|
+
return t ? (Fi(e.fieldId), `${e.fieldId}=${t}`) : void 0;
|
|
2152
|
+
}
|
|
2153
|
+
let t = (e.values ?? []).map((e) => zi(e)).filter((e) => !!e);
|
|
2154
|
+
if (t.length !== 0) return Fi(e.fieldId), `${e.fieldId} IN (${t.join(", ")})`;
|
|
2155
|
+
}
|
|
2156
|
+
function Vi(e) {
|
|
2157
|
+
return e ? e.map((e) => Bi(e)).filter((e) => !!e).join(" AND ") : "";
|
|
2158
|
+
}
|
|
2159
|
+
//#endregion
|
|
2160
|
+
//#region src/odata-service/typesValidation.ts
|
|
2161
|
+
function Hi(e) {
|
|
2162
|
+
return e === "boolean";
|
|
2163
|
+
}
|
|
2164
|
+
function Ui(e) {
|
|
2165
|
+
return e === "byte" || e === "int" || e === "long" || e === "float" || e === "decimal" || e === "double";
|
|
2166
|
+
}
|
|
2167
|
+
function Wi(e) {
|
|
2168
|
+
return e === "byte" || e === "int" || e === "long";
|
|
2169
|
+
}
|
|
2170
|
+
function Gi(e) {
|
|
2171
|
+
return e === "datetime" || e === "datetimeOffset" || e === "time";
|
|
2172
|
+
}
|
|
2173
|
+
//#endregion
|
|
2174
|
+
//#region src/odata-service/unwrapODataQueryResult.ts
|
|
2175
|
+
function Ki(e) {
|
|
2176
|
+
let t = e.data?.data, n = e.data?.totalCount;
|
|
2177
|
+
return {
|
|
2178
|
+
...e,
|
|
2179
|
+
data: t,
|
|
2180
|
+
totalCount: n
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
//#endregion
|
|
2184
|
+
//#region src/odata-service/utils.ts
|
|
2185
|
+
function qi(e) {
|
|
2186
|
+
return Array.isArray(e) ? [e[0] ?? null, e[1] ?? null] : [Yi(e) ? e ?? null : null, null];
|
|
2187
|
+
}
|
|
2188
|
+
function Ji(t) {
|
|
2189
|
+
return t instanceof Date ? t : Array.isArray(t) || e(t) ? null : t;
|
|
2190
|
+
}
|
|
2191
|
+
function Yi(e) {
|
|
2192
|
+
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
2193
|
+
}
|
|
2194
|
+
//#endregion
|
|
2195
|
+
//#region src/odata-service/wrapParams.ts
|
|
2196
|
+
function Xi(e) {
|
|
2197
|
+
if (!e) return {};
|
|
2198
|
+
let t = {};
|
|
2199
|
+
for (let n in e) t[n] = { value: e[n] };
|
|
2200
|
+
return t;
|
|
2201
|
+
}
|
|
2202
|
+
function Zi(e) {
|
|
2203
|
+
if (!e) return;
|
|
2204
|
+
let t = {};
|
|
2205
|
+
for (let n of Object.keys(e).sort()) t[n] = e[n]?.value ?? null;
|
|
2206
|
+
return t;
|
|
2207
|
+
}
|
|
2208
|
+
//#endregion
|
|
2209
|
+
export { pr as $, $t, Kr as A, s as An, j as At, q as B, A as Bt, Yr as C, Te as Cn, Fn as Ct, Xr as D, Me as Dn, kn as Dt, Ei as E, je as En, jn as Et, Ir as F, o as Fn, Tn as Ft, lr as G, Wt as Gt, Y as H, pn as Ht, Mr as I, yn as It, B as J, Jt, yr as K, Xt as Kt, jr as L, vn as Lt, Wr as M, l as Mn, xn as Mt, Gr as N, u as Nn, Cn as Nt, qr as O, Oe as On, On as Ot, Tr as P, a as Pn, wn as Pt, Sr as Q, on as Qt, Ar as R, _n as Rt, ki as S, S as Sn, Mn as St, Zr as T, Ee as Tn, An as Tt, X as U, dn as Ut, J as V, fn as Vt, ur as W, un as Wt, Cr as X, cn as Xt, xr as Y, Gt as Yt, V as Z, sn as Zt, Oi as _, k as _n, Yn as _t, qi as a, hn as an, nr as at, Mi as b, re as bn, Xn as bt, Gi as c, an as cn, ar as ct, Fi as d, nn as dn, L as dt, Qt as en, wr as et, Vi as f, ln as fn, F as ft, Pi as g, Rt as gn, Ln as gt, Li as h, jt as hn, Rn as ht, Ji as i, mn as in, ir as it, Lr as j, c as jn, Dn as jt, $ as k, Ae as kn, M as kt, Wi as l, rn as ln, tr as lt, Ri as m, Nt as mn, zn as mt, Xi as n, tn as nn, sr as nt, Ki as o, gn as on, or as ot, Ii as p, Lt as pn, Bn as pt, br as q, Yt as qt, Yi as r, en as rn, cr as rt, Hi as s, Kt as sn, rr as st, Zi as t, Zt as tn, mr as tt, Ui as u, qt as un, I as ut, ji as v, Ft as vn, Qn as vt, Qr as w, De as wn, In as wt, Ai as x, y as xn, Zn as xt, Di as y, v as yn, $n as yt, Fr as z, bn as zt };
|
|
2210
|
+
|
|
2211
|
+
//# sourceMappingURL=odata-service-CWkHASdw.js.map
|