@@ -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,8 @@ 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 )
271+ console .log (' emit delete' , this .answer )
255272 // Prevent any patch requests
256273 this .queue .pause ()
257274 this .queue .clear ()
@@ -265,6 +282,8 @@ export default {
265282 * @return {object} answer
266283 */
267284 async createAnswer (answer ) {
285+ console .log (' debug: createAnswer' , {optionType: this .optionType })
286+
268287 try {
269288 const response = await axios .post (
270289 generateOcsUrl (
@@ -276,6 +295,7 @@ export default {
276295 ),
277296 {
278297 optionTexts: [answer .text ],
298+ optionType: answer .optionType ,
279299 },
280300 )
281301 logger .debug (' Created answer' , { answer })
0 commit comments