blue-react 9.12.1 → 10.0.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -4
- package/dist/components/HashRouter.js +219 -0
- package/dist/components/HeaderTitle.js +1 -1
- package/dist/components/Layout.js +70 -350
- package/dist/components/LegacyLayout.js +367 -0
- package/dist/components/LegacySidebarMenu.js +74 -0
- package/dist/components/SidebarMenu.js +5 -51
- package/dist/style.css +260 -1152
- package/dist/style.min.css +5 -5
- package/dist/style.scss +1 -1
- package/dist/types/components/HashRouter.d.ts +77 -0
- package/dist/types/components/Layout.d.ts +11 -139
- package/dist/types/components/LegacyLayout.d.ts +145 -0
- package/dist/types/components/LegacySidebarMenu.d.ts +33 -0
- package/index.js +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _SidebarToggler = _interopRequireDefault(require("./SidebarToggler"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
|
|
26
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
+
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
+
|
|
32
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
33
|
+
|
|
34
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
+
|
|
36
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
+
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
|
|
40
|
+
window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Consider to use the new `Layout` component instead.
|
|
44
|
+
* The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
|
|
45
|
+
* You can also append your own event listeners.
|
|
46
|
+
*
|
|
47
|
+
* Allowed events:
|
|
48
|
+
*
|
|
49
|
+
* * **componentDidUpdate** - Component was updated.
|
|
50
|
+
* Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
51
|
+
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
52
|
+
* Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
53
|
+
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
54
|
+
* Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
55
|
+
*
|
|
56
|
+
* Method to add event listeners:
|
|
57
|
+
* * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
|
|
58
|
+
*
|
|
59
|
+
* Methods to remove event listeners:
|
|
60
|
+
* * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
|
|
61
|
+
* * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
|
|
62
|
+
*/
|
|
63
|
+
var LegacyLayout = /*#__PURE__*/function (_Component) {
|
|
64
|
+
_inherits(LegacyLayout, _Component);
|
|
65
|
+
|
|
66
|
+
var _super = _createSuper(LegacyLayout);
|
|
67
|
+
|
|
68
|
+
function LegacyLayout(props) {
|
|
69
|
+
var _this;
|
|
70
|
+
|
|
71
|
+
_classCallCheck(this, LegacyLayout);
|
|
72
|
+
|
|
73
|
+
_this = _super.call(this, props);
|
|
74
|
+
window.blueLayoutRef = _assertThisInitialized(_this);
|
|
75
|
+
_this.defaultMatch = ["home"];
|
|
76
|
+
var expandSidebar = props.hideSidebarMenu ? false : props.expandSidebar !== undefined ? props.expandSidebar : localStorage.getItem("blueLayoutShrinkSidebar") === null;
|
|
77
|
+
_this.state = {
|
|
78
|
+
sidebarIn: props.sidebarIn || false,
|
|
79
|
+
expandSidebar: expandSidebar,
|
|
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
|
+
if (_this.props.onChangeExpandSidebar) _this.props.onChangeExpandSidebar(expandSidebar);
|
|
90
|
+
return _this;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_createClass(LegacyLayout, [{
|
|
94
|
+
key: "onHashChange",
|
|
95
|
+
value: function onHashChange() {
|
|
96
|
+
window.blueLayoutRef.initMatch();
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "componentDidMount",
|
|
100
|
+
value: function componentDidMount() {
|
|
101
|
+
var _this2 = this;
|
|
102
|
+
|
|
103
|
+
var me = this;
|
|
104
|
+
document.addEventListener("toggleSidebar", function () {
|
|
105
|
+
_this2.toggleSidebar(undefined);
|
|
106
|
+
}, false);
|
|
107
|
+
this.initMatch();
|
|
108
|
+
document.addEventListener("touchstart", function (event) {
|
|
109
|
+
var xPos = event.touches[0].pageX;
|
|
110
|
+
|
|
111
|
+
if (xPos < 5) {
|
|
112
|
+
me.toggleSidebar(event);
|
|
113
|
+
} else if (me.state.sidebarIn && xPos > 20) {
|
|
114
|
+
me.toggleSidebar(event);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
window.addEventListener("hashchange", this.onHashChange);
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
key: "componentWillUnmount",
|
|
121
|
+
value: function componentWillUnmount() {
|
|
122
|
+
window.removeEventListener("hashchange", this.onHashChange);
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "componentDidUpdate",
|
|
126
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
127
|
+
var _this3 = this;
|
|
128
|
+
|
|
129
|
+
if (prevProps.sidebarIn !== this.props.sidebarIn) {
|
|
130
|
+
this.setState({
|
|
131
|
+
sidebarIn: this.props.sidebarIn || false
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (this.props.onChangeSidebarIn && prevState.sidebarIn !== this.state.sidebarIn) {
|
|
136
|
+
this.props.onChangeSidebarIn(this.state.sidebarIn);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (prevProps.expandSidebar !== this.props.expandSidebar) {
|
|
140
|
+
this.setState({
|
|
141
|
+
expandSidebar: this.props.expandSidebar || false
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (this.props.onChangeExpandSidebar && prevState.expandSidebar !== this.state.expandSidebar) {
|
|
146
|
+
this.props.onChangeExpandSidebar(this.state.expandSidebar);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (prevProps.blockRouting !== this.props.blockRouting && this.props.blockRouting !== this.state.blockRouting) {
|
|
150
|
+
this.setState({
|
|
151
|
+
blockRouting: this.props.blockRouting
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this.eventListeners.forEach(function (eventListener) {
|
|
156
|
+
if (eventListener[0] === "componentDidUpdate") {
|
|
157
|
+
eventListener[1](prevProps, prevState);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (eventListener[0] === "pageDidShowAgain") {
|
|
161
|
+
var pageId = eventListener[1];
|
|
162
|
+
var callback = eventListener[2];
|
|
163
|
+
|
|
164
|
+
if (prevState.hash !== _this3.state.hash && _this3.state.match[0] === pageId) {
|
|
165
|
+
callback(prevProps, prevState);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (eventListener[0] === "pageDidHide") {
|
|
170
|
+
var _pageId = eventListener[1];
|
|
171
|
+
var _callback = eventListener[2];
|
|
172
|
+
|
|
173
|
+
if (prevState.hash !== _this3.state.hash && prevState.match[0] === _pageId) {
|
|
174
|
+
_callback(prevProps, prevState);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "toggleSidebar",
|
|
181
|
+
value: function toggleSidebar(event) {
|
|
182
|
+
if (this.state.sidebarIn) {
|
|
183
|
+
this.hideSidebar(event);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
this.setState({
|
|
187
|
+
sidebarIn: true
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
key: "hideSidebar",
|
|
192
|
+
value: function hideSidebar(e) {
|
|
193
|
+
if (!(e.target.classList.contains("blue-open-menu") || e.target.classList.contains("bi-menu") || e.target.classList.contains("blue-search") || e.target.classList.contains("blue-search-control") || e.target.classList.contains("blue-search-btn") || e.target.classList.contains("blue-search-btn-icon") || e.target.classList.contains("blue-menu-item-dropdown-toggle") || e.target.classList.contains("blue-menu-item-dropdown-caret") || e.target.classList.contains("blue-menu-item-dropdown-icon") || e.target.classList.contains("blue-sidebar-exception"))) {
|
|
194
|
+
this.setState({
|
|
195
|
+
sidebarIn: false
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "initMatch",
|
|
201
|
+
value: function initMatch() {
|
|
202
|
+
var newMatch;
|
|
203
|
+
|
|
204
|
+
if (window.location.hash && window.location.hash !== "" && window.location.hash !== "#/") {
|
|
205
|
+
newMatch = window.location.hash.replace("#", "").split("/").filter(function (n) {
|
|
206
|
+
return n !== "";
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
newMatch = this.defaultMatch;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (this.props.unrouteable) {
|
|
213
|
+
newMatch = this.defaultMatch;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (this.state.blockRouting && this.state.blockRouting(newMatch, this.state.match) === true) {
|
|
217
|
+
window.location.hash = this.state.hash;
|
|
218
|
+
} else {
|
|
219
|
+
if (!(this.state.history.indexOf(newMatch[0]) > -1)) {
|
|
220
|
+
this.state.history.push(newMatch[0]);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
this.setState({
|
|
224
|
+
match: newMatch,
|
|
225
|
+
history: this.state.history,
|
|
226
|
+
hash: window.location.hash,
|
|
227
|
+
hashHistory: this.state.hashHistory.concat([window.location.hash])
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, {
|
|
232
|
+
key: "addEventListener",
|
|
233
|
+
value: function addEventListener(param1, param2, param3, listenerId) {
|
|
234
|
+
this.eventListeners.push([param1, param2, param3, listenerId]);
|
|
235
|
+
this.removeDuplicatedEventListeners();
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
key: "removeEventListener",
|
|
239
|
+
value: function removeEventListener(type, listenerId) {
|
|
240
|
+
this.eventListeners = this.eventListeners.filter(function (param) {
|
|
241
|
+
if (param[0] !== type) {
|
|
242
|
+
return param;
|
|
243
|
+
} else if (param[0] === type && param[3] !== listenerId) {
|
|
244
|
+
return param;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "removeDuplicatedEventListeners",
|
|
250
|
+
value: function removeDuplicatedEventListeners() {
|
|
251
|
+
this.eventListeners = this.eventListeners.filter(function (value, index, self) {
|
|
252
|
+
return index === self.findIndex(function (t) {
|
|
253
|
+
return t[3] === value[3] && t[0] === value[0];
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}, {
|
|
258
|
+
key: "toggleExpandSidebar",
|
|
259
|
+
value: function toggleExpandSidebar() {
|
|
260
|
+
var expandSidebar = this.state.expandSidebar;
|
|
261
|
+
|
|
262
|
+
if (expandSidebar) {
|
|
263
|
+
localStorage.setItem("blueLayoutShrinkSidebar", "true");
|
|
264
|
+
} else {
|
|
265
|
+
localStorage.removeItem("blueLayoutShrinkSidebar");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
this.setState({
|
|
269
|
+
expandSidebar: !expandSidebar
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
273
|
+
key: "render",
|
|
274
|
+
value: function render() {
|
|
275
|
+
var _this4 = this,
|
|
276
|
+
_this$props$pages;
|
|
277
|
+
|
|
278
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
279
|
+
id: this.props.id ? this.props.id : "",
|
|
280
|
+
style: this.props.style ? this.props.style : {},
|
|
281
|
+
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" : ""),
|
|
282
|
+
onClick: this.hideSidebar
|
|
283
|
+
}, !this.props.hideSidebarMenu && /*#__PURE__*/_react.default.createElement(_SidebarToggler.default, {
|
|
284
|
+
sidebarToggleIconComponent: this.props.sidebarToggleIconComponent,
|
|
285
|
+
onClick: function onClick() {
|
|
286
|
+
_this4.setState({
|
|
287
|
+
sidebarIn: !_this4.state.sidebarIn
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}), !this.props.hideSidebarMenu && !this.props.hideToggleExpandSidebar && /*#__PURE__*/_react.default.createElement(_SidebarToggler.default, {
|
|
291
|
+
sidebarToggleIconComponent: this.props.sidebarToggleIconComponent,
|
|
292
|
+
onClick: this.toggleExpandSidebar,
|
|
293
|
+
className: "d-none d-xxl-block"
|
|
294
|
+
}), this.props.children, (_this$props$pages = this.props.pages) === null || _this$props$pages === void 0 ? void 0 : _this$props$pages.map(function (page) {
|
|
295
|
+
return _this4.state.history.indexOf(page.name) > -1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
296
|
+
key: page.name,
|
|
297
|
+
className: "router-page " + (_this4.state.match[0] === page.name ? "active" : "")
|
|
298
|
+
}, page.component);
|
|
299
|
+
}), this.props.enableStatus && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
300
|
+
className: "blue-status-circle blue-loading blue-status-loading"
|
|
301
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
302
|
+
className: "spinner-bounce-circle"
|
|
303
|
+
}, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
304
|
+
className: "blue-status-circle blue-status-success",
|
|
305
|
+
role: "status",
|
|
306
|
+
"aria-live": "polite"
|
|
307
|
+
}, this.props.statusIcons.success), /*#__PURE__*/_react.default.createElement("div", {
|
|
308
|
+
className: "blue-status-circle blue-status-info"
|
|
309
|
+
}, this.props.statusIcons.info), /*#__PURE__*/_react.default.createElement("div", {
|
|
310
|
+
className: "blue-status-circle blue-status-warning"
|
|
311
|
+
}, this.props.statusIcons.warning), /*#__PURE__*/_react.default.createElement("div", {
|
|
312
|
+
className: "blue-status-circle blue-status-danger"
|
|
313
|
+
}, this.props.statusIcons.danger), /*#__PURE__*/_react.default.createElement("div", {
|
|
314
|
+
className: "blue-status-alert alert"
|
|
315
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
316
|
+
type: "button",
|
|
317
|
+
className: "btn-close float-end mb-1",
|
|
318
|
+
"aria-label": "Close"
|
|
319
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
320
|
+
className: "alert-body"
|
|
321
|
+
})))));
|
|
322
|
+
}
|
|
323
|
+
}], [{
|
|
324
|
+
key: "defaultProps",
|
|
325
|
+
get: function get() {
|
|
326
|
+
return {
|
|
327
|
+
hideSidebarMenu: false,
|
|
328
|
+
unrouteable: false,
|
|
329
|
+
disableTitleSet: false,
|
|
330
|
+
sidebarToggleIconComponent: /*#__PURE__*/_react.default.createElement("svg", {
|
|
331
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
332
|
+
width: "1em",
|
|
333
|
+
height: "1em",
|
|
334
|
+
fill: "currentColor",
|
|
335
|
+
viewBox: "0 0 16 16",
|
|
336
|
+
style: {
|
|
337
|
+
display: "inline-block",
|
|
338
|
+
verticalAlign: "-0.125em"
|
|
339
|
+
}
|
|
340
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
341
|
+
fillRule: "evenodd",
|
|
342
|
+
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"
|
|
343
|
+
})),
|
|
344
|
+
enableStatus: true,
|
|
345
|
+
statusIcons: {
|
|
346
|
+
danger: /*#__PURE__*/_react.default.createElement("span", {
|
|
347
|
+
className: "bi-error"
|
|
348
|
+
}),
|
|
349
|
+
info: /*#__PURE__*/_react.default.createElement("span", {
|
|
350
|
+
className: "bi-information"
|
|
351
|
+
}),
|
|
352
|
+
success: /*#__PURE__*/_react.default.createElement("span", {
|
|
353
|
+
className: "bi-check"
|
|
354
|
+
}),
|
|
355
|
+
warning: /*#__PURE__*/_react.default.createElement("span", {
|
|
356
|
+
className: "bi-sign_warning"
|
|
357
|
+
})
|
|
358
|
+
},
|
|
359
|
+
hideToggleExpandSidebar: false
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}]);
|
|
363
|
+
|
|
364
|
+
return LegacyLayout;
|
|
365
|
+
}(_react.Component);
|
|
366
|
+
|
|
367
|
+
exports.default = LegacyLayout;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = LegacySidebarMenu;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
23
|
+
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use the new `SidebarMenu` component instead.
|
|
30
|
+
* Sidebar for the `Layout` component.
|
|
31
|
+
*/
|
|
32
|
+
function LegacySidebarMenu(props) {
|
|
33
|
+
var _useState = (0, _react.useState)(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
hasShadow = _useState2[0],
|
|
36
|
+
setHasShadow = _useState2[1];
|
|
37
|
+
|
|
38
|
+
var updateDimensions = function updateDimensions() {
|
|
39
|
+
if (window.innerHeight > 500) {
|
|
40
|
+
setHasShadow(false);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
(0, _react.useEffect)(function () {
|
|
45
|
+
var blueAppSidebar = document.querySelector(".blue-sidebar");
|
|
46
|
+
window.addEventListener("resize", updateDimensions);
|
|
47
|
+
|
|
48
|
+
if (blueAppSidebar.scrollHeight > blueAppSidebar.clientHeight) {
|
|
49
|
+
setHasShadow(true);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
blueAppSidebar.addEventListener("scroll", function () {
|
|
53
|
+
if (blueAppSidebar.scrollHeight - blueAppSidebar.scrollTop === blueAppSidebar.clientHeight) {
|
|
54
|
+
setHasShadow(false);
|
|
55
|
+
} else {
|
|
56
|
+
setHasShadow(true);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return function () {
|
|
60
|
+
window.removeEventListener("resize", updateDimensions);
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: "blue-sidebar " + (props.sidebarClass ? props.sidebarClass : ""),
|
|
65
|
+
style: props.sidebarStyle ? props.sidebarStyle : {}
|
|
66
|
+
}, props.topContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "blue-sidebar-top"
|
|
68
|
+
}, props.topContent), /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: "blue-menu " + (props.menuClass ? props.menuClass : ""),
|
|
70
|
+
style: props.menuStyle ? props.menuStyle : {}
|
|
71
|
+
}, props.children), props.bottomContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
+
className: "blue-sidebar-bottom " + (hasShadow ? " has-shadow" : "")
|
|
73
|
+
}, props.bottomContent));
|
|
74
|
+
}
|
|
@@ -1,73 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = SidebarMenu;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
12
|
-
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); }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
-
|
|
18
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
-
|
|
20
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
9
|
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
-
|
|
26
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
11
|
|
|
28
12
|
/**
|
|
29
13
|
* Sidebar for the `Layout` component.
|
|
30
14
|
*/
|
|
31
15
|
function SidebarMenu(props) {
|
|
32
|
-
var _useState = (0, _react.useState)(false),
|
|
33
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
-
hasShadow = _useState2[0],
|
|
35
|
-
setHasShadow = _useState2[1];
|
|
36
|
-
|
|
37
|
-
var updateDimensions = function updateDimensions() {
|
|
38
|
-
if (window.innerHeight > 500) {
|
|
39
|
-
setHasShadow(false);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
(0, _react.useEffect)(function () {
|
|
44
|
-
var blueAppSidebar = document.querySelector(".blue-sidebar");
|
|
45
|
-
window.addEventListener("resize", updateDimensions);
|
|
46
|
-
|
|
47
|
-
if (blueAppSidebar.scrollHeight > blueAppSidebar.clientHeight) {
|
|
48
|
-
setHasShadow(true);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
blueAppSidebar.addEventListener("scroll", function () {
|
|
52
|
-
if (blueAppSidebar.scrollHeight - blueAppSidebar.scrollTop === blueAppSidebar.clientHeight) {
|
|
53
|
-
setHasShadow(false);
|
|
54
|
-
} else {
|
|
55
|
-
setHasShadow(true);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
return function () {
|
|
59
|
-
window.removeEventListener("resize", updateDimensions);
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
16
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
-
className: "
|
|
17
|
+
className: "d-flex flex-column h-100 " + (props.sidebarClass ? props.sidebarClass : ""),
|
|
64
18
|
style: props.sidebarStyle ? props.sidebarStyle : {}
|
|
65
19
|
}, props.topContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
66
20
|
className: "blue-sidebar-top"
|
|
67
21
|
}, props.topContent), /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
-
className: "
|
|
22
|
+
className: "flex-grow-1 overflow-auto " + (props.menuClass ? props.menuClass : ""),
|
|
69
23
|
style: props.menuStyle ? props.menuStyle : {}
|
|
70
24
|
}, props.children), props.bottomContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
71
|
-
className: "
|
|
25
|
+
className: " "
|
|
72
26
|
}, props.bottomContent));
|
|
73
27
|
}
|