globalbrain / sefirot

Global Brain Design System.
https://sefirot.globalbrains.com
MIT License
151 stars 12 forks source link

[Table] Add disable select option #496

Closed kiaking closed 4 months ago

kiaking commented 4 months ago

I need a way to disable selecting rows on <STable>. Not sure how the API should be but maybe add option to Table?

interface Table<
  O extends string = string,
  R extends Record<string, any> = any,
  SR extends Record<string, any> = any
> {
  ...
  isRowSelectable?(record: R): boolean
  ...
}

const table = useTable({
  ...
  // For example, enable bulk selection only for rows
  // with the post that is deletable.
  isRowSelectable(post) {
    return post.isDeletable
  }
})