blue-react 7.9.1 → 8.0.0-next.4

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.
Files changed (61) hide show
  1. package/README.md +22 -3
  2. package/dist/components/ActionMenu.js +8 -10
  3. package/dist/components/ActionMenuSwitch.js +2 -2
  4. package/dist/components/Body.js +1 -1
  5. package/dist/components/Grid.js +276 -287
  6. package/dist/components/Header.js +2 -2
  7. package/dist/components/HeaderTitle.js +6 -6
  8. package/dist/components/Intro.js +1 -12
  9. package/dist/components/Layout.js +295 -0
  10. package/dist/components/MenuItem.js +14 -10
  11. package/dist/components/Modal.js +16 -9
  12. package/dist/components/ModalProvider.js +11 -2
  13. package/dist/components/Outside.js +0 -4
  14. package/dist/components/Page.js +2 -7
  15. package/dist/components/Search.js +7 -7
  16. package/dist/components/SidebarMenu.js +7 -14
  17. package/dist/components/Status.js +67 -0
  18. package/dist/components/{DropdownMenuItem.js → StatusProvider.js} +54 -53
  19. package/dist/components/Utilities.js +11 -29
  20. package/dist/style.css +688 -621
  21. package/dist/style.min.css +5 -5
  22. package/dist/style.scss +1 -2
  23. package/dist/styles/_action-menu.scss +9 -9
  24. package/dist/styles/_general.scss +5 -5
  25. package/dist/styles/_grid.scss +56 -62
  26. package/dist/styles/_keyframes.scss +1 -1
  27. package/dist/styles/_mixins.scss +0 -1
  28. package/dist/styles/_search.scss +9 -9
  29. package/dist/styles/_status.scss +14 -14
  30. package/dist/styles/_variables.scss +6 -0
  31. package/dist/styles/mixins/_action-menu.scss +7 -7
  32. package/dist/styles/mixins/_sidebar.scss +22 -22
  33. package/dist/types/components/Grid.d.ts +12 -14
  34. package/dist/types/components/Layout.d.ts +111 -0
  35. package/dist/types/components/MenuItem.d.ts +4 -0
  36. package/dist/types/components/Modal.d.ts +1 -1
  37. package/dist/types/components/ModalProvider.d.ts +5 -2
  38. package/dist/types/components/SidebarMenu.d.ts +1 -5
  39. package/dist/types/components/Status.d.ts +12 -0
  40. package/dist/types/components/StatusProvider.d.ts +15 -0
  41. package/dist/types/components/Utilities.d.ts +0 -12
  42. package/dist/types/components/shared.d.ts +8 -0
  43. package/index.d.ts +6 -18
  44. package/index.js +4 -10
  45. package/package.json +7 -7
  46. package/dist/components/ActionMenuItem.js +0 -42
  47. package/dist/components/Actions.js +0 -107
  48. package/dist/components/BlueModal.js +0 -147
  49. package/dist/components/BlueModalProvider.js +0 -133
  50. package/dist/components/FluentBtn.js +0 -31
  51. package/dist/components/HeaderActions.js +0 -17
  52. package/dist/styles/_actions.scss +0 -137
  53. package/dist/styles/_ripple.scss +0 -30
  54. package/dist/styles/mixins/_actions.scss +0 -55
  55. package/dist/types/components/ActionMenuItem.d.ts +0 -41
  56. package/dist/types/components/Actions.d.ts +0 -31
  57. package/dist/types/components/BlueModal.d.ts +0 -14
  58. package/dist/types/components/BlueModalProvider.d.ts +0 -8
  59. package/dist/types/components/DropdownMenuItem.d.ts +0 -13
  60. package/dist/types/components/FluentBtn.d.ts +0 -26
  61. package/dist/types/components/HeaderActions.d.ts +0 -15
@@ -1,48 +1,47 @@
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
-
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
42
  /**
43
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
- * and remove it with `blueGridRef.removeEventListener(eventName, listener)`.
44
+ * Also you can append your own event listeners with `blueGridRef.addEventListener(eventName, (prevProps, prevState) => { })`.
46
45
  *
47
46
  * Allowed event listeners:
48
47
  *
@@ -52,248 +51,238 @@ window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
52
51
  * Example: `blueGridRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
53
52
  * * **pageDidHide** - This page disappeared and another page appears instead.
54
53
  * Example: `blueGridRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
55
- */
56
- var Grid = /*#__PURE__*/function (_Component) {
57
- _inherits(Grid, _Component);
58
-
59
- var _super = _createSuper(Grid);
60
-
61
- function Grid(props) {
62
- var _this;
63
-
64
- _classCallCheck(this, Grid);
65
-
66
- _this = _super.call(this, props);
67
- window.blueGridRef = _assertThisInitialized(_this);
68
- _this.defaultMatch = ["home"];
69
- _this.state = {
70
- sidebarIn: props.sidebarIn,
71
- match: null,
72
- history: [],
73
- hash: window.location.hash,
74
- hashHistory: [],
75
- blockRouting: props.blockRouting || undefined
76
- };
77
- _this.hideSidebar = _this.hideSidebar.bind(_assertThisInitialized(_this));
78
- _this.eventListeners = [];
79
- return _this;
80
- }
81
-
82
- _createClass(Grid, [{
83
- key: "onHashChange",
84
- value: function onHashChange(event) {
85
- window.blueGridRef.initMatch();
86
- }
87
- }, {
88
- key: "componentDidMount",
89
- value: function componentDidMount() {
90
- var _this2 = this;
91
-
92
- var me = this;
93
- document.addEventListener("toggleSidebar", function () {
94
- _this2.toggleSidebar(undefined);
95
- }, false);
96
- this.initMatch();
97
- document.addEventListener("touchstart", function (event) {
98
- var xPos = event.touches[0].pageX;
99
-
100
- if (xPos < 5) {
101
- me.toggleSidebar(event);
102
- } else if (me.state.sidebarIn && xPos > 20) {
103
- me.toggleSidebar(event);
104
- }
105
- });
106
-
107
- _Utilities.default.registerFluentBtns();
108
-
109
- window.addEventListener("hashchange", this.onHashChange);
110
- }
111
- }, {
112
- key: "componentWillUnmount",
113
- value: function componentWillUnmount() {
114
- window.removeEventListener("hashchange", this.onHashChange);
115
- }
116
- }, {
117
- key: "componentDidUpdate",
118
- value: function componentDidUpdate(prevProps, prevState) {
119
- var _this3 = this;
120
-
121
- if (prevProps.blockRouting !== this.props.blockRouting && this.props.blockRouting !== this.state.blockRouting) {
122
- this.setState({
123
- blockRouting: this.props.blockRouting
124
- });
125
- }
126
-
127
- this.eventListeners.forEach(function (eventListener) {
128
- if (eventListener[0] === "componentDidUpdate") {
129
- eventListener[1](prevProps, prevState);
130
- }
131
-
132
- if (eventListener[0] === "pageDidShowAgain") {
133
- var pageId = eventListener[1];
134
- var callback = eventListener[2];
135
-
136
- if (prevState.hash !== _this3.state.hash && _this3.state.match[0] === pageId) {
137
- callback(prevProps, prevState);
138
- }
139
- }
140
-
141
- if (eventListener[0] === "pageDidHide") {
142
- var _pageId = eventListener[1];
143
- var _callback = eventListener[2];
144
-
145
- if (prevState.hash !== _this3.state.hash && prevState.match[0] === _pageId) {
146
- _callback(prevProps, prevState);
147
- }
148
- }
149
- });
150
- }
151
- }, {
152
- key: "toggleSidebar",
153
- value: function toggleSidebar(event) {
154
- if (this.state.sidebarIn) {
155
- this.hideSidebar(event);
156
- }
157
-
158
- this.setState({
159
- sidebarIn: true
160
- });
161
- }
162
- }, {
163
- key: "hideSidebar",
164
- value: function hideSidebar(e) {
165
- if (!(_Utilities.default.hasClass(e.target, "blue-app-open-menu") || _Utilities.default.hasClass(e.target, "bi-menu") || _Utilities.default.hasClass(e.target, "blue-app-search") || _Utilities.default.hasClass(e.target, "blue-app-search-control") || _Utilities.default.hasClass(e.target, "blue-app-search-btn") || _Utilities.default.hasClass(e.target, "blue-app-search-btn-icon") || _Utilities.default.hasClass(e.target, "blue-app-sidebar-label") || _Utilities.default.hasClass(e.target, "blue-app-sidebar-dropdown-toggle") || _Utilities.default.hasClass(e.target, "blue-app-sidebar-dropdown-caret") || _Utilities.default.hasClass(e.target, "blue-app-sidebar-dropdown-icon") || _Utilities.default.hasClass(e.target, "blue-app-sidebar-exception"))) {
166
- this.setState({
167
- sidebarIn: false
168
- });
169
- }
170
- }
171
- }, {
172
- key: "initMatch",
173
- value: function initMatch() {
174
- var newMatch;
175
-
176
- if (window.location.hash && window.location.hash !== "" && window.location.hash !== "#/") {
177
- newMatch = window.location.hash.replace("#", "").split("/").filter(function (n) {
178
- return n !== "";
179
- });
180
- } else {
181
- newMatch = this.defaultMatch;
182
- }
183
-
184
- if (this.props.unrouteable) {
185
- newMatch = this.defaultMatch;
186
- }
187
-
188
- if (this.state.blockRouting && this.state.blockRouting(newMatch, this.state.match) === true) {
189
- window.location.hash = this.state.hash;
190
- } else {
191
- if (!(this.state.history.indexOf(newMatch[0]) > -1)) {
192
- this.state.history.push(newMatch[0]);
193
- }
194
-
195
- this.setState({
196
- match: newMatch,
197
- history: this.state.history,
198
- hash: window.location.hash,
199
- hashHistory: this.state.hashHistory.concat([window.location.hash])
200
- });
201
- }
202
- }
203
- }, {
204
- key: "addEventListener",
205
- value: function addEventListener(param1, param2, param3) {
206
- this.eventListeners.push([param1, param2, param3]);
207
- }
208
- }, {
209
- key: "removeEventListener",
210
- value: function removeEventListener(type, listener) {
211
- this.eventListeners = this.eventListeners.filter(function (param) {
212
- return param[0] !== type && param[2].toString() !== listener.toString();
213
- });
214
- }
215
- }, {
216
- key: "render",
217
- value: function render() {
218
- var _this4 = this,
219
- _this$props$pages;
220
-
221
- return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
222
- className: "blue-app-wrapper"
223
- }), /*#__PURE__*/_react.default.createElement("div", {
224
- id: this.props.id ? this.props.id : "",
225
- style: this.props.style ? this.props.style : {},
226
- className: "blue-app-grid" + (this.props.className ? " " + this.props.className : "") + (this.state.sidebarIn ? " open" : "") + (this.props.hideSidebarMenu ? " hasNoSidebarMenu" : " hasSidebarMenu") + (this.props.expandSidebar ? " expand-sidebar" : "") + (this.props.disableHeaders ? " disableHeaders" : ""),
227
- onClick: this.hideSidebar
228
- }, /*#__PURE__*/_react.default.createElement("div", {
229
- className: "blue-app-sidebar-toggler"
230
- }, !this.props.hideSidebarMenu ? /*#__PURE__*/_react.default.createElement("button", {
231
- type: "button",
232
- className: "blue-app-open-menu blue-app-sidebar-btn btn",
233
- onClick: function onClick() {
234
- _this4.setState({
235
- sidebarIn: !_this4.state.sidebarIn
236
- });
237
- }
238
- }, /*#__PURE__*/_react.default.createElement("div", {
239
- className: "blue-app-sidebar-exception position-absolute w-100 h-100"
240
- }), 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) {
241
- return _this4.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_react.default.createElement("div", {
242
- key: page.name,
243
- className: "router-page " + (_this4.state.match[0] === page.name ? "active" : "")
244
- }, page.component);
245
- }), /*#__PURE__*/_react.default.createElement("div", {
246
- className: "blue-app-status-circle blue-app-loading blue-app-status-loading"
247
- }, /*#__PURE__*/_react.default.createElement("div", {
248
- className: "spinner-bounce-circle"
249
- }, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null))), /*#__PURE__*/_react.default.createElement("div", {
250
- className: "blue-app-status-circle blue-app-status-success"
251
- }, this.props.statusIcons.success), /*#__PURE__*/_react.default.createElement("div", {
252
- className: "blue-app-status-circle blue-app-status-info"
253
- }, this.props.statusIcons.info), /*#__PURE__*/_react.default.createElement("div", {
254
- className: "blue-app-status-circle blue-app-status-warning"
255
- }, this.props.statusIcons.warning), /*#__PURE__*/_react.default.createElement("div", {
256
- className: "blue-app-status-circle blue-app-status-danger"
257
- }, this.props.statusIcons.danger), /*#__PURE__*/_react.default.createElement("div", {
258
- className: "blue-app-status-alert alert"
259
- }, /*#__PURE__*/_react.default.createElement("button", {
260
- type: "button",
261
- className: "btn-close float-end mb-1",
262
- "aria-label": "Close"
263
- }), /*#__PURE__*/_react.default.createElement("div", {
264
- className: "alert-body"
265
- }))));
266
- }
267
- }], [{
268
- key: "defaultProps",
269
- get: function get() {
270
- return {
271
- expandSidebar: false,
272
- hideSidebarMenu: false,
273
- unrouteable: false,
274
- disableTitleSet: false,
275
- sidebarToggleIconComponent: /*#__PURE__*/_react.default.createElement("span", {
276
- className: "bi-menu"
277
- }),
278
- statusIcons: {
279
- danger: /*#__PURE__*/_react.default.createElement("span", {
280
- className: "bi-error"
281
- }),
282
- info: /*#__PURE__*/_react.default.createElement("span", {
283
- className: "bi-information"
284
- }),
285
- success: /*#__PURE__*/_react.default.createElement("span", {
286
- className: "bi-check"
287
- }),
288
- warning: /*#__PURE__*/_react.default.createElement("span", {
289
- className: "bi-sign_warning"
290
- })
291
- }
292
- };
293
- }
294
- }]);
295
-
296
- return Grid;
297
- }(_react.Component);
298
-
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
+
299
288
  exports.default = Grid;
@@ -17,9 +17,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
  function Header(_ref) {
18
18
  var children = _ref.children;
19
19
  return /*#__PURE__*/_react.default.createElement("div", {
20
- className: "blue-app-header blue-app-header-extension"
20
+ className: "blue-header blue-header-extension"
21
21
  }, /*#__PURE__*/_react.default.createElement("div", {
22
- className: "ui-header-wrapper",
22
+ className: "blue-header-wrapper",
23
23
  onClick: _Utilities.default.scrollToTop
24
24
  }), children);
25
25
  }
@@ -32,8 +32,8 @@ function HeaderTitle(_ref) {
32
32
  var uniqueId = "HeaderTitle-" + _Utilities.default.guid();
33
33
 
34
34
  var setDocumentTitle = function setDocumentTitle() {
35
- if (window.blueGridRef && window.blueGridRef.props && window.blueGridRef.props.disableTitleSet === false) {
36
- var element = document.querySelector("#".concat(uniqueId, " .blue-app-header-logo-title-labels"));
35
+ if (window.blueLayoutRef && window.blueLayoutRef.props && window.blueLayoutRef.props.disableTitleSet === false) {
36
+ var element = document.querySelector("#".concat(uniqueId, " .blue-header-logo-title-labels"));
37
37
  var titleElement = document.querySelector("title");
38
38
 
39
39
  if (element && element.innerText && titleElement) {
@@ -52,16 +52,16 @@ function HeaderTitle(_ref) {
52
52
  (0, _react.useEffect)(setDocumentTitle, [children]);
53
53
  return /*#__PURE__*/_react.default.createElement("h3", {
54
54
  id: uniqueId,
55
- className: "blue-app-header-logo" + (className ? " ".concat(className) : "") + (sidebar ? " sidebar" : "")
55
+ className: "blue-header-logo" + (className ? " ".concat(className) : "") + (sidebar ? " sidebar" : "")
56
56
  }, /*#__PURE__*/_react.default.createElement("span", {
57
- className: "blue-app-header-logo-title"
57
+ className: "blue-header-logo-title"
58
58
  }, logo ? /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("a", {
59
59
  href: "#"
60
60
  }, /*#__PURE__*/_react.default.createElement("img", {
61
61
  src: logo,
62
- className: "blue-app-header-logo-image"
62
+ className: "blue-header-logo-image"
63
63
  })), "\xA0") : "", /*#__PURE__*/_react.default.createElement("span", {
64
- className: "blue-app-header-logo-title-labels " + (keepAppTitle ? "keep" : "")
64
+ className: "blue-header-logo-title-labels " + (keepAppTitle ? "keep" : "")
65
65
  }, appTitle ? /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("a", {
66
66
  href: "#"
67
67
  }, appTitle), " ", children ? "/" : "", "\xA0") : "", children)));