@gpa-gemstone/common-pages 0.0.98 → 0.0.100

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ interface IError {
3
+ name: string;
4
+ message: string;
5
+ }
6
+ interface IProps {
7
+ HeaderErrorMessage: string;
8
+ BodyErrorMessage: string;
9
+ Height: number | string;
10
+ Width: number | string;
11
+ }
12
+ export default class ErrorBoundary extends React.Component<IProps, IError> {
13
+ constructor(props: IProps);
14
+ componentDidCatch(error: IError): void;
15
+ render(): JSX.Element;
16
+ }
17
+ export {};
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ //******************************************************************************************************
3
+ // ErrorBoundary.tsx - Gbtc
4
+ //
5
+ // Copyright (c) 2024, Grid Protection Alliance. All Rights Reserved.
6
+ //
7
+ // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
+ // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
+ // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
+ // file except in compliance with the License. You may obtain a copy of the License at:
11
+ //
12
+ // http://opensource.org/licenses/MIT
13
+ //
14
+ // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
+ // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
+ // License for the specific language governing permissions and limitations.
17
+ //
18
+ // Code Modification History:
19
+ // ----------------------------------------------------------------------------------------------------
20
+ // 05/02/2024 - Preton Crawford
21
+ // Generated original version of source code.
22
+ //
23
+ //******************************************************************************************************
24
+ var __extends = (this && this.__extends) || (function () {
25
+ var extendStatics = function (d, b) {
26
+ extendStatics = Object.setPrototypeOf ||
27
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29
+ return extendStatics(d, b);
30
+ };
31
+ return function (d, b) {
32
+ if (typeof b !== "function" && b !== null)
33
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
34
+ extendStatics(d, b);
35
+ function __() { this.constructor = d; }
36
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ var React = require("react");
41
+ var react_interactive_1 = require("@gpa-gemstone/react-interactive");
42
+ var ErrorBoundary = /** @class */ (function (_super) {
43
+ __extends(ErrorBoundary, _super);
44
+ function ErrorBoundary(props) {
45
+ var _this = _super.call(this, props) || this;
46
+ _this.state = { name: "", message: "" };
47
+ return _this;
48
+ }
49
+ ErrorBoundary.prototype.componentDidCatch = function (error) {
50
+ this.setState({
51
+ name: error.name,
52
+ message: error.message
53
+ });
54
+ console.warn(error);
55
+ };
56
+ ErrorBoundary.prototype.render = function () {
57
+ if (this.state.name.length > 0) {
58
+ return (React.createElement("div", { className: "card", style: { width: this.props.Width, height: this.props.Height } },
59
+ React.createElement("div", { className: "card-header" }, this.props.HeaderErrorMessage),
60
+ React.createElement("div", { className: "card-body" },
61
+ React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Label: this.props.BodyErrorMessage, Size: 150 }))));
62
+ }
63
+ else
64
+ return React.createElement(React.Fragment, null, this.props.children);
65
+ };
66
+ return ErrorBoundary;
67
+ }(React.Component));
68
+ exports.default = ErrorBoundary;
package/lib/index.d.ts CHANGED
@@ -7,4 +7,5 @@ import User from './user/User';
7
7
  import { DefaultSearch } from './SearchBar';
8
8
  import SelectPopup from './StandardSelectPopup';
9
9
  import { DefaultSelects } from './SelectionPopup';
10
- export { Setting, Note, ValueList, ByValueList, User, ByUser, DefaultSearch, SelectPopup, DefaultSelects };
10
+ import ErrorBoundary from './ErrorBoundary';
11
+ export { Setting, Note, ValueList, ByValueList, User, ByUser, DefaultSearch, SelectPopup, DefaultSelects, ErrorBoundary };
package/lib/index.js CHANGED
@@ -22,7 +22,7 @@
22
22
  //
23
23
  // ******************************************************************************************************
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.DefaultSelects = exports.SelectPopup = exports.DefaultSearch = exports.ByUser = exports.User = exports.ByValueList = exports.ValueList = exports.Note = exports.Setting = void 0;
25
+ exports.ErrorBoundary = exports.DefaultSelects = exports.SelectPopup = exports.DefaultSearch = exports.ByUser = exports.User = exports.ByValueList = exports.ValueList = exports.Note = exports.Setting = void 0;
26
26
  var Setting_1 = require("./Setting");
27
27
  exports.Setting = Setting_1.default;
28
28
  var Note_1 = require("./Note");
@@ -41,3 +41,5 @@ var StandardSelectPopup_1 = require("./StandardSelectPopup");
41
41
  exports.SelectPopup = StandardSelectPopup_1.default;
42
42
  var SelectionPopup_1 = require("./SelectionPopup");
43
43
  Object.defineProperty(exports, "DefaultSelects", { enumerable: true, get: function () { return SelectionPopup_1.DefaultSelects; } });
44
+ var ErrorBoundary_1 = require("./ErrorBoundary");
45
+ exports.ErrorBoundary = ErrorBoundary_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/common-pages",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "description": "Common UI pages for GPA products",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,12 +44,12 @@
44
44
  "typescript": "4.4.4"
45
45
  },
46
46
  "dependencies": {
47
- "@gpa-gemstone/application-typings": "0.0.68",
48
- "@gpa-gemstone/gpa-symbols": "0.0.30",
47
+ "@gpa-gemstone/application-typings": "0.0.69",
48
+ "@gpa-gemstone/gpa-symbols": "0.0.31",
49
49
  "@gpa-gemstone/helper-functions": "0.0.30",
50
- "@gpa-gemstone/react-forms": "1.1.57",
51
- "@gpa-gemstone/react-interactive": "1.0.113",
52
- "@gpa-gemstone/react-table": "1.2.40",
50
+ "@gpa-gemstone/react-forms": "1.1.58",
51
+ "@gpa-gemstone/react-interactive": "1.0.115",
52
+ "@gpa-gemstone/react-table": "1.2.41",
53
53
  "@reduxjs/toolkit": "1.8.3",
54
54
  "crypto-js": "4.0.0",
55
55
  "moment": "^2.29.4",