Skip to content

Commit a8b9f87

Browse files
committed
fix: add showSubmit prop to form component and update button rendering logic
1 parent 131509c commit a8b9f87

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

packages/components/src/renderers/form/form.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ComponentRegistry.register('form',
3737
submitLabel = 'Submit',
3838
cancelLabel = 'Cancel',
3939
showCancel = false,
40+
showSubmit = true,
4041
layout = 'vertical',
4142
columns = 1,
4243
onSubmit: onSubmitProp,
@@ -309,13 +310,15 @@ ComponentRegistry.register('form',
309310
{cancelLabel}
310311
</Button>
311312
)}
313+
{showSubmit && (
312314
<Button
313315
type="submit"
314316
disabled={isSubmitting || disabled}
315317
>
316318
{isSubmitting && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
317319
{submitLabel}
318320
</Button>
321+
)}
319322
</div>
320323
)}
321324
</form>

packages/fields/src/widgets/TextField.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TextareaFieldMetadata } from '@object-ui/types';
44
import { FieldWidgetProps } from './types';
55

66
export function TextField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<string>) {
7+
console.log('TextField props disabled:', (props as any).disabled, 'readonly:', readonly, 'field:', field ? 'yes' : 'no');
78
const fieldData = field || (props as any).schema;
89

910
if (readonly) {

packages/plugin-form/src/ObjectForm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ export const ObjectForm: React.FC<ObjectFormProps> = ({
169169
generatedFields.push(customField);
170170
} else {
171171
// Auto-generate field from schema
172+
const mappedType = mapFieldTypeToFormType(field.type);
173+
if (fieldName === 'name') { console.log('DEBUG: Name field mapped to:', mappedType); }
172174
const formField: FormField = {
173175
name: fieldName,
174176
label: field.label || fieldName,
175-
type: mapFieldTypeToFormType(field.type),
177+
type: mappedType,
176178
required: field.required || false,
177179
disabled: schema.readOnly || schema.mode === 'view' || field.readonly,
178180
placeholder: field.placeholder,

0 commit comments

Comments
 (0)