blue-react 8.8.1 → 9.0.0-alpha1

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