style: format code

This commit is contained in:
tangjinzhou 2019-12-21 18:37:33 +08:00
parent d038b90f4d
commit d7561734ea
74 changed files with 128 additions and 99 deletions

View File

@ -24,3 +24,6 @@ components/style/color/*.less
.gitattributes
.stylelintrc
.vcmrc
.logo
.npmrc.template
.huskyrc

View File

@ -40,7 +40,10 @@ describe('CheckboxGroup', () => {
it('does not trigger onChange callback of both Checkbox and CheckboxGroup when CheckboxGroup is disabled', () => {
const onChangeGroup = jest.fn();
const options = [{ label: 'Apple', value: 'Apple' }, { label: 'Pear', value: 'Pear' }];
const options = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Pear', value: 'Pear' },
];
const groupWrapper = mount(
{
@ -95,7 +98,10 @@ describe('CheckboxGroup', () => {
});
it('passes prefixCls down to checkbox', () => {
const options = [{ label: 'Apple', value: 'Apple' }, { label: 'Orange', value: 'Orange' }];
const options = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Orange', value: 'Orange' },
];
const wrapper = mount({
render() {
@ -106,7 +112,10 @@ describe('CheckboxGroup', () => {
expect(wrapper.html()).toMatchSnapshot();
});
it('should be controlled by value', async () => {
const options = [{ label: 'Apple', value: 'Apple' }, { label: 'Orange', value: 'Orange' }];
const options = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Orange', value: 'Orange' },
];
const wrapper = mount(Checkbox.Group, {
propsData: { options },

View File

@ -1,4 +1,3 @@
/* eslint-disable import/prefer-default-export */
export function $$(className) {
return document.body.querySelectorAll(className);
}

View File

@ -162,7 +162,7 @@ const Drawer = {
return (
<div
class={`${prefixCls}-wrapper-body`}
style={{...containerStyle, ...wrapStyle}}
style={{ ...containerStyle, ...wrapStyle }}
onTransitionend={this.onDestroyTransitionEnd}
>
{this.renderHeader(prefixCls)}

View File

@ -96,7 +96,8 @@ export default {
const { help, validateStatus } = this.$props;
warning(
this.getControls(this.slotDefault, true).length <= 1 ||
(help !== undefined || validateStatus !== undefined),
help !== undefined ||
validateStatus !== undefined,
'`Form.Item` cannot generate `validateStatus` and `help` automatically, ' +
'while there are more than one `getFieldDecorator` in it.',
);

View File

@ -9,7 +9,12 @@ Demonstration of validation configuration for form controls which are not shown
</us>
<template>
<a-form id="components-form-demo-validate-other" :form="form" v-bind="formItemLayout" @submit="handleSubmit">
<a-form
id="components-form-demo-validate-other"
:form="form"
v-bind="formItemLayout"
@submit="handleSubmit"
>
<a-form-item label="Plain Text">
<span class="ant-form-text">
China

View File

@ -1,4 +1,3 @@
/* eslint-disable react/no-multi-comp */
import { mount } from '@vue/test-utils';
import Vue from 'vue';
import moment from 'moment';

View File

@ -218,7 +218,10 @@ describe('Radio', () => {
});
it('passes prefixCls down to radio', () => {
const options = [{ label: 'Apple', value: 'Apple' }, { label: 'Orange', value: 'Orange' }];
const options = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Orange', value: 'Orange' },
];
const wrapper = mount(RadioGroup, {
propsData: {

View File

@ -21,7 +21,10 @@ describe('Table.filter', () => {
{
text: 'Title',
value: 'title',
children: [{ text: 'Designer', value: 'designer' }, { text: 'Coder', value: 'coder' }],
children: [
{ text: 'Designer', value: 'designer' },
{ text: 'Coder', value: 'coder' },
],
},
],
onFilter: filterFn,
@ -358,7 +361,10 @@ describe('Table.filter', () => {
title="name"
dataIndex="name"
key="name"
filters={[{ text: 'Jack', value: 'Jack' }, { text: 'Lucy', value: 'Lucy' }]}
filters={[
{ text: 'Jack', value: 'Jack' },
{ text: 'Lucy', value: 'Lucy' },
]}
filteredValue={this.filters.name}
onFilter={filterFn}
/>
@ -399,7 +405,10 @@ describe('Table.filter', () => {
title: 'Name',
dataIndex: 'name',
key: 'name',
filters: [{ text: 'Jack', value: 'Jack' }, { text: 'Lucy', value: 'Lucy' }],
filters: [
{ text: 'Jack', value: 'Jack' },
{ text: 'Lucy', value: 'Lucy' },
],
onFilter: filterFn,
filteredValue: ['Jack'],
},

View File

@ -69,11 +69,11 @@ const columns = [
### 事件
| 事件名称 | 说明 | 回调参数 |
| ------------------ | -------------------------- | ------------------------------------- |
| expandedRowsChange | 展开的行变化时触发 | Function(expandedRows) |
| change | 分页、排序、筛选变化时触发 | Function(pagination, filters, sorter, { currentDataSource }) |
| expand | 点击展开图标时触发 | Function(expanded, record) |
| 事件名称 | 说明 | 回调参数 |
| --- | --- | --- |
| expandedRowsChange | 展开的行变化时触发 | Function(expandedRows) |
| change | 分页、排序、筛选变化时触发 | Function(pagination, filters, sorter, { currentDataSource }) |
| expand | 点击展开图标时触发 | Function(expanded, record) |
#### customRow 用法

View File

@ -171,7 +171,10 @@ export default {
},
setUncontrolledState(state) {
const newState = omit(state, Object.keys(getOptionProps(this)).map(p => `_${p}`));
const newState = omit(
state,
Object.keys(getOptionProps(this)).map(p => `_${p}`),
);
if (Object.keys(newState).length) {
this.setState(newState);
}

View File

@ -161,14 +161,7 @@ export default {
return treeData.map(item => {
const key = item[replaceFields.key];
const children = item[replaceFields.children];
const {
on = {},
slots = {},
scopedSlots = {},
class: cls,
style,
...restProps
} = item;
const { on = {}, slots = {}, scopedSlots = {}, class: cls, style, ...restProps } = item;
const treeNodeProps = {
...restProps,
icon:

View File

@ -38,7 +38,7 @@ export default {
<md cn={md.cn} us={md.us} />
<BasicControlled />
<Basic />
<ReplaceFields/>
<ReplaceFields />
<CustomizedIcon />
<Draggable />
<Dynamic />

View File

@ -64,8 +64,8 @@ One of the Tree `treeNode` prop for describing the tree's node, TreeNode has the
### DirectoryTree props
| Property | Description | Type | Default |
| ------------ | ------------------------------------------------------------ | ------ | ------- |
| Property | Description | Type | Default |
| ------------ | ------------------------------------------------------------- | ------ | ------- |
| expandAction | Directory open logic, optional `false` `'click'` `'dblclick'` | string | click |
## FAQ

View File

@ -5,7 +5,7 @@
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| treeData | 节点的配置描述,具体项见下表, 1.1.4 之前的版本使用`treeNodes` | array | -- |
| replaceFields | 替换treeNode中 title,key,children字段为treeData中对应的字段 | object |{children:'children', title:'title', key:'key' } |
| replaceFields | 替换 treeNode 中 title,key,children 字段为 treeData 中对应的字段 | object | {children:'children', title:'title', key:'key' } |
| autoExpandParent | 是否自动展开父节点 | boolean | true |
| checkable | 节点前添加 Checkbox 复选框 | boolean | false |
| checkedKeys(v-model) | (受控)选中复选框的树节点(注意:父子节点有关联,如果传入父节点 key则子节点自动选中相应当子节点 key 都传入,父节点也自动选中。当设置`checkable`和`checkStrictly`,它是一个有`checked`和`halfChecked`属性的对象,并且父子节点的选中与否不再关联 | string\[] \| number\[] \| {checked: string\[] \| number\[], halfChecked: string\[] \| number\[]} | \[] |
@ -64,8 +64,8 @@
### DirectoryTree props
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | ------------------------------------------------ | ------ | ------ |
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | ------------------------------------------------- | ------ | ------ |
| expandAction | 目录展开逻辑,可选 `false` `'click'` `'dblclick'` | string | click |
## FAQ

View File

@ -1,5 +1,5 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0, no-unused-vars:0 */
/* eslint no-console:0, no-unused-vars:0 */
import '../assets/index.less';
import PropTypes from '@/components/_util/vue-types';

View File

@ -1,5 +1,5 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import '../assets/index.less';
import PropTypes from '@/components/_util/vue-types';
import DatePicker from '../src/Picker';

View File

@ -1,5 +1,5 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0, no-unused-vars:0 */
/* eslint no-console:0, no-unused-vars:0 */
import '../assets/index.less';
import '@/components/vc-time-picker/assets/index.less';

View File

@ -1,5 +1,5 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import '../assets/index.less';
import zhCN from '../src/locale/zh_CN';
import enUS from '../src/locale/en_US';

View File

@ -155,7 +155,11 @@ export default {
},
handleChange(options, setProps, e) {
if (e.type !== 'keydown' || e.keyCode === KeyCode.ENTER) {
this.__emit('change', options.map(o => o[this.getFieldName('value')]), options);
this.__emit(
'change',
options.map(o => o[this.getFieldName('value')]),
options,
);
this.setPopupVisible(setProps.visible);
}
},

View File

@ -10,7 +10,6 @@ const IDialogPropTypes = getDialogPropTypes();
let uuid = 0;
/* eslint react/no-is-mounted:0 */
function noop() {}
function getScroll(w, top) {
let ret = w[`page${top ? 'Y' : 'X'}Offset`];
@ -111,7 +110,7 @@ export default {
},
updatedCallback(visible) {
const mousePosition = this.mousePosition;
const {mask, focusTriggerAfterClose} = this;
const { mask, focusTriggerAfterClose } = this;
if (this.visible) {
// first show
if (!visible) {
@ -375,7 +374,7 @@ export default {
cacheOverflow = {
overflowX: document.body.style.overflowX,
overflowY: document.body.style.overflowY,
overflow: document.body.style.overflow,
overflow: document.body.style.overflow,
};
switchScrollingEffect();
// Must be set after switchScrollingEffect
@ -383,7 +382,7 @@ export default {
} else if (!openCount) {
// IE browser doesn't merge overflow style, need to set it separately
// https://github.com/ant-design/ant-design/issues/19393
if (cacheOverflow.overflow !== undefined) {
if (cacheOverflow.overflow !== undefined) {
document.body.style.overflow = cacheOverflow.overflow;
}
if (cacheOverflow.overflowX !== undefined) {

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle, errorStyle } from './styles';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import BaseMixin from '../../_util/BaseMixin';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle, errorStyle } from './styles';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle, errorStyle } from './styles';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import BaseMixin from '../../_util/BaseMixin';
import createDOMForm from '../src/createDOMForm';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import createForm from '../src/createDOMForm';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle, errorStyle } from './styles';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import createDOMForm from '../src/createDOMForm';
import { DatePicker, Select } from 'ant-design-vue';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle } from './styles';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { Select } from 'ant-design-vue';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle, errorStyle } from './styles';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import { createForm } from '../index';
import { regionStyle, errorStyle } from './styles';

View File

@ -622,7 +622,13 @@ const Select = {
if (value.length) {
hidden = true;
}
if (!state._mirrorInputValue && isCombobox(props) && value.length === 1 && (state._value && !state._value[0])) {
if (
!state._mirrorInputValue &&
isCombobox(props) &&
value.length === 1 &&
state._value &&
!state._value[0]
) {
hidden = false;
}
const placeholder = props.placeholder;

View File

@ -40,8 +40,8 @@ export default {
[`${prefixCls}-icon`]: true,
[`${iconPrefix}icon`]: true,
[`${iconPrefix}icon-${icon}`]: icon && isString(icon),
[`${iconPrefix}icon-check`]: !icon && status === 'finish' && (icons && !icons.finish),
[`${iconPrefix}icon-close`]: !icon && status === 'error' && (icons && !icons.error),
[`${iconPrefix}icon-check`]: !icon && status === 'finish' && icons && !icons.finish,
[`${iconPrefix}icon-close`]: !icon && status === 'error' && icons && !icons.error,
};
const iconDot = <span class={`${prefixCls}-icon-dot`} />;
// `progressDot` enjoy the highest priority

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';
import BaseMixin from '../../_util/BaseMixin';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';
import Menu from '../../menu';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';
import '../assets/bordered.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
/* eslint-disable no-console,func-names */
import Table from '../index';
import '../assets/index.less';

View File

@ -20,7 +20,10 @@ const TableHeaderRow = {
const { row, index, height, components, customHeaderRow, prefixCls } = this;
const HeaderRow = components.header.row;
const HeaderCell = components.header.cell;
const rowProps = customHeaderRow(row.map(cell => cell.column), index);
const rowProps = customHeaderRow(
row.map(cell => cell.column),
index,
);
const customStyle = rowProps ? rowProps.style : {};
const style = { height, ...customStyle };
if (style.height === null) {

View File

@ -72,7 +72,6 @@ export default {
return;
}
// wait next, prev show hide
/* eslint react/no-did-update-set-state:0 */
if (this.isNextPrevShown(this.$data) !== this.isNextPrevShown(this.setNextPrev())) {
this.$forceUpdate();
this.$nextTick(() => {

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0, no-alert: 0 */
/* eslint no-console:0, no-alert: 0 */
import BaseMixin from '../../_util/BaseMixin';
import '../assets/index.less';
import '../../vc-dialog/assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import '../assets/index.less';
import './demo.less';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0, no-alert: 0 */
/* eslint no-console:0, no-alert: 0 */
import BaseMixin from '../../_util/BaseMixin';
import '../assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0, no-alert: 0 */
/* eslint no-console:0, no-alert: 0 */
import '../assets/index.less';
import '../../vc-dialog/assets/index.less';

View File

@ -1,4 +1,4 @@
/* eslint react/no-multi-comp:0, no-console:0 */
/* eslint no-console:0 */
import BaseMixin from '../../_util/BaseMixin';
import '../assets/index.less';
import TreeSelect from '../src/index';

View File

@ -1,5 +1,3 @@
/* eslint react/no-multi-comp:0, no-console:0 */
import BaseMixin from '../../_util/BaseMixin';
import '../assets/index.less';
import TreeSelect from '../src/index';

View File

@ -1,5 +1,3 @@
/* eslint react/no-multi-comp:0, no-console:0 */
import '../assets/index.less';
import TreeSelect, { SHOW_PARENT } from '../index';
import { gData } from './util';

View File

@ -123,7 +123,7 @@ const BasePopup = {
_keyList: [],
_expandedKeyList: expandedKeyList,
// Cache `expandedKeyList` when tree is in filter. This is used in `getDerivedStateFromProps`
_cachedExpandedKeyList: [], // eslint-disable-line react/no-unused-state
_cachedExpandedKeyList: [],
_loadedKeys: [],
_prevProps: {},
};

View File

@ -58,7 +58,6 @@ export default {
mounted() {
this.$nextTick(() => {
if (this.supportServerRender) {
/* eslint react/no-did-mount-set-state:0 */
this.setState(
{
Component: this.getComponent(),

View File

@ -21,8 +21,8 @@ There are some major variables below, all less variables could be found in [Defa
@font-size-base: 14px; // major text font size
@heading-color: rgba(0, 0, 0, 0.85); // heading text color
@text-color: rgba(0, 0, 0, 0.65); // major text color
@text-color-secondary : rgba(0, 0, 0, .45); // secondary text color
@disabled-color : rgba(0, 0, 0, .25); // disable state color
@text-color-secondary: rgba(0, 0, 0, 0.45); // secondary text color
@disabled-color: rgba(0, 0, 0, 0.25); // disable state color
@border-radius-base: 4px; // major border radius
@border-color-base: #d9d9d9; // major border color
@box-shadow-base: 0 2px 8px rgba(0, 0, 0, 0.15); // major shadow for layers

View File

@ -21,8 +21,8 @@ antd 的样式使用了 [Less](http://lesscss.org/) 作为开发语言,并定
@font-size-base: 14px; // 主字号
@heading-color: rgba(0, 0, 0, 0.85); // 标题色
@text-color: rgba(0, 0, 0, 0.65); // 主文本色
@text-color-secondary : rgba(0, 0, 0, .45); // 次文本色
@disabled-color : rgba(0, 0, 0, .25); // 失效色
@text-color-secondary: rgba(0, 0, 0, 0.45); // 次文本色
@disabled-color: rgba(0, 0, 0, 0.25); // 失效色
@border-radius-base: 4px; // 组件/浮层圆角
@border-color-base: #d9d9d9; // 边框色
@box-shadow-base: 0 2px 8px rgba(0, 0, 0, 0.15); // 浮层阴影

1
types/empty.d.ts vendored
View File

@ -18,5 +18,4 @@ export declare class Empty extends AntdComponent {
* @type string | VNode
*/
image: string | VNode;
}

View File

@ -16,7 +16,7 @@ export declare class Tree extends AntdComponent {
*/
treeData: TreeNode[];
/**
/**
*
*@description Replace the title,key and children fields in treeNode with the corresponding fields in treeData
*/