File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,13 @@ const quickformsFeatures = computed(() => {
4646 const valueLabel =
4747 schemaFeatures .valueLabel ?? globalDefaults .valueLabel ?? " Value" ;
4848
49+ // Type inference option (x-infer-types takes priority over defaults)
50+ const inferTypes =
51+ (props .schema as any )[" x-infer-types" ] ??
52+ schemaFeatures .inferTypes ??
53+ globalDefaults .inferTypes ??
54+ false ;
55+
4956 // Merge QBtn props: defaults -> global -> schema (schema has highest priority)
5057 const addButtonDefaults = {
5158 outline: true ,
@@ -83,6 +90,7 @@ const quickformsFeatures = computed(() => {
8390 showHeaders ,
8491 keyLabel ,
8592 valueLabel ,
93+ inferTypes ,
8694 };
8795});
8896
@@ -142,8 +150,10 @@ watch(
142150 const obj: Record <string , unknown > = {};
143151 newPairs .forEach ((pair ) => {
144152 if (pair .key .trim ()) {
145- // Infer type from string value (e.g., "1" -> 1, "true" -> true)
146- obj [pair .key ] = inferType (pair .value );
153+ // Optionally infer type from string value (e.g., "1" -> 1, "true" -> true)
154+ obj [pair .key ] = quickformsFeatures .value .inferTypes
155+ ? inferType (pair .value )
156+ : pair .value ;
147157 }
148158 });
149159 isInternalUpdate .value = true ;
Original file line number Diff line number Diff line change @@ -134,6 +134,18 @@ export interface QuickFormsQuasarKeyValueFeatures {
134134 keyLabel ?: string ;
135135 /** Custom label for the value column. Default: 'Value' */
136136 valueLabel ?: string ;
137+ /**
138+ * Automatically infer types from string values.
139+ * When enabled:
140+ * - "123" becomes 123 (number)
141+ * - "true"/"false" become booleans
142+ * - "null" becomes null
143+ * - Template expressions ({{ }}) stay as strings
144+ *
145+ * Use via x-infer-types in schema or quickformsDefaults.keyvalue.inferTypes
146+ * Default: false (values stay as strings for backwards compatibility)
147+ */
148+ inferTypes ?: boolean ;
137149}
138150
139151/**
You can’t perform that action at this time.
0 commit comments