@beda.software/web-item-controls 0.1.28-tab-validation.1 → 0.1.28
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 +27 -41
- package/dist/controls/ImageAnnotation/index.d.ts.map +1 -1
- package/dist/controls/ImageAnnotation/index.js +54 -47
- package/package.json +1 -1
- package/src/locale/de/messages.po +4 -4
- package/src/locale/en/messages.po +4 -4
- package/src/locale/es/messages.po +4 -4
- package/src/locale/ru/messages.po +4 -4
- package/dist/controls/GroupTabs/utils.d.ts +0 -8
- package/dist/controls/GroupTabs/utils.d.ts.map +0 -1
- package/dist/controls/GroupTabs/utils.js +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/index.tsx"],"names":[],"mappings":"
|
|
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,47 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _(d) {
|
|
10
|
-
var m;
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as f, Tabs as d } from "antd";
|
|
3
|
+
import { useState as b, useMemo as h } from "react";
|
|
4
|
+
import { useWatch as y } from "react-hook-form";
|
|
5
|
+
import { getEnabledQuestions as x, QuestionItems as I } from "sdc-qrf";
|
|
6
|
+
import { GroupWizardBus as v } from "../GroupWizard/index.js";
|
|
7
|
+
function B(p) {
|
|
8
|
+
var c;
|
|
11
9
|
const {
|
|
12
|
-
parentPath:
|
|
13
|
-
questionItem:
|
|
14
|
-
context:
|
|
15
|
-
} =
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
errors: b
|
|
19
|
-
} = B(), {
|
|
20
|
-
token: g
|
|
21
|
-
} = y.useToken(), [I, c] = E(), o = (() => {
|
|
10
|
+
parentPath: n,
|
|
11
|
+
questionItem: o,
|
|
12
|
+
context: a
|
|
13
|
+
} = p;
|
|
14
|
+
o.repeats && console.warn("GroupTabs does not support repeatable groups in the first level");
|
|
15
|
+
const m = y(), [l, u] = b(), r = h(() => {
|
|
22
16
|
const {
|
|
23
|
-
linkId:
|
|
24
|
-
} =
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
a ? /* @__PURE__ */ s(T, { count: l, size: "small", "data-testid": `group-tab-errors-count-${t.linkId}` }) : null
|
|
34
|
-
] }),
|
|
35
|
-
children: /* @__PURE__ */ s(p, { gap: 16, vertical: !0, children: /* @__PURE__ */ s(G, { questionItems: t.item, parentPath: u, context: e }) })
|
|
36
|
-
};
|
|
37
|
-
}) : [];
|
|
38
|
-
})();
|
|
39
|
-
return K.useBus("scrollTo", ({
|
|
40
|
-
groupLinkId: r
|
|
17
|
+
linkId: s
|
|
18
|
+
} = o, t = a[0];
|
|
19
|
+
return t ? x(o.item ?? [], n, m, t).filter((e) => !e.hidden).map((e) => ({
|
|
20
|
+
key: e.linkId,
|
|
21
|
+
label: e.text,
|
|
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
|
+
})) : [];
|
|
24
|
+
}, [a, m, n, o]);
|
|
25
|
+
return v.useBus("scrollTo", ({
|
|
26
|
+
groupLinkId: s
|
|
41
27
|
}) => {
|
|
42
|
-
|
|
43
|
-
}, [
|
|
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 });
|
|
44
30
|
}
|
|
45
31
|
export {
|
|
46
|
-
|
|
32
|
+
B as GroupTabs
|
|
47
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGH,cAAc,EAIjB,MAAM,SAAS,CAAC;AA8CjB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,kDA+DpD"}
|
|
@@ -1,82 +1,89 @@
|
|
|
1
|
-
import { jsxs as x, jsx as t, Fragment as
|
|
2
|
-
import { i18n as
|
|
3
|
-
import { DeleteOutlined as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { useState as
|
|
6
|
-
import {
|
|
1
|
+
import { jsxs as x, jsx as t, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { i18n as I } from "@lingui/core";
|
|
3
|
+
import { DeleteOutlined as S } from "@ant-design/icons";
|
|
4
|
+
import { Button as y } from "antd";
|
|
5
|
+
import { useState as b } from "react";
|
|
6
|
+
import { useFormContext as j } from "react-hook-form";
|
|
7
|
+
import { getItemKey as k, QuestionItems as O } from "sdc-qrf";
|
|
7
8
|
import { useFieldController as R } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
|
|
8
|
-
import { Title as
|
|
9
|
+
import { Title as V } from "../../components/Typography.js";
|
|
9
10
|
import { useRepeatableGroup as _ } from "../Group/RepeatableGroups/RepeatableGroupCard/hooks.js";
|
|
10
11
|
import { S as i } from "./styles.js";
|
|
11
|
-
import { useAnnotationImageComponent as
|
|
12
|
-
function
|
|
12
|
+
import { useAnnotationImageComponent as q } from "./useAnnotationImageComponent.js";
|
|
13
|
+
function F(l) {
|
|
13
14
|
const {
|
|
14
|
-
index:
|
|
15
|
+
index: r,
|
|
15
16
|
items: n,
|
|
16
|
-
onChange:
|
|
17
|
-
onRemoved:
|
|
18
|
-
groupItem:
|
|
17
|
+
onChange: m,
|
|
18
|
+
onRemoved: c,
|
|
19
|
+
groupItem: s,
|
|
19
20
|
detailItems: o
|
|
20
|
-
} =
|
|
21
|
-
text:
|
|
22
|
-
readOnly:
|
|
23
|
-
} =
|
|
24
|
-
onRemove:
|
|
25
|
-
parentPath:
|
|
21
|
+
} = l, {
|
|
22
|
+
text: f,
|
|
23
|
+
readOnly: g
|
|
24
|
+
} = s.questionItem, {
|
|
25
|
+
onRemove: u,
|
|
26
|
+
parentPath: a,
|
|
26
27
|
context: p
|
|
27
28
|
} = _({
|
|
28
|
-
index:
|
|
29
|
+
index: r,
|
|
29
30
|
items: n,
|
|
30
|
-
onChange:
|
|
31
|
-
groupItem:
|
|
31
|
+
onChange: m,
|
|
32
|
+
groupItem: s
|
|
32
33
|
});
|
|
33
|
-
return /* @__PURE__ */ x(
|
|
34
|
+
return /* @__PURE__ */ x(A, { children: [
|
|
34
35
|
/* @__PURE__ */ x(i.DetailsHeader, { children: [
|
|
35
|
-
/* @__PURE__ */ t(
|
|
36
|
+
/* @__PURE__ */ t(V, { level: 5, children: `${f || I._(
|
|
36
37
|
/*i18n*/
|
|
37
38
|
{
|
|
38
39
|
id: "V0Qg8j"
|
|
39
40
|
}
|
|
40
|
-
)} ${
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, "aria-label":
|
|
41
|
+
)} ${r + 1}` }),
|
|
42
|
+
g ? null : /* @__PURE__ */ t(y, { icon: /* @__PURE__ */ t(S, {}), onClick: () => {
|
|
43
|
+
u(), c(r);
|
|
44
|
+
}, "aria-label": I._(
|
|
44
45
|
/*i18n*/
|
|
45
46
|
{
|
|
46
47
|
id: "KGJ03u"
|
|
47
48
|
}
|
|
48
49
|
), "data-testid": "remove-annotation-button" })
|
|
49
50
|
] }),
|
|
50
|
-
/* @__PURE__ */ t(i.DetailsItems, { children: /* @__PURE__ */ t(O, { questionItems: o, parentPath:
|
|
51
|
+
/* @__PURE__ */ t(i.DetailsItems, { children: /* @__PURE__ */ t(O, { questionItems: o, parentPath: a, context: p }) })
|
|
51
52
|
] });
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function X(l) {
|
|
54
55
|
const {
|
|
55
|
-
parentPath:
|
|
56
|
+
parentPath: r,
|
|
56
57
|
questionItem: n
|
|
57
|
-
} =
|
|
58
|
-
linkId:
|
|
59
|
-
readOnly:
|
|
60
|
-
} = n,
|
|
61
|
-
value: o
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
} = l, {
|
|
59
|
+
linkId: m,
|
|
60
|
+
readOnly: c
|
|
61
|
+
} = n, s = [...r, m], {
|
|
62
|
+
value: o
|
|
63
|
+
} = R(s, n), {
|
|
64
|
+
setValue: f,
|
|
65
|
+
formState: g
|
|
66
|
+
} = j(), [u, a] = b(0), p = q(n), C = p.getDetailItems(n);
|
|
67
|
+
if (!C)
|
|
65
68
|
return null;
|
|
66
|
-
const e = (o == null ? void 0 : o.items) ?? [],
|
|
67
|
-
|
|
69
|
+
const e = (o == null ? void 0 : o.items) ?? [], h = e[u] ? u : e.length - 1, v = (d) => f(s.join("."), d, {
|
|
70
|
+
shouldDirty: !0,
|
|
71
|
+
shouldTouch: !0,
|
|
72
|
+
shouldValidate: g.isSubmitted
|
|
73
|
+
}), D = (d) => {
|
|
74
|
+
v({
|
|
68
75
|
...o,
|
|
69
|
-
items: [...e,
|
|
76
|
+
items: [...e, d]
|
|
70
77
|
}), a(e.length);
|
|
71
78
|
};
|
|
72
|
-
return /* @__PURE__ */ x(i.Container, { "data-testid":
|
|
73
|
-
/* @__PURE__ */ t(i.ImagePane, { children: /* @__PURE__ */ t(
|
|
74
|
-
/* @__PURE__ */ t(i.Details, { children: e[
|
|
79
|
+
return /* @__PURE__ */ x(i.Container, { "data-testid": m, "data-linkid": m, children: [
|
|
80
|
+
/* @__PURE__ */ t(i.ImagePane, { children: /* @__PURE__ */ t(p, { questionItem: n, items: e, activeIndex: h, onAdd: c ? void 0 : D, onSelect: a }) }),
|
|
81
|
+
/* @__PURE__ */ t(i.Details, { children: e[h] ? /* @__PURE__ */ t(F, { index: h, items: e, onChange: v, onRemoved: (d) => a(Math.max(0, d - 1)), groupItem: l, detailItems: C }, k(e[h])) : /* @__PURE__ */ t(i.Empty, { children: c ? I._(
|
|
75
82
|
/*i18n*/
|
|
76
83
|
{
|
|
77
84
|
id: "vKC52t"
|
|
78
85
|
}
|
|
79
|
-
) :
|
|
86
|
+
) : I._(
|
|
80
87
|
/*i18n*/
|
|
81
88
|
{
|
|
82
89
|
id: "sMXMOk"
|
|
@@ -85,5 +92,5 @@ function J(s) {
|
|
|
85
92
|
] });
|
|
86
93
|
}
|
|
87
94
|
export {
|
|
88
|
-
|
|
95
|
+
X as ImageAnnotation
|
|
89
96
|
};
|
package/package.json
CHANGED
|
@@ -308,7 +308,7 @@ msgstr ""
|
|
|
308
308
|
#~ msgstr ""
|
|
309
309
|
|
|
310
310
|
#: src/controls/ImageAnnotation/AnnotationImage.tsx:68
|
|
311
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
311
|
+
#: src/controls/ImageAnnotation/index.tsx:39
|
|
312
312
|
#: src/readonly-controls/ImageAnnotation/index.tsx:32
|
|
313
313
|
msgid "Annotation"
|
|
314
314
|
msgstr ""
|
|
@@ -1181,7 +1181,7 @@ msgstr ""
|
|
|
1181
1181
|
msgid "No"
|
|
1182
1182
|
msgstr ""
|
|
1183
1183
|
|
|
1184
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1184
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1185
1185
|
#: src/readonly-controls/ImageAnnotation/index.tsx:41
|
|
1186
1186
|
msgid "No annotations"
|
|
1187
1187
|
msgstr ""
|
|
@@ -1335,7 +1335,7 @@ msgstr "Parameter"
|
|
|
1335
1335
|
#~ msgid "Phone widget"
|
|
1336
1336
|
#~ msgstr ""
|
|
1337
1337
|
|
|
1338
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1338
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1339
1339
|
msgid "Place a marker on the diagram to add an annotation"
|
|
1340
1340
|
msgstr ""
|
|
1341
1341
|
|
|
@@ -1410,7 +1410,7 @@ msgstr ""
|
|
|
1410
1410
|
msgid "Remove"
|
|
1411
1411
|
msgstr ""
|
|
1412
1412
|
|
|
1413
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1413
|
+
#: src/controls/ImageAnnotation/index.tsx:47
|
|
1414
1414
|
msgid "Remove annotation"
|
|
1415
1415
|
msgstr ""
|
|
1416
1416
|
|
|
@@ -325,7 +325,7 @@ msgstr ""
|
|
|
325
325
|
#~ msgstr ""
|
|
326
326
|
|
|
327
327
|
#: src/controls/ImageAnnotation/AnnotationImage.tsx:68
|
|
328
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
328
|
+
#: src/controls/ImageAnnotation/index.tsx:39
|
|
329
329
|
#: src/readonly-controls/ImageAnnotation/index.tsx:32
|
|
330
330
|
msgid "Annotation"
|
|
331
331
|
msgstr ""
|
|
@@ -1344,7 +1344,7 @@ msgstr ""
|
|
|
1344
1344
|
msgid "No"
|
|
1345
1345
|
msgstr ""
|
|
1346
1346
|
|
|
1347
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1347
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1348
1348
|
#: src/readonly-controls/ImageAnnotation/index.tsx:41
|
|
1349
1349
|
msgid "No annotations"
|
|
1350
1350
|
msgstr ""
|
|
@@ -1515,7 +1515,7 @@ msgstr ""
|
|
|
1515
1515
|
#~ msgid "Phone widget"
|
|
1516
1516
|
#~ msgstr ""
|
|
1517
1517
|
|
|
1518
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1518
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1519
1519
|
msgid "Place a marker on the diagram to add an annotation"
|
|
1520
1520
|
msgstr ""
|
|
1521
1521
|
|
|
@@ -1594,7 +1594,7 @@ msgstr ""
|
|
|
1594
1594
|
msgid "Remove"
|
|
1595
1595
|
msgstr ""
|
|
1596
1596
|
|
|
1597
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1597
|
+
#: src/controls/ImageAnnotation/index.tsx:47
|
|
1598
1598
|
msgid "Remove annotation"
|
|
1599
1599
|
msgstr ""
|
|
1600
1600
|
|
|
@@ -325,7 +325,7 @@ msgstr ""
|
|
|
325
325
|
#~ msgstr "Cantidad"
|
|
326
326
|
|
|
327
327
|
#: src/controls/ImageAnnotation/AnnotationImage.tsx:68
|
|
328
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
328
|
+
#: src/controls/ImageAnnotation/index.tsx:39
|
|
329
329
|
#: src/readonly-controls/ImageAnnotation/index.tsx:32
|
|
330
330
|
msgid "Annotation"
|
|
331
331
|
msgstr ""
|
|
@@ -1336,7 +1336,7 @@ msgstr ""
|
|
|
1336
1336
|
msgid "No"
|
|
1337
1337
|
msgstr "No"
|
|
1338
1338
|
|
|
1339
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1339
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1340
1340
|
#: src/readonly-controls/ImageAnnotation/index.tsx:41
|
|
1341
1341
|
msgid "No annotations"
|
|
1342
1342
|
msgstr ""
|
|
@@ -1503,7 +1503,7 @@ msgstr "Parámetro"
|
|
|
1503
1503
|
#~ msgid "Phone widget"
|
|
1504
1504
|
#~ msgstr "Widget de teléfono"
|
|
1505
1505
|
|
|
1506
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1506
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1507
1507
|
msgid "Place a marker on the diagram to add an annotation"
|
|
1508
1508
|
msgstr ""
|
|
1509
1509
|
|
|
@@ -1582,7 +1582,7 @@ msgstr ""
|
|
|
1582
1582
|
msgid "Remove"
|
|
1583
1583
|
msgstr "Eliminar"
|
|
1584
1584
|
|
|
1585
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1585
|
+
#: src/controls/ImageAnnotation/index.tsx:47
|
|
1586
1586
|
msgid "Remove annotation"
|
|
1587
1587
|
msgstr ""
|
|
1588
1588
|
|
|
@@ -325,7 +325,7 @@ msgstr ""
|
|
|
325
325
|
#~ msgstr ""
|
|
326
326
|
|
|
327
327
|
#: src/controls/ImageAnnotation/AnnotationImage.tsx:68
|
|
328
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
328
|
+
#: src/controls/ImageAnnotation/index.tsx:39
|
|
329
329
|
#: src/readonly-controls/ImageAnnotation/index.tsx:32
|
|
330
330
|
msgid "Annotation"
|
|
331
331
|
msgstr ""
|
|
@@ -1344,7 +1344,7 @@ msgstr ""
|
|
|
1344
1344
|
msgid "No"
|
|
1345
1345
|
msgstr ""
|
|
1346
1346
|
|
|
1347
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1347
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1348
1348
|
#: src/readonly-controls/ImageAnnotation/index.tsx:41
|
|
1349
1349
|
msgid "No annotations"
|
|
1350
1350
|
msgstr ""
|
|
@@ -1515,7 +1515,7 @@ msgstr "Параметр"
|
|
|
1515
1515
|
#~ msgid "Phone widget"
|
|
1516
1516
|
#~ msgstr ""
|
|
1517
1517
|
|
|
1518
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1518
|
+
#: src/controls/ImageAnnotation/index.tsx:121
|
|
1519
1519
|
msgid "Place a marker on the diagram to add an annotation"
|
|
1520
1520
|
msgstr ""
|
|
1521
1521
|
|
|
@@ -1594,7 +1594,7 @@ msgstr ""
|
|
|
1594
1594
|
msgid "Remove"
|
|
1595
1595
|
msgstr ""
|
|
1596
1596
|
|
|
1597
|
-
#: src/controls/ImageAnnotation/index.tsx:
|
|
1597
|
+
#: src/controls/ImageAnnotation/index.tsx:47
|
|
1598
1598
|
msgid "Remove annotation"
|
|
1599
1599
|
msgstr ""
|
|
1600
1600
|
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recursively counts leaf validation errors in a (nested) react-hook-form errors object.
|
|
3
|
-
*
|
|
4
|
-
* @param errors - A react-hook-form errors subtree (object, array or a single field error)
|
|
5
|
-
* @returns Number of field errors found in the subtree
|
|
6
|
-
*/
|
|
7
|
-
export declare function countValidationErrors(errors: unknown): number;
|
|
8
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/controls/GroupTabs/utils.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAU7D"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import i from "lodash";
|
|
2
|
-
function n(t) {
|
|
3
|
-
return i.isPlainObject(t) && typeof t.type == "string";
|
|
4
|
-
}
|
|
5
|
-
function o(t) {
|
|
6
|
-
return n(t) ? 1 : i.isObjectLike(t) ? Object.values(t).reduce((r, e) => r + o(e), 0) : 0;
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
o as countValidationErrors
|
|
10
|
-
};
|