terra-disclosure-manager
Advanced tools
Comparing version 4.26.0 to 4.27.0
@@ -7,2 +7,7 @@ ChangeLog | ||
4.27.0 - (November 20, 2019) | ||
------------------ | ||
### Added | ||
* Added support for application-level disclosure content wrapping | ||
4.26.0 - (November 7, 2019) | ||
@@ -9,0 +14,0 @@ ------------------ |
@@ -134,3 +134,9 @@ "use strict"; | ||
*/ | ||
disclosureManager: _DisclosureManagerDelegate.default.propType | ||
disclosureManager: _DisclosureManagerDelegate.default.propType, | ||
/** | ||
* @private | ||
* The container to wrap the disclosed content. This should be provided from the application level. | ||
*/ | ||
withDisclosureContainer: _propTypes.default.func | ||
}; | ||
@@ -613,3 +619,3 @@ var defaultProps = { | ||
key: "generateDisclosureComponentMappingForRender", | ||
value: function generateDisclosureComponentMappingForRender() { | ||
value: function generateDisclosureComponentMappingForRender(withDisclosureContainer) { | ||
var _this$state = this.state, | ||
@@ -621,2 +627,3 @@ disclosureComponentKeys = _this$state.disclosureComponentKeys, | ||
var componentData = disclosureComponentData[key]; | ||
var component = withDisclosureContainer ? withDisclosureContainer(componentData.component) : componentData.component; | ||
accumulator[key] = { | ||
@@ -628,3 +635,3 @@ component: _react.default.createElement(_DisclosureManagerHeaderAdapterContext.default.Provider, { | ||
value: disclosureComponentDelegates[index] | ||
}, componentData.component)), | ||
}, component)), | ||
headerAdapterData: componentData.headerAdapterData | ||
@@ -641,2 +648,3 @@ }; | ||
var _this$props2 = this.props, | ||
withDisclosureContainer = _this$props2.withDisclosureContainer, | ||
render = _this$props2.render, | ||
@@ -657,3 +665,3 @@ children = _this$props2.children; | ||
var disclosureComponentMappingForRender = this.generateDisclosureComponentMappingForRender(); | ||
var disclosureComponentMappingForRender = this.generateDisclosureComponentMappingForRender(withDisclosureContainer); | ||
return render({ | ||
@@ -660,0 +668,0 @@ dismissPresentedComponent: this.generatePopFunction(disclosureComponentKeys ? disclosureComponentKeys[disclosureComponentKeys.length - 1] : undefined), |
{ | ||
"name": "terra-disclosure-manager", | ||
"main": "lib/DisclosureManager.js", | ||
"version": "4.26.0", | ||
"version": "4.27.0", | ||
"description": "A stateful component used to manage disclosure presentation.", | ||
@@ -43,3 +43,3 @@ "repository": { | ||
}, | ||
"gitHead": "1613dd8dcdbdd7c85a5ebda9e4d463b2e7ad9d48" | ||
"gitHead": "d7bc4327ede7c2168ccdb71e3c0855f6413fe981" | ||
} |
@@ -57,2 +57,7 @@ import React from 'react'; | ||
disclosureManager: DisclosureManagerDelegate.propType, | ||
/** | ||
* @private | ||
* The container to wrap the disclosed content. This should be provided from the application level. | ||
*/ | ||
withDisclosureContainer: PropTypes.func, | ||
}; | ||
@@ -470,3 +475,3 @@ | ||
generateDisclosureComponentMappingForRender() { | ||
generateDisclosureComponentMappingForRender(withDisclosureContainer) { | ||
const { | ||
@@ -480,3 +485,3 @@ disclosureComponentKeys, | ||
const componentData = disclosureComponentData[key]; | ||
const component = withDisclosureContainer ? withDisclosureContainer(componentData.component) : componentData.component; | ||
accumulator[key] = { | ||
@@ -486,3 +491,3 @@ component: ( | ||
<DisclosureManagerContext.Provider value={disclosureComponentDelegates[index]}> | ||
{componentData.component} | ||
{component} | ||
</DisclosureManagerContext.Provider> | ||
@@ -499,3 +504,3 @@ </DisclosureManagerHeaderAdapterContext.Provider> | ||
render() { | ||
const { render, children } = this.props; | ||
const { withDisclosureContainer, render, children } = this.props; | ||
const { | ||
@@ -514,5 +519,4 @@ childComponentDelegate, | ||
} | ||
const disclosureComponentMappingForRender = this.generateDisclosureComponentMappingForRender(withDisclosureContainer); | ||
const disclosureComponentMappingForRender = this.generateDisclosureComponentMappingForRender(); | ||
return render({ | ||
@@ -519,0 +523,0 @@ dismissPresentedComponent: this.generatePopFunction(disclosureComponentKeys ? disclosureComponentKeys[disclosureComponentKeys.length - 1] : undefined), |
@@ -130,2 +130,31 @@ import React from 'react'; | ||
it('renders disclosed content in the disclosure wrapper', () => { | ||
const wrapper = mount( | ||
<DisclosureManager.WrappedComponent | ||
render={(manager) => ( | ||
<div id="content"> | ||
{manager.children.components} | ||
{manager.disclosure.components} | ||
</div> | ||
)} | ||
withDisclosureContainer={(content) => ( | ||
<div id="disclosure-container"> | ||
{content} | ||
</div> | ||
)} | ||
supportedDisclosureTypes={['test']} | ||
> | ||
<TestChild id="child1" /> | ||
<TestChild id="child2" /> | ||
</DisclosureManager.WrappedComponent>, | ||
); | ||
validateInitialState(wrapper); | ||
validateChildDelegate(wrapper); | ||
return triggerChildDisclose(wrapper).then(() => { | ||
expect(wrapper.exists('#disclosure-container')).toBe(true); | ||
}); | ||
}); | ||
it('should resolve disclose request with dismissDisclosure/afterDismiss APIs', () => { | ||
@@ -132,0 +161,0 @@ let dismissDisclosureInstance; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152772
2324