blue-react 8.4.1 → 8.4.2

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,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -13,7 +13,7 @@ var _excluded = ["label"];
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
17
 
18
18
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
19
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -21,11 +21,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
21
21
 
22
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
23
 
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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
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); }
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
27
 
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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
29
 
30
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
31
 
@@ -35,7 +35,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
35
35
 
36
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
37
 
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
39
 
40
40
  window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
41
41
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -19,7 +19,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
23
 
24
24
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
25
 
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.useOutside = useOutside;
9
8
  exports.default = Outside;
9
+ exports.useOutside = useOutside;
10
10
 
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.StatusProvider = exports.useStatus = void 0;
8
+ exports.useStatus = exports.StatusProvider = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
@@ -19,7 +19,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
23
 
24
24
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
25
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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); }
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -3,22 +3,39 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addClass = addClass;
6
7
  exports.default = void 0;
7
- var Utilities = {};
8
-
9
- Utilities.hasClass = function (el, className) {
8
+ exports.fetchData = fetchData;
9
+ exports.finishLoading = finishLoading;
10
+ exports.guid = void 0;
11
+ exports.hasClass = hasClass;
12
+ exports.hideSuccess = hideSuccess;
13
+ exports.removeClass = removeClass;
14
+ exports.resetAlertMessage = resetAlertMessage;
15
+ exports.scrollToTop = scrollToTop;
16
+ exports.setAlertMessage = setAlertMessage;
17
+ exports.showSuccess = showSuccess;
18
+ exports.startLoading = startLoading;
19
+ exports.toggleActions = toggleActions;
20
+ exports.toggleClass = toggleClass;
21
+
22
+ function hasClass(el, className) {
10
23
  if (el.classList) return el.classList.contains(className);else return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
11
- };
24
+ }
12
25
 
13
- Utilities.addClass = function (el, className) {
14
- if (el.classList) el.classList.add(className);else if (!Utilities.hasClass(el, className)) el.className += " " + className;
15
- };
26
+ function addClass(el, className) {
27
+ if (el.classList) el.classList.add(className);else if (!hasClass(el, className)) el.className += " " + className;
28
+ }
16
29
 
17
- Utilities.removeClass = function (el, className) {
18
- if (el.classList) el.classList.remove(className);else if (Utilities.hasClass(el, className)) el.className = el.className.replace(new RegExp("(\\s|^)" + className + "(\\s|$)"), " ");
19
- };
30
+ function removeClass(el, className) {
31
+ if (el.classList) el.classList.remove(className);else if (hasClass(el, className)) el.className = el.className.replace(new RegExp("(\\s|^)" + className + "(\\s|$)"), " ");
32
+ }
33
+ /**
34
+ * @deprecated Use (el as HTMLElement).classList.toggle("my-class") instead.
35
+ */
20
36
 
21
- Utilities.toggleClass = function (element, className) {
37
+
38
+ function toggleClass(element, className) {
22
39
  if (!element || !className) {
23
40
  return;
24
41
  }
@@ -33,102 +50,113 @@ Utilities.toggleClass = function (element, className) {
33
50
  }
34
51
 
35
52
  element.className = classString;
36
- };
37
-
38
- Utilities.startLoading = function () {
39
- document.querySelectorAll(".blue-loading")[0].style.display = "block";
40
- };
41
-
42
- Utilities.finishLoading = function () {
43
- document.querySelectorAll(".blue-loading")[0].style.display = "";
44
- };
45
-
46
- Utilities.showSuccess = function () {
47
- document.querySelectorAll(".blue-status-success")[0].style.display = "flex";
48
- };
49
-
50
- Utilities.hideSuccess = function () {
51
- document.querySelectorAll(".blue-status-success")[0].style.display = "";
52
- };
53
-
54
- Utilities.toggleActions = function () {
55
- this.toggleClass(document.querySelector(".blue-wrapper"), "active");
56
- this.toggleClass(document.querySelector(".blue-layout"), "wrapper-in");
53
+ }
54
+
55
+ function startLoading() {
56
+ ;
57
+ document.querySelector(".blue-loading").style.display = "block";
58
+ }
59
+
60
+ function finishLoading() {
61
+ ;
62
+ document.querySelector(".blue-loading").style.display = "";
63
+ }
64
+
65
+ function showSuccess() {
66
+ ;
67
+ document.querySelector(".blue-status-success").style.display = "flex";
68
+ }
69
+
70
+ function hideSuccess() {
71
+ ;
72
+ document.querySelector(".blue-status-success").style.display = "";
73
+ }
74
+
75
+ function toggleActions() {
76
+ toggleClass(document.querySelector(".blue-wrapper"), "active");
77
+ toggleClass(document.querySelector(".blue-layout"), "wrapper-in");
57
78
  var els = document.querySelectorAll(".blue-actions");
58
79
 
59
80
  for (var i = 0; i < els.length; i++) {
60
- this.toggleClass(els[i], "open");
81
+ toggleClass(els[i], "open");
61
82
  }
62
- };
63
-
64
- Utilities.resetAlertMessage = function () {
65
- var alertClassName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "info";
66
- var alertElement = document.querySelectorAll(".blue-status-alert")[0];
67
- document.querySelectorAll(".blue-status-" + alertClassName)[0].style.display = "";
68
- alertElement.style.display = "";
69
- this.removeClass(alertElement, "alert-" + (alertClassName === "loading" ? "info" : alertClassName));
70
- };
71
-
72
- Utilities.setAlertMessage = function (message) {
73
- var _this = this;
83
+ }
84
+ /**
85
+ * Resets alert messages that was set with `setAlertMessage`.
86
+ * @param alertClassName Leave empty to reset messages of any status type
87
+ */
88
+
89
+
90
+ function resetAlertMessage(alertClassName) {
91
+ if (!alertClassName) {
92
+ ;
93
+ ["loading", "success", "info", "warning", "danger"].forEach(function (status) {
94
+ resetAlertMessage(status);
95
+ });
96
+ } else {
97
+ var alertElement = document.querySelector(".blue-status-alert");
98
+ document.querySelector(".blue-status-" + alertClassName).style.display = "";
99
+ alertElement.style.display = "";
100
+ removeClass(alertElement, "alert-" + (alertClassName === "loading" ? "info" : alertClassName));
101
+ }
102
+ }
74
103
 
104
+ function setAlertMessage(message) {
75
105
  var alertClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "info";
76
- var close = arguments.length > 2 ? arguments[2] : undefined;
106
+ var close = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
77
107
  var detailText = arguments.length > 3 ? arguments[3] : undefined;
78
- var alertElement = document.querySelectorAll(".blue-status-alert")[0];
79
-
80
- if (alertClassName.indexOf("alert-") > -1) {
81
- alertClassName = alertClassName.replace("alert-", "");
82
- }
83
-
84
- document.querySelectorAll(".blue-status-" + alertClassName)[0].style.display = "flex";
108
+ var alertElement = document.querySelector(".blue-status-alert");
109
+ document.querySelector(".blue-status-" + alertClassName).style.display = "flex";
85
110
  alertElement.style.display = "block";
86
- this.addClass(alertElement, "alert-" + (alertClassName === "loading" ? "info" : alertClassName));
111
+ addClass(alertElement, "alert-" + (alertClassName === "loading" ? "info" : alertClassName));
87
112
  alertElement.querySelector(".alert-body").innerHTML = "<h2>" + message + "</h2>";
88
113
 
89
114
  if (detailText) {
90
115
  alertElement.querySelector(".alert-body").innerHTML += "<span>" + detailText + "</span>";
91
116
  }
92
117
 
118
+ var btnCloseElement = alertElement.querySelector(".btn-close");
119
+
93
120
  if (close) {
94
- alertElement.querySelector(".btn-close").style.display = "inline-block";
121
+ btnCloseElement.style.display = "inline-block";
95
122
 
96
- alertElement.querySelector(".btn-close").onclick = function () {
97
- _this.resetAlertMessage(alertClassName);
123
+ btnCloseElement.onclick = function () {
124
+ resetAlertMessage(alertClassName);
98
125
  };
99
126
  } else {
100
- alertElement.querySelector(".btn-close").style.display = "none";
127
+ btnCloseElement.style.display = "none";
101
128
  }
102
- };
129
+ }
103
130
 
104
- Utilities.guid = function () {
105
- function s4() {
106
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
107
- }
131
+ function s4() {
132
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
133
+ }
108
134
 
135
+ var guid = function guid() {
109
136
  return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
110
137
  };
111
138
 
112
- Utilities.scrollToTop = function () {
139
+ exports.guid = guid;
140
+
141
+ function scrollToTop() {
113
142
  var routerPage = document.querySelector(".router-page.active");
114
143
  routerPage.scroll({
115
144
  behavior: "smooth",
116
145
  left: 0,
117
146
  top: 0
118
147
  });
119
- };
148
+ }
120
149
 
121
- Utilities.fetchData = function (input) {
122
- var init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
150
+ function fetchData(input, init) {
123
151
  var showErrorDetail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
124
- var onError = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
152
+ var onError = arguments.length > 3 ? arguments[3] : undefined;
125
153
  return fetch(input, init).then(function (response) {
126
154
  if (!response.ok) throw response;
127
155
  return response;
128
156
  }).catch(function (reason) {
129
157
  if (reason.text) {
130
158
  reason.text().then(function (errorMessage) {
131
- Utilities.setAlertMessage("".concat(reason.status, " - ").concat(reason.statusText), "danger", true, showErrorDetail ? errorMessage : undefined);
159
+ setAlertMessage("".concat(reason.status, " - ").concat(reason.statusText), "danger", true, showErrorDetail ? errorMessage : undefined);
132
160
 
133
161
  if (onError) {
134
162
  onError(errorMessage, reason);
@@ -138,7 +166,22 @@ Utilities.fetchData = function (input) {
138
166
 
139
167
  throw reason;
140
168
  });
169
+ }
170
+
171
+ var _default = {
172
+ hasClass: hasClass,
173
+ addClass: addClass,
174
+ removeClass: removeClass,
175
+ toggleClass: toggleClass,
176
+ startLoading: startLoading,
177
+ finishLoading: finishLoading,
178
+ showSuccess: showSuccess,
179
+ hideSuccess: hideSuccess,
180
+ toggleActions: toggleActions,
181
+ resetAlertMessage: resetAlertMessage,
182
+ setAlertMessage: setAlertMessage,
183
+ guid: guid,
184
+ scrollToTop: scrollToTop,
185
+ fetchData: fetchData
141
186
  };
142
-
143
- var _default = Utilities;
144
187
  exports.default = _default;