/** * @file Santd pagination options file **/ import Base from 'santd/base'; import Select from '../select'; import KEYCODE from '../core/util/keyCode'; import { OptionsState as State, OptionsProps as Props } from './interface'; function isValueNotNaN(value: any): value is number { return !isNaN(value); } export default class Options extends Base { static components = { 's-select': Select, 's-option': Select.Option } handleChangeSize(value: string) { this.fire('changeSize', Number(value)); } handleChange(e: InputEvent) { this.data.set('goInputText', (e.target as HTMLInputElement).value); } handleGo(e: any) { const val = this.data.get('goInputText'); if (val === '') { return; } let newVal = isValueNotNaN(val) ? Number(val) : this.data.get('current'); if (e.keyCode === KEYCODE.ENTER || e.type === 'click') { this.data.set('goInputText', ''); this.fire('quickGo', newVal); } } static template = `
  • {{pageSize}} {{locale.items_per_page}}
    {{locale.jump_to}} {{locale.page}} {{goButton}}
  • ` }; export type TOptions = typeof Options;