parent
39541875ff
commit
745b2983ba
|
@ -27,6 +27,7 @@ export const ColProps = {
|
||||||
xl: objectOrNumber,
|
xl: objectOrNumber,
|
||||||
xxl: objectOrNumber,
|
xxl: objectOrNumber,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
|
flex: stringOrNumber,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -38,6 +39,17 @@ export default {
|
||||||
default: () => null,
|
default: () => null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
parseFlex(flex) {
|
||||||
|
if (typeof flex === 'number') {
|
||||||
|
return `${flex} ${flex} auto`;
|
||||||
|
}
|
||||||
|
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
|
||||||
|
return `0 0 ${flex}`;
|
||||||
|
}
|
||||||
|
return flex;
|
||||||
|
},
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
span,
|
span,
|
||||||
|
@ -45,6 +57,7 @@ export default {
|
||||||
offset,
|
offset,
|
||||||
push,
|
push,
|
||||||
pull,
|
pull,
|
||||||
|
flex,
|
||||||
prefixCls: customizePrefixCls,
|
prefixCls: customizePrefixCls,
|
||||||
$slots,
|
$slots,
|
||||||
rowContext,
|
rowContext,
|
||||||
|
@ -105,6 +118,11 @@ export default {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flex) {
|
||||||
|
divProps.style.flex = this.parseFlex(flex);
|
||||||
|
}
|
||||||
|
|
||||||
return <div {...divProps}>{$slots.default}</div>;
|
return <div {...divProps}>{$slots.default}</div>;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,13 @@ export declare class Col extends AntdComponent {
|
||||||
*/
|
*/
|
||||||
order: ColSpanType;
|
order: ColSpanType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the layout fill of flex
|
||||||
|
* @default none
|
||||||
|
* @type ColSpanType
|
||||||
|
*/
|
||||||
|
flex: ColSpanType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the number of cells to offset Col from the left
|
* the number of cells to offset Col from the left
|
||||||
* @default 0
|
* @default 0
|
||||||
|
|
Loading…
Reference in New Issue