Skip to content

Commit 556ff29

Browse files
committed
chore: temporary add es/
1 parent 71a28d5 commit 556ff29

20 files changed

+1433
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package-lock.json
1111
/coverage
1212

1313
# production
14-
/es
14+
#/es
1515
/lib
1616
/umd
1717

es/Aside.js

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
var _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; };
2+
3+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
4+
5+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6+
7+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8+
9+
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; }
10+
11+
import React, { Component } from 'react';
12+
import PropTypes from 'prop-types';
13+
import classNames from 'classnames';
14+
import { asideMenuCssClasses } from './Shared';
15+
16+
var propTypes = {
17+
children: PropTypes.node,
18+
className: PropTypes.string,
19+
display: PropTypes.string,
20+
fixed: PropTypes.bool,
21+
hidden: PropTypes.bool,
22+
isOpen: PropTypes.bool,
23+
offCanvas: PropTypes.bool,
24+
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
25+
};
26+
27+
var defaultProps = {
28+
tag: 'aside',
29+
display: '',
30+
fixed: false,
31+
hidden: false,
32+
isOpen: false,
33+
offCanvas: true
34+
};
35+
36+
var AppAside = function (_Component) {
37+
_inherits(AppAside, _Component);
38+
39+
function AppAside(props) {
40+
_classCallCheck(this, AppAside);
41+
42+
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
43+
44+
_this.isFixed = _this.isFixed.bind(_this);
45+
_this.isHidden = _this.isHidden.bind(_this);
46+
_this.isOffCanvas = _this.isOffCanvas.bind(_this);
47+
_this.displayBreakpoint = _this.displayBreakpoint.bind(_this);
48+
return _this;
49+
}
50+
51+
AppAside.prototype.componentDidMount = function componentDidMount() {
52+
this.isFixed(this.props.fixed);
53+
this.isHidden(this.props.hidden);
54+
this.isOffCanvas(this.props.offCanvas);
55+
this.displayBreakpoint(this.props.display);
56+
};
57+
58+
AppAside.prototype.isHidden = function isHidden(hidden) {
59+
if (hidden) {
60+
document.body.classList.add('aside-menu-hidden');
61+
}
62+
};
63+
64+
AppAside.prototype.isFixed = function isFixed(fixed) {
65+
if (fixed) {
66+
document.body.classList.add('aside-menu-fixed');
67+
}
68+
};
69+
70+
AppAside.prototype.isOffCanvas = function isOffCanvas(offCanvas) {
71+
if (offCanvas) {
72+
document.body.classList.add('aside-menu-off-canvas');
73+
}
74+
};
75+
76+
AppAside.prototype.displayBreakpoint = function displayBreakpoint(display) {
77+
var cssTemplate = 'aside-menu-' + display + '-show';
78+
var _asideMenuCssClasses$ = asideMenuCssClasses[0],
79+
cssClass = _asideMenuCssClasses$[0];
80+
81+
if (display && asideMenuCssClasses.indexOf(cssTemplate) > -1) {
82+
cssClass = cssTemplate;
83+
}
84+
document.body.classList.add(cssClass);
85+
};
86+
87+
AppAside.prototype.render = function render() {
88+
var _props = this.props,
89+
className = _props.className,
90+
children = _props.children,
91+
display = _props.display,
92+
fixed = _props.fixed,
93+
hidden = _props.hidden,
94+
offCanvas = _props.offCanvas,
95+
isOpen = _props.isOpen,
96+
Tag = _props.tag,
97+
attributes = _objectWithoutProperties(_props, ['className', 'children', 'display', 'fixed', 'hidden', 'offCanvas', 'isOpen', 'tag']);
98+
99+
var classes = classNames(className, 'aside-menu');
100+
101+
return React.createElement(
102+
Tag,
103+
_extends({}, attributes, { className: classes }),
104+
children
105+
);
106+
};
107+
108+
return AppAside;
109+
}(Component);
110+
111+
AppAside.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
112+
AppAside.defaultProps = defaultProps;
113+
114+
export default AppAside;

es/AsideToggler.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
var _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; };
2+
3+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
4+
5+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6+
7+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8+
9+
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; }
10+
11+
import React, { Component } from 'react';
12+
import PropTypes from 'prop-types';
13+
import classNames from 'classnames';
14+
import { asideMenuCssClasses } from './Shared/index';
15+
import { ToggleClasses } from './Shared/toggle-classes';
16+
17+
var propTypes = {
18+
children: PropTypes.node,
19+
className: PropTypes.string,
20+
display: PropTypes.any,
21+
mobile: PropTypes.bool,
22+
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
23+
type: PropTypes.string
24+
};
25+
26+
var defaultProps = {
27+
display: 'lg',
28+
mobile: false,
29+
tag: 'button',
30+
type: 'button'
31+
};
32+
33+
var AppAsideToggler = function (_Component) {
34+
_inherits(AppAsideToggler, _Component);
35+
36+
function AppAsideToggler(props) {
37+
_classCallCheck(this, AppAsideToggler);
38+
39+
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
40+
41+
_this.asideToggle = _this.asideToggle.bind(_this);
42+
43+
_this.state = {};
44+
return _this;
45+
}
46+
47+
AppAsideToggler.prototype.asideToggle = function asideToggle(e) {
48+
e.preventDefault();
49+
50+
if (this.props.mobile) {
51+
document.body.classList.toggle('aside-menu-show');
52+
} else {
53+
var display = this.props.display;
54+
var cssTemplate = 'aside-menu-' + display + '-show';
55+
var _asideMenuCssClasses$ = asideMenuCssClasses[0],
56+
cssClass = _asideMenuCssClasses$[0];
57+
58+
if (display && asideMenuCssClasses.indexOf(cssTemplate) > -1) {
59+
cssClass = cssTemplate;
60+
}
61+
ToggleClasses(cssClass, asideMenuCssClasses);
62+
}
63+
};
64+
65+
AppAsideToggler.prototype.render = function render() {
66+
var _props = this.props,
67+
className = _props.className,
68+
children = _props.children,
69+
mobile = _props.mobile,
70+
Tag = _props.tag,
71+
display = _props.display,
72+
attributes = _objectWithoutProperties(_props, ['className', 'children', 'mobile', 'tag', 'display']);
73+
74+
var classes = classNames(className, 'navbar-toggler');
75+
76+
return React.createElement(
77+
'button',
78+
_extends({
79+
type: 'button',
80+
className: classes
81+
}, attributes, {
82+
onClick: this.asideToggle
83+
}),
84+
children || React.createElement('span', { className: 'navbar-toggler-icon' })
85+
);
86+
};
87+
88+
return AppAsideToggler;
89+
}(Component);
90+
91+
AppAsideToggler.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
92+
AppAsideToggler.defaultProps = defaultProps;
93+
94+
export default AppAsideToggler;

es/Breadcrumb.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
var _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; };
2+
3+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
4+
5+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6+
7+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8+
9+
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; }
10+
11+
import React, { Component } from 'react';
12+
import { Route, Link } from 'react-router-dom';
13+
import { Breadcrumb, BreadcrumbItem } from 'reactstrap';
14+
import PropTypes from 'prop-types';
15+
import classNames from 'classnames';
16+
17+
var routes = void 0;
18+
19+
var getPaths = function getPaths(pathname) {
20+
var paths = ['/'];
21+
22+
if (pathname === '/') return paths;
23+
24+
pathname.split('/').reduce(function (prev, curr) {
25+
var currPath = prev + '/' + curr;
26+
paths.push(currPath);
27+
return currPath;
28+
});
29+
return paths;
30+
};
31+
32+
var findRouteName = function findRouteName(url) {
33+
var aroute = routes.find(function (route) {
34+
return route.path === url;
35+
});
36+
if (aroute && aroute.name) {
37+
return aroute.name;
38+
}
39+
return null;
40+
};
41+
42+
var BreadcrumbsItem = function BreadcrumbsItem(_ref) {
43+
var match = _ref.match;
44+
45+
var routeName = findRouteName(match.url);
46+
if (routeName) {
47+
return match.isExact ? React.createElement(
48+
BreadcrumbItem,
49+
{ active: true },
50+
routeName
51+
) : React.createElement(
52+
BreadcrumbItem,
53+
null,
54+
React.createElement(
55+
Link,
56+
{ to: match.url || '' },
57+
routeName
58+
)
59+
);
60+
}
61+
return null;
62+
};
63+
64+
BreadcrumbsItem.propTypes = process.env.NODE_ENV !== "production" ? {
65+
match: PropTypes.shape({
66+
url: PropTypes.string
67+
})
68+
} : {};
69+
70+
var Breadcrumbs = function Breadcrumbs(args) {
71+
var paths = getPaths(args.location.pathname);
72+
var items = paths.map(function (path, i) {
73+
return React.createElement(Route, { key: i.toString(), path: path, component: BreadcrumbsItem });
74+
});
75+
return React.createElement(
76+
Breadcrumb,
77+
null,
78+
items
79+
);
80+
};
81+
82+
var propTypes = {
83+
children: PropTypes.node,
84+
className: PropTypes.string,
85+
appRoutes: PropTypes.any,
86+
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
87+
};
88+
89+
var defaultProps = {
90+
tag: 'div',
91+
className: '',
92+
appRoutes: [{ path: '/', exact: true, name: 'Home', component: null }]
93+
};
94+
95+
var AppBreadcrumb = function (_Component) {
96+
_inherits(AppBreadcrumb, _Component);
97+
98+
function AppBreadcrumb(props) {
99+
_classCallCheck(this, AppBreadcrumb);
100+
101+
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
102+
103+
_this.state = { routes: props.appRoutes };
104+
routes = _this.state.routes;
105+
return _this;
106+
}
107+
108+
AppBreadcrumb.prototype.render = function render() {
109+
var _props = this.props,
110+
className = _props.className,
111+
children = _props.children,
112+
appRoutes = _props.appRoutes,
113+
Tag = _props.tag,
114+
attributes = _objectWithoutProperties(_props, ['className', 'children', 'appRoutes', 'tag']);
115+
116+
var classes = classNames(className);
117+
118+
return React.createElement(
119+
Tag,
120+
{ className: classes },
121+
React.createElement(Route, _extends({ path: '/:path', component: Breadcrumbs }, attributes))
122+
);
123+
};
124+
125+
return AppBreadcrumb;
126+
}(Component);
127+
128+
AppBreadcrumb.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
129+
AppBreadcrumb.defaultProps = defaultProps;
130+
131+
export default AppBreadcrumb;

0 commit comments

Comments
 (0)