Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
myronliu347 committed Nov 11, 2019
2 parents f1d2f06 + 56181c9 commit 46b8e5c
Show file tree
Hide file tree
Showing 38 changed files with 351 additions and 220 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# Change Log

## [1.18.14](https://github.com/alibaba-fusion/next/compare/1.18.13...1.18.14) (2019-11-08)


### Bug Fixes

* **Menu:** group and its children should have the same inlineLevel ([228c6ad](https://github.com/alibaba-fusion/next/commit/228c6ad)), closes [#1330](https://github.com/alibaba-fusion/next/issues/1330)
* **Table:** correct rowIndex when useVirtual ([6fc5259](https://github.com/alibaba-fusion/next/commit/6fc5259))
* **TimePicker:** Can`t reset input props ([53354c0](https://github.com/alibaba-fusion/next/commit/53354c0))




## [1.18.13](https://github.com/alibaba-fusion/next/compare/1.18.12...1.18.13) (2019-11-06)




## [1.18.12](https://github.com/alibaba-fusion/next/compare/1.18.11...1.18.12) (2019-11-05)


### Bug Fixes

* **Checkbox:** fix nested checkbox style ([1088fbb](https://github.com/alibaba-fusion/next/commit/1088fbb))
* **Input:** lifecycle for didUpdate close [#1301](https://github.com/alibaba-fusion/next/issues/1301) ([8e21cc8](https://github.com/alibaba-fusion/next/commit/8e21cc8))
* **Menu:** make arrow in hoz configurable, [#1280](https://github.com/alibaba-fusion/next/issues/1280) ([b7c6322](https://github.com/alibaba-fusion/next/commit/b7c6322))
* **Nav:** correct child selected state, close [#1280](https://github.com/alibaba-fusion/next/issues/1280) ([9d68697](https://github.com/alibaba-fusion/next/commit/9d68697))
* **Nav:** icon is blocked 1px in iconOnly mode, close [#1278](https://github.com/alibaba-fusion/next/issues/1278) ([9c3fd0a](https://github.com/alibaba-fusion/next/commit/9c3fd0a))
* **Notification:** title and content are not both required ([49b4b96](https://github.com/alibaba-fusion/next/commit/49b4b96))
* **Switch:** update getDerivedStateFromProps logic ([638e6b1](https://github.com/alibaba-fusion/next/commit/638e6b1)) ([5ac62df](https://github.com/alibaba-fusion/next/commit/5ac62df))
* **Table:** expanded trigger cell's width should be unchanged, close [#1281](https://github.com/alibaba-fusion/next/issues/1281) ([9fca31b](https://github.com/alibaba-fusion/next/commit/9fca31b))
* **TreeSelect:** Can`t remove tag ([7ef73f0](https://github.com/alibaba-fusion/next/commit/7ef73f0))




## [1.18.11](https://github.com/alibaba-fusion/next/compare/1.18.10...1.18.11) (2019-10-31)


### Bug Fixes

* **Range:** add window.pageXOffset when calculate ([#1289](https://github.com/alibaba-fusion/next/issues/1289)) ([3460f0f](https://github.com/alibaba-fusion/next/commit/3460f0f))




## [1.18.10](https://github.com/alibaba-fusion/next/compare/1.18.9...1.18.10) (2019-10-29)


### Bug Fixes

* **ConfigProvider:** warning when config function component ([6eb71b5](https://github.com/alibaba-fusion/next/commit/6eb71b5))
* **NumberPicker:** under control input 0 => 0. ([60c0d86](https://github.com/alibaba-fusion/next/commit/60c0d86))




## [1.18.9](https://github.com/alibaba-fusion/next/compare/1.18.8...1.18.9) (2019-10-28)


Expand Down
6 changes: 4 additions & 2 deletions LATESTLOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Latest Log

## [1.18.9](https://github.com/alibaba-fusion/next/compare/1.18.8...1.18.9) (2019-10-28)
## [1.18.14](https://github.com/alibaba-fusion/next/compare/1.18.13...1.18.14) (2019-11-08)


### Bug Fixes

* **Field:** validate bind ([3ad8068](https://github.com/alibaba-fusion/next/commit/3ad8068))
* **Menu:** group and its children should have the same inlineLevel ([228c6ad](https://github.com/alibaba-fusion/next/commit/228c6ad)), closes [#1330](https://github.com/alibaba-fusion/next/issues/1330)
* **Table:** correct rowIndex when useVirtual ([6fc5259](https://github.com/alibaba-fusion/next/commit/6fc5259))
* **TimePicker:** Can`t reset input props ([53354c0](https://github.com/alibaba-fusion/next/commit/53354c0))


19 changes: 12 additions & 7 deletions docs/config-provider/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,42 @@ class Output extends React.Component {
static propTypes = {
prefix: PropTypes.string,
locale: PropTypes.object,
pure: PropTypes.bool
};

static defaultProps = {
prefix: 'next-',
locale: {
hello: '你好'
},
pure: false
}
};

render() {
const { prefix, locale, pure } = this.props;
const { prefix, locale } = this.props;

return (
<ul>
<li>prefix: {prefix}</li>
<li>locale: {JSON.stringify(locale)}</li>
<li>pure: {pure.toString()}</li>
</ul>
);
}
}

const Func = props => {
return <div>This is a Function Component</div>;
};

const NewFunc = config(Func);
const NewOutput = config(Output);

class Demo extends React.Component {
render() {
return (
<ConfigProvider prefix="custom-" locale={{ Output: { hello: 'hello' } }} pure>
<NewOutput />
<ConfigProvider prefix="custom-" locale={{ Output: { hello: 'hello' } }}>
<div>
<NewOutput />
<NewFunc />
</div>
</ConfigProvider>
);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/field/demo/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

`注意`:Form 和 Field 做了深度结合,在 Form 中使用Field,错误信息不需`getError`获取会自动展现。

请参考 validatorPromise demo,以使用Promise而不是回调
请参考 validatorPromise demo,以使用 Promise 而不是回调

:::lang=en-us
# validate
Expand Down
68 changes: 3 additions & 65 deletions docs/field/demo/validatorPromise.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 验证承诺
# 校验 promise

- order: 4

验证表单值,并在承诺中返回错误。也支持回调。如果回调返回承诺,承诺的结果将在 “验证” 函数的承诺中返回。
使用 Promise 的方式作为校验返回

:::lang=en-us
# validate Promise
Expand All @@ -17,10 +17,7 @@ validate form values with errors returned wrapped in a promise. Also supports ca
````jsx
import ReactDOM from 'react-dom';
import React from 'react';
import { Input, Button, Checkbox } from '@alifd/next';
import Field from '@alifd/field';


import { Input, Button, Checkbox, Field } from '@alifd/next';

const CheckboxGroup = Checkbox.Group;

Expand Down Expand Up @@ -67,26 +64,6 @@ class App extends React.Component {
const init = this.field.init;

return (<div className="demo">
<Input {...init('input', {initValue: 'delete all', rules: {required: true}})} />
{this.field.getError('input') ?
<span style={{color: 'red'}}>{this.field.getError('input').join(',')}</span> : ''}

<br/>
<br/>

<Input placeholder="try onBlur" {...init('input1', {
rules: [{
required: true,
message: 'can not be empty',
trigger: ['onBlur', 'onChange']
}]
})} />
{this.field.getError('input1') ?
<span style={{color: 'red'}}>{this.field.getError('input1').join(',')}</span> : ''}

<br/>
<br/>

<Input defaultValue="" placeholder="try frank" {...init('username', {
rules: [{
validator: this.userName,
Expand All @@ -111,35 +88,6 @@ class App extends React.Component {
<br/>
<br/>

<Input.TextArea placeholder=">3 and <10" {...init('textarea', {
rules: [{
required: true,
minLength: 3,
maxLength: 10
}]
})} />
{this.field.getError('textarea') ?
<span style={{color: 'red'}}>{this.field.getError('textarea').join(',')}</span> : ''}

<br/>
<br/>

{this.state.checkboxStatus ? <div>
Array validate:
<CheckboxGroup dataSource={list} {...init('checkboxgroup', {
rules: [{
required: true,
type: 'array',
message: 'choose one please'
}]
})} style={{marginBottom: 10}}/>
{this.field.getError('checkboxgroup') ?
<span style={{color: 'red'}}>{this.field.getError('checkboxgroup').join(',')}</span> : ''}
</div> : null}

<br/>
<br/>

<Button type="primary" onClick={() => {
this.field.validatePromise().then(({errors, values}) => {
console.log(errors, values);
Expand All @@ -148,16 +96,6 @@ class App extends React.Component {
<Button onClick={() => {
this.field.reset();
}}>reset</Button>

<Button onClick={() => {
if (this.state.checkboxStatus) {
this.setState({checkboxStatus: false});
this.field.remove('checkboxgroup');
} else {
this.setState({checkboxStatus: true});
}

}}>{this.state.checkboxStatus ? 'delete' : 'restore'}</Button>
</div>);
}
}
Expand Down
62 changes: 32 additions & 30 deletions docs/shell/theme/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ class RenderShell extends React.Component {
const { type, i18n, demoFunction } = this.props;
const device = demoFunction.device.value;
const globalDir = demoFunction.navigation.value;
// let globalNavType = demoFunction.navigationType.value,
let globalNavType = demoFunction.navigationType.value,
// localNavType = demoFunction.localNavType.value,
let globalHozNavType = 'normal',
// globalHozNavType = 'normal',
localNavType = 'normal',
logoStyle = {},
shellStyle = {};

switch(type) {
case 'light':
logoStyle = {width: 32, height: 32, background: '#000', opacity: '0.04'};
globalHozNavType = 'normal';
// globalHozNavType = 'normal';
break;
case 'dark':
logoStyle = {width: 32, height: 32, background: '#FFF', opacity: '0.2'};
globalHozNavType = globalDir === 'hoz' ? 'primary' : 'normal';
// globalHozNavType = globalDir === 'hoz' ? 'primary' : 'normal';
break;
case 'brand':
logoStyle = {width: 32, height: 32, background: '#000', opacity: '0.04'};
globalHozNavType = globalDir === 'hoz' ? 'secondary' : 'normal';
// globalHozNavType = globalDir === 'hoz' ? 'secondary' : 'normal';
break;
default:
break;
Expand All @@ -68,8 +68,8 @@ class RenderShell extends React.Component {
default:
break;
}
return (<Demo title={i18n[type]} key={type}>
<DemoGroup label={'normal'}>
return (<Demo title={'Shell'} key={type}>
<DemoGroup label={'default'}>
<Shell style={shellStyle} device={device} type={type}>
{
demoFunction.branding.value === 'true'
Expand All @@ -83,7 +83,7 @@ class RenderShell extends React.Component {
{
demoFunction.navigation.value !== 'false'
? <Shell.Navigation direction={globalDir}>
<Nav type={globalHozNavType} embeddable direction={globalDir} hozInLine>
<Nav type={globalNavType} embeddable direction={globalDir} hozInLine>
<Nav.Item icon="account">Nav Item 1</Nav.Item>
<Nav.Item icon="calendar">Nav Item 2</Nav.Item>
<Nav.Item icon="atm">Nav Item 3</Nav.Item>
Expand Down Expand Up @@ -237,23 +237,23 @@ class FunctionDemo extends React.Component {
value: 'false'
}]
},
// 'navigationType': {
// label: 'Applicaitoin Nav Type',
// value: 'normal',
// enum: [{
// label: 'normal',
// value: 'normal'
// }, {
// label: 'primary',
// value: 'primary'
// }, {
// label: 'secondary',
// value: 'secondary'
// }, {
// label: 'line',
// value: 'line'
// }]
// },
'navigationType': {
label: 'App Nav Type',
value: 'normal',
enum: [{
label: 'normal',
value: 'normal'
}, {
label: 'primary',
value: 'primary'
}, {
label: 'secondary',
value: 'secondary'
}, {
label: 'line',
value: 'line'
}]
},
'localNav': {
label: 'Local Nav',
value: 'false',
Expand Down Expand Up @@ -337,21 +337,23 @@ class FunctionDemo extends React.Component {
}

render() {
const { title, locale, types, shellRender } = this.props;
const { title, locale, type, shellRender } = this.props;
const { demoFunction } = this.state;

return (<Demo title={title} demoFunction={demoFunction} onFunctionChange={this.onFunctionChange}>
{
types.map(type => shellRender(type, locale, demoFunction))
}
{ shellRender(type, locale, demoFunction) }
</Demo>)
}
}


function render(i18n, lang) {
return ReactDOM.render(<ConfigProvider lang={lang === 'en-us' ? enUS : zhCN}><div className="demo-container">
<FunctionDemo title={i18n.shell} locale={i18n} shellRender={renderShell} types={['light', 'dark', 'brand']} />
{
['light', 'dark', 'brand'].map(type => {
return <FunctionDemo key={type} type={type} title={i18n[type]} locale={i18n} shellRender={renderShell} />
})
}
</div></ConfigProvider>, document.getElementById('container'));
}

Expand Down
18 changes: 11 additions & 7 deletions docs/transfer/demo/custom-panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,28 @@ class Demo extends React.Component {
const { selected } = this.state;

return (
<Transfer
dataSource={transferDataSource}
listStyle={{ width: '200px', height: '192px' }}
onChange={this.handleChange}
<Transfer
dataSource={transferDataSource}
listStyle={{ width: '200px', height: '192px' }}
onChange={this.handleChange}
titles={[<Button key='left' type='primary'>Source</Button>, 'Target']} >
{ ({ position, onChange, value }) => {
if (position === 'left') {
return (
<Tree checkable editable
style={{padding: '10px'}}
checkedKeys={value}
onCheck={(keys, extra) => {const newValues=extra.checkedNodes.map(item => item.props.value); onChange(position, newValues);}}
>
onCheck={
(keys, extra) => {
const newValues=extra.checkedNodes.map(item => item.props.value);
onChange(position, newValues);
}
}>
{this.getTreeDataSource(treeDataSource, selected)}
</Tree>
);
}
}
}
}
</Transfer>
);
Expand Down
Loading

0 comments on commit 46b8e5c

Please sign in to comment.