@openmrs/esm-form-builder-app 2.0.2-pre.559 → 2.0.2-pre.568
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/150.js +1 -1
- package/dist/150.js.map +1 -1
- package/dist/153.js +1 -1
- package/dist/252.js +2 -0
- package/dist/252.js.map +1 -0
- package/dist/256.js +1 -1
- package/dist/256.js.map +1 -1
- package/dist/447.js +1 -1
- package/dist/447.js.map +1 -1
- package/dist/879.js +2 -0
- package/dist/879.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/openmrs-esm-form-builder-app.js.buildmanifest.json +198 -198
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/components/dashboard/dashboard.component.tsx +0 -1
- package/src/components/form-editor/form-editor.component.tsx +48 -5
- package/src/components/form-editor/form-editor.scss +6 -0
- package/src/components/interactive-builder/draggable-question.component.tsx +23 -24
- package/src/components/interactive-builder/edit-question-modal.component.tsx +308 -317
- package/src/components/interactive-builder/editable-value.component.tsx +1 -1
- package/src/components/interactive-builder/interactive-builder.component.tsx +29 -31
- package/dist/682.js +0 -2
- package/dist/682.js.map +0 -1
- package/dist/990.js +0 -2
- package/dist/990.js.map +0 -1
- /package/dist/{682.js.LICENSE.txt → 252.js.LICENSE.txt} +0 -0
- /package/dist/{990.js.LICENSE.txt → 879.js.LICENSE.txt} +0 -0
|
@@ -231,344 +231,335 @@ const EditQuestionModal: React.FC<EditQuestionModalProps> = ({
|
|
|
231
231
|
onSubmit={(event) => event.preventDefault()}
|
|
232
232
|
>
|
|
233
233
|
<ModalBody hasScrollingContent>
|
|
234
|
-
<
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
/>
|
|
234
|
+
<Stack gap={5}>
|
|
235
|
+
<TextInput
|
|
236
|
+
defaultValue={questionToEdit.label}
|
|
237
|
+
id={questionToEdit.id}
|
|
238
|
+
labelText={t("questionLabel", "Label")}
|
|
239
|
+
onChange={(event) => setQuestionLabel(event.target.value)}
|
|
240
|
+
required
|
|
241
|
+
/>
|
|
243
242
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
243
|
+
<TextInput
|
|
244
|
+
defaultValue={questionToEdit.id}
|
|
245
|
+
id="questionId"
|
|
246
|
+
invalid={questionIdExists(questionId)}
|
|
247
|
+
invalidText={t(
|
|
248
|
+
"questionIdExists",
|
|
249
|
+
"This question ID already exists in your schema"
|
|
250
|
+
)}
|
|
251
|
+
labelText={t(
|
|
252
|
+
"questionId",
|
|
253
|
+
"Question ID (prefer using camel-case for IDs)"
|
|
254
|
+
)}
|
|
255
|
+
onChange={(event) => setQuestionId(event.target.value)}
|
|
256
|
+
placeholder={t(
|
|
257
|
+
"questionIdPlaceholder",
|
|
258
|
+
'Enter a unique ID e.g. "anaesthesiaType" for a question asking about the type of anaesthesia.'
|
|
259
|
+
)}
|
|
260
|
+
required
|
|
261
|
+
/>
|
|
262
|
+
|
|
263
|
+
<RadioButtonGroup
|
|
264
|
+
defaultSelected={
|
|
265
|
+
/true/.test(questionToEdit?.required?.toString())
|
|
266
|
+
? "required"
|
|
267
|
+
: "optional"
|
|
268
|
+
}
|
|
269
|
+
name="isQuestionRequired"
|
|
270
|
+
legendText={t(
|
|
271
|
+
"isQuestionRequiredOrOptional",
|
|
272
|
+
"Is this question a required or optional field? Required fields must be answered before the form can be submitted."
|
|
273
|
+
)}
|
|
274
|
+
>
|
|
275
|
+
<RadioButton
|
|
276
|
+
id="questionIsNotRequired"
|
|
277
|
+
defaultChecked={true}
|
|
278
|
+
labelText={t("optional", "Optional")}
|
|
279
|
+
onClick={() => setIsQuestionRequired(false)}
|
|
280
|
+
value="optional"
|
|
262
281
|
/>
|
|
282
|
+
<RadioButton
|
|
283
|
+
id="questionIsRequired"
|
|
284
|
+
defaultChecked={false}
|
|
285
|
+
labelText={t("required", "Required")}
|
|
286
|
+
onClick={() => setIsQuestionRequired(true)}
|
|
287
|
+
value="required"
|
|
288
|
+
/>
|
|
289
|
+
</RadioButtonGroup>
|
|
263
290
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
<RadioButton
|
|
277
|
-
id="questionIsNotRequired"
|
|
278
|
-
defaultChecked={true}
|
|
279
|
-
labelText={t("optional", "Optional")}
|
|
280
|
-
onClick={() => setIsQuestionRequired(false)}
|
|
281
|
-
value="optional"
|
|
291
|
+
<Select
|
|
292
|
+
defaultValue={questionToEdit.type}
|
|
293
|
+
onChange={(event) => setQuestionType(event.target.value)}
|
|
294
|
+
id={"questionType"}
|
|
295
|
+
invalidText={t("typeRequired", "Type is required")}
|
|
296
|
+
labelText={t("questionType", "Question type")}
|
|
297
|
+
required
|
|
298
|
+
>
|
|
299
|
+
{!questionType && (
|
|
300
|
+
<SelectItem
|
|
301
|
+
text={t("chooseQuestionType", "Choose a question type")}
|
|
302
|
+
value=""
|
|
282
303
|
/>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
304
|
+
)}
|
|
305
|
+
{questionTypes.map((questionType, key) => (
|
|
306
|
+
<SelectItem
|
|
307
|
+
text={questionType}
|
|
308
|
+
value={questionType}
|
|
309
|
+
key={key}
|
|
289
310
|
/>
|
|
290
|
-
|
|
311
|
+
))}
|
|
312
|
+
</Select>
|
|
291
313
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
required
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
</Select>
|
|
314
|
-
|
|
315
|
-
<Select
|
|
316
|
-
defaultValue={questionToEdit.questionOptions.rendering}
|
|
317
|
-
onChange={(event) => setFieldType(event.target.value)}
|
|
318
|
-
id="renderingType"
|
|
319
|
-
invalidText={t(
|
|
320
|
-
"validFieldTypeRequired",
|
|
321
|
-
"A valid field type value is required"
|
|
322
|
-
)}
|
|
323
|
-
labelText={t("fieldType", "Field type")}
|
|
324
|
-
required
|
|
325
|
-
>
|
|
326
|
-
{!fieldType && (
|
|
327
|
-
<SelectItem
|
|
328
|
-
text={t("chooseFieldType", "Choose a field type")}
|
|
329
|
-
value=""
|
|
330
|
-
/>
|
|
331
|
-
)}
|
|
332
|
-
{fieldTypes.map((fieldType, key) => (
|
|
333
|
-
<SelectItem text={fieldType} value={fieldType} key={key} />
|
|
334
|
-
))}
|
|
335
|
-
</Select>
|
|
314
|
+
<Select
|
|
315
|
+
defaultValue={questionToEdit.questionOptions.rendering}
|
|
316
|
+
onChange={(event) => setFieldType(event.target.value)}
|
|
317
|
+
id="renderingType"
|
|
318
|
+
invalidText={t(
|
|
319
|
+
"validFieldTypeRequired",
|
|
320
|
+
"A valid field type value is required"
|
|
321
|
+
)}
|
|
322
|
+
labelText={t("fieldType", "Field type")}
|
|
323
|
+
required
|
|
324
|
+
>
|
|
325
|
+
{!fieldType && (
|
|
326
|
+
<SelectItem
|
|
327
|
+
text={t("chooseFieldType", "Choose a field type")}
|
|
328
|
+
value=""
|
|
329
|
+
/>
|
|
330
|
+
)}
|
|
331
|
+
{fieldTypes.map((fieldType, key) => (
|
|
332
|
+
<SelectItem text={fieldType} value={fieldType} key={key} />
|
|
333
|
+
))}
|
|
334
|
+
</Select>
|
|
336
335
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
<TextInput
|
|
340
|
-
id="min"
|
|
341
|
-
labelText="Min"
|
|
342
|
-
value={min || ""}
|
|
343
|
-
onChange={(event) => setMin(event.target.value)}
|
|
344
|
-
required
|
|
345
|
-
/>
|
|
346
|
-
<TextInput
|
|
347
|
-
id="max"
|
|
348
|
-
labelText="Max"
|
|
349
|
-
value={max || ""}
|
|
350
|
-
onChange={(event) => setMax(event.target.value)}
|
|
351
|
-
required
|
|
352
|
-
/>
|
|
353
|
-
</>
|
|
354
|
-
) : fieldType === "textarea" ? (
|
|
336
|
+
{fieldType === "number" ? (
|
|
337
|
+
<>
|
|
355
338
|
<TextInput
|
|
356
|
-
id="
|
|
357
|
-
labelText=
|
|
358
|
-
value={
|
|
359
|
-
onChange={(event) =>
|
|
339
|
+
id="min"
|
|
340
|
+
labelText="Min"
|
|
341
|
+
value={min || ""}
|
|
342
|
+
onChange={(event) => setMin(event.target.value)}
|
|
360
343
|
required
|
|
361
344
|
/>
|
|
362
|
-
|
|
345
|
+
<TextInput
|
|
346
|
+
id="max"
|
|
347
|
+
labelText="Max"
|
|
348
|
+
value={max || ""}
|
|
349
|
+
onChange={(event) => setMax(event.target.value)}
|
|
350
|
+
required
|
|
351
|
+
/>
|
|
352
|
+
</>
|
|
353
|
+
) : fieldType === "textarea" ? (
|
|
354
|
+
<TextInput
|
|
355
|
+
id="textAreaRows"
|
|
356
|
+
labelText={t("rows", "Rows")}
|
|
357
|
+
value={rows || ""}
|
|
358
|
+
onChange={(event) => setRows(event.target.value)}
|
|
359
|
+
required
|
|
360
|
+
/>
|
|
361
|
+
) : null}
|
|
363
362
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
363
|
+
{fieldType !== "ui-select-extended" && (
|
|
364
|
+
<div>
|
|
365
|
+
<FormLabel className={styles.label}>
|
|
366
|
+
{t("searchForBackingConcept", "Search for a backing concept")}
|
|
367
|
+
</FormLabel>
|
|
368
|
+
{isLoadingConceptName ? (
|
|
369
|
+
<InlineLoading
|
|
370
|
+
className={styles.loader}
|
|
371
|
+
description={t("loading", "Loading") + "..."}
|
|
372
|
+
/>
|
|
373
|
+
) : (
|
|
374
|
+
<>
|
|
375
|
+
<Search
|
|
376
|
+
defaultValue={conceptName}
|
|
377
|
+
id="conceptLookup"
|
|
378
|
+
onClear={() => setSelectedConcept(null)}
|
|
379
|
+
onChange={(e) =>
|
|
380
|
+
handleConceptChange(e.target.value?.trim())
|
|
381
|
+
}
|
|
382
|
+
placeholder={t(
|
|
383
|
+
"searchConcept",
|
|
384
|
+
"Search using a concept name or UUID"
|
|
385
|
+
)}
|
|
386
|
+
required
|
|
387
|
+
size="md"
|
|
388
|
+
value={selectedConcept?.display}
|
|
376
389
|
/>
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
defaultValue={conceptName}
|
|
381
|
-
id="conceptLookup"
|
|
382
|
-
onClear={() => setSelectedConcept(null)}
|
|
383
|
-
onChange={(e) =>
|
|
384
|
-
handleConceptChange(e.target.value?.trim())
|
|
385
|
-
}
|
|
386
|
-
placeholder={t(
|
|
387
|
-
"searchConcept",
|
|
388
|
-
"Search using a concept name or UUID"
|
|
389
|
-
)}
|
|
390
|
-
required
|
|
391
|
-
size="md"
|
|
392
|
-
value={selectedConcept?.display}
|
|
393
|
-
/>
|
|
394
|
-
{(() => {
|
|
395
|
-
if (!conceptToLookup) return null;
|
|
396
|
-
if (isLoadingConcepts)
|
|
397
|
-
return (
|
|
398
|
-
<InlineLoading
|
|
399
|
-
className={styles.loader}
|
|
400
|
-
description={t("searching", "Searching") + "..."}
|
|
401
|
-
/>
|
|
402
|
-
);
|
|
403
|
-
if (
|
|
404
|
-
concepts &&
|
|
405
|
-
concepts?.length &&
|
|
406
|
-
!isLoadingConcepts
|
|
407
|
-
) {
|
|
408
|
-
return (
|
|
409
|
-
<ul className={styles.conceptList}>
|
|
410
|
-
{concepts?.map((concept, index) => (
|
|
411
|
-
<li
|
|
412
|
-
role="menuitem"
|
|
413
|
-
className={styles.concept}
|
|
414
|
-
key={index}
|
|
415
|
-
onClick={() => handleConceptSelect(concept)}
|
|
416
|
-
>
|
|
417
|
-
{concept.display}
|
|
418
|
-
</li>
|
|
419
|
-
))}
|
|
420
|
-
</ul>
|
|
421
|
-
);
|
|
422
|
-
}
|
|
390
|
+
{(() => {
|
|
391
|
+
if (!conceptToLookup) return null;
|
|
392
|
+
if (isLoadingConcepts)
|
|
423
393
|
return (
|
|
424
|
-
<
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
{t(
|
|
439
|
-
"conceptSearchHelpText",
|
|
440
|
-
"Can't find a concept?"
|
|
441
|
-
)}
|
|
442
|
-
</p>
|
|
443
|
-
}
|
|
444
|
-
<a
|
|
445
|
-
className={styles.oclLink}
|
|
446
|
-
target="_blank"
|
|
447
|
-
rel="noopener noreferrer"
|
|
448
|
-
href={"https://app.openconceptlab.org/"}
|
|
394
|
+
<InlineLoading
|
|
395
|
+
className={styles.loader}
|
|
396
|
+
description={t("searching", "Searching") + "..."}
|
|
397
|
+
/>
|
|
398
|
+
);
|
|
399
|
+
if (concepts && concepts?.length && !isLoadingConcepts) {
|
|
400
|
+
return (
|
|
401
|
+
<ul className={styles.conceptList}>
|
|
402
|
+
{concepts?.map((concept, index) => (
|
|
403
|
+
<li
|
|
404
|
+
role="menuitem"
|
|
405
|
+
className={styles.concept}
|
|
406
|
+
key={index}
|
|
407
|
+
onClick={() => handleConceptSelect(concept)}
|
|
449
408
|
>
|
|
450
|
-
{
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
</Layer>
|
|
409
|
+
{concept.display}
|
|
410
|
+
</li>
|
|
411
|
+
))}
|
|
412
|
+
</ul>
|
|
455
413
|
);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
414
|
+
}
|
|
415
|
+
return (
|
|
416
|
+
<Layer>
|
|
417
|
+
<Tile className={styles.emptyResults}>
|
|
418
|
+
<span>
|
|
419
|
+
{t(
|
|
420
|
+
"noMatchingConcepts",
|
|
421
|
+
"No concepts were found that match"
|
|
422
|
+
)}{" "}
|
|
423
|
+
<strong>"{conceptToLookup}".</strong>
|
|
424
|
+
</span>
|
|
425
|
+
</Tile>
|
|
461
426
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
</
|
|
482
|
-
)
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
{!hasConceptChanged &&
|
|
489
|
-
questionToEdit?.questionOptions?.answers &&
|
|
490
|
-
questionToEdit?.questionOptions.answers?.length ? (
|
|
491
|
-
<MultiSelect
|
|
492
|
-
className={styles.multiSelect}
|
|
493
|
-
direction="top"
|
|
494
|
-
id="selectAnswers"
|
|
495
|
-
itemToString={(item) => item.text}
|
|
496
|
-
initialSelectedItems={questionToEdit?.questionOptions?.answers?.map(
|
|
497
|
-
(answer) => ({
|
|
498
|
-
id: answer.concept,
|
|
499
|
-
text: answer.label,
|
|
500
|
-
})
|
|
501
|
-
)}
|
|
502
|
-
items={questionToEdit?.questionOptions?.answers?.map(
|
|
503
|
-
(answer) => ({
|
|
504
|
-
id: answer.concept,
|
|
505
|
-
text: answer.label ?? "",
|
|
506
|
-
})
|
|
507
|
-
)}
|
|
508
|
-
onChange={({ selectedItems }) => {
|
|
509
|
-
setAnswersChanged(true);
|
|
510
|
-
setSelectedAnswers(selectedItems.sort());
|
|
511
|
-
}}
|
|
512
|
-
size="md"
|
|
513
|
-
titleText={t(
|
|
514
|
-
"selectAnswersToDisplay",
|
|
515
|
-
"Select answers to display"
|
|
516
|
-
)}
|
|
517
|
-
/>
|
|
518
|
-
) : null}
|
|
427
|
+
<div className={styles.oclLauncherBanner}>
|
|
428
|
+
{
|
|
429
|
+
<p className={styles.bodyShort01}>
|
|
430
|
+
{t(
|
|
431
|
+
"conceptSearchHelpText",
|
|
432
|
+
"Can't find a concept?"
|
|
433
|
+
)}
|
|
434
|
+
</p>
|
|
435
|
+
}
|
|
436
|
+
<a
|
|
437
|
+
className={styles.oclLink}
|
|
438
|
+
target="_blank"
|
|
439
|
+
rel="noopener noreferrer"
|
|
440
|
+
href={"https://app.openconceptlab.org/"}
|
|
441
|
+
>
|
|
442
|
+
{t("searchInOCL", "Search in OCL")}
|
|
443
|
+
<ArrowUpRight size={16} />
|
|
444
|
+
</a>
|
|
445
|
+
</div>
|
|
446
|
+
</Layer>
|
|
447
|
+
);
|
|
448
|
+
})()}
|
|
449
|
+
</>
|
|
450
|
+
)}
|
|
451
|
+
</div>
|
|
452
|
+
)}
|
|
519
453
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
{
|
|
531
|
-
</
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
454
|
+
{conceptMappings && conceptMappings.length ? (
|
|
455
|
+
<FormGroup>
|
|
456
|
+
<FormLabel className={styles.label}>
|
|
457
|
+
{t("mappings", "Mappings")}
|
|
458
|
+
</FormLabel>
|
|
459
|
+
<table className={styles.tableStriped}>
|
|
460
|
+
<thead>
|
|
461
|
+
<tr>
|
|
462
|
+
<th>{t("relationship", "Relationship")}</th>
|
|
463
|
+
<th>{t("source", "Source")}</th>
|
|
464
|
+
<th>{t("code", "Code")}</th>
|
|
465
|
+
</tr>
|
|
466
|
+
</thead>
|
|
467
|
+
<tbody>
|
|
468
|
+
{conceptMappings.map((mapping, index) => (
|
|
469
|
+
<tr key={`mapping-${index}`}>
|
|
470
|
+
<td>{mapping.relationship ?? "--"}</td>
|
|
471
|
+
<td>{mapping.type ?? "--"}</td>
|
|
472
|
+
<td>{mapping.value ?? "--"}</td>
|
|
473
|
+
</tr>
|
|
474
|
+
))}
|
|
475
|
+
</tbody>
|
|
476
|
+
</table>
|
|
477
|
+
</FormGroup>
|
|
478
|
+
) : null}
|
|
535
479
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
480
|
+
{!hasConceptChanged &&
|
|
481
|
+
questionToEdit?.questionOptions?.answers &&
|
|
482
|
+
questionToEdit?.questionOptions.answers?.length ? (
|
|
483
|
+
<MultiSelect
|
|
484
|
+
className={styles.multiSelect}
|
|
485
|
+
direction="top"
|
|
486
|
+
id="selectAnswers"
|
|
487
|
+
itemToString={(item) => item.text}
|
|
488
|
+
initialSelectedItems={questionToEdit?.questionOptions?.answers?.map(
|
|
489
|
+
(answer) => ({
|
|
543
490
|
id: answer.concept,
|
|
544
491
|
text: answer.label,
|
|
545
|
-
})
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
492
|
+
})
|
|
493
|
+
)}
|
|
494
|
+
items={questionToEdit?.questionOptions?.answers?.map(
|
|
495
|
+
(answer) => ({
|
|
496
|
+
id: answer.concept,
|
|
497
|
+
text: answer.label ?? "",
|
|
498
|
+
})
|
|
499
|
+
)}
|
|
500
|
+
onChange={({ selectedItems }) => {
|
|
501
|
+
setAnswersChanged(true);
|
|
502
|
+
setSelectedAnswers(selectedItems.sort());
|
|
503
|
+
}}
|
|
504
|
+
size="md"
|
|
505
|
+
titleText={t(
|
|
506
|
+
"selectAnswersToDisplay",
|
|
507
|
+
"Select answers to display"
|
|
508
|
+
)}
|
|
509
|
+
/>
|
|
510
|
+
) : null}
|
|
556
511
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
512
|
+
{!hasConceptChanged &&
|
|
513
|
+
questionToEdit?.questionOptions?.answers?.length &&
|
|
514
|
+
!answersChanged ? (
|
|
515
|
+
<div>
|
|
516
|
+
{questionToEdit?.questionOptions?.answers?.map((answer) => (
|
|
517
|
+
<Tag
|
|
518
|
+
className={styles.tag}
|
|
519
|
+
key={answer?.concept}
|
|
520
|
+
type={"blue"}
|
|
521
|
+
>
|
|
522
|
+
{answer?.label}
|
|
523
|
+
</Tag>
|
|
524
|
+
))}
|
|
525
|
+
</div>
|
|
526
|
+
) : null}
|
|
527
|
+
|
|
528
|
+
{hasConceptChanged && answersFromConcept.length ? (
|
|
529
|
+
<MultiSelect
|
|
530
|
+
className={styles.multiSelect}
|
|
531
|
+
direction="top"
|
|
532
|
+
id="selectAnswers"
|
|
533
|
+
itemToString={(item) => item.text}
|
|
534
|
+
items={answersFromConcept.map((answer) => ({
|
|
535
|
+
id: answer.concept,
|
|
536
|
+
text: answer.label,
|
|
537
|
+
}))}
|
|
538
|
+
onChange={({ selectedItems }) =>
|
|
539
|
+
setSelectedAnswers(selectedItems.sort())
|
|
540
|
+
}
|
|
541
|
+
size="md"
|
|
542
|
+
titleText={t(
|
|
543
|
+
"selectAnswersToDisplay",
|
|
544
|
+
"Select answers to display"
|
|
545
|
+
)}
|
|
546
|
+
/>
|
|
547
|
+
) : null}
|
|
548
|
+
|
|
549
|
+
{(hasConceptChanged || answersChanged) && (
|
|
550
|
+
<div>
|
|
551
|
+
{selectedAnswers.map((selectedAnswer) => (
|
|
552
|
+
<Tag
|
|
553
|
+
className={styles.tag}
|
|
554
|
+
key={selectedAnswer.id}
|
|
555
|
+
type={"blue"}
|
|
556
|
+
>
|
|
557
|
+
{selectedAnswer.text}
|
|
558
|
+
</Tag>
|
|
559
|
+
))}
|
|
560
|
+
</div>
|
|
561
|
+
)}
|
|
562
|
+
</Stack>
|
|
572
563
|
</ModalBody>
|
|
573
564
|
<ModalFooter>
|
|
574
565
|
<Button onClick={() => onModalChange(false)} kind="secondary">
|