@beda.software/web-item-controls 0.1.17 → 0.1.19
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/GridGroup/index.d.ts.map +1 -1
- package/dist/controls/Group/GridGroup/index.js +11 -11
- package/dist/controls/GroupWizard/index.d.ts.map +1 -1
- package/dist/controls/GroupWizard/index.js +33 -33
- package/dist/controls/PhoneInput/index.d.ts.map +1 -1
- package/dist/controls/PhoneInput/index.js +9 -8
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/GridGroup/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controls/Group/GridGroup/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,cAAc,kDAqEtD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as s, jsx as
|
|
1
|
+
import { jsxs as d, Fragment as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import c from "react";
|
|
3
3
|
import { QuestionItem as a } from "sdc-qrf";
|
|
4
|
-
import { S as
|
|
4
|
+
import { S as e } from "./Grid.styles.js";
|
|
5
5
|
import { useGridGroup as h } from "./hooks.js";
|
|
6
|
-
import { RepeatableGroups as
|
|
6
|
+
import { RepeatableGroups as G } from "../RepeatableGroups/index.js";
|
|
7
7
|
function q({
|
|
8
8
|
groupItem: i
|
|
9
9
|
}) {
|
|
@@ -13,17 +13,17 @@ function q({
|
|
|
13
13
|
gridMap: o
|
|
14
14
|
} = h(m);
|
|
15
15
|
return o ? /* @__PURE__ */ d(s, { children: [
|
|
16
|
-
/* @__PURE__ */ e
|
|
17
|
-
/* @__PURE__ */ d(
|
|
18
|
-
/* @__PURE__ */ e
|
|
19
|
-
o.columns.map((r) => /* @__PURE__ */ e
|
|
16
|
+
/* @__PURE__ */ t(e.Header, { children: /* @__PURE__ */ t(e.GridRowLabel, { children: m.text }) }),
|
|
17
|
+
/* @__PURE__ */ d(e.GridContainer, { columns: o.columns.length + 1, children: [
|
|
18
|
+
/* @__PURE__ */ t(e.GridItem, {}),
|
|
19
|
+
o.columns.map((r) => /* @__PURE__ */ t(e.GridItem, { children: /* @__PURE__ */ t(e.GridRowLabel, { children: r }) }, r)),
|
|
20
20
|
o.groups.map((r) => /* @__PURE__ */ d(c.Fragment, { children: [
|
|
21
|
-
/* @__PURE__ */ e
|
|
22
|
-
r.items.map((n, l) => n ? /* @__PURE__ */ e
|
|
21
|
+
/* @__PURE__ */ t(e.GridItem, { children: /* @__PURE__ */ t(e.GridRowLabel, { children: r.group.text }) }),
|
|
22
|
+
r.items.map((n, l) => n ? /* @__PURE__ */ t(e.GridItem, { children: n.type === "group" ? /* @__PURE__ */ t(G, { groupItem: {
|
|
23
23
|
questionItem: n,
|
|
24
24
|
context: i.context,
|
|
25
|
-
parentPath: [i.questionItem.linkId, "items", r.group.linkId, "items"]
|
|
26
|
-
} }) : /* @__PURE__ */
|
|
25
|
+
parentPath: [...i.parentPath, i.questionItem.linkId, "items", r.group.linkId, "items"]
|
|
26
|
+
} }) : /* @__PURE__ */ t(a, { questionItem: n, parentPath: [...i.parentPath, i.questionItem.linkId, "items", r.group.linkId, "items"], context: i.context[0] }) }, n.linkId) : /* @__PURE__ */ t(e.GridItem, {}, l))
|
|
27
27
|
] }, r.group.linkId))
|
|
28
28
|
] })
|
|
29
29
|
] }) : null;
|
|
@@ -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;;cACjB,UAAU;qBACH,MAAM;;cADb,UAAU;qBACH,MAAM;;;cADb,UAAU;qBACH,MAAM;;CACnB,CAAC;AAEL,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,
|
|
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;;cACjB,UAAU;qBACH,MAAM;;cADb,UAAU;qBACH,MAAM;;;cADb,UAAU;qBACH,MAAM;;CACnB,CAAC;AAEL,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,2CAsIlD;AAED,eAAO,MAAM,aAAa,GACtB,WAAW,oBAAoB,EAC/B,YAAY,MAAM,EAAE,EACpB,YAAY,SAAS,EACrB,SAAS,WAAW,KACrB,UAeF,CAAC"}
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as P, useState as A, useMemo as G } from "react";
|
|
3
3
|
import { useWatch as E, useFormState as V } from "react-hook-form";
|
|
4
4
|
import { getEnabledQuestions as j, QuestionItems as S } from "sdc-qrf";
|
|
5
5
|
import { questionnaireItemsToValidationSchema as D } from "@beda.software/fhir-questionnaire/components";
|
|
6
6
|
import { BaseQuestionnaireResponseFormPropsContext as L } from "@beda.software/fhir-questionnaire/contexts";
|
|
7
7
|
import { createBus as M } from "@beda.software/fhir-react";
|
|
8
|
-
import { Text as k, Title as
|
|
8
|
+
import { Text as k, Title as w } from "../../components/Typography.js";
|
|
9
9
|
import { Wizard as N } from "../../components/Wizard/index.js";
|
|
10
10
|
import { S as g } from "./styles.js";
|
|
11
11
|
import { getAllGroupQuestionsWithAnswerStatus as Y } from "./utils.js";
|
|
12
12
|
const rt = M();
|
|
13
13
|
function st(s) {
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ n(T, { ...s, wizard: {
|
|
15
15
|
direction: "vertical",
|
|
16
16
|
size: "small"
|
|
17
17
|
} });
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */
|
|
19
|
+
function ut(s) {
|
|
20
|
+
return /* @__PURE__ */ n(T, { ...s, wizard: {
|
|
21
21
|
labelPlacement: "tooltip"
|
|
22
22
|
} });
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function T(s) {
|
|
25
25
|
const {
|
|
26
|
-
parentPath:
|
|
26
|
+
parentPath: l,
|
|
27
27
|
questionItem: d,
|
|
28
28
|
context: Q,
|
|
29
29
|
wizard: e
|
|
30
|
-
} = s,
|
|
31
|
-
|
|
32
|
-
const c = Q[0], [
|
|
30
|
+
} = s, r = P(L);
|
|
31
|
+
d.repeats && console.warn("GroupWizard does not support repeatable groups in the first level");
|
|
32
|
+
const c = Q[0], [u, i] = A(0), {
|
|
33
33
|
linkId: h
|
|
34
34
|
} = d, a = E(), {
|
|
35
35
|
isSubmitted: W
|
|
36
|
-
} = V(), p = j(d.item ?? [],
|
|
36
|
+
} = V(), p = j(d.item ?? [], l, a, c), m = G(() => p.filter((t) => !t.hidden), [p]), b = G(() => p.filter((t) => t.hidden), [p]), q = m.length, C = q === u + 1, F = (e == null ? void 0 : e.direction) === "vertical", R = (t, o) => {
|
|
37
37
|
var v, z, I;
|
|
38
38
|
const x = ((I = (z = (v = a == null ? void 0 : a[h]) == null ? void 0 : v.items) == null ? void 0 : z[t.linkId]) == null ? void 0 : I.items) ?? {};
|
|
39
|
-
return D(t.item,
|
|
39
|
+
return D(t.item, r == null ? void 0 : r.customYupTests).isValidSync(x) === !1 && W ? "error" : o.finishedQuestions === 0 ? "wait" : o.finishedRequiredQuestions >= o.totalRequiredQuestions ? "finish" : "process";
|
|
40
40
|
}, y = (t) => {
|
|
41
|
-
const
|
|
41
|
+
const o = H(t, [...l, h], a, c), x = F ? `${o.finishedQuestions} of ${o.totalQuestions}` : void 0;
|
|
42
42
|
return {
|
|
43
43
|
title: t.text,
|
|
44
44
|
linkId: t.linkId,
|
|
45
|
-
status: R(t,
|
|
45
|
+
status: R(t, o),
|
|
46
46
|
description: x
|
|
47
47
|
};
|
|
48
|
-
},
|
|
49
|
-
|
|
48
|
+
}, $ = G(() => m.map((t) => y(t)), [m, a, W]), B = (t) => {
|
|
49
|
+
i(t);
|
|
50
50
|
};
|
|
51
|
-
return
|
|
52
|
-
m.map((t,
|
|
53
|
-
t.text && (e == null ? void 0 : e.direction) === "vertical" ? /* @__PURE__ */
|
|
51
|
+
return l.length !== 0 ? (console.error("The wizard item control must be in root group"), /* @__PURE__ */ n(k, { children: "The wizard item control must be in root group" })) : m.some((t) => t.type !== "group") ? (console.error("The wizard item control must contain only group items"), /* @__PURE__ */ n(k, { children: "The wizard item control must contain only group items" })) : /* @__PURE__ */ f(N, { items: $, currentIndex: u, onChange: B, ...s.wizard, children: [
|
|
52
|
+
m.map((t, o) => o !== u ? null : /* @__PURE__ */ f(g.Group, { $active: o === u, children: [
|
|
53
|
+
t.text && (e == null ? void 0 : e.direction) === "vertical" ? /* @__PURE__ */ n(w, { level: 4, style: {
|
|
54
54
|
fontWeight: 700
|
|
55
55
|
}, children: t.text }) : null,
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ n(S, { questionItems: t.item, parentPath: [...l, h, "items", t.linkId, "items"], context: c })
|
|
57
57
|
] }, `group-item-${t.linkId}`)),
|
|
58
|
-
|
|
59
|
-
t.text && (e == null ? void 0 : e.direction) === "vertical" ? /* @__PURE__ */
|
|
58
|
+
b.map((t) => /* @__PURE__ */ f(g.Group, { $hidden: !0, children: [
|
|
59
|
+
t.text && (e == null ? void 0 : e.direction) === "vertical" ? /* @__PURE__ */ n(w, { level: 4, style: {
|
|
60
60
|
fontWeight: 700
|
|
61
61
|
}, children: t.text }) : null,
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ n(S, { questionItems: t.item, parentPath: [...l, h, "items", t.linkId, "items"], context: c })
|
|
63
63
|
] }, `group-item-${t.linkId}`)),
|
|
64
|
-
/* @__PURE__ */ f(g.WizardFooter, { goBack: () =>
|
|
65
|
-
!
|
|
66
|
-
|
|
64
|
+
/* @__PURE__ */ f(g.WizardFooter, { goBack: () => i((t) => t - 1), goForward: () => i((t) => t + 1), canGoBack: u > 0, canGoForward: u + 1 < q, children: [
|
|
65
|
+
!r && /* @__PURE__ */ n("div", { children: "No baseQRFPropsContext update" }),
|
|
66
|
+
r && /* @__PURE__ */ n(g.FormFooter, { ...r, submitDisabled: !C })
|
|
67
67
|
] })
|
|
68
68
|
] });
|
|
69
69
|
}
|
|
70
|
-
const H = (s,
|
|
71
|
-
const e = Y(s,
|
|
70
|
+
const H = (s, l, d, Q) => {
|
|
71
|
+
const e = Y(s, l, d, Q).filter(([i]) => !i.hidden), r = e.filter(([i]) => i.required === !0), c = e.filter(([, i]) => i), u = r.filter(([, i]) => i);
|
|
72
72
|
return {
|
|
73
73
|
totalQuestions: e.length,
|
|
74
74
|
finishedQuestions: c.length,
|
|
75
|
-
totalRequiredQuestions:
|
|
76
|
-
finishedRequiredQuestions:
|
|
75
|
+
totalRequiredQuestions: r.length,
|
|
76
|
+
finishedRequiredQuestions: u.length
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
79
|
export {
|
|
80
|
-
|
|
80
|
+
T as GroupWizard,
|
|
81
81
|
rt as GroupWizardBus,
|
|
82
82
|
st as GroupWizardVertical,
|
|
83
|
-
|
|
83
|
+
ut as GroupWizardWithTooltips,
|
|
84
84
|
H as getGroupStats
|
|
85
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/PhoneInput/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAU5C,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,iBAAiB,2CAqC5E"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/PhoneInput/index.tsx"],"names":[],"mappings":"AAIA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAU5C,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,iBAAiB,2CAqC5E"}
|
|
@@ -3,29 +3,30 @@ import { Form as C } from "antd";
|
|
|
3
3
|
import h from "classnames";
|
|
4
4
|
import { useContext as I, useState as b } from "react";
|
|
5
5
|
import s from "react-phone-input-2";
|
|
6
|
+
import "react-phone-input-2/lib/style.css";
|
|
6
7
|
import { useFieldController as x } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
|
|
7
8
|
import { PhoneInputCountryContext as F } from "./context.js";
|
|
8
9
|
import { S as P } from "./PhoneInput.styles.js";
|
|
9
10
|
const g = s.default || s;
|
|
10
|
-
function
|
|
11
|
+
function Q({
|
|
11
12
|
parentPath: u,
|
|
12
13
|
questionItem: t
|
|
13
14
|
}) {
|
|
14
15
|
const {
|
|
15
|
-
linkId:
|
|
16
|
-
} = t,
|
|
16
|
+
linkId: i
|
|
17
|
+
} = t, a = [...u, i, 0, "value", "string"], l = I(F), {
|
|
17
18
|
value: m,
|
|
18
19
|
onChange: c,
|
|
19
20
|
disabled: e = !1,
|
|
20
21
|
formItem: f,
|
|
21
|
-
placeholder:
|
|
22
|
-
} = x(
|
|
22
|
+
placeholder: p
|
|
23
|
+
} = x(a, t), [d, n] = b(!1);
|
|
23
24
|
return /* @__PURE__ */ o(C.Item, { ...f, children: /* @__PURE__ */ o(P.Container, { $disabled: e, children: /* @__PURE__ */ o(g, { country: l, value: m, onChange: (r) => {
|
|
24
25
|
r && c(`+${r}`);
|
|
25
26
|
}, disabled: e, inputClass: "react-phone-input", containerClass: h({
|
|
26
|
-
_focused:
|
|
27
|
-
}), buttonClass: "react-phone-input__button", onFocus: () => n(!0), onBlur: () => n(!1), placeholder:
|
|
27
|
+
_focused: d
|
|
28
|
+
}), buttonClass: "react-phone-input__button", onFocus: () => n(!0), onBlur: () => n(!1), placeholder: p }) }) });
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
Q as QuestionPhone
|
|
31
32
|
};
|
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}
|