Skip to content

Commit

Permalink
fix: fix auto-gen-form required field didn't show * sign (#1193)
Browse files Browse the repository at this point in the history
Because

- fix auto-gen-form required field didn't show * sign

This commit

- fix auto-gen-form required field didn't show * sign
  • Loading branch information
EiffelFly committed Jun 3, 2024
1 parent 935bd7c commit cbd2c6a
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const BooleanField = ({
disabled,
size,
isHidden,
isRequired,
}: {
shortDescription?: string;
disabled?: boolean;
Expand All @@ -30,7 +31,7 @@ export const BooleanField = ({
<Form.Label
className={size === "sm" ? "!product-body-text-4-semibold" : ""}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const CredentialTextField = ({
disabled,
size,
isHidden,
isRequired,
}: {
shortDescription?: string;
disabled?: boolean;
Expand All @@ -33,7 +34,7 @@ export const CredentialTextField = ({
<Form.Label
className={size === "sm" ? "!product-body-text-4-semibold" : ""}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ImageField = ({
shortDescription,
disabled,
isHidden,
isRequired,
}: {
shortDescription?: string;
disabled?: boolean;
Expand All @@ -36,7 +37,7 @@ export const ImageField = ({
<Form.Label
className={size === "sm" ? "!product-body-text-4-medium" : ""}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const OneOfConditionField = ({
disabled,
size,
isHidden,
isRequired,
}: {
tree: InstillFormTree;
selectedConditionMap: Nullable<SelectedConditionMap>;
Expand Down Expand Up @@ -85,7 +86,7 @@ export const OneOfConditionField = ({
size === "sm" ? "!product-body-text-4-semibold" : ""
}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const SingleSelectField = ({
updateForceCloseCollapsibleFormGroups,
updateForceOpenCollapsibleFormGroups,
updateIsUsingInstillCredit,
isRequired,
}: {
tree: InstillFormTree;
options: string[];
Expand Down Expand Up @@ -187,7 +188,7 @@ export const SingleSelectField = ({
<Form.Label
className={size === "sm" ? "!product-body-text-4-medium" : ""}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const TextAreaField = ({
disabled,
size,
isHidden,
isRequired,
}: {
shortDescription?: string;
disabled?: boolean;
Expand All @@ -29,7 +30,7 @@ export const TextAreaField = ({
<Form.Label
className={size === "sm" ? "!product-body-text-4-semibold" : ""}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const TextField = ({
disabled,
size,
isHidden,
isRequired,
}: {
shortDescription?: string;
disabled?: boolean;
Expand All @@ -30,7 +31,7 @@ export const TextField = ({
<Form.Label
className={size === "sm" ? "!product-body-text-4-medium" : ""}
>
{title}
{isRequired ? `${title} *` : title}
</Form.Label>
<FieldDescriptionTooltip description={description} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ export function pickRegularFieldsFromInstillFormTree(
disabled={disabledAll}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
/>
);
}
Expand All @@ -305,6 +306,7 @@ export function pickRegularFieldsFromInstillFormTree(
disabled={disabledAll}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
/>
);
}
Expand All @@ -323,6 +325,7 @@ export function pickRegularFieldsFromInstillFormTree(
disabled={disabledAll}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
instillCredentialMap={tree.instillCredentialMap}
updateSupportInstillCredit={updateSupportInstillCredit}
updateIsUsingInstillCredit={updateIsUsingInstillCredit}
Expand All @@ -348,11 +351,11 @@ export function pickRegularFieldsFromInstillFormTree(
shortDescription={tree.instillShortDescription}
disabled={disabledAll}
instillAcceptFormats={tree.instillAcceptFormats ?? []}
isRequired={tree.isRequired}
instillUpstreamTypes={tree.instillUpstreamTypes ?? []}
componentID={componentID}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
secrets={secrets}
instillSecret={tree.instillSecret}
instillCredential={tree.instillCredential}
Expand All @@ -373,6 +376,7 @@ export function pickRegularFieldsFromInstillFormTree(
disabled={disabledAll}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
/>
);
}
Expand All @@ -388,11 +392,11 @@ export function pickRegularFieldsFromInstillFormTree(
shortDescription={tree.instillShortDescription}
disabled={disabledAll}
instillAcceptFormats={tree.instillAcceptFormats ?? []}
isRequired={tree.isRequired}
instillUpstreamTypes={tree.instillUpstreamTypes ?? []}
componentID={componentID}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
secrets={secrets}
instillSecret={tree.instillSecret}
instillCredential={tree.instillCredential}
Expand All @@ -413,6 +417,7 @@ export function pickRegularFieldsFromInstillFormTree(
disabled={disabledAll}
size={size}
isHidden={tree.isHidden}
isRequired={tree.isRequired}
/>
);
}
1 change: 1 addition & 0 deletions packages/toolkit/src/lib/use-instill-form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export type AutoFormFieldBaseProps = {
isHidden?: boolean;
disabled?: boolean;
keyPrefix?: string;
isRequired?: boolean;
};

export type ZodAnyValidatorSchema = z.ZodType<any, any, any>;
Expand Down

0 comments on commit cbd2c6a

Please sign in to comment.