Skip to content

Commit 43cbdb5

Browse files
committed
cr vc-collapse and update to 1.11.7
1 parent acbc615 commit 43cbdb5

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

components/collapse/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
8787
<div>
8888
<div class="ant-collapse ant-collapse-borderless">
8989
<div role="tablist" class="ant-collapse-item ant-collapse-item-active" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
90-
<div role="button" tabindex="0" aria-expanded="true" class="ant-collapse-header"><i aria-label="icon: caret-right" class="anticon anticon-caret-right ant-collapse-arrow"><svg viewBox="0 0 1024 1024" data-icon="caret-right" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="" style="transform: rotate({isActive ? 90 : 0}deg);">
90+
<div role="button" tabindex="0" aria-expanded="true" class="ant-collapse-header"><i aria-label="icon: caret-right" class="anticon anticon-caret-right ant-collapse-arrow"><svg viewBox="0 0 1024 1024" data-icon="caret-right" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="" style="transform: rotate(90deg);">
9191
<path d="M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"></path>
9292
</svg></i>This is panel header 1</div>
9393
<div class="ant-collapse-content ant-collapse-content-active ant-motion-collapse">
@@ -97,13 +97,13 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
9797
</div>
9898
</div>
9999
<div role="tablist" class="ant-collapse-item" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
100-
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: caret-right" class="anticon anticon-caret-right ant-collapse-arrow"><svg viewBox="0 0 1024 1024" data-icon="caret-right" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="" style="transform: rotate({isActive ? 90 : 0}deg);">
100+
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: caret-right" class="anticon anticon-caret-right ant-collapse-arrow"><svg viewBox="0 0 1024 1024" data-icon="caret-right" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="">
101101
<path d="M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"></path>
102102
</svg></i>This is panel header 2</div>
103103
<!---->
104104
</div>
105105
<div role="tablist" class="ant-collapse-item" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
106-
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: caret-right" class="anticon anticon-caret-right ant-collapse-arrow"><svg viewBox="0 0 1024 1024" data-icon="caret-right" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="" style="transform: rotate({isActive ? 90 : 0}deg);">
106+
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: caret-right" class="anticon anticon-caret-right ant-collapse-arrow"><svg viewBox="0 0 1024 1024" data-icon="caret-right" width="1em" height="1em" fill="currentColor" aria-hidden="true" class="">
107107
<path d="M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"></path>
108108
</svg></i>This is panel header 3</div>
109109
<!---->

components/collapse/demo/custom.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Customize the background, border and margin styles and icon for each panel.
1313
<div>
1414
<a-collapse defaultActiveKey="1" :bordered="false">
1515
<template v-slot:expandIcon="props">
16-
<a-icon type="caret-right" rotate="{isActive ? 90 : 0}" />
16+
<a-icon type="caret-right" :rotate="props.isActive ? 90 : 0" />
1717
</template>
1818
<a-collapse-panel header="This is panel header 1" key="1" :style="customStyle">
1919
<p>{{text}}</p>

components/vc-collapse/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// based on rc-collapse 1.11.1
1+
// based on rc-collapse 1.11.7
22
import CollapsePanel from './src/Panel';
33
import Collapse from './src/Collapse';
44
import { collapseProps, panelProps } from './src/commonProps';

components/vc-collapse/src/Collapse.jsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function _toArray(activeKey) {
99
if (!Array.isArray(currentActiveKey)) {
1010
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
1111
}
12-
return currentActiveKey;
12+
return currentActiveKey.map(key => String(key));
1313
}
1414
export default {
1515
name: 'Collapse',
@@ -84,15 +84,13 @@ export default {
8484
let panelEvents = {};
8585
if (!disabled && disabled !== '') {
8686
panelEvents = {
87-
itemClick: panelKey => {
88-
this.onClickItem(panelKey);
89-
},
87+
itemClick: this.onClickItem,
9088
};
9189
}
9290

9391
const props = {
92+
key,
9493
props: {
95-
key,
9694
panelKey: key,
9795
header,
9896
headerClass,
@@ -103,9 +101,7 @@ export default {
103101
accordion,
104102
expandIcon,
105103
},
106-
on: {
107-
...panelEvents,
108-
},
104+
on: panelEvents,
109105
};
110106

111107
return cloneElement(child, props);

components/vc-collapse/src/Panel.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export default {
5555
[`${prefixCls}-item-active`]: isActive,
5656
[`${prefixCls}-item-disabled`]: disabled,
5757
};
58-
let icon = null;
58+
let icon = <i class="arrow" />;
5959
if (showArrow && typeof expandIcon === 'function') {
60-
icon = cloneElement(expandIcon(this.$props));
60+
icon = expandIcon(this.$props);
6161
}
6262
return (
6363
<div class={itemCls} role="tablist">
@@ -69,7 +69,7 @@ export default {
6969
tabIndex={disabled ? -1 : 0}
7070
aria-expanded={isActive}
7171
>
72-
{showArrow && (icon || <i class="arrow" />)}
72+
{showArrow && icon}
7373
{header}
7474
{extra && <div class={`${prefixCls}-extra`}>{extra}</div>}
7575
</div>

components/vc-collapse/src/commonProps.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@ import PropTypes from '../../_util/vue-types';
22

33
const collapseProps = () => ({
44
prefixCls: PropTypes.string,
5-
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
6-
defaultActiveKey: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
5+
activeKey: PropTypes.oneOfType([
6+
PropTypes.string,
7+
PropTypes.number,
8+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
9+
]),
10+
defaultActiveKey: PropTypes.oneOfType([
11+
PropTypes.string,
12+
PropTypes.number,
13+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
14+
]),
715
accordion: PropTypes.bool,
816
destroyInactivePanel: PropTypes.bool,
917
bordered: PropTypes.bool,

0 commit comments

Comments
 (0)