@gpa-gemstone/common-pages 0.0.61 → 0.0.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/common-pages",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "description": "Common UI pages for GPA products",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -51,7 +51,7 @@
51
51
  "@gpa-gemstone/gpa-symbols": "0.0.23",
52
52
  "@gpa-gemstone/helper-functions": "0.0.18",
53
53
  "@gpa-gemstone/react-forms": "1.1.35",
54
- "@gpa-gemstone/react-interactive": "1.0.76",
54
+ "@gpa-gemstone/react-interactive": "1.0.77",
55
55
  "@gpa-gemstone/react-table": "1.2.20",
56
56
  "@reduxjs/toolkit": "1.8.3",
57
57
  "crypto-js": "4.0.0",
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- interface IProps {
3
- Show: boolean;
4
- Label?: string;
5
- Size?: number;
6
- }
7
- declare const LoadingIcon: React.FunctionComponent<IProps>;
8
- export default LoadingIcon;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // LoadingIcon.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 01/11/2020 - Christoph Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
24
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
25
- return cooked;
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- var React = require("react");
29
- var styled_components_1 = require("styled-components");
30
- var spin = styled_components_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n"], ["\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n"])));
31
- var Icon = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tanimation: ", " 1s linear infinite;\n\tborder: ", "px solid #f3f3f3;\n\tborder-Top: ", "px solid #555;\n\tborder-Radius: 50%;\n\twidth: ", "px;\n\theight: ", "px\n"], ["\n\tanimation: ", " 1s linear infinite;\n\tborder: ", "px solid #f3f3f3;\n\tborder-Top: ", "px solid #555;\n\tborder-Radius: 50%;\n\twidth: ", "px;\n\theight: ", "px\n"])), spin, function (props) { return props.size / 5; }, function (props) { return props.size / 5; }, function (props) { return props.size; }, function (props) { return props.size; });
32
- var LoadingIcon = function (props) {
33
- var h = (props.Size === undefined ? 25 : props.Size);
34
- return (React.createElement("div", null,
35
- React.createElement("div", { style: { width: (props.Label === undefined ? h : undefined), margin: 'auto' }, hidden: !props.Show },
36
- React.createElement(Icon, { size: h }),
37
- props.Label !== undefined ? React.createElement("span", null, props.Label) : null)));
38
- };
39
- exports.default = LoadingIcon;
40
- var templateObject_1, templateObject_2;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- interface IProps {
3
- Show: boolean;
4
- }
5
- declare const LoadingScreen: React.FunctionComponent<IProps>;
6
- export default LoadingScreen;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // LoadingScreen.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 01/11/2020 - Christoph Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- var React = require("react");
25
- var LoadingIcon_1 = require("./LoadingIcon");
26
- var LoadingScreen = function (props) {
27
- var x = window.innerHeight / 2 - 20;
28
- return (props.Show ? React.createElement("div", { style: {
29
- width: '100%',
30
- height: '100%',
31
- position: 'fixed',
32
- top: 0,
33
- left: 0,
34
- opacity: 0.5,
35
- backgroundColor: '#000000',
36
- zIndex: 9980,
37
- } },
38
- React.createElement("div", { style: { height: '40px', width: '40px', margin: 'auto', marginTop: x } },
39
- React.createElement(LoadingIcon_1.default, { Show: true, Size: 40 }))) : null);
40
- };
41
- exports.default = LoadingScreen;
package/lib/Modal.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import * as React from 'react';
2
- interface IProps {
3
- Title: string;
4
- ShowX?: boolean;
5
- CallBack: ((confirmed: boolean, isButton?: boolean) => void);
6
- Show: boolean;
7
- Size?: ('lg' | 'sm' | 'xlg');
8
- ShowCancel?: boolean;
9
- DisableConfirm?: boolean;
10
- DisableCancel?: boolean;
11
- CancelText?: string;
12
- ConfirmText?: string;
13
- ConfirmBtnClass?: string;
14
- CancelBtnClass?: string;
15
- ConfirmShowToolTip?: boolean;
16
- CancelShowToolTip?: boolean;
17
- ConfirmToolTipContent?: React.ReactNode;
18
- CancelToolTipContent?: React.ReactNode;
19
- }
20
- declare const Modal: React.FunctionComponent<IProps>;
21
- export default Modal;
package/lib/Modal.js DELETED
@@ -1,79 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // Modal.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 12/29/2020 - Christoph Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- var React = require("react");
25
- var ToolTip_1 = require("./ToolTip");
26
- var helper_functions_1 = require("@gpa-gemstone/helper-functions");
27
- // Props Description:
28
- // Title => Title of The Modal
29
- // ShowX => show or hide the X button (default true)
30
- // CallBack => Function to be called when closing the Modal either through Cancel (confirmed=false) or Accept Button (confirmed=true)
31
- // Show => Whether to show the modal
32
- // Size => Size of the modal
33
- // ShowCancel => Whether to show the cancel button
34
- // DisableConfirm => Disables the Confirm button
35
- // CancelText => Text on Cancel Button
36
- // Confirm text => Text on Confirm button
37
- // ConfirmBtnClass => Class of the Confirm Button
38
- // CancelBtnClass =>> Class of the Cancel Button
39
- var Modal = function (props) {
40
- var _a = React.useState('none'), hover = _a[0], setHover = _a[1];
41
- var _b = React.useState(''), guid = _b[0], setGuid = _b[1];
42
- React.useEffect(function () {
43
- setGuid(helper_functions_1.CreateGuid());
44
- }, []);
45
- var confirmBtn = (props.ConfirmText === undefined ? 'Save' : props.ConfirmText);
46
- var cxnBtn = (props.CancelText === undefined ? 'Cancel' : props.CancelText);
47
- var cxnbtnCls = 'btn ' + (props.CancelBtnClass === undefined ? 'btn-danger' : props.CancelBtnClass);
48
- var confirmbtnCls = 'btn ' + (props.ConfirmBtnClass === undefined ? 'btn-primary' : props.ConfirmBtnClass);
49
- var showConfirmToolTip = (props.ConfirmShowToolTip !== undefined && props.ConfirmShowToolTip) && hover === 'confirm';
50
- var showCxnToolTip = (props.CancelShowToolTip !== undefined && props.CancelShowToolTip) && hover === 'cancel';
51
- return (React.createElement(React.Fragment, null,
52
- React.createElement("div", { className: "modal" + (props.Show ? " show" : ''), style: props.Show ? { display: 'block', zIndex: 9990 } : {} },
53
- React.createElement("div", { className: "modal-dialog" + (props.Size === undefined ? '' : props.Size === 'xlg' ? '' : (" modal-" + props.Size)), style: props.Size === 'xlg' ? { maxWidth: window.innerWidth - 100 } : {} },
54
- React.createElement("div", { className: "modal-content" },
55
- React.createElement("div", { className: "modal-header" },
56
- React.createElement("h4", { className: "modal-title" }, props.Title),
57
- props.ShowX ? React.createElement("button", { type: "button", className: "close", onClick: function () { return props.CallBack(false, false); } }, "\u00D7") : null),
58
- React.createElement("div", { className: "modal-body" }, props.Show ? props.children : null),
59
- React.createElement("div", { className: "modal-footer" },
60
- React.createElement("button", { type: "button", className: confirmbtnCls + (!(props.DisableConfirm === undefined || !props.DisableConfirm) ? ' disabled' : ''), "data-tooltip": guid + '-confirm', onClick: function () { if (!(props.DisableConfirm === undefined || !props.DisableConfirm))
61
- return; props.CallBack(true, true); }, onMouseEnter: function () { return setHover('confirm'); }, onMouseLeave: function () { return setHover('none'); } }, confirmBtn),
62
- props.ShowCancel === undefined || props.ShowCancel ?
63
- React.createElement("button", { type: "button", className: cxnbtnCls + (!(props.DisableCancel === undefined || !props.DisableCancel) ? ' disabled' : ''), "data-tooltip": guid + '-cancel', onClick: function () { if (!(props.DisableCancel === undefined || !props.DisableCancel))
64
- return; props.CallBack(false, true); }, onMouseEnter: function () { return setHover('cancel'); }, onMouseLeave: function () { return setHover('none'); } }, cxnBtn)
65
- : null)))),
66
- React.createElement(ToolTip_1.default, { Show: showConfirmToolTip, Position: 'top', Theme: 'dark', Target: guid + '-confirm', Zindex: 9999 }, props.ConfirmToolTipContent),
67
- React.createElement(ToolTip_1.default, { Show: showCxnToolTip, Position: 'top', Theme: 'dark', Target: guid + '-cancel', Zindex: 9999 }, props.CancelToolTipContent),
68
- props.Show ? React.createElement("div", { style: {
69
- width: '100%',
70
- height: '100%',
71
- position: 'fixed',
72
- top: 0,
73
- left: 0,
74
- opacity: 0.5,
75
- backgroundColor: '#ffffff',
76
- zIndex: 9980,
77
- } }) : null));
78
- };
79
- exports.default = Modal;
package/lib/ToolTip.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- interface IProps {
3
- Show: boolean;
4
- Position?: ('top' | 'bottom' | 'left' | 'right');
5
- Theme?: ('dark' | 'light');
6
- Target?: string;
7
- Zindex?: number;
8
- }
9
- declare const ToolTip: React.FunctionComponent<IProps>;
10
- export default ToolTip;
package/lib/ToolTip.js DELETED
@@ -1,87 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // ToolTip.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 01/14/2021 - Christoph Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
24
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
25
- return cooked;
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- var React = require("react");
29
- var styled_components_1 = require("styled-components");
30
- var helper_functions_1 = require("@gpa-gemstone/helper-functions");
31
- var WrapperDiv = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n & {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n z-index: ", ";\n opacity: ", ";\n color: ", ";\n background: ", ";\n top: ", ";\n left: ", ";\n border: 1px solid transparent;\n }\n ", "\n ", "\n ", "\n ", ""], ["\n & {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n z-index: ", ";\n opacity: ", ";\n color: ", ";\n background: ", ";\n top: ", ";\n left: ", ";\n border: 1px solid transparent;\n }\n ",
32
- "\n ",
33
- "\n ",
34
- "\n ",
35
- ""
36
- // The other element needs to be labeld as data-tooltip that will only be used for positioning
37
- ])), function (props) { return props.Zindex; }, function (props) { return props.Show ? "0.9" : "0"; }, function (props) { return (props.Theme === 'dark' ? "#fff" : '#222'); }, function (props) { return (props.Theme === 'dark' ? "#222" : '#fff'); }, function (props) { return props.Top + "px"; }, function (props) { return props.Left + "px"; }, function (props) { return (props.Location === 'top' ? "\n &::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n border-top: 8px solid " + (props.Theme === 'dark' ? "#222" : '#fff') + ";\n left: 50%;\n bottom: -6px;\n margin-left: -8px;\n content: \"\";\n width: 0px;\n height: 0px;\n position: absolute\n }\n " : ''); }, function (props) { return (props.Location === 'bottom' ? "\n &::before {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n border-bottom: 8px solid " + (props.Theme === 'dark' ? "#222" : '#fff') + ";\n left: 50%;\n top: -6px;\n margin-left: -8px;\n content: \"\";\n width: 0px;\n height: 0px;\n position: absolute\n }\n " : ''); }, function (props) { return (props.Location === 'left' ? "\n &::before {\n border-top: 8px solid transparent;\n border-bottom: 8px solid transparent;\n border-left: 8px solid " + (props.Theme === 'dark' ? "#222" : '#fff') + ";\n top: 50%;\n left: 100%;\n margin-top: -8px;\n content: \"\";\n width: 0px;\n height: 0px;\n position: absolute\n }\n " : ''); }, function (props) { return (props.Location === 'right' ? "\n &::before {\n border-top: 8px solid transparent;\n border-bottom: 8px solid transparent;\n border-right: 8px solid " + (props.Theme === 'dark' ? "#222" : '#fff') + ";\n top: 50%;\n left: -6px;\n margin-top: -8px;\n content: \"\";\n width: 0px;\n height: 0px;\n position: absolute\n }\n " : ''); });
38
- // The other element needs to be labeld as data-tooltip that will only be used for positioning
39
- var ToolTip = function (props) {
40
- var _a = React.useState(0), top = _a[0], setTop = _a[1];
41
- var _b = React.useState(0), left = _b[0], setLeft = _b[1];
42
- var _c = React.useState(""), guid = _c[0], setGuid = _c[1];
43
- React.useEffect(function () {
44
- setGuid(helper_functions_1.CreateGuid());
45
- }, []);
46
- React.useLayoutEffect(function () {
47
- var _a = UpdatePosition(), t = _a[0], l = _a[1];
48
- if (t !== top)
49
- setTop(t);
50
- if (l !== left)
51
- setLeft(l);
52
- });
53
- var zIndex = (props.Zindex === undefined ? 2000 : props.Zindex);
54
- function UpdatePosition() {
55
- var target = document.querySelectorAll("[data-tooltip" + (props.Target === undefined ? '' : "=\"" + props.Target + "\"") + "]");
56
- if (target.length === 0)
57
- return [-999, -999];
58
- var targetLocation = helper_functions_1.GetNodeSize(target[0]);
59
- var toolTip = document.getElementById(guid);
60
- if (toolTip === null)
61
- return [-999, -999];
62
- var tipLocation = helper_functions_1.GetNodeSize(toolTip);
63
- var offset = 5;
64
- var result = [0, 0];
65
- if (props.Position === 'left') {
66
- result[0] = targetLocation.top + 0.5 * targetLocation.height - 0.5 * tipLocation.height;
67
- result[1] = targetLocation.left - tipLocation.width - offset;
68
- }
69
- else if (props.Position === 'right') {
70
- result[0] = targetLocation.top + 0.5 * targetLocation.height - 0.5 * tipLocation.height;
71
- result[1] = targetLocation.left + targetLocation.width + offset;
72
- }
73
- else if (props.Position === 'top') {
74
- result[0] = targetLocation.top - tipLocation.height - offset;
75
- result[1] = targetLocation.left + 0.5 * targetLocation.width - 0.5 * tipLocation.width;
76
- }
77
- else if (props.Position === 'bottom') {
78
- result[0] = targetLocation.top + targetLocation.height + offset;
79
- result[1] = targetLocation.left + 0.5 * targetLocation.width - 0.5 * tipLocation.width;
80
- }
81
- return result;
82
- }
83
- var theme = (props.Theme === undefined ? 'dark' : props.Theme);
84
- return (React.createElement(WrapperDiv, { Show: props.Show, Theme: theme, Top: top, Left: left, id: guid, Location: props.Position === undefined ? 'top' : props.Position, Zindex: zIndex }, props.children));
85
- };
86
- exports.default = ToolTip;
87
- var templateObject_1;
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- /// <reference types="jquery" />
3
- import { Search } from '@gpa-gemstone/react-interactive';
4
- interface S {
5
- Value: string;
6
- Name: string;
7
- DefaultValue: string;
8
- }
9
- interface IProps<T extends S> {
10
- getNewSetting: () => T;
11
- searchSetting: (search: Search.IFilter<T>[], ascending: boolean, sortField: string) => JQuery.jqXHR<string>;
12
- addSetting: (setting: T) => JQuery.jqXHR;
13
- updateSetting: (setting: T) => JQuery.jqXHR;
14
- deleteSetting: (setting: T) => JQuery.jqXHR;
15
- }
16
- declare function Setting<T extends S>(props: IProps<T>): JSX.Element;
17
- export default Setting;
@@ -1,112 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // Setting.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 04/28/2021 - C. Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- var React = require("react");
25
- var react_forms_1 = require("@gpa-gemstone/react-forms");
26
- var react_table_1 = require("@gpa-gemstone/react-table");
27
- var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
28
- var react_interactive_1 = require("@gpa-gemstone/react-interactive");
29
- function Setting(props) {
30
- var _a = React.useState([]), search = _a[0], setSearch = _a[1];
31
- var _b = React.useState('Idle'), searchState = _b[0], setSearchState = _b[1];
32
- var _c = React.useState([]), data = _c[0], setData = _c[1];
33
- var _d = React.useState('Name'), sortField = _d[0], setSortField = _d[1];
34
- var _e = React.useState(true), ascending = _e[0], setAscending = _e[1];
35
- var _f = React.useState(props.getNewSetting()), editnewSetting = _f[0], setEditNewSetting = _f[1];
36
- var _g = React.useState('New'), editNew = _g[0], setEditNew = _g[1];
37
- var _h = React.useState(false), showModal = _h[0], setShowModal = _h[1];
38
- var _j = React.useState(false), showWarning = _j[0], setShowWarning = _j[1];
39
- var _k = React.useState(false), hasChanged = _k[0], setHasChanged = _k[1];
40
- var _l = React.useState(0), triggerReload = _l[0], setTriggerReload = _l[1];
41
- React.useEffect(function () {
42
- setEditNewSetting(props.getNewSetting());
43
- }, []);
44
- React.useEffect(function () {
45
- setSearchState('Loading');
46
- var handle = props.searchSetting(search, ascending, sortField);
47
- handle.done(function (d) { setData(JSON.parse(d)); setSearchState('Idle'); });
48
- handle.fail(function (msg) { return setSearchState('Error'); });
49
- return function () { if (handle != null && handle.abort != null)
50
- handle.abort(); };
51
- }, [search, ascending, sortField, triggerReload]);
52
- React.useEffect(function () { setHasChanged(false); }, [showModal]);
53
- function isValidSetting() {
54
- return editnewSetting != null && editnewSetting.Name != null && editnewSetting.Name.length > 0
55
- && editnewSetting.Value != null && editnewSetting.Value.length > 0;
56
- }
57
- var searchFields = [
58
- { key: 'Name', label: 'Name', type: 'string' },
59
- { key: 'DefaultValue', label: 'Default Value', type: 'string' },
60
- { key: 'Value', label: 'Value', type: 'string' }
61
- ];
62
- return (React.createElement(React.Fragment, null,
63
- React.createElement("div", { style: { width: '100%', height: '100%' } },
64
- React.createElement(react_interactive_1.SearchBar, { CollumnList: searchFields, SetFilter: function (flds) { return setSearch(flds); }, Direction: 'left', defaultCollumn: { key: 'Name', label: 'Name', type: 'string' }, Width: '50%', Label: 'Search', ShowLoading: searchState === 'Loading', ResultNote: searchState === 'Error' ? 'Could not complete Search' : 'Found ' + data.length + ' Settings', GetEnum: function (setOptions, field) {
65
- return function () {
66
- // do nothing.
67
- };
68
- } },
69
- React.createElement("li", { className: "nav-item", style: { width: '15%', paddingRight: 10 } },
70
- React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%' } },
71
- React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Actions:"),
72
- React.createElement("form", null,
73
- React.createElement("button", { className: "btn btn-primary", onClick: function (event) { setEditNewSetting(props.getNewSetting()); setEditNew('New'); setShowModal(true); event.preventDefault(); } }, "Add Setting"))))),
74
- React.createElement("div", { style: { width: '100%', height: 'calc( 100% - 136px)' } },
75
- React.createElement(react_table_1.default, { cols: [
76
- { key: 'Name', label: 'Setting Name', headerStyle: { width: '10%' }, rowStyle: { width: '10%' } },
77
- { key: 'Value', label: 'Current Value', headerStyle: { width: '10%' }, rowStyle: { width: '10%' } },
78
- { key: 'DefaultValue', label: 'Default Value', headerStyle: { width: '20%' }, rowStyle: { width: '20%' } },
79
- { key: null, label: '', headerStyle: { width: 17, padding: 0 }, rowStyle: { width: 0, padding: 0 } },
80
- ], tableClass: "table table-hover", data: data, sortField: sortField, ascending: ascending, onSort: function (d) {
81
- if (d.col === sortField)
82
- setAscending(!ascending);
83
- else {
84
- setAscending(true);
85
- setSortField(d.col);
86
- }
87
- }, onClick: function (item) { setEditNewSetting(item.row); setShowModal(true); setEditNew('Edit'); }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: window.innerHeight - 300, width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return false; } }))),
88
- React.createElement(react_interactive_1.Modal, { Title: editNew === 'Edit' ? editnewSetting.Name + ' - Setting' : 'Add New Setting', Show: showModal, ShowX: true, Size: 'lg', ShowCancel: editNew === 'Edit', ConfirmText: 'Save', CancelText: 'Delete', CallBack: function (conf, isBtn) {
89
- if (conf && editNew === 'New')
90
- props.addSetting(editnewSetting).then(function (d) { return setTriggerReload(function (x) { return x + 1; }); });
91
- if (conf && editNew === 'Edit')
92
- props.updateSetting(editnewSetting).then(function (d) { return setTriggerReload(function (x) { return x + 1; }); });
93
- if (!conf && isBtn)
94
- setShowWarning(true);
95
- setShowModal(false);
96
- }, DisableConfirm: (editNew === 'Edit' && !hasChanged) || !isValidSetting(), ConfirmShowToolTip: !isValidSetting(), ConfirmToolTipContent: [
97
- editnewSetting.Name == null || editnewSetting.Name.length === 0 ? React.createElement("p", { key: 1 },
98
- gpa_symbols_1.CrossMark,
99
- " A Name is required.") : null,
100
- editnewSetting.Value == null || editnewSetting.Value.length === 0 ? React.createElement("p", { key: 2 },
101
- gpa_symbols_1.CrossMark,
102
- " A Value is required. ") : null,
103
- ] },
104
- React.createElement("div", { className: "row" },
105
- React.createElement("div", { className: "col" },
106
- React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'Name', Label: 'Setting Name', Feedback: 'A unique Name is required.', Valid: function (field) { return editnewSetting.Name != null && editnewSetting.Name.length > 0; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } }),
107
- React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'Value', Label: 'Value', Feedback: 'Value is required.', Valid: function (field) { return editnewSetting.Value != null && editnewSetting.Value.length > 0; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } }),
108
- React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'DefaultValue', Label: 'Default Value', Valid: function (field) { return true; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } })))),
109
- React.createElement(react_interactive_1.Warning, { Title: 'Delete Setting', Message: 'This will Delete this Setting from the System. this can have unintended consequences and cause the System to crash are you Sure you want to continue?.', Show: showWarning, CallBack: function (conf) { if (conf)
110
- props.deleteSetting(editnewSetting).then(function (d) { return setTriggerReload(function (x) { return x + 1; }); }); setShowWarning(false); } })));
111
- }
112
- exports.default = Setting;
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- /// <reference types="jquery" />
3
- import { Search } from '@gpa-gemstone/react-interactive';
4
- interface S {
5
- Value: string;
6
- Name: string;
7
- DefaultValue: string;
8
- }
9
- interface IProps<T extends S> {
10
- getNewSetting: () => T;
11
- searchSetting: (search: Search.IFilter<T>[], ascending: boolean, sortField: string) => JQuery.jqXHR<string>;
12
- addSetting: (setting: T) => JQuery.jqXHR;
13
- updateSetting: (setting: T) => JQuery.jqXHR;
14
- deleteSetting: (setting: T) => JQuery.jqXHR;
15
- }
16
- declare function Setting<T extends S>(props: IProps<T>): JSX.Element;
17
- export default Setting;
@@ -1,112 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // Setting.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 04/28/2021 - C. Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- var React = require("react");
25
- var react_forms_1 = require("@gpa-gemstone/react-forms");
26
- var react_table_1 = require("@gpa-gemstone/react-table");
27
- var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
28
- var react_interactive_1 = require("@gpa-gemstone/react-interactive");
29
- function Setting(props) {
30
- var _a = React.useState([]), search = _a[0], setSearch = _a[1];
31
- var _b = React.useState('Idle'), searchState = _b[0], setSearchState = _b[1];
32
- var _c = React.useState([]), data = _c[0], setData = _c[1];
33
- var _d = React.useState('Name'), sortField = _d[0], setSortField = _d[1];
34
- var _e = React.useState(true), ascending = _e[0], setAscending = _e[1];
35
- var _f = React.useState(props.getNewSetting()), editnewSetting = _f[0], setEditNewSetting = _f[1];
36
- var _g = React.useState('New'), editNew = _g[0], setEditNew = _g[1];
37
- var _h = React.useState(false), showModal = _h[0], setShowModal = _h[1];
38
- var _j = React.useState(false), showWarning = _j[0], setShowWarning = _j[1];
39
- var _k = React.useState(false), hasChanged = _k[0], setHasChanged = _k[1];
40
- var _l = React.useState(0), triggerReload = _l[0], setTriggerReload = _l[1];
41
- React.useEffect(function () {
42
- setEditNewSetting(props.getNewSetting());
43
- }, []);
44
- React.useEffect(function () {
45
- setSearchState('Loading');
46
- var handle = props.searchSetting(search, ascending, sortField);
47
- handle.done(function (d) { setData(JSON.parse(d)); setSearchState('Idle'); });
48
- handle.fail(function (msg) { return setSearchState('Error'); });
49
- return function () { if (handle != null && handle.abort != null)
50
- handle.abort(); };
51
- }, [search, ascending, sortField, triggerReload]);
52
- React.useEffect(function () { setHasChanged(false); }, [showModal]);
53
- function isValidSetting() {
54
- return editnewSetting != null && editnewSetting.Name != null && editnewSetting.Name.length > 0
55
- && editnewSetting.Value != null && editnewSetting.Value.length > 0;
56
- }
57
- var searchFields = [
58
- { key: 'Name', label: 'Name', type: 'string' },
59
- { key: 'DefaultValue', label: 'Default Value', type: 'string' },
60
- { key: 'Value', label: 'Value', type: 'string' }
61
- ];
62
- return (React.createElement(React.Fragment, null,
63
- React.createElement("div", { style: { width: '100%', height: '100%' } },
64
- React.createElement(react_interactive_1.SearchBar, { CollumnList: searchFields, SetFilter: function (flds) { return setSearch(flds); }, Direction: 'left', defaultCollumn: { key: 'Name', label: 'Name', type: 'string' }, Width: '50%', Label: 'Search', ShowLoading: searchState === 'Loading', ResultNote: searchState === 'Error' ? 'Could not complete Search' : 'Found ' + data.length + ' Settings', GetEnum: function (setOptions, field) {
65
- return function () {
66
- // do nothing.
67
- };
68
- } },
69
- React.createElement("li", { className: "nav-item", style: { width: '15%', paddingRight: 10 } },
70
- React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%' } },
71
- React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Actions:"),
72
- React.createElement("form", null,
73
- React.createElement("button", { className: "btn btn-primary", onClick: function (event) { setEditNewSetting(props.getNewSetting()); setEditNew('New'); setShowModal(true); event.preventDefault(); } }, "Add Setting"))))),
74
- React.createElement("div", { style: { width: '100%', height: 'calc( 100% - 136px)' } },
75
- React.createElement(react_table_1.default, { cols: [
76
- { key: 'Name', label: 'Setting Name', headerStyle: { width: '10%' }, rowStyle: { width: '10%' } },
77
- { key: 'Value', label: 'Current Value', headerStyle: { width: '10%' }, rowStyle: { width: '10%' } },
78
- { key: 'DefaultValue', label: 'Default Value', headerStyle: { width: '20%' }, rowStyle: { width: '20%' } },
79
- { key: null, label: '', headerStyle: { width: 17, padding: 0 }, rowStyle: { width: 0, padding: 0 } },
80
- ], tableClass: "table table-hover", data: data, sortField: sortField, ascending: ascending, onSort: function (d) {
81
- if (d.col === sortField)
82
- setAscending(!ascending);
83
- else {
84
- setAscending(true);
85
- setSortField(d.col);
86
- }
87
- }, onClick: function (item) { setEditNewSetting(item.row); setShowModal(true); setEditNew('Edit'); }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: window.innerHeight - 300, width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return false; } }))),
88
- React.createElement(react_interactive_1.Modal, { Title: editNew === 'Edit' ? editnewSetting.Name + ' - Setting' : 'Add New Setting', Show: showModal, ShowX: true, Size: 'lg', ShowCancel: editNew === 'Edit', ConfirmText: 'Save', CancelText: 'Delete', CallBack: function (conf, isBtn) {
89
- if (conf && editNew === 'New')
90
- props.addSetting(editnewSetting).then(function (d) { return setTriggerReload(function (x) { return x + 1; }); });
91
- if (conf && editNew === 'Edit')
92
- props.updateSetting(editnewSetting).then(function (d) { return setTriggerReload(function (x) { return x + 1; }); });
93
- if (!conf && isBtn)
94
- setShowWarning(true);
95
- setShowModal(false);
96
- }, DisableConfirm: (editNew === 'Edit' && !hasChanged) || !isValidSetting(), ConfirmShowToolTip: !isValidSetting(), ConfirmToolTipContent: [
97
- editnewSetting.Name == null || editnewSetting.Name.length === 0 ? React.createElement("p", { key: 1 },
98
- gpa_symbols_1.CrossMark,
99
- " A Name is required.") : null,
100
- editnewSetting.Value == null || editnewSetting.Value.length === 0 ? React.createElement("p", { key: 2 },
101
- gpa_symbols_1.CrossMark,
102
- " A Value is required. ") : null,
103
- ] },
104
- React.createElement("div", { className: "row" },
105
- React.createElement("div", { className: "col" },
106
- React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'Name', Label: 'Setting Name', Feedback: 'A unique Name is required.', Valid: function (field) { return editnewSetting.Name != null && editnewSetting.Name.length > 0; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } }),
107
- React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'Value', Label: 'Value', Feedback: 'Value is required.', Valid: function (field) { return editnewSetting.Value != null && editnewSetting.Value.length > 0; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } }),
108
- React.createElement(react_forms_1.Input, { Record: editnewSetting, Field: 'DefaultValue', Label: 'Default Value', Valid: function (field) { return true; }, Setter: function (record) { setEditNewSetting(record); setHasChanged(true); } })))),
109
- React.createElement(react_interactive_1.Warning, { Title: 'Delete Setting', Message: 'This will Delete this Setting from the System. this can have unintended consequences and cause the System to crash are you Sure you want to continue?.', Show: showWarning, CallBack: function (conf) { if (conf)
110
- props.deleteSetting(editnewSetting).then(function (d) { return setTriggerReload(function (x) { return x + 1; }); }); setShowWarning(false); } })));
111
- }
112
- exports.default = Setting;
package/lib/Warning.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- interface IProps {
3
- Title: string;
4
- CallBack: ((confirmed: boolean) => void);
5
- Show: boolean;
6
- Message: string;
7
- }
8
- declare const Warning: React.FunctionComponent<IProps>;
9
- export default Warning;
package/lib/Warning.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // Warning.tsx - Gbtc
4
- //
5
- // Copyright © 2020, 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
- // 12/29/2020 - Christoph Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- var React = require("react");
25
- var Modal_1 = require("./Modal");
26
- // Usage:
27
- // <Warning Title='This is a Warning' Message={'Are you sure you want to Continue?'} Callback={(canceled) => setShow(false)} Show={show} />
28
- //
29
- // Props Description:
30
- // Title => Title of The Modal
31
- // CallBack => Function to be called when closing the Modal either through Cancel (confirmed=false) or Confirm Button (confirmed=true)
32
- // Show => Whether to show the modal
33
- // Message => The message shown by the Modal
34
- var Warning = function (props) {
35
- return (React.createElement(Modal_1.default, { Title: props.Title, Show: props.Show, CancelBtnClass: 'btn-danger', CancelText: 'Cancel', ConfirmBtnClass: 'btn-success', ConfirmText: 'Confirm', ShowX: false, ShowCancel: true, Size: 'sm', CallBack: function (confirmed) { return props.CallBack(confirmed); } },
36
- React.createElement("p", null, props.Message)));
37
- };
38
- exports.default = Warning;