|
13 | 13 | :shiftDragHandle="false" |
14 | 14 | :isTriggerQuestion="isTriggerQuestion" |
15 | 15 | v-on="commonListeners"> |
16 | | - <template #actions> |
17 | | - <!-- Trigger type selection in menu --> |
18 | | - <NcActionButton |
19 | | - v-for="tt in triggerTypesList" |
20 | | - :key="tt.type" |
21 | | - :closeAfterClick="true" |
22 | | - @click="setTriggerType(tt.type)"> |
23 | | - <template #icon> |
24 | | - <NcIconSvgWrapper :svg="tt.icon" /> |
25 | | - </template> |
26 | | - {{ tt.label }} |
27 | | - </NcActionButton> |
28 | | - </template> |
29 | | - |
30 | 16 | <div class="question-conditional"> |
31 | 17 | <!-- Trigger Type Selection (Edit Mode) --> |
32 | 18 | <div v-if="!readOnly && !triggerType" class="trigger-type-selector"> |
33 | 19 | <p class="trigger-type-selector__label"> |
34 | 20 | {{ t('forms', 'Select the trigger question type:') }} |
35 | 21 | </p> |
36 | 22 | <div class="trigger-type-selector__options"> |
37 | | - <NcButton |
38 | | - v-for="tt in triggerTypesList" |
39 | | - :key="tt.type" |
40 | | - variant="secondary" |
41 | | - @click="setTriggerType(tt.type)"> |
42 | | - <template #icon> |
43 | | - <NcIconSvgWrapper :svg="tt.icon" /> |
44 | | - </template> |
45 | | - {{ tt.label }} |
46 | | - </NcButton> |
| 23 | + <div |
| 24 | + v-for="group in triggerTypeGroups" |
| 25 | + :key="group.label" |
| 26 | + class="trigger-type-selector__group"> |
| 27 | + <p class="trigger-type-selector__group-label"> |
| 28 | + {{ group.label }} |
| 29 | + </p> |
| 30 | + <div class="trigger-type-selector__group-options"> |
| 31 | + <NcButton |
| 32 | + v-for="tt in group.types" |
| 33 | + :key="tt.type" |
| 34 | + variant="secondary" |
| 35 | + @click="setTriggerType(tt.type)"> |
| 36 | + <template #icon> |
| 37 | + <NcIconSvgWrapper :svg="tt.icon" /> |
| 38 | + </template> |
| 39 | + {{ tt.label }} |
| 40 | + </NcButton> |
| 41 | + </div> |
| 42 | + </div> |
47 | 43 | </div> |
48 | 44 | </div> |
49 | 45 |
|
@@ -386,42 +382,32 @@ export default defineComponent({ |
386 | 382 | }, |
387 | 383 |
|
388 | 384 | computed: { |
389 | | - /** |
390 | | - * Trigger types available for conditional questions |
391 | | - */ |
392 | | - triggerTypesList() { |
393 | | - return [ |
394 | | - { |
395 | | - type: 'multiple_unique', |
396 | | - label: t('forms', 'Radio buttons'), |
397 | | - icon: IconRadioboxMarked, |
398 | | - }, |
| 385 | + triggerTypeGroups() { |
| 386 | + const groups = [ |
399 | 387 | { |
400 | | - type: 'dropdown', |
401 | | - label: t('forms', 'Dropdown'), |
402 | | - icon: IconArrowDownDropCircleOutline, |
| 388 | + label: t('forms', 'Choice'), |
| 389 | + types: ['multiple_unique', 'multiple', 'dropdown'], |
403 | 390 | }, |
404 | 391 | { |
405 | | - type: 'multiple', |
406 | | - label: t('forms', 'Checkboxes'), |
407 | | - icon: IconCheckboxOutline, |
| 392 | + label: t('forms', 'Text'), |
| 393 | + types: ['short', 'long'], |
408 | 394 | }, |
409 | 395 | { |
410 | | - type: 'short', |
411 | | - label: t('forms', 'Short answer'), |
412 | | - icon: IconTextShort, |
| 396 | + label: t('forms', 'Date and time'), |
| 397 | + types: ['date', 'time'], |
413 | 398 | }, |
414 | | - { type: 'long', label: t('forms', 'Long text'), icon: IconTextLong }, |
415 | 399 | { |
416 | | - type: 'linearscale', |
417 | | - label: t('forms', 'Linear scale'), |
418 | | - icon: IconLinearScale, |
| 400 | + label: t('forms', 'Other'), |
| 401 | + types: ['linearscale', 'color', 'file'], |
419 | 402 | }, |
420 | | - { type: 'date', label: t('forms', 'Date'), icon: IconCalendar }, |
421 | | - { type: 'time', label: t('forms', 'Time'), icon: IconClockOutline }, |
422 | | - { type: 'color', label: t('forms', 'Color'), icon: IconPalette }, |
423 | | - { type: 'file', label: t('forms', 'File'), icon: IconFile }, |
424 | 403 | ] |
| 404 | +
|
| 405 | + return groups.map((group) => ({ |
| 406 | + ...group, |
| 407 | + types: group.types.map((type) => |
| 408 | + this.subQuestionTypesList.find((item) => item.type === type), |
| 409 | + ), |
| 410 | + })) |
425 | 411 | }, |
426 | 412 |
|
427 | 413 | /** |
@@ -472,7 +458,9 @@ export default defineComponent({ |
472 | 458 | }, |
473 | 459 |
|
474 | 460 | currentTriggerConfig() { |
475 | | - return this.triggerTypesList.find((t) => t.type === this.triggerType) |
| 461 | + return this.triggerTypeGroups |
| 462 | + .flatMap((group) => group.types) |
| 463 | + .find((type) => type.type === this.triggerType) |
476 | 464 | }, |
477 | 465 |
|
478 | 466 | currentTriggerIcon() { |
@@ -1179,6 +1167,18 @@ export default defineComponent({ |
1179 | 1167 | } |
1180 | 1168 |
|
1181 | 1169 | &__options { |
| 1170 | + display: flex; |
| 1171 | + flex-direction: column; |
| 1172 | + gap: 12px; |
| 1173 | + } |
| 1174 | +
|
| 1175 | + &__group-label { |
| 1176 | + margin-bottom: 4px; |
| 1177 | + color: var(--color-text-maxcontrast); |
| 1178 | + font-size: 0.9em; |
| 1179 | + } |
| 1180 | +
|
| 1181 | + &__group-options { |
1182 | 1182 | display: flex; |
1183 | 1183 | flex-wrap: wrap; |
1184 | 1184 | gap: 8px; |
|
0 commit comments