@beda.software/web-item-controls 0.1.28-tab-validation.1 → 0.1.29-tab-validation.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGH,cAAc,EAIjB,MAAM,SAAS,CAAC;AA8CjB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,kDAoDpD"}
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 C } from "react/jsx-runtime";
2
- import { i18n as h } from "@lingui/core";
3
- import { DeleteOutlined as A } from "@ant-design/icons";
4
- import { Button as D } from "antd";
5
- import { useState as k } from "react";
6
- import { getItemKey as y, QuestionItems as O } from "sdc-qrf";
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 S } from "../../components/Typography.js";
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 b } from "./useAnnotationImageComponent.js";
12
- function j(s) {
12
+ import { useAnnotationImageComponent as q } from "./useAnnotationImageComponent.js";
13
+ function F(l) {
13
14
  const {
14
- index: m,
15
+ index: r,
15
16
  items: n,
16
- onChange: r,
17
- onRemoved: d,
18
- groupItem: l,
17
+ onChange: m,
18
+ onRemoved: c,
19
+ groupItem: s,
19
20
  detailItems: o
20
- } = s, {
21
- text: c,
22
- readOnly: u
23
- } = l.questionItem, {
24
- onRemove: a,
25
- parentPath: I,
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: m,
29
+ index: r,
29
30
  items: n,
30
- onChange: r,
31
- groupItem: l
31
+ onChange: m,
32
+ groupItem: s
32
33
  });
33
- return /* @__PURE__ */ x(C, { children: [
34
+ return /* @__PURE__ */ x(A, { children: [
34
35
  /* @__PURE__ */ x(i.DetailsHeader, { children: [
35
- /* @__PURE__ */ t(S, { level: 5, children: `${c || h._(
36
+ /* @__PURE__ */ t(V, { level: 5, children: `${f || I._(
36
37
  /*i18n*/
37
38
  {
38
39
  id: "V0Qg8j"
39
40
  }
40
- )} ${m + 1}` }),
41
- u ? null : /* @__PURE__ */ t(D, { icon: /* @__PURE__ */ t(A, {}), onClick: () => {
42
- a(), d(m);
43
- }, "aria-label": h._(
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: I, context: p }) })
51
+ /* @__PURE__ */ t(i.DetailsItems, { children: /* @__PURE__ */ t(O, { questionItems: o, parentPath: a, context: p }) })
51
52
  ] });
52
53
  }
53
- function J(s) {
54
+ function X(l) {
54
55
  const {
55
- parentPath: m,
56
+ parentPath: r,
56
57
  questionItem: n
57
- } = s, {
58
- linkId: r,
59
- readOnly: d
60
- } = n, l = [...m, r], {
61
- value: o,
62
- onChange: c
63
- } = R(l, n), [u, a] = k(0), I = b(n), p = I.getDetailItems(n);
64
- if (!p)
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) ?? [], f = e[u] ? u : e.length - 1, v = (g) => {
67
- c({
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, g]
76
+ items: [...e, d]
70
77
  }), a(e.length);
71
78
  };
72
- return /* @__PURE__ */ x(i.Container, { "data-testid": r, "data-linkid": r, children: [
73
- /* @__PURE__ */ t(i.ImagePane, { children: /* @__PURE__ */ t(I, { questionItem: n, items: e, activeIndex: f, onAdd: d ? void 0 : v, onSelect: a }) }),
74
- /* @__PURE__ */ t(i.Details, { children: e[f] ? /* @__PURE__ */ t(j, { index: f, items: e, onChange: c, onRemoved: (g) => a(Math.max(0, g - 1)), groupItem: s, detailItems: p }, y(e[f])) : /* @__PURE__ */ t(i.Empty, { children: d ? h._(
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
- ) : h._(
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
- J as ImageAnnotation
95
+ X as ImageAnnotation
89
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beda.software/web-item-controls",
3
- "version": "0.1.28-tab-validation.1",
3
+ "version": "0.1.29-tab-validation.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -308,7 +308,7 @@ msgstr ""
308
308
  #~ msgstr ""
309
309
 
310
310
  #: src/controls/ImageAnnotation/AnnotationImage.tsx:68
311
- #: src/controls/ImageAnnotation/index.tsx:38
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:109
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:109
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:46
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:38
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:109
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:109
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:46
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:38
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:109
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:109
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:46
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:38
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:109
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:109
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:46
1597
+ #: src/controls/ImageAnnotation/index.tsx:47
1598
1598
  msgid "Remove annotation"
1599
1599
  msgstr ""
1600
1600