blue-react 8.8.3 → 8.9.0
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/dist/components/Layout.js +47 -14
- package/dist/components/SidebarMenuItem.js +124 -0
- package/dist/components/SidebarToggler.js +33 -0
- package/dist/components/Utilities.js +5 -0
- package/dist/components/shared.js +2 -1
- package/dist/style.css +79 -65
- package/dist/style.min.css +4 -4
- package/dist/style.scss +2 -1
- package/dist/styles/_layout.scss +2 -28
- package/dist/styles/_sidebar.scss +42 -0
- package/dist/styles/_variables.scss +4 -16
- package/dist/types/components/Layout.d.ts +17 -1
- package/dist/types/components/SidebarMenuItem.d.ts +21 -0
- package/dist/types/components/SidebarToggler.d.ts +10 -0
- package/dist/types/components/Utilities.d.ts +4 -0
- package/index.d.ts +5 -3
- package/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/BodyRounded.js +0 -44
- package/dist/components/Grid.js +0 -288
- package/dist/style.css.map +0 -1
- package/dist/types/components/BodyRounded.d.ts +0 -10
- package/dist/types/components/Grid.d.ts +0 -110
package/dist/style.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Blue React v8.
|
|
2
|
+
* Blue React v8.9.0 (https://bruegmann.github.io/blue-react)
|
|
3
3
|
* Licensed under GNU General Public License v3.0 (https://github.com/bruegmann/blue-react/blob/master/LICENSE).
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
@import "./styles/_router";
|
|
18
18
|
@import "./styles/_status";
|
|
19
19
|
@import "./styles/_layout";
|
|
20
|
+
@import "./styles/_sidebar";
|
|
20
21
|
@import "./styles/_search";
|
|
21
22
|
@import "./styles/action-menu";
|
|
22
23
|
@import "./styles/_switch";
|
package/dist/styles/_layout.scss
CHANGED
|
@@ -21,28 +21,6 @@
|
|
|
21
21
|
padding-right: 0;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
&.open {
|
|
26
|
-
@media screen and (max-width: 1400px) {
|
|
27
|
-
.router-page.active {
|
|
28
|
-
.blue-page {
|
|
29
|
-
filter: blur(3px) brightness(0.8);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@include openSidebarMenu();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&:not(.open) {
|
|
38
|
-
.blue-sidebar-visible-on-open {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.blue-sidebar-hidden-on-open {
|
|
43
|
-
animation: fade-in 1s;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
24
|
}
|
|
47
25
|
|
|
48
26
|
.blue-header-wrapper {
|
|
@@ -59,7 +37,7 @@
|
|
|
59
37
|
height: $normal-size;
|
|
60
38
|
left: 0;
|
|
61
39
|
top: 0;
|
|
62
|
-
z-index:
|
|
40
|
+
z-index: 5;
|
|
63
41
|
}
|
|
64
42
|
|
|
65
43
|
.blue-header {
|
|
@@ -67,10 +45,6 @@
|
|
|
67
45
|
color: $header-color;
|
|
68
46
|
}
|
|
69
47
|
|
|
70
|
-
// .blue-layout:not(.wrapper-in) .blue-header {
|
|
71
|
-
// overflow: hidden;
|
|
72
|
-
// }
|
|
73
|
-
|
|
74
48
|
.blue-header {
|
|
75
49
|
height: $normal-size;
|
|
76
50
|
position: fixed;
|
|
@@ -181,7 +155,7 @@
|
|
|
181
155
|
display: none;
|
|
182
156
|
}
|
|
183
157
|
|
|
184
|
-
.blue-header {
|
|
158
|
+
&.hideToggleExpandSidebar .blue-header {
|
|
185
159
|
left: 0;
|
|
186
160
|
}
|
|
187
161
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.blue-sidebar-state {
|
|
2
|
+
&.open {
|
|
3
|
+
@media screen and (max-width: 1400px) {
|
|
4
|
+
.router-page.active {
|
|
5
|
+
.blue-page {
|
|
6
|
+
filter: blur(3px) brightness(0.8);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@include openSidebarMenu();
|
|
12
|
+
|
|
13
|
+
.blue-menu-item:not(.blue-open-menu) {
|
|
14
|
+
width: $bla-sidebar-width;
|
|
15
|
+
|
|
16
|
+
& > * {
|
|
17
|
+
width: auto;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:not(.open) {
|
|
23
|
+
.blue-sidebar-visible-on-open {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.blue-sidebar-hidden-on-open {
|
|
28
|
+
animation: fade-in 1s;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes blue-menu-item-dropdown-from-start {
|
|
34
|
+
from {
|
|
35
|
+
transform: translateX(-50%);
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.blue-menu-item-dropdown-from-start {
|
|
41
|
+
animation: blue-menu-item-dropdown-from-start 0.15s;
|
|
42
|
+
}
|
|
@@ -98,30 +98,18 @@ $actions-control-bg-hover: $bla-button-bg-hover !default;
|
|
|
98
98
|
// Width and height of the scrollbar indicators
|
|
99
99
|
$scrollbar-size: 10px;
|
|
100
100
|
|
|
101
|
-
:root
|
|
102
|
-
.blue-theme-with-scss {
|
|
101
|
+
:root {
|
|
103
102
|
--blue-sidebar-width: #{$bla-sidebar-width};
|
|
104
103
|
--blue-sidebar-color-h: #{$blue-sidebar-color-h};
|
|
105
104
|
--blue-sidebar-color-s: #{$blue-sidebar-color-s};
|
|
106
105
|
--blue-sidebar-color-l: #{$blue-sidebar-color-l};
|
|
107
106
|
--blue-sidebar-color: #{$blue-sidebar-color};
|
|
108
|
-
--blue-theme: #{$theme};
|
|
107
|
+
--blue-theme: var(--theme, #{$theme});
|
|
108
|
+
--blue-shimmering: 0.8;
|
|
109
109
|
|
|
110
110
|
--blue-app-bg: #{$app-bg};
|
|
111
111
|
--blue-sidebar-bg: #{$sidebar-bg};
|
|
112
112
|
--blue-header-bg: #{$header-bg};
|
|
113
|
-
--blue-menu-item-indicator-bg: #{$sidebar-indicator-color};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.blue-theme-with-css {
|
|
117
|
-
--blue-theme: var(--theme, #{$theme});
|
|
118
|
-
|
|
119
|
-
--blue-app-bg: var(--blue-theme, #{$app-bg});
|
|
120
|
-
--blue-sidebar-bg: var(--blue-theme, #{$sidebar-bg});
|
|
121
|
-
--blue-header-bg: var(--blue-theme, #{$header-bg});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
:root {
|
|
125
|
-
--blue-shimmering: 0.8;
|
|
126
113
|
--blue-action-link-bg-color: var(--blue-theme);
|
|
114
|
+
--blue-menu-item-indicator-bg: #{$sidebar-indicator-color};
|
|
127
115
|
}
|
|
@@ -17,10 +17,18 @@ export interface LayoutProps {
|
|
|
17
17
|
*/
|
|
18
18
|
onChangeSidebarIn?: (sidebarIn: boolean) => void;
|
|
19
19
|
style?: CSSProperties;
|
|
20
|
+
/**
|
|
21
|
+
* Set `true` to hide button to toggle `expandSidebar` state.
|
|
22
|
+
*/
|
|
23
|
+
hideToggleExpandSidebar?: boolean;
|
|
20
24
|
/**
|
|
21
25
|
* Sidebar is automatically expanded on wider views.
|
|
22
26
|
*/
|
|
23
27
|
expandSidebar?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* React to changes of the `expandSidebar` state.
|
|
30
|
+
*/
|
|
31
|
+
onChangeExpandSidebar?: (expandSidebar: boolean) => void;
|
|
24
32
|
/**
|
|
25
33
|
* Disables sidebar.
|
|
26
34
|
*/
|
|
@@ -48,6 +56,11 @@ export interface LayoutProps {
|
|
|
48
56
|
* If you don't use blueicon, you can define another icon element for the sidebar toggle button.
|
|
49
57
|
*/
|
|
50
58
|
sidebarToggleIconComponent?: any;
|
|
59
|
+
/**
|
|
60
|
+
* Set `true` if you want to use the Utilities functions for status and alert.
|
|
61
|
+
* Set `false` if you want to use `StatusProvider` instead.
|
|
62
|
+
*/
|
|
63
|
+
enableStatus?: boolean;
|
|
51
64
|
/**
|
|
52
65
|
* Will replace status icons with custom ones. This will also overwrite the `useBlueicons` option.
|
|
53
66
|
* This can be a SVG component or a normal element component.
|
|
@@ -71,6 +84,7 @@ export interface LayoutProps {
|
|
|
71
84
|
}
|
|
72
85
|
export interface LayoutState {
|
|
73
86
|
sidebarIn: boolean;
|
|
87
|
+
expandSidebar: boolean;
|
|
74
88
|
match: any;
|
|
75
89
|
history: string[];
|
|
76
90
|
hash: string;
|
|
@@ -103,17 +117,18 @@ export default class Layout extends Component<LayoutProps, LayoutState> {
|
|
|
103
117
|
constructor(props: LayoutProps);
|
|
104
118
|
onHashChange(): void;
|
|
105
119
|
static get defaultProps(): {
|
|
106
|
-
expandSidebar: boolean;
|
|
107
120
|
hideSidebarMenu: boolean;
|
|
108
121
|
unrouteable: boolean;
|
|
109
122
|
disableTitleSet: boolean;
|
|
110
123
|
sidebarToggleIconComponent: JSX.Element;
|
|
124
|
+
enableStatus: boolean;
|
|
111
125
|
statusIcons: {
|
|
112
126
|
danger: JSX.Element;
|
|
113
127
|
info: JSX.Element;
|
|
114
128
|
success: JSX.Element;
|
|
115
129
|
warning: JSX.Element;
|
|
116
130
|
};
|
|
131
|
+
hideToggleExpandSidebar: boolean;
|
|
117
132
|
};
|
|
118
133
|
componentDidMount(): void;
|
|
119
134
|
componentWillUnmount(): void;
|
|
@@ -124,5 +139,6 @@ export default class Layout extends Component<LayoutProps, LayoutState> {
|
|
|
124
139
|
addEventListener(param1: any, param2: any, param3: any, listenerId?: string): void;
|
|
125
140
|
removeEventListener(type: string, listenerId: string): void;
|
|
126
141
|
removeDuplicatedEventListeners(): void;
|
|
142
|
+
toggleExpandSidebar(): void;
|
|
127
143
|
render(): JSX.Element;
|
|
128
144
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MenuItemProps } from "./MenuItem";
|
|
3
|
+
export interface SidebarMenuItemProps extends MenuItemProps {
|
|
4
|
+
outerClass?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Extends `MenuItem` with following features:
|
|
8
|
+
* * Shows provided label as tooltip if sidebar is closed.
|
|
9
|
+
* * Children will be displayed on the right side of the parent item.
|
|
10
|
+
*
|
|
11
|
+
* **Important!** Set the following props to the surrounding `SidebarMenu` to provide problems with tooltips:
|
|
12
|
+
* ```jsx
|
|
13
|
+
* <SidebarMenu
|
|
14
|
+
* sidebarClass="overflow-visible"
|
|
15
|
+
* menuClass="overflow-visible"
|
|
16
|
+
* >
|
|
17
|
+
* ...
|
|
18
|
+
* </SidebarMenu>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export default function SidebarMenuItem({ outerClass, children, onClick, ...props }: SidebarMenuItemProps): JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
export interface SidebarTogglerProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
sidebarToggleIconComponent: ReactNode;
|
|
5
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Button to toggle sidebar state. Designed for internal use inside of `Layout`.
|
|
9
|
+
*/
|
|
10
|
+
export default function SidebarToggler({ className, sidebarToggleIconComponent, onClick }: SidebarTogglerProps): JSX.Element;
|
|
@@ -13,9 +13,13 @@ export declare function hideSuccess(): void;
|
|
|
13
13
|
export declare function toggleActions(): void;
|
|
14
14
|
/**
|
|
15
15
|
* Resets alert messages that was set with `setAlertMessage`.
|
|
16
|
+
* When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v8/component/StatusProvider
|
|
16
17
|
* @param alertClassName Leave empty to reset messages of any status type
|
|
17
18
|
*/
|
|
18
19
|
export declare function resetAlertMessage(alertClassName?: StatusType): void;
|
|
20
|
+
/**
|
|
21
|
+
* When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v8/component/StatusProvider
|
|
22
|
+
*/
|
|
19
23
|
export declare function setAlertMessage(message: string, alertClassName?: StatusType, close?: boolean, detailText?: string): void;
|
|
20
24
|
export declare const guid: () => string;
|
|
21
25
|
export declare function scrollToTop(): void;
|
package/index.d.ts
CHANGED
|
@@ -18,9 +18,6 @@ export { ActionMenuSwitchProps } from "./dist/types/components/ActionMenuSwitch"
|
|
|
18
18
|
export { default as Body } from "./dist/types/components/Body"
|
|
19
19
|
export { BodyProps } from "./dist/types/components/Body"
|
|
20
20
|
|
|
21
|
-
export { default as BodyRounded } from "./dist/types/components/BodyRounded"
|
|
22
|
-
export { BodyRoundedProps } from "./dist/types/components/BodyRounded"
|
|
23
|
-
|
|
24
21
|
export { default as Caret } from "./dist/types/components/Caret"
|
|
25
22
|
export { CaretProps } from "./dist/types/components/Caret"
|
|
26
23
|
|
|
@@ -56,12 +53,17 @@ export { SearchProps } from "./dist/types/components/Search"
|
|
|
56
53
|
export { default as SidebarMenu } from "./dist/types/components/SidebarMenu"
|
|
57
54
|
export { SidebarMenuProps } from "./dist/types/components/SidebarMenu"
|
|
58
55
|
|
|
56
|
+
export { default as SidebarMenuItem } from "./dist/types/components/SidebarMenuItem"
|
|
57
|
+
export { SidebarMenuItemProps } from "./dist/types/components/SidebarMenuItem"
|
|
58
|
+
|
|
59
59
|
export { default as SlimContainer } from "./dist/types/components/SlimContainer"
|
|
60
60
|
export { SlimContainerProps } from "./dist/types/components/SlimContainer"
|
|
61
61
|
|
|
62
62
|
export { default as Status } from "./dist/types/components/Status"
|
|
63
63
|
export { StatusProps } from "./dist/types/components/Status"
|
|
64
64
|
|
|
65
|
+
export { StatusProvider, useStatus } from "./dist/types/components/StatusProvider"
|
|
66
|
+
|
|
65
67
|
export { default as Switch } from "./dist/types/components/Switch"
|
|
66
68
|
export { SwitchProps } from "./dist/types/components/Switch"
|
|
67
69
|
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
exports.ActionMenu = require("./dist/components/ActionMenu.js")["default"]
|
|
2
2
|
exports.ActionMenuSwitch = require("./dist/components/ActionMenuSwitch.js")["default"]
|
|
3
3
|
exports.Body = require("./dist/components/Body.js")["default"]
|
|
4
|
-
exports.BodyRounded = require("./dist/components/BodyRounded.js")["default"]
|
|
5
4
|
exports.Caret = require("./dist/components/Caret.js")["default"]
|
|
6
5
|
exports.DocumentView = require("./dist/components/DocumentView.js")["default"]
|
|
7
6
|
exports.Layout = require("./dist/components/Layout.js")["default"]
|
|
@@ -16,6 +15,7 @@ exports.Outside = require("./dist/components/Outside.js")["default"]
|
|
|
16
15
|
exports.Page = require("./dist/components/Page.js")["default"]
|
|
17
16
|
exports.Search = require("./dist/components/Search.js")["default"]
|
|
18
17
|
exports.SidebarMenu = require("./dist/components/SidebarMenu.js")["default"]
|
|
18
|
+
exports.SidebarMenuItem = require("./dist/components/SidebarMenuItem.js")["default"]
|
|
19
19
|
exports.SlimContainer = require("./dist/components/SlimContainer.js")["default"]
|
|
20
20
|
exports.Status = require("./dist/components/Status.js")["default"]
|
|
21
21
|
exports.StatusProvider = require("./dist/components/StatusProvider.js")["StatusProvider"]
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = BodyRounded;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _Body = _interopRequireDefault(require("./Body"));
|
|
11
|
-
|
|
12
|
-
var _excluded = ["classNameTop", "classNameBottom", "children"];
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Extended variation of `Body` with rounded elements on top and bottom of the page.
|
|
22
|
-
*/
|
|
23
|
-
function BodyRounded(_ref) {
|
|
24
|
-
var classNameTop = _ref.classNameTop,
|
|
25
|
-
classNameBottom = _ref.classNameBottom,
|
|
26
|
-
children = _ref.children,
|
|
27
|
-
bodyProps = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_Body.default, bodyProps, /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
-
className: "blue-app-body-rounded-top bg-theme pt-1 d-none d-md-block " + classNameTop,
|
|
31
|
-
style: {
|
|
32
|
-
height: "1rem"
|
|
33
|
-
}
|
|
34
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
35
|
-
className: "rounded-top bg-body w-100 h-100"
|
|
36
|
-
})), children, /*#__PURE__*/_react.default.createElement("div", {
|
|
37
|
-
className: "blue-app-body-rounded-bottom bg-theme pb-1 d-none d-md-block " + classNameBottom,
|
|
38
|
-
style: {
|
|
39
|
-
height: "1rem"
|
|
40
|
-
}
|
|
41
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
-
className: "rounded-bottom bg-body w-100 h-100"
|
|
43
|
-
})));
|
|
44
|
-
}
|
package/dist/components/Grid.js
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
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.blueGridRef`.
|
|
44
|
-
* Also you can append your own event listeners with `blueGridRef.addEventListener(eventName, (prevProps, prevState) => { })`.
|
|
45
|
-
*
|
|
46
|
-
* Allowed event listeners:
|
|
47
|
-
*
|
|
48
|
-
* * **componentDidUpdate** - Component was updated.
|
|
49
|
-
* Example: `blueGridRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
50
|
-
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
51
|
-
* Example: `blueGridRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
52
|
-
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
53
|
-
* Example: `blueGridRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
54
|
-
*/
|
|
55
|
-
var Grid = /*#__PURE__*/function (_Component) {
|
|
56
|
-
_inherits(Grid, _Component);
|
|
57
|
-
|
|
58
|
-
var _super = _createSuper(Grid);
|
|
59
|
-
|
|
60
|
-
function Grid(props) {
|
|
61
|
-
var _this;
|
|
62
|
-
|
|
63
|
-
_classCallCheck(this, Grid);
|
|
64
|
-
|
|
65
|
-
_this = _super.call(this, props);
|
|
66
|
-
window.blueGridRef = _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(Grid, [{
|
|
82
|
-
key: "onHashChange",
|
|
83
|
-
value: function onHashChange(event) {
|
|
84
|
-
window.blueGridRef.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-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"))) {
|
|
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-sidebar-btn 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 Grid;
|
|
286
|
-
}(_react.Component);
|
|
287
|
-
|
|
288
|
-
exports.default = Grid;
|