From 8b191a93b8c7b3bf85631a131d47705694f14494 Mon Sep 17 00:00:00 2001 From: Lightling Date: Tue, 4 Mar 2025 21:35:01 -0500 Subject: [PATCH] support toggle field option --- src/views/Editor/DataEditor.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/views/Editor/DataEditor.vue b/src/views/Editor/DataEditor.vue index 58e291a..2930ff8 100644 --- a/src/views/Editor/DataEditor.vue +++ b/src/views/Editor/DataEditor.vue @@ -2,6 +2,7 @@ import { computed, ref } from 'vue' import { v7 as uuidv7 } from 'uuid' import Button from 'primevue/button' +import Checkbox from 'primevue/checkbox' import DataTable from 'primevue/datatable' import Column from 'primevue/column' import Image from 'primevue/image' @@ -130,6 +131,15 @@ DataTable.data-editor( span( v-else ) No image + div( + v-else-if='col.type === "toggle"' + ) + Checkbox( + v-model='slotProps.data[col.name]' + :name='`${slotProps.data._id} ${col.name}`' + binary + disabled + ) div( v-else ) @@ -150,6 +160,14 @@ DataTable.data-editor( :disabled='!slotProps.data[col.name]' :onClick='(e) => onRemoveImage(e, slotProps)' ) + div( + v-else-if='col.type === "toggle"' + ) + Checkbox( + v-model='slotProps.data[col.name]' + :name='`toggle for ${slotProps.data.name || slotProps.data._id} ${col.name}`' + binary + ) div( v-else )