fix integer handling as field type

This commit is contained in:
Ruben Fiszel
2023-03-28 17:36:21 +02:00
parent 806e2dc817
commit 928e459228
4 changed files with 7 additions and 1 deletions
@@ -58,6 +58,9 @@ fn parse_go_typ(typ: &parser_go_ast::Expr) -> (Option<String>, Typ) {
Some((*name).to_string()),
match *name {
"int" => Typ::Int,
"int16" => Typ::Int,
"int32" => Typ::Int,
"int64" => Typ::Int,
"string" => Typ::Str(None),
"bool" => Typ::Bool,
_ => Typ::Unknown,
@@ -28,7 +28,7 @@
</script>
{#if componentInput?.type === 'static'}
{#if fieldType === 'number'}
{#if fieldType === 'number' || fieldType === 'integer'}
<input on:keydown|stopPropagation type="number" bind:value={componentInput.value} />
{:else if fieldType === 'textarea'}
<textarea on:keydown|stopPropagation bind:value={componentInput.value} />
@@ -2,6 +2,7 @@ import type { ReadFileAs } from '../common/fileInput/model'
import type { InlineScript } from './types'
export type InputType =
| 'integer'
| 'text'
| 'textarea'
| 'template'
@@ -132,6 +132,8 @@ export function fieldTypeToTsType(inputType: InputType): string {
switch (inputType) {
case 'number':
return 'number'
case 'integer':
return 'number'
case 'boolean':
return 'boolean'
case 'object':