-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
4,273 additions
and
2,871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,3 @@ | |
- RichEditor | ||
- TimePicker | ||
- 🔨typescript版本由3.x更新到4.x,eslint相关规则进行了typescript优化适应与变更 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## ppfish 1.8.1 版本升级说明 | ||
|
||
### 1.8.1-alpha.1 | ||
- 🔥🎊 新增Config全局配置组件,新增国际化相关功能,对以下组件进行了国际化改造: | ||
- AudioPlayer | ||
- AutoComplete | ||
- Cascader | ||
- DatePicker | ||
- Guide | ||
- List | ||
- LoadMore | ||
- Modal | ||
- Pagination | ||
- RichEditor | ||
- Select | ||
- Spin | ||
- Table | ||
- Transfer | ||
- TreeSelect | ||
- Uploader | ||
- VideoViewer | ||
|
||
- 🐛对入口文件进行ts声明文件支持 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# ConfigProvider 全局化配置 | ||
为组件提供统一的全局化配置。 | ||
|
||
|
||
## 使用 | ||
|
||
ConfigProvider 使用 React 的 [Context](https://reactjs.org/docs/context.html) 特性,只需在应用外围包裹一次即可全局生效。 | ||
|
||
```js | ||
import { Config, Locale } from 'ppfish'; | ||
|
||
const ConfigProvider = Config.Provider; | ||
const { zh_CN } = Locale; | ||
|
||
export default () => ( | ||
<ConfigProvider Locale={zh_CN}> | ||
<App /> | ||
</ConfigProvider> | ||
); | ||
``` | ||
|
||
## 使用演示 | ||
|
||
:::demo Change locale of components: | ||
```js | ||
|
||
state = { | ||
currentLocale: Locale.zh_CN, | ||
}; | ||
|
||
onChange = (e) => { | ||
const {zh_CN, en_US} = Locale; | ||
const lang = e.target.value; | ||
|
||
let currentLocale = zh_CN; | ||
|
||
if(lang === 'en_US') { | ||
currentLocale = en_US; | ||
} | ||
|
||
this.setState({ | ||
currentLocale | ||
}) | ||
} | ||
info=() => { | ||
Modal.info({ | ||
title: 'This is a notification message', | ||
content: ( | ||
<div> | ||
<p>some messages...some messages...</p> | ||
<p>some messages...some messages...</p> | ||
</div> | ||
), | ||
onOk() {}, | ||
}); | ||
} | ||
|
||
success=() => { | ||
Modal.success({ | ||
title: 'This is a success message', | ||
content: 'some messages...some messages...', | ||
}); | ||
} | ||
|
||
error=() => { | ||
Modal.error({ | ||
title: 'This is an error message', | ||
content: 'some messages...some messages...', | ||
}); | ||
} | ||
|
||
warning=() => { | ||
Modal.warning({ | ||
title: 'This is a warning message', | ||
content: 'some messages...some messages...', | ||
}); | ||
} | ||
render() { | ||
const {currentLocale} = this.state; | ||
const ConfigProvider = Config.Provider; | ||
|
||
return ( | ||
<div className="configProviderDemo"> | ||
<ConfigProvider Locale={currentLocale}> | ||
<Radio.Group onChange={this.onChange} defaultValue="zh_CN"> | ||
<Radio.Button value="zh_CN">中文</Radio.Button> | ||
<Radio.Button value="en_US">English</Radio.Button> | ||
</Radio.Group> | ||
<Divider /> | ||
<Row gutter={24} className="btn-group"> | ||
<Button onClick={this.info}>Info</Button> | ||
<Button onClick={this.success}>Success</Button> | ||
<Button onClick={this.error}>Error</Button> | ||
<Button onClick={this.warning}>Warning</Button> | ||
</Row> | ||
<Row> | ||
<Pagination | ||
defaultCurrent={3} | ||
total={500} | ||
showQuickJumper | ||
showSizeChanger /> | ||
</Row> | ||
<Row> | ||
<Select style={{width: 300}}> | ||
<Select.Option value={0}>{'选项0'}</Select.Option> | ||
<Select.Option value={1}>{'选项1'}</Select.Option> | ||
<Select.Option value={2}>{'选项2'}</Select.Option> | ||
<Select.Option value={3}>{'选项3'}</Select.Option> | ||
</Select> | ||
</Row> | ||
<Row> | ||
<Transfer | ||
dataSource={[]} | ||
showSearch | ||
titles={['源列表', '目标列表']} | ||
targetKeys={[]} | ||
selectedKeys={[]} | ||
render={item => item.title} | ||
/> | ||
</Row> | ||
<Row> | ||
<DatePicker | ||
style={{width: 300, marginRight: 12}} | ||
/> | ||
<DatePicker | ||
style={{width: 310}} | ||
showTime={true} | ||
/> | ||
</Row> | ||
<RichEditor /> | ||
</ConfigProvider> | ||
</div> | ||
) | ||
} | ||
``` | ||
|
||
```less | ||
.configProviderDemo .fishd-row { | ||
margin: 8px 0 | ||
} | ||
|
||
.configProviderDemo .btn-group .fishd-btn { | ||
margin-right: 8px; | ||
} | ||
``` | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 国际化 | ||
ppfish 目前的默认文案是中文,如果需要使用其他语言,可以参考下面的方案。 | ||
|
||
## ConfigProvider | ||
ppfish 提供了一个 React 组件 ConfigProvider 用于全局配置国际化文案。 | ||
|
||
|
||
```js | ||
import { Config, Locale } from 'ppfish'; | ||
|
||
const { zh_CN } = Locale; | ||
const ConfigProvider = Config.Provider; | ||
|
||
return ( | ||
<ConfigProvider Locale={zh_CN}> | ||
<App /> | ||
</ConfigProvider> | ||
); | ||
|
||
``` | ||
更详细的配置以及使用见:[ConfigProvider](/#/components/configProvider) | ||
|
||
|
||
## 支持的语言 | ||
``注意:zh_CN 是本地化语言对象,开发者可以自己制定该对象并传入 ConfigProvider 中`` | ||
|
||
ppfish 目前支持的语言包如下: | ||
- 简体中文(zh_CN) | ||
- 英文 (en_US) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.