style: format code
parent
5da7644ba7
commit
7cbba0ac54
|
@ -24,6 +24,6 @@ components/style/color/*.less
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.stylelintrc
|
.stylelintrc
|
||||||
.vcmrc
|
.vcmrc
|
||||||
.logo
|
.png
|
||||||
.npmrc.template
|
.npmrc.template
|
||||||
.huskyrc
|
.huskyrc
|
||||||
|
|
|
@ -4,7 +4,7 @@ let enquire;
|
||||||
|
|
||||||
// TODO: Will be removed in antd 4.0 because we will no longer support ie9
|
// TODO: Will be removed in antd 4.0 because we will no longer support ie9
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
const matchMediaPolyfill = (mediaQuery) => {
|
const matchMediaPolyfill = mediaQuery => {
|
||||||
return {
|
return {
|
||||||
media: mediaQuery,
|
media: mediaQuery,
|
||||||
matches: false,
|
matches: false,
|
||||||
|
@ -65,12 +65,10 @@ const responsiveObserve = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unregister() {
|
unregister() {
|
||||||
Object.keys(responsiveMap).map((screen) =>
|
Object.keys(responsiveMap).map(screen => enquire.unregister(responsiveMap[screen]));
|
||||||
enquire.unregister(responsiveMap[screen]),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
register() {
|
register() {
|
||||||
Object.keys(responsiveMap).map((screen) =>
|
Object.keys(responsiveMap).map(screen =>
|
||||||
enquire.register(responsiveMap[screen], {
|
enquire.register(responsiveMap[screen], {
|
||||||
match: () => {
|
match: () => {
|
||||||
const pointMap = {
|
const pointMap = {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import demoTest from '../../../tests/shared/demoTest';
|
import demoTest from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('descriptions');
|
demoTest('descriptions');
|
||||||
|
|
|
@ -71,4 +71,4 @@ tr:last-child td {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
| Events Name | Description | Arguments |
|
| Events Name | Description | Arguments |
|
||||||
| ------------- | -------------------------------------- | ----------------- |
|
| ----------- | --------------------- | ----------- |
|
||||||
| back | back icon click event | function(e) |
|
| back | back icon click event | function(e) |
|
||||||
|
|
|
@ -45,13 +45,11 @@ const renderBack = (instance, prefixCls, backIcon, onBack) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderBreadcrumb = (h, breadcrumb) => {
|
const renderBreadcrumb = (h, breadcrumb) => {
|
||||||
return <Breadcrumb {...breadcrumb } />;
|
return <Breadcrumb {...breadcrumb} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderTitle = (h, prefixCls, instance) => {
|
const renderTitle = (h, prefixCls, instance) => {
|
||||||
const {
|
const { avatar } = instance;
|
||||||
avatar,
|
|
||||||
} = instance;
|
|
||||||
const title = getComponentFromProp(instance, 'title');
|
const title = getComponentFromProp(instance, 'title');
|
||||||
const subTitle = getComponentFromProp(instance, 'subTitle');
|
const subTitle = getComponentFromProp(instance, 'subTitle');
|
||||||
const tags = getComponentFromProp(instance, 'tags');
|
const tags = getComponentFromProp(instance, 'tags');
|
||||||
|
@ -64,7 +62,7 @@ const renderTitle = (h, prefixCls, instance) => {
|
||||||
return (
|
return (
|
||||||
<div class={headingPrefixCls}>
|
<div class={headingPrefixCls}>
|
||||||
{backIconDom}
|
{backIconDom}
|
||||||
{avatar && <Avatar {...avatar } />}
|
{avatar && <Avatar {...avatar} />}
|
||||||
{title && <span class={`${headingPrefixCls}-title`}>{title}</span>}
|
{title && <span class={`${headingPrefixCls}-title`}>{title}</span>}
|
||||||
{subTitle && <span class={`${headingPrefixCls}-sub-title`}>{subTitle}</span>}
|
{subTitle && <span class={`${headingPrefixCls}-sub-title`}>{subTitle}</span>}
|
||||||
{tags && <span class={`${headingPrefixCls}-tags`}>{tags}</span>}
|
{tags && <span class={`${headingPrefixCls}-tags`}>{tags}</span>}
|
||||||
|
@ -94,19 +92,22 @@ const PageHeader = {
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
const { getPrefixCls } = this.configProvider;
|
const { getPrefixCls } = this.configProvider;
|
||||||
const {
|
const { prefixCls: customizePrefixCls, breadcrumb } = this.$props;
|
||||||
prefixCls: customizePrefixCls,
|
|
||||||
breadcrumb,
|
|
||||||
} = this.$props;
|
|
||||||
const footer = getComponentFromProp(this, 'footer');
|
const footer = getComponentFromProp(this, 'footer');
|
||||||
const children = this.$slots.default;
|
const children = this.$slots.default;
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('page-header', customizePrefixCls);
|
const prefixCls = getPrefixCls('page-header', customizePrefixCls);
|
||||||
const breadcrumbDom = breadcrumb && breadcrumb.props && breadcrumb.props.routes ? renderBreadcrumb(h, breadcrumb) : null;
|
const breadcrumbDom =
|
||||||
const className = [prefixCls, {
|
breadcrumb && breadcrumb.props && breadcrumb.props.routes
|
||||||
'has-breadcrumb': breadcrumbDom,
|
? renderBreadcrumb(h, breadcrumb)
|
||||||
'has-footer': footer,
|
: null;
|
||||||
}];
|
const className = [
|
||||||
|
prefixCls,
|
||||||
|
{
|
||||||
|
'has-breadcrumb': breadcrumbDom,
|
||||||
|
'has-footer': footer,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={className}>
|
<div class={className}>
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
|
|
||||||
### 事件
|
### 事件
|
||||||
|
|
||||||
| 事件名称 | 说明 | 回调参数 |
|
| 事件名称 | 说明 | 回调参数 |
|
||||||
| ------------- | -------------------------------------- | ----------------- |
|
| -------- | ------------------ | ----------- |
|
||||||
| back | 返回按钮的点击事件 | function(e) |
|
| back | 返回按钮的点击事件 | function(e) |
|
||||||
|
|
|
@ -3,16 +3,19 @@ import Result from '../index';
|
||||||
import Button from '../../button';
|
import Button from '../../button';
|
||||||
|
|
||||||
describe('Result', () => {
|
describe('Result', () => {
|
||||||
|
|
||||||
it('🙂 successPercent should decide the progress status when it exists', () => {
|
it('🙂 successPercent should decide the progress status when it exists', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render () {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Result
|
<Result
|
||||||
status="success"
|
status="success"
|
||||||
title="Successfully Purchased Cloud Server ECS!"
|
title="Successfully Purchased Cloud Server ECS!"
|
||||||
subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
|
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', () => {
|
it('🙂 When status = 404, the icon is an image', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render () {
|
render() {
|
||||||
return <Result status='404' />;
|
return <Result status="404" />;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(wrapper.findAll('.ant-result-404 .ant-result-image')).toHaveLength(1);
|
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', () => {
|
it('🙂 When extra is undefined, the extra dom is undefined', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render () {
|
render() {
|
||||||
return <Result status='404' />;
|
return <Result status="404" />;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(wrapper.findAll('.ant-result-extra')).toHaveLength(0);
|
expect(wrapper.findAll('.ant-result-extra')).toHaveLength(0);
|
||||||
|
@ -57,8 +60,8 @@ describe('Result', () => {
|
||||||
|
|
||||||
it('🙂 result should support className', () => {
|
it('🙂 result should support className', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render () {
|
render() {
|
||||||
return <Result status='404' title='404' class='my-result' />;
|
return <Result status="404" title="404" class="my-result" />;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(wrapper.findAll('.ant-result.my-result')).toHaveLength(1);
|
expect(wrapper.findAll('.ant-result.my-result')).toHaveLength(1);
|
||||||
|
|
|
@ -10,7 +10,7 @@ you are not authorized to access this page.
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
<template>
|
<template>
|
||||||
<a-result
|
<a-result
|
||||||
status="403"
|
status="403"
|
||||||
title="403"
|
title="403"
|
||||||
subTitle="Sorry, you are not authorized to access this page."
|
subTitle="Sorry, you are not authorized to access this page."
|
||||||
|
|
|
@ -10,7 +10,7 @@ The page you visited does not exist.
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
<template>
|
<template>
|
||||||
<a-result
|
<a-result
|
||||||
status="404"
|
status="404"
|
||||||
title="404"
|
title="404"
|
||||||
subTitle="Sorry, the page you visited does not exist."
|
subTitle="Sorry, the page you visited does not exist."
|
||||||
|
|
|
@ -10,7 +10,7 @@ The server is wrong.
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
<template>
|
<template>
|
||||||
<a-result
|
<a-result
|
||||||
status="500"
|
status="500"
|
||||||
title="500"
|
title="500"
|
||||||
subTitle="Sorry, the server is wrong."
|
subTitle="Sorry, the server is wrong."
|
||||||
|
|
|
@ -10,7 +10,7 @@ Complex error feedback.
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
<template>
|
<template>
|
||||||
<a-result
|
<a-result
|
||||||
status="error"
|
status="error"
|
||||||
title="Submission Failed"
|
title="Submission Failed"
|
||||||
subTitle="Please check and modify the following information before resubmitting."
|
subTitle="Please check and modify the following information before resubmitting."
|
||||||
|
|
|
@ -10,7 +10,7 @@ Show successful results.
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
<template>
|
<template>
|
||||||
<a-result
|
<a-result
|
||||||
status="success"
|
status="success"
|
||||||
title="Successfully Purchased Cloud Server ECS!"
|
title="Successfully Purchased Cloud Server ECS!"
|
||||||
subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
|
subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| Property | Description | Type | Default |
|
| Property | Description | Type | Default |
|
||||||
| -------- | ------------------------------------- | ----------------------------------------------------------------- | ------- |
|
| --- | --- | --- | --- |
|
||||||
| title | title string | string \| VNode \| v-slot:title | - |
|
| title | title string | string \| VNode \| v-slot:title | - |
|
||||||
| subTitle | subTitle string | string \| VNode \| v-slot:subTitle | - |
|
| subTitle | subTitle string | string \| VNode \| v-slot:subTitle | - |
|
||||||
| status | result status,decide icons and colors | `'success' | 'error' | 'info' | 'warning'| '404' | '403' | '500'` | 'info' |
|
| status | result status,decide icons and colors | `'success' | 'error' | 'info' | 'warning'| '404' | '403' | '500'` | 'info' |
|
||||||
| icon | custom back icon | v-slot:icon | - |
|
| icon | custom back icon | v-slot:icon | - |
|
||||||
| extra | operating area | v-slot:extra | - |
|
| extra | operating area | v-slot:extra | - |
|
||||||
|
|
|
@ -43,11 +43,12 @@ const renderIcon = (h, prefixCls, { status, icon }) => {
|
||||||
}
|
}
|
||||||
// prop `icon` require slot or VNode
|
// prop `icon` require slot or VNode
|
||||||
const iconString = IconMap[status];
|
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>;
|
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 = {
|
const Result = {
|
||||||
name: 'AResult',
|
name: 'AResult',
|
||||||
|
@ -56,11 +57,7 @@ const Result = {
|
||||||
configProvider: { default: () => ConfigConsumerProps },
|
configProvider: { default: () => ConfigConsumerProps },
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
const {
|
const { prefixCls: customizePrefixCls, status, ...restProps } = this;
|
||||||
prefixCls: customizePrefixCls,
|
|
||||||
status,
|
|
||||||
...restProps
|
|
||||||
} = this;
|
|
||||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||||
const prefixCls = getPrefixCls('result', customizePrefixCls);
|
const prefixCls = getPrefixCls('result', customizePrefixCls);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
| -------- | ------------------------- | ----------------------------------------------------------------- | ------ |
|
| --- | --- | --- | --- |
|
||||||
| title | title 文字 | string \| VNode \| v-slot:title | - |
|
| title | title 文字 | string \| VNode \| v-slot:title | - |
|
||||||
| subTitle | subTitle 文字 | string \| VNode \| v-slot:subTitle | - |
|
| subTitle | subTitle 文字 | string \| VNode \| v-slot:subTitle | - |
|
||||||
| status | 结果的状态,决定图标和颜色 | `'success' | 'error' | 'info' | 'warning'| '404' | '403' | '500'` | 'info' |
|
| status | 结果的状态,决定图标和颜色 | `'success' | 'error' | 'info' | 'warning'| '404' | '403' | '500'` | 'info' |
|
||||||
| icon | 自定义 icon | v-slot:icon | - |
|
| icon | 自定义 icon | v-slot:icon | - |
|
||||||
| extra | 操作区 | v-slot:extra | - |
|
| extra | 操作区 | v-slot:extra | - |
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const NoFound = {
|
const NoFound = {
|
||||||
functional: true,
|
functional: true,
|
||||||
render() {
|
render() {
|
||||||
return(
|
return (
|
||||||
<svg width="252" height="294">
|
<svg width="252" height="294">
|
||||||
<defs>
|
<defs>
|
||||||
<path d="M0 .387h251.772v251.772H0z" />
|
<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"
|
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"
|
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
|
<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"
|
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"
|
fill="#F2D7AD"
|
||||||
|
|
|
@ -9,7 +9,7 @@ Implement resizable column by integrate with [vue-draggable-resizable](https://g
|
||||||
</us>
|
</us>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-table bordered :columns="columns" :components="components" :dataSource="data">
|
<a-table bordered :columns="columns" :components="components" :data-source="data">
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<a href="javascript:;">Delete</a>
|
<a href="javascript:;">Delete</a>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -375,6 +375,6 @@ export default {
|
||||||
category: 'Components',
|
category: 'Components',
|
||||||
subtitle: '描述列表',
|
subtitle: '描述列表',
|
||||||
type: 'Data Display',
|
type: 'Data Display',
|
||||||
title: 'Descriptions'
|
title: 'Descriptions',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,7 +63,7 @@ import { Timeline } from './timeline/timeline';
|
||||||
import { Tooltip } from './tootip/tooltip';
|
import { Tooltip } from './tootip/tooltip';
|
||||||
import { Upload } from './upload';
|
import { Upload } from './upload';
|
||||||
import { Result } from './result';
|
import { Result } from './result';
|
||||||
import { Descriptions } from './descriptions/descriptions'
|
import { Descriptions } from './descriptions/descriptions';
|
||||||
import { PageHeader } from './page-header';
|
import { PageHeader } from './page-header';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,4 +54,4 @@ export declare class Descriptions extends AntdComponent {
|
||||||
* @type boolean
|
* @type boolean
|
||||||
*/
|
*/
|
||||||
colon: boolean;
|
colon: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
import { AntdComponent } from './component';
|
import { AntdComponent } from './component';
|
||||||
|
|
||||||
export declare class PageHeader extends AntdComponent {
|
export declare class PageHeader extends AntdComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom backIcon
|
* Custom backIcon
|
||||||
* @default <Icon type="arrow-left" />
|
* @default <Icon type="arrow-left" />
|
||||||
|
|
|
@ -34,5 +34,4 @@ export declare class Result extends AntdComponent {
|
||||||
* @type any v-slot
|
* @type any v-slot
|
||||||
*/
|
*/
|
||||||
extra: any;
|
extra: any;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue