cr vc-collapse and update to 1.11.7
parent
acbc6158b8
commit
43cbdb5659
|
@ -87,7 +87,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<div class="ant-collapse ant-collapse-borderless">
|
<div class="ant-collapse ant-collapse-borderless">
|
||||||
<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;">
|
<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;">
|
||||||
<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);">
|
<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);">
|
||||||
<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>
|
<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>
|
||||||
</svg></i>This is panel header 1</div>
|
</svg></i>This is panel header 1</div>
|
||||||
<div class="ant-collapse-content ant-collapse-content-active ant-motion-collapse">
|
<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`] = `
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div role="tablist" class="ant-collapse-item" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
|
<div role="tablist" class="ant-collapse-item" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
|
||||||
<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);">
|
<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="">
|
||||||
<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>
|
<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>
|
||||||
</svg></i>This is panel header 2</div>
|
</svg></i>This is panel header 2</div>
|
||||||
<!---->
|
<!---->
|
||||||
</div>
|
</div>
|
||||||
<div role="tablist" class="ant-collapse-item" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
|
<div role="tablist" class="ant-collapse-item" style="background: rgb(247, 247, 247); border-radius: 4px; margin-bottom: 24px; border: 0px; overflow: hidden;">
|
||||||
<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);">
|
<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="">
|
||||||
<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>
|
<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>
|
||||||
</svg></i>This is panel header 3</div>
|
</svg></i>This is panel header 3</div>
|
||||||
<!---->
|
<!---->
|
||||||
|
|
|
@ -13,7 +13,7 @@ Customize the background, border and margin styles and icon for each panel.
|
||||||
<div>
|
<div>
|
||||||
<a-collapse defaultActiveKey="1" :bordered="false">
|
<a-collapse defaultActiveKey="1" :bordered="false">
|
||||||
<template v-slot:expandIcon="props">
|
<template v-slot:expandIcon="props">
|
||||||
<a-icon type="caret-right" rotate="{isActive ? 90 : 0}" />
|
<a-icon type="caret-right" :rotate="props.isActive ? 90 : 0" />
|
||||||
</template>
|
</template>
|
||||||
<a-collapse-panel header="This is panel header 1" key="1" :style="customStyle">
|
<a-collapse-panel header="This is panel header 1" key="1" :style="customStyle">
|
||||||
<p>{{text}}</p>
|
<p>{{text}}</p>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// based on rc-collapse 1.11.1
|
// based on rc-collapse 1.11.7
|
||||||
import CollapsePanel from './src/Panel';
|
import CollapsePanel from './src/Panel';
|
||||||
import Collapse from './src/Collapse';
|
import Collapse from './src/Collapse';
|
||||||
import { collapseProps, panelProps } from './src/commonProps';
|
import { collapseProps, panelProps } from './src/commonProps';
|
||||||
|
|
|
@ -9,7 +9,7 @@ function _toArray(activeKey) {
|
||||||
if (!Array.isArray(currentActiveKey)) {
|
if (!Array.isArray(currentActiveKey)) {
|
||||||
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
|
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
|
||||||
}
|
}
|
||||||
return currentActiveKey;
|
return currentActiveKey.map(key => String(key));
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'Collapse',
|
name: 'Collapse',
|
||||||
|
@ -84,15 +84,13 @@ export default {
|
||||||
let panelEvents = {};
|
let panelEvents = {};
|
||||||
if (!disabled && disabled !== '') {
|
if (!disabled && disabled !== '') {
|
||||||
panelEvents = {
|
panelEvents = {
|
||||||
itemClick: panelKey => {
|
itemClick: this.onClickItem,
|
||||||
this.onClickItem(panelKey);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
|
key,
|
||||||
props: {
|
props: {
|
||||||
key,
|
|
||||||
panelKey: key,
|
panelKey: key,
|
||||||
header,
|
header,
|
||||||
headerClass,
|
headerClass,
|
||||||
|
@ -103,9 +101,7 @@ export default {
|
||||||
accordion,
|
accordion,
|
||||||
expandIcon,
|
expandIcon,
|
||||||
},
|
},
|
||||||
on: {
|
on: panelEvents,
|
||||||
...panelEvents,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return cloneElement(child, props);
|
return cloneElement(child, props);
|
||||||
|
|
|
@ -55,9 +55,9 @@ export default {
|
||||||
[`${prefixCls}-item-active`]: isActive,
|
[`${prefixCls}-item-active`]: isActive,
|
||||||
[`${prefixCls}-item-disabled`]: disabled,
|
[`${prefixCls}-item-disabled`]: disabled,
|
||||||
};
|
};
|
||||||
let icon = null;
|
let icon = <i class="arrow" />;
|
||||||
if (showArrow && typeof expandIcon === 'function') {
|
if (showArrow && typeof expandIcon === 'function') {
|
||||||
icon = cloneElement(expandIcon(this.$props));
|
icon = expandIcon(this.$props);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div class={itemCls} role="tablist">
|
<div class={itemCls} role="tablist">
|
||||||
|
@ -69,7 +69,7 @@ export default {
|
||||||
tabIndex={disabled ? -1 : 0}
|
tabIndex={disabled ? -1 : 0}
|
||||||
aria-expanded={isActive}
|
aria-expanded={isActive}
|
||||||
>
|
>
|
||||||
{showArrow && (icon || <i class="arrow" />)}
|
{showArrow && icon}
|
||||||
{header}
|
{header}
|
||||||
{extra && <div class={`${prefixCls}-extra`}>{extra}</div>}
|
{extra && <div class={`${prefixCls}-extra`}>{extra}</div>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,8 +2,16 @@ import PropTypes from '../../_util/vue-types';
|
||||||
|
|
||||||
const collapseProps = () => ({
|
const collapseProps = () => ({
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
activeKey: PropTypes.oneOfType([
|
||||||
defaultActiveKey: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
PropTypes.string,
|
||||||
|
PropTypes.number,
|
||||||
|
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
||||||
|
]),
|
||||||
|
defaultActiveKey: PropTypes.oneOfType([
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.number,
|
||||||
|
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
||||||
|
]),
|
||||||
accordion: PropTypes.bool,
|
accordion: PropTypes.bool,
|
||||||
destroyInactivePanel: PropTypes.bool,
|
destroyInactivePanel: PropTypes.bool,
|
||||||
bordered: PropTypes.bool,
|
bordered: PropTypes.bool,
|
||||||
|
|
Loading…
Reference in New Issue