Browse Source

Remove allowSyntheticDefaultImports (#8218)

pull/8226/head
Wei Zhu 7 years ago
committed by GitHub
parent
commit
479a5cb743
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .jest.js
  2. 5
      .jest.node.js
  3. 15
      README-zh_CN.md
  4. 15
      README.md
  5. 5
      components/_util/callMoment.tsx
  6. 4
      components/affix/index.tsx
  7. 4
      components/alert/index.tsx
  8. 4
      components/anchor/Anchor.tsx
  9. 2
      components/anchor/AnchorLink.tsx
  10. 8
      components/auto-complete/InputElement.tsx
  11. 2
      components/auto-complete/index.tsx
  12. 4
      components/avatar/index.tsx
  13. 2
      components/back-top/index.tsx
  14. 2
      components/badge/ScrollNumber.tsx
  15. 2
      components/badge/index.tsx
  16. 2
      components/breadcrumb/Breadcrumb.tsx
  17. 2
      components/breadcrumb/BreadcrumbItem.tsx
  18. 2
      components/button/button-group.tsx
  19. 2
      components/button/button.tsx
  20. 4
      components/calendar/Header.tsx
  21. 8
      components/calendar/index.tsx
  22. 2
      components/card/Grid.tsx
  23. 2
      components/card/Meta.tsx
  24. 6
      components/card/index.tsx
  25. 2
      components/carousel/index.tsx
  26. 2
      components/cascader/index.tsx
  27. 2
      components/checkbox/Checkbox.tsx
  28. 2
      components/checkbox/Group.tsx
  29. 2
      components/collapse/Collapse.tsx
  30. 2
      components/date-picker/Calendar.tsx
  31. 7
      components/date-picker/RangePicker.tsx
  32. 6
      components/date-picker/WeekPicker.tsx
  33. 7
      components/date-picker/createPicker.tsx
  34. 4
      components/date-picker/index.tsx
  35. 2
      components/date-picker/wrapPicker.tsx
  36. 2
      components/divider/index.tsx
  37. 2
      components/dropdown/dropdown-button.tsx
  38. 6
      components/dropdown/dropdown.tsx
  39. 2
      components/form/Form.tsx
  40. 6
      components/form/FormItem.tsx
  41. 2
      components/form/__tests__/type.tsx
  42. 2
      components/grid/col.tsx
  43. 2
      components/grid/row.tsx
  44. 2
      components/icon/index.tsx
  45. 2
      components/input-number/index.tsx
  46. 2
      components/input/Group.tsx
  47. 8
      components/input/Input.tsx
  48. 2
      components/input/Search.tsx
  49. 2
      components/input/TextArea.tsx
  50. 2
      components/layout/Sider.tsx
  51. 2
      components/layout/layout.tsx
  52. 2
      components/list/Item.tsx
  53. 4
      components/list/index.tsx
  54. 2
      components/locale-provider/LocaleReceiver.tsx
  55. 2
      components/locale-provider/ar_EG.tsx
  56. 2
      components/locale-provider/bg_BG.tsx
  57. 2
      components/locale-provider/ca_ES.tsx
  58. 2
      components/locale-provider/cs_CZ.tsx
  59. 2
      components/locale-provider/de_DE.tsx
  60. 2
      components/locale-provider/el_GR.tsx
  61. 2
      components/locale-provider/en_GB.tsx
  62. 2
      components/locale-provider/en_US.tsx
  63. 2
      components/locale-provider/et_EE.tsx
  64. 2
      components/locale-provider/fa_IR.tsx
  65. 2
      components/locale-provider/fi_FI.tsx
  66. 2
      components/locale-provider/fr_BE.tsx
  67. 2
      components/locale-provider/fr_FR.tsx
  68. 2
      components/locale-provider/index.tsx
  69. 2
      components/locale-provider/is_IS.tsx
  70. 2
      components/locale-provider/it_IT.tsx
  71. 2
      components/locale-provider/ja_JP.tsx
  72. 2
      components/locale-provider/ko_KR.tsx
  73. 2
      components/locale-provider/nb_NO.tsx
  74. 2
      components/locale-provider/nl_BE.tsx
  75. 2
      components/locale-provider/nl_NL.tsx
  76. 2
      components/locale-provider/pl_PL.tsx
  77. 2
      components/locale-provider/pt_BR.tsx
  78. 2
      components/locale-provider/pt_PT.tsx
  79. 2
      components/locale-provider/ru_RU.tsx
  80. 2
      components/locale-provider/sk_SK.tsx
  81. 2
      components/locale-provider/sr_RS.tsx
  82. 2
      components/locale-provider/sv_SE.tsx
  83. 2
      components/locale-provider/th_TH.tsx
  84. 2
      components/locale-provider/tr_TR.tsx
  85. 2
      components/locale-provider/uk_UA.tsx
  86. 2
      components/locale-provider/vi_VN.tsx
  87. 2
      components/locale-provider/zh_CN.tsx
  88. 2
      components/locale-provider/zh_TW.tsx
  89. 2
      components/mention/index.tsx
  90. 2
      components/menu/MenuItem.tsx
  91. 2
      components/menu/SubMenu.tsx
  92. 2
      components/menu/index.tsx
  93. 2
      components/message/index.tsx
  94. 4
      components/modal/ActionButton.tsx
  95. 2
      components/modal/Modal.tsx
  96. 4
      components/modal/confirm.tsx
  97. 2
      components/notification/index.tsx
  98. 2
      components/pagination/MiniSelect.tsx
  99. 2
      components/pagination/Pagination.tsx
  100. 2
      components/popconfirm/index.tsx

5
.jest.js

@ -42,4 +42,9 @@ module.exports = {
snapshotSerializers: [ snapshotSerializers: [
'enzyme-to-json/serializer', 'enzyme-to-json/serializer',
], ],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
}
},
}; };

5
.jest.node.js

@ -18,4 +18,9 @@ module.exports = {
snapshotSerializers: [ snapshotSerializers: [
'enzyme-to-json/serializer' 'enzyme-to-json/serializer'
], ],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
}
},
}; };

15
README-zh_CN.md

@ -60,20 +60,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
## TypeScript ## TypeScript
```js - 不要使用 @types/antd, antd 已经自带了 TypeScript 定义。
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
}
```
> 注意:
> - 设置 `allowSyntheticDefaultImports` 避免 `error TS1192: Module 'react' has no default export` 的错误。
> - 不要使用 @types/antd, antd 已经自带了 TypeScript 定义。
## 国际化 ## 国际化

15
README.md

@ -86,20 +86,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
### TypeScript ### TypeScript
```js - Don't use @types/antd, antd provide a built-in ts definition already.
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
}
```
> Note:
> - set `allowSyntheticDefaultImports` to prevent `error TS1192: Module 'react' has no default export`.
> - Don't use @types/antd, antd provide a built-in ts definition already.
#### Use [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) with modularized antd #### Use [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) with modularized antd

5
components/_util/callMoment.tsx

@ -0,0 +1,5 @@
// https://github.com/moment/moment/issues/3650
export default function callMoment(moment, ...args) {
return (moment.default || moment)(...args);
}

4
components/affix/index.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import addEventListener from 'rc-util/lib/Dom/addEventListener'; import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames'; import classNames from 'classnames';

4
components/alert/index.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import Animate from 'rc-animate'; import Animate from 'rc-animate';
import Icon from '../icon'; import Icon from '../icon';
import classNames from 'classnames'; import classNames from 'classnames';

4
components/anchor/Anchor.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import addEventListener from 'rc-util/lib/Dom/addEventListener'; import addEventListener from 'rc-util/lib/Dom/addEventListener';

2
components/anchor/AnchorLink.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';

8
components/auto-complete/InputElement.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import { findDOMNode } from 'react-dom'; import * as ReactDOM from 'react-dom';
export interface InputElementProps { export interface InputElementProps {
children: React.ReactElement<any>; children: React.ReactElement<any>;
@ -9,10 +9,10 @@ export default class InputElement extends React.Component<InputElementProps, any
private ele: HTMLInputElement; private ele: HTMLInputElement;
focus = () => { focus = () => {
this.ele.focus ? this.ele.focus() : (findDOMNode(this.ele) as HTMLInputElement).focus(); this.ele.focus ? this.ele.focus() : (ReactDOM.findDOMNode(this.ele) as HTMLInputElement).focus();
} }
blur = () => { blur = () => {
this.ele.blur ? this.ele.blur() : (findDOMNode(this.ele) as HTMLInputElement).blur(); this.ele.blur ? this.ele.blur() : (ReactDOM.findDOMNode(this.ele) as HTMLInputElement).blur();
} }
saveRef = (ele: HTMLInputElement) => { saveRef = (ele: HTMLInputElement) => {
this.ele = ele; this.ele = ele;

2
components/auto-complete/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import { Option, OptGroup } from 'rc-select'; import { Option, OptGroup } from 'rc-select';
import classNames from 'classnames'; import classNames from 'classnames';
import Select, { AbstractSelectProps, SelectValue, OptionProps, OptGroupProps } from '../select'; import Select, { AbstractSelectProps, SelectValue, OptionProps, OptGroupProps } from '../select';

4
components/avatar/index.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import Icon from '../icon'; import Icon from '../icon';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/back-top/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Animate from 'rc-animate'; import Animate from 'rc-animate';
import addEventListener from 'rc-util/lib/Dom/addEventListener'; import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/badge/ScrollNumber.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import { createElement, Component } from 'react'; import { createElement, Component } from 'react';
import omit from 'omit.js'; import omit from 'omit.js';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/badge/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Animate from 'rc-animate'; import Animate from 'rc-animate';
import ScrollNumber from './ScrollNumber'; import ScrollNumber from './ScrollNumber';

2
components/breadcrumb/Breadcrumb.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { cloneElement } from 'react'; import { cloneElement } from 'react';
import warning from '../_util/warning'; import warning from '../_util/warning';

2
components/breadcrumb/BreadcrumbItem.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
export interface BreadcrumbItemProps { export interface BreadcrumbItemProps {

2
components/button/button-group.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { ButtonSize } from './button'; import { ButtonSize } from './button';

2
components/button/button.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import omit from 'omit.js'; import omit from 'omit.js';

4
components/calendar/Header.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import moment from 'moment'; import * as moment from 'moment';
import { PREFIX_CLS } from './Constants'; import { PREFIX_CLS } from './Constants';
import Select from '../select'; import Select from '../select';
import { Group, Button } from '../radio'; import { Group, Button } from '../radio';

8
components/calendar/index.tsx

@ -1,10 +1,12 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import moment from 'moment'; import * as moment from 'moment';
import FullCalendar from 'rc-calendar/lib/FullCalendar'; import FullCalendar from 'rc-calendar/lib/FullCalendar';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { PREFIX_CLS } from './Constants'; import { PREFIX_CLS } from './Constants';
import Header from './Header'; import Header from './Header';
import callMoment from '../_util/callMoment';
declare const require: Function; declare const require: Function;
export { HeaderProps } from './Header'; export { HeaderProps } from './Header';
@ -71,7 +73,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
const value = props.value || props.defaultValue || moment(); const value = props.value || props.defaultValue || callMoment(moment);
if (!moment.isMoment(value)) { if (!moment.isMoment(value)) {
throw new Error( throw new Error(
'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' + 'The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' +

2
components/card/Grid.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
export interface CardGridProps { export interface CardGridProps {

2
components/card/Meta.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
export interface CardMetaProps { export interface CardMetaProps {

6
components/card/index.tsx

@ -1,4 +1,4 @@
import React, { Component, Children } from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import addEventListener from 'rc-util/lib/Dom/addEventListener'; import addEventListener from 'rc-util/lib/Dom/addEventListener';
import omit from 'omit.js'; import omit from 'omit.js';
@ -38,7 +38,7 @@ export interface CardProps {
onTabChange?: (key: string) => void; onTabChange?: (key: string) => void;
} }
export default class Card extends Component<CardProps, {}> { export default class Card extends React.Component<CardProps, {}> {
static Grid: typeof Grid = Grid; static Grid: typeof Grid = Grid;
static Meta: typeof Meta = Meta; static Meta: typeof Meta = Meta;
resizeEvent: any; resizeEvent: any;
@ -93,7 +93,7 @@ export default class Card extends Component<CardProps, {}> {
} }
isContainGrid() { isContainGrid() {
let containGrid; let containGrid;
Children.forEach(this.props.children, (element: JSX.Element) => { React.Children.forEach(this.props.children, (element: JSX.Element) => {
if (element && element.type && element.type === Grid) { if (element && element.type && element.type === Grid) {
containGrid = true; containGrid = true;
} }

2
components/carousel/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import debounce from 'lodash.debounce'; import debounce from 'lodash.debounce';
// matchMedia polyfill for // matchMedia polyfill for

2
components/cascader/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import RcCascader from 'rc-cascader'; import RcCascader from 'rc-cascader';
import arrayTreeFilter from 'array-tree-filter'; import arrayTreeFilter from 'array-tree-filter';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/checkbox/Checkbox.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import RcCheckbox from 'rc-checkbox'; import RcCheckbox from 'rc-checkbox';

2
components/checkbox/Group.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import shallowEqual from 'shallowequal'; import shallowEqual from 'shallowequal';

2
components/collapse/Collapse.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import RcCollapse from 'rc-collapse'; import RcCollapse from 'rc-collapse';
import classNames from 'classnames'; import classNames from 'classnames';
import animation from '../_util/openAnimation'; import animation from '../_util/openAnimation';

2
components/date-picker/Calendar.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import CalendarLocale from 'rc-calendar/lib/locale/zh_CN'; import CalendarLocale from 'rc-calendar/lib/locale/zh_CN';
import RcCalendar from 'rc-calendar'; import RcCalendar from 'rc-calendar';
import warning from 'warning'; import warning from 'warning';

7
components/date-picker/RangePicker.tsx

@ -1,11 +1,12 @@
/* tslint:disable jsx-no-multiline-js */ /* tslint:disable jsx-no-multiline-js */
import React from 'react'; import * as React from 'react';
import moment from 'moment'; import * as moment from 'moment';
import RangeCalendar from 'rc-calendar/lib/RangeCalendar'; import RangeCalendar from 'rc-calendar/lib/RangeCalendar';
import RcDatePicker from 'rc-calendar/lib/Picker'; import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames'; import classNames from 'classnames';
import Icon from '../icon'; import Icon from '../icon';
import warning from '../_util/warning'; import warning from '../_util/warning';
import callMoment from '../_util/callMoment';
function getShowDateFromValue(value: moment.Moment[]): moment.Moment[] | undefined { function getShowDateFromValue(value: moment.Moment[]): moment.Moment[] | undefined {
const [start, end] = value; const [start, end] = value;
@ -60,7 +61,7 @@ export default class RangePicker extends React.Component<any, any> {
const pickerValue = !value || isEmptyArray(value) ? props.defaultPickerValue : value; const pickerValue = !value || isEmptyArray(value) ? props.defaultPickerValue : value;
this.state = { this.state = {
value, value,
showDate: pickerValueAdapter(pickerValue || moment()), showDate: pickerValueAdapter(pickerValue || callMoment(moment)),
open: props.open, open: props.open,
hoverValue: [], hoverValue: [],
}; };

6
components/date-picker/WeekPicker.tsx

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import * as React from 'react';
import moment from 'moment'; import * as moment from 'moment';
import Calendar from 'rc-calendar'; import Calendar from 'rc-calendar';
import RcDatePicker from 'rc-calendar/lib/Picker'; import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames'; import classNames from 'classnames';
@ -9,7 +9,7 @@ function formatValue(value: moment.Moment | undefined, format: string): string {
return (value && value.format(format)) || ''; return (value && value.format(format)) || '';
} }
export default class WeekPicker extends Component<any, any> { export default class WeekPicker extends React.Component<any, any> {
static defaultProps = { static defaultProps = {
format: 'YYYY-Wo', format: 'YYYY-Wo',
allowClear: true, allowClear: true,

7
components/date-picker/createPicker.tsx

@ -1,11 +1,12 @@
import React from 'react'; import * as React from 'react';
import moment from 'moment'; import * as moment from 'moment';
import MonthCalendar from 'rc-calendar/lib/MonthCalendar'; import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
import RcDatePicker from 'rc-calendar/lib/Picker'; import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames'; import classNames from 'classnames';
import omit from 'omit.js'; import omit from 'omit.js';
import Icon from '../icon'; import Icon from '../icon';
import warning from '../_util/warning'; import warning from '../_util/warning';
import callMoment from '../_util/callMoment';
export interface PickerProps { export interface PickerProps {
value?: moment.Moment; value?: moment.Moment;
@ -104,7 +105,7 @@ export default function createPicker(TheCalendar): any {
disabledTime={disabledTime} disabledTime={disabledTime}
locale={locale.lang} locale={locale.lang}
timePicker={props.timePicker} timePicker={props.timePicker}
defaultValue={props.defaultPickerValue || moment()} defaultValue={props.defaultPickerValue || callMoment(moment)}
dateInputPlaceholder={placeholder} dateInputPlaceholder={placeholder}
prefixCls={prefixCls} prefixCls={prefixCls}
className={calendarClassName} className={calendarClassName}

4
components/date-picker/index.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import moment from 'moment'; import * as moment from 'moment';
import RcCalendar from 'rc-calendar'; import RcCalendar from 'rc-calendar';
import MonthCalendar from 'rc-calendar/lib/MonthCalendar'; import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
import createPicker from './createPicker'; import createPicker from './createPicker';

2
components/date-picker/wrapPicker.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import TimePickerPanel from 'rc-time-picker/lib/Panel'; import TimePickerPanel from 'rc-time-picker/lib/Panel';
import classNames from 'classnames'; import classNames from 'classnames';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';

2
components/divider/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
export default function Divider({ export default function Divider({

2
components/dropdown/dropdown-button.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Button from '../button'; import Button from '../button';
import { ButtonGroupProps } from '../button/button-group'; import { ButtonGroupProps } from '../button/button-group';
import Icon from '../icon'; import Icon from '../icon';

6
components/dropdown/dropdown.tsx

@ -1,4 +1,4 @@
import React, { cloneElement } from 'react'; import * as React from 'react';
import RcDropdown from 'rc-dropdown'; import RcDropdown from 'rc-dropdown';
import classNames from 'classnames'; import classNames from 'classnames';
import DropdownButton from './dropdown-button'; import DropdownButton from './dropdown-button';
@ -46,7 +46,7 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
render() { render() {
const { children, prefixCls, overlay, trigger, disabled } = this.props; const { children, prefixCls, overlay, trigger, disabled } = this.props;
const dropdownTrigger = cloneElement(children as any, { const dropdownTrigger = React.cloneElement(children as any, {
className: classNames((children as any).props.className, `${prefixCls}-trigger`), className: classNames((children as any).props.className, `${prefixCls}-trigger`),
disabled, disabled,
}); });
@ -54,7 +54,7 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
const overlayProps = overlay && (overlay as any).props; const overlayProps = overlay && (overlay as any).props;
const selectable = (overlayProps && 'selectable' in overlayProps) const selectable = (overlayProps && 'selectable' in overlayProps)
? overlayProps.selectable : false; ? overlayProps.selectable : false;
const fixedModeOverlay = cloneElement(overlay as any, { const fixedModeOverlay = React.cloneElement(overlay as any, {
mode: 'vertical', mode: 'vertical',
selectable, selectable,
}); });

2
components/form/Form.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import createDOMForm from 'rc-form/lib/createDOMForm'; import createDOMForm from 'rc-form/lib/createDOMForm';

6
components/form/FormItem.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import { findDOMNode } from 'react-dom'; import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import Animate from 'rc-animate'; import Animate from 'rc-animate';
@ -230,7 +230,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
const controls = document.querySelectorAll(`[id="${id}"]`); const controls = document.querySelectorAll(`[id="${id}"]`);
if (controls.length !== 1) { if (controls.length !== 1) {
e.preventDefault(); e.preventDefault();
const control = findDOMNode(this).querySelector(`[id="${id}"]`) as HTMLElement; const control = ReactDOM.findDOMNode(this).querySelector(`[id="${id}"]`) as HTMLElement;
if (control && control.focus) { if (control && control.focus) {
control.focus(); control.focus();
} }

2
components/form/__tests__/type.tsx

@ -1,5 +1,5 @@
/* tslint:disable */ /* tslint:disable */
import React from 'react'; import * as React from 'react';
import Form, { FormComponentProps } from '../Form'; import Form, { FormComponentProps } from '../Form';
// test Form.create on component without own props // test Form.create on component without own props

2
components/grid/col.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/grid/row.tsx

@ -16,7 +16,7 @@ if (typeof window !== 'undefined') {
enquire = require('enquire.js'); enquire = require('enquire.js');
} }
import React from 'react'; import * as React from 'react';
import { Children, cloneElement } from 'react'; import { Children, cloneElement } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';

2
components/icon/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import omit from 'omit.js'; import omit from 'omit.js';

2
components/input-number/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import RcInputNumber from 'rc-input-number'; import RcInputNumber from 'rc-input-number';

2
components/input/Group.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
export interface GroupProps { export interface GroupProps {

8
components/input/Input.tsx

@ -1,4 +1,4 @@
import React, { Component, cloneElement } from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import omit from 'omit.js'; import omit from 'omit.js';
@ -45,7 +45,7 @@ export interface InputProps extends AbstractInputProps {
autoFocus?: boolean; autoFocus?: boolean;
} }
export default class Input extends Component<InputProps, any> { export default class Input extends React.Component<InputProps, any> {
static Group: typeof Group; static Group: typeof Group;
static Search: typeof Search; static Search: typeof Search;
static TextArea: typeof TextArea; static TextArea: typeof TextArea;
@ -148,7 +148,7 @@ export default class Input extends Component<InputProps, any> {
> >
<span className={className}> <span className={className}>
{addonBefore} {addonBefore}
{cloneElement(children, { style: null })} {React.cloneElement(children, { style: null })}
{addonAfter} {addonAfter}
</span> </span>
</span> </span>
@ -187,7 +187,7 @@ export default class Input extends Component<InputProps, any> {
style={props.style} style={props.style}
> >
{prefix} {prefix}
{cloneElement(children, { style: null, className: this.getInputClassName() })} {React.cloneElement(children, { style: null, className: this.getInputClassName() })}
{suffix} {suffix}
</span> </span>
); );

2
components/input/Search.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Input, { InputProps } from './Input'; import Input, { InputProps } from './Input';
import Icon from '../icon'; import Icon from '../icon';

2
components/input/TextArea.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import omit from 'omit.js'; import omit from 'omit.js';
import classNames from 'classnames'; import classNames from 'classnames';
import { AbstractInputProps } from './Input'; import { AbstractInputProps } from './Input';

2
components/layout/Sider.tsx

@ -14,7 +14,7 @@ if (typeof window !== 'undefined') {
window.matchMedia = window.matchMedia || matchMediaPolyfill; window.matchMedia = window.matchMedia || matchMediaPolyfill;
} }
import React from 'react'; import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import omit from 'omit.js'; import omit from 'omit.js';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';

2
components/layout/layout.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { SiderProps } from './Sider'; import { SiderProps } from './Sider';

2
components/list/Item.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { Col } from '../grid'; import { Col } from '../grid';

4
components/list/index.tsx

@ -1,4 +1,4 @@
import React, { Component } from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
@ -48,7 +48,7 @@ export interface ListProps {
locale?: Object; locale?: Object;
} }
export default class List extends Component<ListProps> { export default class List extends React.Component<ListProps> {
static Item: typeof Item = Item; static Item: typeof Item = Item;
static childContextTypes = { static childContextTypes = {

2
components/locale-provider/LocaleReceiver.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
export interface LocaleReceiverProps { export interface LocaleReceiverProps {

2
components/locale-provider/ar_EG.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('ar'); moment.locale('ar');
import Pagination from 'rc-pagination/lib/locale/ar_EG'; import Pagination from 'rc-pagination/lib/locale/ar_EG';

2
components/locale-provider/bg_BG.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('bg'); moment.locale('bg');
import Pagination from 'rc-pagination/lib/locale/bg_BG'; import Pagination from 'rc-pagination/lib/locale/bg_BG';

2
components/locale-provider/ca_ES.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('ca'); moment.locale('ca');
import Pagination from 'rc-pagination/lib/locale/ca_ES'; import Pagination from 'rc-pagination/lib/locale/ca_ES';

2
components/locale-provider/cs_CZ.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('cs'); moment.locale('cs');
import Pagination from 'rc-pagination/lib/locale/cs_CZ'; import Pagination from 'rc-pagination/lib/locale/cs_CZ';

2
components/locale-provider/de_DE.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('de'); moment.locale('de');
import Pagination from 'rc-pagination/lib/locale/de_DE'; import Pagination from 'rc-pagination/lib/locale/de_DE';

2
components/locale-provider/el_GR.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('el'); moment.locale('el');
import Pagination from 'rc-pagination/lib/locale/el_GR'; import Pagination from 'rc-pagination/lib/locale/el_GR';

2
components/locale-provider/en_GB.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('en-gb'); moment.locale('en-gb');
import Pagination from 'rc-pagination/lib/locale/en_GB'; import Pagination from 'rc-pagination/lib/locale/en_GB';

2
components/locale-provider/en_US.tsx

@ -1,5 +1,5 @@
import defaultLocale from './default'; import defaultLocale from './default';
import moment from 'moment'; import * as moment from 'moment';
moment.locale('en'); moment.locale('en');
export default defaultLocale; export default defaultLocale;

2
components/locale-provider/et_EE.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('et'); moment.locale('et');
import Pagination from 'rc-pagination/lib/locale/et_EE'; import Pagination from 'rc-pagination/lib/locale/et_EE';

2
components/locale-provider/fa_IR.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('fa'); moment.locale('fa');
import Pagination from 'rc-pagination/lib/locale/fa_IR'; import Pagination from 'rc-pagination/lib/locale/fa_IR';

2
components/locale-provider/fi_FI.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('fi'); moment.locale('fi');
import Pagination from 'rc-pagination/lib/locale/fi_FI'; import Pagination from 'rc-pagination/lib/locale/fi_FI';

2
components/locale-provider/fr_BE.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('fr'); moment.locale('fr');
import Pagination from 'rc-pagination/lib/locale/fr_BE'; import Pagination from 'rc-pagination/lib/locale/fr_BE';

2
components/locale-provider/fr_FR.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('fr'); moment.locale('fr');
import Pagination from 'rc-pagination/lib/locale/fr_FR'; import Pagination from 'rc-pagination/lib/locale/fr_FR';

2
components/locale-provider/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { ModalLocale, changeConfirmLocale } from '../modal/locale'; import { ModalLocale, changeConfirmLocale } from '../modal/locale';

2
components/locale-provider/is_IS.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('is'); moment.locale('is');
import Pagination from 'rc-pagination/lib/locale/is_IS'; import Pagination from 'rc-pagination/lib/locale/is_IS';

2
components/locale-provider/it_IT.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('it'); moment.locale('it');
import Pagination from 'rc-pagination/lib/locale/it_IT'; import Pagination from 'rc-pagination/lib/locale/it_IT';

2
components/locale-provider/ja_JP.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('ja'); moment.locale('ja');
import Pagination from 'rc-pagination/lib/locale/ja_JP'; import Pagination from 'rc-pagination/lib/locale/ja_JP';

2
components/locale-provider/ko_KR.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('ko'); moment.locale('ko');
import Pagination from 'rc-pagination/lib/locale/ko_KR'; import Pagination from 'rc-pagination/lib/locale/ko_KR';

2
components/locale-provider/nb_NO.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('nb'); moment.locale('nb');
import Pagination from 'rc-pagination/lib/locale/nb_NO'; import Pagination from 'rc-pagination/lib/locale/nb_NO';

2
components/locale-provider/nl_BE.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('nl-be'); moment.locale('nl-be');
import Pagination from 'rc-pagination/lib/locale/nl_BE'; import Pagination from 'rc-pagination/lib/locale/nl_BE';

2
components/locale-provider/nl_NL.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('nl'); moment.locale('nl');
import Pagination from 'rc-pagination/lib/locale/nl_NL'; import Pagination from 'rc-pagination/lib/locale/nl_NL';

2
components/locale-provider/pl_PL.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('pl'); moment.locale('pl');
import Pagination from 'rc-pagination/lib/locale/pl_PL'; import Pagination from 'rc-pagination/lib/locale/pl_PL';

2
components/locale-provider/pt_BR.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('pt-br'); moment.locale('pt-br');
import Pagination from 'rc-pagination/lib/locale/pt_BR'; import Pagination from 'rc-pagination/lib/locale/pt_BR';

2
components/locale-provider/pt_PT.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('pt'); moment.locale('pt');
import Pagination from 'rc-pagination/lib/locale/pt_PT'; import Pagination from 'rc-pagination/lib/locale/pt_PT';

2
components/locale-provider/ru_RU.tsx

@ -2,7 +2,7 @@
* Created by Andrey Gayvoronsky on 13/04/16. * Created by Andrey Gayvoronsky on 13/04/16.
*/ */
import moment from 'moment'; import * as moment from 'moment';
moment.locale('ru'); moment.locale('ru');
import Pagination from 'rc-pagination/lib/locale/ru_RU'; import Pagination from 'rc-pagination/lib/locale/ru_RU';

2
components/locale-provider/sk_SK.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('sk'); moment.locale('sk');
import Pagination from 'rc-pagination/lib/locale/sk_SK'; import Pagination from 'rc-pagination/lib/locale/sk_SK';

2
components/locale-provider/sr_RS.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('sr'); moment.locale('sr');
import Pagination from 'rc-pagination/lib/locale/sr_RS'; import Pagination from 'rc-pagination/lib/locale/sr_RS';

2
components/locale-provider/sv_SE.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('sv'); moment.locale('sv');
import Pagination from 'rc-pagination/lib/locale/sv_SE'; import Pagination from 'rc-pagination/lib/locale/sv_SE';

2
components/locale-provider/th_TH.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('th'); moment.locale('th');
import Pagination from 'rc-pagination/lib/locale/th_TH'; import Pagination from 'rc-pagination/lib/locale/th_TH';

2
components/locale-provider/tr_TR.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('tr'); moment.locale('tr');
import Pagination from 'rc-pagination/lib/locale/en_US'; import Pagination from 'rc-pagination/lib/locale/en_US';

2
components/locale-provider/uk_UA.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('uk'); moment.locale('uk');
import Pagination from 'rc-pagination/lib/locale/uk_UA'; import Pagination from 'rc-pagination/lib/locale/uk_UA';

2
components/locale-provider/vi_VN.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('vi'); moment.locale('vi');
import Pagination from 'rc-pagination/lib/locale/vi_VN'; import Pagination from 'rc-pagination/lib/locale/vi_VN';

2
components/locale-provider/zh_CN.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('zh-cn'); moment.locale('zh-cn');
import Pagination from 'rc-pagination/lib/locale/zh_CN'; import Pagination from 'rc-pagination/lib/locale/zh_CN';

2
components/locale-provider/zh_TW.tsx

@ -1,4 +1,4 @@
import moment from 'moment'; import * as moment from 'moment';
moment.locale('zh-tw'); moment.locale('zh-tw');
import Pagination from 'rc-pagination/lib/locale/zh_TW'; import Pagination from 'rc-pagination/lib/locale/zh_TW';

2
components/mention/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import RcMention, { Nav, toString, toEditorState, getMentions } from 'rc-editor-mention'; import RcMention, { Nav, toString, toEditorState, getMentions } from 'rc-editor-mention';
import classNames from 'classnames'; import classNames from 'classnames';
import shallowequal from 'shallowequal'; import shallowequal from 'shallowequal';

2
components/menu/MenuItem.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import { Item } from 'rc-menu'; import { Item } from 'rc-menu';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Tooltip from '../tooltip'; import Tooltip from '../tooltip';

2
components/menu/SubMenu.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { SubMenu as RcSubMenu } from 'rc-menu'; import { SubMenu as RcSubMenu } from 'rc-menu';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/menu/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import RcMenu, { Divider, ItemGroup } from 'rc-menu'; import RcMenu, { Divider, ItemGroup } from 'rc-menu';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/message/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Notification from 'rc-notification'; import Notification from 'rc-notification';
import Icon from '../icon'; import Icon from '../icon';

4
components/modal/ActionButton.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import Button from '../button'; import Button from '../button';
import { ButtonType } from '../button/button'; import { ButtonType } from '../button/button';

2
components/modal/Modal.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Dialog from 'rc-dialog'; import Dialog from 'rc-dialog';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import addEventListener from 'rc-util/lib/Dom/addEventListener'; import addEventListener from 'rc-util/lib/Dom/addEventListener';

4
components/modal/confirm.tsx

@ -1,5 +1,5 @@
import React from 'react'; import * as React from 'react';
import ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import classNames from 'classnames'; import classNames from 'classnames';
import Icon from '../icon'; import Icon from '../icon';
import Dialog from './Modal'; import Dialog from './Modal';

2
components/notification/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Notification from 'rc-notification'; import Notification from 'rc-notification';
import Icon from '../icon'; import Icon from '../icon';

2
components/pagination/MiniSelect.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Select, { OptionProps } from '../select'; import Select, { OptionProps } from '../select';
export default class MiniSelect extends React.Component<any, any> { export default class MiniSelect extends React.Component<any, any> {

2
components/pagination/Pagination.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import RcPagination from 'rc-pagination'; import RcPagination from 'rc-pagination';
import enUS from 'rc-pagination/lib/locale/en_US'; import enUS from 'rc-pagination/lib/locale/en_US';
import classNames from 'classnames'; import classNames from 'classnames';

2
components/popconfirm/index.tsx

@ -1,4 +1,4 @@
import React from 'react'; import * as React from 'react';
import Tooltip, { AbstractTooltipProps } from '../tooltip'; import Tooltip, { AbstractTooltipProps } from '../tooltip';
import Icon from '../icon'; import Icon from '../icon';
import Button from '../button'; import Button from '../button';

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save