md-components-mdigial-azamat 0.0.320 → 0.0.321
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/PageViewer/PageViewer.js +27 -17
- package/package.json +1 -1
|
@@ -1,41 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import f from "./ComponentsView.js";
|
|
3
3
|
const i = ["Segments"];
|
|
4
|
-
function y(o,
|
|
5
|
-
if (!
|
|
4
|
+
function y(o, r) {
|
|
5
|
+
if (!r || !(o != null && o.length))
|
|
6
6
|
return o;
|
|
7
|
-
const e = `component_props_${
|
|
7
|
+
const e = `component_props_${r}`;
|
|
8
8
|
return o.map((p) => {
|
|
9
9
|
if (!i.includes(p.key))
|
|
10
10
|
return p;
|
|
11
|
-
const t = { ...p.component_props }, s = t == null ? void 0 : t.data,
|
|
12
|
-
var
|
|
13
|
-
return !(
|
|
14
|
-
...
|
|
15
|
-
components:
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const t = { ...p.component_props }, s = t == null ? void 0 : t.data, u = (_) => _.map((n) => {
|
|
12
|
+
var c;
|
|
13
|
+
return !(n != null && n.components) || !Array.isArray(n.components) || !((c = n.components) != null && c.length) ? n : {
|
|
14
|
+
...n,
|
|
15
|
+
components: n.components.map((m) => ({
|
|
16
|
+
...m,
|
|
17
|
+
component_props: {
|
|
18
|
+
// Вытаскиваем локализованные пропсы, если они есть
|
|
19
|
+
...m[e] || m.component_props || {},
|
|
20
|
+
// Локаль нужна самим блокам, а не только для выбора пропсов:
|
|
21
|
+
// часть из них ходит за содержимым в API и передаёт её
|
|
22
|
+
// заголовком Accept-Language. Блокам верхнего уровня локаль
|
|
23
|
+
// кладёт PageViewer, но до вложенных он не доходит — они
|
|
24
|
+
// рисуются через SegmentsContent -> renderComponents, где
|
|
25
|
+
// пропсы расстилаются как есть. Без неё бэк отвечает на языке
|
|
26
|
+
// по умолчанию: у mbonus-категорий это кыргызский.
|
|
27
|
+
locale: r
|
|
28
|
+
}
|
|
19
29
|
}))
|
|
20
30
|
};
|
|
21
31
|
});
|
|
22
|
-
return s && Array.isArray(s) && (t.data =
|
|
32
|
+
return s && Array.isArray(s) && (t.data = u(s)), { ...p, component_props: t };
|
|
23
33
|
});
|
|
24
34
|
}
|
|
25
35
|
const w = ({
|
|
26
36
|
components: o,
|
|
27
|
-
locale:
|
|
37
|
+
locale: r,
|
|
28
38
|
onChangeLanguage: e
|
|
29
39
|
}) => {
|
|
30
|
-
const p = y(o,
|
|
40
|
+
const p = y(o, r), t = e || r ? p.map((s) => ({
|
|
31
41
|
...s,
|
|
32
42
|
component_props: {
|
|
33
43
|
...s.component_props,
|
|
34
|
-
...
|
|
44
|
+
...r ? { locale: r } : {},
|
|
35
45
|
...e ? { onChangeLanguage: e } : {}
|
|
36
46
|
}
|
|
37
47
|
})) : p;
|
|
38
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ a(f, { components: t });
|
|
39
49
|
};
|
|
40
50
|
export {
|
|
41
51
|
w as PageViewer
|