blue-react 7.8.0-next.2 → 8.0.0-next.2
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/README.md +22 -3
- package/dist/components/ActionMenu.js +8 -10
- package/dist/components/ActionMenuSwitch.js +2 -2
- package/dist/components/Body.js +1 -1
- package/dist/components/Grid.js +12 -15
- package/dist/components/Header.js +2 -2
- package/dist/components/HeaderTitle.js +6 -6
- package/dist/components/Intro.js +1 -12
- package/dist/components/Layout.js +288 -0
- package/dist/components/MenuItem.js +14 -10
- package/dist/components/Modal.js +20 -13
- package/dist/components/ModalProvider.js +11 -2
- package/dist/components/Outside.js +0 -4
- package/dist/components/Page.js +2 -7
- package/dist/components/Search.js +7 -7
- package/dist/components/SidebarMenu.js +7 -14
- package/dist/components/Status.js +67 -0
- package/dist/components/{DropdownMenuItem.js → StatusProvider.js} +54 -53
- package/dist/components/Utilities.js +11 -29
- package/dist/style.css +218 -432
- package/dist/style.min.css +4 -4
- package/dist/style.scss +1 -2
- package/dist/styles/_action-menu.scss +9 -9
- package/dist/styles/_general.scss +5 -5
- package/dist/styles/_grid.scss +56 -62
- package/dist/styles/_keyframes.scss +1 -1
- package/dist/styles/_mixins.scss +0 -1
- package/dist/styles/_search.scss +10 -10
- package/dist/styles/_status.scss +14 -14
- package/dist/styles/mixins/_action-menu.scss +7 -7
- package/dist/styles/mixins/_sidebar.scss +22 -22
- package/dist/types/components/Grid.d.ts +12 -12
- package/dist/types/components/Layout.d.ts +110 -0
- package/dist/types/components/MenuItem.d.ts +4 -0
- package/dist/types/components/Modal.d.ts +1 -1
- package/dist/types/components/ModalProvider.d.ts +5 -2
- package/dist/types/components/SidebarMenu.d.ts +1 -5
- package/dist/types/components/Status.d.ts +12 -0
- package/dist/types/components/StatusProvider.d.ts +15 -0
- package/dist/types/components/Utilities.d.ts +0 -12
- package/dist/types/components/shared.d.ts +8 -0
- package/index.d.ts +6 -18
- package/index.js +4 -10
- package/package.json +88 -88
- package/dist/components/ActionMenuItem.js +0 -42
- package/dist/components/Actions.js +0 -107
- package/dist/components/BlueModal.js +0 -147
- package/dist/components/BlueModalProvider.js +0 -133
- package/dist/components/FluentBtn.js +0 -31
- package/dist/components/HeaderActions.js +0 -17
- package/dist/styles/_actions.scss +0 -137
- package/dist/styles/_ripple.scss +0 -30
- package/dist/styles/mixins/_actions.scss +0 -55
- package/dist/types/components/ActionMenuItem.d.ts +0 -41
- package/dist/types/components/Actions.d.ts +0 -31
- package/dist/types/components/BlueModal.d.ts +0 -14
- package/dist/types/components/BlueModalProvider.d.ts +0 -8
- package/dist/types/components/DropdownMenuItem.d.ts +0 -13
- package/dist/types/components/FluentBtn.d.ts +0 -26
- package/dist/types/components/HeaderActions.d.ts +0 -15
package/README.md
CHANGED
|
@@ -6,11 +6,29 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/blue-react)
|
|
8
8
|
|
|
9
|
-
[Checkout the docs](https://bruegmann.github.io/blue-react) to find out how to
|
|
9
|
+
[Checkout the docs](https://bruegmann.github.io/blue-react) to find out how to
|
|
10
|
+
use Blue React.
|
|
11
|
+
|
|
12
|
+
## Breaking changes between v7 and v8
|
|
13
|
+
|
|
14
|
+
- Removed deprecated components:
|
|
15
|
+
- Actions (Alternative: ActionMenu)
|
|
16
|
+
- ActionMenuItem (Alternative: MenuItem)
|
|
17
|
+
- FluentBtn (Alternative: button, bzw. a)
|
|
18
|
+
- HeaderActions
|
|
19
|
+
- DropdownMenuItem (Alternative: MenuItem)
|
|
20
|
+
- Stylesheets
|
|
21
|
+
- Renamed all `.blue-app-*` to `.blue-*`
|
|
22
|
+
- Renamed `Grid` to `Layout`
|
|
23
|
+
- `.blue-grid` ➡ `.blue-layout`
|
|
24
|
+
- `Grid.tsx` ➡ `Layout.tsx`
|
|
25
|
+
- Global `window.blueGridRef` ➡ `window.blueLayoutRef`
|
|
26
|
+
- Renamed all `.blue-sidebar-*` to `.blue-menu-item-*`
|
|
10
27
|
|
|
11
28
|
## Developing
|
|
12
29
|
|
|
13
|
-
This project is built with [CRA](https://create-react-app.dev/). To start
|
|
30
|
+
This project is built with [CRA](https://create-react-app.dev/). To start
|
|
31
|
+
developing, just and install everything with `npm i` and run:
|
|
14
32
|
|
|
15
33
|
```
|
|
16
34
|
npm start
|
|
@@ -25,7 +43,8 @@ By running
|
|
|
25
43
|
npm publish
|
|
26
44
|
```
|
|
27
45
|
|
|
28
|
-
the missing files in `./dist` will be created, the docs will be generated and
|
|
46
|
+
the missing files in `./dist` will be created, the docs will be generated and
|
|
47
|
+
the NPM package will be released.
|
|
29
48
|
|
|
30
49
|
To publish changes on the documentary, run:
|
|
31
50
|
|
|
@@ -55,18 +55,18 @@ function ActionMenu(props) {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
var initToggleStatus = function initToggleStatus() {
|
|
58
|
-
setActionsToggledIn(_Utilities.default.hasClass(document.querySelector(".blue-
|
|
58
|
+
setActionsToggledIn(_Utilities.default.hasClass(document.querySelector(".blue-actions"), "open"));
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
(0, _react.useEffect)(function () {
|
|
62
62
|
initToggleStatus();
|
|
63
|
-
var appWrapper = document.querySelector(".blue-
|
|
63
|
+
var appWrapper = document.querySelector(".blue-wrapper");
|
|
64
64
|
|
|
65
65
|
if (appWrapper) {
|
|
66
66
|
appWrapper.onclick = toggleActions;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
document.querySelectorAll(".blue-
|
|
69
|
+
document.querySelectorAll(".blue-actions-menu .nav-link").forEach(function (link) {
|
|
70
70
|
link.addEventListener("click", function () {
|
|
71
71
|
if (actionsToggledIn) {
|
|
72
72
|
toggleActions();
|
|
@@ -75,16 +75,14 @@ function ActionMenu(props) {
|
|
|
75
75
|
});
|
|
76
76
|
}, []);
|
|
77
77
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
-
className: "blue-
|
|
78
|
+
className: "blue-actions navbar ".concat(className, " navbar-expand").concat(_break !== "none" ? "-".concat(_break) : "", " ").concat(_break)
|
|
79
79
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
className: "
|
|
80
|
+
className: "blue-header-wrapper",
|
|
81
81
|
onClick: _Utilities.default.scrollToTop
|
|
82
82
|
}), /*#__PURE__*/_react.default.createElement("ul", {
|
|
83
|
-
className: "blue-
|
|
84
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
85
|
-
className: "
|
|
86
|
-
}), !actionsToggledIn && !hideToggleAction ? /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
87
|
-
className: "blue-app-actions-menu-toggle",
|
|
83
|
+
className: "blue-actions-menu nav navbar-nav navbar-right"
|
|
84
|
+
}, !actionsToggledIn && !hideToggleAction ? /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
85
|
+
className: "blue-actions-menu-toggle",
|
|
88
86
|
onClick: function onClick() {
|
|
89
87
|
return toggleActions();
|
|
90
88
|
},
|
|
@@ -21,13 +21,13 @@ function ActionMenuSwitch(props) {
|
|
|
21
21
|
className: "nav-item"
|
|
22
22
|
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
23
23
|
href: "javascript:void(0)",
|
|
24
|
-
className: "nav-link blue-
|
|
24
|
+
className: "nav-link blue-actions-menu-item",
|
|
25
25
|
onClick: function onClick() {
|
|
26
26
|
if (props.onChange) props.onChange();
|
|
27
27
|
}
|
|
28
28
|
}, /*#__PURE__*/_react.default.createElement(_Switch.default, _extends({}, props, {
|
|
29
29
|
elementType: "span"
|
|
30
30
|
})), props.label && /*#__PURE__*/_react.default.createElement("span", {
|
|
31
|
-
className: "blue-
|
|
31
|
+
className: "blue-actions-label"
|
|
32
32
|
}, "\xA0", props.label)));
|
|
33
33
|
}
|
package/dist/components/Body.js
CHANGED
|
@@ -27,7 +27,7 @@ function Body(_ref) {
|
|
|
27
27
|
children = _ref.children,
|
|
28
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
29
|
|
|
30
|
-
var pageBodyClassName = "blue-
|
|
30
|
+
var pageBodyClassName = "blue-page";
|
|
31
31
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
32
|
id: id,
|
|
33
33
|
className: className ? pageBodyClassName + " " + className : pageBodyClassName + (hasActions ? " has-actions" : "") + " break-".concat(rest.break || "md"),
|
package/dist/components/Grid.js
CHANGED
|
@@ -102,9 +102,6 @@ var Grid = /*#__PURE__*/function (_Component) {
|
|
|
102
102
|
me.toggleSidebar(event);
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
|
|
106
|
-
_Utilities.default.registerFluentBtns();
|
|
107
|
-
|
|
108
105
|
window.addEventListener("hashchange", this.onHashChange);
|
|
109
106
|
}
|
|
110
107
|
}, {
|
|
@@ -161,7 +158,7 @@ var Grid = /*#__PURE__*/function (_Component) {
|
|
|
161
158
|
}, {
|
|
162
159
|
key: "hideSidebar",
|
|
163
160
|
value: function hideSidebar(e) {
|
|
164
|
-
if (!(_Utilities.default.hasClass(e.target, "blue-
|
|
161
|
+
if (!(_Utilities.default.hasClass(e.target, "blue-open-menu") || _Utilities.default.hasClass(e.target, "bi-menu") || _Utilities.default.hasClass(e.target, "blue-search") || _Utilities.default.hasClass(e.target, "blue-search-control") || _Utilities.default.hasClass(e.target, "blue-search-btn") || _Utilities.default.hasClass(e.target, "blue-search-btn-icon") || _Utilities.default.hasClass(e.target, "blue-sidebar-dropdown-toggle") || _Utilities.default.hasClass(e.target, "blue-sidebar-dropdown-caret") || _Utilities.default.hasClass(e.target, "blue-sidebar-dropdown-icon") || _Utilities.default.hasClass(e.target, "blue-sidebar-exception"))) {
|
|
165
162
|
this.setState({
|
|
166
163
|
sidebarIn: false
|
|
167
164
|
});
|
|
@@ -211,43 +208,43 @@ var Grid = /*#__PURE__*/function (_Component) {
|
|
|
211
208
|
_this$props$pages;
|
|
212
209
|
|
|
213
210
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
214
|
-
className: "blue-
|
|
211
|
+
className: "blue-wrapper"
|
|
215
212
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
216
213
|
id: this.props.id ? this.props.id : "",
|
|
217
214
|
style: this.props.style ? this.props.style : {},
|
|
218
|
-
className: "blue-
|
|
215
|
+
className: "blue-layout" + (this.props.className ? " " + this.props.className : "") + (this.state.sidebarIn ? " open" : "") + (this.props.hideSidebarMenu ? " hasNoSidebarMenu" : " hasSidebarMenu") + (this.props.expandSidebar ? " expandSidebar" : "") + (this.props.disableHeaders ? " disableHeaders" : ""),
|
|
219
216
|
onClick: this.hideSidebar
|
|
220
217
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
221
|
-
className: "blue-
|
|
218
|
+
className: "blue-sidebar-toggler"
|
|
222
219
|
}, !this.props.hideSidebarMenu ? /*#__PURE__*/_react.default.createElement("button", {
|
|
223
220
|
type: "button",
|
|
224
|
-
className: "blue-
|
|
221
|
+
className: "blue-open-menu blue-sidebar-btn btn",
|
|
225
222
|
onClick: function onClick() {
|
|
226
223
|
_this4.setState({
|
|
227
224
|
sidebarIn: !_this4.state.sidebarIn
|
|
228
225
|
});
|
|
229
226
|
}
|
|
230
227
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
231
|
-
className: "blue-
|
|
228
|
+
className: "blue-sidebar-exception position-absolute w-100 h-100"
|
|
232
229
|
}), this.props.sidebarToggleIconComponent) : ""), this.props.children, (_this$props$pages = this.props.pages) === null || _this$props$pages === void 0 ? void 0 : _this$props$pages.map(function (page) {
|
|
233
230
|
return _this4.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
234
231
|
key: page.name,
|
|
235
232
|
className: "router-page " + (_this4.state.match[0] === page.name ? "active" : "")
|
|
236
233
|
}, page.component);
|
|
237
234
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
238
|
-
className: "blue-
|
|
235
|
+
className: "blue-status-circle blue-loading blue-status-loading"
|
|
239
236
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
240
237
|
className: "spinner-bounce-circle"
|
|
241
238
|
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
242
|
-
className: "blue-
|
|
239
|
+
className: "blue-status-circle blue-status-success"
|
|
243
240
|
}, this.props.statusIcons.success), /*#__PURE__*/_react.default.createElement("div", {
|
|
244
|
-
className: "blue-
|
|
241
|
+
className: "blue-status-circle blue-status-info"
|
|
245
242
|
}, this.props.statusIcons.info), /*#__PURE__*/_react.default.createElement("div", {
|
|
246
|
-
className: "blue-
|
|
243
|
+
className: "blue-status-circle blue-status-warning"
|
|
247
244
|
}, this.props.statusIcons.warning), /*#__PURE__*/_react.default.createElement("div", {
|
|
248
|
-
className: "blue-
|
|
245
|
+
className: "blue-status-circle blue-status-danger"
|
|
249
246
|
}, this.props.statusIcons.danger), /*#__PURE__*/_react.default.createElement("div", {
|
|
250
|
-
className: "blue-
|
|
247
|
+
className: "blue-status-alert alert"
|
|
251
248
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
252
249
|
type: "button",
|
|
253
250
|
className: "btn-close float-end mb-1",
|
|
@@ -17,9 +17,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
function Header(_ref) {
|
|
18
18
|
var children = _ref.children;
|
|
19
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
-
className: "blue-
|
|
20
|
+
className: "blue-header blue-header-extension"
|
|
21
21
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
-
className: "
|
|
22
|
+
className: "blue-header-wrapper",
|
|
23
23
|
onClick: _Utilities.default.scrollToTop
|
|
24
24
|
}), children);
|
|
25
25
|
}
|
|
@@ -32,8 +32,8 @@ function HeaderTitle(_ref) {
|
|
|
32
32
|
var uniqueId = "HeaderTitle-" + _Utilities.default.guid();
|
|
33
33
|
|
|
34
34
|
var setDocumentTitle = function setDocumentTitle() {
|
|
35
|
-
if (window.
|
|
36
|
-
var element = document.querySelector("#".concat(uniqueId, " .blue-
|
|
35
|
+
if (window.blueLayoutRef && window.blueLayoutRef.props && window.blueLayoutRef.props.disableTitleSet === false) {
|
|
36
|
+
var element = document.querySelector("#".concat(uniqueId, " .blue-header-logo-title-labels"));
|
|
37
37
|
var titleElement = document.querySelector("title");
|
|
38
38
|
|
|
39
39
|
if (element && element.innerText && titleElement) {
|
|
@@ -52,16 +52,16 @@ function HeaderTitle(_ref) {
|
|
|
52
52
|
(0, _react.useEffect)(setDocumentTitle, [children]);
|
|
53
53
|
return /*#__PURE__*/_react.default.createElement("h3", {
|
|
54
54
|
id: uniqueId,
|
|
55
|
-
className: "blue-
|
|
55
|
+
className: "blue-header-logo" + (className ? " ".concat(className) : "") + (sidebar ? " sidebar" : "")
|
|
56
56
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
57
|
-
className: "blue-
|
|
57
|
+
className: "blue-header-logo-title"
|
|
58
58
|
}, logo ? /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("a", {
|
|
59
59
|
href: "#"
|
|
60
60
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
61
61
|
src: logo,
|
|
62
|
-
className: "blue-
|
|
62
|
+
className: "blue-header-logo-image"
|
|
63
63
|
})), "\xA0") : "", /*#__PURE__*/_react.default.createElement("span", {
|
|
64
|
-
className: "blue-
|
|
64
|
+
className: "blue-header-logo-title-labels " + (keepAppTitle ? "keep" : "")
|
|
65
65
|
}, appTitle ? /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("a", {
|
|
66
66
|
href: "#"
|
|
67
67
|
}, appTitle), " ", children ? "/" : "", "\xA0") : "", children)));
|
package/dist/components/Intro.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = Intro;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
12
|
-
var _Utilities = _interopRequireDefault(require("./Utilities"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
9
|
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
11
|
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
12
|
/**
|
|
21
13
|
* Can be used for a sign-in page.
|
|
22
14
|
*/
|
|
@@ -26,9 +18,6 @@ function Intro(_ref) {
|
|
|
26
18
|
logoMaxWidth = _ref$logoMaxWidth === void 0 ? "100px" : _ref$logoMaxWidth,
|
|
27
19
|
title = _ref.title,
|
|
28
20
|
children = _ref.children;
|
|
29
|
-
(0, _react.useEffect)(function () {
|
|
30
|
-
_Utilities.default.registerFluentBtns();
|
|
31
|
-
}, []);
|
|
32
21
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
22
|
className: "sign-in-screen"
|
|
34
23
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _Utilities = _interopRequireDefault(require("./Utilities"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
25
|
+
|
|
26
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
+
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
+
|
|
32
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
33
|
+
|
|
34
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
+
|
|
36
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
+
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
|
|
40
|
+
window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
|
|
44
|
+
* Also you can append your own event listeners with `blueLayoutRef.addEventListener(eventName, (prevProps, prevState) => { })`.
|
|
45
|
+
*
|
|
46
|
+
* Allowed event listeners:
|
|
47
|
+
*
|
|
48
|
+
* * **componentDidUpdate** - Component was updated.
|
|
49
|
+
* Example: `blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
50
|
+
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
51
|
+
* Example: `blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
52
|
+
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
53
|
+
* Example: `blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
54
|
+
*/
|
|
55
|
+
var Layout = /*#__PURE__*/function (_Component) {
|
|
56
|
+
_inherits(Layout, _Component);
|
|
57
|
+
|
|
58
|
+
var _super = _createSuper(Layout);
|
|
59
|
+
|
|
60
|
+
function Layout(props) {
|
|
61
|
+
var _this;
|
|
62
|
+
|
|
63
|
+
_classCallCheck(this, Layout);
|
|
64
|
+
|
|
65
|
+
_this = _super.call(this, props);
|
|
66
|
+
window.blueLayoutRef = _assertThisInitialized(_this);
|
|
67
|
+
_this.defaultMatch = ["home"];
|
|
68
|
+
_this.state = {
|
|
69
|
+
sidebarIn: props.sidebarIn,
|
|
70
|
+
match: null,
|
|
71
|
+
history: [],
|
|
72
|
+
hash: window.location.hash,
|
|
73
|
+
hashHistory: [],
|
|
74
|
+
blockRouting: props.blockRouting || undefined
|
|
75
|
+
};
|
|
76
|
+
_this.hideSidebar = _this.hideSidebar.bind(_assertThisInitialized(_this));
|
|
77
|
+
_this.eventListeners = [];
|
|
78
|
+
return _this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_createClass(Layout, [{
|
|
82
|
+
key: "onHashChange",
|
|
83
|
+
value: function onHashChange() {
|
|
84
|
+
window.blueLayoutRef.initMatch();
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "componentDidMount",
|
|
88
|
+
value: function componentDidMount() {
|
|
89
|
+
var _this2 = this;
|
|
90
|
+
|
|
91
|
+
var me = this;
|
|
92
|
+
document.addEventListener("toggleSidebar", function () {
|
|
93
|
+
_this2.toggleSidebar(undefined);
|
|
94
|
+
}, false);
|
|
95
|
+
this.initMatch();
|
|
96
|
+
document.addEventListener("touchstart", function (event) {
|
|
97
|
+
var xPos = event.touches[0].pageX;
|
|
98
|
+
|
|
99
|
+
if (xPos < 5) {
|
|
100
|
+
me.toggleSidebar(event);
|
|
101
|
+
} else if (me.state.sidebarIn && xPos > 20) {
|
|
102
|
+
me.toggleSidebar(event);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
window.addEventListener("hashchange", this.onHashChange);
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "componentWillUnmount",
|
|
109
|
+
value: function componentWillUnmount() {
|
|
110
|
+
window.removeEventListener("hashchange", this.onHashChange);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "componentDidUpdate",
|
|
114
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
115
|
+
var _this3 = this;
|
|
116
|
+
|
|
117
|
+
if (prevProps.blockRouting !== this.props.blockRouting && this.props.blockRouting !== this.state.blockRouting) {
|
|
118
|
+
this.setState({
|
|
119
|
+
blockRouting: this.props.blockRouting
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.eventListeners.forEach(function (eventListener) {
|
|
124
|
+
if (eventListener[0] === "componentDidUpdate") {
|
|
125
|
+
eventListener[1](prevProps, prevState);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (eventListener[0] === "pageDidShowAgain") {
|
|
129
|
+
var pageId = eventListener[1];
|
|
130
|
+
var callback = eventListener[2];
|
|
131
|
+
|
|
132
|
+
if (prevState.hash !== _this3.state.hash && _this3.state.match[0] === pageId) {
|
|
133
|
+
callback(prevProps, prevState);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (eventListener[0] === "pageDidHide") {
|
|
138
|
+
var _pageId = eventListener[1];
|
|
139
|
+
var _callback = eventListener[2];
|
|
140
|
+
|
|
141
|
+
if (prevState.hash !== _this3.state.hash && prevState.match[0] === _pageId) {
|
|
142
|
+
_callback(prevProps, prevState);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "toggleSidebar",
|
|
149
|
+
value: function toggleSidebar(event) {
|
|
150
|
+
if (this.state.sidebarIn) {
|
|
151
|
+
this.hideSidebar(event);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
this.setState({
|
|
155
|
+
sidebarIn: true
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "hideSidebar",
|
|
160
|
+
value: function hideSidebar(e) {
|
|
161
|
+
if (!(_Utilities.default.hasClass(e.target, "blue-open-menu") || _Utilities.default.hasClass(e.target, "bi-menu") || _Utilities.default.hasClass(e.target, "blue-search") || _Utilities.default.hasClass(e.target, "blue-search-control") || _Utilities.default.hasClass(e.target, "blue-search-btn") || _Utilities.default.hasClass(e.target, "blue-search-btn-icon") || _Utilities.default.hasClass(e.target, "blue-menu-item-dropdown-toggle") || _Utilities.default.hasClass(e.target, "blue-menu-item-dropdown-caret") || _Utilities.default.hasClass(e.target, "blue-menu-item-dropdown-icon") || _Utilities.default.hasClass(e.target, "blue-sidebar-exception"))) {
|
|
162
|
+
this.setState({
|
|
163
|
+
sidebarIn: false
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
key: "initMatch",
|
|
169
|
+
value: function initMatch() {
|
|
170
|
+
var newMatch;
|
|
171
|
+
|
|
172
|
+
if (window.location.hash && window.location.hash !== "" && window.location.hash !== "#/") {
|
|
173
|
+
newMatch = window.location.hash.replace("#", "").split("/").filter(function (n) {
|
|
174
|
+
return n !== "";
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
newMatch = this.defaultMatch;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (this.props.unrouteable) {
|
|
181
|
+
newMatch = this.defaultMatch;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (this.state.blockRouting && this.state.blockRouting(newMatch, this.state.match) === true) {
|
|
185
|
+
window.location.hash = this.state.hash;
|
|
186
|
+
} else {
|
|
187
|
+
if (!(this.state.history.indexOf(newMatch[0]) > -1)) {
|
|
188
|
+
this.state.history.push(newMatch[0]);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.setState({
|
|
192
|
+
match: newMatch,
|
|
193
|
+
history: this.state.history,
|
|
194
|
+
hash: window.location.hash,
|
|
195
|
+
hashHistory: this.state.hashHistory.concat([window.location.hash])
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "addEventListener",
|
|
201
|
+
value: function addEventListener(param1, param2, param3) {
|
|
202
|
+
this.eventListeners.push([param1, param2, param3]);
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
key: "render",
|
|
206
|
+
value: function render() {
|
|
207
|
+
var _this4 = this,
|
|
208
|
+
_this$props$pages;
|
|
209
|
+
|
|
210
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
211
|
+
className: "blue-wrapper"
|
|
212
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
213
|
+
id: this.props.id ? this.props.id : "",
|
|
214
|
+
style: this.props.style ? this.props.style : {},
|
|
215
|
+
className: "blue-layout" + (this.props.className ? " " + this.props.className : "") + (this.state.sidebarIn ? " open" : "") + (this.props.hideSidebarMenu ? " hasNoSidebarMenu" : " hasSidebarMenu") + (this.props.expandSidebar ? " expandSidebar" : "") + (this.props.disableHeaders ? " disableHeaders" : ""),
|
|
216
|
+
onClick: this.hideSidebar
|
|
217
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
218
|
+
className: "blue-sidebar-toggler"
|
|
219
|
+
}, !this.props.hideSidebarMenu ? /*#__PURE__*/_react.default.createElement("button", {
|
|
220
|
+
type: "button",
|
|
221
|
+
className: "blue-open-menu blue-menu-item btn",
|
|
222
|
+
onClick: function onClick() {
|
|
223
|
+
_this4.setState({
|
|
224
|
+
sidebarIn: !_this4.state.sidebarIn
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
228
|
+
className: "blue-sidebar-exception position-absolute w-100 h-100"
|
|
229
|
+
}), this.props.sidebarToggleIconComponent) : ""), this.props.children, (_this$props$pages = this.props.pages) === null || _this$props$pages === void 0 ? void 0 : _this$props$pages.map(function (page) {
|
|
230
|
+
return _this4.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
231
|
+
key: page.name,
|
|
232
|
+
className: "router-page " + (_this4.state.match[0] === page.name ? "active" : "")
|
|
233
|
+
}, page.component);
|
|
234
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
235
|
+
className: "blue-status-circle blue-loading blue-status-loading"
|
|
236
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
237
|
+
className: "spinner-bounce-circle"
|
|
238
|
+
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
239
|
+
className: "blue-status-circle blue-status-success"
|
|
240
|
+
}, this.props.statusIcons.success), /*#__PURE__*/_react.default.createElement("div", {
|
|
241
|
+
className: "blue-status-circle blue-status-info"
|
|
242
|
+
}, this.props.statusIcons.info), /*#__PURE__*/_react.default.createElement("div", {
|
|
243
|
+
className: "blue-status-circle blue-status-warning"
|
|
244
|
+
}, this.props.statusIcons.warning), /*#__PURE__*/_react.default.createElement("div", {
|
|
245
|
+
className: "blue-status-circle blue-status-danger"
|
|
246
|
+
}, this.props.statusIcons.danger), /*#__PURE__*/_react.default.createElement("div", {
|
|
247
|
+
className: "blue-status-alert alert"
|
|
248
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
className: "btn-close float-end mb-1",
|
|
251
|
+
"aria-label": "Close"
|
|
252
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
253
|
+
className: "alert-body"
|
|
254
|
+
}))));
|
|
255
|
+
}
|
|
256
|
+
}], [{
|
|
257
|
+
key: "defaultProps",
|
|
258
|
+
get: function get() {
|
|
259
|
+
return {
|
|
260
|
+
expandSidebar: false,
|
|
261
|
+
hideSidebarMenu: false,
|
|
262
|
+
unrouteable: false,
|
|
263
|
+
disableTitleSet: false,
|
|
264
|
+
sidebarToggleIconComponent: /*#__PURE__*/_react.default.createElement("span", {
|
|
265
|
+
className: "bi-menu"
|
|
266
|
+
}),
|
|
267
|
+
statusIcons: {
|
|
268
|
+
danger: /*#__PURE__*/_react.default.createElement("span", {
|
|
269
|
+
className: "bi-error"
|
|
270
|
+
}),
|
|
271
|
+
info: /*#__PURE__*/_react.default.createElement("span", {
|
|
272
|
+
className: "bi-information"
|
|
273
|
+
}),
|
|
274
|
+
success: /*#__PURE__*/_react.default.createElement("span", {
|
|
275
|
+
className: "bi-check"
|
|
276
|
+
}),
|
|
277
|
+
warning: /*#__PURE__*/_react.default.createElement("span", {
|
|
278
|
+
className: "bi-sign_warning"
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}]);
|
|
284
|
+
|
|
285
|
+
return Layout;
|
|
286
|
+
}(_react.Component);
|
|
287
|
+
|
|
288
|
+
exports.default = Layout;
|
|
@@ -76,13 +76,17 @@ function MenuItem(props) {
|
|
|
76
76
|
if (props.href && props.href === window.location.hash) {
|
|
77
77
|
_Utilities.default.scrollToTop();
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
if (props.onClickAttached !== undefined) {
|
|
81
|
+
props.onClickAttached(event);
|
|
82
|
+
}
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
var onClickOutside = function onClickOutside(_ref) {
|
|
82
86
|
var target = _ref.target;
|
|
83
87
|
|
|
84
88
|
// Don't trigger when clicking on MenuItem
|
|
85
|
-
if (!_Utilities.default.hasClass(target, "blue-
|
|
89
|
+
if (!_Utilities.default.hasClass(target, "blue-menu-item-dropdown-toggle") && !_Utilities.default.hasClass(target, "blue-menu-item-label")) {
|
|
86
90
|
setShowDropdown(false);
|
|
87
91
|
}
|
|
88
92
|
};
|
|
@@ -96,13 +100,13 @@ function MenuItem(props) {
|
|
|
96
100
|
(0, _react.useEffect)(function () {
|
|
97
101
|
if (props.showDropdown !== undefined) setShowDropdown(props.showDropdown);
|
|
98
102
|
}, [props.showDropdown]);
|
|
99
|
-
var className = "blue-
|
|
103
|
+
var className = "blue-menu-item btn" + (props.isActive ? " active" : "") + (props.className ? " " + props.className : "") + (props.children ? " blue-menu-item-dropdown-toggle" : "");
|
|
100
104
|
var icon, iconForActive;
|
|
101
105
|
|
|
102
106
|
if (typeof props.icon === "string") {
|
|
103
107
|
// is className
|
|
104
108
|
icon = /*#__PURE__*/_react.default.createElement("span", {
|
|
105
|
-
className: props.icon + (props.children ? " blue-
|
|
109
|
+
className: props.icon + (props.children ? " blue-menu-item-dropdown-icon" : "")
|
|
106
110
|
});
|
|
107
111
|
} else {
|
|
108
112
|
// is element / component
|
|
@@ -112,7 +116,7 @@ function MenuItem(props) {
|
|
|
112
116
|
if (typeof props.iconForActive === "string") {
|
|
113
117
|
// is className
|
|
114
118
|
iconForActive = /*#__PURE__*/_react.default.createElement("span", {
|
|
115
|
-
className: props.iconForActive + (props.children ? " blue-
|
|
119
|
+
className: props.iconForActive + (props.children ? " blue-menu-item-dropdown-icon" : "")
|
|
116
120
|
});
|
|
117
121
|
} else {
|
|
118
122
|
// is element / component
|
|
@@ -132,21 +136,21 @@ function MenuItem(props) {
|
|
|
132
136
|
className: className + (props.isActive || active ? " active" : "") + (props.label ? " has-label" : ""),
|
|
133
137
|
onClick: onClick
|
|
134
138
|
}), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
135
|
-
className: (0, _clsx.default)("blue-
|
|
139
|
+
className: (0, _clsx.default)("blue-menu-item-icon", {
|
|
136
140
|
hasIconForActive: iconForActive
|
|
137
141
|
})
|
|
138
142
|
}, icon), iconForActive && /*#__PURE__*/_react.default.createElement("span", {
|
|
139
|
-
className: "blue-
|
|
143
|
+
className: "blue-menu-item-icon iconForActive"
|
|
140
144
|
}, iconForActive), props.label && /*#__PURE__*/_react.default.createElement("span", {
|
|
141
|
-
className: "blue-
|
|
145
|
+
className: "blue-menu-item-label text-truncate"
|
|
142
146
|
}, props.label), props.children && /*#__PURE__*/_react.default.createElement(_Caret.default, {
|
|
143
147
|
open: showDropdown,
|
|
144
148
|
mirrored: true,
|
|
145
|
-
className: "blue-
|
|
149
|
+
className: "blue-menu-item-dropdown-caret mt-2"
|
|
146
150
|
}))), showDropdown && (props.supportOutside ? /*#__PURE__*/_react.default.createElement(_Outside.default, {
|
|
147
|
-
className: "blue-
|
|
151
|
+
className: "blue-menu-item-dropdown ".concat(props.dropdownClassName),
|
|
148
152
|
onClickOutside: onClickOutside
|
|
149
153
|
}, props.children) : /*#__PURE__*/_react.default.createElement("div", {
|
|
150
|
-
className: "blue-
|
|
154
|
+
className: "blue-menu-item-dropdown ".concat(props.dropdownClassName)
|
|
151
155
|
}, props.children)));
|
|
152
156
|
}
|