fix: upgrade formily and form.setValues uses overwrite strategy (#101)

1、formily从2.0.0-rc.3升级到2.0.0-rc.19
2、重置form没有生效,setValues参数设为override
This commit is contained in:
SemmyWong 2021-11-10 23:23:57 +08:00 committed by GitHub
parent 06a67479c8
commit 6c345cb64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 65 deletions

View File

@ -21,9 +21,9 @@
"@antv/g2plot": "^2.3.27", "@antv/g2plot": "^2.3.27",
"@dnd-kit/core": "4.0.0-next-2021720152655", "@dnd-kit/core": "4.0.0-next-2021720152655",
"@dnd-kit/sortable": "5.0.0-next-2021720152655", "@dnd-kit/sortable": "5.0.0-next-2021720152655",
"@formily/antd": "2.0.0-rc.3", "@formily/antd": "2.0.0-rc.19",
"@formily/core": "2.0.0-rc.3", "@formily/core": "2.0.0-rc.19",
"@formily/react": "2.0.0-rc.3", "@formily/react": "2.0.0-rc.19",
"@monaco-editor/react": "^4.2.1", "@monaco-editor/react": "^4.2.1",
"ahooks": "^2.10.2", "ahooks": "^2.10.2",
"axios": "^0.21.1", "axios": "^0.21.1",

View File

@ -610,7 +610,7 @@ function CreateFieldButton() {
key: uid(), key: uid(),
name: `f_${uid()}`, name: `f_${uid()}`,
interface: info.key, interface: info.key,
}); }, 'overwrite');
setProperties(clone(schema.properties)); setProperties(clone(schema.properties));
setVisible(true); setVisible(true);
}} }}
@ -644,16 +644,16 @@ function CreateFieldButton() {
title={t('Add field')} title={t('Add field')}
width={'50%'} width={'50%'}
visible={visible} visible={visible}
onClose={() => { onClose={async () => {
await form.clearFormGraph();
setVisible(false); setVisible(false);
form.reset();
}} }}
footer={ footer={
<Space style={{ float: 'right' }}> <Space style={{ float: 'right' }}>
<Button <Button
onClick={async () => { onClick={async () => {
await form.clearFormGraph();
setVisible(false); setVisible(false);
await form.reset();
}} }}
> >
{t('Cancel')} {t('Cancel')}

124
yarn.lock
View File

@ -1936,78 +1936,86 @@
resolved "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz#2dc8c57044de0340eb53a7ba602e59abf80dc799" resolved "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz#2dc8c57044de0340eb53a7ba602e59abf80dc799"
integrity sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ== integrity sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ==
"@formily/antd@2.0.0-rc.3": "@formily/antd@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/antd/-/antd-2.0.0-rc.3.tgz#714e3cca4dee78799ff3b51f9d9fca143ed52513" resolved "https://registry.npmmirror.com/@formily/antd/download/@formily/antd-2.0.0-rc.19.tgz#e327658aa5c6cb3692be691c94dd6991f0b97cc7"
integrity sha512-uHq+Z1YWzBQgk5zYRhUcRL6UUfLLveSwRptDxUjw/TRS760WIfzs52m/763TZqKpmMmDb83lFoailEoKwalVtg== integrity sha512-RNQ0pNVv4MHmMx2PbhjccYo+zo+m1mA9B4bGBtFHcwklfVt5/Q8Sza0f8drXpxrIYyKAdKiOfW8eoRRXAVDgVg==
dependencies: dependencies:
"@ant-design/icons" "^4.0.0" "@ant-design/icons" "^4.0.0"
"@formily/core" "2.0.0-rc.3" "@formily/core" "2.0.0-rc.19"
"@formily/json-schema" "2.0.0-rc.3" "@formily/grid" "2.0.0-rc.19"
"@formily/react" "2.0.0-rc.3" "@formily/json-schema" "2.0.0-rc.19"
"@formily/reactive" "2.0.0-rc.3" "@formily/react" "2.0.0-rc.19"
"@formily/reactive-react" "2.0.0-rc.3" "@formily/reactive" "2.0.0-rc.19"
"@formily/shared" "2.0.0-rc.3" "@formily/reactive-react" "2.0.0-rc.19"
"@formily/shared" "2.0.0-rc.19"
"@juggle/resize-observer" "^3.3.1" "@juggle/resize-observer" "^3.3.1"
classnames "^2.2.6" classnames "^2.2.6"
react-sortable-hoc "^1.11.0" react-sortable-hoc "^1.11.0"
react-sticky-box "^0.9.3" react-sticky-box "^0.9.3"
"@formily/core@2.0.0-rc.3": "@formily/core@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/core/-/core-2.0.0-rc.3.tgz#aeb085c88f24527fec9b14efe162a77b0a9a4741" resolved "https://registry.npmmirror.com/@formily/core/download/@formily/core-2.0.0-rc.19.tgz#e1579ecf14dd906689652e92f468bbd0f35694aa"
integrity sha512-DZvrCbQqpg8A0V0asVFYWbmdiqmDLq52OZmImr/1Vh3fa6wLExenoMfd1Koz1NXHdtMsLDlqOLnneS8e8+xKgw== integrity sha512-V3UtzsAuy6NUC+SWD16IONKCwnfGjf86JQUhiedpLgLTxJp3MH5UAcfHsUHK5wPmadyUw0+Kp9dKs8hmfHdBRQ==
dependencies: dependencies:
"@formily/reactive" "2.0.0-rc.3" "@formily/reactive" "2.0.0-rc.19"
"@formily/shared" "2.0.0-rc.3" "@formily/shared" "2.0.0-rc.19"
"@formily/validator" "2.0.0-rc.3" "@formily/validator" "2.0.0-rc.19"
"@formily/json-schema@2.0.0-rc.3": "@formily/grid@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/json-schema/-/json-schema-2.0.0-rc.3.tgz#86cb03910e135e198decd41c8e7ecd38923bf8d1" resolved "https://registry.npmmirror.com/@formily/grid/download/@formily/grid-2.0.0-rc.19.tgz#2caf57192c89358c8db37314820396cf8faf36f0"
integrity sha512-l9XtoX2Y8LOWzKoz26Q1E2mbGdPsQXikhCpKdoQ8/wQxEPDd4xzKXVq1+JTepW+N6Qk0I+mP1K26I5vhx9pqCw== integrity sha512-9Dmo3me67Oy10lm9N5z9VubTuKz2wEuZJkZDfRYEma0UmgO+dAAne6ijO4FNu/7+HhfKp3c1C3b1Y2nqGChSBg==
dependencies: dependencies:
"@formily/core" "2.0.0-rc.3" "@formily/reactive" "2.0.0-rc.19"
"@formily/reactive" "2.0.0-rc.3"
"@formily/shared" "2.0.0-rc.3"
"@formily/path@2.0.0-rc.3": "@formily/json-schema@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/path/-/path-2.0.0-rc.3.tgz#10023fe2776d9f2b22ddce1019b5d931f4a517a5" resolved "https://registry.npmmirror.com/@formily/json-schema/download/@formily/json-schema-2.0.0-rc.19.tgz#6f3dbc11d34575ffbc88aca0eb7b78b25379b6d3"
integrity sha512-Q2QgJQH7VOJ/T3dx1GjnA1KCQfutatDcJ7yH7XIJY4XQILnoI5HnNM4b0kJfYH+0LppUsRJrZAhEMO4bH2PUUQ== integrity sha512-vblyDFtAtnDHJyFUPKbaKbrf6BvKSoyVSN43N6tJZzSQt2SdQKRUwI/SDWICPprqc+bnOqmBgpR+YuF8iJUfmg==
"@formily/react@2.0.0-rc.3":
version "2.0.0-rc.3"
resolved "https://registry.npmjs.org/@formily/react/-/react-2.0.0-rc.3.tgz#7ba70b8045b096b4117e2664948b695747e5545c"
integrity sha512-nPiYAOymAtS6ZRN+/uT6c6M729x3c4keRF4johXpBL3gj9Qy3RtGAy41e9Ey/oGHfJjYXCjeLBxtedEyH/3YhA==
dependencies: dependencies:
"@formily/core" "2.0.0-rc.3" "@formily/core" "2.0.0-rc.19"
"@formily/json-schema" "2.0.0-rc.3" "@formily/reactive" "2.0.0-rc.19"
"@formily/reactive" "2.0.0-rc.3" "@formily/shared" "2.0.0-rc.19"
"@formily/reactive-react" "2.0.0-rc.3"
"@formily/shared" "2.0.0-rc.3" "@formily/path@2.0.0-rc.19":
"@formily/validator" "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmmirror.com/@formily/path/download/@formily/path-2.0.0-rc.19.tgz#98922d0694ca15a2d92272440594e13289594319"
integrity sha512-9KdtXzBEOfdJR9XSone3O5K8swShDwyamU/i3+K1mDPqOHgGWeQ83PZf8aOjZzsHGTdJ11z1QyN6QOs6WuF9gg==
"@formily/react@2.0.0-rc.19":
version "2.0.0-rc.19"
resolved "https://registry.npmmirror.com/@formily/react/download/@formily/react-2.0.0-rc.19.tgz#fb79c0983563cd3011fbbcd449d5b026e1132597"
integrity sha512-9z4YN2oUfcXSftLgCbuczm/NXupRHz28NLXsxwLct8+gGWqiKavm47+TtitKElqq51gUCHFq8TxMFkSjfiQYBg==
dependencies:
"@formily/core" "2.0.0-rc.19"
"@formily/json-schema" "2.0.0-rc.19"
"@formily/reactive" "2.0.0-rc.19"
"@formily/reactive-react" "2.0.0-rc.19"
"@formily/shared" "2.0.0-rc.19"
"@formily/validator" "2.0.0-rc.19"
hoist-non-react-statics "^3.3.2" hoist-non-react-statics "^3.3.2"
"@formily/reactive-react@2.0.0-rc.3": "@formily/reactive-react@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/reactive-react/-/reactive-react-2.0.0-rc.3.tgz#ed2e16e85998867b57e6957aee758154d819d2f3" resolved "https://registry.npmmirror.com/@formily/reactive-react/download/@formily/reactive-react-2.0.0-rc.19.tgz#053e362ade56d41a1e2823b94b0a2081bef3a20c"
integrity sha512-h1rkVFtlXnz4f9JE7550K37DJe/l1OHsiPpqIx4eEROSZedoAmsyp/vysDEU2L6CSYmvcLXrqAD4feWh6/r23g== integrity sha512-zjHKd0nwruiI6afYzDFuGB3/SaVtlA9PdwEdAUQN4AjfHLv+8RQv/8LRwlKRko7c7yIBeQGEGnbfs9lKLNRnLA==
dependencies: dependencies:
"@formily/reactive" "2.0.0-rc.3" "@formily/reactive" "2.0.0-rc.19"
hoist-non-react-statics "^3.3.2" hoist-non-react-statics "^3.3.2"
"@formily/reactive@2.0.0-rc.3": "@formily/reactive@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/reactive/-/reactive-2.0.0-rc.3.tgz#2c3a4f034c3e733c75e0e8a9041379be475e74fa" resolved "https://registry.npmmirror.com/@formily/reactive/download/@formily/reactive-2.0.0-rc.19.tgz#0482783f87864dc321590618ba7509248bfe0223"
integrity sha512-m9KOsYkf03efV2D4uGuWQlfSXn8LmuS1B2D56GCu351/CVkiYgaKCm9/3lTOy+Ff0eEg5awdpT5ATOnnQpGa7g== integrity sha512-+6Z0tfAVjN7Icw/CaB6kDMf/BPFqHcMkpMARV6A2rV/J2TfwhbCsDAAXHYa+fSDosKSCk3uMfeCIyYUjuF9hbA==
"@formily/shared@2.0.0-rc.3": "@formily/shared@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/shared/-/shared-2.0.0-rc.3.tgz#8bd430c1d35561397a0686ebb043ae97a0626561" resolved "https://registry.npmmirror.com/@formily/shared/download/@formily/shared-2.0.0-rc.19.tgz#c868f2ccedc2155d7fe84afdba43ff8bc49510d0"
integrity sha512-r0MbLytj//Db2nGNsOi2dyaX1x25EJpPZm1xNevZqGhBj+j+X9YcIl1FbpB6j1nEN6DA3z599AM0V0wu4hpDcA== integrity sha512-LLec+DHWX8IJz9kX6AqWW+Hcbo9Bp0bJ7bxoOk5CFlENvtVbvrrqwrVda/lz6Wk+pqpf3UdrGV09TYTMmcDfMw==
dependencies: dependencies:
"@formily/path" "2.0.0-rc.3" "@formily/path" "2.0.0-rc.19"
camel-case "^4.1.1" camel-case "^4.1.1"
lower-case "^2.0.1" lower-case "^2.0.1"
no-case "^3.0.4" no-case "^3.0.4"
@ -2015,12 +2023,12 @@
pascal-case "^3.1.1" pascal-case "^3.1.1"
upper-case "^2.0.1" upper-case "^2.0.1"
"@formily/validator@2.0.0-rc.3": "@formily/validator@2.0.0-rc.19":
version "2.0.0-rc.3" version "2.0.0-rc.19"
resolved "https://registry.npmjs.org/@formily/validator/-/validator-2.0.0-rc.3.tgz#74a6b093ede5275d93b6e38435c5a7874c34a509" resolved "https://registry.npmmirror.com/@formily/validator/download/@formily/validator-2.0.0-rc.19.tgz#0586f36b7143c2ef026a98890e9084faf6d83b6d"
integrity sha512-pk7fN/P2U38C56YYx6JIcWssAlgxeYoU1rSLFKiV4bawJyoeypVkk6SNmRrruYsFkiZuALvQ2BPtaPpLm7YLIQ== integrity sha512-MjdK/c4NIkkCP2K0cTJZqieL30xxe1gyI+xUXoBD2GY49YF8WrJ6Iuh9L4fpkU55tPt5lnQauH7YnX5GQcidXg==
dependencies: dependencies:
"@formily/shared" "2.0.0-rc.3" "@formily/shared" "2.0.0-rc.19"
"@gulp-sourcemaps/identity-map@1.X": "@gulp-sourcemaps/identity-map@1.X":
version "1.0.2" version "1.0.2"