feat: update collapse
parent
a53dd83c36
commit
465b894c63
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
dev: {
|
||||
componentName: 'config-provider', // dev components
|
||||
componentName: 'collapse', // dev components
|
||||
},
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ export default {
|
|||
props: initDefaultProps(collapseProps(), {
|
||||
bordered: true,
|
||||
openAnimation: animation,
|
||||
expandIconPosition: 'left',
|
||||
}),
|
||||
inject: {
|
||||
configProvider: { default: () => ConfigConsumerProps },
|
||||
|
@ -38,12 +39,13 @@ export default {
|
|||
},
|
||||
},
|
||||
render() {
|
||||
const { prefixCls: customizePrefixCls, bordered } = this;
|
||||
const { prefixCls: customizePrefixCls, bordered, expandIconPosition } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
||||
|
||||
const collapseClassName = {
|
||||
[`${prefixCls}-borderless`]: !bordered,
|
||||
[`${prefixCls}-icon-position-${expandIconPosition}`]: true,
|
||||
};
|
||||
const rcCollapeProps = {
|
||||
props: {
|
||||
|
|
|
@ -22,6 +22,7 @@ export default {
|
|||
props: {
|
||||
...getOptionProps(this),
|
||||
prefixCls,
|
||||
extra: getComponentFromProp(this, 'extra'),
|
||||
},
|
||||
class: collapsePanelClassName,
|
||||
on: getListeners(this),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
|
||||
<div>
|
||||
<div role="tablist" class="ant-collapse">
|
||||
<div role="tablist" class="ant-collapse ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item">
|
||||
<div role="tab" tabindex="0" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
|
@ -27,12 +27,12 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
|
|||
|
||||
exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
|
||||
<div>
|
||||
<div class="ant-collapse">
|
||||
<div class="ant-collapse ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item ant-collapse-item-active">
|
||||
<div role="button" tabindex="0" aria-expanded="true" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="" style="transform: rotate(90deg);">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
</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-legacy">
|
||||
<div class="ant-collapse-content-box">
|
||||
<p>A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.</p>
|
||||
</div>
|
||||
|
@ -56,14 +56,14 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
|
|||
|
||||
exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
|
||||
<div>
|
||||
<div class="ant-collapse ant-collapse-borderless">
|
||||
<div class="ant-collapse ant-collapse-borderless ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item ant-collapse-item-active">
|
||||
<div role="button" tabindex="0" aria-expanded="true" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="" style="transform: rotate(90deg);">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
</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-legacy">
|
||||
<div class="ant-collapse-content-box">
|
||||
<p>A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.</p>
|
||||
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -85,12 +85,12 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
|
|||
|
||||
exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
|
||||
<div>
|
||||
<div class="ant-collapse ant-collapse-borderless">
|
||||
<div class="ant-collapse ant-collapse-borderless ant-collapse-icon-position-left">
|
||||
<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" focusable="false" 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>
|
||||
</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-legacy">
|
||||
<div class="ant-collapse-content-box">
|
||||
<p>A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.</p>
|
||||
</div>
|
||||
|
@ -112,9 +112,54 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
|
|||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
|
||||
<div>
|
||||
<div class="ant-collapse ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item ant-collapse-item-active">
|
||||
<div role="button" tabindex="0" aria-expanded="true" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="" style="transform: rotate(90deg);">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
</svg></i>This is panel header 1<div class="ant-collapse-extra"><i slot="extra" aria-label="icon: setting" tabindex="-1" class="anticon anticon-setting"><svg viewBox="64 64 896 896" data-icon="setting" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z"></path>
|
||||
</svg></i></div>
|
||||
</div>
|
||||
<div class="ant-collapse-content ant-collapse-content-active ant-motion-collapse-legacy">
|
||||
<div class="ant-collapse-content-box">
|
||||
<p>A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div role="tablist" class="ant-collapse-item">
|
||||
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
</svg></i>This is panel header 2<div class="ant-collapse-extra"><i slot="extra" aria-label="icon: setting" tabindex="-1" class="anticon anticon-setting"><svg viewBox="64 64 896 896" data-icon="setting" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z"></path>
|
||||
</svg></i></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div role="tablist" class="ant-collapse-item ant-collapse-item-disabled">
|
||||
<div role="button" tabindex="-1" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
</svg></i>This is panel header 3<div class="ant-collapse-extra"><i slot="extra" aria-label="icon: setting" tabindex="-1" class="anticon anticon-setting"><svg viewBox="64 64 896 896" data-icon="setting" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z"></path>
|
||||
</svg></i></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div> <br> <span>Expand Icon Position: </span>
|
||||
<div tabindex="0" class="ant-select ant-select-enabled">
|
||||
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-controls="test-uuid" class="ant-select-selection ant-select-selection--single">
|
||||
<div class="ant-select-selection__rendered">
|
||||
<div title="left" class="ant-select-selection-selected-value" style="display: block; opacity: 1;">left</div>
|
||||
</div><span unselectable="on" class="ant-select-arrow" style="user-select: none;"><i aria-label="icon: down" class="ant-select-arrow-icon anticon anticon-down"><svg viewBox="64 64 896 896" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
|
||||
<div>
|
||||
<div class="ant-collapse">
|
||||
<div class="ant-collapse ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item">
|
||||
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
|
@ -139,12 +184,12 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
|
|||
|
||||
exports[`renders ./components/collapse/demo/noarrow.md correctly 1`] = `
|
||||
<div>
|
||||
<div class="ant-collapse">
|
||||
<div class="ant-collapse ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item ant-collapse-item-active">
|
||||
<div role="button" tabindex="0" aria-expanded="true" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="" style="transform: rotate(90deg);">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
</svg></i>This is panel header with arrow icon</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-legacy">
|
||||
<div class="ant-collapse-content-box">
|
||||
<p>A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.</p>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Collapse should support remove expandIcon 1`] = `
|
||||
<div class="ant-collapse">
|
||||
<div class="ant-collapse ant-collapse-icon-position-left">
|
||||
<div role="tablist" class="ant-collapse-item">
|
||||
<div role="button" tabindex="0" class="ant-collapse-header"><i aria-label="icon: right" class="anticon anticon-right ant-collapse-arrow"><svg viewBox="64 64 896 896" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
|
||||
<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<cn>
|
||||
#### 手风琴
|
||||
手风琴,每次只打开一个tab。默认打开第一个。
|
||||
手风琴,每次只打开一个 tab。
|
||||
</cn>
|
||||
|
||||
<us>
|
||||
#### Accordion
|
||||
Accordion mode, only one panel can be expanded at a time. The first panel will be expanded by default.
|
||||
In accordion mode, only one panel can be expanded at a time.
|
||||
</us>
|
||||
|
||||
```tpl
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<us>
|
||||
#### Collapse
|
||||
More than one panel can be expanded at a time, the first panel is initialized to be active in this case.
|
||||
By default, any number of panels can be expanded at a time. The first panel is expanded in this example.
|
||||
</us>
|
||||
|
||||
```tpl
|
||||
|
|
|
@ -28,7 +28,7 @@ A borderless style of Collapse.
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
text: `A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.`,
|
||||
text: `A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.`,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<cn>
|
||||
#### 额外节点
|
||||
可以同时展开多个面板,这个例子默认展开了第一个。
|
||||
</cn>
|
||||
|
||||
<us>
|
||||
#### Extra node
|
||||
More than one panel can be expanded at a time, the first panel is initialized to be active in this case.
|
||||
</us>
|
||||
|
||||
```tpl
|
||||
<template>
|
||||
<div>
|
||||
<a-collapse v-model="activeKey" :expandIconPosition="expandIconPosition">
|
||||
<a-collapse-panel header="This is panel header 1" key="1">
|
||||
<p>{{text}}</p>
|
||||
<a-icon slot="extra" type="setting" @click="handleClick" />
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header="This is panel header 2" key="2" :disabled="false">
|
||||
<p>{{text}}</p>
|
||||
<a-icon slot="extra" type="setting" @click="handleClick" />
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header="This is panel header 3" key="3" disabled>
|
||||
<p>{{text}}</p>
|
||||
<a-icon slot="extra" type="setting" @click="handleClick" />
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
<br />
|
||||
<span>Expand Icon Position: </span>
|
||||
<a-select v-model="expandIconPosition">
|
||||
<a-select-option value="left">left</a-select-option>
|
||||
<a-select-option value="right">right</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
text: `A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.`,
|
||||
activeKey: ['1'],
|
||||
expandIconPosition: 'left'
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
activeKey(key) {
|
||||
console.log(key);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleClick(event) {
|
||||
// If you don't want click extra trigger collapse, you can prevent this:
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
```
|
|
@ -5,6 +5,7 @@ import Borderless from './borderless';
|
|||
import Custom from './custom';
|
||||
import Mix from './mix';
|
||||
import Noarrow from './noarrow';
|
||||
import Extra from './extra';
|
||||
import CN from '../index.zh-CN.md';
|
||||
import US from '../index.en-US.md';
|
||||
|
||||
|
@ -40,17 +41,12 @@ export default {
|
|||
<div>
|
||||
<md cn={md.cn} us={md.us} />
|
||||
<Basic />
|
||||
<br />
|
||||
<Accordion />
|
||||
<br />
|
||||
<Mix />
|
||||
<br />
|
||||
<Borderless />
|
||||
<br />
|
||||
<Custom />
|
||||
<br />
|
||||
<Noarrow />
|
||||
<br />
|
||||
<Extra />
|
||||
<api>
|
||||
<template slot="cn">
|
||||
<CN />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<us>
|
||||
#### No arrow
|
||||
You can disable showing arrow icon by passing `:showArrow="false"` to `a-collapse-panel` component.
|
||||
You can hide the arrow icon by passing `showArrow={false}` to `CollapsePanel` component.
|
||||
</us>
|
||||
|
||||
```tpl
|
||||
|
|
|
@ -2,40 +2,29 @@
|
|||
|
||||
### Collapse
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| activeKey | Key of the active panel | string\[]\|string | No default value. In `accordion` mode, it's the key of the first panel. |
|
||||
| defaultActiveKey | Key of the initial active panel | string | - |
|
||||
| bordered | Toggles rendering of the border around the collapse block | boolean | `true` |
|
||||
| accordion | If `true`, `Collapse` renders as `Accordion` | boolean | `false` |
|
||||
| expandIcon | allow to customize collapse icon | Function(props):VNode \| slot="expandIcon" slot-scope="props"\|v-slot:expandIcon="props" |
|
||||
| destroyInactivePanel | Destroy Inactive Panel | boolean | `false` |
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| activeKey | Key of the active panel | string\[]\|string | No default value. In `accordion` mode, it's the key of the first panel. | |
|
||||
| defaultActiveKey | Key of the initial active panel | string | - | |
|
||||
| bordered | Toggles rendering of the border around the collapse block | boolean | `true` | |
|
||||
| accordion | If `true`, `Collapse` renders as `Accordion` | boolean | `false` | |
|
||||
| expandIcon | allow to customize collapse icon | Function(props):VNode \| slot="expandIcon" slot-scope="props"\|v-slot:expandIcon="props" | |
|
||||
| expandIconPosition | Set expand icon position: `left`, `right` | `left` | - | 1.5.0 |
|
||||
| destroyInactivePanel | Destroy Inactive Panel | boolean | `false` | |
|
||||
|
||||
### events
|
||||
|
||||
| Events Name | Description | Arguments |
|
||||
| ----------- | ------------------------------------------------------- | ------------- |
|
||||
| change | Callback function executed when active panel is changed | function(key) |
|
||||
| Events Name | Description | Arguments | Version |
|
||||
| ----------- | ------------------------------------------------------- | ------------- | ------- |
|
||||
| change | Callback function executed when active panel is changed | function(key) | |
|
||||
|
||||
### Collapse.Panel
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` |
|
||||
| forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | `false` |
|
||||
| header | Title of the panel | string | - |
|
||||
| key | Unique key identifying the panel from among its siblings | string | - |
|
||||
| showArrow | If `false`, panel will not show arrow icon | boolean | `true` |
|
||||
|
||||
## FAQ
|
||||
|
||||
### How to let the arrow to be on the right?
|
||||
|
||||
You can adjust style of the arrow:
|
||||
|
||||
```
|
||||
.ant-collapse .ant-collapse-item .ant-collapse-header .anticon {
|
||||
left: initial;
|
||||
right: 16px;
|
||||
}
|
||||
```
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` | |
|
||||
| forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | `false` | |
|
||||
| header | Title of the panel | string | - | |
|
||||
| key | Unique key identifying the panel from among its siblings | string | - | |
|
||||
| showArrow | If `false`, panel will not show arrow icon | boolean | `true` | |
|
||||
| extra | extra element in the corner | VNode \| slot | - | 1.5.0 |
|
||||
|
|
|
@ -2,40 +2,29 @@
|
|||
|
||||
### Collapse
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| activeKey(v-model) | 当前激活 tab 面板的 key | string\[]\|string | 默认无,accordion 模式下默认第一个元素 |
|
||||
| defaultActiveKey | 初始化选中面板的 key | string | 无 |
|
||||
| bordered | 带边框风格的折叠面板 | boolean | `true` |
|
||||
| accordion | 手风琴模式 | boolean | `false` |
|
||||
| expandIcon | 自定义切换图标 | Function(props):VNode \| slot="expandIcon" slot-scope="props"\|v-slot:expandIcon="props" |
|
||||
| destroyInactivePanel | 销毁折叠隐藏的面板 | boolean | `false` |
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| activeKey(v-model) | 当前激活 tab 面板的 key | string\[]\|string | 默认无,accordion 模式下默认第一个元素 | |
|
||||
| defaultActiveKey | 初始化选中面板的 key | string | 无 | |
|
||||
| bordered | 带边框风格的折叠面板 | boolean | `true` | |
|
||||
| accordion | 手风琴模式 | boolean | `false` | |
|
||||
| expandIcon | 自定义切换图标 | Function(props):VNode \| slot="expandIcon" slot-scope="props"\|v-slot:expandIcon="props" | |
|
||||
| expandIconPosition | 设置图标位置: `left`, `right` | `left` | - | 1.5.0 |
|
||||
| destroyInactivePanel | 销毁折叠隐藏的面板 | boolean | `false` | |
|
||||
|
||||
### 事件
|
||||
|
||||
| 事件名称 | 说明 | 回调参数 |
|
||||
| -------- | -------------- | ------------- |
|
||||
| change | 切换面板的回调 | function(key) |
|
||||
| 事件名称 | 说明 | 回调参数 | 版本 |
|
||||
| -------- | -------------- | ------------- | ---- |
|
||||
| change | 切换面板的回调 | function(key) | |
|
||||
|
||||
### Collapse.Panel
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| ----------- | ------------------------------------------ | ------------ | ------ |
|
||||
| disabled | 禁用后的面板展开与否将无法通过用户交互改变 | boolean | false |
|
||||
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false |
|
||||
| header | 面板头内容 | string\|slot | 无 |
|
||||
| key | 对应 activeKey | string | 无 |
|
||||
| showArrow | 是否展示当前面板上的箭头 | boolean | `true` |
|
||||
|
||||
## FAQ
|
||||
|
||||
### 我希望箭头在右边,怎么做?
|
||||
|
||||
通过样式调整,将箭头放到右边就行啦
|
||||
|
||||
```
|
||||
.ant-collapse .ant-collapse-item .ant-collapse-header .anticon {
|
||||
left: initial;
|
||||
right: 16px;
|
||||
}
|
||||
```
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| ----------- | ------------------------------------------ | ------------- | ------ | ----- |
|
||||
| disabled | 禁用后的面板展开与否将无法通过用户交互改变 | boolean | false | |
|
||||
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false | |
|
||||
| header | 面板头内容 | string\|slot | 无 | |
|
||||
| key | 对应 activeKey | string | 无 | |
|
||||
| showArrow | 是否展示当前面板上的箭头 | boolean | `true` | |
|
||||
| extra | 自定义渲染每个面板右上角的内容 | VNode \| slot | - | 1.5.0 |
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// based on rc-collapse 1.11.7
|
||||
// based on rc-collapse 1.11.8
|
||||
import CollapsePanel from './src/Panel';
|
||||
import Collapse from './src/Collapse';
|
||||
import { collapseProps, panelProps } from './src/commonProps';
|
||||
|
|
|
@ -17,6 +17,7 @@ const collapseProps = () => ({
|
|||
bordered: PropTypes.bool,
|
||||
expandIcon: PropTypes.func,
|
||||
openAnimation: PropTypes.object,
|
||||
expandIconPosition: PropTypes.oneOf(['left', 'right']),
|
||||
});
|
||||
|
||||
const panelProps = () => ({
|
||||
|
|
|
@ -37,4 +37,6 @@ export declare class CollapsePanel extends AntdComponent {
|
|||
* @type boolean
|
||||
*/
|
||||
showArrow: boolean;
|
||||
|
||||
extra: any;
|
||||
}
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
|
||||
import { AntdComponent } from '../component';
|
||||
import { CollapsePanel } from './collapse-panel';
|
||||
|
||||
export type ExpandIconPosition = 'left' | 'right';
|
||||
export declare class Collapse extends AntdComponent {
|
||||
static Panel: typeof CollapsePanel;
|
||||
|
||||
expandIconPosition?: ExpandIconPosition;
|
||||
/**
|
||||
* If true, Collapse renders as Accordion
|
||||
* @default false
|
||||
|
|
Loading…
Reference in New Issue