2020-01-18 13:34:23 +00:00
|
|
|
import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
|
2019-01-12 03:33:27 +00:00
|
|
|
import VcCollapse, { panelProps } from '../vc-collapse';
|
2019-03-15 03:20:37 +00:00
|
|
|
import { ConfigConsumerProps } from '../config-provider';
|
2018-02-01 10:18:05 +00:00
|
|
|
|
|
|
|
export default {
|
2018-04-08 13:17:20 +00:00
|
|
|
name: 'ACollapsePanel',
|
2018-02-01 10:18:05 +00:00
|
|
|
props: {
|
2019-02-21 06:31:35 +00:00
|
|
|
...panelProps(),
|
2018-02-01 10:18:05 +00:00
|
|
|
},
|
2019-03-15 03:20:37 +00:00
|
|
|
inject: {
|
2019-09-11 14:35:25 +00:00
|
|
|
configProvider: { default: () => ConfigConsumerProps },
|
2019-03-15 03:20:37 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
2020-01-18 13:34:23 +00:00
|
|
|
const { prefixCls: customizePrefixCls, showArrow = true } = this;
|
2019-09-11 14:35:25 +00:00
|
|
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
2019-03-15 03:20:37 +00:00
|
|
|
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
|
|
|
|
2018-02-01 10:18:05 +00:00
|
|
|
const collapsePanelClassName = {
|
|
|
|
[`${prefixCls}-no-arrow`]: !showArrow,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-02-01 10:18:05 +00:00
|
|
|
const rcCollapePanelProps = {
|
|
|
|
props: {
|
|
|
|
...getOptionProps(this),
|
2019-03-15 03:20:37 +00:00
|
|
|
prefixCls,
|
2020-03-07 11:45:13 +00:00
|
|
|
extra: getComponentFromProp(this, 'extra'),
|
2018-02-01 10:18:05 +00:00
|
|
|
},
|
|
|
|
class: collapsePanelClassName,
|
2020-01-18 13:34:23 +00:00
|
|
|
on: getListeners(this),
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
|
|
|
const header = getComponentFromProp(this, 'header');
|
2018-02-02 09:19:42 +00:00
|
|
|
return (
|
2019-01-12 03:33:27 +00:00
|
|
|
<VcCollapse.Panel {...rcCollapePanelProps}>
|
2018-09-05 13:28:54 +00:00
|
|
|
{this.$slots.default}
|
2019-01-12 03:33:27 +00:00
|
|
|
{header ? <template slot="header">{header}</template> : null}
|
2018-09-05 13:28:54 +00:00
|
|
|
</VcCollapse.Panel>
|
2019-01-12 03:33:27 +00:00
|
|
|
);
|
2018-02-01 10:18:05 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|