<commit_before>import * as React from 'react';
import { Grid, Row, Col } from 'react-bootstrap';
import { Observable } from 'rxjs';
import { Pagination, PaginationProps, Sizes, SelectCallback, DropdownButton, DropdownButtonProps, MenuItem } from 'react-bootstrap';

import { BaseView, BaseViewProps } from '../../React';
import { PagerViewModel, StandardLimits } from './PagerViewModel';

// clone of react-bootstrap PaginationProps, but without the subclassing
export type BootstrapPaginationProps = Omit<PaginationProps, React.HTMLProps<Pagination>>;

export interface PagerProps extends BootstrapPaginationProps {
  info?: boolean;
  limits?: number[];
  dropdownProps?: DropdownButtonProps;
  order?: PagerComponentTypes[];
  emptyInfo?: string;
}

export interface PagerViewProps extends BaseViewProps<PagerViewModel>, PagerProps {
}

export type PagerComponentTypes = 'info' | 'controls' | 'limit' | undefined;
export const StandardPagerComponentOrder: PagerComponentTypes[] = [ 'info', 'controls', 'limit' ];

const ComponentLocations = [ 'left', 'center', 'right' ];

export class PagerView extends BaseView<PagerViewProps, PagerViewModel> {
  public static displayName = 'PagerView';

  static defaultProps = {
    first: true,
    prev: true,
    next: true,
    last: true,
    boundaryLinks: true,
    maxButtons: 3,
    info: true,
    limits: StandardLimits,
    order: StandardPagerComponentOrder,
    emptyInfo: 'No Items to Display',
  };

  private readonly renderFunctions: { [ type: string ]: Function } = {
    info: this.renderInfo,
    controls: this.renderControls,
    limit: this.renderLimit,
  };

  updateOn(viewModel: Readonly<PagerViewModel>) {
    return [
      viewModel.itemCount.changed,
      viewModel.limit.changed,
      viewModel.offset.changed,
      viewModel.pageCount.changed,
      viewModel.selectedPage.changed,
    ];
  }

  render() {
    const { className, props, rest } = this.restProps(x => {
      const { info, limits, dropdownProps, order, emptyInfo } = x;
      return { info, limits, dropdownProps, order, emptyInfo };
    });

    const pagerProps = Object.rest(rest, x => {
      const { activePage, boundaryLinks, bsSize, bsStyle, bsClass, buttonComponentClass, ellipsis, first, items, last, maxButtons, next, onSelect, prev } = x;
      return { activePage, boundaryLinks, bsSize, bsStyle, bsClass, buttonComponentClass, ellipsis, first, items, last, maxButtons, next, onSelect, prev };
    });

    return this.wxr.renderConditional(
      this.shouldRenderPager(),
      () => (
        <div { ...pagerProps.rest } className={ this.wxr.classNames('Pager', className) }><commit_msg>removing bsClass from Pager props extraction does not exist on PaginationProps<commit_after>import * as React from 'react';
import { Grid, Row, Col } from 'react-bootstrap';
import { Observable } from 'rxjs';
import { Pagination, PaginationProps, Sizes, SelectCallback, DropdownButton, DropdownButtonProps, MenuItem } from 'react-bootstrap';

import { BaseView, BaseViewProps } from '../../React';
import { PagerViewModel, StandardLimits } from './PagerViewModel';

// clone of react-bootstrap PaginationProps, but without the subclassing
export type BootstrapPaginationProps = Omit<PaginationProps, React.HTMLProps<Pagination>>;

export interface PagerProps extends BootstrapPaginationProps {
  info?: boolean;
  limits?: number[];
  dropdownProps?: DropdownButtonProps;
  order?: PagerComponentTypes[];
  emptyInfo?: string;
}

export interface PagerViewProps extends BaseViewProps<PagerViewModel>, PagerProps {
}

export type PagerComponentTypes = 'info' | 'controls' | 'limit' | undefined;
export const StandardPagerComponentOrder: PagerComponentTypes[] = [ 'info', 'controls', 'limit' ];

const ComponentLocations = [ 'left', 'center', 'right' ];

export class PagerView extends BaseView<PagerViewProps, PagerViewModel> {
  public static displayName = 'PagerView';

  static defaultProps = {
    first: true,
    prev: true,
    next: true,
    last: true,
    boundaryLinks: true,
    maxButtons: 3,
    info: true,
    limits: StandardLimits,
    order: StandardPagerComponentOrder,
    emptyInfo: 'No Items to Display',
  };

  private readonly renderFunctions: { [ type: string ]: Function } = {
    info: this.renderInfo,
    controls: this.renderControls,
    limit: this.renderLimit,
  };

  updateOn(viewModel: Readonly<PagerViewModel>) {
    return [
      viewModel.itemCount.changed,
      viewModel.limit.changed,
      viewModel.offset.changed,
      viewModel.pageCount.changed,
      viewModel.selectedPage.changed,
    ];
  }

  render() {
    const { className, props, rest } = this.restProps(x => {
      const { info, limits, dropdownProps, order, emptyInfo } = x;
      return { info, limits, dropdownProps, order, emptyInfo };
    });

    const pagerProps = Object.rest(rest, x => {
      const { activePage, boundaryLinks, bsSize, bsStyle, buttonComponentClass, ellipsis, first, items, last, maxButtons, next, onSelect, prev } = x;
      return { activePage, boundaryLinks, bsSize, bsStyle, buttonComponentClass, ellipsis, first, items, last, maxButtons, next, onSelect, prev };
    });

    return this.wxr.renderConditional(
      this.shouldRenderPager(),
      () => (
        <div { ...pagerProps.rest } className={ this.wxr.classNames('Pager', className) }>
{'fraction_non_alphanumeric': 0.1162136832239925, 'fraction_numerical': 0.00037488284910965324, 'mean_word_length': 4.236506378802748, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '400520', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1538, 'n_words': 418}