@beda.software/web-item-controls 0.1.25 → 0.1.27
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/components/ModalQuestionnaireGroupItem/index.js +3 -2
- package/dist/components/SearchBar/SearchBarColumn/ChoiceColumn/hooks.js +3 -2
- package/dist/contexts/image-annotation.d.ts +23 -0
- package/dist/contexts/image-annotation.d.ts.map +1 -0
- package/dist/contexts/image-annotation.js +5 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/contexts/index.js +4 -2
- package/dist/controls/Choice/index.js +11 -10
- package/dist/controls/Display/index.js +4 -2
- package/dist/controls/GroupTable/RenderFormItemReadOnly/index.js +4 -2
- package/dist/controls/ImageAnnotation/AnnotationImage.d.ts +9 -14
- package/dist/controls/ImageAnnotation/AnnotationImage.d.ts.map +1 -1
- package/dist/controls/ImageAnnotation/AnnotationImage.js +48 -32
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/body-regions.d.ts +23 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/body-regions.d.ts.map +1 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/body-regions.js +436 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/index.d.ts +13 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/index.d.ts.map +1 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/index.js +95 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/labels.d.ts +3 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/labels.d.ts.map +1 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/labels.js +224 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/styles.d.ts +17 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/styles.d.ts.map +1 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/styles.js +42 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/utils.d.ts +17 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/utils.d.ts.map +1 -0
- package/dist/controls/ImageAnnotation/BodyAnnotationImage/utils.js +35 -0
- package/dist/controls/ImageAnnotation/index.d.ts +2 -3
- package/dist/controls/ImageAnnotation/index.d.ts.map +1 -1
- package/dist/controls/ImageAnnotation/index.js +60 -92
- package/dist/controls/ImageAnnotation/useAnnotationImageComponent.d.ts +5 -0
- package/dist/controls/ImageAnnotation/useAnnotationImageComponent.d.ts.map +1 -0
- package/dist/controls/ImageAnnotation/useAnnotationImageComponent.js +11 -0
- package/dist/controls/ImageAnnotation/utils.d.ts +14 -1
- package/dist/controls/ImageAnnotation/utils.d.ts.map +1 -1
- package/dist/controls/ImageAnnotation/utils.js +38 -6
- package/dist/controls/InlineChoice/index.d.ts.map +1 -1
- package/dist/controls/InlineChoice/index.js +46 -55
- package/dist/controls/InlineChoice/styles.d.ts +27 -0
- package/dist/controls/InlineChoice/styles.d.ts.map +1 -0
- package/dist/controls/InlineChoice/styles.js +40 -0
- package/dist/controls/InlineChoice/utils.d.ts +5 -0
- package/dist/controls/InlineChoice/utils.d.ts.map +1 -0
- package/dist/controls/InlineChoice/utils.js +11 -0
- package/dist/controls/controls.js +11 -14
- package/dist/controls/index.d.ts +1 -0
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/index.js +77 -75
- package/dist/locale/de/messages.d.ts.map +1 -1
- package/dist/locale/de/messages.js +1 -1
- package/dist/locale/en/messages.d.ts.map +1 -1
- package/dist/locale/en/messages.js +1 -1
- package/dist/locale/es/messages.d.ts.map +1 -1
- package/dist/locale/es/messages.js +1 -1
- package/dist/locale/ru/messages.d.ts.map +1 -1
- package/dist/locale/ru/messages.js +1 -1
- package/dist/readonly-controls/Display/index.js +4 -2
- package/dist/readonly-controls/ImageAnnotation/index.d.ts.map +1 -1
- package/dist/readonly-controls/ImageAnnotation/index.js +25 -30
- package/dist/readonly-controls/MarkdownRender/index.d.ts.map +1 -1
- package/dist/readonly-controls/MarkdownRender/index.js +51 -41
- package/package.json +3 -2
- package/src/locale/de/messages.po +172 -8
- package/src/locale/de/messages.ts +1 -1
- package/src/locale/en/messages.po +172 -8
- package/src/locale/en/messages.ts +1 -1
- package/src/locale/es/messages.po +172 -8
- package/src/locale/es/messages.ts +1 -1
- package/src/locale/ru/messages.po +172 -8
- package/src/locale/ru/messages.ts +1 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { i18n as e } from "@lingui/core";
|
|
2
|
+
function r(i) {
|
|
3
|
+
return {
|
|
4
|
+
face: e._(
|
|
5
|
+
/*i18n*/
|
|
6
|
+
{
|
|
7
|
+
id: "PF860N"
|
|
8
|
+
}
|
|
9
|
+
),
|
|
10
|
+
backOfHead: e._(
|
|
11
|
+
/*i18n*/
|
|
12
|
+
{
|
|
13
|
+
id: "lz51jW"
|
|
14
|
+
}
|
|
15
|
+
),
|
|
16
|
+
leftNeck: e._(
|
|
17
|
+
/*i18n*/
|
|
18
|
+
{
|
|
19
|
+
id: "84K1BL"
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
rightNeck: e._(
|
|
23
|
+
/*i18n*/
|
|
24
|
+
{
|
|
25
|
+
id: "EdV9yV"
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
leftShoulder: e._(
|
|
29
|
+
/*i18n*/
|
|
30
|
+
{
|
|
31
|
+
id: "Wo8md0"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
rightShoulder: e._(
|
|
35
|
+
/*i18n*/
|
|
36
|
+
{
|
|
37
|
+
id: "AUaUKJ"
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
leftChest: e._(
|
|
41
|
+
/*i18n*/
|
|
42
|
+
{
|
|
43
|
+
id: "eEOw68"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
rightChest: e._(
|
|
47
|
+
/*i18n*/
|
|
48
|
+
{
|
|
49
|
+
id: "aMfaOO"
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
leftUpperBack: e._(
|
|
53
|
+
/*i18n*/
|
|
54
|
+
{
|
|
55
|
+
id: "ynIwyV"
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
rightUpperBack: e._(
|
|
59
|
+
/*i18n*/
|
|
60
|
+
{
|
|
61
|
+
id: "Cg0w+b"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
leftFlank: e._(
|
|
65
|
+
/*i18n*/
|
|
66
|
+
{
|
|
67
|
+
id: "1XuG7s"
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
rightFlank: e._(
|
|
71
|
+
/*i18n*/
|
|
72
|
+
{
|
|
73
|
+
id: "xOIKbb"
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
leftAbdomen: e._(
|
|
77
|
+
/*i18n*/
|
|
78
|
+
{
|
|
79
|
+
id: "Ion8vf"
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
rightAbdomen: e._(
|
|
83
|
+
/*i18n*/
|
|
84
|
+
{
|
|
85
|
+
id: "Orh2L1"
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
leftLowerBack: e._(
|
|
89
|
+
/*i18n*/
|
|
90
|
+
{
|
|
91
|
+
id: "vd/mEc"
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
rightLowerBack: e._(
|
|
95
|
+
/*i18n*/
|
|
96
|
+
{
|
|
97
|
+
id: "ZM4pOr"
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
leftUpperArm: e._(
|
|
101
|
+
/*i18n*/
|
|
102
|
+
{
|
|
103
|
+
id: "reyfbU"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
rightUpperArm: e._(
|
|
107
|
+
/*i18n*/
|
|
108
|
+
{
|
|
109
|
+
id: "IzYDoz"
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
leftForearm: e._(
|
|
113
|
+
/*i18n*/
|
|
114
|
+
{
|
|
115
|
+
id: "QodMBV"
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
rightForearm: e._(
|
|
119
|
+
/*i18n*/
|
|
120
|
+
{
|
|
121
|
+
id: "8d/UkC"
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
leftGroin: e._(
|
|
125
|
+
/*i18n*/
|
|
126
|
+
{
|
|
127
|
+
id: "th7mh+"
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
rightGroin: e._(
|
|
131
|
+
/*i18n*/
|
|
132
|
+
{
|
|
133
|
+
id: "FJXVVo"
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
leftButtock: e._(
|
|
137
|
+
/*i18n*/
|
|
138
|
+
{
|
|
139
|
+
id: "xJpeLm"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
rightButtock: e._(
|
|
143
|
+
/*i18n*/
|
|
144
|
+
{
|
|
145
|
+
id: "3oDwtW"
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
leftThigh: e._(
|
|
149
|
+
/*i18n*/
|
|
150
|
+
{
|
|
151
|
+
id: "Lgm9l9"
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
rightThigh: e._(
|
|
155
|
+
/*i18n*/
|
|
156
|
+
{
|
|
157
|
+
id: "t9fJfg"
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
leftKnee: e._(
|
|
161
|
+
/*i18n*/
|
|
162
|
+
{
|
|
163
|
+
id: "SboYP8"
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
rightKnee: e._(
|
|
167
|
+
/*i18n*/
|
|
168
|
+
{
|
|
169
|
+
id: "NqKcg7"
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
leftBackOfKnee: e._(
|
|
173
|
+
/*i18n*/
|
|
174
|
+
{
|
|
175
|
+
id: "ZABEAW"
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
rightBackOfKnee: e._(
|
|
179
|
+
/*i18n*/
|
|
180
|
+
{
|
|
181
|
+
id: "N9bah7"
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
leftLowerLeg: e._(
|
|
185
|
+
/*i18n*/
|
|
186
|
+
{
|
|
187
|
+
id: "YAAq0R"
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
rightLowerLeg: e._(
|
|
191
|
+
/*i18n*/
|
|
192
|
+
{
|
|
193
|
+
id: "xUrmeX"
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
leftCalf: e._(
|
|
197
|
+
/*i18n*/
|
|
198
|
+
{
|
|
199
|
+
id: "G/rrnp"
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
rightCalf: e._(
|
|
203
|
+
/*i18n*/
|
|
204
|
+
{
|
|
205
|
+
id: "hvsjS9"
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
leftHeel: e._(
|
|
209
|
+
/*i18n*/
|
|
210
|
+
{
|
|
211
|
+
id: "H18z7p"
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
rightHeel: e._(
|
|
215
|
+
/*i18n*/
|
|
216
|
+
{
|
|
217
|
+
id: "k3pAMl"
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}[i];
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
r as getBodyRegionLabel
|
|
224
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const S: {
|
|
2
|
+
Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
3
|
+
Figure: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
4
|
+
Svg: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').SVGProps<SVGSVGElement>, never> & Partial<Pick<import('react').SVGProps<SVGSVGElement>, never>>> & string;
|
|
5
|
+
Region: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').SVGProps<SVGGElement>, "$active" | "$selected" | "$interactive"> & {
|
|
6
|
+
$selected: boolean;
|
|
7
|
+
$active: boolean;
|
|
8
|
+
$interactive: boolean;
|
|
9
|
+
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').SVGProps<SVGGElement>, "$active" | "$selected" | "$interactive"> & {
|
|
10
|
+
$selected: boolean;
|
|
11
|
+
$active: boolean;
|
|
12
|
+
$interactive: boolean;
|
|
13
|
+
}, never>>> & string;
|
|
14
|
+
Side: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').SVGTextElementAttributes<SVGTextElement>, never> & Partial<Pick<import('react').SVGTextElementAttributes<SVGTextElement>, never>>> & string;
|
|
15
|
+
Number: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').SVGTextElementAttributes<SVGTextElement>, never> & Partial<Pick<import('react').SVGTextElementAttributes<SVGTextElement>, never>>> & string;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/controls/ImageAnnotation/BodyAnnotationImage/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC;;;;;mBAmBoB,OAAO;iBAAW,OAAO;sBAAgB,OAAO;;mBAAhD,OAAO;iBAAW,OAAO;sBAAgB,OAAO;;;;CA4BjF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import i, { css as n } from "styled-components";
|
|
2
|
+
const r = {
|
|
3
|
+
Container: i.div.withConfig({
|
|
4
|
+
displayName: "BodyAnnotationImage__Container",
|
|
5
|
+
componentId: "sc-1yexbro-0"
|
|
6
|
+
})(["display:flex;flex-direction:column;gap:24px;width:100%;"]),
|
|
7
|
+
Figure: i.div.withConfig({
|
|
8
|
+
displayName: "BodyAnnotationImage__Figure",
|
|
9
|
+
componentId: "sc-1yexbro-1"
|
|
10
|
+
})(["position:relative;width:100%;max-width:289px;margin:0 auto;"]),
|
|
11
|
+
Svg: i.svg.withConfig({
|
|
12
|
+
displayName: "BodyAnnotationImage__Svg",
|
|
13
|
+
componentId: "sc-1yexbro-2"
|
|
14
|
+
})(["display:block;width:100%;height:auto;overflow:visible;"]),
|
|
15
|
+
Region: i.g.withConfig({
|
|
16
|
+
displayName: "BodyAnnotationImage__Region",
|
|
17
|
+
componentId: "sc-1yexbro-3"
|
|
18
|
+
})(["fill:", ";stroke:", ";stroke-width:2px;outline:none;transition:fill 0.2s;", ""], ({
|
|
19
|
+
theme: o,
|
|
20
|
+
$selected: e
|
|
21
|
+
}) => e ? o.primary : o.neutralPalette.gray_5, ({
|
|
22
|
+
theme: o,
|
|
23
|
+
$active: e
|
|
24
|
+
}) => e ? o.primaryPalette.bcp_8 : "none", ({
|
|
25
|
+
$interactive: o,
|
|
26
|
+
$selected: e,
|
|
27
|
+
theme: t
|
|
28
|
+
}) => o && n(["cursor:pointer;&:hover,&:focus-visible{fill:", ";}"], e ? t.primaryPalette.bcp_7 : t.primaryPalette.bcp_5)),
|
|
29
|
+
Side: i.text.withConfig({
|
|
30
|
+
displayName: "BodyAnnotationImage__Side",
|
|
31
|
+
componentId: "sc-1yexbro-4"
|
|
32
|
+
})(["fill:", ";font-size:14px;"], ({
|
|
33
|
+
theme: o
|
|
34
|
+
}) => o.neutral.primaryText),
|
|
35
|
+
Number: i.text.withConfig({
|
|
36
|
+
displayName: "BodyAnnotationImage__Number",
|
|
37
|
+
componentId: "sc-1yexbro-5"
|
|
38
|
+
})(["fill:#ffffff;font-size:12px;font-weight:600;pointer-events:none;"])
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
r as S
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FCEQuestionnaireItem, FormItems } from 'sdc-qrf';
|
|
2
|
+
/** The first child of a body annotation group is a choice holding the body site code of the annotation */
|
|
3
|
+
export declare function getBodySiteItem(questionItem: FCEQuestionnaireItem): FCEQuestionnaireItem | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Child items describing a body annotation, i.e. everything except the body site item.
|
|
6
|
+
* Returns undefined when the group is misconfigured.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getBodyAnnotationDetailItems(questionItem: FCEQuestionnaireItem): FCEQuestionnaireItem[] | undefined;
|
|
9
|
+
export declare function getBodySiteCode(item: FormItems | undefined, linkId: string): string | undefined;
|
|
10
|
+
export declare function buildBodySiteAnswer(code: string): {
|
|
11
|
+
value: {
|
|
12
|
+
Coding: {
|
|
13
|
+
code: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/controls/ImageAnnotation/BodyAnnotationImage/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3E,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,YAAY,EAAE,oBAAoB,oCAIjE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,SAAS,CAcnH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/F;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM;;;;;;IAE/C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function c(e) {
|
|
2
|
+
const [n] = e.item ?? [];
|
|
3
|
+
return (n == null ? void 0 : n.type) === "choice" ? n : void 0;
|
|
4
|
+
}
|
|
5
|
+
function d(e) {
|
|
6
|
+
const {
|
|
7
|
+
linkId: n,
|
|
8
|
+
item: o,
|
|
9
|
+
repeats: t
|
|
10
|
+
} = e;
|
|
11
|
+
if (!c(e)) {
|
|
12
|
+
console.warn(`BodyAnnotationImage (${n}): the first child item must be of type choice`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return t || console.warn(`BodyAnnotationImage (${n}): the group must be repeatable`), (o ?? []).slice(1);
|
|
16
|
+
}
|
|
17
|
+
function u(e, n) {
|
|
18
|
+
var o, t, i, r;
|
|
19
|
+
return (r = (i = (t = (o = e == null ? void 0 : e[n]) == null ? void 0 : o[0]) == null ? void 0 : t.value) == null ? void 0 : i.Coding) == null ? void 0 : r.code;
|
|
20
|
+
}
|
|
21
|
+
function a(e) {
|
|
22
|
+
return [{
|
|
23
|
+
value: {
|
|
24
|
+
Coding: {
|
|
25
|
+
code: e
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}];
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
a as buildBodySiteAnswer,
|
|
32
|
+
d as getBodyAnnotationDetailItems,
|
|
33
|
+
u as getBodySiteCode,
|
|
34
|
+
c as getBodySiteItem
|
|
35
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GroupItemProps } from 'sdc-qrf';
|
|
2
2
|
/**
|
|
3
3
|
* Repeatable group rendered on top of an image (`backgroundImage` extension).
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
* and are shown for the currently selected marker only.
|
|
4
|
+
* The image interaction and marker positions are handled by `AnnotationImage`;
|
|
5
|
+
* the details of the currently selected annotation are shown next to it.
|
|
7
6
|
*/
|
|
8
7
|
export declare function ImageAnnotation(props: GroupItemProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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":"AAIA,OAAO,EAGH,cAAc,EAIjB,MAAM,SAAS,CAAC;AA8CjB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,kDAoDpD"}
|
|
@@ -1,114 +1,82 @@
|
|
|
1
|
-
import { jsxs as x, jsx as t, Fragment as
|
|
2
|
-
import { i18n as
|
|
3
|
-
import { DeleteOutlined as
|
|
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
4
|
import { Button as D } from "antd";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const E = 2;
|
|
14
|
-
function A(e, i) {
|
|
15
|
-
return w.round(w.clamp(e / i * 100, 0, 100), E);
|
|
16
|
-
}
|
|
17
|
-
function O(e) {
|
|
18
|
-
return [{
|
|
19
|
-
value: {
|
|
20
|
-
decimal: e
|
|
21
|
-
}
|
|
22
|
-
}];
|
|
23
|
-
}
|
|
24
|
-
function N(e) {
|
|
5
|
+
import { useState as k } from "react";
|
|
6
|
+
import { getItemKey as y, QuestionItems as O } from "sdc-qrf";
|
|
7
|
+
import { useFieldController as R } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
|
|
8
|
+
import { Title as S } from "../../components/Typography.js";
|
|
9
|
+
import { useRepeatableGroup as _ } from "../Group/RepeatableGroups/RepeatableGroupCard/hooks.js";
|
|
10
|
+
import { S as i } from "./styles.js";
|
|
11
|
+
import { useAnnotationImageComponent as b } from "./useAnnotationImageComponent.js";
|
|
12
|
+
function j(s) {
|
|
25
13
|
const {
|
|
26
|
-
index:
|
|
27
|
-
items:
|
|
28
|
-
onChange:
|
|
29
|
-
onRemoved:
|
|
30
|
-
groupItem:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} =
|
|
36
|
-
onRemove:
|
|
37
|
-
parentPath:
|
|
38
|
-
context:
|
|
39
|
-
} =
|
|
40
|
-
index:
|
|
41
|
-
items:
|
|
42
|
-
onChange:
|
|
43
|
-
groupItem:
|
|
44
|
-
})
|
|
45
|
-
return /* @__PURE__ */ x(
|
|
46
|
-
/* @__PURE__ */ x(
|
|
47
|
-
/* @__PURE__ */ t(
|
|
14
|
+
index: m,
|
|
15
|
+
items: n,
|
|
16
|
+
onChange: r,
|
|
17
|
+
onRemoved: d,
|
|
18
|
+
groupItem: l,
|
|
19
|
+
detailItems: o
|
|
20
|
+
} = s, {
|
|
21
|
+
text: c,
|
|
22
|
+
readOnly: u
|
|
23
|
+
} = l.questionItem, {
|
|
24
|
+
onRemove: a,
|
|
25
|
+
parentPath: I,
|
|
26
|
+
context: p
|
|
27
|
+
} = _({
|
|
28
|
+
index: m,
|
|
29
|
+
items: n,
|
|
30
|
+
onChange: r,
|
|
31
|
+
groupItem: l
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ x(C, { children: [
|
|
34
|
+
/* @__PURE__ */ x(i.DetailsHeader, { children: [
|
|
35
|
+
/* @__PURE__ */ t(S, { level: 5, children: `${c || h._(
|
|
48
36
|
/*i18n*/
|
|
49
37
|
{
|
|
50
38
|
id: "V0Qg8j"
|
|
51
39
|
}
|
|
52
|
-
)} ${
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, "aria-label":
|
|
40
|
+
)} ${m + 1}` }),
|
|
41
|
+
u ? null : /* @__PURE__ */ t(D, { icon: /* @__PURE__ */ t(A, {}), onClick: () => {
|
|
42
|
+
a(), d(m);
|
|
43
|
+
}, "aria-label": h._(
|
|
56
44
|
/*i18n*/
|
|
57
45
|
{
|
|
58
46
|
id: "KGJ03u"
|
|
59
47
|
}
|
|
60
48
|
), "data-testid": "remove-annotation-button" })
|
|
61
49
|
] }),
|
|
62
|
-
/* @__PURE__ */ t(
|
|
50
|
+
/* @__PURE__ */ t(i.DetailsItems, { children: /* @__PURE__ */ t(O, { questionItems: o, parentPath: I, context: p }) })
|
|
63
51
|
] });
|
|
64
52
|
}
|
|
65
|
-
function
|
|
53
|
+
function J(s) {
|
|
66
54
|
const {
|
|
67
|
-
parentPath:
|
|
68
|
-
questionItem:
|
|
69
|
-
} =
|
|
70
|
-
linkId:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return;
|
|
84
|
-
const s = I.currentTarget.getBoundingClientRect();
|
|
85
|
-
if (!s.width || !s.height)
|
|
86
|
-
return;
|
|
87
|
-
const _ = K({
|
|
88
|
-
[a.linkId]: O(A(I.clientX - s.left, s.width)),
|
|
89
|
-
[d.linkId]: O(A(I.clientY - s.top, s.height))
|
|
90
|
-
});
|
|
91
|
-
h({
|
|
92
|
-
...c,
|
|
93
|
-
items: [...n, _]
|
|
94
|
-
}), y(n.length);
|
|
55
|
+
parentPath: m,
|
|
56
|
+
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)
|
|
65
|
+
return null;
|
|
66
|
+
const e = (o == null ? void 0 : o.items) ?? [], f = e[u] ? u : e.length - 1, v = (g) => {
|
|
67
|
+
c({
|
|
68
|
+
...o,
|
|
69
|
+
items: [...e, g]
|
|
70
|
+
}), a(e.length);
|
|
95
71
|
};
|
|
96
|
-
return /* @__PURE__ */ x(
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
99
|
-
/*i18n*/
|
|
100
|
-
{
|
|
101
|
-
id: "2mt1iB"
|
|
102
|
-
}
|
|
103
|
-
) }),
|
|
104
|
-
/* @__PURE__ */ t(B, { imageUrl: u == null ? void 0 : u.url, alt: l.text, items: n, xLinkId: a.linkId, yLinkId: d.linkId, activeIndex: g, onImageClick: r ? void 0 : R, onMarkerClick: y })
|
|
105
|
-
] }),
|
|
106
|
-
/* @__PURE__ */ t(m.Details, { children: n[g] ? /* @__PURE__ */ t(N, { index: g, items: n, onChange: h, onRemoved: (I) => y(Math.max(0, I - 1)), groupItem: e }, S(n[g])) : /* @__PURE__ */ t(m.Empty, { children: r ? p._(
|
|
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._(
|
|
107
75
|
/*i18n*/
|
|
108
76
|
{
|
|
109
77
|
id: "vKC52t"
|
|
110
78
|
}
|
|
111
|
-
) :
|
|
79
|
+
) : h._(
|
|
112
80
|
/*i18n*/
|
|
113
81
|
{
|
|
114
82
|
id: "sMXMOk"
|
|
@@ -117,5 +85,5 @@ function W(e) {
|
|
|
117
85
|
] });
|
|
118
86
|
}
|
|
119
87
|
export {
|
|
120
|
-
|
|
88
|
+
J as ImageAnnotation
|
|
121
89
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FCEQuestionnaireItem } from 'sdc-qrf';
|
|
2
|
+
import { AnnotationImageComponent } from '../../contexts/image-annotation';
|
|
3
|
+
/** Picks the image renderer registered for the group's `backgroundImage` url, `AnnotationImage` by default */
|
|
4
|
+
export declare function useAnnotationImageComponent(questionItem: FCEQuestionnaireItem): AnnotationImageComponent;
|
|
5
|
+
//# sourceMappingURL=useAnnotationImageComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnnotationImageComponent.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/useAnnotationImageComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAA2B,MAAM,+BAA+B,CAAC;AAIlG,8GAA8G;AAC9G,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,oBAAoB,GAAG,wBAAwB,CAKxG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext as e } from "react";
|
|
2
|
+
import { ImageAnnotationProvider as m } from "../../contexts/image-annotation.js";
|
|
3
|
+
import { AnnotationImage as a } from "./AnnotationImage.js";
|
|
4
|
+
function c(t) {
|
|
5
|
+
var n;
|
|
6
|
+
const r = e(m), o = (n = t.backgroundImage) == null ? void 0 : n.url;
|
|
7
|
+
return o && r[o] || a;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
c as useAnnotationImageComponent
|
|
11
|
+
};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import { FormItems } from 'sdc-qrf';
|
|
1
|
+
import { FCEQuestionnaireItem, FormItems } from 'sdc-qrf';
|
|
2
2
|
export declare function getCoordinate(item: FormItems | undefined, linkId: string): number | undefined;
|
|
3
|
+
export declare function toPercent(value: number, total: number): number;
|
|
4
|
+
export declare function buildCoordinateAnswer(value: number): {
|
|
5
|
+
value: {
|
|
6
|
+
decimal: number;
|
|
7
|
+
};
|
|
8
|
+
}[];
|
|
9
|
+
/** The first two children of an image annotation group are decimals holding the marker position (x, y) */
|
|
10
|
+
export declare function getCoordinateItems(questionItem: FCEQuestionnaireItem): readonly [FCEQuestionnaireItem, FCEQuestionnaireItem] | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Child items describing an annotation, i.e. everything except the coordinate items.
|
|
13
|
+
* Returns undefined when the group is misconfigured.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getAnnotationDetailItems(questionItem: FCEQuestionnaireItem): FCEQuestionnaireItem[] | undefined;
|
|
3
16
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAmB,SAAS,EAAE,MAAM,SAAS,CAAC;AAI3E,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI7F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAErD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM;;;;IAElD;AAED,0GAA0G;AAC1G,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,oBAAoB,qEAQpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,SAAS,CAc/G"}
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import r from "lodash";
|
|
2
|
+
const c = 2;
|
|
3
|
+
function d(e, t) {
|
|
4
|
+
var o, i, a;
|
|
5
|
+
const n = (a = (i = (o = e == null ? void 0 : e[t]) == null ? void 0 : o[0]) == null ? void 0 : i.value) == null ? void 0 : a.decimal;
|
|
6
|
+
return r.isNumber(n) ? n : void 0;
|
|
7
|
+
}
|
|
8
|
+
function m(e, t) {
|
|
9
|
+
return r.round(r.clamp(e / t * 100, 0, 100), c);
|
|
10
|
+
}
|
|
11
|
+
function s(e) {
|
|
12
|
+
return [{
|
|
13
|
+
value: {
|
|
14
|
+
decimal: e
|
|
15
|
+
}
|
|
16
|
+
}];
|
|
17
|
+
}
|
|
18
|
+
function u(e) {
|
|
19
|
+
const [t, n] = e.item ?? [];
|
|
20
|
+
if (!(!t || !n || t.type !== "decimal" || n.type !== "decimal"))
|
|
21
|
+
return [t, n];
|
|
22
|
+
}
|
|
23
|
+
function f(e) {
|
|
24
|
+
const {
|
|
25
|
+
linkId: t,
|
|
26
|
+
item: n,
|
|
27
|
+
repeats: o
|
|
28
|
+
} = e;
|
|
29
|
+
if (!u(e)) {
|
|
30
|
+
console.warn(`ImageAnnotation (${t}): the first two child items must be of type decimal`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return o || console.warn(`ImageAnnotation (${t}): the group must be repeatable`), (n ?? []).slice(2);
|
|
6
34
|
}
|
|
7
35
|
export {
|
|
8
|
-
|
|
36
|
+
s as buildCoordinateAnswer,
|
|
37
|
+
f as getAnnotationDetailItems,
|
|
38
|
+
d as getCoordinate,
|
|
39
|
+
u as getCoordinateItems,
|
|
40
|
+
m as toPercent
|
|
9
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/InlineChoice/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/InlineChoice/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAmB,iBAAiB,EAAiB,MAAM,SAAS,CAAC;AAQ5E,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAsFpD"}
|