Skip to content

Commit

Permalink
feat(@uform/next): update next features (#439)
Browse files Browse the repository at this point in the history
* feat(@uform/next): update next features

* fix(@uform/antd): fix typings
  • Loading branch information
janryWang authored Nov 27, 2019
1 parent fd93386 commit 15b6b43
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 22 deletions.
13 changes: 12 additions & 1 deletion docs/Examples/next/Sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ ReactDOM.render(
title="TextArea"
name="textarea"
x-component="textarea"
x-rules={value => {
return value > 20
? {
type: 'warning',
message: '这是个警告信息'
}
: ''
}}
/>
<Field type="number" title="数字选择" name="number" />
<Field type="boolean" title="开关选择" name="boolean" />
Expand Down Expand Up @@ -115,7 +123,10 @@ ReactDOM.render(
/>
<Field
type="transfer"
enum={[{ value: 1, label: '选项1' }, { value: 2, label: '选项2' }]}
enum={[
{ value: 1, label: '选项1' },
{ value: 2, label: '选项2' }
]}
title="穿梭框"
name="transfer"
/>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/react": "16.8.23"
},
"devDependencies": {
"@alifd/next": "^1.14.2",
"@alifd/next": "^1.19.1",
"@babel/cli": "^7.2.0",
"@babel/core": "^7.3.3",
"@babel/plugin-proposal-class-properties": "^7.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type IFormItemTopProps = React.PropsWithChildren<
>

export interface ICompatItemProps
extends Exclude<ItemProps, 'labelCol' | 'wrapperCol'>,
extends Omit<ItemProps, 'labelCol' | 'wrapperCol'>,
Partial<ISchemaFieldComponentProps> {
labelCol?: number | { span: number; offset?: number }
wrapperCol?: number | { span: number; offset?: number }
Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"build": "ts-node --project ../../tsconfig.build.json build.ts"
},
"peerDependencies": {
"@alifd/next": "^1.13.1",
"@alifd/next": "^1.19.1",
"@babel/runtime": "^7.4.4",
"@types/classnames": "^2.2.9",
"@types/styled-components": "^4.1.19",
Expand All @@ -38,7 +38,7 @@
"styled-components": "^4.1.1"
},
"devDependencies": {
"@alifd/next": "^1.13.1",
"@alifd/next": "^1.19.1",
"@types/classnames": "^2.2.9",
"@types/styled-components": "^4.1.19"
},
Expand Down
7 changes: 3 additions & 4 deletions packages/next/src/compat/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ const computeStatus = (props: ICompatItemProps) => {
if (props.invalid) {
return 'error'
}
//todo:暂时不支持
// if (props.warnings.length) {
// return 'warning'
// }
if (props.warnings.length) {
return 'warning'
}
}

const computeHelp = (props: ICompatItemProps) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/next/src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ export const mapStyledProps = (
props: IConnectProps,
fieldProps: MergedFieldComponentProps
) => {
const { loading, errors } = fieldProps
const { loading, errors, warnings } = fieldProps
if (loading) {
props.state = props.state || 'loading'
} else if (errors && errors.length) {
props.state = 'error'
} else if (warnings && warnings.length) {
props.state = 'warning'
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type IFormItemTopProps = React.PropsWithChildren<
>

export interface ICompatItemProps
extends Exclude<ItemProps, 'labelCol' | 'wrapperCol'>,
extends Omit<ItemProps, 'labelCol' | 'wrapperCol'>,
Partial<ISchemaFieldComponentProps> {
labelCol?: number | { span: number; offset?: number }
wrapperCol?: number | { span: number; offset?: number }
Expand Down
10 changes: 0 additions & 10 deletions scripts/doc-renderer.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import React from 'react'
import SiteRenderer from 'react-site-renderer'

;((window.gitter = {}).chat = {}).options = {
room: 'alibaba-uform/community'
}

setTimeout(() => {
const script = document.createElement('script')
script.src = '//sidecar.gitter.im/dist/sidecar.v1.js'
document.body.appendChild(script)
}, 1000)

export default ({ docs }) => {
return (
<SiteRenderer
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ window.codeSandBoxPeerDependencies = {
const FOOTER_HTML = `
<script src="//unpkg.com/moment/min/moment-with-locales.js"></script>
<script src="//unpkg.com/antd/dist/antd.min.js"></script>
<script src="//unpkg.com/@alifd/next/dist/next.min.js"></script>
<script src="//unpkg.com/@alifd/next@next/dist/next.min.js"></script>
`

const createDocs = async () => {
Expand Down

0 comments on commit 15b6b43

Please sign in to comment.