Skip to content

Commit

Permalink
Merge branch 'feature-1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
SummerOverture committed Jan 5, 2021
2 parents f50a31b + fb069d8 commit e649305
Show file tree
Hide file tree
Showing 57 changed files with 4,273 additions and 2,871 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppfish",
"version": "1.8.0-alpha.1.1",
"version": "1.8.1-alpha.1",
"description": "fish design ui components",
"typings": "lib/components/index.d.ts",
"scripts": {
Expand Down
15 changes: 15 additions & 0 deletions site/componentsPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export const components = {
type: 'markdown',
name: '设计资源',
published: true,
}, {
key: 'i18n',
type: 'markdown',
name: '国际化',
published: true,
}, {
key: 'customTheme',
type: 'markdown',
Expand Down Expand Up @@ -513,6 +518,16 @@ export const components = {
name: 'Spin 加载中',
published: true,
}]
}, {
key: '其他',
children: [
{
key: 'configProvider',
type: 'markdown',
name: 'ConfigProvider 全局化配置',
published: true,
}
]
}
],
};
Expand Down
1 change: 0 additions & 1 deletion site/docs/upgradeNotes/1.8/1.8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@
- RichEditor
- TimePicker
- 🔨typescript版本由3.x更新到4.x,eslint相关规则进行了typescript优化适应与变更

23 changes: 23 additions & 0 deletions site/docs/upgradeNotes/1.8/1.8.1.md
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声明文件支持
27 changes: 26 additions & 1 deletion site/docs/upgradeNotes/版本升级说明.md
Original file line number Diff line number Diff line change
Expand Up @@ -1112,4 +1112,29 @@
- RichEditor
- TimePicker
- 🔨typescript版本由3.x更新到4.x,eslint相关规则进行了typescript优化适应与变更


---
`2021.1.5`

## 1.8.0-alpha.1

- 🔥🎊 新增Config全局配置组件,新增国际化相关功能,对以下组件进行了国际化改造:
- AudioPlayer
- AutoComplete
- Cascader
- DatePicker
- Guide
- List
- LoadMore
- Modal
- Pagination
- RichEditor
- Select
- Spin
- Table
- Transfer
- TreeSelect
- Uploader
- VideoViewer

- 🐛对入口文件进行ts声明文件支持
146 changes: 146 additions & 0 deletions site/docs/zh-CN/configProvider.md
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;
}
```
:::
30 changes: 30 additions & 0 deletions site/docs/zh-CN/i18n.md
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)

2 changes: 1 addition & 1 deletion site/locales/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export default {
'feedback': '反馈建议',
'demo': '演示环境',
'mobileComponent': 'Mobile组件',
'version': '1.8.0'
'version': '1.8.1'
}
};
1 change: 1 addition & 0 deletions site/pages/demo/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
export {Resizable} from 'react-resizable';
export copy from 'copy-to-clipboard';
// ppfish发布的组件
export Locale from '../../../source/components/Locale';
export * from '../../../source/components';
Loading

0 comments on commit e649305

Please sign in to comment.