@@ -80,12 +80,14 @@ import IconCheckboxBlankOutline from 'vue-material-design-icons/CheckboxBlankOut
8080import IconDelete from ' vue-material-design-icons/TrashCanOutline.vue'
8181import IconDragIndicator from ' ../Icons/IconDragIndicator.vue'
8282import IconRadioboxBlank from ' vue-material-design-icons/RadioboxBlank.vue'
83+ import IconTableColumn from ' vue-material-design-icons/TableColumn.vue'
84+ import IconTableRow from ' vue-material-design-icons/TableRow.vue'
8385
8486import NcActions from ' @nextcloud/vue/components/NcActions'
8587import NcActionButton from ' @nextcloud/vue/components/NcActionButton'
8688import NcButton from ' @nextcloud/vue/components/NcButton'
8789
88- import { INPUT_DEBOUNCE_MS } from ' ../../models/Constants.ts'
90+ import { INPUT_DEBOUNCE_MS , OptionType } from ' ../../models/Constants.ts'
8991import OcsResponse2Data from ' ../../utils/OcsResponse2Data.js'
9092import logger from ' ../../utils/Logger.js'
9193
@@ -99,6 +101,8 @@ export default {
99101 IconDelete,
100102 IconDragIndicator,
101103 IconRadioboxBlank,
104+ IconTableColumn,
105+ IconTableRow,
102106 NcActions,
103107 NcActionButton,
104108 NcButton,
@@ -133,6 +137,10 @@ export default {
133137 type: Number ,
134138 required: true ,
135139 },
140+ optionType: {
141+ type: String ,
142+ required: true ,
143+ }
136144 },
137145
138146 data () {
@@ -154,7 +162,7 @@ export default {
154162 },
155163
156164 optionDragMenuId () {
157- return ` q${ this .answer .questionId } o${ this .answer .id } __drag_menu`
165+ return ` q${ this .answer .questionId } o${ this .answer .id } o ${ this . optionType } __drag_menu`
158166 },
159167
160168 placeholder () {
@@ -165,6 +173,14 @@ export default {
165173 },
166174
167175 pseudoIcon () {
176+ if (this .optionType === OptionType .Column ) {
177+ return IconTableColumn;
178+ }
179+
180+ if (this .optionType === OptionType .Row ) {
181+ return IconTableRow;
182+ }
183+
168184 return this .isUnique ? IconRadioboxBlank : IconCheckboxBlankOutline
169185 },
170186 },
@@ -180,7 +196,7 @@ export default {
180196
181197 methods: {
182198 handleTabbing () {
183- this .$emit (' tabbed-out' )
199+ this .$emit (' tabbed-out' , this . optionType )
184200 },
185201
186202 /**
@@ -227,7 +243,7 @@ export default {
227243 */
228244 focusNextInput () {
229245 if (this .index <= this .maxIndex ) {
230- this .$emit (' focus-next' , this .index )
246+ this .$emit (' focus-next' , this .index , this . optionType )
231247 }
232248 },
233249
@@ -251,7 +267,7 @@ export default {
251267
252268 // do this in queue to prevent race conditions between PATCH and DELETE
253269 this .queue .add (() => {
254- this .$emit (' delete' , this .answer . id )
270+ this .$emit (' delete' , this .answer )
255271 // Prevent any patch requests
256272 this .queue .pause ()
257273 this .queue .clear ()
@@ -265,6 +281,8 @@ export default {
265281 * @return {object} answer
266282 */
267283 async createAnswer (answer ) {
284+ console .log (' debug: createAnswer' , {optionType: this .optionType })
285+
268286 try {
269287 const response = await axios .post (
270288 generateOcsUrl (
@@ -276,6 +294,7 @@ export default {
276294 ),
277295 {
278296 optionTexts: [answer .text ],
297+ optionType: answer .optionType ,
279298 },
280299 )
281300 logger .debug (' Created answer' , { answer })
@@ -325,15 +344,15 @@ export default {
325344 * Reorder option but keep focus on the button
326345 */
327346 onMoveDown () {
328- this .$emit (' move-down' )
347+ this .$emit (' move-down' , this . optionType )
329348 this .focusButton (
330349 this .index < this .maxIndex - 1
331350 ? ' buttonOptionDown'
332351 : ' buttonOptionUp' ,
333352 )
334353 },
335354 onMoveUp () {
336- this .$emit (' move-up' )
355+ this .$emit (' move-up' , this . optionType )
337356 this .focusButton (this .index > 1 ? ' buttonOptionUp' : ' buttonOptionDown' )
338357 },
339358 focusButton (refName ) {
0 commit comments