37 lines
938 B
Vue
37 lines
938 B
Vue
import PropTypes from '../../_util/vue-types';
|
|
import BaseMixin from '../../_util/BaseMixin';
|
|
export default {
|
|
name: 'ExpandIcon',
|
|
mixins: [BaseMixin],
|
|
inheritAttrs: false,
|
|
props: {
|
|
record: PropTypes.object,
|
|
prefixCls: PropTypes.string,
|
|
expandable: PropTypes.any,
|
|
expanded: PropTypes.looseBool,
|
|
needIndentSpaced: PropTypes.looseBool,
|
|
},
|
|
methods: {
|
|
onExpand(e) {
|
|
this.__emit('expand', this.record, e);
|
|
},
|
|
},
|
|
|
|
render() {
|
|
const { expandable, prefixCls, onExpand, needIndentSpaced, expanded } = this;
|
|
if (expandable) {
|
|
const expandClassName = expanded ? 'expanded' : 'collapsed';
|
|
return (
|
|
<span
|
|
class={`${prefixCls}-expand-icon ${prefixCls}-${expandClassName}`}
|
|
onClick={onExpand}
|
|
/>
|
|
);
|
|
}
|
|
if (needIndentSpaced) {
|
|
return <span class={`${prefixCls}-expand-icon ${prefixCls}-spaced`} />;
|
|
}
|
|
return null;
|
|
},
|
|
};
|