Skip to content

Commit

Permalink
Fix BasicEntityRadioGroupField
Browse files Browse the repository at this point in the history
  • Loading branch information
zackatbrightbeam committed Aug 12, 2024
1 parent 814ed03 commit cea0703
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 150 deletions.
5 changes: 0 additions & 5 deletions dist/BasicEntityRadioGroupField.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
declare function BasicEntityRadioGroupField(props: any): import("react/jsx-runtime").JSX.Element;
export declare function resolveCategories(cat: any): {
title: any;
key: string;
}[];
export declare function resolveDefault(cat: any): any;
export { BasicEntityRadioGroupField };
112 changes: 50 additions & 62 deletions dist/voxgig-model-react.es.js

Large diffs are not rendered by default.

112 changes: 50 additions & 62 deletions dist/voxgig-model-react.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lib/BasicEntityAutocompleteField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function BasicEntityAutocompleteField (props: any) {
const { control, field, errors, getValues, setValue } =
basicEntityAutocompleteField

console.log('BERF', 'multiple', field.cat.multiple)
// console.log('BERF', 'multiple', field.cat.multiple)

const defaultAlternative = field.cat.multiple === 1 ? {} : []
const defaultValues =
Expand Down
15 changes: 0 additions & 15 deletions src/lib/BasicEntityRadioGroupField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ function BasicEntityRadioGroupField (props: any) {

const defaultValues = getValues(`${field.name}_default$`) || ''
const categories = getValues(`${field.name}_cat$`) || []

console.log('BERF', 'default', defaultValues)

const err = errors[field.name]

const {
Expand Down Expand Up @@ -86,16 +83,4 @@ function BasicEntityRadioGroupField (props: any) {
)
}

export function resolveCategories (cat: any) {
return Object.keys(cat.item).map((key) => ({
title: cat.item?.[key]?.title,
key: key,
}))
}

export function resolveDefault (cat: any) {
const { default: defaultValues } = cat
return defaultValues
}

export { BasicEntityRadioGroupField }
7 changes: 2 additions & 5 deletions src/lib/VxgBasicEntityEditPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,11 @@ function VxgBasicEntityEditPlugin (this: any, options: any) {
item[field.name + '_uival$'] = resvalue(
item[field.name],
field.cat,
(val: string, item: { title: string }) => ({
key: val,
title: item.title,
})
(val: string) => val
)
}

// console.log('modify_edit_Autocomplete', item)
// console.log('modify_edit_RadioGroup', item)

return item
}
Expand Down

0 comments on commit cea0703

Please sign in to comment.