Skip to content

Commit e9db59f

Browse files
authored
Create CustomOption.JS
1 parent 8676923 commit e9db59f

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as React from 'react';
2+
import { PrimeReactContext, localeOption } from '../api/Api';
3+
import { ariaLabel } from '../api/Locale';
4+
5+
import { useMergeProps } from '../hooks/Hooks';
6+
import { ObjectUtils } from '../utils/Utils';
7+
import { RowsPerPageDropdownBase } from './PaginatorBase';
8+
9+
export const CustomOption = React.memo((inProps) => {
10+
const mergeProps = useMergeProps();
11+
const context = React.useContext(PrimeReactContext);
12+
const props = RowsPerPageDropdownBase.getProps(inProps, context);
13+
14+
const value = props.totalPages > 0 ? props.page + 1 : 0;
15+
const element = null;
16+
17+
if (props.template) {
18+
const defaultOptions = {
19+
value,
20+
//onChange: onChange,
21+
disabled: props.disabled,
22+
className: 'p-paginator-page-input',
23+
24+
element,
25+
props
26+
};
27+
28+
return ObjectUtils.getJSXElement(props.template, defaultOptions);
29+
}
30+
31+
return element;
32+
});
33+
34+
CustomOption.displayName = 'CustomOption';

0 commit comments

Comments
 (0)