Commit ea24dfa384c9dc05e1b397c7c7dd4635dae87aef
1 parent
be2b8a7e
chore: bump 2.0.0-rc.11
Showing
10 changed files
with
59 additions
and
71 deletions
CHANGELOG.en_US.md
1 | +## 2.0.0-rc.11 (2020-11-18) | |
2 | + | |
3 | +### ✨ Features | |
4 | + | |
5 | +- Added base64 file stream download | |
6 | +- Optimize upload components and examples | |
7 | +- New editable row example | |
8 | +- Add a personal page | |
9 | +- New form page | |
10 | +- Add details page | |
11 | +- Integrate upload components into form by default | |
12 | + | |
13 | +### 🎫 Chores | |
14 | + | |
15 | +- Update antdv to `2.0.0-rc.1` (temporarily restore to beta15, rc1 menu freezes too seriously.) | |
16 | +- Add some notes | |
17 | + | |
18 | +### ✨ Refactor | |
19 | + | |
20 | +- Removed `receiveDrawerDataRef` and `transferDrawerData` properties of `useModal` and `useDrawer` | |
21 | +- `openModal` and `openDrawer` corresponding to `useModal` and `useDrawer` extend the third parameter. Used to open the trigger callback again | |
22 | + | |
23 | +### 🐛 Bug Fixes | |
24 | + | |
25 | +- Repair form inputNumber verification error | |
26 | +- Fix the error of setting the default value of the form | |
27 | +- Fix the problem of occupying position when the menu collapse button is hidden | |
28 | +- Fix the form baseColProps does not take effect | |
29 | + | |
1 | 30 | ## 2.0.0-rc.10 (2020-11-13) |
2 | 31 | |
3 | 32 | ### ✨ Refactor | ... | ... |
CHANGELOG.zh_CN.md
1 | -## Wip | |
1 | +## 2.0.0-rc.11 (2020-11-18) | |
2 | 2 | |
3 | 3 | ### ✨ Features |
4 | 4 | |
... | ... | @@ -15,6 +15,11 @@ |
15 | 15 | - 更新 antdv 到`2.0.0-rc.1`(暂时还原到 beta15,rc1 菜单卡顿太严重.) |
16 | 16 | - 添加部分注释 |
17 | 17 | |
18 | +### ✨ Refactor | |
19 | + | |
20 | +- 移除`useModal`与`useDrawer`的`receiveDrawerDataRef`和`transferDrawerData`属性 | |
21 | +- `useModal`与`useDrawer`对应的`openModal`与`openDrawer`扩展第三个参数。用于再次打开触发回调 | |
22 | + | |
18 | 23 | ### 🐛 Bug Fixes |
19 | 24 | |
20 | 25 | - 修复表单 inputNumber 校验错误 | ... | ... |
package.json
src/components/Drawer/src/types.ts
... | ... | @@ -7,8 +7,7 @@ export interface DrawerInstance { |
7 | 7 | } |
8 | 8 | |
9 | 9 | export interface ReturnMethods extends DrawerInstance { |
10 | - openDrawer: <T = any>(visible?: boolean, data?: T) => void; | |
11 | - transferDrawerData: (data: any) => void; | |
10 | + openDrawer: <T = any>(visible?: boolean, data?: T, openOnSet?: boolean) => void; | |
12 | 11 | } |
13 | 12 | |
14 | 13 | export type RegisterFn = (drawerInstance: DrawerInstance, uuid?: string) => void; |
... | ... | @@ -17,7 +16,6 @@ export interface ReturnInnerMethods extends DrawerInstance { |
17 | 16 | closeDrawer: () => void; |
18 | 17 | changeLoading: (loading: boolean) => void; |
19 | 18 | changeOkLoading: (loading: boolean) => void; |
20 | - receiveDrawerDataRef: any; | |
21 | 19 | } |
22 | 20 | |
23 | 21 | export type UseDrawerReturnType = [RegisterFn, ReturnMethods]; | ... | ... |
src/components/Drawer/src/useDrawer.ts
... | ... | @@ -6,16 +6,7 @@ import type { |
6 | 6 | UseDrawerInnerReturnType, |
7 | 7 | } from './types'; |
8 | 8 | |
9 | -import { | |
10 | - ref, | |
11 | - getCurrentInstance, | |
12 | - onUnmounted, | |
13 | - unref, | |
14 | - reactive, | |
15 | - computed, | |
16 | - watchEffect, | |
17 | - nextTick, | |
18 | -} from 'vue'; | |
9 | +import { ref, getCurrentInstance, onUnmounted, unref, reactive, watchEffect, nextTick } from 'vue'; | |
19 | 10 | |
20 | 11 | import { isProdMode } from '/@/utils/env'; |
21 | 12 | import { isFunction } from '/@/utils/is'; |
... | ... | @@ -60,18 +51,19 @@ export function useDrawer(): UseDrawerReturnType { |
60 | 51 | getInstance().setDrawerProps(props); |
61 | 52 | }, |
62 | 53 | |
63 | - openDrawer: <T = any>(visible = true, data?: T): void => { | |
54 | + openDrawer: <T = any>(visible = true, data?: T, openOnSet = false): void => { | |
64 | 55 | getInstance().setDrawerProps({ |
65 | 56 | visible: visible, |
66 | 57 | }); |
67 | 58 | if (data) { |
68 | - dataTransferRef[unref(uidRef)] = data; | |
59 | + dataTransferRef[unref(uidRef)] = openOnSet | |
60 | + ? { | |
61 | + ...data, | |
62 | + __t__: Date.now(), | |
63 | + } | |
64 | + : data; | |
69 | 65 | } |
70 | 66 | }, |
71 | - | |
72 | - transferDrawerData(val: any) { | |
73 | - dataTransferRef[unref(uidRef)] = val; | |
74 | - }, | |
75 | 67 | }; |
76 | 68 | |
77 | 69 | return [getDrawer, methods]; |
... | ... | @@ -111,10 +103,6 @@ export const useDrawerInner = (callbackFn?: Fn): UseDrawerInnerReturnType => { |
111 | 103 | return [ |
112 | 104 | register, |
113 | 105 | { |
114 | - receiveDrawerDataRef: computed(() => { | |
115 | - return dataTransferRef[unref(uidRef)]; | |
116 | - }), | |
117 | - | |
118 | 106 | changeLoading: (loading = true) => { |
119 | 107 | getInstance().setDrawerProps({ loading }); |
120 | 108 | }, | ... | ... |
src/components/Modal/src/types.ts
... | ... | @@ -9,8 +9,7 @@ export interface ModalMethods { |
9 | 9 | |
10 | 10 | export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void; |
11 | 11 | export interface ReturnMethods extends ModalMethods { |
12 | - openModal: <T = any>(props?: boolean, data?: T) => void; | |
13 | - transferModalData: (data: any) => void; | |
12 | + openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void; | |
14 | 13 | } |
15 | 14 | export type UseModalReturnType = [RegisterFn, ReturnMethods]; |
16 | 15 | |
... | ... | @@ -18,7 +17,6 @@ export interface ReturnInnerMethods extends ModalMethods { |
18 | 17 | closeModal: () => void; |
19 | 18 | changeLoading: (loading: boolean) => void; |
20 | 19 | changeOkLoading: (loading: boolean) => void; |
21 | - receiveModalDataRef: any; | |
22 | 20 | } |
23 | 21 | export type UseModalInnerReturnType = [RegisterFn, ReturnInnerMethods]; |
24 | 22 | ... | ... |
src/components/Modal/src/useModal.ts
... | ... | @@ -5,16 +5,7 @@ import type { |
5 | 5 | ReturnMethods, |
6 | 6 | UseModalInnerReturnType, |
7 | 7 | } from './types'; |
8 | -import { | |
9 | - ref, | |
10 | - onUnmounted, | |
11 | - unref, | |
12 | - getCurrentInstance, | |
13 | - reactive, | |
14 | - computed, | |
15 | - watchEffect, | |
16 | - nextTick, | |
17 | -} from 'vue'; | |
8 | +import { ref, onUnmounted, unref, getCurrentInstance, reactive, watchEffect, nextTick } from 'vue'; | |
18 | 9 | import { isProdMode } from '/@/utils/env'; |
19 | 10 | import { isFunction } from '/@/utils/is'; |
20 | 11 | const dataTransferRef = reactive<any>({}); |
... | ... | @@ -55,18 +46,19 @@ export function useModal(): UseModalReturnType { |
55 | 46 | getInstance().setModalProps(props); |
56 | 47 | }, |
57 | 48 | |
58 | - openModal: <T = any>(visible = true, data?: T): void => { | |
49 | + openModal: <T = any>(visible = true, data?: T, openOnSet = false): void => { | |
59 | 50 | getInstance().setModalProps({ |
60 | 51 | visible: visible, |
61 | 52 | }); |
62 | 53 | if (data) { |
63 | - dataTransferRef[unref(uidRef)] = data; | |
54 | + dataTransferRef[unref(uidRef)] = openOnSet | |
55 | + ? { | |
56 | + ...data, | |
57 | + __t__: Date.now(), | |
58 | + } | |
59 | + : data; | |
64 | 60 | } |
65 | 61 | }, |
66 | - | |
67 | - transferModalData(val: any) { | |
68 | - dataTransferRef[unref(uidRef)] = val; | |
69 | - }, | |
70 | 62 | }; |
71 | 63 | return [register, methods]; |
72 | 64 | } |
... | ... | @@ -106,10 +98,6 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => { |
106 | 98 | return [ |
107 | 99 | register, |
108 | 100 | { |
109 | - receiveModalDataRef: computed(() => { | |
110 | - return dataTransferRef[unref(uidRef)]; | |
111 | - }), | |
112 | - | |
113 | 101 | changeLoading: (loading = true) => { |
114 | 102 | getInstance().setModalProps({ loading }); |
115 | 103 | }, | ... | ... |
src/views/demo/comp/drawer/Drawer4.vue
1 | 1 | <template> |
2 | 2 | <BasicDrawer v-bind="$attrs" @register="register" title="Drawer Title" width="50%"> |
3 | 3 | <div> |
4 | - <p class="h-20">外部传递数据: {{ receiveDrawerDataRef }}</p> | |
5 | 4 | <BasicForm @register="registerForm" /> |
6 | 5 | </div> |
7 | 6 | </BasicDrawer> |
... | ... | @@ -41,14 +40,14 @@ |
41 | 40 | span: 24, |
42 | 41 | }, |
43 | 42 | }); |
44 | - const [register, { receiveDrawerDataRef }] = useDrawerInner((data) => { | |
43 | + const [register] = useDrawerInner((data) => { | |
45 | 44 | // 方式1 |
46 | 45 | setFieldsValue({ |
47 | 46 | field2: data.data, |
48 | 47 | field1: data.info, |
49 | 48 | }); |
50 | 49 | }); |
51 | - return { register, receiveDrawerDataRef, schemas, registerForm }; | |
50 | + return { register, schemas, registerForm }; | |
52 | 51 | }, |
53 | 52 | }); |
54 | 53 | </script> | ... | ... |
src/views/demo/comp/modal/Modal4.vue
1 | 1 | <template> |
2 | 2 | <BasicModal v-bind="$attrs" @register="register" title="Modal Title"> |
3 | - <p class="h-20">外部传递数据: {{ receiveModalDataRef }}</p> | |
4 | 3 | <BasicForm @register="registerForm" :model="model" /> |
5 | 4 | </BasicModal> |
6 | 5 | </template> |
... | ... | @@ -46,7 +45,7 @@ |
46 | 45 | }, |
47 | 46 | }); |
48 | 47 | |
49 | - const [register, { receiveModalDataRef }] = useModalInner((data) => { | |
48 | + const [register] = useModalInner((data) => { | |
50 | 49 | // 方式1 |
51 | 50 | // setFieldsValue({ |
52 | 51 | // field2: data.data, |
... | ... | @@ -60,7 +59,7 @@ |
60 | 59 | // model:{ field2: data.data, field1: data.info } |
61 | 60 | // }) |
62 | 61 | }); |
63 | - return { register, receiveModalDataRef, schemas, registerForm, model: modelRef }; | |
62 | + return { register, schemas, registerForm, model: modelRef }; | |
64 | 63 | }, |
65 | 64 | }); |
66 | 65 | </script> | ... | ... |
src/views/demo/comp/modal/index.vue
... | ... | @@ -40,24 +40,8 @@ |
40 | 40 | const [register1, { openModal: openModal1, setModalProps }] = useModal(); |
41 | 41 | const [register2, { openModal: openModal2 }] = useModal(); |
42 | 42 | const [register3, { openModal: openModal3 }] = useModal(); |
43 | - const [ | |
44 | - register4, | |
45 | - { | |
46 | - openModal: openModal4, | |
47 | - // transferModalData | |
48 | - }, | |
49 | - ] = useModal(); | |
43 | + const [register4, { openModal: openModal4 }] = useModal(); | |
50 | 44 | function send() { |
51 | - // transferModalData({ | |
52 | - // data: 'content', | |
53 | - // info: 'Info', | |
54 | - // }); | |
55 | - // setTimeout(() => { | |
56 | - // transferModalData({ | |
57 | - // data: 'content1', | |
58 | - // info: 'Info1', | |
59 | - // }); | |
60 | - // }, 3000); | |
61 | 45 | openModal4(true, { |
62 | 46 | data: 'content', |
63 | 47 | info: 'Info', | ... | ... |