Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V1 UMBRELLA] #346

Merged
merged 87 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
b62c68b
refactor(@uform/core/validator): boom first
janryWang Sep 4, 2019
2fe168f
refactor(@uform/core/validator): improve typings
janryWang Sep 4, 2019
7199a45
test(@uform/validator): add validator tests
janryWang Sep 4, 2019
6be6172
test(@uform/core): add test cases
janryWang Sep 4, 2019
2d2dc95
test(@uform/core): add some tests
janryWang Sep 5, 2019
0801b9d
feat(@uform/core): support get/set graph
janryWang Sep 5, 2019
a8d16c7
feat(@uform/core): editable will clear errors
janryWang Sep 5, 2019
e58b4e6
refactor: optimize ts typings (#11)
stkevintan Sep 5, 2019
229494b
feat(@uform/core): backward compat
janryWang Sep 5, 2019
5509d44
Merge branch 'v1.0.0' of github.com:janryWang/uform into v1.0.0
janryWang Sep 5, 2019
a445d66
feat(@uform/core): backward compat
janryWang Sep 5, 2019
91aebe4
feat(@uform/core): add export default
janryWang Sep 5, 2019
292e061
feat(@uform/core): remove types package
janryWang Sep 5, 2019
ec339e8
feat(@uform/core): export validation api
janryWang Sep 5, 2019
49c7ebb
feat(@uform/core): support dynamic remove field
janryWang Sep 6, 2019
ed7d288
feat(@uform/react-schema-form): change name to @uform/react-schema-re…
janryWang Sep 6, 2019
a44cf82
feat(@uform/core): add test cases
janryWang Sep 6, 2019
d84136e
feat(@uform/core): support shadow update
janryWang Sep 6, 2019
670d243
feat(@uform/core): add snapshot test case
janryWang Sep 6, 2019
c37e8c9
feat(@uform/core): fix validate
janryWang Sep 6, 2019
bdb1d8d
fix(@uform/core): fix useDirty
janryWang Sep 7, 2019
5165c51
feat(@uform/core): support reset
janryWang Sep 7, 2019
23c63b2
feat(@uform/core): reset action will clear errors
janryWang Sep 7, 2019
9b67f58
feat(@uform/react): support react
janryWang Sep 8, 2019
4659584
fix(@uform/react): fix typo
janryWang Sep 9, 2019
0617755
feat(@uform/react): support onSubmit/onReset/onValidateFailed
janryWang Sep 9, 2019
8c3928b
refactor(@uform/core): update
janryWang Sep 9, 2019
f4c95de
feat(@uform/core): support FormSpy
janryWang Sep 9, 2019
8ea9bb7
refactor(@uform/core): improve typings
janryWang Sep 9, 2019
61c4337
feat(core): improve code
janryWang Sep 11, 2019
0839b69
fix(@uform/validator): fix validate not work when field was removed
janryWang Sep 11, 2019
dac0791
feat(@uform/core/react): support global editable controller
janryWang Sep 11, 2019
bf4208a
fix(@uform/core): fix value update
janryWang Sep 11, 2019
fa34e22
feat(@uform/react): support scheduler
janryWang Sep 11, 2019
689bd5e
feat(@uform/react): support FormProvider
janryWang Sep 11, 2019
a1c9183
feat(@uform/react): support FormConsumer
janryWang Sep 11, 2019
27536cd
feat(@uform/react): export FormConsumer
janryWang Sep 11, 2019
00328dd
feat(@uform/react): support effect hook
janryWang Sep 12, 2019
6190c22
feat(@uform/react): export useVirtualField
janryWang Sep 12, 2019
5ac67d6
feat(@uform/react): update readme
janryWang Sep 12, 2019
1778a63
fix(@uform/core): fix form graph memory leak
janryWang Sep 12, 2019
01159c4
feat(@uform/react): support async actions
janryWang Sep 14, 2019
4673e5e
feat(@uform/react-schema-renderer): first all
janryWang Sep 15, 2019
db9a390
feat(@uform/react-schema-renderer): update validate
janryWang Sep 15, 2019
facd82a
refactor(@uform/core): improve model
janryWang Sep 16, 2019
03a4a8a
refactor(@uform/core): improve model
janryWang Sep 16, 2019
67b3ecd
refactor(@uform/react-schema-renderer): improve code
janryWang Sep 16, 2019
4557b14
V1.0.0 (#13)
JohnIsOnTheRoad Sep 19, 2019
6af9e2a
feat(schema-renderer): support schema-form
janryWang Sep 21, 2019
ac97a3d
Merge branch 'v1.0.0' of github.com:janryWang/uform into v1.0.0
janryWang Sep 21, 2019
27f51a7
feat(@uform/core): improve code
janryWang Sep 21, 2019
506384c
feat(@uform/react-schema-renderer): support connect
janryWang Sep 21, 2019
36bac09
test(@uform/react-schema-renderer): add some test case
janryWang Sep 22, 2019
f9f13d1
feat(@uform/react-schema-renderer): support getFormSchema API
janryWang Sep 22, 2019
09fbbe0
feat(@uform/react-schema-renderer): add test todo
janryWang Sep 22, 2019
14be36b
feat(@uform/react): export effecthooks
janryWang Sep 22, 2019
67df291
feat(@uform/react): export effecthooks
janryWang Sep 22, 2019
9c401c9
test(schema): improve code
janryWang Sep 23, 2019
2796a44
refactor(schema): improve code
janryWang Sep 23, 2019
6b0c17d
refactor(shared): improve code
janryWang Sep 23, 2019
fc672db
feat(react): support ssr
janryWang Sep 23, 2019
8d51110
feat(core): enhanced unit test (#14)
JohnIsOnTheRoad Sep 23, 2019
175f0b3
Merge branch 'v1.0.0' of github.com:janryWang/uform into v1.0.0
janryWang Sep 23, 2019
22a5856
feat(@uform/core): FormSpy support props.reducer
janryWang Sep 23, 2019
41929d6
feat(@uform/core): FormSpy support props.reducer
janryWang Sep 23, 2019
de96835
feat(core + validator): enhance unit test and validate (#15)
JohnIsOnTheRoad Sep 23, 2019
828e7af
feat(core): fix validate and implement clearErrors (#16)
JohnIsOnTheRoad Sep 26, 2019
f27a162
feat(core): validating sync (#17)
JohnIsOnTheRoad Sep 26, 2019
5ad6b91
feat(core): add unit test (#18)
JohnIsOnTheRoad Sep 27, 2019
d2d0755
feat(@uform/next): improve
janryWang Oct 8, 2019
9a8b93d
Merge branch 'v1.0.0' of github.com:janryWang/uform into v1.0.0
janryWang Oct 8, 2019
152d1f8
feat(@uform/next): New architecture
janryWang Oct 8, 2019
a7ec682
fix(@uform/core): fix bug of setFieldState
janryWang Oct 8, 2019
4d24850
fix(@uform/react): fix typings
janryWang Oct 9, 2019
635e51e
fix(@uform/react): improve actions typings
janryWang Oct 9, 2019
dc0fa06
fix(@uform/validator): fix validator
janryWang Oct 10, 2019
95305e7
test(@uform/react-schema-renderer): update snapshot
janryWang Oct 10, 2019
d24e93d
fix(@uform/core): fix setFieldState match strategy
janryWang Oct 11, 2019
ba2d959
feat(@uform/next): compat the FormTextBox
janryWang Oct 13, 2019
3e3bfa1
feat(@uform/next): support FormStep
janryWang Oct 13, 2019
e6fabb7
feat(@uform/antd): complte first
janryWang Oct 14, 2019
8b0be53
feat(core): finish core/index unit test and fix errors calculate logi…
JohnIsOnTheRoad Oct 15, 2019
eebce5d
feat(@uform/antd): bugfix
janryWang Oct 15, 2019
dee1de8
Merge branch 'v1.0.0' of github.com:janryWang/uform into v1.0.0
janryWang Oct 15, 2019
cf3ed22
feat(@uform/antd/next): fix some styles
janryWang Oct 16, 2019
679e34c
fix(@uform/core): fix path match
janryWang Oct 24, 2019
d6bb435
Merge branch 'v1' of github.com:alibaba/uform into v1.0.0
janryWang Oct 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"ecmaFeatures": {
"jsx": true
}
}
},
}
68 changes: 44 additions & 24 deletions docs/Examples/antd/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
> 数组场景,区块型数组,能解决大量字段的聚合输入,但是对于数据的对比化展示,区分
> 度不够明显

下面对于List场景我们主要封装了
- Array类型组件
- Table类型组件
- Card类型组件
下面对于 List 场景我们主要封装了

- Array 类型组件
- Table 类型组件
- Card 类型组件

这些组件你都可以对其做简单的定制来适应你当前的业务需求,比如

Expand Down Expand Up @@ -66,8 +67,8 @@ const App = () => {
maxItems={3}
type="array"
x-props={{
renderAddition:'这是定制的添加文案',
renderRemove:'这是定制的删除文案'
renderAddition: '这是定制的添加文案',
renderRemove: '这是定制的删除文案'
}}
>
<Field type="object">
Expand All @@ -82,11 +83,7 @@ const App = () => {
</FormLayout>
</FormBlock>
<FormBlock title="嵌套数组">
<Field
name="array2"
maxItems={3}
type="array"
>
<Field name="array2" maxItems={3} type="array">
<Field type="object">
<FormLayout labelCol={9} wrapperCol={6}>
<Field name="aa" type="string" title="字段1" />
Expand Down Expand Up @@ -149,11 +146,23 @@ const App = () => (
maxItems={3}
type="array"
x-component="table"
x-props={{
renderExtraOperations(){
return <div>Hello worldasdasdasdasd</div>
x-props={{
scroll: { x: '200%' },
renderExtraOperations() {
return (
<div
style={{
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
lineHeight: '32px'
}}
>
Hello worldasdasdasdasd
</div>
)
},
operationsWidth:400
operationsWidth: 400
}}
>
<Field type="object">
Expand All @@ -169,7 +178,7 @@ const App = () => (
<Field name="dd" type="string" title="字段5" />
<Field name="ee" type="string" title="字段6" />
<Field name="ff" type="string" title="字段7" />
<Field name="gg" type="daterange" title="字段8" width={400} />
<Field name="gg" type="daterange" title="字段8" width={400} />
</Field>
</Field>
</SchemaForm>
Expand Down Expand Up @@ -207,12 +216,17 @@ import 'antd/dist/antd.css'
const App = () => (
<Printer>
<SchemaForm>
<Field name="array" maxItems={3} type="array" x-component="cards"
x-props={{
title:'这是卡片标题',
renderAddition:'这是定制的添加文案',
renderRemove:'这是定制的删除文案'
}}>
<Field
name="array"
maxItems={3}
type="array"
x-component="cards"
x-props={{
title: '这是卡片标题',
renderAddition: '这是定制的添加文案',
renderRemove: '这是定制的删除文案'
}}
>
<Field type="object">
<FormLayout labelCol={6} wrapperCol={8}>
<Field
Expand All @@ -227,9 +241,15 @@ const App = () => (
<Field name="dd" type="string" title="字段5" />
<Field name="ee" type="string" title="字段6" />
<Field name="ff" type="string" title="字段7" />
<Field name="gg" type="daterange" title="字段8"/>
<Field name="gg" type="daterange" title="字段8" />
</FormLayout>
<Field name="array" maxItems={3} type="array" x-component="cards" x-props={{title:'这是卡片标题'}}>
<Field
name="array"
maxItems={3}
type="array"
x-component="cards"
x-props={{ title: '这是卡片标题' }}
>
<Field type="object">
<FormLayout labelCol={6} wrapperCol={8}>
<Field
Expand Down
3 changes: 2 additions & 1 deletion docs/Examples/antd/Relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const App = () => {
})
})
$('onFieldChange', 'aa').subscribe(fieldState => {
console.log(fieldState.value)
setFieldState('bb', state => {
state.visible = !fieldState.value
})
Expand Down Expand Up @@ -135,7 +136,7 @@ const App = () => {
})
}}
labelCol={6}
wrapperCol={4}
wrapperCol={12}
onSubmit={v => console.log(v)}
>
<FormBlock title="Block1">
Expand Down
3 changes: 1 addition & 2 deletions docs/Examples/antd/Sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ReactDOM.render(
actions={actions}
labelCol={7}
initialValues={{
date:'2019-08-01',
upload3:[{
downloadURL:
"//img.alicdn.com/tfs/TB1n8jfr1uSBuNjy1XcXXcYjFXa-200-200.png",
Expand Down Expand Up @@ -82,7 +81,7 @@ ReactDOM.render(
/>
<Field type="number" title="数字选择" name="number" />
<Field type="boolean" title="开关选择" name="boolean" />
<Field type="date" title="日期选择" name="date" x-props={{disabled:true}} />
<Field type="date" title="日期选择" name="date" />
<Field
type="daterange"
title="日期范围"
Expand Down
7 changes: 6 additions & 1 deletion docs/Examples/next/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ const App = () => (
<Field name="ee" type="string" title="字段5" />
<Field name="ff" type="string" title="字段6" />
<Field name="gg" type="string" title="字段7" />
<Field name="hh" type="daterange" title="字段8" />
<Field
name="hh"
type="daterange"
x-props={{ width: 400 }}
title="字段8"
/>
</Field>
</Field>
</FormLayout>
Expand Down
5 changes: 3 additions & 2 deletions docs/Examples/next/Relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const App = () => {
return (
<Printer>
<SchemaForm
useDirty
effects={($, { setFieldState, getFieldState }) => {
$('onFormInit').subscribe(() => {
setFieldState(FormPath.match('*(gg,hh)'), state => {
Expand Down Expand Up @@ -131,7 +132,7 @@ const App = () => {
wrapperCol={4}
onSubmit={v => console.log(v)}
>
<FormBlock title="Block1">
<FormBlock name="block" title="Block1">
<Field
name="aa"
type="boolean"
Expand Down Expand Up @@ -497,7 +498,7 @@ const App = () => {
</FormLayout>
</FormBlock>
<FormBlock title="嵌套Array">
<Field type="array" name="dd" x-component="cards">
<Field type="array" name="dd">
<Field type="object">
<FormLayout inline style={{ marginLeft: 20 }}>
<Field
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"build:docs": "node ./scripts/docs.js build -i docs -o docs",
"start": "node ./scripts/docs.js start -i docs",
"sort-api": "node ./scripts/sort-api-table.js",
"test": "jest",
"test": "npm run lint && jest",
"test:core": "jest --watch packages/core/src/__tests__/index.spec.ts",
"test:prod": "cross-env TEST_ENV=production npm run build && jest",
"doc:core": "doc-scripts start -i packages/core",
"doc:react": "doc-scripts start -i packages/react",
"test:watch": "jest --watch",
"coverage": "npm run test -- --coverage",
"coverage:upload": "rm -rf ./coverage && npm run coverage && node ./scripts/mapCoverage.js && codecov",
Expand Down Expand Up @@ -48,6 +51,7 @@
"@babel/register": "^7.0.0",
"@babel/runtime-corejs3": "^7.2.0",
"@testing-library/react": "^8.0.0",
"@types/jest": "^24.0.18",
"@types/node": "^12.6.8",
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
Expand Down Expand Up @@ -94,6 +98,7 @@
"pretty-format": "^24.0.0",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-eva": "^1.1.7",
"remark-parse": "^6.0.3",
"remark-stringify": "^6.0.4",
"scheduler": "^0.15.0",
Expand All @@ -118,11 +123,11 @@
}
},
"lint-staged": {
"packages/**": [
"packages/*/src/**.@(ts|tsx|js)": [
"npm run lint",
"git add"
],
"scripts/**": [
"scripts/**.@(ts|tsx|js)": [
"npm run lint",
"git add"
]
Expand Down
24 changes: 18 additions & 6 deletions packages/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
"jest": true,
"commonjs": true
},
"plugins": ["@typescript-eslint", "react", "react-hooks", "prettier"],
"plugins": [
"@typescript-eslint",
"react",
"react-hooks",
"prettier"
],
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module",
Expand All @@ -25,10 +30,8 @@
"version": "detect",
}
},

"rules": {
"prettier/prettier": 2,

// don't force es6 functions to include space before paren
"space-before-function-paren": 0,
"react/prop-types": 0,
Expand All @@ -40,13 +43,22 @@
"react/no-did-update-set-state": 0,
// maybe we should no-public
"@typescript-eslint/explicit-member-accessibility": 0,

"@typescript-eslint/interface-name-prefix": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-parameter-properties": 0,
"@typescript-eslint/array-type": 0,
"@typescript-eslint/no-object-literal-type-assertion": 0,
"no-console": ["error", { "allow": ["warn", "error", "info"] }]
"@typescript-eslint/no-use-before-define": 0,
"no-console": [
"error",
{
"allow": [
"warn",
"error",
"info"
]
}
]
}
}
}
12 changes: 6 additions & 6 deletions packages/antd/build.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { compile, getCompileConfig } from '../../scripts/build'
import ts from 'typescript'
import tsImportPluginFactory from 'ts-import-plugin'
//import tsImportPluginFactory from 'ts-import-plugin'
import glob from 'glob'

const transformer = tsImportPluginFactory({
libraryName: 'antd',
//style: 'css',
})
// const transformer = tsImportPluginFactory({
// libraryName: 'antd',
// style: 'css',
// })

function buildESM() {
const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
outDir: './esm',
module: ts.ModuleKind.ESNext
})
compile(fileNames, options, { before: [transformer] })
compile(fileNames, options)
console.log('esm build successfully')
}

Expand Down
12 changes: 7 additions & 5 deletions packages/antd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uform/antd",
"version": "0.4.3",
"version": "0.4.0",
"license": "MIT",
"main": "lib",
"module": "esm",
Expand All @@ -26,12 +26,14 @@
"@babel/runtime": "^7.4.4",
"antd": "^3.14.1",
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
"react-dom": ">=16.8.0",
"@types/styled-components": "^4.1.19"
},
"dependencies": {
"@uform/react": "^0.4.3",
"@uform/types": "^0.4.3",
"@uform/utils": "^0.4.3",
"@uform/react-schema-renderer": "^0.4.0",
"@uform/react-shared-components":"^0.4.0",
"@uform/types": "^0.4.0",
"@uform/shared": "^0.4.0",
"classnames": "^2.2.6",
"moveto": "^1.7.4",
"react-stikky": "^0.1.15",
Expand Down
22 changes: 22 additions & 0 deletions packages/antd/src/compat/Form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { Form } from 'antd'
import { FormProps } from 'antd/lib/form'
import { IFormItemTopProps } from '../types'
import { FormItemProvider } from './context'
import { normalizeCol } from '../shared'

export const CompatNextForm: React.FC<
FormProps & IFormItemTopProps
> = props => {
return (
<FormItemProvider {...props}>
<Form
{...props}
labelCol={normalizeCol(props.labelCol)}
wrapperCol={normalizeCol(props.wrapperCol)}
layout={props.inline ? 'inline' : props.layout}
form={undefined}
/>
</FormItemProvider>
)
}
Loading