blue-react 9.12.1 → 10.0.0-rc2
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 +37 -4
- package/dist/components/A.js +8 -23
- package/dist/components/ActionMenu.js +33 -65
- package/dist/components/ActionMenuItem.js +12 -36
- package/dist/components/Body.js +13 -27
- package/dist/components/Caret.js +6 -9
- package/dist/components/Chevron.js +14 -24
- package/dist/components/HashRouter.js +176 -0
- package/dist/components/Header.js +3 -13
- package/dist/components/HeaderTitle.js +24 -43
- package/dist/components/IconMenuItem.js +17 -33
- package/dist/components/Intro.js +12 -22
- package/dist/components/Layout.js +72 -360
- package/dist/components/MenuItem.js +41 -83
- package/dist/components/Modal.js +53 -86
- package/dist/components/ModalProvider.js +70 -125
- package/dist/components/Outside.js +13 -29
- package/dist/components/Page.js +18 -44
- package/dist/components/Search.js +47 -85
- package/dist/components/SidebarMenu.js +8 -68
- package/dist/components/SidebarMenuItem.js +34 -65
- package/dist/components/SidebarToggler.js +12 -22
- package/dist/components/SlimContainer.js +6 -16
- package/dist/components/Status.js +33 -44
- package/dist/components/StatusProvider.js +28 -65
- package/dist/components/Switch.js +17 -23
- package/dist/components/ToastProvider.js +43 -83
- package/dist/components/Utilities.js +23 -45
- package/dist/components/shared.js +1 -11
- package/dist/style.scss +1 -1
- package/dist/types/components/A.d.ts +9 -9
- package/dist/types/components/ActionMenu.d.ts +25 -25
- package/dist/types/components/ActionMenuItem.d.ts +34 -35
- package/dist/types/components/Body.d.ts +20 -21
- package/dist/types/components/Caret.d.ts +18 -18
- package/dist/types/components/Chevron.d.ts +17 -17
- package/dist/types/components/HashRouter.d.ts +76 -0
- package/dist/types/components/Header.d.ts +8 -8
- package/dist/types/components/HeaderTitle.d.ts +39 -40
- package/dist/types/components/IconMenuItem.d.ts +18 -19
- package/dist/types/components/Intro.d.ts +22 -23
- package/dist/types/components/Layout.d.ts +9 -144
- package/dist/types/components/MenuItem.d.ts +149 -149
- package/dist/types/components/Modal.d.ts +30 -30
- package/dist/types/components/ModalProvider.d.ts +21 -21
- package/dist/types/components/Outside.d.ts +17 -17
- package/dist/types/components/Page.d.ts +11 -12
- package/dist/types/components/Search.d.ts +36 -36
- package/dist/types/components/SidebarMenu.d.ts +31 -32
- package/dist/types/components/SidebarMenuItem.d.ts +21 -22
- package/dist/types/components/SidebarToggler.d.ts +10 -10
- package/dist/types/components/SlimContainer.d.ts +10 -10
- package/dist/types/components/Status.d.ts +12 -12
- package/dist/types/components/StatusProvider.d.ts +15 -15
- package/dist/types/components/Switch.d.ts +33 -33
- package/dist/types/components/ToastProvider.d.ts +22 -22
- package/dist/types/components/Utilities.d.ts +41 -41
- package/dist/types/components/shared.d.ts +15 -15
- package/index.d.ts +8 -12
- package/index.js +56 -29
- package/package.json +28 -45
- package/dist/components/ActionMenuSwitch.js +0 -44
- package/dist/style.css +0 -12836
- package/dist/style.min.css +0 -16
- package/dist/types/components/ActionMenuSwitch.d.ts +0 -12
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = HeaderTitle;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _utils = require("blue-web/dist/js/utils");
|
|
13
|
-
|
|
14
|
-
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); }
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { guid } from "blue-web/dist/js/utils";
|
|
18
3
|
/**
|
|
19
4
|
* The title area at the header bar.
|
|
20
5
|
* Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
|
|
21
6
|
*/
|
|
22
|
-
function HeaderTitle(_ref) {
|
|
7
|
+
export default function HeaderTitle(_ref) {
|
|
23
8
|
var logo = _ref.logo,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var uniqueId = "HeaderTitle-" +
|
|
37
|
-
|
|
9
|
+
_ref$logoAlt = _ref.logoAlt,
|
|
10
|
+
logoAlt = _ref$logoAlt === void 0 ? "Logo" : _ref$logoAlt,
|
|
11
|
+
appTitle = _ref.appTitle,
|
|
12
|
+
keepAppTitle = _ref.keepAppTitle,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
sidebar = _ref.sidebar,
|
|
16
|
+
_ref$elementType = _ref.elementType,
|
|
17
|
+
elementType = _ref$elementType === void 0 ? "a" : _ref$elementType,
|
|
18
|
+
to = _ref.to,
|
|
19
|
+
_ref$href = _ref.href,
|
|
20
|
+
href = _ref$href === void 0 ? "#" : _ref$href;
|
|
21
|
+
var uniqueId = "HeaderTitle-" + guid();
|
|
38
22
|
var setDocumentTitle = function setDocumentTitle() {
|
|
39
|
-
if (window.
|
|
23
|
+
if (window.blueHashRouterRef && window.blueHashRouterRef.props && window.blueHashRouterRef.props.disableTitleSet === false) {
|
|
40
24
|
var element = document.querySelector("#".concat(uniqueId, " .blue-header-title-labels"));
|
|
41
25
|
var titleElement = document.querySelector("title");
|
|
42
|
-
|
|
43
26
|
if (element && element.innerText && titleElement) {
|
|
44
27
|
var titlePaths = element.innerText.split("/");
|
|
45
|
-
|
|
46
28
|
if (titlePaths.length > 1) {
|
|
47
29
|
titleElement.innerText = "".concat(titlePaths[titlePaths.length - 1].trim(), " - ").concat(titlePaths[0].trim());
|
|
48
30
|
} else {
|
|
@@ -51,22 +33,21 @@ function HeaderTitle(_ref) {
|
|
|
51
33
|
}
|
|
52
34
|
}
|
|
53
35
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
+
useEffect(setDocumentTitle, []);
|
|
37
|
+
useEffect(setDocumentTitle, [children]);
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
39
|
id: uniqueId,
|
|
59
40
|
className: "blue-header-title d-inline-flex gap-2 fw-medium align-items-center px-3 py-2 position-absolute z-1" + (className ? " ".concat(className) : "") + (sidebar ? " sidebar" : "")
|
|
60
|
-
}, logo && /*#__PURE__*/
|
|
41
|
+
}, logo && /*#__PURE__*/createElement(elementType, {
|
|
61
42
|
to: to,
|
|
62
43
|
href: href
|
|
63
|
-
}, /*#__PURE__*/
|
|
44
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
64
45
|
src: logo,
|
|
65
46
|
alt: logoAlt,
|
|
66
47
|
className: "blue-header-title-image"
|
|
67
|
-
})), /*#__PURE__*/
|
|
48
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
68
49
|
className: "blue-header-title-labels " + (keepAppTitle ? "keep" : "")
|
|
69
|
-
}, appTitle && /*#__PURE__*/
|
|
50
|
+
}, appTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createElement(elementType, {
|
|
70
51
|
to: to,
|
|
71
52
|
href: href
|
|
72
53
|
}, appTitle), " ", children ? "/" : "", "\xA0"), children));
|
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = IconMenuItem;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _MenuItem = _interopRequireDefault(require("./MenuItem"));
|
|
11
|
-
|
|
12
1
|
var _excluded = ["label", "outerClass", "tooltipClass", "horizontalOnOpenSidebar", "className"];
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from "react";
|
|
6
|
+
import MenuItem from "./MenuItem";
|
|
22
7
|
/**
|
|
23
8
|
* Variant of `MenuItem` to primarily display an icon without a label.
|
|
24
9
|
* The label prop will be displayed as a tooltip.
|
|
25
10
|
*/
|
|
26
|
-
function IconMenuItem(_ref) {
|
|
11
|
+
export default function IconMenuItem(_ref) {
|
|
27
12
|
var label = _ref.label,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
13
|
+
_ref$outerClass = _ref.outerClass,
|
|
14
|
+
outerClass = _ref$outerClass === void 0 ? "" : _ref$outerClass,
|
|
15
|
+
_ref$tooltipClass = _ref.tooltipClass,
|
|
16
|
+
tooltipClass = _ref$tooltipClass === void 0 ? "blue-tooltip-end" : _ref$tooltipClass,
|
|
17
|
+
_ref$horizontalOnOpen = _ref.horizontalOnOpenSidebar,
|
|
18
|
+
horizontalOnOpenSidebar = _ref$horizontalOnOpen === void 0 ? true : _ref$horizontalOnOpen,
|
|
19
|
+
_ref$className = _ref.className,
|
|
20
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
23
|
className: "".concat(tooltipClass, " ").concat(horizontalOnOpenSidebar ? "blue-sidebar-menu-horizontal-on-open" : "", " ").concat(outerClass),
|
|
40
24
|
"data-tooltip": label
|
|
41
|
-
}, /*#__PURE__*/
|
|
25
|
+
}, /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
|
|
42
26
|
className: "".concat(className, " w-100"),
|
|
43
27
|
iconClassName: "w-100"
|
|
44
28
|
})));
|
package/dist/components/Intro.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = Intro;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
1
|
+
import React from "react";
|
|
12
2
|
/**
|
|
13
3
|
* Can be used for a sign-in page.
|
|
14
4
|
*/
|
|
15
|
-
function Intro(_ref) {
|
|
5
|
+
export default function Intro(_ref) {
|
|
16
6
|
var logo = _ref.logo,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /*#__PURE__*/
|
|
7
|
+
_ref$logoMaxWidth = _ref.logoMaxWidth,
|
|
8
|
+
logoMaxWidth = _ref$logoMaxWidth === void 0 ? "100px" : _ref$logoMaxWidth,
|
|
9
|
+
title = _ref.title,
|
|
10
|
+
children = _ref.children;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
12
|
className: "sign-in-screen"
|
|
23
|
-
}, /*#__PURE__*/
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24
14
|
className: "sign-in-container mx-1"
|
|
25
|
-
}, /*#__PURE__*/
|
|
15
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
16
|
className: "bg-body rounded-3 shadow-lg px-4 py-5"
|
|
27
|
-
}, /*#__PURE__*/
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
18
|
className: "text-center"
|
|
29
|
-
}, /*#__PURE__*/
|
|
19
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
30
20
|
style: {
|
|
31
21
|
maxWidth: logoMaxWidth
|
|
32
22
|
},
|
|
33
23
|
src: logo,
|
|
34
24
|
alt: ""
|
|
35
|
-
}), /*#__PURE__*/
|
|
25
|
+
}), /*#__PURE__*/React.createElement("h2", {
|
|
36
26
|
className: "mt-4 mb-3"
|
|
37
27
|
}, title)), children)));
|
|
38
28
|
}
|
|
@@ -1,366 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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); Object.defineProperty(Constructor, "prototype", { writable: false }); 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
-
|
|
28
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : 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.bind() : 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
|
-
* You can also append your own event listeners.
|
|
45
|
-
*
|
|
46
|
-
* Allowed events:
|
|
47
|
-
*
|
|
48
|
-
* * **componentDidUpdate** - Component was updated.
|
|
49
|
-
* Example: `window.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: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
52
|
-
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
53
|
-
* Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
54
|
-
*
|
|
55
|
-
* Method to add event listeners:
|
|
56
|
-
* * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
|
|
57
|
-
*
|
|
58
|
-
* Methods to remove event listeners:
|
|
59
|
-
* * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
|
|
60
|
-
* * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
|
|
61
|
-
*/
|
|
62
|
-
var Layout = /*#__PURE__*/function (_Component) {
|
|
63
|
-
_inherits(Layout, _Component);
|
|
64
|
-
|
|
65
|
-
var _super = _createSuper(Layout);
|
|
66
|
-
|
|
67
|
-
function Layout(props) {
|
|
68
|
-
var _this;
|
|
69
|
-
|
|
70
|
-
_classCallCheck(this, Layout);
|
|
71
|
-
|
|
72
|
-
_this = _super.call(this, props);
|
|
73
|
-
window.blueLayoutRef = _assertThisInitialized(_this);
|
|
74
|
-
_this.defaultMatch = ["home"];
|
|
75
|
-
var expandSidebar = props.hideSidebarMenu ? false : props.expandSidebar !== undefined ? props.expandSidebar : localStorage.getItem("blueLayoutShrinkSidebar") === null;
|
|
76
|
-
_this.state = {
|
|
77
|
-
sidebarIn: props.sidebarIn || false,
|
|
78
|
-
expandSidebar: expandSidebar,
|
|
79
|
-
match: null,
|
|
80
|
-
history: [],
|
|
81
|
-
hash: window.location.hash,
|
|
82
|
-
hashHistory: [],
|
|
83
|
-
blockRouting: props.blockRouting || undefined
|
|
84
|
-
};
|
|
85
|
-
_this.hideSidebar = _this.hideSidebar.bind(_assertThisInitialized(_this));
|
|
86
|
-
_this.toggleExpandSidebar = _this.toggleExpandSidebar.bind(_assertThisInitialized(_this));
|
|
87
|
-
_this.eventListeners = [];
|
|
88
|
-
if (_this.props.onChangeExpandSidebar) _this.props.onChangeExpandSidebar(expandSidebar);
|
|
89
|
-
return _this;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_createClass(Layout, [{
|
|
93
|
-
key: "onHashChange",
|
|
94
|
-
value: function onHashChange() {
|
|
95
|
-
window.blueLayoutRef.initMatch();
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "blue-web/dist/js/side-layout";
|
|
3
|
+
var SideLayout = "side-layout";
|
|
4
|
+
export default function Layout(_ref) {
|
|
5
|
+
var children = _ref.children,
|
|
6
|
+
header = _ref.header,
|
|
7
|
+
side = _ref.side,
|
|
8
|
+
_ref$noPageBorder = _ref.noPageBorder,
|
|
9
|
+
noPageBorder = _ref$noPageBorder === void 0 ? false : _ref$noPageBorder;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
style: {
|
|
12
|
+
height: "100vh"
|
|
96
13
|
}
|
|
97
|
-
}, {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var _this2 = this;
|
|
101
|
-
|
|
102
|
-
var me = this;
|
|
103
|
-
document.addEventListener("toggleSidebar", function () {
|
|
104
|
-
_this2.toggleSidebar(undefined);
|
|
105
|
-
}, false);
|
|
106
|
-
this.initMatch();
|
|
107
|
-
document.addEventListener("touchstart", function (event) {
|
|
108
|
-
var xPos = event.touches[0].pageX;
|
|
109
|
-
|
|
110
|
-
if (xPos < 5) {
|
|
111
|
-
me.toggleSidebar(event);
|
|
112
|
-
} else if (me.state.sidebarIn && xPos > 20) {
|
|
113
|
-
me.toggleSidebar(event);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
window.addEventListener("hashchange", this.onHashChange);
|
|
14
|
+
}, /*#__PURE__*/React.createElement(SideLayout, {
|
|
15
|
+
style: {
|
|
16
|
+
"--base-z-index": 500
|
|
117
17
|
}
|
|
118
|
-
}, {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
slot: "expand-toggler",
|
|
20
|
+
className: "w-100 h-100",
|
|
21
|
+
style: {
|
|
22
|
+
color: "var(--blue-sidebar-color)",
|
|
23
|
+
background: "var(--blue-sidebar-bg)"
|
|
122
24
|
}
|
|
123
|
-
}, {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (this.props.onChangeExpandSidebar && prevState.expandSidebar !== this.state.expandSidebar) {
|
|
145
|
-
this.props.onChangeExpandSidebar(this.state.expandSidebar);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (prevProps.blockRouting !== this.props.blockRouting && this.props.blockRouting !== this.state.blockRouting) {
|
|
149
|
-
this.setState({
|
|
150
|
-
blockRouting: this.props.blockRouting
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
this.eventListeners.forEach(function (eventListener) {
|
|
155
|
-
if (eventListener[0] === "componentDidUpdate") {
|
|
156
|
-
eventListener[1](prevProps, prevState);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (eventListener[0] === "pageDidShowAgain") {
|
|
160
|
-
var pageId = eventListener[1];
|
|
161
|
-
var callback = eventListener[2];
|
|
162
|
-
|
|
163
|
-
if (prevState.hash !== _this3.state.hash && _this3.state.match[0] === pageId) {
|
|
164
|
-
callback(prevProps, prevState);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (eventListener[0] === "pageDidHide") {
|
|
169
|
-
var _pageId = eventListener[1];
|
|
170
|
-
var _callback = eventListener[2];
|
|
171
|
-
|
|
172
|
-
if (prevState.hash !== _this3.state.hash && prevState.match[0] === _pageId) {
|
|
173
|
-
_callback(prevProps, prevState);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
});
|
|
25
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
|
|
27
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
viewBox: "0 0 16 16",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
width: "1em",
|
|
32
|
+
height: "1em",
|
|
33
|
+
fill: "currentColor",
|
|
34
|
+
className: "bi bi-layout-sidebar"
|
|
35
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
36
|
+
d: "M0 3a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm5-1v12h9a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1zM4 2H2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h2z"
|
|
37
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
slot: "drawer-toggler",
|
|
39
|
+
className: "w-100 h-100",
|
|
40
|
+
style: {
|
|
41
|
+
color: "var(--blue-sidebar-color)",
|
|
42
|
+
background: "var(--blue-sidebar-bg)"
|
|
177
43
|
}
|
|
178
|
-
}, {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: "btn blue-menu-item w-100 h-100 d-flex align-items-center justify-content-center p-0"
|
|
46
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
47
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
+
viewBox: "0 0 16 16",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
width: "1em",
|
|
51
|
+
height: "1em",
|
|
52
|
+
fill: "currentColor",
|
|
53
|
+
className: "bi bi-layout-sidebar-inset"
|
|
54
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
55
|
+
d: "M14 2a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2z"
|
|
56
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
57
|
+
d: "M3 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"
|
|
58
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
slot: "overlay",
|
|
60
|
+
className: "bg-dark w-100 h-100",
|
|
61
|
+
style: {
|
|
62
|
+
"--bs-bg-opacity": 0.5
|
|
188
63
|
}
|
|
189
|
-
}, {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
64
|
+
}), /*#__PURE__*/React.createElement("header", {
|
|
65
|
+
slot: "header"
|
|
66
|
+
}, header), /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
slot: "side",
|
|
68
|
+
className: "overflow-x-hidden overflow-y-auto h-100",
|
|
69
|
+
style: {
|
|
70
|
+
color: "var(--blue-sidebar-color)",
|
|
71
|
+
background: "var(--blue-sidebar-bg)"
|
|
197
72
|
}
|
|
198
|
-
}, {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
newMatch = window.location.hash.replace("#", "").split("/").filter(function (n) {
|
|
205
|
-
return n !== "";
|
|
206
|
-
});
|
|
207
|
-
} else {
|
|
208
|
-
newMatch = this.defaultMatch;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (this.props.unrouteable) {
|
|
212
|
-
newMatch = this.defaultMatch;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (this.state.blockRouting && this.state.blockRouting(newMatch, this.state.match) === true) {
|
|
216
|
-
window.location.hash = this.state.hash;
|
|
217
|
-
} else {
|
|
218
|
-
if (!(this.state.history.indexOf(newMatch[0]) > -1)) {
|
|
219
|
-
this.state.history.push(newMatch[0]);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
this.setState({
|
|
223
|
-
match: newMatch,
|
|
224
|
-
history: this.state.history,
|
|
225
|
-
hash: window.location.hash,
|
|
226
|
-
hashHistory: this.state.hashHistory.concat([window.location.hash])
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
key: "addEventListener",
|
|
232
|
-
value: function addEventListener(param1, param2, param3, listenerId) {
|
|
233
|
-
this.eventListeners.push([param1, param2, param3, listenerId]);
|
|
234
|
-
this.removeDuplicatedEventListeners();
|
|
235
|
-
}
|
|
236
|
-
}, {
|
|
237
|
-
key: "removeEventListener",
|
|
238
|
-
value: function removeEventListener(type, listenerId) {
|
|
239
|
-
this.eventListeners = this.eventListeners.filter(function (param) {
|
|
240
|
-
if (param[0] !== type) {
|
|
241
|
-
return param;
|
|
242
|
-
} else if (param[0] === type && param[3] !== listenerId) {
|
|
243
|
-
return param;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "removeDuplicatedEventListeners",
|
|
249
|
-
value: function removeDuplicatedEventListeners() {
|
|
250
|
-
this.eventListeners = this.eventListeners.filter(function (value, index, self) {
|
|
251
|
-
return index === self.findIndex(function (t) {
|
|
252
|
-
return t[3] === value[3] && t[0] === value[0];
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}, {
|
|
257
|
-
key: "toggleExpandSidebar",
|
|
258
|
-
value: function toggleExpandSidebar() {
|
|
259
|
-
var expandSidebar = this.state.expandSidebar;
|
|
260
|
-
|
|
261
|
-
if (expandSidebar) {
|
|
262
|
-
localStorage.setItem("blueLayoutShrinkSidebar", "true");
|
|
263
|
-
} else {
|
|
264
|
-
localStorage.removeItem("blueLayoutShrinkSidebar");
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
this.setState({
|
|
268
|
-
expandSidebar: !expandSidebar
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}, {
|
|
272
|
-
key: "render",
|
|
273
|
-
value: function render() {
|
|
274
|
-
var _this4 = this,
|
|
275
|
-
_this$props$pages;
|
|
276
|
-
|
|
277
|
-
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
278
|
-
id: this.props.id ? this.props.id : "",
|
|
279
|
-
style: this.props.style ? this.props.style : {},
|
|
280
|
-
className: "blue-layout" + (this.props.className ? " " + this.props.className : "") + (this.state.sidebarIn ? " open" : "") + (this.props.hideSidebarMenu ? " hasNoSidebarMenu" : " hasSidebarMenu") + (this.state.expandSidebar ? " expandSidebar" : "") + (this.props.disableHeaders ? " disableHeaders" : "") + (this.props.hideToggleExpandSidebar ? " hideToggleExpandSidebar" : ""),
|
|
281
|
-
onClick: this.hideSidebar
|
|
282
|
-
}, !this.props.hideSidebarMenu && /*#__PURE__*/_react.default.createElement(_SidebarToggler.default, {
|
|
283
|
-
sidebarToggleIconComponent: this.props.sidebarToggleIconComponent,
|
|
284
|
-
onClick: function onClick() {
|
|
285
|
-
_this4.setState({
|
|
286
|
-
sidebarIn: !_this4.state.sidebarIn
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}), !this.props.hideSidebarMenu && !this.props.hideToggleExpandSidebar && /*#__PURE__*/_react.default.createElement(_SidebarToggler.default, {
|
|
290
|
-
sidebarToggleIconComponent: this.props.sidebarToggleIconComponent,
|
|
291
|
-
onClick: this.toggleExpandSidebar,
|
|
292
|
-
className: "d-none d-xxl-block"
|
|
293
|
-
}), this.props.children, (_this$props$pages = this.props.pages) === null || _this$props$pages === void 0 ? void 0 : _this$props$pages.map(function (page) {
|
|
294
|
-
return _this4.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
295
|
-
key: page.name,
|
|
296
|
-
className: "router-page " + (_this4.state.match[0] === page.name ? "active" : "")
|
|
297
|
-
}, page.component);
|
|
298
|
-
}), this.props.enableStatus && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
299
|
-
className: "blue-status-circle blue-loading blue-status-loading"
|
|
300
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
301
|
-
className: "spinner-bounce-circle"
|
|
302
|
-
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
303
|
-
className: "blue-status-circle blue-status-success",
|
|
304
|
-
role: "status",
|
|
305
|
-
"aria-live": "polite"
|
|
306
|
-
}, this.props.statusIcons.success), /*#__PURE__*/_react.default.createElement("div", {
|
|
307
|
-
className: "blue-status-circle blue-status-info"
|
|
308
|
-
}, this.props.statusIcons.info), /*#__PURE__*/_react.default.createElement("div", {
|
|
309
|
-
className: "blue-status-circle blue-status-warning"
|
|
310
|
-
}, this.props.statusIcons.warning), /*#__PURE__*/_react.default.createElement("div", {
|
|
311
|
-
className: "blue-status-circle blue-status-danger"
|
|
312
|
-
}, this.props.statusIcons.danger), /*#__PURE__*/_react.default.createElement("div", {
|
|
313
|
-
className: "blue-status-alert alert"
|
|
314
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
315
|
-
type: "button",
|
|
316
|
-
className: "btn-close float-end mb-1",
|
|
317
|
-
"aria-label": "Close"
|
|
318
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
319
|
-
className: "alert-body"
|
|
320
|
-
})))));
|
|
321
|
-
}
|
|
322
|
-
}], [{
|
|
323
|
-
key: "defaultProps",
|
|
324
|
-
get: function get() {
|
|
325
|
-
return {
|
|
326
|
-
hideSidebarMenu: false,
|
|
327
|
-
unrouteable: false,
|
|
328
|
-
disableTitleSet: false,
|
|
329
|
-
sidebarToggleIconComponent: /*#__PURE__*/_react.default.createElement("svg", {
|
|
330
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
331
|
-
width: "1em",
|
|
332
|
-
height: "1em",
|
|
333
|
-
fill: "currentColor",
|
|
334
|
-
viewBox: "0 0 16 16",
|
|
335
|
-
style: {
|
|
336
|
-
display: "inline-block",
|
|
337
|
-
verticalAlign: "-0.125em"
|
|
338
|
-
}
|
|
339
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
340
|
-
fillRule: "evenodd",
|
|
341
|
-
d: "M2.5 12a.5.5 0 01.5-.5h10a.5.5 0 010 1H3a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h10a.5.5 0 010 1H3a.5.5 0 01-.5-.5zm0-4a.5.5 0 01.5-.5h10a.5.5 0 010 1H3a.5.5 0 01-.5-.5z"
|
|
342
|
-
})),
|
|
343
|
-
enableStatus: true,
|
|
344
|
-
statusIcons: {
|
|
345
|
-
danger: /*#__PURE__*/_react.default.createElement("span", {
|
|
346
|
-
className: "bi-error"
|
|
347
|
-
}),
|
|
348
|
-
info: /*#__PURE__*/_react.default.createElement("span", {
|
|
349
|
-
className: "bi-information"
|
|
350
|
-
}),
|
|
351
|
-
success: /*#__PURE__*/_react.default.createElement("span", {
|
|
352
|
-
className: "bi-check"
|
|
353
|
-
}),
|
|
354
|
-
warning: /*#__PURE__*/_react.default.createElement("span", {
|
|
355
|
-
className: "bi-sign_warning"
|
|
356
|
-
})
|
|
357
|
-
},
|
|
358
|
-
hideToggleExpandSidebar: false
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
}]);
|
|
362
|
-
|
|
363
|
-
return Layout;
|
|
364
|
-
}(_react.Component);
|
|
365
|
-
|
|
366
|
-
exports.default = Layout;
|
|
73
|
+
}, side), /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "w-100 h-100 p-1"
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "\"w-100 h-100 overflow-auto rounded ".concat(noPageBorder ? "" : "border ", "bg-body shadow-sm\"")
|
|
77
|
+
}, children))));
|
|
78
|
+
}
|