@beda.software/web-item-controls 0.1.25-group-new-design.2 → 0.1.25-group-new-design.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/controls/GroupTabs/index.d.ts.map +1 -1
- package/dist/controls/GroupTabs/index.js +17 -17
- package/dist/controls/GroupWizard/GroupWizardSidebar/index.d.ts.map +1 -1
- package/dist/controls/GroupWizard/GroupWizardSidebar/index.js +83 -72
- package/dist/controls/GroupWizard/index.d.ts +19 -1
- package/dist/controls/GroupWizard/index.d.ts.map +1 -1
- package/dist/readonly-controls/GroupWizardSidebar/index.d.ts.map +1 -1
- package/dist/readonly-controls/GroupWizardSidebar/index.js +63 -56
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/locale/de/messages.po +3 -3
- package/src/locale/en/messages.po +3 -3
- package/src/locale/es/messages.po +3 -3
- package/src/locale/ru/messages.po +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAsC,MAAM,SAAS,CAAC;AAI7E,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAsC,MAAM,SAAS,CAAC;AAI7E,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CA0D9C"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Flex as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as f, Tabs as d } from "antd";
|
|
3
3
|
import { useState as b, useMemo as h } from "react";
|
|
4
|
-
import { useWatch as
|
|
5
|
-
import { getEnabledQuestions as x, QuestionItems as
|
|
4
|
+
import { useWatch as y } from "react-hook-form";
|
|
5
|
+
import { getEnabledQuestions as x, QuestionItems as I } from "sdc-qrf";
|
|
6
6
|
import { GroupWizardBus as v } from "../GroupWizard/index.js";
|
|
7
7
|
function B(p) {
|
|
8
8
|
var c;
|
|
9
9
|
const {
|
|
10
|
-
parentPath:
|
|
11
|
-
questionItem:
|
|
12
|
-
context:
|
|
10
|
+
parentPath: n,
|
|
11
|
+
questionItem: o,
|
|
12
|
+
context: a
|
|
13
13
|
} = p;
|
|
14
|
-
|
|
15
|
-
const
|
|
14
|
+
o.repeats && console.warn("GroupTabs does not support repeatable groups in the first level");
|
|
15
|
+
const m = y(), [l, u] = b(), r = h(() => {
|
|
16
16
|
const {
|
|
17
|
-
linkId:
|
|
18
|
-
} =
|
|
19
|
-
return
|
|
17
|
+
linkId: s
|
|
18
|
+
} = o, t = a[0];
|
|
19
|
+
return t ? x(o.item ?? [], n, m, t).filter((e) => !e.hidden).map((e) => ({
|
|
20
20
|
key: e.linkId,
|
|
21
21
|
label: e.text,
|
|
22
|
-
children: /* @__PURE__ */
|
|
22
|
+
children: /* @__PURE__ */ i(f, { gap: 16, vertical: !0, children: /* @__PURE__ */ i(I, { questionItems: e.item, parentPath: [...n, s, "items", e.linkId, "items"], context: t }) })
|
|
23
23
|
})) : [];
|
|
24
|
-
}, [
|
|
24
|
+
}, [a, m, n, o]);
|
|
25
25
|
return v.useBus("scrollTo", ({
|
|
26
|
-
groupLinkId:
|
|
26
|
+
groupLinkId: s
|
|
27
27
|
}) => {
|
|
28
|
-
u(
|
|
29
|
-
}, []), /* @__PURE__ */
|
|
28
|
+
r.some((t) => t.key === s) && u(s);
|
|
29
|
+
}, [r]), /* @__PURE__ */ i(d, { type: "card", items: r, activeKey: l ?? ((c = r[0]) == null ? void 0 : c.key), onChange: u, destroyInactiveTabPane: !0 });
|
|
30
30
|
}
|
|
31
31
|
export {
|
|
32
32
|
B as GroupTabs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/GroupWizard/GroupWizardSidebar/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EACH,cAAc,EAKjB,MAAM,SAAS,CAAC;AA8BjB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/GroupWizard/GroupWizardSidebar/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EACH,cAAc,EAKjB,MAAM,SAAS,CAAC;AA8BjB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,kDAkRvD;AAED,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,128 +1,139 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i, jsxs as b, Fragment as L } from "react/jsx-runtime";
|
|
2
2
|
import { Trans as Q } from "@lingui/react";
|
|
3
3
|
import { i18n as V } from "@lingui/core";
|
|
4
4
|
import { DeleteOutlined as _ } from "@ant-design/icons";
|
|
5
|
-
import { Popconfirm as
|
|
5
|
+
import { Popconfirm as N, Button as X } from "antd";
|
|
6
6
|
import j from "lodash";
|
|
7
|
-
import { useState as P, useMemo as
|
|
7
|
+
import { useState as P, useMemo as M, useEffect as H } from "react";
|
|
8
8
|
import { useWatch as Z, useFormContext as $ } from "react-hook-form";
|
|
9
9
|
import { useQuestionnaireResponseFormContext as J, QuestionnaireResponseFormProvider as U, QuestionItems as A, populateItemKey as Y } from "sdc-qrf";
|
|
10
10
|
import { Text as ee } from "../../../components/Typography.js";
|
|
11
|
-
import { GroupWizardBus as
|
|
11
|
+
import { GroupWizardBus as f } from "../index.js";
|
|
12
12
|
import { SidebarMenu as te } from "./SidebarMenu.js";
|
|
13
13
|
import { S as p } from "./styles.js";
|
|
14
14
|
import { buildRootSection as ne, shouldApplySidebarDesign as oe } from "./utils.js";
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function q(h, u, l) {
|
|
16
|
+
h.nodes.forEach((m) => {
|
|
17
|
+
l.nodesByKey.set(m.key, m), l.ancestorsByKey.set(m.key, u), m.sections.forEach((o) => q(o, [...u, m.key], l));
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function re(
|
|
21
|
-
const
|
|
20
|
+
function re(h) {
|
|
21
|
+
const u = {
|
|
22
22
|
nodesByKey: /* @__PURE__ */ new Map(),
|
|
23
23
|
ancestorsByKey: /* @__PURE__ */ new Map()
|
|
24
24
|
};
|
|
25
|
-
return
|
|
25
|
+
return q(h, [], u), u;
|
|
26
26
|
}
|
|
27
|
-
function Ie(
|
|
27
|
+
function Ie(h) {
|
|
28
28
|
const {
|
|
29
|
-
parentPath:
|
|
30
|
-
questionItem:
|
|
31
|
-
context:
|
|
32
|
-
} =
|
|
33
|
-
linkId:
|
|
34
|
-
hidden:
|
|
35
|
-
readOnly:
|
|
36
|
-
} =
|
|
37
|
-
getValues:
|
|
29
|
+
parentPath: u,
|
|
30
|
+
questionItem: l,
|
|
31
|
+
context: m
|
|
32
|
+
} = h, {
|
|
33
|
+
linkId: o,
|
|
34
|
+
hidden: D,
|
|
35
|
+
readOnly: x
|
|
36
|
+
} = l, g = m[0], v = Z(), {
|
|
37
|
+
getValues: K,
|
|
38
38
|
setValue: B
|
|
39
|
-
} = $(),
|
|
40
|
-
nodesByKey:
|
|
41
|
-
ancestorsByKey:
|
|
42
|
-
} =
|
|
43
|
-
|
|
44
|
-
if (!
|
|
39
|
+
} = $(), F = J(), [C, y] = P(null), [O, T] = P(/* @__PURE__ */ new Set()), [c, I] = P(null), n = M(() => ne(l, u, v, g), [l, u, v, g]), {
|
|
40
|
+
nodesByKey: k,
|
|
41
|
+
ancestorsByKey: w
|
|
42
|
+
} = M(() => re(n), [n]), d = c ? k.get(c) : void 0, R = (c ? w.get(c) ?? [] : []).map((e) => k.get(e)).filter((e) => !!e && e.contentItems.length > 0);
|
|
43
|
+
H(() => {
|
|
44
|
+
if (!d && n.nodes.length > 0) {
|
|
45
45
|
const e = n.nodes[0];
|
|
46
|
-
|
|
46
|
+
I(e.key), y(e.key);
|
|
47
47
|
}
|
|
48
|
-
}, [
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const t =
|
|
52
|
-
|
|
53
|
-
},
|
|
48
|
+
}, [d, n]);
|
|
49
|
+
const S = (e) => {
|
|
50
|
+
I(e);
|
|
51
|
+
const t = w.get(e) ?? [], [r, ...s] = t;
|
|
52
|
+
y(r ?? e), s.length > 0 && T((a) => /* @__PURE__ */ new Set([...a, ...s]));
|
|
53
|
+
}, W = (e) => {
|
|
54
54
|
const t = n.nodes.map((a) => a.key);
|
|
55
55
|
if (t.length < 2)
|
|
56
56
|
return;
|
|
57
57
|
if (C !== e.key) {
|
|
58
|
-
|
|
58
|
+
y(e.key);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
const t = j.get(
|
|
61
|
+
const s = (t.indexOf(e.key) + 1) % t.length;
|
|
62
|
+
y(t[s]);
|
|
63
|
+
}, E = (e) => {
|
|
64
|
+
const t = j.get(K(), e.fieldPath), r = (t == null ? void 0 : t.items) ?? [], s = [...r, {}].map(Y), a = [...e.fieldPath, "items", r.length.toString()].join(".");
|
|
65
65
|
B(e.fieldPath.join("."), {
|
|
66
66
|
...t,
|
|
67
|
-
items:
|
|
67
|
+
items: s
|
|
68
68
|
}, {
|
|
69
69
|
shouldDirty: !0
|
|
70
|
-
}),
|
|
71
|
-
},
|
|
70
|
+
}), I(a), e === n && y(a);
|
|
71
|
+
}, G = (e) => {
|
|
72
72
|
if (e.repeatIndex === void 0 || !e.fieldPath)
|
|
73
73
|
return;
|
|
74
|
-
const t = j.get(
|
|
74
|
+
const t = j.get(K(), e.fieldPath), s = ((t == null ? void 0 : t.items) ?? []).filter((a, z) => z !== e.repeatIndex);
|
|
75
75
|
B(e.fieldPath.join("."), {
|
|
76
76
|
...t,
|
|
77
|
-
items:
|
|
77
|
+
items: s
|
|
78
78
|
}, {
|
|
79
79
|
shouldDirty: !0
|
|
80
|
-
}),
|
|
80
|
+
}), I(null);
|
|
81
81
|
};
|
|
82
|
-
return
|
|
83
|
-
e.type !== "sidebarSelect" || e.groupLinkId !==
|
|
84
|
-
}, [
|
|
85
|
-
if (e.type !== "sidebarGoToIndex" || e.groupLinkId !==
|
|
82
|
+
return f.useBus("sidebarSelect", (e) => {
|
|
83
|
+
e.type !== "sidebarSelect" || e.groupLinkId !== o || !k.has(e.key) || S(e.key);
|
|
84
|
+
}, [o, k]), f.useBus("sidebarGoToIndex", (e) => {
|
|
85
|
+
if (e.type !== "sidebarGoToIndex" || e.groupLinkId !== o)
|
|
86
86
|
return;
|
|
87
87
|
const t = n.nodes[e.index];
|
|
88
|
-
t &&
|
|
89
|
-
}, [
|
|
88
|
+
t && S(t.key);
|
|
89
|
+
}, [o, n]), f.useBus("sidebarGoToPrevious", ({
|
|
90
90
|
groupLinkId: e
|
|
91
91
|
}) => {
|
|
92
|
-
if (e !==
|
|
92
|
+
if (e !== o)
|
|
93
93
|
return;
|
|
94
|
-
const t = n.nodes.findIndex((a) => a.key ===
|
|
95
|
-
|
|
96
|
-
}, [
|
|
94
|
+
const t = n.nodes.findIndex((a) => a.key === c), r = Math.max(0, (t === -1 ? n.nodes.length : t) - 1), s = n.nodes[r];
|
|
95
|
+
s && S(s.key);
|
|
96
|
+
}, [o, n, c]), f.useBus("sidebarGoToNext", ({
|
|
97
|
+
groupLinkId: e
|
|
98
|
+
}) => {
|
|
99
|
+
if (e !== o)
|
|
100
|
+
return;
|
|
101
|
+
const t = n.nodes.findIndex((a) => a.key === c), r = Math.min(n.nodes.length - 1, t + 1), s = n.nodes[r];
|
|
102
|
+
s && S(s.key);
|
|
103
|
+
}, [o, n, c]), f.useBus("sidebarAddElement", ({
|
|
104
|
+
groupLinkId: e
|
|
105
|
+
}) => {
|
|
106
|
+
e === o && E(n);
|
|
107
|
+
}, [o, n]), f.useBus("sidebarRemove", ({
|
|
97
108
|
groupLinkId: e
|
|
98
109
|
}) => {
|
|
99
|
-
e
|
|
100
|
-
}, [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
const
|
|
103
|
-
return
|
|
104
|
-
}), onSelect: (e) =>
|
|
110
|
+
e !== o || x || !d || G(d);
|
|
111
|
+
}, [o, x, d]), D || !l.item ? null : oe(l) ? /* @__PURE__ */ b(p.Container, { children: [
|
|
112
|
+
/* @__PURE__ */ i(p.Sider, { children: /* @__PURE__ */ i(te, { section: n, expandedRootKey: C, expandedKeys: O, selectedKey: c, onToggleRoot: W, onToggleExpand: (e) => T((t) => {
|
|
113
|
+
const r = new Set(t);
|
|
114
|
+
return r.has(e) ? r.delete(e) : r.add(e), r;
|
|
115
|
+
}), onSelect: (e) => f.dispatch({
|
|
105
116
|
type: "sidebarSelect",
|
|
106
|
-
groupLinkId:
|
|
117
|
+
groupLinkId: o,
|
|
107
118
|
key: e.key
|
|
108
|
-
}), onAdd:
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
119
|
+
}), onAdd: x ? void 0 : E }) }),
|
|
120
|
+
/* @__PURE__ */ i(p.Content, { children: d ? /* @__PURE__ */ b(L, { children: [
|
|
121
|
+
R.length > 0 ? /* @__PURE__ */ i(U, { ...F, readOnly: !0, children: R.map((e) => /* @__PURE__ */ b(p.ParentPreview, { children: [
|
|
122
|
+
/* @__PURE__ */ i(p.ParentPreviewTitle, { level: 5, children: e.text }),
|
|
123
|
+
/* @__PURE__ */ i(A, { questionItems: e.contentItems, parentPath: e.path, context: g })
|
|
113
124
|
] }, e.key)) }) : null,
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
!
|
|
125
|
+
/* @__PURE__ */ b(p.ContentHeader, { children: [
|
|
126
|
+
/* @__PURE__ */ i(p.ContentTitle, { level: 4, children: d.text }),
|
|
127
|
+
!x && d.repeatIndex !== void 0 ? /* @__PURE__ */ i(N, { title: V._(
|
|
117
128
|
/*i18n*/
|
|
118
129
|
{
|
|
119
130
|
id: "XtpCjZ"
|
|
120
131
|
}
|
|
121
|
-
), onConfirm: () =>
|
|
132
|
+
), onConfirm: () => G(d), children: /* @__PURE__ */ i(X, { danger: !0, icon: /* @__PURE__ */ i(_, {}), "data-testid": `sidebar-menu-remove-${d.key}` }) }) : null
|
|
122
133
|
] }),
|
|
123
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ i(A, { questionItems: d.contentItems, parentPath: d.path, context: g })
|
|
124
135
|
] }) : null })
|
|
125
|
-
] }) : (console.error("GroupWizardSidebar was used for a group that does not match the sidebar design criteria"), /* @__PURE__ */
|
|
136
|
+
] }) : (console.error("GroupWizardSidebar was used for a group that does not match the sidebar design criteria"), /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Q, { id: "vya+nX" }) }));
|
|
126
137
|
}
|
|
127
138
|
export {
|
|
128
139
|
Ie as GroupWizardSidebar,
|
|
@@ -4,7 +4,7 @@ export interface GroupWizardProps extends GroupItemProps {
|
|
|
4
4
|
wizard?: Partial<WizardProps>;
|
|
5
5
|
}
|
|
6
6
|
export declare const GroupWizardBus: {
|
|
7
|
-
useBus: (type: "scrollTo" | "sidebarAddElement" | "sidebarGoToIndex" | "sidebarGoToPrevious" | "sidebarSelect", callback: (e: {
|
|
7
|
+
useBus: (type: "scrollTo" | "sidebarAddElement" | "sidebarGoToIndex" | "sidebarGoToPrevious" | "sidebarGoToNext" | "sidebarRemove" | "sidebarSelect", callback: (e: {
|
|
8
8
|
type: "scrollTo";
|
|
9
9
|
groupLinkId: string;
|
|
10
10
|
} | {
|
|
@@ -17,6 +17,12 @@ export declare const GroupWizardBus: {
|
|
|
17
17
|
} | {
|
|
18
18
|
type: "sidebarGoToPrevious";
|
|
19
19
|
groupLinkId: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "sidebarGoToNext";
|
|
22
|
+
groupLinkId: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "sidebarRemove";
|
|
25
|
+
groupLinkId: string;
|
|
20
26
|
} | {
|
|
21
27
|
type: "sidebarSelect";
|
|
22
28
|
groupLinkId: string;
|
|
@@ -34,6 +40,12 @@ export declare const GroupWizardBus: {
|
|
|
34
40
|
} | {
|
|
35
41
|
type: "sidebarGoToPrevious";
|
|
36
42
|
groupLinkId: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: "sidebarGoToNext";
|
|
45
|
+
groupLinkId: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: "sidebarRemove";
|
|
48
|
+
groupLinkId: string;
|
|
37
49
|
} | {
|
|
38
50
|
type: "sidebarSelect";
|
|
39
51
|
groupLinkId: string;
|
|
@@ -52,6 +64,12 @@ export declare const GroupWizardBus: {
|
|
|
52
64
|
} | {
|
|
53
65
|
type: "sidebarGoToPrevious";
|
|
54
66
|
groupLinkId: string;
|
|
67
|
+
} | {
|
|
68
|
+
type: "sidebarGoToNext";
|
|
69
|
+
groupLinkId: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: "sidebarRemove";
|
|
72
|
+
groupLinkId: string;
|
|
55
73
|
} | {
|
|
56
74
|
type: "sidebarSelect";
|
|
57
75
|
groupLinkId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACH,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,WAAW,EAGd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKxE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,cAAc;;cAEX,UAAU;qBACH,MAAM;;cAGb,mBAAmB;qBACZ,MAAM;;cAGb,kBAAkB;qBACX,MAAM;eACZ,MAAM;;cAGP,qBAAqB;qBACd,MAAM;;cAGb,eAAe;qBACR,MAAM;aACd,MAAM;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACH,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,WAAW,EAGd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKxE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,cAAc;;cAEX,UAAU;qBACH,MAAM;;cAGb,mBAAmB;qBACZ,MAAM;;cAGb,kBAAkB;qBACX,MAAM;eACZ,MAAM;;cAGP,qBAAqB;qBACd,MAAM;;cAGb,iBAAiB;qBACV,MAAM;;cAGb,eAAe;qBACR,MAAM;;cAGb,eAAe;qBACR,MAAM;aACd,MAAM;;cA3BL,UAAU;qBACH,MAAM;;cAGb,mBAAmB;qBACZ,MAAM;;cAGb,kBAAkB;qBACX,MAAM;eACZ,MAAM;;cAGP,qBAAqB;qBACd,MAAM;;cAGb,iBAAiB;qBACV,MAAM;;cAGb,eAAe;qBACR,MAAM;;cAGb,eAAe;qBACR,MAAM;aACd,MAAM;;;cA3BL,UAAU;qBACH,MAAM;;cAGb,mBAAmB;qBACZ,MAAM;;cAGb,kBAAkB;qBACX,MAAM;eACZ,MAAM;;cAGP,qBAAqB;qBACd,MAAM;;cAGb,iBAAiB;qBACV,MAAM;;cAGb,eAAe;qBACR,MAAM;;cAGb,eAAe;qBACR,MAAM;aACd,MAAM;;CAElB,CAAC;AAEJ,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,2CAU1D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,2CAS9D;AAED,MAAM,WAAW,UAAU;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,yBAAyB,EAAE,MAAM,CAAC;CACrC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAkJlD;AAED,eAAO,MAAM,aAAa,GACtB,WAAW,oBAAoB,EAC/B,YAAY,MAAM,EAAE,EACpB,YAAY,SAAS,EACrB,SAAS,WAAW,KACrB,UAeF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/readonly-controls/GroupWizardSidebar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AA6BxD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/readonly-controls/GroupWizardSidebar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AA6BxD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,kDAyMvD"}
|
|
@@ -1,90 +1,97 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i, jsxs as k, Fragment as W } from "react/jsx-runtime";
|
|
2
2
|
import { Trans as q } from "@lingui/react";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as S, useMemo as w, useEffect as z } from "react";
|
|
4
4
|
import { useWatch as A } from "react-hook-form";
|
|
5
5
|
import { QuestionItems as P } from "sdc-qrf";
|
|
6
6
|
import { Text as L } from "../../components/Typography.js";
|
|
7
|
-
import { GroupWizardBus as
|
|
7
|
+
import { GroupWizardBus as m } from "../../controls/GroupWizard/index.js";
|
|
8
8
|
import { SidebarMenu as j } from "../../controls/GroupWizard/GroupWizardSidebar/SidebarMenu.js";
|
|
9
|
-
import { S as
|
|
10
|
-
import { buildRootSection as
|
|
11
|
-
function E(
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { S as p } from "../../controls/GroupWizard/GroupWizardSidebar/styles.js";
|
|
10
|
+
import { buildRootSection as N, shouldApplySidebarDesign as D } from "../../controls/GroupWizard/GroupWizardSidebar/utils.js";
|
|
11
|
+
function E(y, a, d) {
|
|
12
|
+
y.nodes.forEach((u) => {
|
|
13
|
+
d.nodesByKey.set(u.key, u), d.ancestorsByKey.set(u.key, a), u.sections.forEach((o) => E(o, [...a, u.key], d));
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
16
|
+
function F(y) {
|
|
17
|
+
const a = {
|
|
18
18
|
nodesByKey: /* @__PURE__ */ new Map(),
|
|
19
19
|
ancestorsByKey: /* @__PURE__ */ new Map()
|
|
20
20
|
};
|
|
21
|
-
return E(
|
|
21
|
+
return E(y, [], a), a;
|
|
22
22
|
}
|
|
23
|
-
function $(
|
|
23
|
+
function $(y) {
|
|
24
24
|
const {
|
|
25
|
-
parentPath:
|
|
26
|
-
questionItem:
|
|
27
|
-
context:
|
|
28
|
-
} =
|
|
29
|
-
linkId:
|
|
25
|
+
parentPath: a,
|
|
26
|
+
questionItem: d,
|
|
27
|
+
context: u
|
|
28
|
+
} = y, {
|
|
29
|
+
linkId: o,
|
|
30
30
|
hidden: G
|
|
31
|
-
} =
|
|
32
|
-
nodesByKey:
|
|
31
|
+
} = d, h = u[0], b = A(), [K, x] = S(null), [M, B] = S(/* @__PURE__ */ new Set()), [c, T] = S(null), t = w(() => N(d, a, b, h), [d, a, b, h]), {
|
|
32
|
+
nodesByKey: g,
|
|
33
33
|
ancestorsByKey: v
|
|
34
|
-
} = w(() =>
|
|
34
|
+
} = w(() => F(t), [t]), f = c ? g.get(c) : void 0, R = (c ? v.get(c) ?? [] : []).map((e) => g.get(e)).filter((e) => !!e && e.contentItems.length > 0);
|
|
35
35
|
z(() => {
|
|
36
|
-
if (!
|
|
37
|
-
const e =
|
|
38
|
-
T(e.key),
|
|
36
|
+
if (!f && t.nodes.length > 0) {
|
|
37
|
+
const e = t.nodes[0];
|
|
38
|
+
T(e.key), x(e.key);
|
|
39
39
|
}
|
|
40
|
-
}, [
|
|
40
|
+
}, [f, t]);
|
|
41
41
|
const I = (e) => {
|
|
42
42
|
T(e);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
43
|
+
const n = v.get(e) ?? [], [s, ...r] = n;
|
|
44
|
+
x(s ?? e), r.length > 0 && B((l) => /* @__PURE__ */ new Set([...l, ...r]));
|
|
45
|
+
}, C = (e) => {
|
|
46
|
+
const n = t.nodes.map((l) => l.key);
|
|
47
|
+
if (n.length < 2)
|
|
48
48
|
return;
|
|
49
|
-
if (
|
|
50
|
-
|
|
49
|
+
if (K !== e.key) {
|
|
50
|
+
x(e.key);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const r = (n.indexOf(e.key) + 1) % n.length;
|
|
54
|
+
x(n[r]);
|
|
55
55
|
};
|
|
56
|
-
return
|
|
57
|
-
e.type !== "sidebarSelect" || e.groupLinkId !==
|
|
58
|
-
}, [
|
|
59
|
-
if (e.type !== "sidebarGoToIndex" || e.groupLinkId !==
|
|
56
|
+
return m.useBus("sidebarSelect", (e) => {
|
|
57
|
+
e.type !== "sidebarSelect" || e.groupLinkId !== o || !g.has(e.key) || I(e.key);
|
|
58
|
+
}, [o, g]), m.useBus("sidebarGoToIndex", (e) => {
|
|
59
|
+
if (e.type !== "sidebarGoToIndex" || e.groupLinkId !== o)
|
|
60
60
|
return;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
}, [
|
|
61
|
+
const n = t.nodes[e.index];
|
|
62
|
+
n && I(n.key);
|
|
63
|
+
}, [o, t]), m.useBus("sidebarGoToPrevious", ({
|
|
64
64
|
groupLinkId: e
|
|
65
65
|
}) => {
|
|
66
|
-
if (e !==
|
|
66
|
+
if (e !== o)
|
|
67
67
|
return;
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
const n = t.nodes.findIndex((l) => l.key === c), s = Math.max(0, (n === -1 ? t.nodes.length : n) - 1), r = t.nodes[s];
|
|
69
|
+
r && I(r.key);
|
|
70
|
+
}, [o, t, c]), m.useBus("sidebarGoToNext", ({
|
|
71
|
+
groupLinkId: e
|
|
72
|
+
}) => {
|
|
73
|
+
if (e !== o)
|
|
74
|
+
return;
|
|
75
|
+
const n = t.nodes.findIndex((l) => l.key === c), s = Math.min(t.nodes.length - 1, n + 1), r = t.nodes[s];
|
|
76
|
+
r && I(r.key);
|
|
77
|
+
}, [o, t, c]), G || !d.item ? null : D(d) ? /* @__PURE__ */ k(p.Container, { children: [
|
|
78
|
+
/* @__PURE__ */ i(p.Sider, { children: /* @__PURE__ */ i(j, { section: t, expandedRootKey: K, expandedKeys: M, selectedKey: c, onToggleRoot: C, onToggleExpand: (e) => B((n) => {
|
|
79
|
+
const s = new Set(n);
|
|
80
|
+
return s.has(e) ? s.delete(e) : s.add(e), s;
|
|
81
|
+
}), onSelect: (e) => m.dispatch({
|
|
75
82
|
type: "sidebarSelect",
|
|
76
|
-
groupLinkId:
|
|
83
|
+
groupLinkId: o,
|
|
77
84
|
key: e.key
|
|
78
85
|
}) }) }),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ i(p.Content, { children: f ? /* @__PURE__ */ k(W, { children: [
|
|
87
|
+
R.map((e) => /* @__PURE__ */ k(p.ParentPreview, { children: [
|
|
88
|
+
/* @__PURE__ */ i(p.ParentPreviewTitle, { level: 5, children: e.text }),
|
|
89
|
+
/* @__PURE__ */ i(P, { questionItems: e.contentItems, parentPath: e.path, context: h })
|
|
83
90
|
] }, e.key)),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ i(p.ContentHeader, { children: /* @__PURE__ */ i(p.ContentTitle, { level: 4, children: f.text }) }),
|
|
92
|
+
/* @__PURE__ */ i(P, { questionItems: f.contentItems, parentPath: f.path, context: h })
|
|
86
93
|
] }) : null })
|
|
87
|
-
] }) : (console.error("GroupWizardSidebar was used for a group that does not match the sidebar design criteria"), /* @__PURE__ */
|
|
94
|
+
] }) : (console.error("GroupWizardSidebar was used for a group that does not match the sidebar design criteria"), /* @__PURE__ */ i(L, { children: /* @__PURE__ */ i(q, { id: "vya+nX" }) }));
|
|
88
95
|
}
|
|
89
96
|
export {
|
|
90
97
|
$ as GroupWizardSidebar
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._column_14bfg_1{display:flex;flex-direction:column}._row_14bfg_6{display:flex;flex-direction:row;justify-content:space-between;align-items:center}._questionText_14bfg_13{font-weight:700;margin:0}._answer_14bfg_18{display:block;min-width:40%;max-width:40%}.ant-dropdown .ant-table-filter-dropdown{border:0;background:none;box-shadow:none;position:relative;overflow:visible}._row_dy31e_1{display:flex}._inputWrapper_dy31e_5{flex:auto}._splitterWrapper_dy31e_9{display:flex;flex-direction:column;justify-content:flex-end}._splitter_dy31e_9{position:relative;bottom:22px;margin:0 8px;font-weight:400;font-size:20px;line-height:22px}._form_1v4sy_1 .ant-form-item-label{font-weight:700}._form_1v4sy_1 .ant-form-item-row{flex:1;flex-direction:column;justify-content:space-between;gap:12px}._form_1v4sy_1 .ant-form-item-label{text-align:start;white-space:normal}._form_1v4sy_1 .ant-form-item-label label{display:flex;height:auto}._form_1v4sy_1 .ant-form-item-label label:after{display:none}._form_1v4sy_1 .ant-form-item-control{flex-grow:0}._content_1v4sy_25{display:flex;flex-direction:column;gap:24px}._field_1v4sy_31{width:100%;margin-bottom:0;display:flex}._field_1v4sy_31.__hidden_1v4sy_36{display:none}._group_1ndd9_1{display:flex;flex-direction:column;gap:16px;width:100%}._groupTitle_1ndd9_8{font-weight:700;font-size:16px;line-height:24px}._row_1ndd9_14{display:flex;flex-direction:row;justify-content:space-between;gap:16px;width:100%}._col_1ndd9_22{display:flex;flex-direction:column;gap:16px}._inputContainer_gs0vq_1{display:flex;flex-direction:column}._inputHeader_gs0vq_6{display:flex;margin-bottom:12px;align-items:center;justify-content:space-between}._label_gs0vq_13{font-weight:700;font-size:14px;line-height:22px}
|
package/package.json
CHANGED
|
@@ -344,7 +344,7 @@ msgstr ""
|
|
|
344
344
|
#~ msgstr ""
|
|
345
345
|
|
|
346
346
|
#: src/controls/GroupTable/hooks.tsx:615
|
|
347
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
347
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:296
|
|
348
348
|
msgid "Are you sure you want to delete this item?"
|
|
349
349
|
msgstr ""
|
|
350
350
|
|
|
@@ -1643,8 +1643,8 @@ msgstr ""
|
|
|
1643
1643
|
#~ msgid "The questionnaire is saved"
|
|
1644
1644
|
#~ msgstr ""
|
|
1645
1645
|
|
|
1646
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
1647
|
-
#: src/readonly-controls/GroupWizardSidebar/index.tsx:
|
|
1646
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:242
|
|
1647
|
+
#: src/readonly-controls/GroupWizardSidebar/index.tsx:176
|
|
1648
1648
|
msgid "The sidebar item control requires at least 2 subgroups"
|
|
1649
1649
|
msgstr ""
|
|
1650
1650
|
|
|
@@ -361,7 +361,7 @@ msgstr ""
|
|
|
361
361
|
#~ msgstr ""
|
|
362
362
|
|
|
363
363
|
#: src/controls/GroupTable/hooks.tsx:615
|
|
364
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
364
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:296
|
|
365
365
|
msgid "Are you sure you want to delete this item?"
|
|
366
366
|
msgstr ""
|
|
367
367
|
|
|
@@ -1868,8 +1868,8 @@ msgstr ""
|
|
|
1868
1868
|
#~ msgid "The questionnaire is saved"
|
|
1869
1869
|
#~ msgstr ""
|
|
1870
1870
|
|
|
1871
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
1872
|
-
#: src/readonly-controls/GroupWizardSidebar/index.tsx:
|
|
1871
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:242
|
|
1872
|
+
#: src/readonly-controls/GroupWizardSidebar/index.tsx:176
|
|
1873
1873
|
msgid "The sidebar item control requires at least 2 subgroups"
|
|
1874
1874
|
msgstr ""
|
|
1875
1875
|
|
|
@@ -361,7 +361,7 @@ msgstr ""
|
|
|
361
361
|
#~ msgstr "¿Estás seguro de que quieres eliminar el documento?"
|
|
362
362
|
|
|
363
363
|
#: src/controls/GroupTable/hooks.tsx:615
|
|
364
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
364
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:296
|
|
365
365
|
msgid "Are you sure you want to delete this item?"
|
|
366
366
|
msgstr "¿Estás seguro que deseas eliminar este ítem?"
|
|
367
367
|
|
|
@@ -1852,8 +1852,8 @@ msgstr ""
|
|
|
1852
1852
|
#~ msgid "The questionnaire is saved"
|
|
1853
1853
|
#~ msgstr "El cuestionario fue guardado"
|
|
1854
1854
|
|
|
1855
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
1856
|
-
#: src/readonly-controls/GroupWizardSidebar/index.tsx:
|
|
1855
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:242
|
|
1856
|
+
#: src/readonly-controls/GroupWizardSidebar/index.tsx:176
|
|
1857
1857
|
msgid "The sidebar item control requires at least 2 subgroups"
|
|
1858
1858
|
msgstr ""
|
|
1859
1859
|
|
|
@@ -361,7 +361,7 @@ msgstr ""
|
|
|
361
361
|
#~ msgstr ""
|
|
362
362
|
|
|
363
363
|
#: src/controls/GroupTable/hooks.tsx:615
|
|
364
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
364
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:296
|
|
365
365
|
msgid "Are you sure you want to delete this item?"
|
|
366
366
|
msgstr ""
|
|
367
367
|
|
|
@@ -1868,8 +1868,8 @@ msgstr ""
|
|
|
1868
1868
|
#~ msgid "The questionnaire is saved"
|
|
1869
1869
|
#~ msgstr ""
|
|
1870
1870
|
|
|
1871
|
-
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:
|
|
1872
|
-
#: src/readonly-controls/GroupWizardSidebar/index.tsx:
|
|
1871
|
+
#: src/controls/GroupWizard/GroupWizardSidebar/index.tsx:242
|
|
1872
|
+
#: src/readonly-controls/GroupWizardSidebar/index.tsx:176
|
|
1873
1873
|
msgid "The sidebar item control requires at least 2 subgroups"
|
|
1874
1874
|
msgstr ""
|
|
1875
1875
|
|