From 8f4731e08a6425699b6dc4d17831b966c24524b0 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Wed, 18 Dec 2024 12:55:24 +0100 Subject: [PATCH] query builder boolean (0/1) --- src/components/queryBuilder/Condition.vue | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/queryBuilder/Condition.vue b/src/components/queryBuilder/Condition.vue index bd685d2..3766198 100644 --- a/src/components/queryBuilder/Condition.vue +++ b/src/components/queryBuilder/Condition.vue @@ -24,15 +24,25 @@ :value="(value as any)?.start" @input="(e) => ((value as any).start = (e.target as HTMLInputElement).value)" :type="inputType" + :min="columnType == 'boolean' ? 0 : undefined" + :max="columnType == 'boolean' ? 1 : undefined" />

-

- +
@@ -79,16 +89,20 @@ export default defineComponent({ foreignColumns() { return this.activeTable?.relations.map((r) => r.column); }, + columnType() { + return this.activeTable?.columns.find((c) => c.column == this.column)?.type; + }, inputType() { - let type = this.activeTable?.columns.find((c) => c.column == this.column)?.type; if (this.operation.includes("timespan")) return "number"; - switch (type) { + switch (this.columnType) { case "int": return "number"; case "varchar": return "text"; case "date": return "date"; + case "boolean": + return "number"; // "checkbox"; default: return "text"; }