mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-28 07:23:46 +08:00
Merge branch 'master' of https://github.com/ant-design/ant-design into feature-2.11
This commit is contained in:
commit
f03e5549bf
12
.babelrc
12
.babelrc
@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"presets": ["es2015", "react", "stage-0"],
|
"env": {
|
||||||
"plugins": [
|
"test": {
|
||||||
"add-module-exports"
|
"presets": ["es2015", "react", "stage-0"],
|
||||||
]
|
"plugins": [
|
||||||
|
"add-module-exports"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,6 +26,7 @@ _site
|
|||||||
_data
|
_data
|
||||||
dist
|
dist
|
||||||
/lib
|
/lib
|
||||||
|
/es
|
||||||
elasticsearch-*
|
elasticsearch-*
|
||||||
config/base.yaml
|
config/base.yaml
|
||||||
/.vscode/
|
/.vscode/
|
||||||
|
@ -17,6 +17,38 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 2.10.3
|
||||||
|
|
||||||
|
`2017-05-31`
|
||||||
|
|
||||||
|
- **Calendar**
|
||||||
|
- Fix disabledDate not be supported, and make supplement for the types and documentation. [#6074](https://github.com/ant-design/ant-design/issues/6074)
|
||||||
|
- Upgrade rc-calendar to 8.4.0, support Bulgarian, and user can select end date first. [commit/a4a6db](https://github.com/ant-design/ant-design/commit/a4a6db76de57ac2559a2be80208121ab5e168fbf)
|
||||||
|
- **Alert** Remove default margin-bottom. [commit/5ef482](https://github.com/ant-design/ant-design/commit/5ef48289747409b6d962f75627ddb11e2765f965)
|
||||||
|
- **Tabs** Fix inactive tab panel behavious. [#6237](https://github.com/ant-design/ant-design/issues/6237)
|
||||||
|
- **Layout** Fix children in the collapsed Sider not be hidden. [#6131](https://github.com/ant-design/ant-design/issues/6131)
|
||||||
|
- **Table** Fix table filter menu overflow issue. [#6245](https://github.com/ant-design/ant-design/issues/6245)
|
||||||
|
- **InputNumber** Fix hasFeedback misplaced validated icon. [#6289](https://github.com/ant-design/ant-design/issues/6289)
|
||||||
|
- **Typescript**
|
||||||
|
- Upgrade TypeScript to 2.3.x. [#6263](https://github.com/ant-design/ant-design/issues/6263)
|
||||||
|
- Add missing props in Table. [commit/acdc56](https://github.com/ant-design/ant-design/commit/acdc563a547c49960521b2b48cd5c707ac1e4cf2) [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254)
|
||||||
|
- Fix wrong type in Mention and Form. [pull/6268](https://github.com/ant-design/ant-design/pull/6268) [@jch254](https://github.com/jch254)
|
||||||
|
- Fix wrong type in Badge. [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254)
|
||||||
|
- Add missing props in Input related Components. [pull/6276](https://github.com/ant-design/ant-design/pull/6276/commits/94901de2e8c0a2ed6f62f5aa50c98994aad71844) [@panjiesw](https://github.com/panjiesw) [commit/220264](https://github.com/ant-design/ant-design/commit/2202648d6e1c53409ade2141955232922b0040d6#diff-26cb6da96d10397e18e7dbd6c5d8f7a1L265) [@clinyong](https://github.com/clinyong)
|
||||||
|
|
||||||
|
## 2.10.2
|
||||||
|
|
||||||
|
`2017-05-23`
|
||||||
|
|
||||||
|
- Fix `prop-types` warnings which due to upgrading React. [#5678](https://github.com/ant-design/ant-design/issues/5678)
|
||||||
|
- Fix `defaultValue` issue of DatePicker and RangePicker in showTime mode. [#6160](https://github.com/ant-design/ant-design/pull/6160)
|
||||||
|
- Fix style issue of TreeSelect. [#6137](https://github.com/ant-design/ant-design/issues/6137)
|
||||||
|
- Fix style issue of Input with prefix and addon. [#6144](https://github.com/ant-design/ant-design/issues/6144)
|
||||||
|
- Fix some bugs of `notification.destroy`. [#6161](https://github.com/ant-design/ant-design/issues/6161)
|
||||||
|
- Fix missing translations of Upload and Table. [#6218](https://github.com/ant-design/ant-design/issues/6218)
|
||||||
|
- Fix style issue of Cascader inside Input.Group. [#6208](https://github.com/ant-design/ant-design/issues/6208)
|
||||||
|
- Increase click area of Tree icons. [#6120](https://github.com/ant-design/ant-design/issues/6120)
|
||||||
|
|
||||||
## 2.10.1
|
## 2.10.1
|
||||||
|
|
||||||
`2017-05-14`
|
`2017-05-14`
|
||||||
|
@ -17,6 +17,38 @@ timeline: true
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 2.10.3
|
||||||
|
|
||||||
|
`2017-05-31`
|
||||||
|
|
||||||
|
- **Calendar**
|
||||||
|
- 修复了样式问题以支持 disabledDate,补充了 Type 定义及文档。[#6074](https://github.com/ant-design/ant-design/issues/6074)
|
||||||
|
- rc-calendar 依赖升级至 8.4.0,支持保加利亚语,支持首先选择结束日期。[commit/a4a6db](https://github.com/ant-design/ant-design/commit/a4a6db76de57ac2559a2be80208121ab5e168fbf)
|
||||||
|
- **Alert** 去掉了默认的下边距。[commit/5ef482](https://github.com/ant-design/ant-design/commit/5ef48289747409b6d962f75627ddb11e2765f965)
|
||||||
|
- **Tabs** 修复了隐藏标签下内容的表现问题。[#6237](https://github.com/ant-design/ant-design/issues/6237)
|
||||||
|
- **Layout** 修复了折叠侧边栏中的内容不能自动隐藏的问题。[#6131](https://github.com/ant-design/ant-design/issues/6131)
|
||||||
|
- **Table** 修复了 filter 被 Table 截断的问题。[#6245](https://github.com/ant-design/ant-design/issues/6245)
|
||||||
|
- **InputNumber** 修复了配置 hasFeedback 时校验结果图标位置有误的问题。[#6289](https://github.com/ant-design/ant-design/issues/6289)
|
||||||
|
- **Typescript**
|
||||||
|
- typescript 升级至 2.3.x。[#6263](https://github.com/ant-design/ant-design/issues/6263)
|
||||||
|
- 补充了 Table 的 type 定义. [commit/acdc56](https://github.com/ant-design/ant-design/commit/acdc563a547c49960521b2b48cd5c707ac1e4cf2) [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254)
|
||||||
|
- 修复了 Mention、Form 组件中错误的 type 定义. [pull/6268](https://github.com/ant-design/ant-design/pull/6268) [@jch254](https://github.com/jch254)
|
||||||
|
- 修复了 Badge 组件中错误的 type 定义. [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254)
|
||||||
|
- 补充了 Input 相关组件的 type 定义。[pull/6276](https://github.com/ant-design/ant-design/pull/6276/commits/94901de2e8c0a2ed6f62f5aa50c98994aad71844) [@panjiesw](https://github.com/panjiesw) [commit/220264](https://github.com/ant-design/ant-design/commit/2202648d6e1c53409ade2141955232922b0040d6#diff-26cb6da96d10397e18e7dbd6c5d8f7a1L265) [@clinyong](https://github.com/clinyong)
|
||||||
|
|
||||||
|
## 2.10.2
|
||||||
|
|
||||||
|
`2017-05-23`
|
||||||
|
|
||||||
|
- 修复了 React 升级引起的 `prop-types` 相关的 warning 问题。[#5678](https://github.com/ant-design/ant-design/issues/5678)
|
||||||
|
- 修复 DatePicker 和 RangePicker showTime 模式下 defaultValue 的问题。[#6160](https://github.com/ant-design/ant-design/pull/6160)
|
||||||
|
- 修复 TreeSelect 的样式问题。[#6137](https://github.com/ant-design/ant-design/issues/6137)
|
||||||
|
- 修复 包含 prefix 和 addon 的 Input 的样式问题。[#6144](https://github.com/ant-design/ant-design/issues/6144)
|
||||||
|
- 修复 `notification.destroy` 的 Bug。[#6161](https://github.com/ant-design/ant-design/issues/6161)
|
||||||
|
- 修复了 Upload 和 Table 组件中缺失的翻译。
|
||||||
|
- 修复了在 Input.Group 中的 Cascader 的样式问题。[#6208](https://github.com/ant-design/ant-design/issues/6208)
|
||||||
|
- 增大了 Tree 图标的可点击区域面积。
|
||||||
|
|
||||||
## 2.10.1
|
## 2.10.1
|
||||||
|
|
||||||
`2017-05-14`
|
`2017-05-14`
|
||||||
|
@ -29,7 +29,7 @@ An enterprise-class UI design language and React-based implementation.
|
|||||||
|
|
||||||
## Environment Support
|
## Environment Support
|
||||||
|
|
||||||
* Browser: Modern browsers and Internet Explorer 9+
|
* Modern browsers and Internet Explorer 9+ (with [polyfills](https://ant.design/docs/react/getting-started#Compatibility))
|
||||||
* Server-side Rendering
|
* Server-side Rendering
|
||||||
* [Electron](http://electron.atom.io/)
|
* [Electron](http://electron.atom.io/)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ function noop() {}
|
|||||||
function getDefaultTarget() {
|
function getDefaultTarget() {
|
||||||
return typeof window !== 'undefined' ?
|
return typeof window !== 'undefined' ?
|
||||||
window : null;
|
window : null;
|
||||||
};
|
}
|
||||||
|
|
||||||
// Affix
|
// Affix
|
||||||
export interface AffixProps {
|
export interface AffixProps {
|
||||||
|
@ -20,3 +20,9 @@ ReactDOM.render(
|
|||||||
<Alert message="Success Text" type="success" />
|
<Alert message="Success Text" type="success" />
|
||||||
, mountNode);
|
, mountNode);
|
||||||
````
|
````
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.ant-alert {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -24,4 +24,3 @@ title: Alert
|
|||||||
| onClose | 关闭时触发的回调函数 | Function | 无 |
|
| onClose | 关闭时触发的回调函数 | Function | 无 |
|
||||||
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
||||||
| banner | 是否用作顶部公告 | boolean | false |
|
| banner | 是否用作顶部公告 | boolean | false |
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
color: @alert-text-color;
|
color: @alert-text-color;
|
||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
margin-bottom: 10px;
|
|
||||||
|
|
||||||
&&-no-icon {
|
&&-no-icon {
|
||||||
padding: 8px 48px 8px 16px;
|
padding: 8px 48px 8px 16px;
|
||||||
@ -91,7 +90,6 @@
|
|||||||
padding: 16px 16px 16px 60px;
|
padding: 16px 16px 16px 60px;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: @border-radius-base;
|
border-radius: @border-radius-base;
|
||||||
margin-bottom: 10px;
|
|
||||||
color: @text-color;
|
color: @text-color;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import Select, { AbstractSelectProps, SelectValue, OptionProps, OptGroupProps }
|
|||||||
import Input from '../input';
|
import Input from '../input';
|
||||||
import InputElement from './InputElement';
|
import InputElement from './InputElement';
|
||||||
|
|
||||||
export interface DataSourceItemObject { value: string; text: string; };
|
export interface DataSourceItemObject { value: string; text: string; }
|
||||||
export type DataSourceItemType = string | DataSourceItemObject;
|
export type DataSourceItemType = string | DataSourceItemObject;
|
||||||
|
|
||||||
export interface InputProps {
|
export interface InputProps {
|
||||||
@ -23,7 +23,6 @@ export interface AutoCompleteProps extends AbstractSelectProps {
|
|||||||
defaultValue?: SelectValue;
|
defaultValue?: SelectValue;
|
||||||
dataSource: DataSourceItemType[];
|
dataSource: DataSourceItemType[];
|
||||||
optionLabelProp?: string;
|
optionLabelProp?: string;
|
||||||
filterOption?: boolean | ((inputValue: string, option: Object) => any);
|
|
||||||
onChange?: (value: SelectValue) => void;
|
onChange?: (value: SelectValue) => void;
|
||||||
onSelect?: (value: SelectValue, option: Object) => any;
|
onSelect?: (value: SelectValue, option: Object) => any;
|
||||||
children?: ValidInputElement |
|
children?: ValidInputElement |
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
line-height: @input-height-base;
|
||||||
}
|
}
|
||||||
&__placeholder {
|
&__placeholder {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
top: @input-height-base / 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,8 +36,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-lg {
|
&-lg {
|
||||||
.@{select-prefix-cls}-selection__placeholder {
|
.@{select-prefix-cls}-selection__rendered {
|
||||||
top: @input-height-lg / 2;
|
line-height: @input-height-lg;
|
||||||
}
|
}
|
||||||
.@{input-prefix-cls} {
|
.@{input-prefix-cls} {
|
||||||
.input-lg();
|
.input-lg();
|
||||||
@ -45,8 +45,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-sm {
|
&-sm {
|
||||||
.@{select-prefix-cls}-selection__placeholder {
|
.@{select-prefix-cls}-selection__rendered {
|
||||||
top: @input-height-sm / 2;
|
line-height: @input-height-sm;
|
||||||
}
|
}
|
||||||
.@{input-prefix-cls} {
|
.@{input-prefix-cls} {
|
||||||
.input-sm();
|
.input-sm();
|
||||||
|
@ -7,7 +7,7 @@ import warning from '../_util/warning';
|
|||||||
|
|
||||||
export interface BadgeProps {
|
export interface BadgeProps {
|
||||||
/** Number to show in badge */
|
/** Number to show in badge */
|
||||||
count: number | string;
|
count?: number | string;
|
||||||
showZero?: boolean;
|
showZero?: boolean;
|
||||||
/** Max count to show */
|
/** Max count to show */
|
||||||
overflowCount?: number;
|
overflowCount?: number;
|
||||||
@ -54,7 +54,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
|
|||||||
...restProps,
|
...restProps,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const isDot = dot || status;
|
const isDot = dot || status;
|
||||||
let displayCount = count > (overflowCount as number) ? `${overflowCount}+` : count;
|
let displayCount = (count as number) > (overflowCount as number) ? `${overflowCount}+` : count;
|
||||||
// dot mode don't need count
|
// dot mode don't need count
|
||||||
if (isDot) {
|
if (isDot) {
|
||||||
displayCount = '';
|
displayCount = '';
|
||||||
|
@ -13,7 +13,7 @@ export interface BreadcrumbProps {
|
|||||||
itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode;
|
itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
function getBreadcrumbName(route, params) {
|
function getBreadcrumbName(route, params) {
|
||||||
if (!route.breadcrumbName) {
|
if (!route.breadcrumbName) {
|
||||||
|
@ -43,3 +43,4 @@ moment.locale('zh-cn');
|
|||||||
| locale | set locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
| locale | set locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||||
| onPanelChange| callback when panel change | function(date: moment, mode: string) | - |
|
| onPanelChange| callback when panel change | function(date: moment, mode: string) | - |
|
||||||
| onSelect | callback when select date | function(date: moment) | - |
|
| onSelect | callback when select date | function(date: moment) | - |
|
||||||
|
| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | 无 |
|
||||||
|
@ -39,6 +39,7 @@ export interface CalendarProps {
|
|||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void;
|
onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void;
|
||||||
onSelect?: (date?: moment.Moment) => void;
|
onSelect?: (date?: moment.Moment) => void;
|
||||||
|
disabledDate?: (current: moment.Moment) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CalendarState {
|
export interface CalendarState {
|
||||||
|
@ -45,3 +45,4 @@ moment.locale('zh-cn');
|
|||||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||||
| onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 |
|
| onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 |
|
||||||
| onSelect | 点击选择日期回调 | function(date: moment) | 无 |
|
| onSelect | 点击选择日期回调 | function(date: moment) | 无 |
|
||||||
|
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 |
|
||||||
|
@ -125,18 +125,6 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-disabled-cell &-value {
|
|
||||||
cursor: not-allowed;
|
|
||||||
color: @disabled-color;
|
|
||||||
background: @disabled-bg;
|
|
||||||
border-radius: 0;
|
|
||||||
width: auto;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: @disabled-bg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-disabled-cell-first-of-row &-value {
|
&-disabled-cell-first-of-row &-value {
|
||||||
border-top-left-radius: @border-radius-base;
|
border-top-left-radius: @border-radius-base;
|
||||||
border-bottom-left-radius: @border-radius-base;
|
border-bottom-left-radius: @border-radius-base;
|
||||||
@ -254,4 +242,25 @@
|
|||||||
left: auto;
|
left: auto;
|
||||||
bottom: auto;
|
bottom: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-disabled-cell &-date {
|
||||||
|
&,
|
||||||
|
&:hover {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-disabled-cell:not(&-today) &-date {
|
||||||
|
&,
|
||||||
|
&:hover {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-disabled-cell &-value {
|
||||||
|
color: @disabled-color;
|
||||||
|
border-radius: 0;
|
||||||
|
width: auto;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,3 +23,4 @@ A card can be used to display content related to a single subject. The content c
|
|||||||
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
|
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - |
|
||||||
| bordered | Toggles rendering of the border around the card | boolean | true |
|
| bordered | Toggles rendering of the border around the card | boolean | true |
|
||||||
| bodyStyle | Inline style to apply to the card content | object | - |
|
| bodyStyle | Inline style to apply to the card content | object | - |
|
||||||
|
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false |
|
||||||
|
@ -24,3 +24,4 @@ cols: 1
|
|||||||
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
|
| extra | 卡片右上角的操作区域 | string\|ReactNode | - |
|
||||||
| bordered | 是否有边框 | boolean | true |
|
| bordered | 是否有边框 | boolean | true |
|
||||||
| bodyStyle | 内容区域自定义样式 | object | - |
|
| bodyStyle | 内容区域自定义样式 | object | - |
|
||||||
|
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false |
|
||||||
|
@ -5,6 +5,9 @@ exports[`renders ./components/cascader/demo/basic.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -13,9 +16,6 @@ exports[`renders ./components/cascader/demo/basic.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -27,6 +27,9 @@ exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] =
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -35,9 +38,6 @@ exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] =
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -50,13 +50,6 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = `
|
|||||||
style="width:270px;"
|
style="width:270px;"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
class="ant-input ant-cascader-input "
|
|
||||||
readonly=""
|
|
||||||
type="text"
|
|
||||||
value=""
|
|
||||||
/>
|
|
||||||
<span
|
<span
|
||||||
class="ant-cascader-picker-label"
|
class="ant-cascader-picker-label"
|
||||||
>
|
>
|
||||||
@ -74,6 +67,13 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = `
|
|||||||
)
|
)
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<input
|
||||||
|
autocomplete="off"
|
||||||
|
class="ant-input ant-cascader-input "
|
||||||
|
readonly=""
|
||||||
|
type="text"
|
||||||
|
value=""
|
||||||
|
/>
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
||||||
/>
|
/>
|
||||||
@ -100,6 +100,11 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
>
|
||||||
|
Zhejiang / Hangzhou / West Lake
|
||||||
|
</span>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -107,11 +112,6 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
>
|
|
||||||
Zhejiang / Hangzhou / West Lake
|
|
||||||
</span>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
||||||
/>
|
/>
|
||||||
@ -126,6 +126,9 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -134,9 +137,6 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -148,6 +148,9 @@ exports[`renders ./components/cascader/demo/hover.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -156,9 +159,6 @@ exports[`renders ./components/cascader/demo/hover.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -170,6 +170,9 @@ exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -178,9 +181,6 @@ exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -192,6 +192,9 @@ exports[`renders ./components/cascader/demo/search.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -199,9 +202,6 @@ exports[`renders ./components/cascader/demo/search.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -214,6 +214,9 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input ant-input-lg"
|
class="ant-input ant-cascader-input ant-input-lg"
|
||||||
@ -222,9 +225,6 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -235,6 +235,9 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -243,9 +246,6 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
@ -256,6 +256,9 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input ant-input-sm"
|
class="ant-input ant-cascader-input ant-input-sm"
|
||||||
@ -264,9 +267,6 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
|
@ -330,6 +330,9 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
|||||||
style={style}
|
style={style}
|
||||||
className={pickerCls}
|
className={pickerCls}
|
||||||
>
|
>
|
||||||
|
<span className={`${prefixCls}-picker-label`}>
|
||||||
|
{this.getLabel()}
|
||||||
|
</span>
|
||||||
<Input
|
<Input
|
||||||
{...inputProps}
|
{...inputProps}
|
||||||
ref="input"
|
ref="input"
|
||||||
@ -344,9 +347,6 @@ export default class Cascader extends React.Component<CascaderProps, any> {
|
|||||||
onKeyDown={this.handleKeyDown}
|
onKeyDown={this.handleKeyDown}
|
||||||
onChange={showSearch ? this.handleInputChange : undefined}
|
onChange={showSearch ? this.handleInputChange : undefined}
|
||||||
/>
|
/>
|
||||||
<span className={`${prefixCls}-picker-label`}>
|
|
||||||
{this.getLabel()}
|
|
||||||
</span>
|
|
||||||
{clearIcon}
|
{clearIcon}
|
||||||
<Icon type="down" className={arrowCls} />
|
<Icon type="down" className={arrowCls} />
|
||||||
</span>
|
</span>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
background-color: transparent!important;
|
background-color: transparent!important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 1;
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ export interface AbstractCheckboxProps {
|
|||||||
onMouseEnter?: React.MouseEventHandler<any>;
|
onMouseEnter?: React.MouseEventHandler<any>;
|
||||||
onMouseLeave?: React.MouseEventHandler<any>;
|
onMouseLeave?: React.MouseEventHandler<any>;
|
||||||
value?: any;
|
value?: any;
|
||||||
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CheckboxProps extends AbstractCheckboxProps {
|
export interface CheckboxProps extends AbstractCheckboxProps {
|
||||||
|
@ -33,7 +33,7 @@ function pickerValueAdapter(value?: moment.Moment | moment.Moment[]): moment.Mom
|
|||||||
|
|
||||||
export default class RangePicker extends React.Component<any, any> {
|
export default class RangePicker extends React.Component<any, any> {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
antLocale: PropTypes.object,
|
antLocale: PropTypes.object,
|
||||||
};
|
};
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
prefixCls: 'ant-calendar',
|
prefixCls: 'ant-calendar',
|
||||||
@ -56,6 +56,7 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
this.state = {
|
this.state = {
|
||||||
value,
|
value,
|
||||||
open: props.open,
|
open: props.open,
|
||||||
|
hoverValue: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +79,8 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
this.handleChange([]);
|
this.handleChange([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearHoverValue = () => this.setState({ hoverValue: [] });
|
||||||
|
|
||||||
handleChange = (value: moment.Moment[]) => {
|
handleChange = (value: moment.Moment[]) => {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
if (!('value' in props)) {
|
if (!('value' in props)) {
|
||||||
@ -100,6 +103,8 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
|
|
||||||
handleShowDateChange = showDate => this.setState({ showDate });
|
handleShowDateChange = showDate => this.setState({ showDate });
|
||||||
|
|
||||||
|
handleHoverChange = hoverValue => this.setState({ hoverValue });
|
||||||
|
|
||||||
setValue(value) {
|
setValue(value) {
|
||||||
this.handleChange(value);
|
this.handleChange(value);
|
||||||
if (!this.props.showTime) {
|
if (!this.props.showTime) {
|
||||||
@ -115,7 +120,16 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
|
|
||||||
const operations = Object.keys(ranges).map((range) => {
|
const operations = Object.keys(ranges).map((range) => {
|
||||||
const value = ranges[range];
|
const value = ranges[range];
|
||||||
return <a key={range} onClick={() => this.setValue(value)}>{range}</a>;
|
return (
|
||||||
|
<a
|
||||||
|
key={range}
|
||||||
|
onClick={() => this.setValue(value)}
|
||||||
|
onMouseEnter={() => this.setState({ hoverValue: value })}
|
||||||
|
onMouseLeave={this.clearHoverValue}
|
||||||
|
>
|
||||||
|
{range}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div className={`${prefixCls}-range-quick-selector`}>
|
<div className={`${prefixCls}-range-quick-selector`}>
|
||||||
@ -126,7 +140,7 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { state, props, context } = this;
|
const { state, props, context } = this;
|
||||||
const { value, showDate, open } = state;
|
const { value, showDate, hoverValue, open } = state;
|
||||||
const localeCode = getLocaleCode(context);
|
const localeCode = getLocaleCode(context);
|
||||||
if (value && localeCode) {
|
if (value && localeCode) {
|
||||||
if (value[0]) {
|
if (value[0]) {
|
||||||
@ -138,9 +152,10 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
disabledDate, disabledTime, showTime, showToday,
|
prefixCls, popupStyle, style,
|
||||||
ranges, prefixCls, popupStyle,
|
disabledDate, disabledTime,
|
||||||
style, onOk, locale, format,
|
showTime, showToday,
|
||||||
|
ranges, onOk, locale, format,
|
||||||
} = props;
|
} = props;
|
||||||
warning(!('onOK' in props), 'It should be `RangePicker[onOk]`, instead of `onOK`!');
|
warning(!('onOK' in props), 'It should be `RangePicker[onOk]`, instead of `onOK`!');
|
||||||
|
|
||||||
@ -182,6 +197,8 @@ export default class RangePicker extends React.Component<any, any> {
|
|||||||
onOk={onOk}
|
onOk={onOk}
|
||||||
value={showDate || pickerValueAdapter(props.defaultPickerValue) || pickerValueAdapter(moment())}
|
value={showDate || pickerValueAdapter(props.defaultPickerValue) || pickerValueAdapter(moment())}
|
||||||
onValueChange={this.handleShowDateChange}
|
onValueChange={this.handleShowDateChange}
|
||||||
|
hoverValue={hoverValue}
|
||||||
|
onHoverChange={this.handleHoverChange}
|
||||||
showToday={showToday}
|
showToday={showToday}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -41,6 +41,25 @@ describe('RangePicker', () => {
|
|||||||
.toMatchSnapshot();
|
.toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('highlight range when hover presetted range', () => {
|
||||||
|
const wrapper = mount(
|
||||||
|
<RangePicker
|
||||||
|
ranges={{
|
||||||
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||||
|
}}
|
||||||
|
getCalendarContainer={trigger => trigger}
|
||||||
|
format="YYYY/MM/DD"
|
||||||
|
open
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
let rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||||
|
rangeCalendarWrapper.find('.ant-calendar-range-quick-selector a')
|
||||||
|
.simulate('mouseEnter');
|
||||||
|
rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||||
|
expect(rangeCalendarWrapper.find('.ant-calendar-selected-day').length).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
// issue: https://github.com/ant-design/ant-design/issues/5872
|
// issue: https://github.com/ant-design/ant-design/issues/5872
|
||||||
it('should not throw error when value is reset to `[]`', () => {
|
it('should not throw error when value is reset to `[]`', () => {
|
||||||
const birthday = moment('2000-01-01', 'YYYY-MM-DD');
|
const birthday = moment('2000-01-01', 'YYYY-MM-DD');
|
||||||
@ -53,7 +72,7 @@ describe('RangePicker', () => {
|
|||||||
);
|
);
|
||||||
wrapper.setProps({ value: [] });
|
wrapper.setProps({ value: [] });
|
||||||
const rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
const rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent());
|
||||||
expect(() => rangeCalendarWrapper.find('.ant-calendar-today').simulate('click').simulate('click'))
|
expect(() => rangeCalendarWrapper.find('.ant-calendar-today').at(0).simulate('click').simulate('click'))
|
||||||
.not.toThrow();
|
.not.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker.
|
|||||||
| popupStyle | to customize the style of the popup calendar | object | {} |
|
| popupStyle | to customize the style of the popup calendar | object | {} |
|
||||||
| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | string | - |
|
| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | string | - |
|
||||||
| locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
| locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||||
| disabledDate | to specify the date that cannot be selected | function | - |
|
| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | - |
|
||||||
| getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - |
|
| getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - |
|
||||||
| open | open state of picker | boolean | - |
|
| open | open state of picker | boolean | - |
|
||||||
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
|
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - |
|
||||||
|
@ -43,7 +43,7 @@ moment.locale('zh-cn');
|
|||||||
| popupStyle | 格外的弹出日历样式 | object | {} |
|
| popupStyle | 格外的弹出日历样式 | object | {} |
|
||||||
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
||||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) |
|
||||||
| disabledDate | 不可选择的日期 | function | 无 |
|
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 |
|
||||||
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
|
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
|
||||||
| open | 控制弹层是否展开 | boolean | - |
|
| open | 控制弹层是否展开 | boolean | - |
|
||||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
| onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 |
|
||||||
|
@ -30,6 +30,31 @@ export interface FormProps {
|
|||||||
hideRequiredMark?: boolean;
|
hideRequiredMark?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ValidationRule = {
|
||||||
|
/** validation error message */
|
||||||
|
message?: string;
|
||||||
|
/** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */
|
||||||
|
type?: string;
|
||||||
|
/** indicates whether field is required */
|
||||||
|
required?: boolean;
|
||||||
|
/** treat required fields that only contain whitespace as errors */
|
||||||
|
whitespace?: boolean;
|
||||||
|
/** validate the exact length of a field */
|
||||||
|
len?: number;
|
||||||
|
/** validate the min length of a field */
|
||||||
|
min?: number;
|
||||||
|
/** validate the max length of a field */
|
||||||
|
max?: number;
|
||||||
|
/** validate the value from a list of possible values */
|
||||||
|
enum?: string | string[];
|
||||||
|
/** validate from a regular expression */
|
||||||
|
pattern?: RegExp;
|
||||||
|
/** transform a value before validation */
|
||||||
|
transform?: (value: any) => any;
|
||||||
|
/** custom validate function (Note: callback must be called) */
|
||||||
|
validator?: (rule: any, value: any, callback: any, source?: any, options?: any) => any;
|
||||||
|
};
|
||||||
|
|
||||||
export type ValidateCallback = (erros: any, values: any) => void;
|
export type ValidateCallback = (erros: any, values: any) => void;
|
||||||
|
|
||||||
// function create
|
// function create
|
||||||
@ -74,7 +99,7 @@ export type WrappedFormUtils = {
|
|||||||
/** 校验子节点值的时机 */
|
/** 校验子节点值的时机 */
|
||||||
validateTrigger?: string | string[];
|
validateTrigger?: string | string[];
|
||||||
/** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */
|
/** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */
|
||||||
rules?: Array<any>;
|
rules?: ValidationRule[];
|
||||||
/** 是否和其他控件互斥,特别用于 Radio 单选控件 */
|
/** 是否和其他控件互斥,特别用于 Radio 单选控件 */
|
||||||
exclusive?: boolean;
|
exclusive?: boolean;
|
||||||
}): (node: React.ReactNode) => React.ReactNode;
|
}): (node: React.ReactNode) => React.ReactNode;
|
||||||
|
@ -1232,6 +1232,11 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
|
|||||||
class="ant-cascader-picker"
|
class="ant-cascader-picker"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
>
|
||||||
|
Zhejiang / Hangzhou / West Lake
|
||||||
|
</span>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input ant-input-lg"
|
class="ant-input ant-cascader-input ant-input-lg"
|
||||||
@ -1241,11 +1246,6 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
>
|
|
||||||
Zhejiang / Hangzhou / West Lake
|
|
||||||
</span>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
class="anticon anticon-cross-circle ant-cascader-picker-clear"
|
||||||
/>
|
/>
|
||||||
@ -1277,51 +1277,55 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
|
|||||||
class="ant-form-item-control "
|
class="ant-form-item-control "
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-input-wrapper ant-input-group"
|
class="ant-input-group-wrapper"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-input-group-addon"
|
class="ant-input-wrapper ant-input-group"
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
class="icp-selector ant-select ant-select-enabled"
|
class="ant-input-group-addon"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-autocomplete="list"
|
class="icp-selector ant-select ant-select-enabled"
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
class="ant-select-selection
|
|
||||||
ant-select-selection--single"
|
|
||||||
role="combobox"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-select-selection__rendered"
|
aria-autocomplete="list"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="true"
|
||||||
|
class="ant-select-selection
|
||||||
|
ant-select-selection--single"
|
||||||
|
role="combobox"
|
||||||
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-select-selection-selected-value"
|
class="ant-select-selection__rendered"
|
||||||
style="display:block;opacity:1;"
|
|
||||||
title="+86"
|
|
||||||
>
|
>
|
||||||
+86
|
<div
|
||||||
|
class="ant-select-selection-selected-value"
|
||||||
|
style="display:block;opacity:1;"
|
||||||
|
title="+86"
|
||||||
|
>
|
||||||
|
+86
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span
|
||||||
|
class="ant-select-arrow"
|
||||||
|
style="user-select:none;-webkit-user-select:none;"
|
||||||
|
unselectable="unselectable"
|
||||||
|
>
|
||||||
|
<b />
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span
|
|
||||||
class="ant-select-arrow"
|
|
||||||
style="user-select:none;-webkit-user-select:none;"
|
|
||||||
unselectable="unselectable"
|
|
||||||
>
|
|
||||||
<b />
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</span>
|
||||||
|
<input
|
||||||
|
class="ant-input ant-input-lg"
|
||||||
|
data-__meta="[object Object]"
|
||||||
|
id="phone"
|
||||||
|
type="text"
|
||||||
|
value=""
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
<input
|
|
||||||
class="ant-input ant-input-lg"
|
|
||||||
data-__meta="[object Object]"
|
|
||||||
id="phone"
|
|
||||||
type="text"
|
|
||||||
value=""
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +17,7 @@ export interface InputNumberProps {
|
|||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class InputNumber extends React.Component<InputNumberProps, any> {
|
export default class InputNumber extends React.Component<InputNumberProps, any> {
|
||||||
|
@ -113,6 +113,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
border-radius: 0 @border-radius-base @border-radius-base 0;
|
border-radius: 0 @border-radius-base @border-radius-base 0;
|
||||||
transition: opacity 0.24s linear 0.1s;
|
transition: opacity 0.24s linear 0.1s;
|
||||||
|
z-index: 2; // https://github.com/ant-design/ant-design/issues/6289
|
||||||
}
|
}
|
||||||
|
|
||||||
&-handler-wrap:hover &-handler {
|
&-handler-wrap:hover &-handler {
|
||||||
|
@ -31,7 +31,7 @@ function clearNextFrameAction(nextFrameId) {
|
|||||||
export interface AutoSizeType {
|
export interface AutoSizeType {
|
||||||
minRows?: number;
|
minRows?: number;
|
||||||
maxRows?: number;
|
maxRows?: number;
|
||||||
};
|
}
|
||||||
|
|
||||||
export interface InputProps {
|
export interface InputProps {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
@ -59,6 +59,7 @@ export interface InputProps {
|
|||||||
prefix?: React.ReactNode;
|
prefix?: React.ReactNode;
|
||||||
suffix?: React.ReactNode;
|
suffix?: React.ReactNode;
|
||||||
spellCheck?: boolean;
|
spellCheck?: boolean;
|
||||||
|
autoFocus?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Input extends Component<InputProps, any> {
|
export default class Input extends Component<InputProps, any> {
|
||||||
@ -175,18 +176,23 @@ export default class Input extends Component<InputProps, any> {
|
|||||||
</span>
|
</span>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
const className = classNames({
|
const className = classNames(`${props.prefixCls}-wrapper`, {
|
||||||
[`${props.prefixCls}-wrapper`]: true,
|
|
||||||
[wrapperClassName]: (addonBefore || addonAfter),
|
[wrapperClassName]: (addonBefore || addonAfter),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
const node = (
|
||||||
<span className={className}>
|
<span className={className}>
|
||||||
{addonBefore}
|
{addonBefore}
|
||||||
{children}
|
{children}
|
||||||
{addonAfter}
|
{addonAfter}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Need another wrapper for changing display:table to display:inline-block
|
||||||
|
if (addonBefore || addonAfter) {
|
||||||
|
return <span className={`${props.prefixCls}-group-wrapper`}>{node}</span>;
|
||||||
|
}
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLabeledIcon(children) {
|
renderLabeledIcon(children) {
|
||||||
|
@ -15,6 +15,7 @@ export interface SearchProps {
|
|||||||
size?: 'large' | 'default' | 'small';
|
size?: 'large' | 'default' | 'small';
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Search extends React.Component<SearchProps, any> {
|
export default class Search extends React.Component<SearchProps, any> {
|
||||||
|
@ -6,129 +6,141 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
|
|||||||
style="margin-bottom:16px;"
|
style="margin-bottom:16px;"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-input-wrapper ant-input-group"
|
class="ant-input-group-wrapper"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-input-group-addon"
|
class="ant-input-wrapper ant-input-group"
|
||||||
>
|
>
|
||||||
Http://
|
<span
|
||||||
</span>
|
class="ant-input-group-addon"
|
||||||
<input
|
|
||||||
class="ant-input"
|
|
||||||
type="text"
|
|
||||||
value="mysite"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="ant-input-group-addon"
|
|
||||||
>
|
|
||||||
.com
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
style="margin-bottom:16px;"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="ant-input-wrapper ant-input-group"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="ant-input-group-addon"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-select ant-select-enabled"
|
|
||||||
style="width:80px;"
|
|
||||||
>
|
>
|
||||||
<div
|
Http://
|
||||||
aria-autocomplete="list"
|
</span>
|
||||||
aria-expanded="false"
|
<input
|
||||||
aria-haspopup="true"
|
class="ant-input"
|
||||||
class="ant-select-selection
|
type="text"
|
||||||
ant-select-selection--single"
|
value="mysite"
|
||||||
role="combobox"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-select-selection__rendered"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-select-selection-selected-value"
|
|
||||||
style="display:block;opacity:1;"
|
|
||||||
title="Http://"
|
|
||||||
>
|
|
||||||
Http://
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span
|
|
||||||
class="ant-select-arrow"
|
|
||||||
style="user-select:none;-webkit-user-select:none;"
|
|
||||||
unselectable="unselectable"
|
|
||||||
>
|
|
||||||
<b />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<input
|
|
||||||
class="ant-input"
|
|
||||||
type="text"
|
|
||||||
value="mysite"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="ant-input-group-addon"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-select ant-select-enabled"
|
|
||||||
style="width:70px;"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
aria-autocomplete="list"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
class="ant-select-selection
|
|
||||||
ant-select-selection--single"
|
|
||||||
role="combobox"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-select-selection__rendered"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="ant-select-selection-selected-value"
|
|
||||||
style="display:block;opacity:1;"
|
|
||||||
title=".com"
|
|
||||||
>
|
|
||||||
.com
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span
|
|
||||||
class="ant-select-arrow"
|
|
||||||
style="user-select:none;-webkit-user-select:none;"
|
|
||||||
unselectable="unselectable"
|
|
||||||
>
|
|
||||||
<b />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
style="margin-bottom:16px;"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="ant-input-wrapper ant-input-group"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
class="ant-input"
|
|
||||||
type="text"
|
|
||||||
value="mysite"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="ant-input-group-addon"
|
|
||||||
>
|
|
||||||
<i
|
|
||||||
class="anticon anticon-setting"
|
|
||||||
/>
|
/>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-addon"
|
||||||
|
>
|
||||||
|
.com
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="margin-bottom:16px;"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-wrapper"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-wrapper ant-input-group"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-addon"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-select ant-select-enabled"
|
||||||
|
style="width:80px;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-autocomplete="list"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="true"
|
||||||
|
class="ant-select-selection
|
||||||
|
ant-select-selection--single"
|
||||||
|
role="combobox"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-select-selection__rendered"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-select-selection-selected-value"
|
||||||
|
style="display:block;opacity:1;"
|
||||||
|
title="Http://"
|
||||||
|
>
|
||||||
|
Http://
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="ant-select-arrow"
|
||||||
|
style="user-select:none;-webkit-user-select:none;"
|
||||||
|
unselectable="unselectable"
|
||||||
|
>
|
||||||
|
<b />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
class="ant-input"
|
||||||
|
type="text"
|
||||||
|
value="mysite"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-addon"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-select ant-select-enabled"
|
||||||
|
style="width:70px;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-autocomplete="list"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="true"
|
||||||
|
class="ant-select-selection
|
||||||
|
ant-select-selection--single"
|
||||||
|
role="combobox"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-select-selection__rendered"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-select-selection-selected-value"
|
||||||
|
style="display:block;opacity:1;"
|
||||||
|
title=".com"
|
||||||
|
>
|
||||||
|
.com
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="ant-select-arrow"
|
||||||
|
style="user-select:none;-webkit-user-select:none;"
|
||||||
|
unselectable="unselectable"
|
||||||
|
>
|
||||||
|
<b />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="margin-bottom:16px;"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-wrapper"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-input-wrapper ant-input-group"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
class="ant-input"
|
||||||
|
type="text"
|
||||||
|
value="mysite"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="ant-input-group-addon"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="anticon anticon-setting"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -615,6 +627,9 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
|
|||||||
style="width:70%;"
|
style="width:70%;"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
class="ant-cascader-picker-label"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class="ant-input ant-cascader-input "
|
class="ant-input ant-cascader-input "
|
||||||
@ -623,9 +638,6 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
|
|||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="ant-cascader-picker-label"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
class="anticon anticon-down ant-cascader-picker-arrow"
|
class="anticon anticon-down ant-cascader-picker-arrow"
|
||||||
/>
|
/>
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
//== Style for input-group: input with label, with button or dropdown...
|
//== Style for input-group: input with label, with button or dropdown...
|
||||||
.@{ant-prefix}-input-group {
|
.@{ant-prefix}-input-group {
|
||||||
.input-group(~"@{ant-prefix}-input");
|
.input-group(~"@{ant-prefix}-input");
|
||||||
|
&-wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input with affix: prefix or suffix
|
// Input with affix: prefix or suffix
|
||||||
|
@ -168,7 +168,7 @@ export default class Sider extends React.Component<SiderProps, any> {
|
|||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div className={siderCls} {...divProps} style={divStyle}>
|
<div className={siderCls} {...divProps} style={divStyle}>
|
||||||
{this.props.children}
|
<div className={`${prefixCls}-children`}>{this.props.children}</div>
|
||||||
{collapsible || (this.state.below && zeroWidthTrigger) ? triggerDom : null}
|
{collapsible || (this.state.below && zeroWidthTrigger) ? triggerDom : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { SiderProps } from './Sider';
|
||||||
|
|
||||||
export interface BasicProps {
|
export interface BasicProps {
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
@ -8,7 +9,7 @@ export interface BasicProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generator(props) {
|
function generator(props) {
|
||||||
return (Basic) : any => {
|
return (Basic): any => {
|
||||||
return class Adapter extends React.Component<BasicProps, any> {
|
return class Adapter extends React.Component<BasicProps, any> {
|
||||||
static Header: any;
|
static Header: any;
|
||||||
static Footer: any;
|
static Footer: any;
|
||||||
@ -40,7 +41,12 @@ class Basic extends React.Component<BasicProps, any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Layout = generator({
|
const Layout: React.ComponentClass<BasicProps> & {
|
||||||
|
Header: React.ComponentClass<BasicProps>;
|
||||||
|
Footer: React.ComponentClass<BasicProps>;
|
||||||
|
Content: React.ComponentClass<BasicProps>;
|
||||||
|
Sider: React.ComponentClass<SiderProps>;
|
||||||
|
} = generator({
|
||||||
prefixCls: 'ant-layout',
|
prefixCls: 'ant-layout',
|
||||||
})(Basic);
|
})(Basic);
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ export default {
|
|||||||
filterConfirm: 'OK',
|
filterConfirm: 'OK',
|
||||||
filterReset: 'Resetar',
|
filterReset: 'Resetar',
|
||||||
emptyText: 'Não há dados',
|
emptyText: 'Não há dados',
|
||||||
|
selectAll: 'Selecionar página atual',
|
||||||
|
selectInvert: 'Inverter seleção',
|
||||||
},
|
},
|
||||||
Modal: {
|
Modal: {
|
||||||
okText: 'OK',
|
okText: 'OK',
|
||||||
@ -37,4 +39,10 @@ export default {
|
|||||||
Select: {
|
Select: {
|
||||||
notFoundContent: 'Não encontrado',
|
notFoundContent: 'Não encontrado',
|
||||||
},
|
},
|
||||||
|
Upload: {
|
||||||
|
uploading: 'Enviando...',
|
||||||
|
removeFile: 'Remover arquivo',
|
||||||
|
uploadError: 'Erro no envio',
|
||||||
|
previewFile: 'Visualizar arquivo',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@ import shallowequal from 'shallowequal';
|
|||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
export interface MentionProps {
|
export interface MentionProps {
|
||||||
prefixCls: string;
|
prefixCls?: string;
|
||||||
suggestionStyle?: React.CSSProperties;
|
suggestionStyle?: React.CSSProperties;
|
||||||
suggestions?: Array<any>;
|
suggestions?: Array<any>;
|
||||||
onSearchChange?: Function;
|
onSearchChange?: Function;
|
||||||
@ -54,7 +54,8 @@ export default class Mention extends React.Component<MentionProps, MentionState>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps({ suggestions }) {
|
componentWillReceiveProps(nextProps: MentionProps) {
|
||||||
|
const { suggestions } = nextProps;
|
||||||
if (!shallowequal(suggestions, this.props.suggestions)) {
|
if (!shallowequal(suggestions, this.props.suggestions)) {
|
||||||
this.setState({
|
this.setState({
|
||||||
suggestions,
|
suggestions,
|
||||||
|
@ -36,6 +36,7 @@ export interface ModalProps {
|
|||||||
maskTransitionName?: string;
|
maskTransitionName?: string;
|
||||||
transitionName?: string;
|
transitionName?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
getContainer?: (instance: React.ReactInstance) => HTMLElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModalContext {
|
export interface ModalContext {
|
||||||
|
@ -32,6 +32,7 @@ and so on.
|
|||||||
| style | Style of floating layer, typically used at least for adjusting the position. | object | - |
|
| style | Style of floating layer, typically used at least for adjusting the position. | object | - |
|
||||||
| wrapClassName | The class name of the container of the modal dialog | string | - |
|
| wrapClassName | The class name of the container of the modal dialog | string | - |
|
||||||
| afterClose | Specify a function that will be called when modal is closed completely. | function | - |
|
| afterClose | Specify a function that will be called when modal is closed completely. | function | - |
|
||||||
|
| getContainer | Return the mount node for Modal | (instance): HTMLElement | () => document.body |
|
||||||
|
|
||||||
#### Destroy on close
|
#### Destroy on close
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import Modal, { ModalFuncProps } from './Modal';
|
|||||||
import confirm from './confirm';
|
import confirm from './confirm';
|
||||||
import assign from 'object-assign';
|
import assign from 'object-assign';
|
||||||
|
|
||||||
export { ModalFuncProps }
|
export { ModalFuncProps };
|
||||||
|
|
||||||
Modal.info = function (props: ModalFuncProps) {
|
Modal.info = function (props: ModalFuncProps) {
|
||||||
const config = assign({}, {
|
const config = assign({}, {
|
||||||
|
@ -31,6 +31,7 @@ title: Modal
|
|||||||
| style | 可用于设置浮层的样式,调整浮层位置等 | object | - |
|
| style | 可用于设置浮层的样式,调整浮层位置等 | object | - |
|
||||||
| wrapClassName | 对话框外层容器的类名 | string | - |
|
| wrapClassName | 对话框外层容器的类名 | string | - |
|
||||||
| afterClose | Modal 完全关闭后的回调 | function | 无 |
|
| afterClose | Modal 完全关闭后的回调 | function | 无 |
|
||||||
|
| getContainer | 指定 Modal 挂载的 HTML 节点 | (instance): HTMLElement | () => document.body |
|
||||||
|
|
||||||
#### 清空旧数据
|
#### 清空旧数据
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ abstract class Pagination extends React.Component<PaginationProps, any> {
|
|||||||
selectPrefixCls: 'ant-select',
|
selectPrefixCls: 'ant-select',
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract getLocale()
|
abstract getLocale();
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className, size, ...restProps } = this.props;
|
const { className, size, ...restProps } = this.props;
|
||||||
|
@ -28,7 +28,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getLocale()
|
abstract getLocale();
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: PopconfirmProps) {
|
componentWillReceiveProps(nextProps: PopconfirmProps) {
|
||||||
if ('visible' in nextProps) {
|
if ('visible' in nextProps) {
|
||||||
|
@ -16,6 +16,11 @@ export interface AbstractSelectProps {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
dropdownClassName?: string;
|
||||||
|
dropdownStyle?: React.CSSProperties;
|
||||||
|
dropdownMenuStyle?: React.CSSProperties;
|
||||||
|
onSearch?: (value: string) => any;
|
||||||
|
filterOption?: boolean | ((inputValue: string, option: Object) => any);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LabeledValue {
|
export interface LabeledValue {
|
||||||
@ -33,18 +38,14 @@ export interface SelectProps extends AbstractSelectProps {
|
|||||||
tags?: boolean;
|
tags?: boolean;
|
||||||
combobox?: boolean;
|
combobox?: boolean;
|
||||||
optionLabelProp?: string;
|
optionLabelProp?: string;
|
||||||
filterOption?: boolean | ((inputValue: string, option: Object) => any);
|
|
||||||
onChange?: (value: SelectValue) => void;
|
onChange?: (value: SelectValue) => void;
|
||||||
onSelect?: (value: SelectValue, option: Object) => any;
|
onSelect?: (value: SelectValue, option: Object) => any;
|
||||||
onDeselect?: (value: SelectValue) => any;
|
onDeselect?: (value: SelectValue) => any;
|
||||||
onSearch?: (value: string) => any;
|
|
||||||
dropdownMatchSelectWidth?: boolean;
|
dropdownMatchSelectWidth?: boolean;
|
||||||
optionFilterProp?: string;
|
optionFilterProp?: string;
|
||||||
defaultActiveFirstOption?: boolean;
|
defaultActiveFirstOption?: boolean;
|
||||||
labelInValue?: boolean;
|
labelInValue?: boolean;
|
||||||
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
||||||
dropdownStyle?: React.CSSProperties;
|
|
||||||
dropdownMenuStyle?: React.CSSProperties;
|
|
||||||
tokenSeparators?: string[];
|
tokenSeparators?: string[];
|
||||||
getInputElement?: () => React.ReactElement<any>;
|
getInputElement?: () => React.ReactElement<any>;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ title: Select
|
|||||||
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索 | string | value |
|
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索 | string | value |
|
||||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) |
|
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) |
|
||||||
| size | 选择框大小,可选 `large` `small` | string | default |
|
| size | 选择框大小,可选 `large` `small` | string | default |
|
||||||
| showSearch | 在选择框中显示搜索框 | boolean | false |
|
| showSearch | 使单选模式可搜索 | boolean | false |
|
||||||
| disabled | 是否禁用 | boolean | false |
|
| disabled | 是否禁用 | boolean | false |
|
||||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
|
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
|
||||||
| dropdownStyle | 下拉菜单的 style 属性 | object | - |
|
| dropdownStyle | 下拉菜单的 style 属性 | object | - |
|
||||||
|
@ -227,6 +227,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-search__field__placeholder {
|
&-search__field__placeholder {
|
||||||
@ -298,7 +299,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.@{select-prefix-cls}-selection__choice {
|
.@{select-prefix-cls}-selection__choice {
|
||||||
background-color: #f3f3f3;
|
color: @tag-default-color;
|
||||||
|
background-color: @tag-default-bg;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
|
|
||||||
&-dot {
|
&-dot {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: inline-block;
|
||||||
.square(@spin-dot-size);
|
.square(@spin-dot-size);
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
animation: antRotate 1.2s infinite linear;
|
animation: antRotate 1.2s infinite linear;
|
||||||
|
@ -294,6 +294,11 @@
|
|||||||
@table-padding-vertical: 16px;
|
@table-padding-vertical: 16px;
|
||||||
@table-padding-horizontal: 8px;
|
@table-padding-horizontal: 8px;
|
||||||
|
|
||||||
|
// Tag
|
||||||
|
// --
|
||||||
|
@tag-default-bg: #f3f3f3;
|
||||||
|
@tag-default-color: @text-color;
|
||||||
|
|
||||||
// TimePicker
|
// TimePicker
|
||||||
// ---
|
// ---
|
||||||
@time-picker-panel-column-width: 56px;
|
@time-picker-panel-column-width: 56px;
|
||||||
|
@ -10,6 +10,8 @@ export interface ColumnProps<T> {
|
|||||||
onFilter?: (value: any, record: T) => boolean;
|
onFilter?: (value: any, record: T) => boolean;
|
||||||
filterMultiple?: boolean;
|
filterMultiple?: boolean;
|
||||||
filterDropdown?: React.ReactNode;
|
filterDropdown?: React.ReactNode;
|
||||||
|
filterDropdownVisible?: boolean;
|
||||||
|
onFilterDropdownVisibleChange?: (visible: boolean) => void;
|
||||||
sorter?: boolean | ((a: any, b: any) => number);
|
sorter?: boolean | ((a: any, b: any) => number);
|
||||||
colSpan?: number;
|
colSpan?: number;
|
||||||
width?: string | number;
|
width?: string | number;
|
||||||
@ -19,6 +21,7 @@ export interface ColumnProps<T> {
|
|||||||
filteredValue?: any[];
|
filteredValue?: any[];
|
||||||
sortOrder?: boolean | ('ascend' | 'descend');
|
sortOrder?: boolean | ('ascend' | 'descend');
|
||||||
children?: ColumnProps<T>[];
|
children?: ColumnProps<T>[];
|
||||||
|
onCellClick?: (record: T, event: any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Column<T> extends (RcTable.Column as React.ComponentClass<ColumnProps<T>>) {}
|
export default class Column<T> extends (RcTable.Column as React.ComponentClass<ColumnProps<T>>) {}
|
||||||
|
@ -22,6 +22,7 @@ export interface SelectionCheckboxAllProps {
|
|||||||
prefixCls: string | undefined;
|
prefixCls: string | undefined;
|
||||||
onSelect: (key: string, index: number, selectFunc: any) => void;
|
onSelect: (key: string, index: number, selectFunc: any) => void;
|
||||||
selections?: SelectionDecorator[] | boolean;
|
selections?: SelectionDecorator[] | boolean;
|
||||||
|
getPopupContainer: (triggerNode?: Element) => HTMLElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SelectionCheckboxAll extends React.Component<SelectionCheckboxAllProps, any> {
|
export default class SelectionCheckboxAll extends React.Component<SelectionCheckboxAllProps, any> {
|
||||||
@ -152,7 +153,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { disabled, prefixCls, selections } = this.props;
|
const { disabled, prefixCls, selections, getPopupContainer } = this.props;
|
||||||
const { checked, indeterminate } = this.state;
|
const { checked, indeterminate } = this.state;
|
||||||
|
|
||||||
let selectionPrefixCls = `${prefixCls}-selection`;
|
let selectionPrefixCls = `${prefixCls}-selection`;
|
||||||
@ -175,7 +176,7 @@ export default class SelectionCheckboxAll extends React.Component<SelectionCheck
|
|||||||
customSelections = (
|
customSelections = (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
overlay={menu}
|
overlay={menu}
|
||||||
getPopupContainer={(trigger: HTMLElement) => trigger.parentNode as HTMLElement}
|
getPopupContainer={getPopupContainer}
|
||||||
>
|
>
|
||||||
<div className={`${selectionPrefixCls}-down`}>
|
<div className={`${selectionPrefixCls}-down`}>
|
||||||
<Icon type="down" />
|
<Icon type="down" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { findDOMNode } from 'react-dom';
|
||||||
import RcTable from 'rc-table';
|
import RcTable from 'rc-table';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
@ -615,6 +616,10 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
|||||||
return recordKey === undefined ? index : recordKey;
|
return recordKey === undefined ? index : recordKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPopupContainer = () => {
|
||||||
|
return findDOMNode(this) as HTMLElement;
|
||||||
|
}
|
||||||
|
|
||||||
renderRowSelection() {
|
renderRowSelection() {
|
||||||
const { prefixCls, rowSelection } = this.props;
|
const { prefixCls, rowSelection } = this.props;
|
||||||
const columns = this.columns.concat();
|
const columns = this.columns.concat();
|
||||||
@ -646,6 +651,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
|||||||
prefixCls={prefixCls}
|
prefixCls={prefixCls}
|
||||||
onSelect={this.handleSelectRow}
|
onSelect={this.handleSelectRow}
|
||||||
selections={rowSelection.selections}
|
selections={rowSelection.selections}
|
||||||
|
getPopupContainer={this.getPopupContainer}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -700,6 +706,7 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
|||||||
confirmFilter={this.handleFilter}
|
confirmFilter={this.handleFilter}
|
||||||
prefixCls={`${prefixCls}-filter`}
|
prefixCls={`${prefixCls}-filter`}
|
||||||
dropdownPrefixCls={dropdownPrefixCls || 'ant-dropdown'}
|
dropdownPrefixCls={dropdownPrefixCls || 'ant-dropdown'}
|
||||||
|
getPopupContainer={this.getPopupContainer}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -939,7 +946,10 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(`${prefixCls}-wrapper`, className)} style={style}>
|
<div
|
||||||
|
className={classNames(`${prefixCls}-wrapper`, className)}
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
<Spin
|
<Spin
|
||||||
{...loading}
|
{...loading}
|
||||||
className={loading ? `${paginationPatchClass} ${prefixCls}-spin-holder` : ''}
|
className={loading ? `${paginationPatchClass} ${prefixCls}-spin-holder` : ''}
|
||||||
|
@ -91,7 +91,11 @@ class App extends React.Component {
|
|||||||
),
|
),
|
||||||
filterIcon: <Icon type="smile-o" style={{ color: this.state.filtered ? '#108ee9' : '#aaa' }} />,
|
filterIcon: <Icon type="smile-o" style={{ color: this.state.filtered ? '#108ee9' : '#aaa' }} />,
|
||||||
filterDropdownVisible: this.state.filterDropdownVisible,
|
filterDropdownVisible: this.state.filterDropdownVisible,
|
||||||
onFilterDropdownVisibleChange: visible => this.setState({ filterDropdownVisible: visible }, () => this.searchInput.focus()),
|
onFilterDropdownVisibleChange: (visible) => {
|
||||||
|
this.setState({
|
||||||
|
filterDropdownVisible: visible,
|
||||||
|
}, () => this.searchInput.focus());
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
title: 'Age',
|
title: 'Age',
|
||||||
dataIndex: 'age',
|
dataIndex: 'age',
|
||||||
|
@ -24,6 +24,7 @@ export interface FilterMenuProps {
|
|||||||
confirmFilter: (column: Object, selectedKeys: string[]) => any;
|
confirmFilter: (column: Object, selectedKeys: string[]) => any;
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
dropdownPrefixCls: string;
|
dropdownPrefixCls: string;
|
||||||
|
getPopupContainer: (triggerNode?: Element) => HTMLElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class FilterMenu extends React.Component<FilterMenuProps, any> {
|
export default class FilterMenu extends React.Component<FilterMenuProps, any> {
|
||||||
@ -182,7 +183,7 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
|
|||||||
}) : <Icon title={locale.filterTitle} type="filter" className={dropdownSelectedClass} />;
|
}) : <Icon title={locale.filterTitle} type="filter" className={dropdownSelectedClass} />;
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const { column, locale, prefixCls, dropdownPrefixCls } = this.props;
|
const { column, locale, prefixCls, dropdownPrefixCls, getPopupContainer } = this.props;
|
||||||
// default multiple selection in filter dropdown
|
// default multiple selection in filter dropdown
|
||||||
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
|
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
|
||||||
const dropdownMenuClass = classNames({
|
const dropdownMenuClass = classNames({
|
||||||
@ -228,6 +229,7 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
|
|||||||
overlay={menus}
|
overlay={menus}
|
||||||
visible={this.neverShown ? false : this.state.visible}
|
visible={this.neverShown ? false : this.state.visible}
|
||||||
onVisibleChange={this.onVisibleChange}
|
onVisibleChange={this.onVisibleChange}
|
||||||
|
getPopupContainer={getPopupContainer}
|
||||||
>
|
>
|
||||||
{this.renderFilterIcon()}
|
{this.renderFilterIcon()}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
@ -200,6 +200,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
padding: 0!important;
|
padding: 0!important;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
> .@{tab-prefix-cls}-content-animated {
|
> .@{tab-prefix-cls}-content-animated {
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
@tag-prefix-cls: ~"@{ant-prefix}-tag";
|
@tag-prefix-cls: ~"@{ant-prefix}-tag";
|
||||||
|
|
||||||
@tag-default-bg: @background-color-base;
|
|
||||||
@tag-default-color: @text-color;
|
|
||||||
|
|
||||||
.@{tag-prefix-cls} {
|
.@{tag-prefix-cls} {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
@ -58,7 +58,7 @@ abstract class TimePicker extends React.Component<TimePickerProps, any> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getLocale()
|
abstract getLocale();
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: TimePickerProps) {
|
componentWillReceiveProps(nextProps: TimePickerProps) {
|
||||||
if ('value' in nextProps) {
|
if ('value' in nextProps) {
|
||||||
|
@ -27,7 +27,7 @@ export interface AbstractTooltipProps {
|
|||||||
// getTooltipContainer had been rename to getPopupContainer
|
// getTooltipContainer had been rename to getPopupContainer
|
||||||
getTooltipContainer?: (triggerNode: Element) => HTMLElement;
|
getTooltipContainer?: (triggerNode: Element) => HTMLElement;
|
||||||
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
||||||
children?: React.ReactElement<any>;
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TooltipProps extends AbstractTooltipProps {
|
export interface TooltipProps extends AbstractTooltipProps {
|
||||||
|
@ -91,7 +91,7 @@ abstract class Transfer extends React.Component<TransferProps, any> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getLocale()
|
abstract getLocale();
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: TransferProps) {
|
componentWillReceiveProps(nextProps: TransferProps) {
|
||||||
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
||||||
@ -227,10 +227,10 @@ abstract class Transfer extends React.Component<TransferProps, any> {
|
|||||||
|
|
||||||
handleLeftSelectAll = (filteredDataSource, checkAll) => (
|
handleLeftSelectAll = (filteredDataSource, checkAll) => (
|
||||||
this.handleSelectAll('left', filteredDataSource, checkAll)
|
this.handleSelectAll('left', filteredDataSource, checkAll)
|
||||||
);
|
)
|
||||||
handleRightSelectAll = (filteredDataSource, checkAll) => (
|
handleRightSelectAll = (filteredDataSource, checkAll) => (
|
||||||
this.handleSelectAll('right', filteredDataSource, checkAll)
|
this.handleSelectAll('right', filteredDataSource, checkAll)
|
||||||
);
|
)
|
||||||
|
|
||||||
handleFilter = (direction, e) => {
|
handleFilter = (direction, e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -20,7 +20,7 @@ abstract class TreeSelect extends React.Component<TreeSelectProps, any> {
|
|||||||
dropdownClassName: 'ant-select-tree-dropdown',
|
dropdownClassName: 'ant-select-tree-dropdown',
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract getLocale()
|
abstract getLocale();
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const locale = this.getLocale();
|
const locale = this.getLocale();
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 0 18px;
|
padding: 0 0 0 18px;
|
||||||
}
|
}
|
||||||
> span {
|
.@{select-tree-prefix-cls}-node-content-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 1px 5px;
|
padding: 3px 5px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -41,22 +41,25 @@
|
|||||||
background-color: @item-hover-bg;
|
background-color: @item-hover-bg;
|
||||||
}
|
}
|
||||||
&.@{select-tree-prefix-cls}-node-selected {
|
&.@{select-tree-prefix-cls}-node-selected {
|
||||||
background-color: @item-active-bg;
|
background-color: @primary-2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
> span {
|
||||||
&.@{select-tree-prefix-cls}-checkbox {
|
&.@{select-tree-prefix-cls}-checkbox {
|
||||||
margin: 2px 4px 0 0;
|
margin: 2px 4px 0 0;
|
||||||
}
|
}
|
||||||
&.@{select-tree-prefix-cls}-switcher,
|
&.@{select-tree-prefix-cls}-switcher,
|
||||||
&.@{select-tree-prefix-cls}-iconEle {
|
&.@{select-tree-prefix-cls}-iconEle {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 16px;
|
width: 24px;
|
||||||
height: 16px;
|
height: 24px;
|
||||||
line-height: 16px;
|
line-height: 24px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
&.@{select-tree-prefix-cls}-icon_loading {
|
&.@{select-tree-prefix-cls}-icon_loading {
|
||||||
&:after {
|
&:after {
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
}
|
}
|
||||||
.@{tree-prefix-cls}-node-content-wrapper {
|
.@{tree-prefix-cls}-node-content-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 1px 5px;
|
padding: 3px 5px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -78,14 +78,15 @@
|
|||||||
&.@{tree-prefix-cls}-switcher,
|
&.@{tree-prefix-cls}-switcher,
|
||||||
&.@{tree-prefix-cls}-iconEle {
|
&.@{tree-prefix-cls}-iconEle {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 16px;
|
width: 24px;
|
||||||
height: 16px;
|
height: 24px;
|
||||||
line-height: 16px;
|
line-height: 24px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
&.@{tree-prefix-cls}-icon_loading {
|
&.@{tree-prefix-cls}-icon_loading {
|
||||||
&:after {
|
&:after {
|
||||||
@ -187,7 +188,7 @@
|
|||||||
border-left: 1px solid @border-color-base;
|
border-left: 1px solid @border-color-base;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 6px;
|
left: 12px;
|
||||||
margin: 18px 0;
|
margin: 18px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ Following the Ant Design specification, we developed a React UI library `antd` t
|
|||||||
|
|
||||||
## Environment Support
|
## Environment Support
|
||||||
|
|
||||||
* Modern browsers and Internet Explorer 9+
|
* Modern browsers and Internet Explorer 9+ (with [polyfills](https://ant.design/docs/react/getting-started#Compatibility))
|
||||||
* Server-side Rendering
|
* Server-side Rendering
|
||||||
* [Electron](http://electron.atom.io/)
|
* [Electron](http://electron.atom.io/)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ title: Ant Design of React
|
|||||||
|
|
||||||
## 支持环境
|
## 支持环境
|
||||||
|
|
||||||
* 现代浏览器和 IE9 及以上。
|
* 现代浏览器和 IE9 及以上(需要 [polyfills](https://ant.design/docs/react/getting-started-cn#兼容性))。
|
||||||
* 支持服务端渲染。
|
* 支持服务端渲染。
|
||||||
* [Electron](http://electron.atom.io/)
|
* [Electron](http://electron.atom.io/)
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ It is the default directory structure below.
|
|||||||
Now we install `antd` from yarn or npm.
|
Now we install `antd` from yarn or npm.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add antd --save
|
$ yarn add antd
|
||||||
```
|
```
|
||||||
|
|
||||||
Modify `src/App.js`, import Button component from `antd`.
|
Modify `src/App.js`, import Button component from `antd`.
|
||||||
@ -113,7 +113,7 @@ $ yarn run eject
|
|||||||
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) is a babel plugin for importing components on demand ([principle](/docs/react/getting-started#Import-on-Demand)). After eject all config files to antd-demo, we allowed to install it and modify `config/webpack.config.dev.js` now.
|
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) is a babel plugin for importing components on demand ([principle](/docs/react/getting-started#Import-on-Demand)). After eject all config files to antd-demo, we allowed to install it and modify `config/webpack.config.dev.js` now.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add babel-plugin-import --save-dev
|
$ yarn add babel-plugin-import --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
@ -121,10 +121,10 @@ $ yarn add babel-plugin-import --save-dev
|
|||||||
{
|
{
|
||||||
test: /\.(js|jsx)$/,
|
test: /\.(js|jsx)$/,
|
||||||
include: paths.appSrc,
|
include: paths.appSrc,
|
||||||
loader: 'babel',
|
loader: require.resolve('babel-loader'),
|
||||||
query: {
|
options: {
|
||||||
+ plugins: [
|
+ plugins: [
|
||||||
+ ['import', [{ libraryName: "antd", style: 'css' }]],
|
+ ['import', { libraryName: 'antd', style: 'css' }],
|
||||||
+ ],
|
+ ],
|
||||||
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
||||||
// It enables caching results in ./node_modules/.cache/babel-loader/
|
// It enables caching results in ./node_modules/.cache/babel-loader/
|
||||||
@ -145,22 +145,27 @@ Then reboot `yarn start` and visit demo page, you should find that the above war
|
|||||||
According to [Customize Theme documentation](/docs/react/customize-theme), we need `less` variables modify ability of [less-loader](https://github.com/webpack/less-loader), so we add it.
|
According to [Customize Theme documentation](/docs/react/customize-theme), we need `less` variables modify ability of [less-loader](https://github.com/webpack/less-loader), so we add it.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add less less-loader --save-dev
|
$ yarn add less less-loader --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
loaders: [
|
|
||||||
{
|
{
|
||||||
exclude: [
|
exclude: [
|
||||||
/\.html$/,
|
/\.html$/,
|
||||||
/\.(js|jsx)$/,
|
/\.(js|jsx)$/,
|
||||||
+ /\.less$/,
|
|
||||||
/\.css$/,
|
/\.css$/,
|
||||||
|
+ /\.less$/,
|
||||||
/\.json$/,
|
/\.json$/,
|
||||||
/\.svg$/
|
/\.bmp$/,
|
||||||
|
/\.gif$/,
|
||||||
|
/\.jpe?g$/,
|
||||||
|
/\.png$/,
|
||||||
],
|
],
|
||||||
loader: 'url',
|
loader: require.resolve('file-loader'),
|
||||||
},
|
options: {
|
||||||
|
name: 'static/media/[name].[hash:8].[ext]',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -169,21 +174,48 @@ loaders: [
|
|||||||
test: /\.(js|jsx)$/,
|
test: /\.(js|jsx)$/,
|
||||||
include: paths.appSrc,
|
include: paths.appSrc,
|
||||||
loader: 'babel',
|
loader: 'babel',
|
||||||
query: {
|
options: {
|
||||||
plugins: [
|
plugins: [
|
||||||
- ['import', [{ libraryName: "antd", style: 'css' }]],
|
- ['import', [{ libraryName: 'antd', style: 'css' }]],
|
||||||
+ ['import', [{ libraryName: "antd", style: true }]], // import less
|
+ ['import', [{ libraryName: 'antd', style: true }]], // import less
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
+ // Parse less files and modify variables
|
+ // Parse less files and modify variables
|
||||||
+ {
|
+ {
|
||||||
+ test: /\.less$/,
|
+ test: /\.less$/,
|
||||||
+ loader: 'style!css!postcss!less?{modifyVars:{"@primary-color":"#1DA57A"}}'
|
+ use: [
|
||||||
+ },
|
+ require.resolve('style-loader'),
|
||||||
]
|
+ require.resolve('css-loader'),
|
||||||
|
+ {
|
||||||
|
+ loader: require.resolve('postcss-loader'),
|
||||||
|
+ options: {
|
||||||
|
+ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options
|
||||||
|
+ plugins: () => [
|
||||||
|
+ require('postcss-flexbugs-fixes'),
|
||||||
|
+ autoprefixer({
|
||||||
|
+ browsers: [
|
||||||
|
+ '>1%',
|
||||||
|
+ 'last 4 versions',
|
||||||
|
+ 'Firefox ESR',
|
||||||
|
+ 'not ie < 9', // React doesn't support IE8 anyway
|
||||||
|
+ ],
|
||||||
|
+ flexbox: 'no-2009',
|
||||||
|
+ }),
|
||||||
|
+ ],
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ loader: require.resolve('less-loader'),
|
||||||
|
+ options: {
|
||||||
|
+ modifyVars: { "@primary-color": "#1DA57A" },
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ ],
|
||||||
|
+ },
|
||||||
|
],
|
||||||
```
|
```
|
||||||
|
|
||||||
We use `modifyVars` option of [less-loader](https://github.com/webpack/less-loader#less-options) here, you can see a green button rendered on the page after reboot start server.
|
We use `modifyVars` option of [less-loader](https://github.com/webpack/less-loader#less-options) here, you can see a green button rendered on the page after reboot start server.
|
||||||
|
@ -55,7 +55,7 @@ $ yarn start
|
|||||||
现在从 yarn 或 npm 安装并引入 antd。
|
现在从 yarn 或 npm 安装并引入 antd。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add antd --save
|
$ yarn add antd
|
||||||
```
|
```
|
||||||
|
|
||||||
修改 `src/App.js`,引入 antd 的按钮组件。
|
修改 `src/App.js`,引入 antd 的按钮组件。
|
||||||
@ -110,7 +110,7 @@ $ yarn run eject
|
|||||||
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 是一个用于按需加载组件代码和样式的 babel 插件([原理](/docs/react/getting-started#按需加载)),现在我们尝试安装它并修改 `config/webpack.config.dev.js` 文件。
|
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 是一个用于按需加载组件代码和样式的 babel 插件([原理](/docs/react/getting-started#按需加载)),现在我们尝试安装它并修改 `config/webpack.config.dev.js` 文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add babel-plugin-import --save-dev
|
$ yarn add babel-plugin-import --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
@ -118,10 +118,10 @@ $ yarn add babel-plugin-import --save-dev
|
|||||||
{
|
{
|
||||||
test: /\.(js|jsx)$/,
|
test: /\.(js|jsx)$/,
|
||||||
include: paths.appSrc,
|
include: paths.appSrc,
|
||||||
loader: 'babel',
|
loader: require.resolve('babel-loader'),
|
||||||
query: {
|
options: {
|
||||||
+ plugins: [
|
+ plugins: [
|
||||||
+ ['import', [{ libraryName: "antd", style: 'css' }]],
|
+ ['import', { libraryName: 'antd', style: 'css' }],
|
||||||
+ ],
|
+ ],
|
||||||
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
||||||
// It enables caching results in ./node_modules/.cache/babel-loader/
|
// It enables caching results in ./node_modules/.cache/babel-loader/
|
||||||
@ -142,22 +142,27 @@ $ yarn add babel-plugin-import --save-dev
|
|||||||
按照 [配置主题](/docs/react/customize-theme) 的要求,自定义主题需要用到 less 变量覆盖功能,因此首先我们需要引入 [less-loader](https://github.com/webpack/less-loader) 来加载 less 样式,同时修改 `config/webpack.config.dev.js` 文件。
|
按照 [配置主题](/docs/react/customize-theme) 的要求,自定义主题需要用到 less 变量覆盖功能,因此首先我们需要引入 [less-loader](https://github.com/webpack/less-loader) 来加载 less 样式,同时修改 `config/webpack.config.dev.js` 文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ yarn add less less-loader --save-dev
|
$ yarn add less less-loader --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
loaders: [
|
|
||||||
{
|
{
|
||||||
exclude: [
|
exclude: [
|
||||||
/\.html$/,
|
/\.html$/,
|
||||||
/\.(js|jsx)$/,
|
/\.(js|jsx)$/,
|
||||||
+ /\.less$/,
|
|
||||||
/\.css$/,
|
/\.css$/,
|
||||||
|
+ /\.less$/,
|
||||||
/\.json$/,
|
/\.json$/,
|
||||||
/\.svg$/
|
/\.bmp$/,
|
||||||
|
/\.gif$/,
|
||||||
|
/\.jpe?g$/,
|
||||||
|
/\.png$/,
|
||||||
],
|
],
|
||||||
loader: 'url',
|
loader: require.resolve('file-loader'),
|
||||||
},
|
options: {
|
||||||
|
name: 'static/media/[name].[hash:8].[ext]',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -166,21 +171,48 @@ loaders: [
|
|||||||
test: /\.(js|jsx)$/,
|
test: /\.(js|jsx)$/,
|
||||||
include: paths.appSrc,
|
include: paths.appSrc,
|
||||||
loader: 'babel',
|
loader: 'babel',
|
||||||
query: {
|
options: {
|
||||||
plugins: [
|
plugins: [
|
||||||
- ['import', [{ libraryName: "antd", style: 'css' }]],
|
- ['import', [{ libraryName: 'antd', style: 'css' }]],
|
||||||
+ ['import', [{ libraryName: "antd", style: true }]], // 加载 less 文件
|
+ ['import', [{ libraryName: 'antd', style: true }]], // import less
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
+ // 解析 less 文件,并加入变量覆盖配置
|
+ // Parse less files and modify variables
|
||||||
+ {
|
+ {
|
||||||
+ test: /\.less$/,
|
+ test: /\.less$/,
|
||||||
+ loader: 'style!css!postcss!less?{modifyVars:{"@primary-color":"#1DA57A"}}'
|
+ use: [
|
||||||
+ },
|
+ require.resolve('style-loader'),
|
||||||
]
|
+ require.resolve('css-loader'),
|
||||||
|
+ {
|
||||||
|
+ loader: require.resolve('postcss-loader'),
|
||||||
|
+ options: {
|
||||||
|
+ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options
|
||||||
|
+ plugins: () => [
|
||||||
|
+ require('postcss-flexbugs-fixes'),
|
||||||
|
+ autoprefixer({
|
||||||
|
+ browsers: [
|
||||||
|
+ '>1%',
|
||||||
|
+ 'last 4 versions',
|
||||||
|
+ 'Firefox ESR',
|
||||||
|
+ 'not ie < 9', // React doesn't support IE8 anyway
|
||||||
|
+ ],
|
||||||
|
+ flexbox: 'no-2009',
|
||||||
|
+ }),
|
||||||
|
+ ],
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ loader: require.resolve('less-loader'),
|
||||||
|
+ options: {
|
||||||
|
+ modifyVars: { "@primary-color": "#1DA57A" },
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
+ ],
|
||||||
|
+ },
|
||||||
|
],
|
||||||
```
|
```
|
||||||
|
|
||||||
这里利用了 [less-loader](https://github.com/webpack/less-loader#less-options) 的 `modifyVars` 来进行主题配置,
|
这里利用了 [less-loader](https://github.com/webpack/less-loader#less-options) 的 `modifyVars` 来进行主题配置,
|
||||||
|
20
package.json
20
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "antd",
|
"name": "antd",
|
||||||
"version": "2.10.1",
|
"version": "2.10.3",
|
||||||
"title": "Ant Design",
|
"title": "Ant Design",
|
||||||
"description": "An enterprise-class UI design language and React-based implementation",
|
"description": "An enterprise-class UI design language and React-based implementation",
|
||||||
"homepage": "http://ant.design/",
|
"homepage": "http://ant.design/",
|
||||||
@ -26,9 +26,11 @@
|
|||||||
"url": "https://github.com/ant-design/ant-design/issues"
|
"url": "https://github.com/ant-design/ant-design/issues"
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
"module": "es/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"lib"
|
"lib",
|
||||||
|
"es"
|
||||||
],
|
],
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -45,7 +47,7 @@
|
|||||||
"omit.js": "^0.1.0",
|
"omit.js": "^0.1.0",
|
||||||
"prop-types": "^15.5.7",
|
"prop-types": "^15.5.7",
|
||||||
"rc-animate": "~2.3.0",
|
"rc-animate": "~2.3.0",
|
||||||
"rc-calendar": "~8.2.0",
|
"rc-calendar": "~8.4.0",
|
||||||
"rc-cascader": "~0.11.0",
|
"rc-cascader": "~0.11.0",
|
||||||
"rc-checkbox": "~2.0.0",
|
"rc-checkbox": "~2.0.0",
|
||||||
"rc-collapse": "~1.7.0",
|
"rc-collapse": "~1.7.0",
|
||||||
@ -80,7 +82,7 @@
|
|||||||
"@types/react": "^15.0.8",
|
"@types/react": "^15.0.8",
|
||||||
"@types/react-dom": "~0.14.18",
|
"@types/react-dom": "~0.14.18",
|
||||||
"antd-demo-jest": "^1.0.5",
|
"antd-demo-jest": "^1.0.5",
|
||||||
"antd-tools": "~0.19.1",
|
"antd-tools": "^1.4.2",
|
||||||
"babel-cli": "^6.18.0",
|
"babel-cli": "^6.18.0",
|
||||||
"babel-eslint": "^7.1.0",
|
"babel-eslint": "^7.1.0",
|
||||||
"babel-jest": "^19.0.0",
|
"babel-jest": "^19.0.0",
|
||||||
@ -138,7 +140,7 @@
|
|||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"stylelint": "^7.8.0",
|
"stylelint": "^7.8.0",
|
||||||
"stylelint-config-standard": "^16.0.0",
|
"stylelint-config-standard": "^16.0.0",
|
||||||
"typescript": "~2.2.1",
|
"typescript": "~2.3.0",
|
||||||
"typescript-babel-jest": "^1.0.2",
|
"typescript-babel-jest": "^1.0.2",
|
||||||
"values.js": "^1.0.3",
|
"values.js": "^1.0.3",
|
||||||
"xhr2": "^0.1.3"
|
"xhr2": "^0.1.3"
|
||||||
@ -198,8 +200,8 @@
|
|||||||
"/_site/"
|
"/_site/"
|
||||||
],
|
],
|
||||||
"testPathIgnorePatterns": [
|
"testPathIgnorePatterns": [
|
||||||
"dekko",
|
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
|
"dekko",
|
||||||
"node"
|
"node"
|
||||||
],
|
],
|
||||||
"transform": {
|
"transform": {
|
||||||
@ -210,11 +212,13 @@
|
|||||||
"testRegex": ".*\\.test\\.js$",
|
"testRegex": ".*\\.test\\.js$",
|
||||||
"collectCoverageFrom": [
|
"collectCoverageFrom": [
|
||||||
"components/**/*.{ts,tsx}",
|
"components/**/*.{ts,tsx}",
|
||||||
"!components/*/style/index.tsx"
|
"!components/*/style/index.tsx",
|
||||||
|
"!components/style/index.tsx",
|
||||||
|
"!components/*/locale/index.tsx"
|
||||||
],
|
],
|
||||||
"transformIgnorePatterns": [
|
"transformIgnorePatterns": [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
"/dist/antd.js"
|
"/dist/"
|
||||||
],
|
],
|
||||||
"snapshotSerializers": [
|
"snapshotSerializers": [
|
||||||
"enzyme-to-json/serializer"
|
"enzyme-to-json/serializer"
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
transform: scale(0.9);
|
transform: scale(0.9);
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-demo {
|
&-demo {
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border-radius: @border-radius-base;
|
border-radius: @border-radius-base;
|
||||||
border: 1px solid @start-button-color;
|
border: 1px solid @start-button-color;
|
||||||
|
text-decoration: none;
|
||||||
color: #0ae;
|
color: #0ae;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
@ -164,6 +164,7 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
color: #999;
|
color: #999;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
float: left;
|
float: left;
|
||||||
line-height: 72px;
|
line-height: 72px;
|
||||||
height: 72px;
|
height: 72px;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
> a.prev-page {
|
> a.prev-page {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import fs from 'fs';
|
|
||||||
import path from 'path';
|
|
||||||
import pkg from '../package.json';
|
import pkg from '../package.json';
|
||||||
|
|
||||||
describe('antd dist files', () => {
|
describe('antd dist files', () => {
|
||||||
@ -13,14 +11,6 @@ describe('antd dist files', () => {
|
|||||||
// https://github.com/ant-design/ant-design/issues/1970
|
// https://github.com/ant-design/ant-design/issues/1970
|
||||||
// https://github.com/ant-design/ant-design/issues/1804
|
// https://github.com/ant-design/ant-design/issues/1804
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
it('should be compatible in IE8', () => {
|
|
||||||
const antdJsContent = fs.readFileSync(path.join(process.cwd(), 'dist', 'antd.js'));
|
|
||||||
expect(
|
|
||||||
antdJsContent.toString()
|
|
||||||
.indexOf('function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }')
|
|
||||||
).toBe(-1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have antd.version', () => {
|
it('should have antd.version', () => {
|
||||||
const antd = require('../dist/antd'); // eslint-disable-line global-require
|
const antd = require('../dist/antd'); // eslint-disable-line global-require
|
||||||
expect(antd.version).toBe(pkg.version);
|
expect(antd.version).toBe(pkg.version);
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
@ -12,6 +14,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules",
|
||||||
|
"lib",
|
||||||
|
"es"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,6 @@ function ignoreMomentLocale(webpackConfig) {
|
|||||||
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
|
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix ie8 compatibility
|
|
||||||
function es3ify(webpackConfig) {
|
|
||||||
webpackConfig.module.loaders.unshift({
|
|
||||||
test: /\.(tsx|jsx?)$/,
|
|
||||||
loader: 'es3ify-loader',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function addLocales(webpackConfig) {
|
function addLocales(webpackConfig) {
|
||||||
let packageName = 'antd-with-locales';
|
let packageName = 'antd-with-locales';
|
||||||
if (webpackConfig.entry['antd.min']) {
|
if (webpackConfig.entry['antd.min']) {
|
||||||
@ -28,10 +20,9 @@ function addLocales(webpackConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function (webpackConfig) {
|
module.exports = function (webpackConfig) {
|
||||||
webpackConfig = getWebpackConfig(webpackConfig);
|
webpackConfig = getWebpackConfig(webpackConfig, true);
|
||||||
if (process.env.RUN_ENV === 'PRODUCTION') {
|
if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||||
webpackConfig.forEach((config) => {
|
webpackConfig.forEach((config) => {
|
||||||
es3ify(config);
|
|
||||||
ignoreMomentLocale(config);
|
ignoreMomentLocale(config);
|
||||||
addLocales(config);
|
addLocales(config);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user