From ef84f8d408ea65f441babf8a6c98afde7d8e3cc2 Mon Sep 17 00:00:00 2001 From: ddcat1115 Date: Tue, 2 Aug 2016 16:10:26 +0800 Subject: [PATCH] refactor: ts LocaleProvider (#2548) --- components/index.tsx | 3 +++ components/locale-provider/index.tsx | 16 +++++++++++++++- components/modal/locale.tsx | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/components/index.tsx b/components/index.tsx index dcf7e1505d..a8cc3f175b 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -31,6 +31,9 @@ export { Carousel }; import Cascader from './cascader'; export { Cascader }; +import LocaleProvider from './locale-provider'; +export { LocaleProvider }; + import Popconfirm from './popconfirm'; export { Popconfirm }; diff --git a/components/locale-provider/index.tsx b/components/locale-provider/index.tsx index 35a3c7636a..e908b04fdc 100644 --- a/components/locale-provider/index.tsx +++ b/components/locale-provider/index.tsx @@ -1,7 +1,21 @@ import * as React from 'react'; import { changeConfirmLocale } from '../modal/locale'; -export default class LocaleProvider extends React.Component { +export interface LocaleProviderProps { + locale: { + Pagination?: Object, + DatePicker?: Object, + TimePicker?: Object, + Calendar?: Object, + Table?: Object, + Modal?: Object, + Popconfirm?: Object, + Transfer?: Object, + Select?: Object, + }; +} + +export default class LocaleProvider extends React.Component { static propTypes = { locale: React.PropTypes.object, }; diff --git a/components/modal/locale.tsx b/components/modal/locale.tsx index 3c6b5945eb..a4043d745b 100644 --- a/components/modal/locale.tsx +++ b/components/modal/locale.tsx @@ -8,7 +8,7 @@ const defaultLocale = { let runtimeLocale = assign({}, defaultLocale); -export function changeConfirmLocale(newLocale) { +export function changeConfirmLocale(newLocale?: Object) { if (newLocale) { runtimeLocale = assign({}, runtimeLocale, newLocale); } else {