selectAll()

in packages/rc-components/rc-table/src/selection/index.tsx [165:192]


  selectAll(checked) {
    if (checked) {
      update((selectedRowKeys, dataSource, primaryKey, rowSelection = {}) => {
        const primaryKeys = getPrimaryKeys(
          dataSource as any[],
          primaryKey as string,
          rowSelection.getProps
        )
        return uniq([...selectedRowKeys, ...primaryKeys])
      })
    } else {
      update(
        (
          selectedRowKeys: any[],
          dataSource: ITableProps['dataSource'],
          primaryKey: ITableProps['primaryKey'],
          rowSelection: ITableProps['rowSelection'] = {}
        ) => {
          const primaryKeys = getPrimaryKeys(
            dataSource as any[],
            primaryKey as string,
            rowSelection.getProps
          )
          return xor(selectedRowKeys, primaryKeys)
        }
      )
    }
  },