Skip to content

Commit 371c5da

Browse files
committed
parent 8dfe105
author janrywang <[email protected]> 1575541800 +0800 committer janryWang <[email protected]> 1576467830 +0800 chore(publish): v1.0.0-alpha.6 refactor(@uform/core): update onFormSubmit position fix: Not in the browser refactor(@uform/core): update onFormSubmit position (alibaba#464) refactor: update scheduler (alibaba#465) * refactor(@uform/core): update onFormSubmit position * fix(@uform/shared): fix shared * refactor(@uform/react): remove react scheduler deps * refactor(@uform/core): move scheduler fix(@uform/validator): fix maximum rule get message logic (alibaba#468) * refactor(@uform/core): update onFormSubmit position * fix(@uform/validator): fix rules feat(@uform/react-form-editor): add schema code editor, edit copy and download (alibaba#469) fix(@uform/antd/next/react): doc (alibaba#471) * feat: enhanced document * fix: custom string component Fix field visible display behavior (alibaba#470) * refactor(@uform/core): update onFormSubmit position * fix(@uform/core): fix fields visible and display behavior * refactor(examples): revert examples chore(publish): v1.0.0-alpha.7 refactor(typings): update FormStep、dispatch、notify typings Fix match strategy (alibaba#475) * refactor(@uform/core): update onFormSubmit position * fix(@uform/core): fix match strategy feat: update unitest and document (alibaba#476) * feat: update unitest and document * feat: update unit-test case * feat: update docs and add actions * feat: remove internal api feat: 添加next components schema feat: 临时交互对焦
1 parent 8dfe105 commit 371c5da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3028
-840
lines changed

docs/Examples/antd/Actions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import React from 'react'
1515
import ReactDOM from 'react-dom'
1616
import {
1717
SchemaForm,
18-
Field,
18+
SchemaMarkupField as Field,
1919
FormButtonGroup,
2020
Submit,
2121
Reset,
@@ -79,7 +79,7 @@ import React from 'react'
7979
import ReactDOM from 'react-dom'
8080
import {
8181
SchemaForm,
82-
Field,
82+
SchemaMarkupField as Field,
8383
FormButtonGroup,
8484
Submit,
8585
Reset,

docs/Examples/antd/Deconstruction.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
```jsx
1111
import React from 'react'
1212
import ReactDOM from 'react-dom'
13-
import { SchemaForm, Field, FormButtonGroup, Submit, Reset } from '@uform/antd'
13+
import { SchemaForm, SchemaMarkupField as Field, FormButtonGroup, Submit, Reset } from '@uform/antd'
1414
import { Button } from '@alifd/antd'
1515
import Printer from '@uform/printer'
1616
import 'antd/dist/antd.css'
@@ -42,7 +42,7 @@ import React from 'react'
4242
import ReactDOM from 'react-dom'
4343
import {
4444
SchemaForm,
45-
Field,
45+
SchemaMarkupField as Field,
4646
FormButtonGroup,
4747
Submit,
4848
Reset,
@@ -107,7 +107,7 @@ import React from 'react'
107107
import ReactDOM from 'react-dom'
108108
import {
109109
SchemaForm,
110-
Field,
110+
SchemaMarkupField as Field,
111111
FormButtonGroup,
112112
Submit,
113113
Reset,
@@ -179,14 +179,15 @@ import React from 'react'
179179
import ReactDOM from 'react-dom'
180180
import {
181181
SchemaForm,
182-
Field,
182+
SchemaMarkupField as Field,
183183
FormButtonGroup,
184184
Submit,
185185
Reset,
186186
registerFormField,
187187
connect,
188188
FormLayout,
189-
FormPath
189+
FormPath,
190+
FormEffectHooks,
190191
} from '@uform/antd'
191192
import { Button } from '@alifd/antd'
192193
import Printer from '@uform/printer'
@@ -219,12 +220,13 @@ registerFormField(
219220
)
220221
})
221222
)
223+
const { onFieldValueChange$ } = FormEffectHooks
222224

223225
const App = () => (
224226
<Printer>
225227
<SchemaForm
226228
effects={($, { setFieldState }) => {
227-
$('onFieldValueChange', 'wrapper.relation').subscribe(({ value }) => {
229+
onFieldValueChange$('wrapper.relation').subscribe(({ value }) => {
228230
setFieldState(
229231
FormPath.match(
230232
'wrapper.[[{aa:{bb:{cc:destructor1,dd:\\[destructor2,destructor3\\],ee}}}]]'

docs/Examples/antd/Detail.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import React, { useState } from 'react'
99
import ReactDOM from 'react-dom'
1010
import {
1111
SchemaForm,
12-
Field,
12+
SchemaMarkupField as Field,
1313
FormButtonGroup,
1414
Submit,
1515
Reset,

docs/Examples/antd/International.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
```jsx
1111
import React from 'react'
1212
import ReactDOM from 'react-dom'
13-
import { SchemaForm, Field, FormButtonGroup, Submit, Reset,setValidationLanguage } from '@uform/antd'
13+
import { SchemaForm, SchemaMarkupField as Field, FormButtonGroup, Submit, Reset,setValidationLanguage } from '@uform/antd'
1414
import { Button,LocaleProvider } from 'antd'
1515
import Printer from '@uform/printer'
1616
import zhCN from 'antd/lib/locale-provider/zh_CN'
@@ -108,7 +108,7 @@ ReactDOM.render(
108108
```jsx
109109
import React from 'react'
110110
import ReactDOM from 'react-dom'
111-
import { SchemaForm, Field, FormButtonGroup, Submit, Reset,setValidationLanguage } from '@uform/antd'
111+
import { SchemaForm, SchemaMarkupField as Field, FormButtonGroup, Submit, Reset,setValidationLanguage } from '@uform/antd'
112112
import { Button,LocaleProvider } from 'antd'
113113
import Printer from '@uform/printer'
114114
import enUS from 'antd/lib/locale-provider/en_US'

docs/Examples/antd/Layout.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import React from 'react'
1616
import ReactDOM from 'react-dom'
1717
import {
1818
SchemaForm,
19-
Field,
19+
SchemaMarkupField as Field,
2020
FormButtonGroup,
2121
Submit,
2222
Reset,
@@ -58,7 +58,7 @@ import React from 'react'
5858
import ReactDOM from 'react-dom'
5959
import {
6060
SchemaForm,
61-
Field,
61+
SchemaMarkupField as Field,
6262
FormButtonGroup,
6363
Submit,
6464
Reset,
@@ -99,7 +99,7 @@ import React from 'react'
9999
import ReactDOM from 'react-dom'
100100
import {
101101
SchemaForm,
102-
Field,
102+
SchemaMarkupField as Field,
103103
FormButtonGroup,
104104
Submit,
105105
Reset,
@@ -147,7 +147,7 @@ import React, { useState } from 'react'
147147
import ReactDOM from 'react-dom'
148148
import {
149149
SchemaForm,
150-
Field,
150+
SchemaMarkupField as Field,
151151
FormButtonGroup,
152152
Submit,
153153
Reset,
@@ -232,7 +232,7 @@ import React from 'react'
232232
import ReactDOM from 'react-dom'
233233
import {
234234
SchemaForm,
235-
Field,
235+
SchemaMarkupField as Field,
236236
FormButtonGroup,
237237
Submit,
238238
Reset,
@@ -275,7 +275,7 @@ ReactDOM.render(<App />, document.getElementById('root'))
275275
```jsx
276276
import {
277277
SchemaForm,
278-
Field,
278+
SchemaMarkupField as Field,
279279
FormButtonGroup,
280280
Submit,
281281
FormEffectHooks,

docs/Examples/antd/List.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import React, { useState, useEffect } from 'react'
3434
import ReactDOM from 'react-dom'
3535
import {
3636
SchemaForm,
37-
Field,
37+
SchemaMarkupField as Field,
3838
FormButtonGroup,
3939
Submit,
4040
Reset,
@@ -122,7 +122,7 @@ import React from 'react'
122122
import ReactDOM from 'react-dom'
123123
import {
124124
SchemaForm,
125-
Field,
125+
SchemaMarkupField as Field,
126126
FormButtonGroup,
127127
Submit,
128128
Reset,
@@ -198,7 +198,7 @@ import React from 'react'
198198
import ReactDOM from 'react-dom'
199199
import {
200200
SchemaForm,
201-
Field,
201+
SchemaMarkupField as Field,
202202
FormButtonGroup,
203203
Submit,
204204
Reset,

docs/Examples/antd/Relations.md

+37-22
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import ReactDOM from 'react-dom'
3232
import { filter, withLatestFrom, map, debounceTime } from 'rxjs/operators'
3333
import {
3434
SchemaForm,
35-
Field,
35+
SchemaMarkupField as Field,
3636
FormButtonGroup,
3737
Submit,
3838
Reset,
@@ -41,19 +41,27 @@ import {
4141
FormPath,
4242
FormBlock,
4343
FormLayout,
44-
createFormActions
44+
createFormActions,
45+
FormEffectHooks,
46+
createEffectHook,
4547
} from '@uform/antd'
4648
import { Button } from 'antd'
4749
import Printer from '@uform/printer'
4850
import 'antd/dist/antd.css'
4951

52+
const { onFormInit$, onFieldValueChange$ } = FormEffectHooks
53+
const onSearch$ = createEffectHook('onSearch')
54+
const onChangeOption$ = createEffectHook('onChangeOption')
55+
const actions = createFormActions()
56+
5057
const App = () => {
5158
const [state, setState] = useState({ visible: false })
5259
return (
5360
<Printer>
5461
<SchemaForm
62+
actions={actions}
5563
effects={($, { setFieldState, getFieldState }) => {
56-
$('onFormInit').subscribe(() => {
64+
onFormInit$().subscribe(() => {
5765
setFieldState(FormPath.match('*(gg,hh)'), state => {
5866
state.props['x-props'] = state.props['x-props'] || {}
5967
state.props['x-props'].style = {
@@ -64,14 +72,14 @@ const App = () => {
6472
}
6573
})
6674
})
67-
$('onFieldValueChange', 'aa').subscribe(fieldState => {
75+
onFieldValueChange$('aa').subscribe(fieldState => {
6876
console.log(fieldState.value)
6977
setFieldState('bb', state => {
7078
state.visible = !fieldState.value
7179
})
7280
})
7381

74-
$('onFieldValueChange', 'cc').subscribe(fieldState => {
82+
onFieldValueChange$('cc').subscribe(fieldState => {
7583
setFieldState('dd', state => {
7684
state.visible = !fieldState.value
7785
})
@@ -89,14 +97,14 @@ const App = () => {
8997
}
9098
})
9199
})
92-
$('onFieldValueChange', 'mm').subscribe(fieldState => {
100+
onFieldValueChange$('mm').subscribe(fieldState => {
93101
setFieldState('ff', state => {
94102
state.visible = !fieldState.value
95103
})
96104
})
97-
$('onFieldValueChange', 'gg')
105+
onFieldValueChange$('gg')
98106
.pipe(
99-
withLatestFrom($('onChangeOption')),
107+
withLatestFrom(onChangeOption$()),
100108
map(([fieldState, { payload: option }]) => {
101109
return {
102110
state: fieldState,
@@ -114,7 +122,8 @@ const App = () => {
114122
}
115123
})
116124
})
117-
$('onSearch', 'gg')
125+
126+
onSearch$('gg')
118127
.pipe(
119128
map(fieldState => {
120129
setFieldState('gg', state => {
@@ -175,7 +184,7 @@ const App = () => {
175184
name="gg"
176185
type="string"
177186
x-effect={dispatch => ({
178-
onChange(value, option) {
187+
onChange(value, option) {
179188
dispatch('onChangeOption', option)
180189
},
181190
onSearch(value) {
@@ -215,26 +224,29 @@ import React from 'react'
215224
import ReactDOM from 'react-dom'
216225
import {
217226
SchemaForm,
218-
Field,
227+
SchemaMarkupField as Field,
219228
FormButtonGroup,
220229
Submit,
221230
Reset,
222231
FormItemGrid,
223232
FormCard,
224233
FormPath,
225234
FormBlock,
226-
FormLayout
235+
FormLayout,
236+
FormEffectHooks,
227237
} from '@uform/next'
228238
import { filter, withLatestFrom, map, debounceTime } from 'rxjs/operators'
229239
import { Button } from '@alifd/next'
230240
import Printer from '@uform/printer'
231241
import '@alifd/next/dist/next.css'
232242

243+
const { onFieldValueChange$ } = FormEffectHooks
244+
233245
const App = () => (
234246
<Printer>
235247
<SchemaForm
236248
effects={($, { setFieldState, getFieldState }) => {
237-
$('onFieldValueChange', 'total').subscribe(({ value }) => {
249+
onFieldValueChange$('total').subscribe(({ value }) => {
238250
if (!value) return
239251
setFieldState('count', state => {
240252
const price = getFieldState('price', state => state.value)
@@ -247,7 +259,7 @@ const App = () => (
247259
state.value = value / count
248260
})
249261
})
250-
$('onFieldValueChange', 'price').subscribe(({ value }) => {
262+
onFieldValueChange$('price').subscribe(({ value }) => {
251263
if (!value) return
252264
setFieldState('total', state => {
253265
const count = getFieldState('count', state => state.value)
@@ -260,7 +272,7 @@ const App = () => (
260272
state.value = total / value
261273
})
262274
})
263-
$('onFieldValueChange', 'count').subscribe(({ value }) => {
275+
onFieldValueChange$('count').subscribe(({ value }) => {
264276
if (!value) return
265277
setFieldState('total', state => {
266278
const price = getFieldState('price', state => state.value)
@@ -305,7 +317,7 @@ import ReactDOM from 'react-dom'
305317
import { filter, withLatestFrom, map, debounceTime } from 'rxjs/operators'
306318
import {
307319
SchemaForm,
308-
Field,
320+
SchemaMarkupField as Field,
309321
FormButtonGroup,
310322
Submit,
311323
Reset,
@@ -314,12 +326,15 @@ import {
314326
FormPath,
315327
FormBlock,
316328
FormLayout,
317-
createFormActions
329+
createFormActions,
330+
FormEffectHooks,
318331
} from '@uform/antd'
319332
import { Button } from 'antd'
320333
import Printer from '@uform/printer'
321334
import 'antd/dist/antd.css'
322335

336+
const { onFormInit$, onFieldValueChange$ } = FormEffectHooks
337+
323338
const App = () => (
324339
<Printer>
325340
<SchemaForm
@@ -354,10 +369,10 @@ const App = () => (
354369
state.value = value
355370
})
356371
}
357-
$('onFormInit').subscribe(() => {
372+
onFormInit$().subscribe(() => {
358373
hide('bb')
359374
})
360-
$('onFieldValueChange', 'aa').subscribe(fieldState => {
375+
onFieldValueChange$('aa').subscribe(fieldState => {
361376
if (!fieldState.value) return
362377
show('bb')
363378
loading('bb')
@@ -367,7 +382,7 @@ const App = () => (
367382
setValue('bb', '1111')
368383
}, 1000)
369384
})
370-
$('onFieldValueChange', 'bb').subscribe(fieldState => {
385+
onFieldValueChange$('bb').subscribe(fieldState => {
371386
console.log(fieldState.loading)
372387
if (!fieldState.value) return hide('cc')
373388
show('cc')
@@ -411,7 +426,7 @@ import ReactDOM from 'react-dom'
411426
import { filter, withLatestFrom, map, debounceTime } from 'rxjs/operators'
412427
import {
413428
SchemaForm,
414-
Field,
429+
SchemaMarkupField as Field,
415430
FormButtonGroup,
416431
Submit,
417432
Reset,
@@ -471,7 +486,7 @@ import ReactDOM from 'react-dom'
471486
import { filter, withLatestFrom, map, debounceTime } from 'rxjs/operators'
472487
import {
473488
SchemaForm,
474-
Field,
489+
SchemaMarkupField as Field,
475490
FormButtonGroup,
476491
Submit,
477492
Reset,

0 commit comments

Comments
 (0)