Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Dec 10, 2024
1 parent 96c3daa commit 49a4e86
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 186 deletions.
4 changes: 0 additions & 4 deletions docs/examples/jumper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const App = () => (
<>
<h3>默认</h3>
<PaginationWithSizeChanger
// selectComponentClass={Select}
showQuickJumper
showSizeChanger
defaultPageSize={20}
Expand All @@ -29,7 +28,6 @@ const App = () => (
/>
<h3>禁用</h3>
<PaginationWithSizeChanger
// selectComponentClass={Select}
showQuickJumper
showSizeChanger
defaultPageSize={20}
Expand All @@ -41,7 +39,6 @@ const App = () => (
/>
<h3>单页默认隐藏</h3>
<PaginationWithSizeChanger
// selectComponentClass={Select}
showQuickJumper
showSizeChanger
onShowSizeChange={onShowSizeChange}
Expand All @@ -50,7 +47,6 @@ const App = () => (
/>
<br />
<PaginationWithSizeChanger
// selectComponentClass={Select}
showQuickJumper
showSizeChanger
onShowSizeChange={onShowSizeChange}
Expand Down
1 change: 0 additions & 1 deletion docs/examples/jumperWithGoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class App extends React.Component {
<>
<p> customize node </p>
<PaginationWithSizeChanger
// selectComponentClass={Select}
showSizeChanger
showQuickJumper={{ goButton: <button type="button">确定</button> }}
defaultPageSize={20}
Expand Down
1 change: 0 additions & 1 deletion docs/examples/locale.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function onChange(current, pageSize) {

const App = () => (
<PaginationWithSizeChanger
// selectComponentClass={Select}
showQuickJumper
showSizeChanger
defaultPageSize={20}
Expand Down
3 changes: 0 additions & 3 deletions docs/examples/showSizeChanger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@ export default () => {
<PaginationWithSizeChanger
defaultCurrent={1}
total={50}
// selectComponentClass={Select}
showSizeChanger={false}
/>
<PaginationWithSizeChanger
defaultCurrent={1}
total={50}
// selectComponentClass={Select}
showSizeChanger
/>
<PaginationWithSizeChanger
defaultCurrent={1}
showSizeChanger
// selectComponentClass={Select}
sizeChangerProps={{
options: [
{ value: 10, label: '10 条每页' },
Expand Down
2 changes: 0 additions & 2 deletions docs/examples/simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default () => {
defaultCurrent={1}
total={50}
showSizeChanger
// selectComponentClass={Select}
/>
<hr />
<a href="https://github.com/ant-design/ant-design/issues/46671">
Expand All @@ -49,7 +48,6 @@ export default () => {
total={50}
showSizeChanger
showQuickJumper
// selectComponentClass={Select}
/>
</>
);
Expand Down
4 changes: 0 additions & 4 deletions docs/examples/sizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,25 @@ class App extends React.Component {
return (
<div style={{ margin: 10 }}>
<PaginationWithSizeChanger
// selectComponentClass={Select}
showSizeChanger
pageSize={pageSize}
onShowSizeChange={this.onShowSizeChange}
defaultCurrent={3}
total={40}
/>
<PaginationWithSizeChanger
// selectComponentClass={Select}
pageSize={pageSize}
onShowSizeChange={this.onShowSizeChange}
defaultCurrent={3}
total={50}
/>
<PaginationWithSizeChanger
// selectComponentClass={Select}
pageSize={pageSize}
onShowSizeChange={this.onShowSizeChange}
defaultCurrent={3}
total={60}
/>
<PaginationWithSizeChanger
// selectComponentClass={Select}
showSizeChanger={false}
pageSize={pageSize}
onShowSizeChange={this.onShowSizeChange}
Expand Down
4 changes: 0 additions & 4 deletions docs/examples/utils/commonUtil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ export const getSizeChangerRender = (selectProps?: any) => {
}) => (
<Select
disabled={disabled}
// prefixCls={selectPrefixCls}
showSearch={false}
// optionLabelProp={showSizeChangerOptions ? 'label' : 'children'}
// popupMatchSelectWidth={false}
dropdownMatchSelectWidth={false}
value={pageSize || options[0].value}
getPopupContainer={(triggerNode) => triggerNode.parentNode}
aria-label={ariaLabel}
defaultOpen={false}
// {...(typeof showSizeChanger === 'object' ? showSizeChanger : null)}
className={className}
options={options}
onChange={onSizeChange}
Expand Down
64 changes: 0 additions & 64 deletions src/Options.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
// import type { SelectProps } from 'rc-select';
// import type { OptionProps } from 'rc-select/es/Option';
import KEYCODE from 'rc-util/lib/KeyCode';
// import classNames from 'classnames';
import React from 'react';
import type { PaginationLocale } from './interface';

// interface InternalSelectProps extends SelectProps {
// /**
// * form antd v5.5.0, popupMatchSelectWidth default is true
// */
// popupMatchSelectWidth?: boolean;
// }

export type SizeChangerRender = (info: {
disabled: boolean;
size: number;
Expand All @@ -35,10 +25,6 @@ interface OptionsProps {
changeSize?: (size: number) => void;
quickGo?: (value: number) => void;
buildOptionText?: (value: number | string) => string;
// selectComponentClass: React.ComponentType<Partial<InternalSelectProps>> & {
// Option?: React.ComponentType<Partial<OptionProps>>;
// };
// showSizeChanger: PaginationProps['showSizeChanger'];
showSizeChanger: boolean;
sizeChangerRender?: SizeChangerRender;
}
Expand All @@ -54,8 +40,6 @@ const Options: React.FC<OptionsProps> = (props) => {
goButton,
quickGo,
rootPrefixCls,
// selectComponentClass,
// selectPrefixCls,
disabled,
buildOptionText,
showSizeChanger,
Expand All @@ -75,13 +59,6 @@ const Options: React.FC<OptionsProps> = (props) => {
? buildOptionText
: (value: string | number) => `${value} ${locale.items_per_page}`;

// const changeSizeHandle = (value: number, option) => {
// changeSize?.(Number(value));
// if (typeof showSizeChanger === 'object') {
// showSizeChanger.onChange?.(value, option);
// }
// };

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setGoInputText(e.target.value);
};
Expand Down Expand Up @@ -155,47 +132,6 @@ const Options: React.FC<OptionsProps> = (props) => {
});
}

// if (showSizeChanger && Select) {
// const {
// options: showSizeChangerOptions,
// className: showSizeChangerClassName,
// } =
// typeof showSizeChanger === 'object'
// ? showSizeChanger
// : ({} as SelectProps);
// // use showSizeChanger.options if existed, otherwise use pageSizeOptions
// const options = showSizeChangerOptions
// ? undefined
// : getPageSizeOptions().map((opt, i) => (
// <Select.Option key={i} value={opt.toString()}>
// {mergeBuildOptionText(opt)}
// </Select.Option>
// ));

// changeSelect = (
// <Select
// disabled={disabled}
// prefixCls={selectPrefixCls}
// showSearch={false}
// optionLabelProp={showSizeChangerOptions ? 'label' : 'children'}
// popupMatchSelectWidth={false}
// value={(pageSize || pageSizeOptions[0]).toString()}
// getPopupContainer={(triggerNode) => triggerNode.parentNode}
// aria-label={locale.page_size}
// defaultOpen={false}
// {...(typeof showSizeChanger === 'object' ? showSizeChanger : null)}
// className={classNames(
// `${prefixCls}-size-changer`,
// showSizeChangerClassName,
// )}
// options={showSizeChangerOptions}
// onChange={changeSizeHandle}
// >
// {options}
// </Select>
// );
// }

// >>>>> Quick Go
if (quickGo) {
if (goButton) {
Expand Down
2 changes: 0 additions & 2 deletions src/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const Pagination: React.FC<PaginationProps> = (props) => {
prefixCls = 'rc-pagination',
selectPrefixCls = 'rc-select',
className,
// selectComponentClass,

// control
current: currentProp,
Expand Down Expand Up @@ -583,7 +582,6 @@ const Pagination: React.FC<PaginationProps> = (props) => {
locale={locale}
rootPrefixCls={prefixCls}
disabled={disabled}
// selectComponentClass={selectComponentClass}
selectPrefixCls={selectPrefixCls}
changeSize={changePageSize}
pageSize={pageSize}
Expand Down
2 changes: 0 additions & 2 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export interface PaginationData {
className: string;
selectPrefixCls: string;
prefixCls: string;
// pageSizeOptions: string[] | number[];
pageSizeOptions: number[];

current: number;
Expand All @@ -47,7 +46,6 @@ export interface PaginationData {

style: React.CSSProperties;

// selectComponentClass: React.ComponentType;
prevIcon: React.ComponentType | React.ReactNode;
nextIcon: React.ComponentType | React.ReactNode;
jumpPrevIcon: React.ComponentType | React.ReactNode;
Expand Down
2 changes: 0 additions & 2 deletions tests/options.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render } from '@testing-library/react';
// import Select from 'rc-select';
import zhCN from '../src/locale/zh_CN';
import Options from '../src/Options';
import * as React from 'react';
Expand All @@ -9,7 +8,6 @@ const WrapperOptions: React.FC<any> = (props) => (
<Options
locale={zhCN}
rootPrefixCls="rc-pagination"
// selectComponentClass={Select}
sizeChangerRender={sizeChangerRender}
pageSize={10}
changeSize={jest.fn()}
Expand Down
2 changes: 0 additions & 2 deletions tests/simple.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ describe('simple Pagination', () => {
total={500}
pageSize={15}
showSizeChanger
// selectComponentClass={Select}
sizeChangerRender={sizeChangerRender}
/>,
);
Expand All @@ -119,7 +118,6 @@ describe('simple Pagination', () => {
const { container, getByRole } = render(
<Pagination
simple
// selectComponentClass={Select}
sizeChangerRender={sizeChangerRender}
onChange={onChange}
total={500}
Expand Down
Loading

0 comments on commit 49a4e86

Please sign in to comment.