style: format code
parent
5da7644ba7
commit
7cbba0ac54
|
@ -24,6 +24,6 @@ components/style/color/*.less
|
|||
.gitattributes
|
||||
.stylelintrc
|
||||
.vcmrc
|
||||
.logo
|
||||
.png
|
||||
.npmrc.template
|
||||
.huskyrc
|
|
@ -4,7 +4,7 @@ let enquire;
|
|||
|
||||
// TODO: Will be removed in antd 4.0 because we will no longer support ie9
|
||||
if (typeof window !== 'undefined') {
|
||||
const matchMediaPolyfill = (mediaQuery) => {
|
||||
const matchMediaPolyfill = mediaQuery => {
|
||||
return {
|
||||
media: mediaQuery,
|
||||
matches: false,
|
||||
|
@ -65,12 +65,10 @@ const responsiveObserve = {
|
|||
}
|
||||
},
|
||||
unregister() {
|
||||
Object.keys(responsiveMap).map((screen) =>
|
||||
enquire.unregister(responsiveMap[screen]),
|
||||
);
|
||||
Object.keys(responsiveMap).map(screen => enquire.unregister(responsiveMap[screen]));
|
||||
},
|
||||
register() {
|
||||
Object.keys(responsiveMap).map((screen) =>
|
||||
Object.keys(responsiveMap).map(screen =>
|
||||
enquire.register(responsiveMap[screen], {
|
||||
match: () => {
|
||||
const pointMap = {
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
### Events
|
||||
|
||||
| Events Name | Description | Arguments |
|
||||
| ------------- | -------------------------------------- | ----------------- |
|
||||
| ----------- | --------------------- | ----------- |
|
||||
| back | back icon click event | function(e) |
|
||||
|
|
|
@ -45,13 +45,11 @@ const renderBack = (instance, prefixCls, backIcon, onBack) => {
|
|||
};
|
||||
|
||||
const renderBreadcrumb = (h, breadcrumb) => {
|
||||
return <Breadcrumb {...breadcrumb } />;
|
||||
return <Breadcrumb {...breadcrumb} />;
|
||||
};
|
||||
|
||||
const renderTitle = (h, prefixCls, instance) => {
|
||||
const {
|
||||
avatar,
|
||||
} = instance;
|
||||
const { avatar } = instance;
|
||||
const title = getComponentFromProp(instance, 'title');
|
||||
const subTitle = getComponentFromProp(instance, 'subTitle');
|
||||
const tags = getComponentFromProp(instance, 'tags');
|
||||
|
@ -64,7 +62,7 @@ const renderTitle = (h, prefixCls, instance) => {
|
|||
return (
|
||||
<div class={headingPrefixCls}>
|
||||
{backIconDom}
|
||||
{avatar && <Avatar {...avatar } />}
|
||||
{avatar && <Avatar {...avatar} />}
|
||||
{title && <span class={`${headingPrefixCls}-title`}>{title}</span>}
|
||||
{subTitle && <span class={`${headingPrefixCls}-sub-title`}>{subTitle}</span>}
|
||||
{tags && <span class={`${headingPrefixCls}-tags`}>{tags}</span>}
|
||||
|
@ -94,19 +92,22 @@ const PageHeader = {
|
|||
},
|
||||
render(h) {
|
||||
const { getPrefixCls } = this.configProvider;
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
breadcrumb,
|
||||
} = this.$props;
|
||||
const { prefixCls: customizePrefixCls, breadcrumb } = this.$props;
|
||||
const footer = getComponentFromProp(this, 'footer');
|
||||
const children = this.$slots.default;
|
||||
|
||||
const prefixCls = getPrefixCls('page-header', customizePrefixCls);
|
||||
const breadcrumbDom = breadcrumb && breadcrumb.props && breadcrumb.props.routes ? renderBreadcrumb(h, breadcrumb) : null;
|
||||
const className = [prefixCls, {
|
||||
const breadcrumbDom =
|
||||
breadcrumb && breadcrumb.props && breadcrumb.props.routes
|
||||
? renderBreadcrumb(h, breadcrumb)
|
||||
: null;
|
||||
const className = [
|
||||
prefixCls,
|
||||
{
|
||||
'has-breadcrumb': breadcrumbDom,
|
||||
'has-footer': footer,
|
||||
}];
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div class={className}>
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
### 事件
|
||||
|
||||
| 事件名称 | 说明 | 回调参数 |
|
||||
| ------------- | -------------------------------------- | ----------------- |
|
||||
| -------- | ------------------ | ----------- |
|
||||
| back | 返回按钮的点击事件 | function(e) |
|
||||
|
|
|
@ -3,16 +3,19 @@ import Result from '../index';
|
|||
import Button from '../../button';
|
||||
|
||||
describe('Result', () => {
|
||||
|
||||
it('🙂 successPercent should decide the progress status when it exists', () => {
|
||||
const wrapper = mount({
|
||||
render () {
|
||||
render() {
|
||||
return (
|
||||
<Result
|
||||
status="success"
|
||||
title="Successfully Purchased Cloud Server ECS!"
|
||||
subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
|
||||
extra={<Button type="primary" key="console">Go Console</Button>}
|
||||
extra={
|
||||
<Button type="primary" key="console">
|
||||
Go Console
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
@ -39,8 +42,8 @@ describe('Result', () => {
|
|||
|
||||
it('🙂 When status = 404, the icon is an image', () => {
|
||||
const wrapper = mount({
|
||||
render () {
|
||||
return <Result status='404' />;
|
||||
render() {
|
||||
return <Result status="404" />;
|
||||
},
|
||||
});
|
||||
expect(wrapper.findAll('.ant-result-404 .ant-result-image')).toHaveLength(1);
|
||||
|
@ -48,8 +51,8 @@ describe('Result', () => {
|
|||
|
||||
it('🙂 When extra is undefined, the extra dom is undefined', () => {
|
||||
const wrapper = mount({
|
||||
render () {
|
||||
return <Result status='404' />;
|
||||
render() {
|
||||
return <Result status="404" />;
|
||||
},
|
||||
});
|
||||
expect(wrapper.findAll('.ant-result-extra')).toHaveLength(0);
|
||||
|
@ -57,8 +60,8 @@ describe('Result', () => {
|
|||
|
||||
it('🙂 result should support className', () => {
|
||||
const wrapper = mount({
|
||||
render () {
|
||||
return <Result status='404' title='404' class='my-result' />;
|
||||
render() {
|
||||
return <Result status="404" title="404" class="my-result" />;
|
||||
},
|
||||
});
|
||||
expect(wrapper.findAll('.ant-result.my-result')).toHaveLength(1);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## API
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ------------------------------------- | ----------------------------------------------------------------- | ------- |
|
||||
| --- | --- | --- | --- |
|
||||
| title | title string | string \| VNode \| v-slot:title | - |
|
||||
| subTitle | subTitle string | string \| VNode \| v-slot:subTitle | - |
|
||||
| status | result status,decide icons and colors | `'success' | 'error' | 'info' | 'warning'| '404' | '403' | '500'` | 'info' |
|
||||
|
|
|
@ -43,11 +43,12 @@ const renderIcon = (h, prefixCls, { status, icon }) => {
|
|||
}
|
||||
// prop `icon` require slot or VNode
|
||||
const iconString = IconMap[status];
|
||||
const iconNode = icon || <Icon type={iconString} theme="filled"/>;
|
||||
const iconNode = icon || <Icon type={iconString} theme="filled" />;
|
||||
return <div class={`${prefixCls}-icon`}>{iconNode}</div>;
|
||||
};
|
||||
|
||||
const renderExtra = (h, prefixCls, extra) => extra && <div class={`${prefixCls}-extra`}>{extra}</div>;
|
||||
const renderExtra = (h, prefixCls, extra) =>
|
||||
extra && <div class={`${prefixCls}-extra`}>{extra}</div>;
|
||||
|
||||
const Result = {
|
||||
name: 'AResult',
|
||||
|
@ -56,11 +57,7 @@ const Result = {
|
|||
configProvider: { default: () => ConfigConsumerProps },
|
||||
},
|
||||
render(h) {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
status,
|
||||
...restProps
|
||||
} = this;
|
||||
const { prefixCls: customizePrefixCls, status, ...restProps } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('result', customizePrefixCls);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## API
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| -------- | ------------------------- | ----------------------------------------------------------------- | ------ |
|
||||
| --- | --- | --- | --- |
|
||||
| title | title 文字 | string \| VNode \| v-slot:title | - |
|
||||
| subTitle | subTitle 文字 | string \| VNode \| v-slot:subTitle | - |
|
||||
| status | 结果的状态,决定图标和颜色 | `'success' | 'error' | 'info' | 'warning'| '404' | '403' | '500'` | 'info' |
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const NoFound = {
|
||||
functional: true,
|
||||
render() {
|
||||
return(
|
||||
return (
|
||||
<svg width="252" height="294">
|
||||
<defs>
|
||||
<path d="M0 .387h251.772v251.772H0z" />
|
||||
|
@ -218,7 +218,10 @@ const NoFound = {
|
|||
d="M150.028 151.232h-49.837a1.01 1.01 0 0 1-1.01-1.01v-31.688c0-.557.452-1.01 1.01-1.01h49.837c.558 0 1.01.453 1.01 1.01v31.688a1.01 1.01 0 0 1-1.01 1.01"
|
||||
fill="#F2D7AD"
|
||||
/>
|
||||
<path d="M150.29 151.232h-19.863v-33.707h20.784v32.786a.92.92 0 0 1-.92.92" fill="#F4D19D" />
|
||||
<path
|
||||
d="M150.29 151.232h-19.863v-33.707h20.784v32.786a.92.92 0 0 1-.92.92"
|
||||
fill="#F4D19D"
|
||||
/>
|
||||
<path
|
||||
d="M123.554 127.896H92.917a.518.518 0 0 1-.425-.816l6.38-9.113c.193-.277.51-.442.85-.442h31.092l-7.26 10.371z"
|
||||
fill="#F2D7AD"
|
||||
|
|
|
@ -9,7 +9,7 @@ Implement resizable column by integrate with [vue-draggable-resizable](https://g
|
|||
</us>
|
||||
|
||||
<template>
|
||||
<a-table bordered :columns="columns" :components="components" :dataSource="data">
|
||||
<a-table bordered :columns="columns" :components="components" :data-source="data">
|
||||
<template v-slot:action>
|
||||
<a href="javascript:;">Delete</a>
|
||||
</template>
|
||||
|
|
|
@ -375,6 +375,6 @@ export default {
|
|||
category: 'Components',
|
||||
subtitle: '描述列表',
|
||||
type: 'Data Display',
|
||||
title: 'Descriptions'
|
||||
}
|
||||
title: 'Descriptions',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ import { Timeline } from './timeline/timeline';
|
|||
import { Tooltip } from './tootip/tooltip';
|
||||
import { Upload } from './upload';
|
||||
import { Result } from './result';
|
||||
import { Descriptions } from './descriptions/descriptions'
|
||||
import { Descriptions } from './descriptions/descriptions';
|
||||
import { PageHeader } from './page-header';
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import { AntdComponent } from './component';
|
||||
|
||||
export declare class PageHeader extends AntdComponent {
|
||||
|
||||
/**
|
||||
* Custom backIcon
|
||||
* @default <Icon type="arrow-left" />
|
||||
|
|
|
@ -34,5 +34,4 @@ export declare class Result extends AntdComponent {
|
|||
* @type any v-slot
|
||||
*/
|
||||
extra: any;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue