From ee0470c2809f6ce5dc52e5ad86effe215fa458b0 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Fri, 6 Nov 2020 16:44:30 +0800 Subject: [PATCH] revert: menu to 1.6.5 #3112 --- antdv-demo | 2 +- components/_util/store/connect.jsx | 42 ++++--------------- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- components/menu/MenuItem.jsx | 7 +--- .../__tests__/__snapshots__/demo.test.js.snap | 12 +++--- components/vc-menu/DOMWrap.jsx | 7 +--- components/vc-menu/MenuItem.jsx | 13 +++--- components/vc-menu/MenuItemGroup.jsx | 18 +++----- components/vc-menu/SubMenu.jsx | 15 +++---- components/vc-menu/SubPopupMenu.jsx | 9 ++-- 10 files changed, 39 insertions(+), 90 deletions(-) diff --git a/antdv-demo b/antdv-demo index f7a4bb76d..52006fa6a 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit f7a4bb76d93075062da04b34afb264aefee1c351 +Subproject commit 52006fa6ae47595a2af099ab226e3c79861d3f84 diff --git a/components/_util/store/connect.jsx b/components/_util/store/connect.jsx index ca970e4dc..792a0a279 100644 --- a/components/_util/store/connect.jsx +++ b/components/_util/store/connect.jsx @@ -9,7 +9,7 @@ function getDisplayName(WrappedComponent) { } const defaultMapStateToProps = () => ({}); -export default function connect(mapStateToProps, injectExtraPropsKey) { +export default function connect(mapStateToProps) { const shouldSubscribe = !!mapStateToProps; const finalMapStateToProps = mapStateToProps || defaultMapStateToProps; return function wrapWithConnect(WrappedComponent) { @@ -25,43 +25,18 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { props, inject: { storeContext: { default: () => ({}) }, - ...(injectExtraPropsKey - ? { - injectExtraContext: { - from: injectExtraPropsKey, - default: () => ({}), - }, - } - : {}), - }, - computed: { - injectExtraProps() { - return this.injectExtraContext ? this.injectExtraContext.$attrs : {}; - }, - injectExtraListeners() { - return this.injectExtraContext ? this.injectExtraContext.$listeners : {}; - }, }, data() { this.store = this.storeContext.store; - this.preProps = { - ...omit(getOptionProps(this), ['__propsSymbol__']), - ...this.injectExtraProps, - }; + this.preProps = omit(getOptionProps(this), ['__propsSymbol__']); return { - subscribed: finalMapStateToProps(this.store.getState(), { - ...this.$props, - ...this.injectExtraProps, - }), + subscribed: finalMapStateToProps(this.store.getState(), this.$props), }; }, watch: { __propsSymbol__() { if (mapStateToProps && mapStateToProps.length === 2) { - this.subscribed = finalMapStateToProps(this.store.getState(), { - ...this.$props, - ...this.injectExtraProps, - }); + this.subscribed = finalMapStateToProps(this.store.getState(), this.$props); } }, }, @@ -77,10 +52,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { if (!this.unsubscribe) { return; } - const props = { - ...omit(getOptionProps(this), ['__propsSymbol__']), - ...this.injectExtraProps, - }; + const props = omit(getOptionProps(this), ['__propsSymbol__']); const nextSubscribed = finalMapStateToProps(this.store.getState(), props); if ( !shallowEqual(this.preProps, props) || @@ -109,7 +81,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { }, render() { const { $slots = {}, $scopedSlots, subscribed, store } = this; - const props = { ...getOptionProps(this), ...this.injectExtraProps }; + const props = getOptionProps(this); this.preProps = { ...omit(props, ['__propsSymbol__']) }; const wrapProps = { props: { @@ -117,7 +89,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) { ...subscribed, store, }, - on: { ...getListeners(this), ...this.injectExtraListeners }, + on: getListeners(this), scopedSlots: $scopedSlots, }; return ( diff --git a/components/layout/__tests__/__snapshots__/demo.test.js.snap b/components/layout/__tests__/__snapshots__/demo.test.js.snap index cb081120a..576bca6d8 100644 --- a/components/layout/__tests__/__snapshots__/demo.test.js.snap +++ b/components/layout/__tests__/__snapshots__/demo.test.js.snap @@ -322,7 +322,7 @@ exports[`renders ./antdv-demo/docs/layout/demo/top-side.md correctly 1`] = `