Skip to content

Commit 43f42e1

Browse files
committed
feat: adjust onShowSizeChange
1 parent 8de5d52 commit 43f42e1

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/Pagination.jsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class Pagination extends React.Component {
133133
* @param {React.ReactNode | React.ComponentType<PaginationProps>} icon received icon.
134134
* @returns {React.ReactNode}
135135
*/
136-
getItemIcon = icon => {
136+
getItemIcon = (icon) => {
137137
const { prefixCls } = this.props;
138138
// eslint-disable-next-line jsx-a11y/anchor-has-content
139139
let iconNode = icon || <a className={`${prefixCls}-item-link`} />;
@@ -161,11 +161,11 @@ class Pagination extends React.Component {
161161
return value;
162162
}
163163

164-
savePaginationNode = node => {
164+
savePaginationNode = (node) => {
165165
this.paginationNode = node;
166166
};
167167

168-
isValid = page => isInteger(page) && page !== this.state.current;
168+
isValid = (page) => isInteger(page) && page !== this.state.current;
169169

170170
shouldDisplayQuickJumper = () => {
171171
const { showQuickJumper, pageSize, total } = this.props;
@@ -175,13 +175,13 @@ class Pagination extends React.Component {
175175
return showQuickJumper;
176176
};
177177

178-
handleKeyDown = e => {
178+
handleKeyDown = (e) => {
179179
if (e.keyCode === KEYCODE.ARROW_UP || e.keyCode === KEYCODE.ARROW_DOWN) {
180180
e.preventDefault();
181181
}
182182
};
183183

184-
handleKeyUp = e => {
184+
handleKeyUp = (e) => {
185185
const value = this.getValidValue(e);
186186
const { currentInputValue } = this.state;
187187
if (value !== currentInputValue) {
@@ -198,7 +198,7 @@ class Pagination extends React.Component {
198198
}
199199
};
200200

201-
changePageSize = size => {
201+
changePageSize = (size) => {
202202
let { current } = this.state;
203203
const newCurrent = calculatePage(size, this.state, this.props);
204204
current = current > newCurrent ? newCurrent : current;
@@ -223,14 +223,14 @@ class Pagination extends React.Component {
223223
}
224224
}
225225

226-
if ('onChange' in this.props) {
227-
this.props.onChange(current, size)
226+
if ('onChange' in this.props && this.props.onChange) {
227+
this.props.onChange(current, size);
228228
}
229229

230230
this.props.onShowSizeChange(current, size);
231231
};
232232

233-
handleChange = p => {
233+
handleChange = (p) => {
234234
const { disabled } = this.props;
235235

236236
let page = p;
@@ -283,37 +283,37 @@ class Pagination extends React.Component {
283283
hasNext = () =>
284284
this.state.current < calculatePage(undefined, this.state, this.props);
285285

286-
getShowSizeChanger() {
287-
const { showSizeChanger, total, totalBoundaryShowSizeChanger } = this.props;
288-
if (typeof showSizeChanger !== 'undefined') {
289-
return showSizeChanger;
290-
}
291-
return total > totalBoundaryShowSizeChanger;
292-
}
286+
getShowSizeChanger() {
287+
const { showSizeChanger, total, totalBoundaryShowSizeChanger } = this.props;
288+
if (typeof showSizeChanger !== 'undefined') {
289+
return showSizeChanger;
290+
}
291+
return total > totalBoundaryShowSizeChanger;
292+
}
293293

294294
runIfEnter = (event, callback, ...restParams) => {
295295
if (event.key === 'Enter' || event.charCode === 13) {
296296
callback(...restParams);
297297
}
298298
};
299299

300-
runIfEnterPrev = e => {
300+
runIfEnterPrev = (e) => {
301301
this.runIfEnter(e, this.prev);
302302
};
303303

304-
runIfEnterNext = e => {
304+
runIfEnterNext = (e) => {
305305
this.runIfEnter(e, this.next);
306306
};
307307

308-
runIfEnterJumpPrev = e => {
308+
runIfEnterJumpPrev = (e) => {
309309
this.runIfEnter(e, this.jumpPrev);
310310
};
311311

312-
runIfEnterJumpNext = e => {
312+
runIfEnterJumpNext = (e) => {
313313
this.runIfEnter(e, this.jumpNext);
314314
};
315315

316-
handleGoTO = e => {
316+
handleGoTO = (e) => {
317317
if (e.keyCode === KEYCODE.ENTER || e.type === 'click') {
318318
this.handleChange(this.state.currentInputValue);
319319
}

0 commit comments

Comments
 (0)