Skip to content

Commit a307562

Browse files
Merge pull request #81 from webdev-dev/master
Cascading Pane Action Update
2 parents ba83e82 + 05e509c commit a307562

8 files changed

Lines changed: 298 additions & 224 deletions

File tree

lib/CascadingPane/CascadingPane.js

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,25 @@ var CascadingPane = function (_React$Component) {
7171
_createClass(CascadingPane, [{
7272
key: 'componentWillMount',
7373
value: function componentWillMount() {
74-
var _props = this.props,
75-
config = _props.config,
76-
getCascadingNav = _props.getCascadingNav;
74+
var getCascadingNav = this.props.getCascadingNav;
7775

78-
getCascadingNav(config);
76+
getCascadingNav();
7977
}
8078
}, {
8179
key: 'renderNav',
8280
value: function renderNav(child) {
8381
var _this2 = this;
8482

85-
var _props2 = this.props,
86-
config = _props2.config,
87-
location = _props2.location,
88-
getCascadingNav = _props2.getCascadingNav,
89-
navData = _props2.navData,
90-
navFetch = _props2.navFetch,
91-
fetchedNav = _props2.fetchedNav;
83+
var _props = this.props,
84+
location = _props.location,
85+
getCascadingNav = _props.getCascadingNav,
86+
navData = _props.navData,
87+
navFetch = _props.navFetch,
88+
fetchedNav = _props.fetchedNav;
9289

9390

9491
return _react2.default.cloneElement(child, {
9592
key: 0,
96-
config: config,
9793
data: navData,
9894
getCascadingNav: getCascadingNav,
9995
navFetch: navFetch,
@@ -109,23 +105,21 @@ var CascadingPane = function (_React$Component) {
109105
value: function renderMainView(child) {
110106
var _this3 = this;
111107

112-
var _props3 = this.props,
113-
config = _props3.config,
114-
getCascadingNav = _props3.getCascadingNav,
115-
getCascadingMainView = _props3.getCascadingMainView,
116-
location = _props3.location,
117-
mainData = _props3.mainData,
118-
navFetch = _props3.navFetch,
119-
mainViewFetch = _props3.mainViewFetch,
120-
fetchedNav = _props3.fetchedNav,
121-
fetchedMainView = _props3.fetchedMainView,
122-
visibilityFilter = _props3.visibilityFilter;
108+
var _props2 = this.props,
109+
getCascadingNav = _props2.getCascadingNav,
110+
getCascadingMainView = _props2.getCascadingMainView,
111+
location = _props2.location,
112+
mainData = _props2.mainData,
113+
navFetch = _props2.navFetch,
114+
mainViewFetch = _props2.mainViewFetch,
115+
fetchedNav = _props2.fetchedNav,
116+
fetchedMainView = _props2.fetchedMainView,
117+
visibilityFilter = _props2.visibilityFilter;
123118
var selectedGroup = this.state.selectedGroup;
124119

125120

126121
return _react2.default.cloneElement(child, {
127122
key: 1,
128-
config: config,
129123
groupData: selectedGroup,
130124
mainData: mainData,
131125
getCascadingMainView: getCascadingMainView,
@@ -146,24 +140,22 @@ var CascadingPane = function (_React$Component) {
146140
}, {
147141
key: 'renderSubView',
148142
value: function renderSubView(child) {
149-
var _props4 = this.props,
150-
config = _props4.config,
151-
getCascadingSubView = _props4.getCascadingSubView,
152-
getCascadingMainView = _props4.getCascadingMainView,
153-
location = _props4.location,
154-
subData = _props4.subData,
155-
subViewFetch = _props4.subViewFetch,
156-
mainViewFetch = _props4.mainViewFetch,
157-
fetchedSubView = _props4.fetchedSubView,
158-
fetchedMainView = _props4.fetchedMainView;
143+
var _props3 = this.props,
144+
getCascadingSubView = _props3.getCascadingSubView,
145+
getCascadingMainView = _props3.getCascadingMainView,
146+
location = _props3.location,
147+
subData = _props3.subData,
148+
subViewFetch = _props3.subViewFetch,
149+
mainViewFetch = _props3.mainViewFetch,
150+
fetchedSubView = _props3.fetchedSubView,
151+
fetchedMainView = _props3.fetchedMainView;
159152
var _state = this.state,
160153
selectedGroup = _state.selectedGroup,
161154
selectedMember = _state.selectedMember;
162155

163156

164157
return _react2.default.cloneElement(child, {
165158
key: 2,
166-
config: config,
167159
groupData: selectedGroup,
168160
memberData: selectedMember,
169161
data: subData,
@@ -180,22 +172,26 @@ var CascadingPane = function (_React$Component) {
180172
}, {
181173
key: 'render',
182174
value: function render() {
183-
var _props5 = this.props,
184-
className = _props5.className,
185-
viewClassName = _props5.viewClassName,
186-
splitClassName = _props5.splitClassName,
187-
defaultSize = _props5.defaultSize,
188-
children = _props5.children;
175+
var _props4 = this.props,
176+
className = _props4.className,
177+
viewClassName = _props4.viewClassName,
178+
splitClassName = _props4.splitClassName,
179+
defaultSize = _props4.defaultSize,
180+
children = _props4.children;
189181
var selectedMember = this.state.selectedMember;
190182

191183

192184
return _react2.default.createElement(
193185
'div',
194-
{ className: (0, _classnames2.default)(className, 'cascading-pane cascading-pane-container') },
186+
{
187+
className: (0, _classnames2.default)(className, 'cascading-pane cascading-pane-container')
188+
},
195189
this.renderNav(children[0]),
196190
Object.keys(selectedMember).length === 0 ? _react2.default.createElement(
197191
'div',
198-
{ className: (0, _classnames2.default)(viewClassName, 'cascading-pane-view') },
192+
{
193+
className: (0, _classnames2.default)(viewClassName, 'cascading-pane-view')
194+
},
199195
this.renderMainView(children[1])
200196
) : _react2.default.createElement(
201197
_reactSplitPane2.default,
@@ -221,9 +217,6 @@ CascadingPane.MainView = _CascadingPaneMainView2.default;
221217
CascadingPane.SubView = _CascadingPaneSubView2.default;
222218

223219
CascadingPane.propTypes = {
224-
config: _propTypes2.default.shape({
225-
APP_ID: _propTypes2.default.string
226-
}).isRequired,
227220
location: _propTypes2.default.object,
228221
className: _propTypes2.default.string,
229222
viewClassName: _propTypes2.default.string,

lib/CascadingPane/CascadingPaneMainView.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,10 @@ var CascadingPaneMainView = function (_React$Component) {
6969
key: 'componentWillMount',
7070
value: function componentWillMount() {
7171
var _props = this.props,
72-
config = _props.config,
7372
cascNav = _props.cascNav,
7473
getCascadingMainView = _props.getCascadingMainView;
7574

76-
if (cascNav) getCascadingMainView(config, cascNav);
75+
if (cascNav) getCascadingMainView(cascNav);
7776
}
7877
}, {
7978
key: 'componentWillReceiveProps',
@@ -83,7 +82,6 @@ var CascadingPaneMainView = function (_React$Component) {
8382
cascSelect = _props2.cascSelect,
8483
fetchedNav = _props2.fetchedNav,
8584
fetchedMainView = _props2.fetchedMainView,
86-
config = _props2.config,
8785
getCascadingMainView = _props2.getCascadingMainView,
8886
mainData = _props2.mainData;
8987

@@ -97,11 +95,11 @@ var CascadingPaneMainView = function (_React$Component) {
9795
if (cascNav) {
9896
if (!nextProps.cascNav || cascNav !== nextProps.cascNav) {
9997
newState.navSelect = nextProps.cascNav || '';
100-
if (nextProps.cascNav) getCascadingMainView(config, nextProps.cascNav);
98+
if (nextProps.cascNav) getCascadingMainView(nextProps.cascNav);
10199
}
102100
} else if (nextProps.cascNav) {
103101
newState.navSelect = nextProps.cascNav;
104-
getCascadingMainView(config, nextProps.cascNav);
102+
getCascadingMainView(nextProps.cascNav);
105103
}
106104

107105
if (cascSelect) {
@@ -191,7 +189,6 @@ var CascadingPaneMainView = function (_React$Component) {
191189
mainData = _props4.mainData,
192190
summaryDisplay = _props4.summaryDisplay,
193191
reloadNav = _props4.reloadNav,
194-
config = _props4.config,
195192
itemDisplay = _props4.itemDisplay,
196193
tableClassName = _props4.tableClassName,
197194
visibilityFilter = _props4.visibilityFilter,
@@ -209,14 +206,20 @@ var CascadingPaneMainView = function (_React$Component) {
209206
if (!navSelect) {
210207
return _react2.default.createElement(
211208
'div',
212-
{ className: (0, _classnames2.default)(className, 'cascading-pane-mainview'), key: key },
209+
{
210+
className: (0, _classnames2.default)(className, 'cascading-pane-mainview'),
211+
key: key
212+
},
213213
noneSelectedDisplay
214214
);
215215
}
216216

217217
return _react2.default.createElement(
218218
'div',
219-
{ className: (0, _classnames2.default)(className, 'cascading-pane-mainview'), key: key },
219+
{
220+
className: (0, _classnames2.default)(className, 'cascading-pane-mainview'),
221+
key: key
222+
},
220223
_react2.default.createElement(
221224
_LoadingComponent2.default,
222225
navFetch,
@@ -230,7 +233,7 @@ var CascadingPaneMainView = function (_React$Component) {
230233
data: mainData,
231234
groupData: groupData,
232235
updateNav: function updateNav() {
233-
return reloadNav(config);
236+
return reloadNav();
234237
}
235238
})
236239
),
@@ -278,9 +281,6 @@ var CascadingPaneMainView = function (_React$Component) {
278281
CascadingPaneMainView.propTypes = {
279282
role: _propTypes2.default.string,
280283
key: _propTypes2.default.number,
281-
config: _propTypes2.default.shape({
282-
APP_ID: _propTypes2.default.string
283-
}),
284284
groupData: _propTypes2.default.object,
285285
mainData: _propTypes2.default.array,
286286
getCascadingMainView: _propTypes2.default.func,

lib/CascadingPane/CascadingPaneNav.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ var CascadingPaneNav = function (_React$Component) {
149149
data = _props3.data,
150150
itemConfigDisplay = _props3.itemConfigDisplay,
151151
getCascadingNav = _props3.getCascadingNav,
152-
config = _props3.config,
153152
logoField = _props3.logoField,
154153
titleField = _props3.titleField,
155154
isHiddenField = _props3.isHiddenField;
@@ -164,7 +163,11 @@ var CascadingPaneNav = function (_React$Component) {
164163
name: 'Logo',
165164
className: 'nav-group-logo',
166165
display: function display(item) {
167-
return _react2.default.createElement('img', { role: 'presentation', src: item[logoField], className: 'cascading-nav-logo' });
166+
return _react2.default.createElement('img', {
167+
role: 'presentation',
168+
src: item[logoField],
169+
className: 'cascading-nav-logo'
170+
});
168171
}
169172
});
170173
}
@@ -180,7 +183,10 @@ var CascadingPaneNav = function (_React$Component) {
180183
name: 'Visibility',
181184
className: 'nav-group-visibility',
182185
display: function display(item) {
183-
return item[isHiddenField] ? _react2.default.createElement(_reactBootstrap.Glyphicon, { glyph: 'eye-close', title: 'Only visible to CUD administrators' }) : '';
186+
return item[isHiddenField] ? _react2.default.createElement(_reactBootstrap.Glyphicon, {
187+
glyph: 'eye-close',
188+
title: 'Only visible to CUD administrators'
189+
}) : '';
184190
}
185191
});
186192
}
@@ -190,7 +196,7 @@ var CascadingPaneNav = function (_React$Component) {
190196
className: 'nav-group-actions',
191197
display: function display(item) {
192198
return _react2.default.cloneElement(itemConfigDisplay, Object.assign({}, { item: item }, { updateNav: function updateNav() {
193-
return getCascadingNav(config);
199+
return getCascadingNav();
194200
} }));
195201
},
196202
excludeRowClick: true
@@ -199,7 +205,10 @@ var CascadingPaneNav = function (_React$Component) {
199205

200206
return _react2.default.createElement(
201207
'div',
202-
{ className: (0, _classnames2.default)(className, 'cascading-pane-nav'), key: key },
208+
{
209+
className: (0, _classnames2.default)(className, 'cascading-pane-nav'),
210+
key: key
211+
},
203212
headerDisplay,
204213
_react2.default.createElement(
205214
_LoadingComponent2.default,
@@ -234,9 +243,6 @@ var CascadingPaneNav = function (_React$Component) {
234243
CascadingPaneNav.propTypes = {
235244
role: _propTypes2.default.string,
236245
key: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
237-
config: _propTypes2.default.shape({
238-
APP_ID: _propTypes2.default.string
239-
}),
240246
data: _propTypes2.default.array,
241247
getCascadingNav: _propTypes2.default.func,
242248
navFetch: _propTypes2.default.shape({

lib/CascadingPane/CascadingPaneSubView.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ var CascadingPaneSubView = function (_React$Component) {
5454
key: 'componentWillMount',
5555
value: function componentWillMount() {
5656
var _props = this.props,
57-
config = _props.config,
5857
cascSelect = _props.cascSelect,
5958
getCascadingSubView = _props.getCascadingSubView;
6059

61-
if (cascSelect) getCascadingSubView(config, cascSelect);
60+
if (cascSelect) getCascadingSubView(cascSelect);
6261
}
6362
}, {
6463
key: 'componentWillReceiveProps',
@@ -68,7 +67,6 @@ var CascadingPaneSubView = function (_React$Component) {
6867
cascSelect = _props2.cascSelect,
6968
fetchedMainView = _props2.fetchedMainView,
7069
fetchedSubView = _props2.fetchedSubView,
71-
config = _props2.config,
7270
getCascadingSubView = _props2.getCascadingSubView;
7371

7472
var newState = {};
@@ -88,11 +86,11 @@ var CascadingPaneSubView = function (_React$Component) {
8886
if (cascSelect) {
8987
if (!nextProps.cascSelect || cascSelect !== nextProps.cascSelect) {
9088
newState.navSelect = nextProps.cascSelect || '';
91-
if (nextProps.cascSelect) getCascadingSubView(config, nextProps.cascSelect);
89+
if (nextProps.cascSelect) getCascadingSubView(nextProps.cascSelect);
9290
}
9391
} else if (nextProps.cascSelect) {
9492
newState.navSelect = nextProps.cascSelect;
95-
getCascadingSubView(config, nextProps.cascSelect);
93+
getCascadingSubView(nextProps.cascSelect);
9694
}
9795
if (Object.keys(newState).length > 0) {
9896
this.setState(_extends({}, newState));
@@ -109,7 +107,6 @@ var CascadingPaneSubView = function (_React$Component) {
109107
subViewFetch = _props3.subViewFetch,
110108
mainViewFetch = _props3.mainViewFetch,
111109
groupData = _props3.groupData,
112-
config = _props3.config,
113110
memberData = _props3.memberData,
114111
data = _props3.data,
115112
contentDisplay = _props3.contentDisplay;
@@ -122,15 +119,17 @@ var CascadingPaneSubView = function (_React$Component) {
122119

123120
return _react2.default.createElement(
124121
'div',
125-
{ className: (0, _classnames2.default)(className, 'cascading-pane-subview'), key: key },
122+
{
123+
className: (0, _classnames2.default)(className, 'cascading-pane-subview'),
124+
key: key
125+
},
126126
_react2.default.createElement(
127127
_LoadingComponent2.default,
128128
mainViewFetch,
129129
_react2.default.createElement(
130130
_LoadingComponent2.default,
131131
subViewFetch,
132132
fetchedSub && fetchedMain && _react2.default.cloneElement(contentDisplay, {
133-
config: config,
134133
groupData: groupData,
135134
memberData: memberData,
136135
data: data,
@@ -151,9 +150,6 @@ var CascadingPaneSubView = function (_React$Component) {
151150
CascadingPaneSubView.propTypes = {
152151
role: _propTypes2.default.string,
153152
key: _propTypes2.default.number,
154-
config: _propTypes2.default.shape({
155-
APP_ID: _propTypes2.default.string
156-
}),
157153
groupData: _propTypes2.default.object,
158154
memberData: _propTypes2.default.object,
159155
data: _propTypes2.default.object,

0 commit comments

Comments
 (0)