Skip to content

Commit 370925c

Browse files
authored
Merge pull request #137 from workfloworchestrator/const-schema-field-set-disabled
Add schemaField const to set disabled attribute
2 parents ec845bf + 32428b1 commit 370925c

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pydantic-forms': patch
3+
---
4+
5+
Add schemaField const to set disabled attribute

frontend/packages/pydantic-forms/src/core/helper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ export const getFieldAttributes = function (
313313
attributes.disabled = true;
314314
}
315315

316+
if (schemaField.const) {
317+
attributes.disabled = true;
318+
}
319+
316320
if (schemaField.uniforms?.sensitive) {
317321
attributes.sensitive = true;
318322
}

frontend/packages/pydantic-forms/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ export interface PydanticFormPropertySchemaParsed
426426

427427
default?: string | null;
428428
format: PydanticFormFieldFormat;
429+
const?: number | string | boolean | null;
429430

430431
uniforms?: UniformProperties;
431432

0 commit comments

Comments
 (0)