@beda.software/web-item-controls 0.1.24 → 0.1.25-group-accordion.1
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/Group/AccordionSection/index.d.ts +12 -0
- package/dist/controls/Group/AccordionSection/index.d.ts.map +1 -0
- package/dist/controls/Group/AccordionSection/index.js +33 -0
- package/dist/controls/Group/AccordionSection/styles.d.ts +13 -0
- package/dist/controls/Group/AccordionSection/styles.d.ts.map +1 -0
- package/dist/controls/Group/AccordionSection/styles.js +38 -0
- package/dist/controls/Group/ChildGroupAccordionProvider.d.ts +9 -0
- package/dist/controls/Group/ChildGroupAccordionProvider.d.ts.map +1 -0
- package/dist/controls/Group/ChildGroupAccordionProvider.js +24 -0
- package/dist/controls/Group/GoalsAndTasksAccordion.fixtures.d.ts +8 -0
- package/dist/controls/Group/GoalsAndTasksAccordion.fixtures.d.ts.map +1 -0
- package/dist/controls/Group/GroupAccordionExpandBus.stories.utils.d.ts +11 -0
- package/dist/controls/Group/GroupAccordionExpandBus.stories.utils.d.ts.map +1 -0
- package/dist/controls/Group/GroupCard/index.d.ts +3 -0
- package/dist/controls/Group/GroupCard/index.d.ts.map +1 -1
- package/dist/controls/Group/GroupCard/index.js +72 -40
- package/dist/controls/Group/GroupCard/styles.d.ts +14 -2
- package/dist/controls/Group/GroupCard/styles.d.ts.map +1 -1
- package/dist/controls/Group/GroupCard/styles.js +31 -11
- package/dist/controls/Group/RepeatableGroups/RepeatableGroupCard/index.d.ts.map +1 -1
- package/dist/controls/Group/RepeatableGroups/RepeatableGroupCard/index.js +23 -19
- package/dist/controls/Group/RepeatableGroups/index.d.ts.map +1 -1
- package/dist/controls/Group/RepeatableGroups/index.js +126 -50
- package/dist/controls/Group/RepeatableGroups/types.d.ts +2 -0
- package/dist/controls/Group/RepeatableGroups/types.d.ts.map +1 -1
- package/dist/controls/Group/accordionContext.d.ts +19 -0
- package/dist/controls/Group/accordionContext.d.ts.map +1 -0
- package/dist/controls/Group/accordionContext.js +47 -0
- package/dist/controls/Group/index.d.ts.map +1 -1
- package/dist/controls/Group/index.js +89 -67
- package/dist/controls/GroupWizard/GroupWizard.stories.utils.d.ts +1 -1
- package/dist/controls/GroupWizard/GroupWizard.stories.utils.d.ts.map +1 -1
- package/dist/controls/GroupWizard/index.d.ts +46 -1
- package/dist/controls/GroupWizard/index.d.ts.map +1 -1
- package/dist/controls/controls.js +14 -12
- package/dist/style.css +1 -1
- package/package.json +9 -14
- package/src/locale/de/messages.po +9 -6
- package/src/locale/en/messages.po +9 -6
- package/src/locale/es/messages.po +9 -6
- package/src/locale/ru/messages.po +9 -6
|
@@ -1,57 +1,133 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Trans as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsxs as b, Fragment as R, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Trans as K } from "@lingui/react";
|
|
3
|
+
import { i18n as I } from "@lingui/core";
|
|
4
|
+
import { PlusOutlined as q } from "@ant-design/icons";
|
|
5
|
+
import { Modal as w, Button as S } from "antd";
|
|
6
|
+
import a from "lodash";
|
|
7
|
+
import E, { useState as H } from "react";
|
|
8
|
+
import { useFormContext as Q, useFieldArray as W } from "react-hook-form";
|
|
9
|
+
import { getItemKey as s, populateItemKey as X } from "sdc-qrf";
|
|
10
|
+
import { useFieldController as Z } from "../../../components/BaseQuestionnaireResponseForm/hooks.js";
|
|
11
|
+
import { GroupWizardBus as u } from "../../GroupWizard/index.js";
|
|
12
|
+
import { useGroupAccordionMode as D } from "../accordionContext.js";
|
|
13
|
+
import { RepeatableGroupCard as J } from "./RepeatableGroupCard/index.js";
|
|
14
|
+
import { S as L } from "./styles.js";
|
|
15
|
+
function U(f) {
|
|
16
|
+
return [...f, {}];
|
|
14
17
|
}
|
|
15
|
-
function
|
|
18
|
+
function le(f) {
|
|
16
19
|
const {
|
|
17
|
-
groupItem:
|
|
18
|
-
renderGroup:
|
|
19
|
-
buildValue:
|
|
20
|
-
} =
|
|
21
|
-
parentPath:
|
|
22
|
-
questionItem:
|
|
23
|
-
} =
|
|
24
|
-
linkId:
|
|
25
|
-
text:
|
|
26
|
-
} =
|
|
20
|
+
groupItem: l,
|
|
21
|
+
renderGroup: h,
|
|
22
|
+
buildValue: j = U
|
|
23
|
+
} = f, {
|
|
24
|
+
parentPath: x,
|
|
25
|
+
questionItem: y
|
|
26
|
+
} = l, {
|
|
27
|
+
linkId: o,
|
|
28
|
+
text: G
|
|
29
|
+
} = y, k = [...x, o], {
|
|
27
30
|
onChange: m
|
|
28
|
-
} =
|
|
29
|
-
getValues:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
} = Z(k, y), {
|
|
32
|
+
getValues: M,
|
|
33
|
+
control: P
|
|
34
|
+
} = Q(), {
|
|
35
|
+
remove: T
|
|
36
|
+
} = W({
|
|
37
|
+
control: P,
|
|
38
|
+
name: [...x, o, "items"].join(".")
|
|
39
|
+
}), p = a.get(M(), k), V = (e) => (j(e) || []).map(X), t = (p == null ? void 0 : p.items) || [], n = D(), [O, g] = H(() => n && t.length ? s(t[t.length - 1]) : null), d = n && t.length ? a.some(t, (e) => s(e) === O) ? O : s(t[t.length - 1]) : null, [v, _] = w.useModal(), B = () => {
|
|
40
|
+
const e = V(t ?? []);
|
|
41
|
+
m({
|
|
42
|
+
...p,
|
|
43
|
+
items: e
|
|
44
|
+
}), n && e.length && g(s(e[e.length - 1]));
|
|
45
|
+
}, C = (e) => {
|
|
46
|
+
if (!n)
|
|
47
|
+
return;
|
|
48
|
+
const r = a.map(t, s).indexOf(d) + e;
|
|
49
|
+
r < 0 || r >= t.length || g(s(t[r]));
|
|
50
|
+
}, z = () => {
|
|
51
|
+
const e = a.map(t, s).indexOf(d);
|
|
52
|
+
e !== -1 && (T(e), m({
|
|
53
|
+
...p,
|
|
54
|
+
items: [...t.slice(0, e), ...t.slice(e + 1)]
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
return u.useBus("addItem", ({
|
|
58
|
+
groupLinkId: e
|
|
59
|
+
}) => {
|
|
60
|
+
e === o && (u.dispatch({
|
|
61
|
+
type: "expandGroup",
|
|
62
|
+
groupLinkId: o
|
|
63
|
+
}), B());
|
|
64
|
+
}, [o, t, p, m, n]), u.useBus("openNextItem", ({
|
|
65
|
+
groupLinkId: e
|
|
66
|
+
}) => {
|
|
67
|
+
e === o && (u.dispatch({
|
|
68
|
+
type: "expandGroup",
|
|
69
|
+
groupLinkId: o
|
|
70
|
+
}), C(1));
|
|
71
|
+
}, [o, t, d]), u.useBus("openPreviousItem", ({
|
|
72
|
+
groupLinkId: e
|
|
73
|
+
}) => {
|
|
74
|
+
e === o && (u.dispatch({
|
|
75
|
+
type: "expandGroup",
|
|
76
|
+
groupLinkId: o
|
|
77
|
+
}), C(-1));
|
|
78
|
+
}, [o, t, d]), u.useBus("removeItem", ({
|
|
79
|
+
groupLinkId: e
|
|
80
|
+
}) => {
|
|
81
|
+
e !== o || !n || (u.dispatch({
|
|
82
|
+
type: "expandGroup",
|
|
83
|
+
groupLinkId: o
|
|
84
|
+
}), v.confirm({
|
|
85
|
+
title: I._(
|
|
86
|
+
/*i18n*/
|
|
87
|
+
{
|
|
88
|
+
id: "XtpCjZ"
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
okText: I._(
|
|
92
|
+
/*i18n*/
|
|
93
|
+
{
|
|
94
|
+
id: "cnGeoo"
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
okButtonProps: {
|
|
98
|
+
danger: !0
|
|
99
|
+
},
|
|
100
|
+
cancelText: I._(
|
|
101
|
+
/*i18n*/
|
|
102
|
+
{
|
|
103
|
+
id: "dEgA5A"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
onOk: z
|
|
107
|
+
}));
|
|
108
|
+
}, [o, n, t, d, p, m, v]), /* @__PURE__ */ b(R, { children: [
|
|
109
|
+
_,
|
|
110
|
+
/* @__PURE__ */ b(L.Group, { children: [
|
|
111
|
+
a.map(t, (e, c) => {
|
|
112
|
+
if (!t[c])
|
|
113
|
+
return null;
|
|
114
|
+
const r = s(e), A = n ? r === d : void 0, F = n ? () => g((N) => N === r ? null : r) : void 0;
|
|
115
|
+
return h ? /* @__PURE__ */ i(E.Fragment, { children: h({
|
|
116
|
+
index: c,
|
|
117
|
+
items: t,
|
|
118
|
+
onChange: m,
|
|
119
|
+
groupItem: l,
|
|
120
|
+
isOpen: A,
|
|
121
|
+
onToggle: F
|
|
122
|
+
}) }, r) : /* @__PURE__ */ i(J, { index: c, items: t, onChange: m, groupItem: l, variant: "main-card", isOpen: A, onToggle: F }, r);
|
|
123
|
+
}),
|
|
124
|
+
l.questionItem.readOnly ? null : /* @__PURE__ */ i(L.Footer, { children: /* @__PURE__ */ i(S, { icon: /* @__PURE__ */ i(q, {}), type: "primary", ghost: !0, onClick: B, size: "middle", "data-testid": "add-another-answer-button", children: /* @__PURE__ */ i("span", { children: G ? /* @__PURE__ */ i(K, { id: "yCbNQL", values: {
|
|
125
|
+
text: G
|
|
126
|
+
} }) : /* @__PURE__ */ i(K, { id: "kiGxiz" }) }) }) })
|
|
127
|
+
] })
|
|
52
128
|
] });
|
|
53
129
|
}
|
|
54
130
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
131
|
+
J as RepeatableGroupCard,
|
|
132
|
+
le as RepeatableGroups
|
|
57
133
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/RepeatableGroups/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/RepeatableGroups/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,cAAc,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FCEQuestionnaireItem } from 'sdc-qrf';
|
|
2
|
+
export declare function getAccordionSiblingCandidates(item: FCEQuestionnaireItem[] | undefined): FCEQuestionnaireItem[];
|
|
3
|
+
export declare function qualifiesForAccordion(candidates: FCEQuestionnaireItem[]): boolean;
|
|
4
|
+
export declare function containsLinkId(item: FCEQuestionnaireItem, linkId: string): boolean;
|
|
5
|
+
export declare function findCandidateContaining(candidates: FCEQuestionnaireItem[], linkId: string): FCEQuestionnaireItem | undefined;
|
|
6
|
+
export declare function getPendingExpandTarget(): string | undefined;
|
|
7
|
+
export declare function setPendingExpandTarget(linkId: string): void;
|
|
8
|
+
export declare const GroupAccordionModeContext: import('react').Context<boolean>;
|
|
9
|
+
export declare function useGroupAccordionMode(): boolean;
|
|
10
|
+
export interface GroupSiblingAccordionContextProps {
|
|
11
|
+
activeLinkId: string;
|
|
12
|
+
setActiveLinkId: (linkId: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const GroupSiblingAccordionContext: import('react').Context<GroupSiblingAccordionContextProps | undefined>;
|
|
15
|
+
export declare function useGroupSiblingAccordion(linkId: string): {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
onToggle: () => void;
|
|
18
|
+
} | undefined;
|
|
19
|
+
//# sourceMappingURL=accordionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordionContext.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/accordionContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAM/C,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,SAAS,0BAErF;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,oBAAoB,EAAE,WAEvE;AAKD,wBAAgB,cAAc,CAAC,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMlF;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,MAAM,oCAEzF;AAYD,wBAAgB,sBAAsB,uBAErC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,QAEpD;AAED,eAAO,MAAM,yBAAyB,kCAAuB,CAAC;AAE9D,wBAAgB,qBAAqB,YAEpC;AAED,MAAM,WAAW,iCAAiC;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,4BAA4B,wEAA0E,CAAC;AAEpH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM;;;cAatD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createContext as o, useContext as i } from "react";
|
|
2
|
+
function g(n) {
|
|
3
|
+
return (n ?? []).filter((t) => t.type === "group" && !t.hidden);
|
|
4
|
+
}
|
|
5
|
+
function s(n) {
|
|
6
|
+
return n.length > 1 && n.some((t) => t.repeats);
|
|
7
|
+
}
|
|
8
|
+
function r(n, t) {
|
|
9
|
+
return n.linkId === t ? !0 : (n.item ?? []).some((e) => r(e, t));
|
|
10
|
+
}
|
|
11
|
+
function a(n, t) {
|
|
12
|
+
return n.find((e) => r(e, t));
|
|
13
|
+
}
|
|
14
|
+
let c;
|
|
15
|
+
function p() {
|
|
16
|
+
return c;
|
|
17
|
+
}
|
|
18
|
+
function x(n) {
|
|
19
|
+
c = n;
|
|
20
|
+
}
|
|
21
|
+
const u = o(!1);
|
|
22
|
+
function l() {
|
|
23
|
+
return i(u);
|
|
24
|
+
}
|
|
25
|
+
const d = o(void 0);
|
|
26
|
+
function A(n) {
|
|
27
|
+
const t = i(d);
|
|
28
|
+
if (!t)
|
|
29
|
+
return;
|
|
30
|
+
const e = t.activeLinkId === n;
|
|
31
|
+
return {
|
|
32
|
+
isOpen: e,
|
|
33
|
+
onToggle: () => t.setActiveLinkId(e ? "" : n)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
u as GroupAccordionModeContext,
|
|
38
|
+
d as GroupSiblingAccordionContext,
|
|
39
|
+
r as containsLinkId,
|
|
40
|
+
a as findCandidateContaining,
|
|
41
|
+
g as getAccordionSiblingCandidates,
|
|
42
|
+
p as getPendingExpandTarget,
|
|
43
|
+
s as qualifiesForAccordion,
|
|
44
|
+
x as setPendingExpandTarget,
|
|
45
|
+
l as useGroupAccordionMode,
|
|
46
|
+
A as useGroupSiblingAccordion
|
|
47
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/Group/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AA2GxD,wBAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,2CAE1C;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,2CAExC;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,2CAExC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,2CAE3C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,cAAc,2CAEzC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,2CAE5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,2CAEvD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,2CAE7C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,2CAE5C"}
|
|
@@ -1,86 +1,108 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import w from "lodash";
|
|
4
|
+
import { useFormContext as y } from "react-hook-form";
|
|
5
|
+
import { QuestionItems as C } from "sdc-qrf";
|
|
6
|
+
import { ItemHelpText as S } from "../../components/BaseQuestionnaireResponseForm/ItemHelpText.js";
|
|
7
|
+
import { Title as T } from "../../components/Typography.js";
|
|
8
|
+
import { useGroupSiblingAccordion as P } from "./accordionContext.js";
|
|
9
|
+
import { AccordionSection as R } from "./AccordionSection/index.js";
|
|
10
|
+
import { ChildGroupAccordionProvider as q } from "./ChildGroupAccordionProvider.js";
|
|
11
|
+
import { GroupContext as A } from "./context.js";
|
|
12
|
+
import { GridGroup as F } from "./GridGroup/index.js";
|
|
13
|
+
import h from "./group.module.scss.js";
|
|
14
|
+
import { GroupCard as x } from "./GroupCard/index.js";
|
|
15
|
+
import { GTable as O } from "./GTable/index.js";
|
|
16
|
+
import { RepeatableGroups as g } from "./RepeatableGroups/index.js";
|
|
17
|
+
import { S as f } from "./styles.js";
|
|
18
|
+
import { RepeatableGroupRow as j } from "./RepeatableGroups/RepeatableGroupRow.js";
|
|
19
|
+
function G(t) {
|
|
15
20
|
const {
|
|
16
|
-
parentPath:
|
|
17
|
-
questionItem:
|
|
18
|
-
context:
|
|
21
|
+
parentPath: m,
|
|
22
|
+
questionItem: l,
|
|
23
|
+
context: u,
|
|
19
24
|
type: e = "col"
|
|
20
|
-
} =
|
|
21
|
-
linkId:
|
|
22
|
-
item:
|
|
23
|
-
repeats:
|
|
24
|
-
text:
|
|
25
|
-
helpText: i
|
|
26
|
-
|
|
27
|
-
} = f;
|
|
28
|
-
if (x)
|
|
29
|
-
return null;
|
|
30
|
-
const b = () => e === "gtable" ? /* @__PURE__ */ t(T, { groupItem: r }) : e === "row" ? /* @__PURE__ */ t(l, { groupItem: r, renderGroup: (I) => /* @__PURE__ */ t(P, { ...I }) }) : /* @__PURE__ */ t(l, { groupItem: r });
|
|
25
|
+
} = t, {
|
|
26
|
+
linkId: p,
|
|
27
|
+
item: c,
|
|
28
|
+
repeats: d,
|
|
29
|
+
text: o,
|
|
30
|
+
helpText: i
|
|
31
|
+
} = l, a = () => e === "gtable" ? /* @__PURE__ */ r(O, { groupItem: t }) : e === "row" ? /* @__PURE__ */ r(g, { groupItem: t, renderGroup: (I) => /* @__PURE__ */ r(j, { ...I }) }) : /* @__PURE__ */ r(g, { groupItem: t });
|
|
31
32
|
if (e === "grid")
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
if (
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ r(F, { groupItem: t });
|
|
34
|
+
if (d)
|
|
35
|
+
return /* @__PURE__ */ r(A.Provider, { value: {
|
|
35
36
|
type: e
|
|
36
|
-
}, children:
|
|
37
|
+
}, children: a() });
|
|
37
38
|
const v = e === "section" || e === "section-with-divider";
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
i && /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ s(f.Group, { children: [
|
|
40
|
+
o || i ? /* @__PURE__ */ r(f.Header, { $type: e, children: /* @__PURE__ */ s(f.Title, { children: [
|
|
41
|
+
o && /* @__PURE__ */ r(T, { level: v ? 4 : 5, children: o }),
|
|
42
|
+
i && /* @__PURE__ */ r(S, { helpText: i })
|
|
42
43
|
] }) }) : null,
|
|
43
|
-
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
}), children: /* @__PURE__ */
|
|
44
|
+
c && /* @__PURE__ */ r("div", { className: b({
|
|
45
|
+
[h.row]: e === "row",
|
|
46
|
+
[h.col]: !e || e === "col"
|
|
47
|
+
}), children: /* @__PURE__ */ r(q, { item: c, children: /* @__PURE__ */ r(C, { questionItems: c, parentPath: [...m, p, "items"], context: u[0] }) }) })
|
|
47
48
|
] });
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
50
|
+
function n(t) {
|
|
51
|
+
var i;
|
|
52
|
+
const {
|
|
53
|
+
parentPath: m,
|
|
54
|
+
questionItem: l
|
|
55
|
+
} = t, {
|
|
56
|
+
linkId: u,
|
|
57
|
+
text: e,
|
|
58
|
+
repeats: p,
|
|
59
|
+
hidden: c
|
|
60
|
+
} = l, {
|
|
61
|
+
getValues: d
|
|
62
|
+
} = y(), o = P(u);
|
|
63
|
+
if (c)
|
|
64
|
+
return null;
|
|
65
|
+
if (o) {
|
|
66
|
+
const a = p ? ((i = w.get(d(), [...m, u, "items"])) == null ? void 0 : i.length) ?? 0 : void 0;
|
|
67
|
+
return /* @__PURE__ */ r(R, { linkId: u, title: e, count: a, isOpen: o.isOpen, onToggle: o.onToggle, children: o.isOpen ? /* @__PURE__ */ r(G, { ...t }) : null });
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ r(G, { ...t });
|
|
70
|
+
}
|
|
71
|
+
function Y(t) {
|
|
72
|
+
return /* @__PURE__ */ r(n, { ...t });
|
|
51
73
|
}
|
|
52
|
-
function
|
|
53
|
-
return /* @__PURE__ */
|
|
74
|
+
function Z(t) {
|
|
75
|
+
return /* @__PURE__ */ r(n, { ...t, type: "col" });
|
|
54
76
|
}
|
|
55
|
-
function
|
|
56
|
-
return /* @__PURE__ */
|
|
77
|
+
function tt(t) {
|
|
78
|
+
return /* @__PURE__ */ r(n, { ...t, type: "row" });
|
|
57
79
|
}
|
|
58
|
-
function
|
|
59
|
-
return /* @__PURE__ */
|
|
80
|
+
function rt(t) {
|
|
81
|
+
return /* @__PURE__ */ r(n, { ...t, type: "gtable" });
|
|
60
82
|
}
|
|
61
|
-
function
|
|
62
|
-
return /* @__PURE__ */
|
|
83
|
+
function et(t) {
|
|
84
|
+
return /* @__PURE__ */ r(n, { ...t, type: "grid" });
|
|
63
85
|
}
|
|
64
|
-
function
|
|
65
|
-
return /* @__PURE__ */
|
|
86
|
+
function ot(t) {
|
|
87
|
+
return /* @__PURE__ */ r(n, { ...t, type: "section" });
|
|
66
88
|
}
|
|
67
|
-
function
|
|
68
|
-
return /* @__PURE__ */
|
|
89
|
+
function nt(t) {
|
|
90
|
+
return /* @__PURE__ */ r(n, { ...t, type: "section-with-divider" });
|
|
69
91
|
}
|
|
70
|
-
function
|
|
71
|
-
return /* @__PURE__ */
|
|
92
|
+
function it(t) {
|
|
93
|
+
return /* @__PURE__ */ r(x, { ...t, variant: "main-card" });
|
|
72
94
|
}
|
|
73
|
-
function
|
|
74
|
-
return /* @__PURE__ */
|
|
95
|
+
function ut(t) {
|
|
96
|
+
return /* @__PURE__ */ r(x, { ...t, variant: "sub-card" });
|
|
75
97
|
}
|
|
76
98
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
Z as Col,
|
|
100
|
+
et as Grid,
|
|
101
|
+
Y as Group,
|
|
102
|
+
rt as Gtable,
|
|
103
|
+
it as MainCard,
|
|
104
|
+
tt as Row,
|
|
105
|
+
ot as Section,
|
|
106
|
+
nt as SectionWithDivider,
|
|
107
|
+
ut as SubCard
|
|
86
108
|
};
|
|
@@ -6,5 +6,5 @@ export declare const QUESTIONNAIRE: Questionnaire;
|
|
|
6
6
|
export declare const QUESTIONNAIRE_RESPONSE: QuestionnaireResponse;
|
|
7
7
|
export declare const CONTEXT: ItemContext[];
|
|
8
8
|
export declare const WithGroupWizardProviderDecorator: Decorator;
|
|
9
|
-
export declare function testScrollTo(qi: FCEQuestionnaireItem): import('
|
|
9
|
+
export declare function testScrollTo(qi: FCEQuestionnaireItem): import('storybook/internal/csf').PlayFunction<import('@storybook/react').ReactRenderer, {}>;
|
|
10
10
|
//# sourceMappingURL=GroupWizard.stories.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupWizard.stories.utils.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/GroupWizard.stories.utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupWizard.stories.utils.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupWizard/GroupWizard.stories.utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAa,WAAW,EAAqC,MAAM,SAAS,CAAC;AAY1G,eAAO,MAAM,WAAW,EAAE,oBAqEzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAI3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAGpC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAAW,EAMhC,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,SAsB9C,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,EAAE,oBAAoB,+FAkBpD"}
|
|
@@ -4,16 +4,61 @@ export interface GroupWizardProps extends GroupItemProps {
|
|
|
4
4
|
wizard?: Partial<WizardProps>;
|
|
5
5
|
}
|
|
6
6
|
export declare const GroupWizardBus: {
|
|
7
|
-
useBus: (type: "scrollTo", callback: (e: {
|
|
7
|
+
useBus: (type: "scrollTo" | "expandGroup" | "addItem" | "openNextItem" | "openPreviousItem" | "removeItem", callback: (e: {
|
|
8
8
|
type: "scrollTo";
|
|
9
9
|
groupLinkId: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "expandGroup";
|
|
12
|
+
groupLinkId: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: "addItem";
|
|
15
|
+
groupLinkId: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: "openNextItem";
|
|
18
|
+
groupLinkId: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: "openPreviousItem";
|
|
21
|
+
groupLinkId: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "removeItem";
|
|
24
|
+
groupLinkId: string;
|
|
10
25
|
}) => void, deps: Array<any>) => (action: {
|
|
11
26
|
type: "scrollTo";
|
|
12
27
|
groupLinkId: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "expandGroup";
|
|
30
|
+
groupLinkId: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: "addItem";
|
|
33
|
+
groupLinkId: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: "openNextItem";
|
|
36
|
+
groupLinkId: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: "openPreviousItem";
|
|
39
|
+
groupLinkId: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: "removeItem";
|
|
42
|
+
groupLinkId: string;
|
|
13
43
|
}) => void;
|
|
14
44
|
dispatch: (action: {
|
|
15
45
|
type: "scrollTo";
|
|
16
46
|
groupLinkId: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: "expandGroup";
|
|
49
|
+
groupLinkId: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "addItem";
|
|
52
|
+
groupLinkId: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: "openNextItem";
|
|
55
|
+
groupLinkId: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: "openPreviousItem";
|
|
58
|
+
groupLinkId: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: "removeItem";
|
|
61
|
+
groupLinkId: string;
|
|
17
62
|
}) => void;
|
|
18
63
|
};
|
|
19
64
|
export declare function GroupWizardVertical(props: GroupWizardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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;;
|
|
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;;cAQb,aAAa;qBACN,MAAM;;cAKb,SAAS;qBACF,MAAM;;cAIb,cAAc;qBACP,MAAM;;cAGb,kBAAkB;qBACX,MAAM;;cAKb,YAAY;qBACL,MAAM;;cA/Bb,UAAU;qBACH,MAAM;;cAQb,aAAa;qBACN,MAAM;;cAKb,SAAS;qBACF,MAAM;;cAIb,cAAc;qBACP,MAAM;;cAGb,kBAAkB;qBACX,MAAM;;cAKb,YAAY;qBACL,MAAM;;;cA/Bb,UAAU;qBACH,MAAM;;cAQb,aAAa;qBACN,MAAM;;cAKb,SAAS;qBACF,MAAM;;cAIb,cAAc;qBACP,MAAM;;cAGb,kBAAkB;qBACX,MAAM;;cAKb,YAAY;qBACL,MAAM;;CAE1B,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"}
|
|
@@ -26,10 +26,13 @@ import "@lingui/react";
|
|
|
26
26
|
import "sdc-qrf";
|
|
27
27
|
import "./Group/GridGroup/Grid.styles.js";
|
|
28
28
|
import "@lingui/core";
|
|
29
|
+
import { GroupWizard as m, GroupWizardWithTooltips as w, GroupWizardVertical as G } from "./GroupWizard/index.js";
|
|
30
|
+
import "./Group/accordionContext.js";
|
|
29
31
|
import "./Group/GroupCard/styles.js";
|
|
32
|
+
import "./Group/AccordionSection/styles.js";
|
|
30
33
|
import "./Group/RepeatableGroups/styles.js";
|
|
31
34
|
import "./Group/GTable/GTable.styles.js";
|
|
32
|
-
import { GroupTable as
|
|
35
|
+
import { GroupTable as I } from "./GroupTable/index.js";
|
|
33
36
|
import "recharts";
|
|
34
37
|
import "styled-components";
|
|
35
38
|
import "./GroupTable/GroupTableChart/Tooltip/styles.js";
|
|
@@ -45,7 +48,6 @@ import "../utils/yup-locale.js";
|
|
|
45
48
|
import "antd/es/layout/layout";
|
|
46
49
|
import "antd/es/layout/Sider";
|
|
47
50
|
import "../components/Wizard/styles.js";
|
|
48
|
-
import { GroupWizard as m, GroupWizardWithTooltips as G, GroupWizardVertical as I } from "./GroupWizard/index.js";
|
|
49
51
|
import "../readonly-controls/GroupWizard/styles.js";
|
|
50
52
|
import "react-markdown";
|
|
51
53
|
import "rehype-raw";
|
|
@@ -77,7 +79,7 @@ import { QuestionText as B, QuestionString as E, QuestionEmail as M } from "./St
|
|
|
77
79
|
import { TextWithMacroFill as q } from "./TextWithMacroFill/index.js";
|
|
78
80
|
import { TimeRangePickerControl as F } from "./TimeRangePickerControl/index.js";
|
|
79
81
|
import { UploadFileControl as U } from "./UploadFileControl/index.js";
|
|
80
|
-
const
|
|
82
|
+
const fr = {
|
|
81
83
|
text: B,
|
|
82
84
|
string: E,
|
|
83
85
|
decimal: R,
|
|
@@ -92,7 +94,7 @@ const lr = {
|
|
|
92
94
|
reference: T,
|
|
93
95
|
quantity: D,
|
|
94
96
|
attachment: U
|
|
95
|
-
},
|
|
97
|
+
}, br = l, gr = {
|
|
96
98
|
phoneWidget: v,
|
|
97
99
|
email: M,
|
|
98
100
|
passwordWidget: k,
|
|
@@ -109,7 +111,7 @@ const lr = {
|
|
|
109
111
|
barcode: n,
|
|
110
112
|
// reference-radio-button is deprecated, use inline-reference instead
|
|
111
113
|
"reference-radio-button": e
|
|
112
|
-
},
|
|
114
|
+
}, Qr = {
|
|
113
115
|
col: c,
|
|
114
116
|
row: f,
|
|
115
117
|
gtable: t,
|
|
@@ -122,16 +124,16 @@ const lr = {
|
|
|
122
124
|
"blood-pressure": a,
|
|
123
125
|
"time-range-picker": F,
|
|
124
126
|
wizard: m,
|
|
125
|
-
"wizard-with-tooltips":
|
|
127
|
+
"wizard-with-tooltips": w,
|
|
126
128
|
"wizard-navigation-group": m,
|
|
127
|
-
"wizard-vertical":
|
|
129
|
+
"wizard-vertical": G,
|
|
128
130
|
"group-tabs": x,
|
|
129
|
-
"group-table":
|
|
131
|
+
"group-table": I,
|
|
130
132
|
"editable-group": u
|
|
131
133
|
};
|
|
132
134
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
br as groupItemComponent,
|
|
136
|
+
Qr as itemControlGroupItemComponents,
|
|
137
|
+
gr as itemControlQuestionItemComponents,
|
|
138
|
+
fr as questionItemComponents
|
|
137
139
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.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}.
|
|
1
|
+
.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}._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}._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}._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}._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%}
|