@gpa-gemstone/common-pages 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +14 -0
- package/lib/Note.d.ts +17 -0
- package/lib/Note.js +179 -0
- package/lib/Setting.d.ts +8 -0
- package/lib/Setting.js +125 -0
- package/lib/SliceInterfaces.d.ts +76 -0
- package/lib/SliceInterfaces.js +2 -0
- package/lib/ValueList/ByValueList.d.ts +10 -0
- package/lib/ValueList/ByValueList.js +115 -0
- package/lib/ValueList/Group.d.ts +11 -0
- package/lib/ValueList/Group.js +71 -0
- package/lib/ValueList/GroupForm.d.ts +9 -0
- package/lib/ValueList/GroupForm.js +51 -0
- package/lib/ValueList/GroupInfo.d.ts +8 -0
- package/lib/ValueList/GroupInfo.js +69 -0
- package/lib/ValueList/GroupItem.d.ts +9 -0
- package/lib/ValueList/GroupItem.js +116 -0
- package/lib/ValueList/ItemForm.d.ts +9 -0
- package/lib/ValueList/ItemForm.js +59 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +37 -0
- package/lib/user/AdditionalField.d.ts +26 -0
- package/lib/user/AdditionalField.js +260 -0
- package/lib/user/ByUser.d.ts +12 -0
- package/lib/user/ByUser.js +148 -0
- package/lib/user/User.d.ts +14 -0
- package/lib/user/User.js +71 -0
- package/lib/user/UserForm.d.ts +12 -0
- package/lib/user/UserForm.js +141 -0
- package/lib/user/UserInfo.d.ts +7 -0
- package/lib/user/UserInfo.js +97 -0
- package/lib/user/UserPermissions.d.ts +8 -0
- package/lib/user/UserPermissions.js +83 -0
- package/package.json +66 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
import { IGenericSlice } from '../SliceInterfaces';
|
4
|
+
interface IProps {
|
5
|
+
Id: number;
|
6
|
+
ValueListSlice: IGenericSlice<SystemCenter.Types.ValueListGroup>;
|
7
|
+
ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
|
8
|
+
OnDelete: () => {};
|
9
|
+
}
|
10
|
+
export default function ValueListGroup(props: IProps): JSX.Element | null;
|
11
|
+
export {};
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// Group.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
|
+
// 07/04/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_interactive_1 = require("@gpa-gemstone/react-interactive");
|
26
|
+
var GroupInfo_1 = require("./GroupInfo");
|
27
|
+
var GroupItem_1 = require("./GroupItem");
|
28
|
+
var react_redux_1 = require("react-redux");
|
29
|
+
function ValueListGroup(props) {
|
30
|
+
var dispatch = react_redux_1.useDispatch();
|
31
|
+
var record = react_redux_1.useSelector(function (state) { return props.ValueListSlice.Data(state).find(function (i) { return i.ID === props.Id; }); });
|
32
|
+
var recordStatus = react_redux_1.useSelector(props.ValueListSlice.Status);
|
33
|
+
var _a = React.useState('items'), tab = _a[0], setTab = _a[1];
|
34
|
+
var _b = React.useState(false), showWarning = _b[0], setShowWarning = _b[1];
|
35
|
+
React.useEffect(function () {
|
36
|
+
if (recordStatus === 'unintiated' || recordStatus === 'changed')
|
37
|
+
dispatch(props.ValueListSlice.Fetch());
|
38
|
+
}, [dispatch, recordStatus]);
|
39
|
+
var Tabs = [
|
40
|
+
{ Id: "info", Label: "Value List Group Info" },
|
41
|
+
{ Id: "items", Label: "List Items" }
|
42
|
+
];
|
43
|
+
if (recordStatus === 'error')
|
44
|
+
return React.createElement("div", { style: { width: '100%', height: '100%' } },
|
45
|
+
React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Label: 'A Server Error Occured. Please Reload the Application' }));
|
46
|
+
if (record == null)
|
47
|
+
return null;
|
48
|
+
return (React.createElement("div", { style: { width: '100%', height: window.innerHeight - 63, maxHeight: window.innerHeight - 63, overflow: 'hidden', padding: 15 } },
|
49
|
+
React.createElement("div", { className: "row" },
|
50
|
+
React.createElement("div", { className: "col" },
|
51
|
+
React.createElement("h2", null, record.Name)),
|
52
|
+
React.createElement("div", { className: "col" },
|
53
|
+
React.createElement("button", { className: "btn btn-danger pull-right", hidden: record == null, onClick: function () { return setShowWarning(true); } }, "Delete Value List Group (Permanent)"))),
|
54
|
+
React.createElement("hr", null),
|
55
|
+
React.createElement(react_interactive_1.TabSelector, { CurrentTab: tab, SetTab: function (t) { return setTab(t); }, Tabs: Tabs }),
|
56
|
+
React.createElement("div", { className: "tab-content", style: { maxHeight: window.innerHeight - 235, overflow: 'hidden' } },
|
57
|
+
React.createElement("div", { className: "tab-pane " + (tab === "info" ? " active" : "fade"), id: "info" },
|
58
|
+
React.createElement(GroupInfo_1.default, { Record: record, Setter: function (r) {
|
59
|
+
dispatch(props.ValueListSlice.DBAction({ verb: 'PATCH', record: r }));
|
60
|
+
} })),
|
61
|
+
React.createElement("div", { className: "tab-pane " + (tab === "items" ? " active" : "fade"), id: "items" },
|
62
|
+
React.createElement(GroupItem_1.default, { Record: record, ValueListItemSlice: props.ValueListItemSlice }))),
|
63
|
+
React.createElement(react_interactive_1.Warning, { Message: 'This will permanently remove the ValueList Group. Are you sure you want to continue?', Title: 'Warning', Show: showWarning, CallBack: function (c) {
|
64
|
+
setShowWarning(false);
|
65
|
+
if (c) {
|
66
|
+
dispatch(props.ValueListSlice.DBAction({ verb: 'DELETE', record: record }));
|
67
|
+
props.OnDelete();
|
68
|
+
}
|
69
|
+
} })));
|
70
|
+
}
|
71
|
+
exports.default = ValueListGroup;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
interface IProps {
|
4
|
+
Record: SystemCenter.Types.ValueListGroup;
|
5
|
+
Setter: (record: SystemCenter.Types.ValueListGroup) => void;
|
6
|
+
ErrorSetter?: (errors: string[]) => void;
|
7
|
+
}
|
8
|
+
export default function GroupForm(props: IProps): JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// GroupForm.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
|
+
// 07/04/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
|
+
function GroupForm(props) {
|
27
|
+
var _a = React.useState([]), errors = _a[0], setErrors = _a[1];
|
28
|
+
React.useEffect(function () {
|
29
|
+
var e = [];
|
30
|
+
if (props.Record.Name == null || props.Record.Name.length === 0)
|
31
|
+
e.push('A Name is required.');
|
32
|
+
if (props.Record.Name != null && props.Record.Name.length > 200)
|
33
|
+
e.push('Name has to be less than 200 characters.');
|
34
|
+
setErrors(e);
|
35
|
+
}, [props.Record]);
|
36
|
+
React.useEffect(function () {
|
37
|
+
if (props.ErrorSetter !== undefined)
|
38
|
+
props.ErrorSetter(errors);
|
39
|
+
}, [errors, props.ErrorSetter]);
|
40
|
+
function Valid(field) {
|
41
|
+
if (field === 'Name')
|
42
|
+
return props.Record.Name != null && props.Record.Name.length > 0 && props.Record.Name.length <= 200;
|
43
|
+
else if (field === 'Description')
|
44
|
+
return true;
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
return (React.createElement("form", null,
|
48
|
+
React.createElement(react_forms_1.Input, { Record: props.Record, Field: 'Name', Feedback: 'Name must be less than 200 characters.', Valid: Valid, Setter: props.Setter }),
|
49
|
+
React.createElement(react_forms_1.TextArea, { Rows: 3, Record: props.Record, Field: 'Description', Valid: Valid, Setter: props.Setter })));
|
50
|
+
}
|
51
|
+
exports.default = GroupForm;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
interface IProps {
|
4
|
+
Record: SystemCenter.Types.ValueListGroup;
|
5
|
+
Setter: (record: SystemCenter.Types.ValueListGroup) => void;
|
6
|
+
}
|
7
|
+
declare const InfoWindow: (props: IProps) => JSX.Element | null;
|
8
|
+
export default InfoWindow;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// GroupInfo.tsx - Gbtc
|
4
|
+
//
|
5
|
+
// Copyright © 2021, 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
|
+
// 07/04/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 GroupForm_1 = require("./GroupForm");
|
26
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
27
|
+
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
28
|
+
var InfoWindow = function (props) {
|
29
|
+
var _a = React.useState(props.Record), record = _a[0], setRecord = _a[1];
|
30
|
+
var _b = React.useState([]), errors = _b[0], setErrors = _b[1];
|
31
|
+
var _c = React.useState([]), warnings = _c[0], setWarnings = _c[1];
|
32
|
+
var _d = React.useState('None'), hover = _d[0], setHover = _d[1];
|
33
|
+
React.useEffect(function () {
|
34
|
+
var w = [];
|
35
|
+
if (record == null)
|
36
|
+
return;
|
37
|
+
if (record.Name !== props.Record.Name)
|
38
|
+
w.push('Changes to Name will be lost.');
|
39
|
+
if (record.Description !== props.Record.Description)
|
40
|
+
w.push('Changes to Description will be lost.');
|
41
|
+
setWarnings(w);
|
42
|
+
}, [props.Record, record]);
|
43
|
+
if (record == null)
|
44
|
+
return null;
|
45
|
+
return (React.createElement("div", { className: "card", style: { marginBottom: 10 } },
|
46
|
+
React.createElement("div", { className: "card-header" },
|
47
|
+
React.createElement("div", { className: "row" },
|
48
|
+
React.createElement("div", { className: "col" },
|
49
|
+
React.createElement("h4", null, "Value List Group Information:")))),
|
50
|
+
React.createElement("div", { className: "card-body" },
|
51
|
+
React.createElement(GroupForm_1.default, { Record: record, Setter: function (r) { return setRecord(r); }, ErrorSetter: setErrors })),
|
52
|
+
React.createElement("div", { className: "card-footer" },
|
53
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
54
|
+
React.createElement("button", { className: "btn btn-primary" + (errors.length > 0 || warnings.length === 0 ? ' disabled' : ''), onClick: function () {
|
55
|
+
if (errors.length === 0 && warnings.length > 0)
|
56
|
+
props.Setter(record);
|
57
|
+
}, hidden: record.ID === 0, "data-tooltip": 'Update', onMouseEnter: function () { return setHover('Update'); }, onMouseLeave: function () { return setHover('None'); } }, "Update")),
|
58
|
+
React.createElement(react_interactive_1.ToolTip, { Show: hover === 'Clear' && (errors.length > 0), Position: 'top', Theme: 'dark', Target: "Update" }, errors.map(function (t, i) { return React.createElement("p", { key: i },
|
59
|
+
gpa_symbols_1.CrossMark,
|
60
|
+
" ",
|
61
|
+
t); })),
|
62
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
63
|
+
React.createElement("button", { className: "btn btn-default", onClick: function () { return setRecord(props.Record); }, disabled: warnings.length === 0, "data-tooltip": 'Clr', onMouseEnter: function () { return setHover('Clear'); }, onMouseLeave: function () { return setHover('None'); } }, "Reset")),
|
64
|
+
React.createElement(react_interactive_1.ToolTip, { Show: hover === 'Clear' && (warnings.length > 0), Position: 'top', Theme: 'dark', Target: "Clr" }, warnings.map(function (t, i) { return React.createElement("p", { key: i },
|
65
|
+
gpa_symbols_1.Warning,
|
66
|
+
" ",
|
67
|
+
t); })))));
|
68
|
+
};
|
69
|
+
exports.default = InfoWindow;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
import { IGenericSlice } from '../SliceInterfaces';
|
4
|
+
interface IProps {
|
5
|
+
Record: SystemCenter.Types.ValueListGroup;
|
6
|
+
ValueListItemSlice: IGenericSlice<SystemCenter.Types.ValueListItem>;
|
7
|
+
}
|
8
|
+
export default function GroupItemsWindow(props: IProps): JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,116 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// GroupItem.tsx - Gbtc
|
4
|
+
//
|
5
|
+
// Copyright © 2021, 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
|
+
// 07/04/2021 - C. Lackner
|
21
|
+
// Generated original version of source code.
|
22
|
+
// ******************************************************************************************************
|
23
|
+
var __assign = (this && this.__assign) || function () {
|
24
|
+
__assign = Object.assign || function(t) {
|
25
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
26
|
+
s = arguments[i];
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
28
|
+
t[p] = s[p];
|
29
|
+
}
|
30
|
+
return t;
|
31
|
+
};
|
32
|
+
return __assign.apply(this, arguments);
|
33
|
+
};
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
35
|
+
var React = require("react");
|
36
|
+
var ItemForm_1 = require("./ItemForm");
|
37
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
38
|
+
var react_table_1 = require("@gpa-gemstone/react-table");
|
39
|
+
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
40
|
+
var react_redux_1 = require("react-redux");
|
41
|
+
function GroupItemsWindow(props) {
|
42
|
+
var dispatch = react_redux_1.useDispatch();
|
43
|
+
var recordStatus = react_redux_1.useSelector(props.ValueListItemSlice.Status);
|
44
|
+
var data = react_redux_1.useSelector(props.ValueListItemSlice.Data);
|
45
|
+
var parentID = react_redux_1.useSelector((props.ValueListItemSlice.ParentID === undefined ? function (state) { return -1; } : props.ValueListItemSlice.ParentID));
|
46
|
+
var _a = React.useState('Value'), sortField = _a[0], setSortField = _a[1];
|
47
|
+
var _b = React.useState(false), ascending = _b[0], setAscending = _b[1];
|
48
|
+
var emptyRecord = { ID: 0, GroupID: props.Record.ID, Value: '', AltValue: '', SortOrder: 0 };
|
49
|
+
var _c = React.useState(emptyRecord), record = _c[0], setRecord = _c[1];
|
50
|
+
var _d = React.useState(false), showNew = _d[0], setShowNew = _d[1];
|
51
|
+
var _e = React.useState([]), newErrors = _e[0], setNewErrors = _e[1];
|
52
|
+
var _f = React.useState(true), validValue = _f[0], setValidValue = _f[1];
|
53
|
+
React.useEffect(function () {
|
54
|
+
if (recordStatus === 'unintiated' || recordStatus === 'changed' || parentID !== props.Record.ID)
|
55
|
+
dispatch(props.ValueListItemSlice.Fetch(props.Record.ID));
|
56
|
+
}, [recordStatus, dispatch]);
|
57
|
+
React.useEffect(function () {
|
58
|
+
dispatch(props.ValueListItemSlice.Sort({ Ascending: ascending, SortField: sortField }));
|
59
|
+
}, [sortField, ascending]);
|
60
|
+
React.useEffect(function () {
|
61
|
+
if (record.Value === null)
|
62
|
+
setValidValue(true);
|
63
|
+
if (data.findIndex(function (d) { return d.Value.toLowerCase() === record.Value.toLowerCase(); }) > -1)
|
64
|
+
setValidValue(false);
|
65
|
+
else
|
66
|
+
setValidValue(true);
|
67
|
+
}, [record, data]);
|
68
|
+
return (React.createElement("div", { className: "card", style: { marginBottom: 10 } },
|
69
|
+
React.createElement("div", { className: "card-header" },
|
70
|
+
React.createElement("div", { className: "row" },
|
71
|
+
React.createElement("div", { className: "col" },
|
72
|
+
React.createElement("h4", null, "List Items:")))),
|
73
|
+
React.createElement("div", { className: "card-body" },
|
74
|
+
React.createElement("div", { className: "row" },
|
75
|
+
React.createElement("div", { style: { width: '100%', height: window.innerHeight - 421, maxHeight: window.innerHeight - 421, padding: 0, overflowY: 'auto' } },
|
76
|
+
React.createElement(react_table_1.SearchableTable, { cols: [
|
77
|
+
{ key: 'Value', field: 'Value', label: 'Value', headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' } },
|
78
|
+
{ key: 'AltValue', field: 'AltValue', label: 'Alternate Value', headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' } },
|
79
|
+
{ key: 'SortOrder', field: 'SortOrder', label: 'Sort Order', headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' } },
|
80
|
+
{ key: 'remove', label: '', headerStyle: { width: '10%' }, rowStyle: { width: '10%' }, content: function (item) { return React.createElement("button", { className: "btn btn-sm", onClick: function (e) {
|
81
|
+
e.preventDefault();
|
82
|
+
dispatch(props.ValueListItemSlice.DBAction({ verb: 'DELETE', record: item }));
|
83
|
+
} },
|
84
|
+
React.createElement("span", null,
|
85
|
+
React.createElement("i", { className: "fa fa-times" }))); }
|
86
|
+
},
|
87
|
+
{ key: 'scroll', label: '', headerStyle: { width: 17, padding: 0 }, rowStyle: { width: 0, padding: 0 } },
|
88
|
+
], tableClass: "table table-hover", data: data, sortKey: sortField, onSort: function (d) {
|
89
|
+
if (d.colKey === 'remove' || d.colKey === 'scroll' || d.colField === undefined)
|
90
|
+
return;
|
91
|
+
setSortField(d.colField);
|
92
|
+
if (d.colField === sortField)
|
93
|
+
setAscending(function (asc) { return !asc; });
|
94
|
+
else
|
95
|
+
setAscending(true);
|
96
|
+
}, ascending: true, onClick: function () { }, 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; }, matchSearch: function (item, search) { return item.Value.toLowerCase().indexOf(search.toLowerCase()) > -1; } })))),
|
97
|
+
React.createElement("div", { className: "card-footer" },
|
98
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
99
|
+
React.createElement("button", { className: "btn btn-primary pull-right", "data-toggle": "modal", "data-target": "#exampleModal", onClick: function () { setRecord(__assign(__assign({}, emptyRecord), { GroupID: props.Record.ID })); setShowNew(true); } }, "Add Item"))),
|
100
|
+
React.createElement(react_interactive_1.Modal, { Title: 'Add new List Item', Show: showNew, Size: 'lg', ShowX: true, ShowCancel: false, DisableConfirm: newErrors.length > 0 || !validValue, ConfirmShowToolTip: newErrors.length > 0 || !validValue, ConfirmToolTipContent: React.createElement(React.Fragment, null,
|
101
|
+
newErrors.map(function (t, i) { return React.createElement("p", { key: i },
|
102
|
+
" ",
|
103
|
+
gpa_symbols_1.CrossMark,
|
104
|
+
" ",
|
105
|
+
t); }),
|
106
|
+
!validValue ? React.createElement("p", null,
|
107
|
+
" ",
|
108
|
+
gpa_symbols_1.CrossMark,
|
109
|
+
" A Value has to be unique in a given Item List.") : null), CallBack: function (c) {
|
110
|
+
setShowNew(false);
|
111
|
+
if (c)
|
112
|
+
dispatch(props.ValueListItemSlice.DBAction({ verb: 'POST', record: record }));
|
113
|
+
} },
|
114
|
+
React.createElement(ItemForm_1.default, { Record: record, Setter: setRecord, ErrorSetter: setNewErrors }))));
|
115
|
+
}
|
116
|
+
exports.default = GroupItemsWindow;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SystemCenter } from '@gpa-gemstone/application-typings';
|
3
|
+
interface IProps {
|
4
|
+
Record: SystemCenter.Types.ValueListItem;
|
5
|
+
Setter: (record: SystemCenter.Types.ValueListItem) => void;
|
6
|
+
ErrorSetter?: (errors: string[]) => void;
|
7
|
+
}
|
8
|
+
export default function ItemForm(props: IProps): JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// ItemForm.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
|
+
// 07/04/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 helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
27
|
+
function ItemForm(props) {
|
28
|
+
var _a = React.useState([]), errors = _a[0], setErrors = _a[1];
|
29
|
+
React.useEffect(function () {
|
30
|
+
var e = [];
|
31
|
+
if (props.Record.Value == null || props.Record.Value.length === 0)
|
32
|
+
e.push('A Value is required.');
|
33
|
+
if (props.Record.Value != null && props.Record.Value.length > 200)
|
34
|
+
e.push('Value has to be less than 200 characters.');
|
35
|
+
if (props.Record.AltValue != null && props.Record.AltValue.length > 200)
|
36
|
+
e.push('Alt Value has to be less than 200 characters.');
|
37
|
+
if (props.Record.SortOrder != null && !helper_functions_1.IsInteger(props.Record.SortOrder))
|
38
|
+
e.push('Sort Order has to be an integer or be left blank.');
|
39
|
+
setErrors(e);
|
40
|
+
}, [props.Record]);
|
41
|
+
React.useEffect(function () {
|
42
|
+
if (props.ErrorSetter !== undefined)
|
43
|
+
props.ErrorSetter(errors);
|
44
|
+
}, [errors, props.ErrorSetter]);
|
45
|
+
function Valid(field) {
|
46
|
+
if (field === 'Value')
|
47
|
+
return props.Record.Value != null && props.Record.Value.length > 0 && props.Record.Value.length <= 200;
|
48
|
+
else if (field === 'AltValue')
|
49
|
+
return props.Record.AltValue == null || props.Record.AltValue.length <= 200;
|
50
|
+
else if (field === 'SortOrder')
|
51
|
+
return props.Record.SortOrder == null || helper_functions_1.IsInteger(props.Record.SortOrder);
|
52
|
+
return true;
|
53
|
+
}
|
54
|
+
return (React.createElement("form", null,
|
55
|
+
React.createElement(react_forms_1.Input, { Record: props.Record, Field: 'Value', Feedback: 'Value must be set and be less than 200 characters.', Valid: Valid, Setter: props.Setter }),
|
56
|
+
React.createElement(react_forms_1.Input, { Record: props.Record, Field: 'AltValue', Label: 'Alt. Value', Feedback: 'Alt. Value must be less than 200 characters.', Valid: Valid, Setter: props.Setter }),
|
57
|
+
React.createElement(react_forms_1.Input, { Record: props.Record, Field: 'SortOrder', Label: 'Sort Order', Type: 'number', Valid: Valid, Setter: props.Setter })));
|
58
|
+
}
|
59
|
+
exports.default = ItemForm;
|
package/lib/index.d.ts
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
import Setting from './Setting';
|
2
|
+
import Note from './Note';
|
3
|
+
import ByValueList from './ValueList/ByValueList';
|
4
|
+
import ValueList from './ValueList/Group';
|
5
|
+
import ByUser from './user/ByUser';
|
6
|
+
import User from './user/User';
|
7
|
+
export { Setting, Note, ValueList, ByValueList, User, ByUser };
|
package/lib/index.js
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// index.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 - C. Lackner
|
21
|
+
// Generated original version of source code.
|
22
|
+
//
|
23
|
+
// ******************************************************************************************************
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
exports.ByUser = exports.User = exports.ByValueList = exports.ValueList = exports.Note = exports.Setting = void 0;
|
26
|
+
var Setting_1 = require("./Setting");
|
27
|
+
exports.Setting = Setting_1.default;
|
28
|
+
var Note_1 = require("./Note");
|
29
|
+
exports.Note = Note_1.default;
|
30
|
+
var ByValueList_1 = require("./ValueList/ByValueList");
|
31
|
+
exports.ByValueList = ByValueList_1.default;
|
32
|
+
var Group_1 = require("./ValueList/Group");
|
33
|
+
exports.ValueList = Group_1.default;
|
34
|
+
var ByUser_1 = require("./user/ByUser");
|
35
|
+
exports.ByUser = ByUser_1.default;
|
36
|
+
var User_1 = require("./user/User");
|
37
|
+
exports.User = User_1.default;
|