Skip to content

Commit

Permalink
fix password field cell components when null
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Feb 4, 2025
1 parent 0789563 commit 0327828
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions packages/core/src/fields/types/password/views/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export function Field (props: FieldProps<typeof controller>) {
}

export const Cell: CellComponent<typeof controller> = ({ value }) => {
return value.isSet
return value !== null
? (
<div aria-label="is set" style={{display:'flex'}}>
<Icon src={asteriskIcon} size="small" />
Expand Down Expand Up @@ -249,11 +249,11 @@ type Value =
confirm: string
}

type PasswordController = FieldController<Value, boolean> & { validation: Validation }

export const controller = (
export function controller (
config: FieldControllerConfig<PasswordFieldMeta>
): PasswordController => {
): FieldController<Value, boolean | null> & {
validation: Validation
} {
const validation: Validation = {
...config.fieldMeta.validation,
match:
Expand Down Expand Up @@ -288,9 +288,22 @@ export const controller = (
? undefined
: {
Filter (props) {
const { autoFocus, context, typeLabel, onChange, value, type, ...otherProps } = props
const {
autoFocus,
context,
typeLabel,
onChange,
value,
type,
...otherProps
} = props
return (
<Checkbox autoFocus={autoFocus} onChange={onChange} isSelected={value} {...otherProps}>
<Checkbox
autoFocus={autoFocus}
onChange={onChange}
isSelected={value ?? false}
{...otherProps}
>
{typeLabel} set
</Checkbox>
)
Expand Down

0 comments on commit 0327828

Please sign in to comment.