@coreui/react 2.5.7 → 2.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/es/Aside.js +29 -37
- package/es/AsideToggler.js +36 -44
- package/es/Breadcrumb.js +51 -58
- package/es/Breadcrumb2.js +52 -60
- package/es/Footer.js +24 -32
- package/es/Header.js +23 -35
- package/es/HeaderDropdown.js +23 -27
- package/es/NavbarBrand.js +32 -39
- package/es/Shared/classes.js +0 -3
- package/es/Shared/element-closest.js +2 -0
- package/es/Shared/index.js +0 -1
- package/es/Shared/layout/layout.js +24 -16
- package/es/Shared/toggle-classes.js +2 -0
- package/es/Sidebar.js +43 -53
- package/es/SidebarFooter.js +19 -29
- package/es/SidebarForm.js +19 -29
- package/es/SidebarHeader.js +19 -29
- package/es/SidebarMinimizer.js +30 -35
- package/es/SidebarNav.js +128 -162
- package/es/SidebarNav2.js +178 -202
- package/es/SidebarToggler.js +35 -36
- package/es/Switch.js +59 -62
- package/lib/Aside.js +51 -60
- package/lib/AsideToggler.js +58 -67
- package/lib/Breadcrumb.js +71 -77
- package/lib/Breadcrumb2.js +72 -79
- package/lib/Footer.js +40 -47
- package/lib/Header.js +39 -50
- package/lib/HeaderDropdown.js +36 -37
- package/lib/NavbarBrand.js +50 -56
- package/lib/Shared/classes.js +8 -6
- package/lib/Shared/element-closest.js +3 -1
- package/lib/Shared/index.js +2 -3
- package/lib/Shared/layout/layout.js +31 -19
- package/lib/Shared/toggle-classes.js +6 -2
- package/lib/Sidebar.js +69 -81
- package/lib/SidebarFooter.js +33 -42
- package/lib/SidebarForm.js +33 -42
- package/lib/SidebarHeader.js +33 -42
- package/lib/SidebarMinimizer.js +51 -55
- package/lib/SidebarNav.js +154 -187
- package/lib/SidebarNav2.js +211 -236
- package/lib/SidebarToggler.js +56 -58
- package/lib/Switch.js +90 -92
- package/lib/index.js +36 -55
- package/package.json +14 -14
- package/umd/main.d0f057e5.css +5 -0
- package/umd/main.d0f057e5.css.map +1 -0
- package/umd/{@coreui/react.js → react.js} +918 -1076
- package/umd/react.min.js +38 -0
- package/umd/react.min.js.map +1 -0
- package/umd/@coreui/react.min.js +0 -44
- package/umd/@coreui/react.min.js.map +0 -1
- package/umd/main.a93373b7.css +0 -148
- package/umd/main.a93373b7.css.map +0 -1
package/es/SidebarNav2.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
10
|
|
|
13
11
|
import React, { Component } from 'react';
|
|
14
12
|
import { Badge, Nav, NavItem, NavLink as RsNavLink } from 'reactstrap';
|
|
@@ -17,10 +15,8 @@ import PropTypes from 'prop-types';
|
|
|
17
15
|
import PerfectScrollbar from 'react-perfect-scrollbar';
|
|
18
16
|
import 'react-perfect-scrollbar/dist/css/styles.css';
|
|
19
17
|
import '../css/scrollbar.css';
|
|
20
|
-
|
|
21
18
|
import LayoutHelper from './Shared/layout/layout';
|
|
22
|
-
|
|
23
|
-
var propTypes = {
|
|
19
|
+
var propTypes = process.env.NODE_ENV !== "production" ? {
|
|
24
20
|
children: PropTypes.node,
|
|
25
21
|
className: PropTypes.string,
|
|
26
22
|
navConfig: PropTypes.any,
|
|
@@ -30,8 +26,7 @@ var propTypes = {
|
|
|
30
26
|
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
31
27
|
router: PropTypes.any,
|
|
32
28
|
props: PropTypes.any
|
|
33
|
-
};
|
|
34
|
-
|
|
29
|
+
} : {};
|
|
35
30
|
var defaultProps = {
|
|
36
31
|
tag: 'nav',
|
|
37
32
|
navConfig: {
|
|
@@ -39,174 +34,165 @@ var defaultProps = {
|
|
|
39
34
|
name: 'Dashboard',
|
|
40
35
|
url: '/dashboard',
|
|
41
36
|
icon: 'icon-speedometer',
|
|
42
|
-
badge: {
|
|
37
|
+
badge: {
|
|
38
|
+
variant: 'info',
|
|
39
|
+
text: 'NEW'
|
|
40
|
+
}
|
|
43
41
|
}]
|
|
44
42
|
},
|
|
45
43
|
isOpen: false,
|
|
46
|
-
router: {
|
|
44
|
+
router: {
|
|
45
|
+
RsNavLink: RsNavLink
|
|
46
|
+
}
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
var AppSidebarNav2 = function (_Component) {
|
|
50
|
-
|
|
49
|
+
var AppSidebarNav2 = /*#__PURE__*/function (_Component) {
|
|
50
|
+
_inheritsLoose(AppSidebarNav2, _Component);
|
|
51
51
|
|
|
52
52
|
function AppSidebarNav2(props) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
|
56
|
-
|
|
57
|
-
_this._scrollBarRef = null;
|
|
53
|
+
var _this;
|
|
58
54
|
|
|
55
|
+
_this = _Component.call(this, props) || this;
|
|
59
56
|
|
|
60
|
-
_this
|
|
61
|
-
_this.activeRoute = _this.activeRoute.bind(_this);
|
|
62
|
-
_this.hideMobile = _this.hideMobile.bind(_this);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "_scrollBarRef", null);
|
|
63
58
|
|
|
59
|
+
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
|
|
60
|
+
_this.activeRoute = _this.activeRoute.bind(_assertThisInitialized(_this));
|
|
61
|
+
_this.hideMobile = _this.hideMobile.bind(_assertThisInitialized(_this));
|
|
64
62
|
_this.changes = null;
|
|
65
|
-
_this.state = {
|
|
63
|
+
_this.state = {
|
|
64
|
+
sidebarMinimized: false
|
|
65
|
+
};
|
|
66
66
|
return _this;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
AppSidebarNav2.prototype
|
|
69
|
+
var _proto = AppSidebarNav2.prototype;
|
|
70
|
+
|
|
71
|
+
_proto.handleClick = function handleClick(e, item) {
|
|
70
72
|
if (item.attributes && typeof item.attributes.onClick === 'function' && !this.isActiveRoute(item.url, this.props)) {
|
|
71
73
|
item.attributes.onClick(e, item);
|
|
72
74
|
} else {
|
|
73
75
|
e.preventDefault();
|
|
74
76
|
}
|
|
77
|
+
|
|
75
78
|
e.currentTarget.parentElement.classList.toggle('open');
|
|
76
79
|
};
|
|
77
80
|
|
|
78
|
-
|
|
81
|
+
_proto.isActiveRoute = function isActiveRoute(routeName, props) {
|
|
79
82
|
return props.location.pathname.indexOf(routeName) > -1;
|
|
80
83
|
};
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
_proto.activeRoute = function activeRoute(routeName, props) {
|
|
83
86
|
return this.isActiveRoute(routeName, props) ? 'nav-item nav-dropdown open' : 'nav-item nav-dropdown';
|
|
84
87
|
};
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
_proto.hideMobile = function hideMobile() {
|
|
87
90
|
if (document.body.classList.contains('sidebar-show')) {
|
|
88
91
|
document.body.classList.toggle('sidebar-show');
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
_proto.getAttribs = function getAttribs(attributes) {
|
|
93
96
|
return _extends({}, attributes);
|
|
94
|
-
}
|
|
97
|
+
} // nav list
|
|
98
|
+
;
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
AppSidebarNav2.prototype.navList = function navList(items) {
|
|
100
|
+
_proto.navList = function navList(items) {
|
|
100
101
|
var _this2 = this;
|
|
101
102
|
|
|
102
103
|
return items.map(function (item, index) {
|
|
103
104
|
return _this2.navType(item, index);
|
|
104
105
|
});
|
|
105
|
-
}
|
|
106
|
+
} // nav type
|
|
107
|
+
;
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
AppSidebarNav2.prototype.navType = function navType(item, idx) {
|
|
109
|
+
_proto.navType = function navType(item, idx) {
|
|
111
110
|
return item.title ? this.navTitle(item, idx) : item.divider ? this.navDivider(item, idx) : item.label ? this.navLabel(item, idx) : item.children ? this.navDropdown(item, idx) : this.navItem(item, idx);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
// simple wrapper for nav-title item
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
AppSidebarNav2.prototype.navWrapper = function navWrapper(item) {
|
|
111
|
+
} // nav list section title
|
|
112
|
+
;
|
|
113
|
+
|
|
114
|
+
_proto.navTitle = function navTitle(title, key) {
|
|
115
|
+
var classes = classNames('nav-title', title["class"], title.className);
|
|
116
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
117
|
+
key: key,
|
|
118
|
+
className: classes
|
|
119
|
+
}, this.navWrapper(title), " ");
|
|
120
|
+
} // simple wrapper for nav-title item
|
|
121
|
+
;
|
|
122
|
+
|
|
123
|
+
_proto.navWrapper = function navWrapper(item) {
|
|
131
124
|
return item.wrapper && item.wrapper.element ? React.createElement(item.wrapper.element, item.wrapper.attributes, item.name) : item.name;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
} // nav list divider
|
|
126
|
+
;
|
|
127
|
+
|
|
128
|
+
_proto.navDivider = function navDivider(divider, key) {
|
|
129
|
+
var classes = classNames('divider', divider["class"], divider.className);
|
|
130
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
131
|
+
key: key,
|
|
132
|
+
className: classes
|
|
133
|
+
});
|
|
134
|
+
} // nav label with nav link
|
|
135
|
+
;
|
|
144
136
|
|
|
145
|
-
|
|
137
|
+
_proto.navLabel = function navLabel(item, key) {
|
|
146
138
|
var classes = {
|
|
147
|
-
item: classNames('hidden-cn', item
|
|
148
|
-
link: classNames('nav-label', item
|
|
149
|
-
icon: classNames('nav-icon', !item.icon ? 'fa fa-circle' : item.icon, item.label.variant ?
|
|
139
|
+
item: classNames('hidden-cn', item["class"]),
|
|
140
|
+
link: classNames('nav-label', item["class"] ? item["class"] : ''),
|
|
141
|
+
icon: classNames('nav-icon', !item.icon ? 'fa fa-circle' : item.icon, item.label.variant ? "text-" + item.label.variant : '', item.label["class"] ? item.label["class"] : '')
|
|
150
142
|
};
|
|
151
143
|
return this.navLink(item, key, classes);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// nav dropdown
|
|
144
|
+
} // nav dropdown
|
|
145
|
+
;
|
|
155
146
|
|
|
156
|
-
|
|
157
|
-
AppSidebarNav2.prototype.navDropdown = function navDropdown(item, key) {
|
|
147
|
+
_proto.navDropdown = function navDropdown(item, key) {
|
|
158
148
|
var _this3 = this;
|
|
159
149
|
|
|
160
150
|
var itemIcon = this.navIcon(item);
|
|
161
151
|
var attributes = this.getAttribs(item.attributes);
|
|
162
|
-
var classes = classNames('nav-link', 'nav-dropdown-toggle', item
|
|
163
|
-
delete attributes
|
|
152
|
+
var classes = classNames('nav-link', 'nav-dropdown-toggle', item["class"], attributes["class"], attributes.className);
|
|
153
|
+
delete attributes["class"];
|
|
164
154
|
delete attributes.className;
|
|
165
155
|
var itemAttr = this.getAttribs(item.itemAttr);
|
|
166
|
-
var liClasses = classNames('nav-item', 'nav-dropdown', itemAttr
|
|
167
|
-
delete itemAttr
|
|
156
|
+
var liClasses = classNames('nav-item', 'nav-dropdown', itemAttr["class"], itemAttr.className);
|
|
157
|
+
delete itemAttr["class"];
|
|
168
158
|
delete itemAttr.className;
|
|
169
159
|
var NavLink = this.props.router.NavLink || RsNavLink;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.navList(item.children)
|
|
191
|
-
)
|
|
192
|
-
);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
// nav item with nav link
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
AppSidebarNav2.prototype.navItem = function navItem(item, key) {
|
|
160
|
+
return /*#__PURE__*/React.createElement("li", _extends({
|
|
161
|
+
key: key,
|
|
162
|
+
className: classNames(liClasses, {
|
|
163
|
+
'open': this.isActiveRoute(item.url, this.props)
|
|
164
|
+
})
|
|
165
|
+
}, itemAttr), /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
166
|
+
activeClassName: "open",
|
|
167
|
+
className: classes,
|
|
168
|
+
to: item.url || ''
|
|
169
|
+
}, attributes, {
|
|
170
|
+
onClick: function onClick(e) {
|
|
171
|
+
return _this3.handleClick(e, item);
|
|
172
|
+
}
|
|
173
|
+
}), itemIcon, item.name, this.navBadge(item.badge)), /*#__PURE__*/React.createElement("ul", {
|
|
174
|
+
className: "nav-dropdown-items"
|
|
175
|
+
}, this.navList(item.children)));
|
|
176
|
+
} // nav item with nav link
|
|
177
|
+
;
|
|
178
|
+
|
|
179
|
+
_proto.navItem = function navItem(item, key) {
|
|
199
180
|
var classes = {
|
|
200
|
-
item: classNames(item
|
|
201
|
-
link: classNames('nav-link', item.variant ?
|
|
181
|
+
item: classNames(item["class"]),
|
|
182
|
+
link: classNames('nav-link', item.variant ? "nav-link-" + item.variant : ''),
|
|
202
183
|
icon: classNames('nav-icon', item.icon)
|
|
203
184
|
};
|
|
204
185
|
return this.navLink(item, key, classes);
|
|
205
186
|
};
|
|
206
187
|
|
|
207
|
-
|
|
188
|
+
_proto.navIcon = function navIcon(item) {
|
|
208
189
|
var icon = item.icon;
|
|
209
|
-
var iconObject =
|
|
190
|
+
var iconObject = typeof icon === 'object' && icon !== null ? _extends({
|
|
191
|
+
iconClass: icon["class"],
|
|
192
|
+
iconClassName: icon.className
|
|
193
|
+
}, icon) : {
|
|
194
|
+
iconClass: icon
|
|
195
|
+
};
|
|
210
196
|
var iconClass = iconObject.iconClass,
|
|
211
197
|
iconClassName = iconObject.iconClassName,
|
|
212
198
|
innerText = iconObject.innerText,
|
|
@@ -214,24 +200,24 @@ var AppSidebarNav2 = function (_Component) {
|
|
|
214
200
|
attributes = iconObject.attributes;
|
|
215
201
|
|
|
216
202
|
var iconAttr = _extends({}, attributes);
|
|
217
|
-
|
|
203
|
+
|
|
204
|
+
delete iconAttr["class"];
|
|
218
205
|
delete iconAttr.className;
|
|
219
206
|
delete iconAttr.img;
|
|
220
207
|
var iconImg = img && img.src ? img : null;
|
|
221
208
|
var iconInner = innerText || null;
|
|
222
209
|
var classIcon = classNames('nav-icon', iconClass, iconClassName);
|
|
223
|
-
var iconComponent = iconImg ? React.createElement(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
210
|
+
var iconComponent = iconImg ? /*#__PURE__*/React.createElement("img", _extends({}, iconAttr, {
|
|
211
|
+
className: classIcon,
|
|
212
|
+
src: iconImg.src
|
|
213
|
+
})) : /*#__PURE__*/React.createElement("i", _extends({}, iconAttr, {
|
|
214
|
+
className: classIcon
|
|
215
|
+
}), iconInner);
|
|
228
216
|
return iconComponent;
|
|
229
|
-
}
|
|
217
|
+
} // nav link
|
|
218
|
+
;
|
|
230
219
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
AppSidebarNav2.prototype.navLink = function navLink(item, key, classes) {
|
|
220
|
+
_proto.navLink = function navLink(item, key, classes) {
|
|
235
221
|
var _this4 = this;
|
|
236
222
|
|
|
237
223
|
var ref = React.createRef();
|
|
@@ -239,72 +225,65 @@ var AppSidebarNav2 = function (_Component) {
|
|
|
239
225
|
var itemIcon = this.navIcon(item);
|
|
240
226
|
var itemBadge = this.navBadge(item.badge);
|
|
241
227
|
var attributes = this.getAttribs(item.attributes);
|
|
242
|
-
classes.link = classNames(classes.link, attributes
|
|
243
|
-
delete attributes
|
|
228
|
+
classes.link = classNames(classes.link, attributes["class"], attributes.className);
|
|
229
|
+
delete attributes["class"];
|
|
244
230
|
delete attributes.className;
|
|
245
231
|
var itemAttr = this.getAttribs(item.itemAttr);
|
|
246
|
-
classes.item = classNames(classes.item, itemAttr
|
|
247
|
-
delete itemAttr
|
|
232
|
+
classes.item = classNames(classes.item, itemAttr["class"], itemAttr.className);
|
|
233
|
+
delete itemAttr["class"];
|
|
248
234
|
delete itemAttr.className;
|
|
249
235
|
var NavLink = this.props.router.NavLink || RsNavLink;
|
|
250
|
-
return React.createElement(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
)
|
|
274
|
-
);
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
// badge addon to NavItem
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
AppSidebarNav2.prototype.navBadge = function navBadge(badge) {
|
|
236
|
+
return /*#__PURE__*/React.createElement(NavItem, _extends({
|
|
237
|
+
key: key,
|
|
238
|
+
className: classes.item
|
|
239
|
+
}, itemAttr), attributes.disabled ? /*#__PURE__*/React.createElement(RsNavLink, _extends({
|
|
240
|
+
href: '',
|
|
241
|
+
className: classes.link
|
|
242
|
+
}, attributes), itemIcon, item.name, itemBadge) : this.isExternal(url, this.props) || NavLink === RsNavLink ? /*#__PURE__*/React.createElement(RsNavLink, _extends({
|
|
243
|
+
href: url,
|
|
244
|
+
className: classes.link,
|
|
245
|
+
active: true
|
|
246
|
+
}, attributes), itemIcon, item.name, itemBadge) : /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
247
|
+
to: url,
|
|
248
|
+
className: classes.link,
|
|
249
|
+
activeClassName: "active",
|
|
250
|
+
onClick: function onClick() {
|
|
251
|
+
return _this4.hideMobile(ref);
|
|
252
|
+
},
|
|
253
|
+
ref: ref
|
|
254
|
+
}, attributes), itemIcon, item.name, itemBadge));
|
|
255
|
+
} // badge addon to NavItem
|
|
256
|
+
;
|
|
257
|
+
|
|
258
|
+
_proto.navBadge = function navBadge(badge) {
|
|
281
259
|
if (badge) {
|
|
282
|
-
var classes = classNames(badge
|
|
283
|
-
return React.createElement(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
);
|
|
260
|
+
var classes = classNames(badge["class"], badge.className);
|
|
261
|
+
return /*#__PURE__*/React.createElement(Badge, {
|
|
262
|
+
className: classes,
|
|
263
|
+
color: badge.variant
|
|
264
|
+
}, badge.text);
|
|
288
265
|
}
|
|
266
|
+
|
|
289
267
|
return null;
|
|
290
268
|
};
|
|
291
269
|
|
|
292
|
-
|
|
293
|
-
var linkType = typeof url
|
|
294
|
-
var link = linkType === 'string' ? url : linkType === 'object' && url.pathname ? url.pathname : linkType === 'function' && typeof url(props.location) === 'string' ? url(props.location) : linkType === 'function' &&
|
|
270
|
+
_proto.isExternal = function isExternal(url, props) {
|
|
271
|
+
var linkType = typeof url;
|
|
272
|
+
var link = linkType === 'string' ? url : linkType === 'object' && url.pathname ? url.pathname : linkType === 'function' && typeof url(props.location) === 'string' ? url(props.location) : linkType === 'function' && typeof url(props.location) === 'object' ? url(props.location).pathname : '';
|
|
295
273
|
return link.substring(0, 4) === 'http';
|
|
296
274
|
};
|
|
297
275
|
|
|
298
|
-
|
|
276
|
+
_proto.observeDomMutations = function observeDomMutations() {
|
|
299
277
|
var _this5 = this;
|
|
300
278
|
|
|
301
279
|
if (window.MutationObserver) {
|
|
302
|
-
|
|
303
280
|
// eslint-disable-next-line
|
|
304
281
|
this.changes = new MutationObserver(function (mutations) {
|
|
305
|
-
|
|
306
282
|
var isSidebarMinimized = document.body.classList.contains('sidebar-minimized') || false;
|
|
307
|
-
|
|
283
|
+
|
|
284
|
+
_this5.setState({
|
|
285
|
+
sidebarMinimized: isSidebarMinimized
|
|
286
|
+
});
|
|
308
287
|
|
|
309
288
|
LayoutHelper.sidebarPSToggle(!isSidebarMinimized);
|
|
310
289
|
});
|
|
@@ -314,18 +293,19 @@ var AppSidebarNav2 = function (_Component) {
|
|
|
314
293
|
attributeFilter: ['class']
|
|
315
294
|
});
|
|
316
295
|
}
|
|
296
|
+
|
|
317
297
|
window.addEventListener('resize', this.onResize);
|
|
318
298
|
};
|
|
319
299
|
|
|
320
|
-
|
|
300
|
+
_proto.onResize = function onResize() {
|
|
321
301
|
LayoutHelper.sidebarPSToggle(true);
|
|
322
302
|
};
|
|
323
303
|
|
|
324
|
-
|
|
304
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
325
305
|
this.observeDomMutations();
|
|
326
306
|
};
|
|
327
307
|
|
|
328
|
-
|
|
308
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
329
309
|
try {
|
|
330
310
|
this.changes.disconnect();
|
|
331
311
|
window.removeEventListener('resize', this.onResize);
|
|
@@ -335,36 +315,33 @@ var AppSidebarNav2 = function (_Component) {
|
|
|
335
315
|
}
|
|
336
316
|
};
|
|
337
317
|
|
|
338
|
-
|
|
318
|
+
_proto.render = function render() {
|
|
339
319
|
var _this6 = this;
|
|
340
320
|
|
|
341
|
-
var
|
|
342
|
-
className =
|
|
343
|
-
children =
|
|
344
|
-
navConfig =
|
|
345
|
-
attributes =
|
|
321
|
+
var _this$props = this.props,
|
|
322
|
+
className = _this$props.className,
|
|
323
|
+
children = _this$props.children,
|
|
324
|
+
navConfig = _this$props.navConfig,
|
|
325
|
+
attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "children", "navConfig"]);
|
|
346
326
|
|
|
347
327
|
delete attributes.isOpen;
|
|
348
328
|
delete attributes.staticContext;
|
|
349
329
|
delete attributes.Tag;
|
|
350
330
|
delete attributes.router;
|
|
351
|
-
|
|
352
331
|
var navClasses = classNames(className, 'sidebar-nav');
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
// sidebar-nav root
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
)
|
|
367
|
-
);
|
|
332
|
+
var options = Object.assign({}, {
|
|
333
|
+
suppressScrollX: true,
|
|
334
|
+
suppressScrollY: this.state.sidebarMinimized
|
|
335
|
+
}); // sidebar-nav root
|
|
336
|
+
|
|
337
|
+
return /*#__PURE__*/React.createElement(PerfectScrollbar, _extends({
|
|
338
|
+
className: navClasses
|
|
339
|
+
}, attributes, {
|
|
340
|
+
options: options,
|
|
341
|
+
ref: function ref(_ref) {
|
|
342
|
+
_this6._scrollBarRef = _ref;
|
|
343
|
+
}
|
|
344
|
+
}), /*#__PURE__*/React.createElement(Nav, null, children || this.navList(navConfig.items)));
|
|
368
345
|
};
|
|
369
346
|
|
|
370
347
|
return AppSidebarNav2;
|
|
@@ -372,5 +349,4 @@ var AppSidebarNav2 = function (_Component) {
|
|
|
372
349
|
|
|
373
350
|
AppSidebarNav2.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
374
351
|
AppSidebarNav2.defaultProps = defaultProps;
|
|
375
|
-
|
|
376
352
|
export default AppSidebarNav2;
|