mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 09:38:29 +02:00
Even better
This commit is contained in:
@@ -58,7 +58,9 @@ export function DynamicForm<T extends Record<string, string | boolean>>({
|
|||||||
key={i + stateKey}
|
key={i + stateKey}
|
||||||
arg={a}
|
arg={a}
|
||||||
onChange={(v) => setDataAttr(a.name, v)}
|
onChange={(v) => setDataAttr(a.name, v)}
|
||||||
value={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG}
|
value={
|
||||||
|
data[a.name] ? String(data[a.name]) : (a.defaultValue ?? DYNAMIC_FORM_NULL_ARG)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'text':
|
case 'text':
|
||||||
@@ -70,7 +72,7 @@ export function DynamicForm<T extends Record<string, string | boolean>>({
|
|||||||
useTemplating={useTemplating || false}
|
useTemplating={useTemplating || false}
|
||||||
autocompleteVariables={autocompleteVariables || false}
|
autocompleteVariables={autocompleteVariables || false}
|
||||||
onChange={(v) => setDataAttr(a.name, v)}
|
onChange={(v) => setDataAttr(a.name, v)}
|
||||||
value={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG}
|
value={data[a.name] ? String(data[a.name]) : (a.defaultValue ?? '')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'editor':
|
case 'editor':
|
||||||
@@ -82,7 +84,7 @@ export function DynamicForm<T extends Record<string, string | boolean>>({
|
|||||||
useTemplating={useTemplating || false}
|
useTemplating={useTemplating || false}
|
||||||
autocompleteVariables={autocompleteVariables || false}
|
autocompleteVariables={autocompleteVariables || false}
|
||||||
onChange={(v) => setDataAttr(a.name, v)}
|
onChange={(v) => setDataAttr(a.name, v)}
|
||||||
value={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG}
|
value={data[a.name] ? String(data[a.name]) : (a.defaultValue ?? '')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
@@ -100,7 +102,7 @@ export function DynamicForm<T extends Record<string, string | boolean>>({
|
|||||||
key={i + stateKey}
|
key={i + stateKey}
|
||||||
arg={a}
|
arg={a}
|
||||||
onChange={(v) => setDataAttr(a.name, v)}
|
onChange={(v) => setDataAttr(a.name, v)}
|
||||||
value={data[a.name] ? String(data[a.name]) : '__ERROR__'}
|
value={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'file':
|
case 'file':
|
||||||
@@ -109,7 +111,7 @@ export function DynamicForm<T extends Record<string, string | boolean>>({
|
|||||||
key={i + stateKey}
|
key={i + stateKey}
|
||||||
arg={a}
|
arg={a}
|
||||||
onChange={(v) => setDataAttr(a.name, v)}
|
onChange={(v) => setDataAttr(a.name, v)}
|
||||||
filePath={data[a.name] ? String(data[a.name]) : '__ERROR__'}
|
filePath={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -233,7 +235,7 @@ function SelectArg({
|
|||||||
options={[
|
options={[
|
||||||
...arg.options.map((a) => ({
|
...arg.options.map((a) => ({
|
||||||
label: a.name,
|
label: a.name,
|
||||||
value: a.value === arg.defaultValue ? DYNAMIC_FORM_NULL_ARG : a.value,
|
value: a.value,
|
||||||
})),
|
})),
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user