mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
fix(Table): handle dot nation with by prop (#2413)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -290,12 +290,16 @@ export default defineComponent({
|
||||
|
||||
function compare (a: any, z: any) {
|
||||
if (typeof props.by === 'string') {
|
||||
const property = props.by as unknown as any
|
||||
return a?.[property] === z?.[property]
|
||||
const accesorFn = accessor(props.by)
|
||||
return accesorFn(a) === accesorFn(z)
|
||||
}
|
||||
return props.by(a, z)
|
||||
}
|
||||
|
||||
function accessor <T extends Record<string, any>> (key: string) {
|
||||
return (obj: T) => get(obj, key)
|
||||
}
|
||||
|
||||
function isSelected (row: TableRow) {
|
||||
if (!props.modelValue) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user