diff --git a/antdv-demo b/antdv-demo
index a71e2eac4..fce7a2bab 160000
--- a/antdv-demo
+++ b/antdv-demo
@@ -1 +1 @@
-Subproject commit a71e2eac4c9b38092fc8edd2282bdd91170fa04b
+Subproject commit fce7a2bab42ec55d7cc8b7414336249c3dbf91c5
diff --git a/components/pagination/Pagination.jsx b/components/pagination/Pagination.jsx
index d8d7326a1..8722a4939 100644
--- a/components/pagination/Pagination.jsx
+++ b/components/pagination/Pagination.jsx
@@ -32,7 +32,7 @@ export const PaginationProps = () => ({
locale: PropTypes.object,
prefixCls: PropTypes.string,
selectPrefixCls: PropTypes.string,
- itemRender: PropTypes.any,
+ itemRender: PropTypes.func,
role: PropTypes.string,
showLessItems: PropTypes.bool,
});
@@ -116,6 +116,7 @@ export default {
buildOptionText: buildOptionText || this.$slots.buildOptionText,
...this.$attrs,
class: classNames({ mini: isSmall }, this.$attrs.class),
+ itemRender: this.itemRender || this.$slots.itemRender,
};
return ;
diff --git a/components/vc-pagination/Pager.jsx b/components/vc-pagination/Pager.jsx
index 580f8676d..66272ab26 100644
--- a/components/vc-pagination/Pager.jsx
+++ b/components/vc-pagination/Pager.jsx
@@ -49,7 +49,7 @@ export default {
class={cls}
style={style}
>
- {this.itemRender(this.page, 'page', {this.page})}
+ {this.itemRender({ page: this.page, type: 'page', originalElement: {this.page} })}
);
},
diff --git a/components/vc-pagination/Pagination.jsx b/components/vc-pagination/Pagination.jsx
index 51b9b7011..5f450ad14 100644
--- a/components/vc-pagination/Pagination.jsx
+++ b/components/vc-pagination/Pagination.jsx
@@ -14,8 +14,8 @@ function isInteger(value) {
return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
}
-function defaultItemRender(page, type, element) {
- return element;
+function defaultItemRender({ originalElement }) {
+ return originalElement;
}
function calculatePage(p, state, props) {
@@ -52,7 +52,7 @@ export default {
showTotal: PropTypes.func,
simple: PropTypes.bool,
locale: PropTypes.object.def(LOCALE),
- itemRender: PropTypes.func.def(defaultItemRender),
+ itemRender: PropTypes.func,
prevIcon: PropTypes.any,
nextIcon: PropTypes.any,
jumpPrevIcon: PropTypes.any,
@@ -315,6 +315,7 @@ export default {
if (this.hideOnSinglePage === true && this.total <= this.statePageSize) {
return null;
}
+ const itemRender = this.itemRender || defaultItemRender;
const props = this.$props;
const locale = this.locale;
@@ -368,7 +369,11 @@ export default {
class={`${hasPrev ? '' : `${prefixCls}-disabled`} ${prefixCls}-prev`}
aria-disabled={!this.hasPrev()}
>
- {this.itemRender(prevPage, 'prev', this.getItemIcon('prevIcon'))}
+ {itemRender({
+ page: prevPage,
+ type: 'prev',
+ originalElement: this.getItemIcon('prevIcon'),
+ })}
- {this.itemRender(nextPage, 'next', this.getItemIcon('nextIcon'))}
+ {itemRender({
+ page: nextPage,
+ type: 'next',
+ originalElement: this.getItemIcon('nextIcon'),
+ })}
{gotoButton}
@@ -405,7 +414,7 @@ export default {
locale,
rootPrefixCls: prefixCls,
showTitle: props.showTitle,
- itemRender: props.itemRender,
+ itemRender,
onClick: this.handleChange,
onKeypress: this.runIfEnter,
};
@@ -435,7 +444,11 @@ export default {
onKeypress={this.runIfEnterJumpPrev}
class={jumpPrevClassString}
>
- {this.itemRender(this.getJumpPrevPage(), 'jump-prev', this.getItemIcon('jumpPrevIcon'))}
+ {itemRender({
+ page: this.getJumpPrevPage(),
+ type: 'jump-prev',
+ originalElement: this.getItemIcon('jumpPrevIcon'),
+ })}
);
let jumpNextClassString = `${prefixCls}-jump-next`;
@@ -451,7 +464,11 @@ export default {
onKeypress={this.runIfEnterJumpNext}
class={jumpNextClassString}
>
- {this.itemRender(this.getJumpNextPage(), 'jump-next', this.getItemIcon('jumpNextIcon'))}
+ {itemRender({
+ page: this.getJumpNextPage(),
+ type: 'jump-next',
+ originalElement: this.getItemIcon('jumpNextIcon'),
+ })}
);
}
@@ -467,7 +484,7 @@ export default {
page={allPages}
active={false}
showTitle={this.showTitle}
- itemRender={this.itemRender}
+ itemRender={itemRender}
/>
);
firstPager = (
@@ -480,7 +497,7 @@ export default {
page={1}
active={false}
showTitle={this.showTitle}
- itemRender={this.itemRender}
+ itemRender={itemRender}
/>
);
@@ -507,7 +524,7 @@ export default {
page={i}
active={active}
showTitle={this.showTitle}
- itemRender={this.itemRender}
+ itemRender={itemRender}
/>,
);
}
@@ -524,7 +541,7 @@ export default {
class={`${prefixCls}-item-after-jump-prev`}
active={false}
showTitle={this.showTitle}
- itemRender={this.itemRender}
+ itemRender={itemRender}
/>
);
pagerList.unshift(jumpPrev);
@@ -541,7 +558,7 @@ export default {
class={`${prefixCls}-item-before-jump-next`}
active={false}
showTitle={this.showTitle}
- itemRender={this.itemRender}
+ itemRender={itemRender}
/>
);
pagerList.push(jumpNext);
@@ -589,7 +606,11 @@ export default {
class={`${!prevDisabled ? '' : `${prefixCls}-disabled`} ${prefixCls}-prev`}
aria-disabled={prevDisabled}
>
- {this.itemRender(prevPage, 'prev', this.getItemIcon('prevIcon'))}
+ {itemRender({
+ page: prevPage,
+ type: 'prev',
+ originalElement: this.getItemIcon('prevIcon'),
+ })}
{pagerList}
- {this.itemRender(nextPage, 'next', this.getItemIcon('nextIcon'))}
+ {itemRender({
+ page: nextPage,
+ type: 'next',
+ originalElement: this.getItemIcon('nextIcon'),
+ })}
menu),
+ dropdownRender: PropTypes.func.def(({ menuNode }) => menuNode),
// onChange: noop,
// onFocus: noop,
// onBlur: noop,
diff --git a/components/vc-select/SelectTrigger.jsx b/components/vc-select/SelectTrigger.jsx
index 45dd6822b..bddf07d25 100644
--- a/components/vc-select/SelectTrigger.jsx
+++ b/components/vc-select/SelectTrigger.jsx
@@ -131,7 +131,7 @@ export default {
);
if (dropdownRender) {
- return dropdownRender(menuNode, props);
+ return dropdownRender({ menuNode, props });
}
return null;
},
diff --git a/examples/App.vue b/examples/App.vue
index 4bbcb8c1a..39957fd6c 100644
--- a/examples/App.vue
+++ b/examples/App.vue
@@ -4,7 +4,7 @@