@ryuzaki13/react-foundation-ui 1.0.3 → 1.0.4
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/advanced-search/index.js +90 -89
- package/dist/advanced-search/index.js.map +1 -1
- package/dist/chunks/multi-select-BYsbh2ca.js +126 -0
- package/dist/chunks/multi-select-BYsbh2ca.js.map +1 -0
- package/dist/chunks/{multi-select-BzYIviCU.js → odata-DSW7z3nh.js} +373 -569
- package/dist/chunks/odata-DSW7z3nh.js.map +1 -0
- package/dist/chunks/select-BT65bQ8J.js +81 -0
- package/dist/chunks/select-BT65bQ8J.js.map +1 -0
- package/dist/chunks/useODataSelectBase-BbeKdq6x.js +125 -0
- package/dist/chunks/useODataSelectBase-BbeKdq6x.js.map +1 -0
- package/dist/multi-select/index.js +3 -3
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +3 -2
- package/dist/styles.css +1 -1
- package/dist/tree-select/index.d.ts +2 -0
- package/dist/tree-select/index.d.ts.map +1 -1
- package/dist/tree-select/index.js +173 -4
- package/dist/tree-select/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/multi-select-BzYIviCU.js.map +0 -1
|
@@ -1,92 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { buildEntityOperationPath as y, buildEntityPath as b, buildFunctionImportPath as x, buildODataFilter as S, buildODataOrder as C, odataParseValueByMetadata as w, parseServiceMetadata as T } from "@ryuzaki13/react-foundation-lib/odata-service";
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import { logError as a } from "@ryuzaki13/react-foundation-lib/utils";
|
|
3
|
+
import { asRecord as o, isRecord as s, isSafe as c } from "@ryuzaki13/react-foundation-lib/validators";
|
|
4
|
+
import { reportTransportError as l } from "@ryuzaki13/react-foundation-lib/error-report";
|
|
5
|
+
import { formatDateAsODataDatetime as u, parseDate as d, truncateText as f } from "@ryuzaki13/react-foundation-lib/formatters";
|
|
6
|
+
import { queryOptions as p, useQuery as m, useQueryClient as h } from "@tanstack/react-query";
|
|
7
|
+
import { persistedQueryMeta as g } from "@ryuzaki13/react-foundation-lib/query-client";
|
|
8
|
+
import { buildEntityOperationPath as _, buildEntityPath as v, buildFunctionImportPath as y, buildODataFilter as b, buildODataOrder as x, odataParseValueByMetadata as S, parseServiceMetadata as C } from "@ryuzaki13/react-foundation-lib/odata-service";
|
|
10
9
|
import "@ryuzaki13/react-foundation-lib/string-comparison";
|
|
11
|
-
import { buildSeparatedArrays as
|
|
12
|
-
import { createTableColumnVisibilityFromODataMetadata as
|
|
10
|
+
import { buildSeparatedArrays as ee, useODataCollectionStore as w } from "@ryuzaki13/react-foundation-lib/odata";
|
|
11
|
+
import { createTableColumnVisibilityFromODataMetadata as T, createTableColumnsFromODataMetadata as te, enrichTableColumnsWithODataFormatting as ne, resolveStableColumnId as re } from "@ryuzaki13/react-foundation-lib/table";
|
|
13
12
|
import "@ryuzaki13/react-foundation-lib/notifications";
|
|
14
|
-
import { jsx as j } from "react/jsx-runtime";
|
|
15
13
|
//#region node_modules/@ryuzaki13/react-foundation-api/dist/chunks/fetch-CPEFkAcU.js
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
return
|
|
14
|
+
var E = {};
|
|
15
|
+
function D() {
|
|
16
|
+
return E;
|
|
19
17
|
}
|
|
20
|
-
function
|
|
18
|
+
function O(e) {
|
|
21
19
|
return e.split(";")[0] ?? e;
|
|
22
20
|
}
|
|
23
|
-
function
|
|
24
|
-
let n =
|
|
25
|
-
return (__DEV__ || __PREVIEW__) && n &&
|
|
21
|
+
function k(e, t) {
|
|
22
|
+
let n = E.devDp0Service;
|
|
23
|
+
return (__DEV__ || __PREVIEW__) && n && O(e) === O(n) ? "odataDp0" : t ?? "odata";
|
|
26
24
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
25
|
+
function ie() {
|
|
26
|
+
return E.resolveSapClient?.() ?? null;
|
|
29
27
|
}
|
|
30
|
-
var
|
|
28
|
+
var ae = "/sap/opu/odata/sap", oe = __DEV__ || __PREVIEW__ ? "/sap-dp0/opu/odata/sap" : "/sap/opu/odata/sap", se = __DEV__ || __PREVIEW__ ? "/sap-dp0/opu/odata/UI2" : "/sap/opu/odata/UI2", ce = __BASE_APP_CONFIG_URL__, A = Object.freeze({
|
|
31
29
|
"": "",
|
|
32
|
-
odata:
|
|
33
|
-
odataDp0:
|
|
34
|
-
odataUi2:
|
|
35
|
-
config:
|
|
30
|
+
odata: ae,
|
|
31
|
+
odataDp0: oe,
|
|
32
|
+
odataUi2: se,
|
|
33
|
+
config: ce
|
|
36
34
|
});
|
|
37
|
-
function
|
|
35
|
+
function j(e) {
|
|
38
36
|
return typeof e == "string" ? e : typeof Request < "u" && e instanceof Request ? e.url : e.toString();
|
|
39
37
|
}
|
|
40
|
-
function
|
|
38
|
+
function M(e) {
|
|
41
39
|
let t = e.split("?")[0]?.split("#")[0] ?? "";
|
|
42
40
|
return t ? t.startsWith("/") ? t : `/${t}` : "/";
|
|
43
41
|
}
|
|
44
|
-
var
|
|
45
|
-
function
|
|
42
|
+
var le = 40, ue = 1e3;
|
|
43
|
+
function de(e) {
|
|
46
44
|
try {
|
|
47
45
|
let t = typeof window < "u" ? window.location.origin : "http://localhost", n = new URL(e, t);
|
|
48
46
|
return `${n.origin === t ? "" : n.origin}${n.pathname}`;
|
|
49
47
|
} catch {
|
|
50
|
-
return
|
|
48
|
+
return M(e);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
|
-
function
|
|
51
|
+
function fe(e) {
|
|
54
52
|
if (!(typeof DOMParser > "u")) try {
|
|
55
53
|
return new DOMParser().parseFromString(e, "text/html");
|
|
56
54
|
} catch {
|
|
57
55
|
return;
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
|
-
function
|
|
58
|
+
function pe(e, t) {
|
|
61
59
|
return t?.querySelector("title")?.textContent || /<title[^>]*>([\s\S]*?)<\/title>/i.exec(e)?.[1];
|
|
62
60
|
}
|
|
63
|
-
function
|
|
61
|
+
function me(e, t) {
|
|
64
62
|
let n = t?.querySelectorAll("form").length;
|
|
65
63
|
return n === void 0 ? Array.from(e.matchAll(/<form\b/gi)).length : n;
|
|
66
64
|
}
|
|
67
|
-
function
|
|
65
|
+
function he(e, t) {
|
|
68
66
|
let n = t ? Array.from(t.querySelectorAll("input[name],textarea[name],select[name]")).map((e) => e.name).filter(Boolean) : Array.from(e.matchAll(/\bname\s*=\s*["']([^"']+)["']/gi)).map((e) => e[1]).filter((e) => !!e);
|
|
69
|
-
return Array.from(new Set(n)).slice(0,
|
|
67
|
+
return Array.from(new Set(n)).slice(0, le);
|
|
70
68
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
69
|
+
function ge(e, t) {
|
|
70
|
+
return f(t?.body?.textContent ?? e.replace(/<script\b[\s\S]*?<\/script>/gi, " ").replace(/<style\b[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " "), ue);
|
|
73
71
|
}
|
|
74
|
-
function
|
|
75
|
-
let t =
|
|
72
|
+
function _e(e) {
|
|
73
|
+
let t = fe(e);
|
|
76
74
|
return {
|
|
77
75
|
length: e.length,
|
|
78
|
-
title:
|
|
79
|
-
formCount:
|
|
80
|
-
inputNames:
|
|
81
|
-
textPreview:
|
|
76
|
+
title: f(pe(e, t), 200),
|
|
77
|
+
formCount: me(e, t),
|
|
78
|
+
inputNames: he(e, t),
|
|
79
|
+
textPreview: ge(e, t)
|
|
82
80
|
};
|
|
83
81
|
}
|
|
84
|
-
function
|
|
85
|
-
let a = i ?
|
|
86
|
-
|
|
82
|
+
function ve(e, t, n, r, i) {
|
|
83
|
+
let a = i ? j(i.input) : void 0, o = a?.startsWith("http") ? a : a ? `${A[i?.baseUrlType ?? ""]}${a}` : void 0;
|
|
84
|
+
l(e, {
|
|
87
85
|
source: t,
|
|
88
|
-
requestUrl: o ?
|
|
89
|
-
responseUrl: n.url ?
|
|
86
|
+
requestUrl: o ? de(o) : void 0,
|
|
87
|
+
responseUrl: n.url ? de(n.url) : void 0,
|
|
90
88
|
method: i?.init.method?.toUpperCase() ?? "GET",
|
|
91
89
|
baseUrlType: i?.baseUrlType,
|
|
92
90
|
sapClient: i?.sapClient,
|
|
@@ -95,11 +93,11 @@ function ge(e, t, n, r, i) {
|
|
|
95
93
|
contentType: n.headers.get("Content-Type") || void 0,
|
|
96
94
|
redirected: n.redirected,
|
|
97
95
|
responseType: n.type,
|
|
98
|
-
html:
|
|
96
|
+
html: _e(r)
|
|
99
97
|
});
|
|
100
98
|
}
|
|
101
|
-
var
|
|
102
|
-
function
|
|
99
|
+
var N = null, ye = 0;
|
|
100
|
+
function be(e) {
|
|
103
101
|
if (typeof window > "u") return e;
|
|
104
102
|
try {
|
|
105
103
|
let t = new RegExp(__ORIGIN_REG_EXP__, "i"), n = new URL(e, window.location.origin), r = t.test(n.origin), i = n.origin === __SSO_ORIGIN__;
|
|
@@ -108,14 +106,14 @@ function ve(e) {
|
|
|
108
106
|
return e;
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
|
-
function
|
|
109
|
+
function P(e) {
|
|
112
110
|
return e ? typeof e.inputs.SAMLRequest == "string" || typeof e.inputs.SAMLResponse == "string" : !1;
|
|
113
111
|
}
|
|
114
|
-
function
|
|
115
|
-
let e = `${__APP_ID__}-sso-iframe-${++
|
|
112
|
+
function xe() {
|
|
113
|
+
let e = `${__APP_ID__}-sso-iframe-${++ye}`, t = document.createElement("iframe");
|
|
116
114
|
return t.name = e, t.style.display = "none", t;
|
|
117
115
|
}
|
|
118
|
-
function
|
|
116
|
+
function Se(e, t) {
|
|
119
117
|
return new Promise((n) => {
|
|
120
118
|
let r = null, i = () => {
|
|
121
119
|
r !== null && window.clearTimeout(r), r = window.setTimeout(() => {
|
|
@@ -125,90 +123,90 @@ function be(e, t) {
|
|
|
125
123
|
e.addEventListener("load", i), e.addEventListener("error", i);
|
|
126
124
|
});
|
|
127
125
|
}
|
|
128
|
-
function
|
|
126
|
+
function Ce(e, t) {
|
|
129
127
|
let n = document.createElement("form");
|
|
130
|
-
n.method = e.method === "GET" ? "GET" : "POST", n.action =
|
|
128
|
+
n.method = e.method === "GET" ? "GET" : "POST", n.action = be(e.action), n.target = t, n.style.display = "none";
|
|
131
129
|
for (let [t, r] of Object.entries(e.inputs)) {
|
|
132
130
|
let e = document.createElement("input");
|
|
133
131
|
e.type = "hidden", e.name = t, e.value = r, n.appendChild(e);
|
|
134
132
|
}
|
|
135
133
|
return n;
|
|
136
134
|
}
|
|
137
|
-
function
|
|
135
|
+
function we() {
|
|
138
136
|
return typeof document > "u" ? null : document.body ?? document.documentElement;
|
|
139
137
|
}
|
|
140
|
-
function
|
|
141
|
-
let t =
|
|
138
|
+
function Te(e) {
|
|
139
|
+
let t = we();
|
|
142
140
|
if (!t) return Promise.resolve(!1);
|
|
143
|
-
let n =
|
|
141
|
+
let n = xe(), r = Ce(e, n.name), i = Se(n, () => {
|
|
144
142
|
n.remove(), r.remove();
|
|
145
143
|
});
|
|
146
144
|
return t.appendChild(n), t.appendChild(r), r.submit(), i;
|
|
147
145
|
}
|
|
148
|
-
function
|
|
149
|
-
let t =
|
|
146
|
+
function Ee(e) {
|
|
147
|
+
let t = we();
|
|
150
148
|
if (!t) return Promise.resolve(!1);
|
|
151
|
-
let n =
|
|
149
|
+
let n = xe(), r = Se(n, () => {
|
|
152
150
|
n.remove();
|
|
153
151
|
});
|
|
154
|
-
return t.appendChild(n), n.src =
|
|
152
|
+
return t.appendChild(n), n.src = be(e), r;
|
|
155
153
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
}),
|
|
154
|
+
function De({ form: e, recoveryUrl: t } = {}) {
|
|
155
|
+
return N || (typeof window > "u" ? !1 : (N = (async () => P(e) ? Te(e) : t ? Ee(t) : !1)().finally(() => {
|
|
156
|
+
N = null;
|
|
157
|
+
}), N));
|
|
160
158
|
}
|
|
161
|
-
var
|
|
159
|
+
var F = class e extends Error {
|
|
162
160
|
form;
|
|
163
161
|
recoveryUrl;
|
|
164
162
|
recoverable;
|
|
165
163
|
constructor(t, n, r, i = {}) {
|
|
166
164
|
super(t), this.form = n, this.recoveryUrl = r, this.recoverable = i.recoverable ?? !0, Object.setPrototypeOf(this, e.prototype);
|
|
167
165
|
}
|
|
168
|
-
},
|
|
169
|
-
function
|
|
166
|
+
}, I = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map(), R = null, z = null;
|
|
167
|
+
function B(e, t) {
|
|
170
168
|
if (t !== "") return !0;
|
|
171
|
-
let n =
|
|
169
|
+
let n = M(j(e));
|
|
172
170
|
return n.startsWith("/sap/") || n.startsWith("/sap-dp0/");
|
|
173
171
|
}
|
|
174
|
-
function
|
|
175
|
-
return __DEV__ || __PREVIEW__ ?
|
|
172
|
+
function V(e, t) {
|
|
173
|
+
return __DEV__ || __PREVIEW__ ? B(e, t) ? t === "odataDp0" || t === "" && M(j(e)).startsWith("/sap-dp0/") ? "300" : `${__SAP_CLIENT__}` : null : ie();
|
|
176
174
|
}
|
|
177
|
-
function
|
|
178
|
-
return new
|
|
175
|
+
function Oe(e) {
|
|
176
|
+
return new F("Не удалось автоматически восстановить SSO-сессию. Перезагрузите страницу и выполните вход заново.", e.form, e.recoveryUrl, { recoverable: !1 });
|
|
179
177
|
}
|
|
180
|
-
function
|
|
181
|
-
let t =
|
|
182
|
-
return typeof window < "u" && (
|
|
178
|
+
function H(e) {
|
|
179
|
+
let t = Oe(e);
|
|
180
|
+
return typeof window < "u" && (z = t), t;
|
|
183
181
|
}
|
|
184
|
-
async function
|
|
185
|
-
let e =
|
|
186
|
-
if (e && await e.catch(() => {}),
|
|
182
|
+
async function ke() {
|
|
183
|
+
let e = R;
|
|
184
|
+
if (e && await e.catch(() => {}), z) throw z;
|
|
187
185
|
}
|
|
188
|
-
async function
|
|
189
|
-
if (
|
|
186
|
+
async function U(e, t) {
|
|
187
|
+
if (z) throw z;
|
|
190
188
|
let n;
|
|
191
|
-
if (!
|
|
192
|
-
if (
|
|
193
|
-
if (!await Promise.resolve(
|
|
189
|
+
if (!R) {
|
|
190
|
+
if (R = (async () => {
|
|
191
|
+
if (!await Promise.resolve(De({
|
|
194
192
|
form: e.form,
|
|
195
193
|
recoveryUrl: e.recoveryUrl
|
|
196
|
-
})).catch(() => !1)) throw
|
|
194
|
+
})).catch(() => !1)) throw H(e);
|
|
197
195
|
try {
|
|
198
|
-
n = { value: await t() },
|
|
196
|
+
n = { value: await t() }, z = null;
|
|
199
197
|
} catch (e) {
|
|
200
|
-
throw e instanceof
|
|
198
|
+
throw e instanceof F ? H(e) : e;
|
|
201
199
|
}
|
|
202
200
|
})().finally(() => {
|
|
203
|
-
|
|
204
|
-
}), await
|
|
201
|
+
R = null;
|
|
202
|
+
}), await R, !n) throw z ?? Oe(e);
|
|
205
203
|
return n.value;
|
|
206
204
|
}
|
|
207
|
-
await
|
|
205
|
+
await ke();
|
|
208
206
|
try {
|
|
209
207
|
return await t();
|
|
210
208
|
} catch (e) {
|
|
211
|
-
throw e instanceof
|
|
209
|
+
throw e instanceof F ? H(e) : e;
|
|
212
210
|
}
|
|
213
211
|
}
|
|
214
212
|
function Ae(e, t, n) {
|
|
@@ -216,7 +214,7 @@ function Ae(e, t, n) {
|
|
|
216
214
|
cacheKey: `${__APP_ID__}:${n ?? ""}`,
|
|
217
215
|
fetchUrl: "/Statistics"
|
|
218
216
|
};
|
|
219
|
-
let [r] =
|
|
217
|
+
let [r] = M(j(e)).split("/").filter(Boolean);
|
|
220
218
|
if (!r) throw Error("Не удалось определить сервис для получения CSRF-токена");
|
|
221
219
|
return {
|
|
222
220
|
cacheKey: `${t}:${n ?? ""}:${r}`,
|
|
@@ -224,36 +222,36 @@ function Ae(e, t, n) {
|
|
|
224
222
|
};
|
|
225
223
|
}
|
|
226
224
|
async function je(e, t, n) {
|
|
227
|
-
let r = Ae(e, t, n), i =
|
|
225
|
+
let r = Ae(e, t, n), i = I.get(r.cacheKey);
|
|
228
226
|
if (i) return i;
|
|
229
|
-
let a =
|
|
227
|
+
let a = L.get(r.cacheKey);
|
|
230
228
|
if (a) return a;
|
|
231
229
|
let o = new Headers({ "x-csrf-token": "Fetch" });
|
|
232
230
|
o.set("sap-language", "ru"), o.set("sap-contextid-accept", "header"), o.set("Accept-Language", "ru"), n && o.set("sap-client", n);
|
|
233
|
-
let s = (t &&
|
|
231
|
+
let s = (t && A[t]) ?? "", c = fetch(s + r.fetchUrl, {
|
|
234
232
|
method: "GET",
|
|
235
233
|
headers: o,
|
|
236
234
|
credentials: "include",
|
|
237
235
|
redirect: "manual"
|
|
238
236
|
}).then(async (e) => {
|
|
239
|
-
if (He(e)) throw new
|
|
237
|
+
if (He(e)) throw new F("Требуется повторная аутентификация", void 0, s + r.fetchUrl);
|
|
240
238
|
if (!e.ok) throw Error("Не удалось получить CSRF-токен");
|
|
241
239
|
let t = e.headers.get("x-csrf-token");
|
|
242
240
|
if (!t) {
|
|
243
241
|
let t = (e.headers.get("Content-Type") || "").toLowerCase(), n = await e.text();
|
|
244
242
|
if (Ne(t, n)) {
|
|
245
243
|
let e = Me(n);
|
|
246
|
-
if (
|
|
244
|
+
if (P(e)) throw new F("Требуется повторная аутентификация", e, s + r.fetchUrl);
|
|
247
245
|
}
|
|
248
246
|
throw Error("CSRF-токен отсутствует в ответе");
|
|
249
247
|
}
|
|
250
|
-
return
|
|
248
|
+
return I.set(r.cacheKey, t), L.delete(r.cacheKey), t;
|
|
251
249
|
}).catch((e) => {
|
|
252
|
-
throw
|
|
250
|
+
throw L.delete(r.cacheKey), e;
|
|
253
251
|
});
|
|
254
|
-
return
|
|
252
|
+
return L.set(r.cacheKey, c), c;
|
|
255
253
|
}
|
|
256
|
-
function
|
|
254
|
+
function W(e, t) {
|
|
257
255
|
let n = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
258
256
|
return RegExp(`${n}\\s*=\\s*["']([^"']*)["']`, "i").exec(e)?.[1];
|
|
259
257
|
}
|
|
@@ -275,10 +273,10 @@ function Me(e) {
|
|
|
275
273
|
} catch {}
|
|
276
274
|
let t = /<form\b([^>]*)>([\s\S]*?)<\/form>/i.exec(e);
|
|
277
275
|
if (!t) return;
|
|
278
|
-
let [, n = "", r = ""] = t, i =
|
|
276
|
+
let [, n = "", r = ""] = t, i = W(n, "action") || (typeof window < "u" ? window.location.href : ""), a = (W(n, "method") || "GET").toUpperCase(), o = {};
|
|
279
277
|
for (let e of r.matchAll(/<input\b([^>]*)>/gi)) {
|
|
280
|
-
let t = e[1] ?? "", n =
|
|
281
|
-
n && (o[n] =
|
|
278
|
+
let t = e[1] ?? "", n = W(t, "name");
|
|
279
|
+
n && (o[n] = W(t, "value") ?? "");
|
|
282
280
|
}
|
|
283
281
|
return {
|
|
284
282
|
action: i,
|
|
@@ -290,19 +288,19 @@ function Ne(e, t) {
|
|
|
290
288
|
return e.includes("text/html") || /<html/i.test(t) || /<form/i.test(t);
|
|
291
289
|
}
|
|
292
290
|
function Pe(e) {
|
|
293
|
-
if (!
|
|
291
|
+
if (!s(e)) return e;
|
|
294
292
|
let t = { ...e };
|
|
295
293
|
return delete t.__metadata, t;
|
|
296
294
|
}
|
|
297
295
|
function Fe(e) {
|
|
298
|
-
if (
|
|
296
|
+
if (s(e) && s(e.d) && Array.isArray(e.d.results)) {
|
|
299
297
|
let t;
|
|
300
298
|
return e.d.__count && (t = Number(e.d.__count)), {
|
|
301
299
|
data: e.d.results.map(Pe),
|
|
302
300
|
totalCount: t
|
|
303
301
|
};
|
|
304
302
|
}
|
|
305
|
-
return
|
|
303
|
+
return s(e) && e.d !== void 0 ? { data: Pe(e.d) } : { data: e };
|
|
306
304
|
}
|
|
307
305
|
var Ie = Object.freeze({ __noContent: !0 });
|
|
308
306
|
function Le(e) {
|
|
@@ -315,14 +313,14 @@ async function Re(e, t) {
|
|
|
315
313
|
let r = await e.text();
|
|
316
314
|
if (Ne(n, r)) {
|
|
317
315
|
let n = Me(r);
|
|
318
|
-
if (
|
|
316
|
+
if (P(n)) throw new F("Требуется повторная аутентификация", n);
|
|
319
317
|
let i = /* @__PURE__ */ Error("Unexpected HTML response from OData endpoint");
|
|
320
|
-
throw
|
|
318
|
+
throw ve(i, "fetch.parseResponse", e, r, t), i;
|
|
321
319
|
}
|
|
322
320
|
try {
|
|
323
321
|
return Fe(JSON.parse(r));
|
|
324
322
|
} catch (e) {
|
|
325
|
-
throw
|
|
323
|
+
throw a(e), Error("Unsupported response content type and body is not JSON");
|
|
326
324
|
}
|
|
327
325
|
}
|
|
328
326
|
function ze(e) {
|
|
@@ -330,15 +328,15 @@ function ze(e) {
|
|
|
330
328
|
let t = e.trim();
|
|
331
329
|
return t.length ? t : null;
|
|
332
330
|
}
|
|
333
|
-
function
|
|
331
|
+
function G(e, t) {
|
|
334
332
|
let n = ze(t);
|
|
335
333
|
!n || e.includes(n) || e.push(n);
|
|
336
334
|
}
|
|
337
335
|
function Be(e) {
|
|
338
336
|
let t = [], n = e.error;
|
|
339
|
-
typeof n == "string" &&
|
|
340
|
-
let r =
|
|
341
|
-
return r && (
|
|
337
|
+
typeof n == "string" && G(t, n);
|
|
338
|
+
let r = o(n);
|
|
339
|
+
return r && (G(t, r.code), G(t, o(r.message)?.value ?? r.message)), G(t, e.details), G(t, e.message), t;
|
|
342
340
|
}
|
|
343
341
|
async function Ve(e, t) {
|
|
344
342
|
let n = (e.headers.get("Content-Type") || "").toLowerCase();
|
|
@@ -351,9 +349,9 @@ async function Ve(e, t) {
|
|
|
351
349
|
if (r) {
|
|
352
350
|
if (Ne(n, r)) {
|
|
353
351
|
let n = Me(r);
|
|
354
|
-
if (
|
|
352
|
+
if (P(n)) return new F("Требуется повторная аутентификация", n);
|
|
355
353
|
let i = /* @__PURE__ */ Error("Unexpected HTML response from OData endpoint");
|
|
356
|
-
return
|
|
354
|
+
return ve(i, "fetch.buildHttpError", e, r, t), i;
|
|
357
355
|
}
|
|
358
356
|
return Error(r);
|
|
359
357
|
}
|
|
@@ -365,34 +363,34 @@ function He(e) {
|
|
|
365
363
|
return e.type === "opaqueredirect";
|
|
366
364
|
}
|
|
367
365
|
async function Ue(e, t = {}, n = "odata") {
|
|
368
|
-
let r = t.method?.toUpperCase() || "GET", i = new Headers(t.headers), a = !["GET", "HEAD"].includes(r), o =
|
|
369
|
-
if (i.set("sap-language", "ru"), s && (i.set("sap-language", "ru"), i.set("sap-contextid-accept", "header")),
|
|
370
|
-
let t = await je(e, n,
|
|
366
|
+
let r = t.method?.toUpperCase() || "GET", i = new Headers(t.headers), a = !["GET", "HEAD"].includes(r), o = c(t.body), s = B(e, n), l = V(e, n);
|
|
367
|
+
if (i.set("sap-language", "ru"), s && (i.set("sap-language", "ru"), i.set("sap-contextid-accept", "header")), l && i.set("sap-client", l), a && s) {
|
|
368
|
+
let t = await je(e, n, l);
|
|
371
369
|
i.set("x-csrf-token", t);
|
|
372
370
|
}
|
|
373
371
|
i.has("Accept") || i.set("Accept", "application/json"), o && a && !i.has("Content-Type") && i.set("Content-Type", "application/json");
|
|
374
|
-
let u = (n &&
|
|
372
|
+
let u = (n && A[n]) ?? "", d = typeof e == "string" ? e : e.toString(), f = await fetch(u + d, {
|
|
375
373
|
...t,
|
|
376
374
|
headers: i,
|
|
377
375
|
credentials: "include",
|
|
378
376
|
redirect: s ? "manual" : t.redirect
|
|
379
377
|
});
|
|
380
|
-
if (s && He(f)) throw new
|
|
378
|
+
if (s && He(f)) throw new F("Требуется повторная аутентификация", void 0, u + d);
|
|
381
379
|
if ((f.status === 401 || f.status === 403) && a && s && !t.retried) {
|
|
382
|
-
let r = Ae(e, n,
|
|
383
|
-
|
|
384
|
-
let a = await je(e, n,
|
|
380
|
+
let r = Ae(e, n, l);
|
|
381
|
+
I.delete(r.cacheKey), L.delete(r.cacheKey);
|
|
382
|
+
let a = await je(e, n, l), o = new Headers(i);
|
|
385
383
|
if (o.set("x-csrf-token", a), f = await fetch(u + d, {
|
|
386
384
|
...t,
|
|
387
385
|
headers: o,
|
|
388
386
|
credentials: "include",
|
|
389
387
|
redirect: "manual",
|
|
390
388
|
retried: !0
|
|
391
|
-
}), He(f)) throw new
|
|
389
|
+
}), He(f)) throw new F("Требуется повторная аутентификация", void 0, u + d);
|
|
392
390
|
}
|
|
393
391
|
return f;
|
|
394
392
|
}
|
|
395
|
-
async function
|
|
393
|
+
async function K(e, t, n, r, i) {
|
|
396
394
|
if (!e.ok) throw e.status === 0 ? Error("Ошибка сети или CORS. Проверьте подключение и настройки сервера.") : await Ve(e, {
|
|
397
395
|
input: t,
|
|
398
396
|
init: n,
|
|
@@ -401,31 +399,31 @@ async function We(e, t, n, r, i) {
|
|
|
401
399
|
});
|
|
402
400
|
return e;
|
|
403
401
|
}
|
|
404
|
-
async function
|
|
405
|
-
let r =
|
|
406
|
-
return
|
|
402
|
+
async function We(e, t = {}, n = "odata") {
|
|
403
|
+
let r = V(e, n);
|
|
404
|
+
return K(await Ue(e, t, n), e, t, n, r);
|
|
407
405
|
}
|
|
408
|
-
async function
|
|
409
|
-
let r =
|
|
406
|
+
async function Ge(e, t = {}, n = "odata") {
|
|
407
|
+
let r = B(e, n), i = V(e, n), a = () => We(e, {
|
|
410
408
|
...t,
|
|
411
409
|
ssoRetried: !0
|
|
412
410
|
}, n);
|
|
413
|
-
r && await
|
|
411
|
+
r && await ke();
|
|
414
412
|
let o;
|
|
415
413
|
try {
|
|
416
414
|
o = await Ue(e, t, n);
|
|
417
415
|
} catch (e) {
|
|
418
|
-
if (r && e instanceof
|
|
416
|
+
if (r && e instanceof F && e.recoverable && !t.ssoRetried) o = await U(e, a);
|
|
419
417
|
else throw e;
|
|
420
418
|
}
|
|
421
419
|
try {
|
|
422
|
-
return await
|
|
420
|
+
return await K(o, e, t, n, i);
|
|
423
421
|
} catch (o) {
|
|
424
|
-
if (r && o instanceof
|
|
422
|
+
if (r && o instanceof F && o.recoverable && !t.ssoRetried) return K(await U(o, a), e, t, n, i);
|
|
425
423
|
throw o;
|
|
426
424
|
}
|
|
427
425
|
}
|
|
428
|
-
async function
|
|
426
|
+
async function Ke(e, t = {}, n = "odata") {
|
|
429
427
|
let r = new Headers(t.headers);
|
|
430
428
|
r.set("DataServiceVersion", "2.0"), r.set("MaxDataServiceVersion", "2.0");
|
|
431
429
|
let i = {
|
|
@@ -435,27 +433,27 @@ async function qe(e, t = {}, n = "odata") {
|
|
|
435
433
|
input: e,
|
|
436
434
|
init: t,
|
|
437
435
|
baseUrlType: n,
|
|
438
|
-
sapClient:
|
|
436
|
+
sapClient: V(e, n)
|
|
439
437
|
};
|
|
440
438
|
try {
|
|
441
|
-
return await Re(await
|
|
439
|
+
return await Re(await Ge(e, i, n), a);
|
|
442
440
|
} catch (r) {
|
|
443
|
-
if (
|
|
441
|
+
if (B(e, n) && r instanceof F && r.recoverable && !t.ssoRetried) return U(r, async () => {
|
|
444
442
|
let t = {
|
|
445
443
|
...i,
|
|
446
444
|
ssoRetried: !0
|
|
447
445
|
};
|
|
448
|
-
return Re(await
|
|
446
|
+
return Re(await We(e, t, n), {
|
|
449
447
|
input: e,
|
|
450
448
|
init: t,
|
|
451
449
|
baseUrlType: n,
|
|
452
|
-
sapClient:
|
|
450
|
+
sapClient: V(e, n)
|
|
453
451
|
});
|
|
454
452
|
});
|
|
455
453
|
throw r;
|
|
456
454
|
}
|
|
457
455
|
}
|
|
458
|
-
function
|
|
456
|
+
function qe(e, t) {
|
|
459
457
|
let n = t.init || {}, r = t.baseUrl, i = t.transform;
|
|
460
458
|
if (t.swCache) {
|
|
461
459
|
let e = new Headers(n.headers);
|
|
@@ -463,24 +461,24 @@ function Je(e, t) {
|
|
|
463
461
|
}
|
|
464
462
|
return async (t) => {
|
|
465
463
|
!n.signal && t?.signal && (n.signal = t.signal);
|
|
466
|
-
let a = await
|
|
464
|
+
let a = await Ge(e, n, r);
|
|
467
465
|
if (typeof i != "function") throw Error("fetchQueryFn requires a transformation function!");
|
|
468
466
|
return await i(a);
|
|
469
467
|
};
|
|
470
468
|
}
|
|
471
469
|
//#endregion
|
|
472
470
|
//#region node_modules/@ryuzaki13/react-foundation-api/dist/chunks/odataFetchFn-D8PGKDZM.js
|
|
473
|
-
var
|
|
474
|
-
function
|
|
471
|
+
var q = ["odata"];
|
|
472
|
+
function J(e, t, n) {
|
|
475
473
|
n === void 0 || n === "" || e.set(t, String(n));
|
|
476
474
|
}
|
|
477
|
-
function
|
|
475
|
+
function Je(e, t = {}, n = {}) {
|
|
478
476
|
let [r, i = ""] = e.split("?"), a = new URLSearchParams(i);
|
|
479
477
|
if (t.expression) {
|
|
480
|
-
let e =
|
|
478
|
+
let e = b(t.expression);
|
|
481
479
|
e && a.set("$filter", e);
|
|
482
480
|
}
|
|
483
|
-
t.sorts && a.set("$orderby",
|
|
481
|
+
t.sorts && a.set("$orderby", x(t.sorts)), t.select && a.set("$select", t.select.join(",")), t.expand && a.set("$expand", t.expand.join(",")), J(a, "$top", t.top), J(a, "$skip", t.skip), J(a, "$inlinecount", t.inlinecount);
|
|
484
482
|
let o = r.replace(/\/+$/, ""), s = a.toString(), c = s ? `${o}?${s}` : o, l = n;
|
|
485
483
|
if (t.swCache) {
|
|
486
484
|
let e = new Headers(n.headers);
|
|
@@ -491,164 +489,164 @@ function Xe(e, t = {}, n = {}) {
|
|
|
491
489
|
}
|
|
492
490
|
return {
|
|
493
491
|
path: c,
|
|
494
|
-
fullUrl: `${
|
|
492
|
+
fullUrl: `${A[t.baseUrl ?? "odata"]}${c}`,
|
|
495
493
|
baseUrl: t.baseUrl,
|
|
496
494
|
init: l,
|
|
497
495
|
queryString: s
|
|
498
496
|
};
|
|
499
497
|
}
|
|
500
|
-
async function
|
|
501
|
-
let r =
|
|
502
|
-
return
|
|
498
|
+
async function Y(e, t = {}, n = {}) {
|
|
499
|
+
let r = Je(e, t, n);
|
|
500
|
+
return Ke(r.path, r.init, t.baseUrl);
|
|
503
501
|
}
|
|
504
|
-
var
|
|
505
|
-
function
|
|
502
|
+
var Ye = __APP_BUILD_ID__, Xe = 1e3 * 60 * 60 * 24;
|
|
503
|
+
function Ze(e) {
|
|
506
504
|
if (e) return Array.isArray(e) ? e[0] : e;
|
|
507
505
|
}
|
|
508
|
-
var
|
|
509
|
-
...
|
|
506
|
+
var Qe = ({ service: e }) => [
|
|
507
|
+
...q,
|
|
510
508
|
"metadata-version",
|
|
511
509
|
{
|
|
512
510
|
service: e,
|
|
513
|
-
buildId:
|
|
511
|
+
buildId: Ye
|
|
514
512
|
}
|
|
515
513
|
];
|
|
516
|
-
function
|
|
514
|
+
function $e(e) {
|
|
517
515
|
return {
|
|
518
516
|
service: e,
|
|
519
517
|
changedAt: null,
|
|
520
518
|
version: null
|
|
521
519
|
};
|
|
522
520
|
}
|
|
523
|
-
function
|
|
521
|
+
function et(e) {
|
|
524
522
|
return async ({ signal: t }) => {
|
|
525
|
-
let n =
|
|
526
|
-
if (!n) return
|
|
527
|
-
let r =
|
|
523
|
+
let n = D().metadataVersion;
|
|
524
|
+
if (!n) return $e(e.service);
|
|
525
|
+
let r = d(Ze((await Y(`/${n.service}/${n.target}('${O(e.service)}')`, { baseUrl: k(n.service, n.baseUrl) }, { signal: t })).data)?.lastChanged);
|
|
528
526
|
return {
|
|
529
527
|
service: e.service,
|
|
530
528
|
changedAt: r,
|
|
531
|
-
version: r ?
|
|
529
|
+
version: r ? u(r) : null
|
|
532
530
|
};
|
|
533
531
|
};
|
|
534
532
|
}
|
|
535
|
-
var
|
|
536
|
-
queryKey:
|
|
537
|
-
queryFn:
|
|
538
|
-
meta:
|
|
539
|
-
enabled: !!(e.service &&
|
|
540
|
-
staleTime: e.staleTime ??
|
|
533
|
+
var tt = (e) => p({
|
|
534
|
+
queryKey: Qe(e),
|
|
535
|
+
queryFn: et(e),
|
|
536
|
+
meta: g,
|
|
537
|
+
enabled: !!(e.service && D().metadataVersion),
|
|
538
|
+
staleTime: e.staleTime ?? Xe,
|
|
541
539
|
gcTime: Infinity
|
|
542
540
|
});
|
|
543
|
-
function
|
|
541
|
+
function nt(e, t) {
|
|
544
542
|
return e.invalidateQueries({ predicate: (e) => {
|
|
545
543
|
let [n, r, i] = e.queryKey;
|
|
546
|
-
return n !==
|
|
544
|
+
return n !== q[0] || r !== "metadata" || !i || typeof i != "object" ? !1 : "service" in i && i.service === t;
|
|
547
545
|
} });
|
|
548
546
|
}
|
|
549
|
-
function
|
|
547
|
+
function rt(e, t) {
|
|
550
548
|
return e?.data === void 0 || !t.changedAt ? !1 : t.changedAt.getTime() > e.dataUpdatedAt;
|
|
551
549
|
}
|
|
552
|
-
function
|
|
553
|
-
return
|
|
554
|
-
baseUrl:
|
|
550
|
+
function it(e) {
|
|
551
|
+
return qe(`/${e.service}/$metadata`, {
|
|
552
|
+
baseUrl: k(e.service, e.baseUrl),
|
|
555
553
|
init: { headers: {
|
|
556
554
|
Accept: "*/*",
|
|
557
555
|
"Content-Type": "application/xml"
|
|
558
556
|
} },
|
|
559
557
|
transform: async (t) => {
|
|
560
558
|
try {
|
|
561
|
-
return
|
|
559
|
+
return C(await t.text());
|
|
562
560
|
} catch (t) {
|
|
563
561
|
throw Error(`Сервис ${e.service} содержит необработанную ошибку: ${String(t)}`);
|
|
564
562
|
}
|
|
565
563
|
}
|
|
566
564
|
});
|
|
567
565
|
}
|
|
568
|
-
var
|
|
566
|
+
var X = (e) => p({
|
|
569
567
|
queryKey: [
|
|
570
|
-
...
|
|
568
|
+
...q,
|
|
571
569
|
"metadata",
|
|
572
570
|
e
|
|
573
571
|
],
|
|
574
|
-
queryFn:
|
|
575
|
-
meta:
|
|
572
|
+
queryFn: it(e),
|
|
573
|
+
meta: g,
|
|
576
574
|
enabled: !!e.service,
|
|
577
575
|
staleTime: Infinity,
|
|
578
576
|
gcTime: Infinity
|
|
579
577
|
});
|
|
580
|
-
async function
|
|
578
|
+
async function at(e, t, n) {
|
|
581
579
|
if (!t.service) return;
|
|
582
|
-
let r =
|
|
583
|
-
|
|
580
|
+
let r = X(t).queryKey;
|
|
581
|
+
rt(e.getQueryState(r), n) && await nt(e, t.service);
|
|
584
582
|
}
|
|
585
|
-
function
|
|
586
|
-
let
|
|
583
|
+
function ot(e) {
|
|
584
|
+
let r = h(), i = n(() => ({
|
|
587
585
|
service: e.service,
|
|
588
586
|
baseUrl: e.baseUrl
|
|
589
|
-
}), [e.baseUrl, e.service]), a =
|
|
590
|
-
return
|
|
591
|
-
!e.service || !a.isSuccess ||
|
|
587
|
+
}), [e.baseUrl, e.service]), a = m(tt(n(() => ({ service: e.service }), [e.service]))), o = m(X(i));
|
|
588
|
+
return t(() => {
|
|
589
|
+
!e.service || !a.isSuccess || at(r, i, a.data);
|
|
592
590
|
}, [
|
|
593
591
|
i,
|
|
594
592
|
o.dataUpdatedAt,
|
|
595
593
|
e.service,
|
|
596
|
-
|
|
594
|
+
r,
|
|
597
595
|
a.data,
|
|
598
596
|
a.isSuccess
|
|
599
597
|
]), o;
|
|
600
598
|
}
|
|
601
|
-
async function
|
|
599
|
+
async function st(e, t) {
|
|
602
600
|
let n = { service: e.service };
|
|
603
601
|
try {
|
|
604
|
-
await
|
|
602
|
+
await at(t, e, await t.fetchQuery(tt(n)));
|
|
605
603
|
} catch {}
|
|
606
604
|
}
|
|
607
|
-
async function
|
|
608
|
-
if (e.service) return await t.fetchQuery(
|
|
605
|
+
async function ct(e, t) {
|
|
606
|
+
if (e.service) return await t.fetchQuery(X(e)), await st(e, t), t.fetchQuery(X(e));
|
|
609
607
|
}
|
|
610
|
-
function
|
|
608
|
+
function Z(e) {
|
|
611
609
|
return "returnType" in e;
|
|
612
610
|
}
|
|
613
|
-
function
|
|
611
|
+
function lt(e, t) {
|
|
614
612
|
let n = e?.entities[t], r = e?.functionImports[t];
|
|
615
613
|
if (n && r) throw Error(`Найден конфликт metadata: '${t}' существует и как Entity, и как FunctionImport`);
|
|
616
614
|
if (n) return n;
|
|
617
615
|
if (r) return r;
|
|
618
616
|
throw Error(`OData target '${t}' не был загружен`);
|
|
619
617
|
}
|
|
620
|
-
function
|
|
621
|
-
if (
|
|
618
|
+
function ut(e, t, n) {
|
|
619
|
+
if (Z(e)) {
|
|
622
620
|
if (t !== "fi") throw Error(`OData operation '${t}' несовместима с FunctionImport '${e.name}'. Для FunctionImport используйте method: 'fi'.`);
|
|
623
621
|
return;
|
|
624
622
|
}
|
|
625
623
|
if (t === "fi") throw Error(`OData operation 'fi' несовместима с Entity '${n.target}'. Для Entity используйте один из методов: 'create', 'update', 'delete', 'read', 'query', 'fm'.`);
|
|
626
624
|
if (t === "read" && e.result) throw Error(`OData operation '${t}' несовместима с parameterized query entity '${n.target}'. Для target с result='${e.result}' используйте method: 'query'.`);
|
|
627
625
|
}
|
|
628
|
-
function
|
|
626
|
+
function dt(e, t) {
|
|
629
627
|
if (t === "create") return "POST";
|
|
630
628
|
if (t === "update") return "PUT";
|
|
631
629
|
if (t === "delete") return "DELETE";
|
|
632
630
|
if (t === "read" || t === "query") return "GET";
|
|
633
|
-
if (
|
|
631
|
+
if (Z(e)) {
|
|
634
632
|
if (!e.httpMethod) throw Error(`FunctionImport '${e.name}' не содержит httpMethod в metadata, поэтому operation 'fi' выполнить нельзя.`);
|
|
635
633
|
return e.httpMethod;
|
|
636
634
|
}
|
|
637
635
|
throw Error(`OData operation '${t}' не поддерживается для target '${"title" in e ? e.title : "unknown"}'.`);
|
|
638
636
|
}
|
|
639
|
-
function
|
|
637
|
+
function ft(e, t) {
|
|
640
638
|
if (e && (t === "create" || t === "update")) return JSON.stringify(e);
|
|
641
639
|
}
|
|
642
|
-
function
|
|
643
|
-
if (
|
|
640
|
+
function pt(e, t, n, r) {
|
|
641
|
+
if (Z(e)) return y(e, t, n);
|
|
644
642
|
if (r === "fi") throw Error(`OData operation 'fi' несовместима с Entity '${t.target}'.`);
|
|
645
|
-
return
|
|
643
|
+
return _(e, t, n, r);
|
|
646
644
|
}
|
|
647
|
-
function
|
|
648
|
-
if (!
|
|
645
|
+
function mt(e, t) {
|
|
646
|
+
if (!Z(e)) return e.columns;
|
|
649
647
|
if (e.resultEntity) return t.entities[e.resultEntity]?.columns;
|
|
650
648
|
}
|
|
651
|
-
function
|
|
649
|
+
function ht(e) {
|
|
652
650
|
let t = [];
|
|
653
651
|
for (let n = 0; n < e.length; n += 1) {
|
|
654
652
|
let r = e[n];
|
|
@@ -660,45 +658,45 @@ function _t(e) {
|
|
|
660
658
|
}
|
|
661
659
|
return t;
|
|
662
660
|
}
|
|
663
|
-
function
|
|
661
|
+
function gt(e, t) {
|
|
664
662
|
let n;
|
|
665
663
|
for (let r = 0; r < t.length; r += 1) {
|
|
666
664
|
let i = t[r];
|
|
667
665
|
if (!Object.prototype.hasOwnProperty.call(e, i.id)) continue;
|
|
668
|
-
let a = e[i.id], o =
|
|
666
|
+
let a = e[i.id], o = S(i, a);
|
|
669
667
|
o !== a && (n ||= { ...e }, n[i.id] = o);
|
|
670
668
|
}
|
|
671
669
|
return n ?? e;
|
|
672
670
|
}
|
|
673
|
-
function
|
|
674
|
-
let r =
|
|
671
|
+
function _t(e, t, n) {
|
|
672
|
+
let r = mt(t, n);
|
|
675
673
|
if (!r?.length) return e;
|
|
676
|
-
let i =
|
|
674
|
+
let i = ht(r);
|
|
677
675
|
if (Array.isArray(e)) {
|
|
678
676
|
let t;
|
|
679
677
|
for (let n = 0; n < e.length; n += 1) {
|
|
680
678
|
let r = e[n];
|
|
681
|
-
if (!
|
|
682
|
-
let a =
|
|
679
|
+
if (!s(r)) continue;
|
|
680
|
+
let a = gt(r, i);
|
|
683
681
|
a !== r && (t ||= e.slice(), t[n] = a);
|
|
684
682
|
}
|
|
685
683
|
return t ?? e;
|
|
686
684
|
}
|
|
687
|
-
return
|
|
685
|
+
return s(e) ? gt(e, i) : e;
|
|
688
686
|
}
|
|
689
|
-
function
|
|
687
|
+
function vt(...e) {
|
|
690
688
|
let [t, n] = e, { odata: r, options: i = {}, init: a = {}, autoParse: o, swCache: s } = n, c = "params" in n ? n.params ?? {} : {};
|
|
691
689
|
return async ({ client: e, signal: l }) => {
|
|
692
|
-
let u =
|
|
690
|
+
let u = k(r.service, i.baseUrl), d = await ct({
|
|
693
691
|
service: r.service,
|
|
694
692
|
baseUrl: u
|
|
695
693
|
}, e);
|
|
696
694
|
if (!d) throw Error(`Не удалось загрузить metadata OData-сервиса '${r.service}'`);
|
|
697
|
-
let f =
|
|
698
|
-
|
|
699
|
-
let p = "body" in n ?
|
|
695
|
+
let f = lt(d, r.target);
|
|
696
|
+
ut(f, t, r);
|
|
697
|
+
let p = "body" in n ? ft(n.body, t) : void 0, m = dt(f, t);
|
|
700
698
|
__DEV__ && t === "query" && !("result" in f) && Object.keys(c).length > 0 && console.warn(`OData query для plain entity "${r.service}/${r.target}" получил params, но они будут проигнорированы. Для чтения сущности по ключу используйте odataReadFn.`);
|
|
701
|
-
let h =
|
|
699
|
+
let h = pt(f, r, c, t), g = s ? {
|
|
702
700
|
...i,
|
|
703
701
|
baseUrl: u,
|
|
704
702
|
swCache: s
|
|
@@ -712,35 +710,35 @@ function bt(...e) {
|
|
|
712
710
|
signal: l
|
|
713
711
|
};
|
|
714
712
|
if (t === "query") {
|
|
715
|
-
let e = await
|
|
713
|
+
let e = await Y(h, g, _);
|
|
716
714
|
if (Le(e)) throw Error("OData query не должен возвращать 204 No Content");
|
|
717
|
-
let t = o ?
|
|
715
|
+
let t = o ? _t(e.data, f, d) : e.data;
|
|
718
716
|
return {
|
|
719
717
|
data: n.transform ? n.transform(t, f) : t,
|
|
720
718
|
totalCount: e.totalCount
|
|
721
719
|
};
|
|
722
720
|
}
|
|
723
|
-
let v = await
|
|
721
|
+
let v = await Y(h, g, _);
|
|
724
722
|
if (Le(v)) return { data: v.data };
|
|
725
|
-
let y = o ?
|
|
723
|
+
let y = o ? _t(v.data, f, d) : v.data;
|
|
726
724
|
return {
|
|
727
725
|
data: n.transform ? n.transform(y, f) : y,
|
|
728
726
|
totalCount: v.totalCount
|
|
729
727
|
};
|
|
730
728
|
};
|
|
731
729
|
}
|
|
732
|
-
function
|
|
733
|
-
return
|
|
730
|
+
function yt(e) {
|
|
731
|
+
return vt("query", e);
|
|
734
732
|
}
|
|
735
733
|
//#endregion
|
|
736
734
|
//#region node_modules/@ryuzaki13/react-foundation-api/dist/odata/index.js
|
|
737
|
-
var
|
|
735
|
+
var bt = () => [...q, "collection"], Q = ({ service: e, target: t, limitedKeys: n, serverFilter: r }) => [...bt(), {
|
|
738
736
|
service: e,
|
|
739
737
|
target: t,
|
|
740
738
|
limitedKeys: n,
|
|
741
739
|
serverFilter: r
|
|
742
740
|
}];
|
|
743
|
-
function
|
|
741
|
+
function xt(e) {
|
|
744
742
|
let t = [];
|
|
745
743
|
for (let [n, r] of e.entries()) {
|
|
746
744
|
let e = `${r.odata.service}.${r.odata.target}`;
|
|
@@ -760,58 +758,78 @@ function wt(e) {
|
|
|
760
758
|
}
|
|
761
759
|
return t;
|
|
762
760
|
}
|
|
763
|
-
|
|
761
|
+
function St(e, t, n) {
|
|
762
|
+
let r = /* @__PURE__ */ new Map();
|
|
763
|
+
for (let [e, n] of Object.entries(t)) r.set(e, new Map(n.map((e, t) => [e.codeKey, t])));
|
|
764
|
+
let i = [...e].map((e, t) => ({
|
|
765
|
+
item: e,
|
|
766
|
+
index: t
|
|
767
|
+
})).sort((e, t) => {
|
|
768
|
+
if (e.item.serviceIndex !== t.item.serviceIndex) return e.item.serviceIndex - t.item.serviceIndex;
|
|
769
|
+
let n = r.get(e.item.serviceKey), i = n?.get(e.item.id), a = n?.get(t.item.id);
|
|
770
|
+
return i !== void 0 && a !== void 0 ? i - a : i === void 0 ? a === void 0 ? e.item.segmentIndex === t.item.segmentIndex ? e.index - t.index : e.item.segmentIndex - t.item.segmentIndex : 1 : -1;
|
|
771
|
+
});
|
|
772
|
+
if (!n?.length) return i.map(({ item: e }) => e);
|
|
773
|
+
let a = new Set(i.map(({ item: e }) => e.id)), o = [...new Set(n)].filter((e) => a.has(e));
|
|
774
|
+
if (o.length === 0) return i.map(({ item: e }) => e);
|
|
775
|
+
let s = new Map(o.map((e, t) => [e, t]));
|
|
776
|
+
return [...i].sort((e, t) => {
|
|
777
|
+
let n = s.get(e.item.id), r = s.get(t.item.id);
|
|
778
|
+
return n !== void 0 && r !== void 0 ? n - r : n === void 0 ? r === void 0 ? e.index - t.index : 1 : -1;
|
|
779
|
+
}).map(({ item: e }) => e);
|
|
780
|
+
}
|
|
781
|
+
async function Ct(e) {
|
|
764
782
|
let { url: t, query: n, signal: r } = e;
|
|
765
783
|
try {
|
|
766
|
-
let e = await
|
|
784
|
+
let e = await Y(t, n, { signal: r });
|
|
767
785
|
if (Le(e)) throw Error("отсутствует тело ответа");
|
|
768
786
|
return { items: e.data.map(({ ID: e, CNT: t, __metadata: n, __Parameters: r, ...i }) => i) };
|
|
769
787
|
} catch (e) {
|
|
770
|
-
return
|
|
788
|
+
return a("Ошибка загрузки справочника:", e), { items: [] };
|
|
771
789
|
}
|
|
772
790
|
}
|
|
773
|
-
var
|
|
774
|
-
...
|
|
791
|
+
var wt = __APP_BUILD_ID__, Tt = 1e3 * 60 * 60 * 4, Et = 1e3 * 60 * 60 * 24 * 7, Dt = "ttl=forever;name=ref", Ot = "bust=forever;name=ref", kt = "ttl=4h;name=ref-updates", At = () => [
|
|
792
|
+
...q,
|
|
775
793
|
"collection-updates",
|
|
776
|
-
{ buildId:
|
|
794
|
+
{ buildId: wt }
|
|
777
795
|
];
|
|
778
|
-
function
|
|
796
|
+
function jt(e) {
|
|
779
797
|
return {
|
|
780
798
|
...e,
|
|
781
|
-
lastChangedAt:
|
|
799
|
+
lastChangedAt: d(e.lastChanged)
|
|
782
800
|
};
|
|
783
801
|
}
|
|
784
|
-
function
|
|
785
|
-
let n = e.map(
|
|
802
|
+
function Mt(e, t) {
|
|
803
|
+
let n = e.map(jt);
|
|
786
804
|
return {
|
|
787
805
|
items: n,
|
|
788
806
|
byEntityName: n.reduce((e, t) => (t.entityName && (e[t.entityName] = t), e), {}),
|
|
789
807
|
fetchedAt: t,
|
|
790
|
-
coverageStartedAt: t -
|
|
808
|
+
coverageStartedAt: t - Et
|
|
791
809
|
};
|
|
792
810
|
}
|
|
793
|
-
function
|
|
811
|
+
function Nt() {
|
|
794
812
|
return async ({ signal: e }) => {
|
|
795
|
-
let t = Date.now(), n =
|
|
796
|
-
return n ?
|
|
797
|
-
baseUrl:
|
|
798
|
-
swCache:
|
|
799
|
-
}, { signal: e })).data, Math.max(t, Date.now())) :
|
|
813
|
+
let t = Date.now(), n = D().collectionUpdates;
|
|
814
|
+
return n ? Mt((await Y(`/${n.service}/${n.target}`, {
|
|
815
|
+
baseUrl: k(n.service, n.baseUrl),
|
|
816
|
+
swCache: kt
|
|
817
|
+
}, { signal: e })).data, Math.max(t, Date.now())) : Mt([], t);
|
|
800
818
|
};
|
|
801
819
|
}
|
|
802
|
-
var
|
|
803
|
-
queryKey:
|
|
804
|
-
queryFn:
|
|
805
|
-
meta:
|
|
806
|
-
enabled: !!
|
|
807
|
-
staleTime: e.staleTime ??
|
|
820
|
+
var Pt = (e = {}) => p({
|
|
821
|
+
queryKey: At(),
|
|
822
|
+
queryFn: Nt(),
|
|
823
|
+
meta: g,
|
|
824
|
+
enabled: !!D().collectionUpdates,
|
|
825
|
+
staleTime: e.staleTime ?? Tt,
|
|
808
826
|
gcTime: Infinity
|
|
809
827
|
});
|
|
810
|
-
function
|
|
811
|
-
return
|
|
828
|
+
function Ft(e = {}) {
|
|
829
|
+
return m(Pt(e));
|
|
812
830
|
}
|
|
813
|
-
function
|
|
814
|
-
let { data: t, dataUpdatedAt: n = 0, isLoading: r, isError: i } =
|
|
831
|
+
function It(e) {
|
|
832
|
+
let { data: t, dataUpdatedAt: n = 0, isLoading: r, isError: i } = ot({ service: e.service }), a = t?.entities[e.target];
|
|
815
833
|
if (!r && !a && t?.functionImports[e.target]) throw Error(`OData target '${e.target}' является FunctionImport и не может использоваться как сущность`);
|
|
816
834
|
if (i) throw Error(`Ошибка загрузки метаданных сервиса ${e.service}`);
|
|
817
835
|
return {
|
|
@@ -821,17 +839,17 @@ function Rt(e) {
|
|
|
821
839
|
};
|
|
822
840
|
}
|
|
823
841
|
var $ = "Использование actions недопустимо до окончания загрузки metadata";
|
|
824
|
-
function
|
|
825
|
-
let { metadata: t, metadataUpdatedAt:
|
|
842
|
+
function Lt(e) {
|
|
843
|
+
let { metadata: t, metadataUpdatedAt: r, isLoading: i } = It(e);
|
|
826
844
|
return {
|
|
827
845
|
config: e,
|
|
828
846
|
metadata: t,
|
|
829
|
-
metadataUpdatedAt:
|
|
847
|
+
metadataUpdatedAt: r,
|
|
830
848
|
isLoading: i,
|
|
831
|
-
actions:
|
|
849
|
+
actions: n(() => ({
|
|
832
850
|
getEntityPath: (n = {}) => {
|
|
833
851
|
if (!t) throw Error($);
|
|
834
|
-
return
|
|
852
|
+
return v(t, e, n);
|
|
835
853
|
},
|
|
836
854
|
getKeys: () => {
|
|
837
855
|
if (!t) throw Error($);
|
|
@@ -853,81 +871,81 @@ function zt(e) {
|
|
|
853
871
|
}), [e, t])
|
|
854
872
|
};
|
|
855
873
|
}
|
|
856
|
-
function
|
|
874
|
+
function Rt(e, t) {
|
|
857
875
|
if (!t) return e;
|
|
858
876
|
let n = e.trim().toLowerCase();
|
|
859
|
-
return n === "off" || n.startsWith("bust=") ? e : n.startsWith("ttl=") ? e.replace(/^\s*ttl=/i, "bust=") :
|
|
877
|
+
return n === "off" || n.startsWith("bust=") ? e : n.startsWith("ttl=") ? e.replace(/^\s*ttl=/i, "bust=") : Ot;
|
|
860
878
|
}
|
|
861
|
-
function
|
|
879
|
+
function zt(e) {
|
|
862
880
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
863
881
|
}
|
|
864
|
-
function
|
|
882
|
+
function Bt(e, t) {
|
|
865
883
|
let n = t?.cacheUpdatedAt ?? 0, r = e.update?.lastChangedAt?.getTime();
|
|
866
|
-
return !!(
|
|
884
|
+
return !!(zt(r) && (!t || !n || r > n) || zt(e.metadataUpdatedAt) && (!t || !n || e.metadataUpdatedAt > n) || zt(e.updatesCoverageStartedAt) && (!t || !n || n < e.updatesCoverageStartedAt));
|
|
867
885
|
}
|
|
868
|
-
function
|
|
869
|
-
let { service:
|
|
870
|
-
service:
|
|
886
|
+
function Vt(e) {
|
|
887
|
+
let { service: r, target: i, limitedKeys: a, excludeEmpty: o, sortByCode: s, serverFilter: c, clientFilter: l, swCache: u = Dt } = e, d = h(), { actions: f, metadata: p, metadataUpdatedAt: _, isLoading: v } = Lt(e), y = Ft(), b = n(() => Q({
|
|
888
|
+
service: r,
|
|
871
889
|
target: i,
|
|
872
890
|
limitedKeys: a,
|
|
873
891
|
serverFilter: c
|
|
874
892
|
}), [
|
|
875
|
-
|
|
893
|
+
r,
|
|
876
894
|
i,
|
|
877
895
|
a,
|
|
878
896
|
c
|
|
879
|
-
]), x = d.getQueryData(b), S = y.data?.byEntityName[i], C =
|
|
897
|
+
]), x = d.getQueryData(b), S = y.data?.byEntityName[i], C = Bt({
|
|
880
898
|
update: S,
|
|
881
|
-
metadataUpdatedAt:
|
|
899
|
+
metadataUpdatedAt: _,
|
|
882
900
|
updatesCoverageStartedAt: y.data?.coverageStartedAt
|
|
883
|
-
}, x), w =
|
|
884
|
-
return
|
|
901
|
+
}, x), w = Rt(u, C), T = y.isError || y.isSuccess && !y.isFetching;
|
|
902
|
+
return t(() => {
|
|
885
903
|
!x || !C || d.invalidateQueries({ queryKey: b });
|
|
886
904
|
}, [
|
|
887
905
|
x,
|
|
888
906
|
d,
|
|
889
907
|
b,
|
|
890
908
|
C
|
|
891
|
-
]),
|
|
909
|
+
]), m({
|
|
892
910
|
queryKey: b,
|
|
893
911
|
queryFn: async ({ signal: e }) => {
|
|
894
|
-
let
|
|
912
|
+
let t = Date.now(), n = a ? [...a] : f.getKeys(), u = f.getKeyPairs(), d = f.getKeyPairsMap();
|
|
895
913
|
if (a) for (let e of a) {
|
|
896
914
|
let t = d[e];
|
|
897
|
-
t && !
|
|
915
|
+
t && !n.includes(t) && n.push(t);
|
|
898
916
|
}
|
|
899
|
-
let { items: p } = await
|
|
900
|
-
url: `/${
|
|
917
|
+
let { items: p } = await Ct({
|
|
918
|
+
url: `/${r}/${i}`,
|
|
901
919
|
query: {
|
|
902
|
-
select:
|
|
920
|
+
select: n,
|
|
903
921
|
expression: c,
|
|
904
922
|
swCache: w
|
|
905
923
|
},
|
|
906
924
|
signal: e
|
|
907
|
-
}),
|
|
908
|
-
l && (
|
|
909
|
-
let
|
|
925
|
+
}), m = p;
|
|
926
|
+
l && (m = p.filter(l));
|
|
927
|
+
let h = ee(m, u, o, s), g = u.map((e) => ({
|
|
910
928
|
codeKey: e.codeKey,
|
|
911
|
-
count:
|
|
929
|
+
count: h[e.codeKey].length
|
|
912
930
|
})).sort((e, t) => e.count - t.count);
|
|
913
931
|
return {
|
|
914
|
-
items:
|
|
932
|
+
items: m,
|
|
915
933
|
keyPairs: u,
|
|
916
934
|
keyPairsMap: d,
|
|
917
|
-
separated:
|
|
918
|
-
chain:
|
|
919
|
-
count:
|
|
920
|
-
cacheUpdatedAt: Math.max(
|
|
935
|
+
separated: h,
|
|
936
|
+
chain: g,
|
|
937
|
+
count: m.length,
|
|
938
|
+
cacheUpdatedAt: Math.max(t, Date.now(), S?.lastChangedAt?.getTime() ?? 0, _)
|
|
921
939
|
};
|
|
922
940
|
},
|
|
923
|
-
enabled: !!(!
|
|
924
|
-
meta:
|
|
941
|
+
enabled: !!(!v && p && r && i && T),
|
|
942
|
+
meta: g,
|
|
925
943
|
staleTime: 1e3 * 60 * 60 * 2,
|
|
926
944
|
gcTime: 1e3 * 60 * 60 * 1
|
|
927
945
|
});
|
|
928
946
|
}
|
|
929
|
-
function
|
|
930
|
-
let { codeKey: s, maxVisibleItems: c } =
|
|
947
|
+
function Ht({ odata: t, model: a, pageSize: o = 50 }) {
|
|
948
|
+
let { codeKey: s, maxVisibleItems: c } = a, { data: l, isLoading: u, isError: d, refetch: f } = Vt(t), p = l?.keyPairsMap[s] ?? "", m = h(), [g, _] = i(), v = r(/* @__PURE__ */ new Map()), { itemsMap: y, separatedItems: b, orderedKeys: x } = n(() => {
|
|
931
949
|
let e = /* @__PURE__ */ new Map(), t = [], n = [];
|
|
932
950
|
if (l && l.separated[s]) {
|
|
933
951
|
n = l.separated[s];
|
|
@@ -941,7 +959,7 @@ function Wt({ odata: e, model: n, pageSize: o = 50 }) {
|
|
|
941
959
|
separatedItems: n,
|
|
942
960
|
orderedKeys: t
|
|
943
961
|
};
|
|
944
|
-
}, [l, s]), S =
|
|
962
|
+
}, [l, s]), S = e((e) => {
|
|
945
963
|
let t = l?.separated[s];
|
|
946
964
|
if (!t) return /* @__PURE__ */ new Map();
|
|
947
965
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -953,21 +971,21 @@ function Wt({ odata: e, model: n, pageSize: o = 50 }) {
|
|
|
953
971
|
}
|
|
954
972
|
}
|
|
955
973
|
return n;
|
|
956
|
-
}, [l, s]), C =
|
|
957
|
-
|
|
974
|
+
}, [l, s]), C = e((e) => {
|
|
975
|
+
_(() => {
|
|
958
976
|
if (e?.length) return new Set(e.map((e) => e[s]));
|
|
959
977
|
});
|
|
960
|
-
}, [s]),
|
|
978
|
+
}, [s]), ee = e((e, t) => {
|
|
961
979
|
if (!x.length) return [];
|
|
962
980
|
let n = c, r = /* @__PURE__ */ new Set(), i = [];
|
|
963
981
|
if (t?.length) for (let e = 0; e < t.length; e++) r.add(t[e][s]);
|
|
964
|
-
let a = 0, o =
|
|
982
|
+
let a = 0, o = g && g.size > 0;
|
|
965
983
|
for (let t of x) {
|
|
966
984
|
if (a >= n) break;
|
|
967
985
|
let c = y.get(t);
|
|
968
986
|
if (!c || r.size > 0 && r.has(t)) continue;
|
|
969
987
|
let l = c[s];
|
|
970
|
-
o && !
|
|
988
|
+
o && !g.has(l) || e && !e(l, c[p]) || (i.push(c), a++);
|
|
971
989
|
}
|
|
972
990
|
return i;
|
|
973
991
|
}, [
|
|
@@ -975,53 +993,76 @@ function Wt({ odata: e, model: n, pageSize: o = 50 }) {
|
|
|
975
993
|
c,
|
|
976
994
|
s,
|
|
977
995
|
y,
|
|
978
|
-
|
|
996
|
+
g,
|
|
979
997
|
p
|
|
980
|
-
]),
|
|
998
|
+
]), w = e((e) => {
|
|
981
999
|
let t = l?.separated[s] || [], n = e * o, r = n + o;
|
|
982
1000
|
return t.slice(n, r);
|
|
983
1001
|
}, [
|
|
984
1002
|
l,
|
|
985
1003
|
o,
|
|
986
1004
|
s
|
|
987
|
-
]),
|
|
1005
|
+
]), T = e((e, t) => {
|
|
988
1006
|
if (!l) return [];
|
|
989
1007
|
let n = new Set(t);
|
|
990
1008
|
return l.items.filter((t) => n.has(t[e]));
|
|
991
|
-
}, [l]),
|
|
1009
|
+
}, [l]), te = e((e, t, n = 200) => {
|
|
992
1010
|
v.current.has(e) && clearTimeout(v.current.get(e));
|
|
993
1011
|
let r = setTimeout(t, n);
|
|
994
1012
|
v.current.set(e, r);
|
|
995
|
-
}, []),
|
|
1013
|
+
}, []), ne = e(() => {
|
|
996
1014
|
for (let e of v.current.values()) clearTimeout(e);
|
|
997
1015
|
v.current.clear();
|
|
998
1016
|
}, []);
|
|
999
|
-
return
|
|
1000
|
-
|
|
1001
|
-
}, [
|
|
1017
|
+
return n(() => () => {
|
|
1018
|
+
ne();
|
|
1019
|
+
}, [ne]), {
|
|
1002
1020
|
data: l,
|
|
1003
1021
|
isLoading: u,
|
|
1004
1022
|
isError: d,
|
|
1005
1023
|
codeKey: s,
|
|
1006
1024
|
textKey: p,
|
|
1007
|
-
getItems:
|
|
1008
|
-
findSourceItemsByKeys:
|
|
1025
|
+
getItems: ee,
|
|
1026
|
+
findSourceItemsByKeys: T,
|
|
1009
1027
|
setFilteredItems: C,
|
|
1010
|
-
getPage:
|
|
1028
|
+
getPage: w,
|
|
1011
1029
|
buildSearchIndex: S,
|
|
1012
|
-
debounce:
|
|
1030
|
+
debounce: te,
|
|
1013
1031
|
itemsMap: y,
|
|
1014
1032
|
separatedItems: b,
|
|
1015
1033
|
orderedKeys: x,
|
|
1016
1034
|
refetch: f,
|
|
1017
|
-
invalidate: () => m.invalidateQueries({ queryKey:
|
|
1035
|
+
invalidate: () => m.invalidateQueries({ queryKey: Q(t) }),
|
|
1018
1036
|
totalCount: l?.separated[s]?.length || 0,
|
|
1019
1037
|
pageSize: o
|
|
1020
1038
|
};
|
|
1021
1039
|
}
|
|
1022
|
-
function
|
|
1023
|
-
let [
|
|
1024
|
-
|
|
1040
|
+
function Ut(e) {
|
|
1041
|
+
let r = h(), [a, o] = i({}), s = n(() => e.map((e) => Q(e)), [e]);
|
|
1042
|
+
return t(() => {
|
|
1043
|
+
function t() {
|
|
1044
|
+
let t = {};
|
|
1045
|
+
for (let n of e) {
|
|
1046
|
+
let e = Q(n), i = r.getQueryData(e);
|
|
1047
|
+
i?.chain && (t[`${n.service}.${n.target}`] = i.chain);
|
|
1048
|
+
}
|
|
1049
|
+
o((e) => Object.keys(e).length === Object.keys(t).length && Object.entries(t).every(([t, n]) => e[t] === n) ? e : t);
|
|
1050
|
+
}
|
|
1051
|
+
return t(), r.getQueryCache().subscribe((e) => {
|
|
1052
|
+
if (e?.query) {
|
|
1053
|
+
let n = e.query;
|
|
1054
|
+
s.some((e) => JSON.stringify(e) === JSON.stringify(n.queryKey)) && t();
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
}, [
|
|
1058
|
+
e,
|
|
1059
|
+
r,
|
|
1060
|
+
s
|
|
1061
|
+
]), a;
|
|
1062
|
+
}
|
|
1063
|
+
function Wt(e) {
|
|
1064
|
+
let [t] = i(() => {
|
|
1065
|
+
let t = w.getState(), { codeKey: n, maxVisibleItems: r = t.defaultMaxVisibleItems, minSearchCodeLength: i = t.defaultMinSearchCodeLength, minSearchTextLength: a = t.defaultMinSearchTextLength, searchDebounceDelay: o = t.defaultSearchDebounceDelay } = e;
|
|
1025
1066
|
return {
|
|
1026
1067
|
codeKey: n,
|
|
1027
1068
|
maxVisibleItems: r,
|
|
@@ -1032,274 +1073,37 @@ function Gt(e) {
|
|
|
1032
1073
|
});
|
|
1033
1074
|
return t;
|
|
1034
1075
|
}
|
|
1035
|
-
function
|
|
1076
|
+
function Gt(e, t) {
|
|
1036
1077
|
let n = {}, r = (e) => {
|
|
1037
1078
|
for (let i of e) {
|
|
1038
1079
|
if ("columns" in i && Array.isArray(i.columns) && i.columns.length > 0) {
|
|
1039
1080
|
r(i.columns);
|
|
1040
1081
|
continue;
|
|
1041
1082
|
}
|
|
1042
|
-
let e =
|
|
1083
|
+
let e = re(i);
|
|
1043
1084
|
!e || !(e in t) || (n[e] = t[e]);
|
|
1044
1085
|
}
|
|
1045
1086
|
};
|
|
1046
1087
|
return r(e), n;
|
|
1047
1088
|
}
|
|
1048
|
-
function
|
|
1049
|
-
let { metadata: t, isLoading:
|
|
1089
|
+
function Kt(e) {
|
|
1090
|
+
let { metadata: t, isLoading: r } = It(e);
|
|
1050
1091
|
return {
|
|
1051
|
-
columns:
|
|
1092
|
+
columns: n(() => t ? e.mode === "build" ? te(t.columns, {
|
|
1052
1093
|
resolveHeader: e.resolveHeader,
|
|
1053
1094
|
resolveFormatting: e.resolveFormatting
|
|
1054
|
-
}) :
|
|
1055
|
-
defaultColumnVisibility:
|
|
1095
|
+
}) : ne(e.columns, t.columns) : e.mode === "build" ? [] : [...e.columns], [e, t]),
|
|
1096
|
+
defaultColumnVisibility: n(() => {
|
|
1056
1097
|
if (!t) return;
|
|
1057
|
-
if (e.mode === "build") return
|
|
1058
|
-
let n =
|
|
1059
|
-
return
|
|
1098
|
+
if (e.mode === "build") return T(t.columns, { resolveVisible: e.resolveVisible });
|
|
1099
|
+
let n = T(t.columns);
|
|
1100
|
+
return Gt(e.columns, n);
|
|
1060
1101
|
}, [e, t]),
|
|
1061
1102
|
metadata: t,
|
|
1062
|
-
isLoading:
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
//#endregion
|
|
1066
|
-
//#region src/select/model/useODataSelectBase.ts
|
|
1067
|
-
var Jt = "", Yt = "";
|
|
1068
|
-
function Xt(e) {
|
|
1069
|
-
return e?.length ? [...new Set(e)].sort() : [];
|
|
1070
|
-
}
|
|
1071
|
-
function Zt(e, t, n) {
|
|
1072
|
-
let r = [];
|
|
1073
|
-
for (let i of Object.keys(t).sort()) {
|
|
1074
|
-
if (i === e) continue;
|
|
1075
|
-
let t = Xt(n?.[i]);
|
|
1076
|
-
t.length && r.push(`${i}:${t.join(Yt)}`);
|
|
1077
|
-
}
|
|
1078
|
-
return r.join(Jt);
|
|
1079
|
-
}
|
|
1080
|
-
function Qt(e) {
|
|
1081
|
-
let t = /* @__PURE__ */ new Map();
|
|
1082
|
-
if (!e) return t;
|
|
1083
|
-
for (let n of e.split(Jt)) {
|
|
1084
|
-
let e = n.indexOf(":");
|
|
1085
|
-
if (e < 0) continue;
|
|
1086
|
-
let r = n.slice(0, e), i = n.slice(e + 1).split(Yt).filter(Boolean);
|
|
1087
|
-
r && i.length && t.set(r, i);
|
|
1088
|
-
}
|
|
1089
|
-
return t;
|
|
1090
|
-
}
|
|
1091
|
-
function $t({ odata: e, segment: t, model: i, value: o, dependencies: s }) {
|
|
1092
|
-
let [c, l] = a(""), [u, d] = a(""), { codeKey: f, searchDebounceDelay: m, minSearchCodeLength: h, minSearchTextLength: g } = i, { data: _, textKey: v, isLoading: y, isError: b, getItems: x, separatedItems: S, findSourceItemsByKeys: C, setFilteredItems: w, debounce: T } = Wt({
|
|
1093
|
-
odata: e,
|
|
1094
|
-
model: i
|
|
1095
|
-
}), E = S.length, D = t.selectText && v ? v : f, O = r(() => _ ? Zt(f, _.keyPairsMap, s) : "", [
|
|
1096
|
-
_,
|
|
1097
|
-
f,
|
|
1098
|
-
s
|
|
1099
|
-
]);
|
|
1100
|
-
n(() => {
|
|
1101
|
-
if (!_) return;
|
|
1102
|
-
let e = _.chain.findIndex((e) => e.codeKey === f), t = Qt(O), n = (e) => {
|
|
1103
|
-
let n = _.chain[e].codeKey, r = t.get(n);
|
|
1104
|
-
if (r?.length) return C(n, r);
|
|
1105
|
-
};
|
|
1106
|
-
for (let t = _.chain.length - 1; t > e; t--) {
|
|
1107
|
-
let e = n(t);
|
|
1108
|
-
if (e) {
|
|
1109
|
-
w(e);
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
for (let t = 0; t < e; t++) {
|
|
1114
|
-
let e = n(t);
|
|
1115
|
-
if (e) {
|
|
1116
|
-
w(e);
|
|
1117
|
-
return;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
w(void 0);
|
|
1121
|
-
}, [
|
|
1122
|
-
_,
|
|
1123
|
-
O,
|
|
1124
|
-
f,
|
|
1125
|
-
C,
|
|
1126
|
-
w
|
|
1127
|
-
]), n(() => {
|
|
1128
|
-
T("search", () => {
|
|
1129
|
-
d(c.trim().toLowerCase());
|
|
1130
|
-
}, m);
|
|
1131
|
-
}, [
|
|
1132
|
-
T,
|
|
1133
|
-
c,
|
|
1134
|
-
m
|
|
1135
|
-
]);
|
|
1136
|
-
let k = r(() => {
|
|
1137
|
-
if (!o?.length || !D) return [];
|
|
1138
|
-
let e = new Set(o);
|
|
1139
|
-
return S.filter((t) => e.has(t[D]));
|
|
1140
|
-
}, [
|
|
1141
|
-
S,
|
|
1142
|
-
D,
|
|
1143
|
-
o
|
|
1144
|
-
]), A = r(() => {
|
|
1145
|
-
if (!_) return [];
|
|
1146
|
-
if (!(u.length >= g)) return x(void 0, k);
|
|
1147
|
-
let e = u.length >= g, n = !t.hideCode && u.length >= h && !Number.isNaN(Number(u));
|
|
1148
|
-
return x((t, r) => !!(t && r && (n && p(t, u) || e && r.toLowerCase().includes(u))), k);
|
|
1149
|
-
}, [
|
|
1150
|
-
u,
|
|
1151
|
-
x,
|
|
1152
|
-
h,
|
|
1153
|
-
g,
|
|
1154
|
-
_,
|
|
1155
|
-
t.hideCode,
|
|
1156
|
-
k
|
|
1157
|
-
]);
|
|
1158
|
-
return {
|
|
1159
|
-
query: c,
|
|
1160
|
-
setQuery: l,
|
|
1161
|
-
debouncedQuery: u,
|
|
1162
|
-
selectedItems: k,
|
|
1163
|
-
filteredItems: A,
|
|
1164
|
-
itemsCount: E,
|
|
1165
|
-
isLoading: y,
|
|
1166
|
-
isError: b,
|
|
1167
|
-
codeKey: f,
|
|
1168
|
-
textKey: v,
|
|
1169
|
-
selectionKey: D,
|
|
1170
|
-
placeholder: r(() => {
|
|
1171
|
-
let e = A.length;
|
|
1172
|
-
return E ? e < E ? `${t.placeholder} <${e}+>` : `${t.placeholder} <${E > i.maxVisibleItems ? `${i.maxVisibleItems}+` : E}>` : `${t.placeholder} <пусто>`;
|
|
1173
|
-
}, [
|
|
1174
|
-
A.length,
|
|
1175
|
-
E,
|
|
1176
|
-
i.maxVisibleItems,
|
|
1177
|
-
t.placeholder
|
|
1178
|
-
])
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
1181
|
-
function en(e, t) {
|
|
1182
|
-
return e.map((e) => e[t]);
|
|
1183
|
-
}
|
|
1184
|
-
//#endregion
|
|
1185
|
-
//#region src/multi-select/model/useODataMultiSelect.ts
|
|
1186
|
-
function tn({ odata: e, segment: t, model: n, value: r, dependencies: i, onChange: a }) {
|
|
1187
|
-
let o = $t({
|
|
1188
|
-
odata: e,
|
|
1189
|
-
segment: t,
|
|
1190
|
-
model: n,
|
|
1191
|
-
value: r,
|
|
1192
|
-
dependencies: i
|
|
1193
|
-
}), s = (e) => {
|
|
1194
|
-
a(en(e, o.selectionKey));
|
|
1195
|
-
};
|
|
1196
|
-
return {
|
|
1197
|
-
...o,
|
|
1198
|
-
handleChange: s
|
|
1103
|
+
isLoading: r
|
|
1199
1104
|
};
|
|
1200
1105
|
}
|
|
1201
1106
|
//#endregion
|
|
1202
|
-
|
|
1203
|
-
var nn = ({ odata: t, segment: n, model: r, label: i, description: a, disabled: o, value: s, dependencies: c, onChange: l, size: u }) => {
|
|
1204
|
-
let d = tn({
|
|
1205
|
-
odata: t,
|
|
1206
|
-
segment: n,
|
|
1207
|
-
model: Gt(r),
|
|
1208
|
-
value: s,
|
|
1209
|
-
dependencies: c,
|
|
1210
|
-
onChange: l
|
|
1211
|
-
});
|
|
1212
|
-
return /* @__PURE__ */ j(e, {
|
|
1213
|
-
label: i,
|
|
1214
|
-
description: a,
|
|
1215
|
-
size: u,
|
|
1216
|
-
codeKey: d.codeKey,
|
|
1217
|
-
textKey: d.textKey,
|
|
1218
|
-
hideCode: n.hideCode ?? t.hideCode,
|
|
1219
|
-
items: d.filteredItems,
|
|
1220
|
-
value: d.selectedItems,
|
|
1221
|
-
onChange: d.handleChange,
|
|
1222
|
-
onQuery: d.setQuery,
|
|
1223
|
-
query: d.query,
|
|
1224
|
-
defaultFilter: !1,
|
|
1225
|
-
highlightQuery: d.debouncedQuery,
|
|
1226
|
-
disabled: o || d.isLoading,
|
|
1227
|
-
placeholder: d.placeholder,
|
|
1228
|
-
error: d.isError ? "Ошибка загрузки" : void 0
|
|
1229
|
-
});
|
|
1230
|
-
}, rn = ({ item: e, values: n, onChange: r, width: i = 15 }) => {
|
|
1231
|
-
let [o, s] = a({}), c = n ?? o, l = `calc(${i}em + var(--width-add))`, u = t((t) => {
|
|
1232
|
-
let i = {
|
|
1233
|
-
...c,
|
|
1234
|
-
[e.id]: t
|
|
1235
|
-
};
|
|
1236
|
-
n || s(i), r?.(i);
|
|
1237
|
-
}, [
|
|
1238
|
-
e.id,
|
|
1239
|
-
r,
|
|
1240
|
-
c,
|
|
1241
|
-
n
|
|
1242
|
-
]);
|
|
1243
|
-
return /* @__PURE__ */ j("div", {
|
|
1244
|
-
style: {
|
|
1245
|
-
maxWidth: l,
|
|
1246
|
-
minWidth: l
|
|
1247
|
-
},
|
|
1248
|
-
children: /* @__PURE__ */ j(nn, {
|
|
1249
|
-
odata: e.odata,
|
|
1250
|
-
segment: e.segment,
|
|
1251
|
-
model: e.model,
|
|
1252
|
-
dependencies: c,
|
|
1253
|
-
value: c[e.id],
|
|
1254
|
-
onChange: u
|
|
1255
|
-
})
|
|
1256
|
-
});
|
|
1257
|
-
}, an = ({ width: e = 15, odata: t, segments: n, model: r, values: i, onChange: o }) => {
|
|
1258
|
-
let [s, c] = a({}), l = i ?? s;
|
|
1259
|
-
return wt([{
|
|
1260
|
-
odata: t,
|
|
1261
|
-
segments: n,
|
|
1262
|
-
model: r
|
|
1263
|
-
}]).map((t) => /* @__PURE__ */ j(rn, {
|
|
1264
|
-
item: t,
|
|
1265
|
-
values: l,
|
|
1266
|
-
onChange: (e) => {
|
|
1267
|
-
i || c(e), o?.(e);
|
|
1268
|
-
},
|
|
1269
|
-
width: e
|
|
1270
|
-
}, t.id));
|
|
1271
|
-
};
|
|
1272
|
-
//#endregion
|
|
1273
|
-
//#region src/multi-select/ui/SerializableMultiSelect.tsx
|
|
1274
|
-
function on(e, t) {
|
|
1275
|
-
return e[t];
|
|
1276
|
-
}
|
|
1277
|
-
function sn(e, t, n) {
|
|
1278
|
-
let r = e[t];
|
|
1279
|
-
if (typeof r == "string") return r;
|
|
1280
|
-
let i = on(e, n);
|
|
1281
|
-
return typeof i == "string" ? i : String(i);
|
|
1282
|
-
}
|
|
1283
|
-
function cn({ label: t, description: n, disabled: r, placeholder: i, size: a, options: o, value: s, onChange: c, optionKey: l, optionLabel: u, renderCode: d }) {
|
|
1284
|
-
let f = o.map((e) => ({
|
|
1285
|
-
key: String(on(e, l)),
|
|
1286
|
-
text: sn(e, u, l)
|
|
1287
|
-
})), p = new Set((s ?? []).map((e) => String(e))), m = f.filter((e) => p.has(e.key));
|
|
1288
|
-
return /* @__PURE__ */ j(e, {
|
|
1289
|
-
label: t,
|
|
1290
|
-
description: n,
|
|
1291
|
-
disabled: r,
|
|
1292
|
-
placeholder: i,
|
|
1293
|
-
size: a,
|
|
1294
|
-
items: f,
|
|
1295
|
-
codeKey: "key",
|
|
1296
|
-
textKey: "text",
|
|
1297
|
-
hideCode: d ? void 0 : !0,
|
|
1298
|
-
value: m,
|
|
1299
|
-
onChange: (e) => c(e.map((e) => e.key))
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
//#endregion
|
|
1303
|
-
export { qt as a, nn as i, an as n, xt as o, rn as r, cn as t };
|
|
1107
|
+
export { Wt as a, St as i, Ut as n, Ht as o, xt as r, yt as s, Kt as t };
|
|
1304
1108
|
|
|
1305
|
-
//# sourceMappingURL=
|
|
1109
|
+
//# sourceMappingURL=odata-DSW7z3nh.js.map
|