blue-react 9.0.0-alpha1 → 9.0.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/ActionMenu.js +98 -109
- package/dist/components/ActionMenuSwitch.js +44 -55
- package/dist/components/Body.js +38 -50
- package/dist/components/Caret.js +19 -32
- package/dist/components/DocumentView.js +76 -88
- package/dist/components/Header.js +22 -34
- package/dist/components/HeaderTitle.js +54 -66
- package/dist/components/Intro.js +35 -48
- package/dist/components/Layout.js +313 -292
- package/dist/components/MenuItem.js +130 -139
- package/dist/components/Modal.js +164 -173
- package/dist/components/ModalProvider.js +184 -195
- package/dist/components/Outside.js +50 -63
- package/dist/components/Page.js +62 -74
- package/dist/components/Search.js +159 -168
- package/dist/components/SidebarMenu.js +56 -69
- package/dist/components/SidebarMenuItem.js +124 -0
- package/dist/components/SidebarToggler.js +33 -0
- package/dist/components/SlimContainer.js +21 -34
- package/dist/components/Status.js +64 -76
- package/dist/components/StatusProvider.js +68 -79
- package/dist/components/Switch.js +57 -70
- package/dist/components/Utilities.js +183 -192
- package/dist/components/shared.js +24 -37
- package/dist/neu.scss +76 -0
- package/dist/style.css +1632 -522
- package/dist/style.min.css +9 -10
- package/dist/style.scss +4 -4
- package/dist/styles/_bootstrap-variables.scss +2 -2
- package/dist/styles/_bootstrap.scss +1 -0
- package/dist/styles/_general.scss +2 -2
- package/dist/styles/_layout.scss +3 -7
- package/dist/styles/_sidebar.scss +36 -0
- package/dist/styles/_variables.scss +5 -20
- package/dist/styles/mixins/_sidebar.scss +16 -2
- package/dist/types/components/Layout.d.ts +17 -1
- package/dist/types/components/MenuItem.d.ts +4 -0
- package/dist/types/components/Search.d.ts +7 -3
- 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 -6
- package/index.js +1 -2
- package/package.json +4 -5
- package/dist/components/BodyRounded.js +0 -44
- package/dist/components/Grid.js +0 -288
- package/dist/style.css.map +0 -1
- package/dist/styles/_bootstrap-optimizations.scss +0 -5
- package/dist/types/components/BodyRounded.d.ts +0 -10
- package/dist/types/components/Grid.d.ts +0 -110
|
@@ -1,345 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
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); }
|
|
2
4
|
|
|
3
|
-
(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
factory(exports, require("react"), require("./Utilities"));
|
|
8
|
-
} else {
|
|
9
|
-
var mod = {
|
|
10
|
-
exports: {}
|
|
11
|
-
};
|
|
12
|
-
factory(mod.exports, global.react, global.Utilities);
|
|
13
|
-
global.Layout = mod.exports;
|
|
14
|
-
}
|
|
15
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _Utilities) {
|
|
16
|
-
"use strict";
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
value: true
|
|
20
|
-
});
|
|
21
|
-
_exports.default = void 0;
|
|
22
|
-
_react = _interopRequireWildcard(_react);
|
|
23
|
-
_Utilities = _interopRequireDefault(_Utilities);
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
24
11
|
|
|
25
|
-
|
|
12
|
+
var _Utilities = _interopRequireDefault(require("./Utilities"));
|
|
26
13
|
|
|
27
|
-
|
|
14
|
+
var _SidebarToggler = _interopRequireDefault(require("./SidebarToggler"));
|
|
28
15
|
|
|
29
|
-
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
17
|
|
|
31
|
-
|
|
18
|
+
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); }
|
|
32
19
|
|
|
33
|
-
|
|
20
|
+
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; }
|
|
34
21
|
|
|
35
|
-
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
36
23
|
|
|
37
|
-
|
|
24
|
+
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); } }
|
|
38
25
|
|
|
39
|
-
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
40
27
|
|
|
41
|
-
|
|
28
|
+
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); }
|
|
42
29
|
|
|
43
|
-
|
|
30
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
44
31
|
|
|
45
|
-
|
|
32
|
+
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); }; }
|
|
46
33
|
|
|
47
|
-
|
|
34
|
+
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); }
|
|
48
35
|
|
|
49
|
-
|
|
36
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
50
37
|
|
|
51
|
-
|
|
38
|
+
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; } }
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
* The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
|
|
55
|
-
* You can also append your own event listeners.
|
|
56
|
-
*
|
|
57
|
-
* Allowed events:
|
|
58
|
-
*
|
|
59
|
-
* * **componentDidUpdate** - Component was updated.
|
|
60
|
-
* Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
61
|
-
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
62
|
-
* Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
63
|
-
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
64
|
-
* Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
65
|
-
*
|
|
66
|
-
* Method to add event listeners:
|
|
67
|
-
* * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
|
|
68
|
-
*
|
|
69
|
-
* Methods to remove event listeners:
|
|
70
|
-
* * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
|
|
71
|
-
* * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
|
|
72
|
-
*/
|
|
73
|
-
var Layout = /*#__PURE__*/function (_Component) {
|
|
74
|
-
_inherits(Layout, _Component);
|
|
40
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
75
41
|
|
|
76
|
-
|
|
42
|
+
window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
|
|
77
43
|
|
|
78
|
-
|
|
79
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
|
|
46
|
+
* You can also append your own event listeners.
|
|
47
|
+
*
|
|
48
|
+
* Allowed events:
|
|
49
|
+
*
|
|
50
|
+
* * **componentDidUpdate** - Component was updated.
|
|
51
|
+
* Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
52
|
+
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
53
|
+
* Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
54
|
+
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
55
|
+
* Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
56
|
+
*
|
|
57
|
+
* Method to add event listeners:
|
|
58
|
+
* * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
|
|
59
|
+
*
|
|
60
|
+
* Methods to remove event listeners:
|
|
61
|
+
* * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
|
|
62
|
+
* * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
|
|
63
|
+
*/
|
|
64
|
+
var Layout = /*#__PURE__*/function (_Component) {
|
|
65
|
+
_inherits(Layout, _Component);
|
|
80
66
|
|
|
81
|
-
|
|
67
|
+
var _super = _createSuper(Layout);
|
|
82
68
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
function Layout(props) {
|
|
70
|
+
var _this;
|
|
71
|
+
|
|
72
|
+
_classCallCheck(this, Layout);
|
|
73
|
+
|
|
74
|
+
_this = _super.call(this, props);
|
|
75
|
+
window.blueLayoutRef = _assertThisInitialized(_this);
|
|
76
|
+
_this.defaultMatch = ["home"];
|
|
77
|
+
_this.state = {
|
|
78
|
+
sidebarIn: props.sidebarIn || false,
|
|
79
|
+
expandSidebar: props.hideSidebarMenu ? false : props.expandSidebar || localStorage.getItem("blueLayoutShrinkSidebar") === null,
|
|
80
|
+
match: null,
|
|
81
|
+
history: [],
|
|
82
|
+
hash: window.location.hash,
|
|
83
|
+
hashHistory: [],
|
|
84
|
+
blockRouting: props.blockRouting || undefined
|
|
85
|
+
};
|
|
86
|
+
_this.hideSidebar = _this.hideSidebar.bind(_assertThisInitialized(_this));
|
|
87
|
+
_this.toggleExpandSidebar = _this.toggleExpandSidebar.bind(_assertThisInitialized(_this));
|
|
88
|
+
_this.eventListeners = [];
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_createClass(Layout, [{
|
|
93
|
+
key: "onHashChange",
|
|
94
|
+
value: function onHashChange() {
|
|
95
|
+
window.blueLayoutRef.initMatch();
|
|
97
96
|
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "componentDidMount",
|
|
99
|
+
value: function componentDidMount() {
|
|
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);
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: "componentWillUnmount",
|
|
120
|
+
value: function componentWillUnmount() {
|
|
121
|
+
window.removeEventListener("hashchange", this.onHashChange);
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "componentDidUpdate",
|
|
125
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
126
|
+
var _this3 = this;
|
|
127
|
+
|
|
128
|
+
if (prevProps.sidebarIn !== this.props.sidebarIn) {
|
|
129
|
+
this.setState({
|
|
130
|
+
sidebarIn: this.props.sidebarIn || false
|
|
131
|
+
});
|
|
132
|
+
}
|
|
98
133
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
value: function onHashChange() {
|
|
102
|
-
window.blueLayoutRef.initMatch();
|
|
134
|
+
if (this.props.onChangeSidebarIn && prevState.sidebarIn !== this.state.sidebarIn) {
|
|
135
|
+
this.props.onChangeSidebarIn(this.state.sidebarIn);
|
|
103
136
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var me = this;
|
|
110
|
-
document.addEventListener("toggleSidebar", function () {
|
|
111
|
-
_this2.toggleSidebar(undefined);
|
|
112
|
-
}, false);
|
|
113
|
-
this.initMatch();
|
|
114
|
-
document.addEventListener("touchstart", function (event) {
|
|
115
|
-
var xPos = event.touches[0].pageX;
|
|
116
|
-
|
|
117
|
-
if (xPos < 5) {
|
|
118
|
-
me.toggleSidebar(event);
|
|
119
|
-
} else if (me.state.sidebarIn && xPos > 20) {
|
|
120
|
-
me.toggleSidebar(event);
|
|
121
|
-
}
|
|
137
|
+
|
|
138
|
+
if (prevProps.expandSidebar !== this.props.expandSidebar) {
|
|
139
|
+
this.setState({
|
|
140
|
+
expandSidebar: this.props.expandSidebar || false
|
|
122
141
|
});
|
|
123
|
-
window.addEventListener("hashchange", this.onHashChange);
|
|
124
142
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
window.removeEventListener("hashchange", this.onHashChange);
|
|
143
|
+
|
|
144
|
+
if (this.props.onChangeExpandSidebar && prevState.expandSidebar !== this.state.expandSidebar) {
|
|
145
|
+
this.props.onChangeExpandSidebar(this.state.expandSidebar);
|
|
129
146
|
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "componentDidUpdate",
|
|
132
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
133
|
-
var _this3 = this;
|
|
134
|
-
|
|
135
|
-
if (prevProps.sidebarIn !== this.props.sidebarIn) {
|
|
136
|
-
this.setState({
|
|
137
|
-
sidebarIn: this.props.sidebarIn || false
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
147
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
if (prevProps.blockRouting !== this.props.blockRouting && this.props.blockRouting !== this.state.blockRouting) {
|
|
149
|
+
this.setState({
|
|
150
|
+
blockRouting: this.props.blockRouting
|
|
151
|
+
});
|
|
152
|
+
}
|
|
144
153
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
154
|
+
this.eventListeners.forEach(function (eventListener) {
|
|
155
|
+
if (eventListener[0] === "componentDidUpdate") {
|
|
156
|
+
eventListener[1](prevProps, prevState);
|
|
149
157
|
}
|
|
150
158
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (eventListener[0] === "pageDidShowAgain") {
|
|
157
|
-
var pageId = eventListener[1];
|
|
158
|
-
var callback = eventListener[2];
|
|
159
|
+
if (eventListener[0] === "pageDidShowAgain") {
|
|
160
|
+
var pageId = eventListener[1];
|
|
161
|
+
var callback = eventListener[2];
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
+
if (prevState.hash !== _this3.state.hash && _this3.state.match[0] === pageId) {
|
|
164
|
+
callback(prevProps, prevState);
|
|
163
165
|
}
|
|
166
|
+
}
|
|
164
167
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
if (eventListener[0] === "pageDidHide") {
|
|
169
|
+
var _pageId = eventListener[1];
|
|
170
|
+
var _callback = eventListener[2];
|
|
168
171
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
+
if (prevState.hash !== _this3.state.hash && prevState.match[0] === _pageId) {
|
|
173
|
+
_callback(prevProps, prevState);
|
|
172
174
|
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}, {
|
|
176
|
-
key: "toggleSidebar",
|
|
177
|
-
value: function toggleSidebar(event) {
|
|
178
|
-
if (this.state.sidebarIn) {
|
|
179
|
-
this.hideSidebar(event);
|
|
180
175
|
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "toggleSidebar",
|
|
180
|
+
value: function toggleSidebar(event) {
|
|
181
|
+
if (this.state.sidebarIn) {
|
|
182
|
+
this.hideSidebar(event);
|
|
183
|
+
}
|
|
181
184
|
|
|
185
|
+
this.setState({
|
|
186
|
+
sidebarIn: true
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
key: "hideSidebar",
|
|
191
|
+
value: function hideSidebar(e) {
|
|
192
|
+
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"))) {
|
|
182
193
|
this.setState({
|
|
183
|
-
sidebarIn:
|
|
194
|
+
sidebarIn: false
|
|
184
195
|
});
|
|
185
196
|
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "initMatch",
|
|
200
|
+
value: function initMatch() {
|
|
201
|
+
var newMatch;
|
|
202
|
+
|
|
203
|
+
if (window.location.hash && window.location.hash !== "" && window.location.hash !== "#/") {
|
|
204
|
+
newMatch = window.location.hash.replace("#", "").split("/").filter(function (n) {
|
|
205
|
+
return n !== "";
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
newMatch = this.defaultMatch;
|
|
194
209
|
}
|
|
195
|
-
}, {
|
|
196
|
-
key: "initMatch",
|
|
197
|
-
value: function initMatch() {
|
|
198
|
-
var newMatch;
|
|
199
|
-
|
|
200
|
-
if (window.location.hash && window.location.hash !== "" && window.location.hash !== "#/") {
|
|
201
|
-
newMatch = window.location.hash.replace("#", "").split("/").filter(function (n) {
|
|
202
|
-
return n !== "";
|
|
203
|
-
});
|
|
204
|
-
} else {
|
|
205
|
-
newMatch = this.defaultMatch;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (this.props.unrouteable) {
|
|
209
|
-
newMatch = this.defaultMatch;
|
|
210
|
-
}
|
|
211
210
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (!(this.state.history.indexOf(newMatch[0]) > -1)) {
|
|
216
|
-
this.state.history.push(newMatch[0]);
|
|
217
|
-
}
|
|
211
|
+
if (this.props.unrouteable) {
|
|
212
|
+
newMatch = this.defaultMatch;
|
|
213
|
+
}
|
|
218
214
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
});
|
|
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]);
|
|
225
220
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
key: "removeEventListener",
|
|
235
|
-
value: function removeEventListener(type, listenerId) {
|
|
236
|
-
this.eventListeners = this.eventListeners.filter(function (param) {
|
|
237
|
-
if (param[0] !== type) {
|
|
238
|
-
return param;
|
|
239
|
-
} else if (param[0] === type && param[3] !== listenerId) {
|
|
240
|
-
return param;
|
|
241
|
-
}
|
|
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])
|
|
242
227
|
});
|
|
243
228
|
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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];
|
|
251
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");
|
|
252
265
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
className: "bi-error"
|
|
326
|
-
}),
|
|
327
|
-
info: /*#__PURE__*/_react.default.createElement("span", {
|
|
328
|
-
className: "bi-information"
|
|
329
|
-
}),
|
|
330
|
-
success: /*#__PURE__*/_react.default.createElement("span", {
|
|
331
|
-
className: "bi-check"
|
|
332
|
-
}),
|
|
333
|
-
warning: /*#__PURE__*/_react.default.createElement("span", {
|
|
334
|
-
className: "bi-sign_warning"
|
|
335
|
-
})
|
|
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
|
+
className: "blue-wrapper"
|
|
279
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
280
|
+
id: this.props.id ? this.props.id : "",
|
|
281
|
+
style: this.props.style ? this.props.style : {},
|
|
282
|
+
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" : ""),
|
|
283
|
+
onClick: this.hideSidebar
|
|
284
|
+
}, !this.props.hideSidebarMenu && /*#__PURE__*/_react.default.createElement(_SidebarToggler.default, {
|
|
285
|
+
sidebarToggleIconComponent: this.props.sidebarToggleIconComponent,
|
|
286
|
+
onClick: function onClick() {
|
|
287
|
+
_this4.setState({
|
|
288
|
+
sidebarIn: !_this4.state.sidebarIn
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}), !this.props.hideSidebarMenu && !this.props.hideToggleExpandSidebar && /*#__PURE__*/_react.default.createElement(_SidebarToggler.default, {
|
|
292
|
+
sidebarToggleIconComponent: this.props.sidebarToggleIconComponent,
|
|
293
|
+
onClick: this.toggleExpandSidebar,
|
|
294
|
+
className: "d-none d-xxl-block"
|
|
295
|
+
}), this.props.children, (_this$props$pages = this.props.pages) === null || _this$props$pages === void 0 ? void 0 : _this$props$pages.map(function (page) {
|
|
296
|
+
return _this4.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
297
|
+
key: page.name,
|
|
298
|
+
className: "router-page " + (_this4.state.match[0] === page.name ? "active" : "")
|
|
299
|
+
}, page.component);
|
|
300
|
+
}), this.props.enableStatus && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
301
|
+
className: "blue-status-circle blue-loading blue-status-loading"
|
|
302
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
303
|
+
className: "spinner-bounce-circle"
|
|
304
|
+
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
305
|
+
className: "blue-status-circle blue-status-success"
|
|
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"
|
|
336
338
|
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
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
|
+
}]);
|
|
340
362
|
|
|
341
|
-
|
|
342
|
-
|
|
363
|
+
return Layout;
|
|
364
|
+
}(_react.Component);
|
|
343
365
|
|
|
344
|
-
|
|
345
|
-
});
|
|
366
|
+
exports.default = Layout;
|