@gpa-gemstone/common-pages 0.0.103 → 0.0.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/lib/ErrorBoundary.d.ts +17 -17
  2. package/lib/ErrorBoundary.js +91 -68
  3. package/lib/Note.d.ts +22 -22
  4. package/lib/Note.js +256 -230
  5. package/lib/SearchBar.d.ts +37 -37
  6. package/lib/SearchBar.js +203 -180
  7. package/lib/SelectionPopup.d.ts +42 -42
  8. package/lib/SelectionPopup.js +93 -90
  9. package/lib/Setting.d.ts +8 -8
  10. package/lib/Setting.js +151 -125
  11. package/lib/SliceInterfaces.d.ts +76 -76
  12. package/lib/SliceInterfaces.js +2 -2
  13. package/lib/StandardSelectPopup.d.ts +20 -20
  14. package/lib/StandardSelectPopup.js +135 -109
  15. package/lib/TimeFilter/QuickSelects.d.ts +7 -0
  16. package/lib/TimeFilter/QuickSelects.js +240 -0
  17. package/lib/TimeFilter.d.ts +26 -0
  18. package/lib/TimeFilter.js +270 -0
  19. package/lib/TimeWindowUtils.d.ts +33 -0
  20. package/lib/TimeWindowUtils.js +121 -0
  21. package/lib/ValueList/ByValueList.d.ts +10 -10
  22. package/lib/ValueList/ByValueList.js +141 -115
  23. package/lib/ValueList/Group.d.ts +11 -11
  24. package/lib/ValueList/Group.js +97 -71
  25. package/lib/ValueList/GroupForm.d.ts +9 -9
  26. package/lib/ValueList/GroupForm.js +74 -51
  27. package/lib/ValueList/GroupInfo.d.ts +8 -8
  28. package/lib/ValueList/GroupInfo.js +95 -69
  29. package/lib/ValueList/GroupItem.d.ts +9 -9
  30. package/lib/ValueList/GroupItem.js +142 -116
  31. package/lib/ValueList/ItemForm.d.ts +9 -9
  32. package/lib/ValueList/ItemForm.js +82 -59
  33. package/lib/index.d.ts +12 -11
  34. package/lib/index.js +50 -45
  35. package/lib/user/AdditionalField.d.ts +26 -26
  36. package/lib/user/AdditionalField.js +290 -264
  37. package/lib/user/ByUser.d.ts +12 -12
  38. package/lib/user/ByUser.js +174 -148
  39. package/lib/user/User.d.ts +14 -14
  40. package/lib/user/User.js +97 -71
  41. package/lib/user/UserForm.d.ts +12 -12
  42. package/lib/user/UserForm.js +166 -143
  43. package/lib/user/UserInfo.d.ts +7 -7
  44. package/lib/user/UserInfo.js +123 -97
  45. package/lib/user/UserPermissions.d.ts +8 -8
  46. package/lib/user/UserPermissions.js +106 -83
  47. package/package.json +9 -8
package/lib/SearchBar.js CHANGED
@@ -1,180 +1,203 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // SearchBar.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
- // 12/17/2021 - Samuel Robinson
21
- // Generated original version of source code.
22
- // 12/19/2021 - C. Lackner
23
- // Cleaned up code.
24
- // ******************************************************************************************************
25
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
26
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
- if (ar || !(i in from)) {
28
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
- ar[i] = from[i];
30
- }
31
- }
32
- return to.concat(ar || Array.prototype.slice.call(from));
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.DefaultSearch = void 0;
36
- var React = require("react");
37
- var react_interactive_1 = require("@gpa-gemstone/react-interactive");
38
- var react_redux_1 = require("react-redux");
39
- /** This Implements a few standardized SearchBars */
40
- var DefaultSearch;
41
- (function (DefaultSearch) {
42
- /** This Implements a standard Meter Search */
43
- function Meter(props) {
44
- var defaultSearchcols = [
45
- { label: 'Key', key: 'AssetKey', type: 'string', isPivotField: false },
46
- { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
47
- { label: 'Substation', key: 'Location', type: 'string', isPivotField: false },
48
- { label: 'Make', key: 'Make', type: 'string', isPivotField: false },
49
- { label: 'Model', key: 'Model', type: 'string', isPivotField: false },
50
- { label: 'Number of Assets', key: 'MappedAssets', type: 'number', isPivotField: false },
51
- { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
52
- ];
53
- var dispatch = (0, react_redux_1.useDispatch)();
54
- var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
55
- var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
56
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
57
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
58
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
59
- React.useEffect(function () {
60
- return props.GetAddlFields(setAddlFieldCols);
61
- }, []);
62
- var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
63
- return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Meter(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
64
- }
65
- DefaultSearch.Meter = Meter;
66
- /** This Implements a standard Substation Search */
67
- function Location(props) {
68
- var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
69
- var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
70
- var dispatch = (0, react_redux_1.useDispatch)();
71
- var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
72
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
73
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
74
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
75
- var defaultSearchcols = [
76
- { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
77
- { label: 'Key', key: 'LocationKey', type: 'string', isPivotField: false },
78
- { label: 'Transmission Asset', key: 'Asset', type: 'string', isPivotField: false },
79
- { label: 'Meter', key: 'Meter', type: 'string', isPivotField: false },
80
- { label: 'Number of Transmission Assets', key: 'Assets', type: 'integer', isPivotField: false },
81
- { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: false },
82
- { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
83
- ];
84
- React.useEffect(function () {
85
- return props.GetAddlFields(setAddlFieldCols);
86
- }, []);
87
- return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Substation(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
88
- }
89
- DefaultSearch.Location = Location;
90
- /** This Implements a standard Transmission Asset Search */
91
- function Asset(props) {
92
- var standardSearch = { label: 'Name', key: 'AssetName', type: 'string', isPivotField: false };
93
- var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
94
- var dispatch = (0, react_redux_1.useDispatch)();
95
- var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
96
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
97
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
98
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
99
- var defaultSearchcols = [
100
- { label: 'Key', key: 'AssetKey', type: 'string', isPivotField: false },
101
- { label: 'Name', key: 'AssetName', type: 'string', isPivotField: false },
102
- { label: 'Nominal Voltage (L-L kV)', key: 'VoltageKV', type: 'number', isPivotField: false },
103
- { label: 'Type', key: 'AssetType', type: 'enum', isPivotField: false },
104
- { label: 'Meter Key', key: 'Meter', type: 'string', isPivotField: false },
105
- { label: 'Substation Key', key: 'Location', type: 'string', isPivotField: false },
106
- { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: false },
107
- { label: 'Number of Substations', key: 'Locations', type: 'integer', isPivotField: false },
108
- { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
109
- ];
110
- React.useEffect(function () {
111
- return props.GetAddlFields(setAddlFieldCols);
112
- }, []);
113
- return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Transmission Asset(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
114
- }
115
- DefaultSearch.Asset = Asset;
116
- /** This Implements a standard AssetGroup Search */
117
- function AssetGroup(props) {
118
- var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
119
- var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
120
- var dispatch = (0, react_redux_1.useDispatch)();
121
- var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
122
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
123
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
124
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
125
- var defaultSearchcols = [
126
- { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
127
- { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: false },
128
- { label: 'Number of Transmission Assets', key: 'Assets', type: 'integer', isPivotField: false },
129
- { label: 'Number of Asset Groups', key: 'AssetGroups', type: 'integer', isPivotField: false },
130
- { label: 'Show in PQ Dashboard', key: 'DisplayDashboard', type: 'boolean', isPivotField: false },
131
- { label: 'Show in Email Subscription', key: 'DisplayEmail', type: 'boolean', isPivotField: false },
132
- ];
133
- React.useEffect(function () {
134
- return props.GetAddlFields(setAddlFieldCols);
135
- }, []);
136
- return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Asset Group(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
137
- }
138
- DefaultSearch.AssetGroup = AssetGroup;
139
- /** This Implements a standard User Search */
140
- function User(props) {
141
- var standardSearch = { label: 'Username', key: 'Name', type: 'string', isPivotField: false };
142
- var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
143
- var dispatch = (0, react_redux_1.useDispatch)();
144
- var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
145
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
146
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
147
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
148
- var defaultSearchcols = [
149
- { label: 'Username', key: 'Name', type: 'string', isPivotField: false },
150
- { label: 'Email', key: 'Email', type: 'string', isPivotField: false },
151
- { label: 'Account Locked', key: 'LockedOut', type: 'boolean', isPivotField: false },
152
- ];
153
- React.useEffect(function () {
154
- return props.GetAddlFields(setAddlFieldCols);
155
- }, []);
156
- return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' User(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
157
- }
158
- DefaultSearch.User = User;
159
- /** This Implements a standard Customer Search */
160
- function Customer(props) {
161
- var defaultSearchcols = [
162
- { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
163
- { label: 'Account Name', key: 'CustomerKey', type: 'string', isPivotField: false },
164
- { label: 'Phone', key: 'Phone', type: 'string', isPivotField: false },
165
- { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
166
- ];
167
- var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
168
- var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
169
- var dispatch = (0, react_redux_1.useDispatch)();
170
- var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
171
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
172
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
173
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
174
- React.useEffect(function () {
175
- return props.GetAddlFields(setAddlFieldCols);
176
- }, []);
177
- return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Customer(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
178
- }
179
- DefaultSearch.Customer = Customer;
180
- })(DefaultSearch = exports.DefaultSearch || (exports.DefaultSearch = {}));
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // SearchBar.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
+ // 12/17/2021 - Samuel Robinson
21
+ // Generated original version of source code.
22
+ // 12/19/2021 - C. Lackner
23
+ // Cleaned up code.
24
+ // ******************************************************************************************************
25
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ var desc = Object.getOwnPropertyDescriptor(m, k);
28
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
29
+ desc = { enumerable: true, get: function() { return m[k]; } };
30
+ }
31
+ Object.defineProperty(o, k2, desc);
32
+ }) : (function(o, m, k, k2) {
33
+ if (k2 === undefined) k2 = k;
34
+ o[k2] = m[k];
35
+ }));
36
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
37
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
38
+ }) : function(o, v) {
39
+ o["default"] = v;
40
+ });
41
+ var __importStar = (this && this.__importStar) || function (mod) {
42
+ if (mod && mod.__esModule) return mod;
43
+ var result = {};
44
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
45
+ __setModuleDefault(result, mod);
46
+ return result;
47
+ };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
57
+ Object.defineProperty(exports, "__esModule", { value: true });
58
+ exports.DefaultSearch = void 0;
59
+ var React = __importStar(require("react"));
60
+ var react_interactive_1 = require("@gpa-gemstone/react-interactive");
61
+ var react_redux_1 = require("react-redux");
62
+ /** This Implements a few standardized SearchBars */
63
+ var DefaultSearch;
64
+ (function (DefaultSearch) {
65
+ /** This Implements a standard Meter Search */
66
+ function Meter(props) {
67
+ var defaultSearchcols = [
68
+ { label: 'Key', key: 'AssetKey', type: 'string', isPivotField: false },
69
+ { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
70
+ { label: 'Substation', key: 'Location', type: 'string', isPivotField: false },
71
+ { label: 'Make', key: 'Make', type: 'string', isPivotField: false },
72
+ { label: 'Model', key: 'Model', type: 'string', isPivotField: false },
73
+ { label: 'Number of Assets', key: 'MappedAssets', type: 'number', isPivotField: false },
74
+ { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
75
+ ];
76
+ var dispatch = (0, react_redux_1.useDispatch)();
77
+ var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
78
+ var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
79
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
80
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
81
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
82
+ React.useEffect(function () {
83
+ return props.GetAddlFields(setAddlFieldCols);
84
+ }, []);
85
+ var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
86
+ return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Meter(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
87
+ }
88
+ DefaultSearch.Meter = Meter;
89
+ /** This Implements a standard Substation Search */
90
+ function Location(props) {
91
+ var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
92
+ var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
93
+ var dispatch = (0, react_redux_1.useDispatch)();
94
+ var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
95
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
96
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
97
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
98
+ var defaultSearchcols = [
99
+ { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
100
+ { label: 'Key', key: 'LocationKey', type: 'string', isPivotField: false },
101
+ { label: 'Transmission Asset', key: 'Asset', type: 'string', isPivotField: false },
102
+ { label: 'Meter', key: 'Meter', type: 'string', isPivotField: false },
103
+ { label: 'Number of Transmission Assets', key: 'Assets', type: 'integer', isPivotField: false },
104
+ { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: false },
105
+ { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
106
+ ];
107
+ React.useEffect(function () {
108
+ return props.GetAddlFields(setAddlFieldCols);
109
+ }, []);
110
+ return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Substation(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
111
+ }
112
+ DefaultSearch.Location = Location;
113
+ /** This Implements a standard Transmission Asset Search */
114
+ function Asset(props) {
115
+ var standardSearch = { label: 'Name', key: 'AssetName', type: 'string', isPivotField: false };
116
+ var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
117
+ var dispatch = (0, react_redux_1.useDispatch)();
118
+ var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
119
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
120
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
121
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
122
+ var defaultSearchcols = [
123
+ { label: 'Key', key: 'AssetKey', type: 'string', isPivotField: false },
124
+ { label: 'Name', key: 'AssetName', type: 'string', isPivotField: false },
125
+ { label: 'Nominal Voltage (L-L kV)', key: 'VoltageKV', type: 'number', isPivotField: false },
126
+ { label: 'Type', key: 'AssetType', type: 'enum', isPivotField: false },
127
+ { label: 'Meter Key', key: 'Meter', type: 'string', isPivotField: false },
128
+ { label: 'Substation Key', key: 'Location', type: 'string', isPivotField: false },
129
+ { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: false },
130
+ { label: 'Number of Substations', key: 'Locations', type: 'integer', isPivotField: false },
131
+ { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
132
+ ];
133
+ React.useEffect(function () {
134
+ return props.GetAddlFields(setAddlFieldCols);
135
+ }, []);
136
+ return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Transmission Asset(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
137
+ }
138
+ DefaultSearch.Asset = Asset;
139
+ /** This Implements a standard AssetGroup Search */
140
+ function AssetGroup(props) {
141
+ var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
142
+ var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
143
+ var dispatch = (0, react_redux_1.useDispatch)();
144
+ var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
145
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
146
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
147
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
148
+ var defaultSearchcols = [
149
+ { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
150
+ { label: 'Number of Meters', key: 'Meters', type: 'integer', isPivotField: false },
151
+ { label: 'Number of Transmission Assets', key: 'Assets', type: 'integer', isPivotField: false },
152
+ { label: 'Number of Asset Groups', key: 'AssetGroups', type: 'integer', isPivotField: false },
153
+ { label: 'Show in PQ Dashboard', key: 'DisplayDashboard', type: 'boolean', isPivotField: false },
154
+ { label: 'Show in Email Subscription', key: 'DisplayEmail', type: 'boolean', isPivotField: false },
155
+ ];
156
+ React.useEffect(function () {
157
+ return props.GetAddlFields(setAddlFieldCols);
158
+ }, []);
159
+ return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Asset Group(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
160
+ }
161
+ DefaultSearch.AssetGroup = AssetGroup;
162
+ /** This Implements a standard User Search */
163
+ function User(props) {
164
+ var standardSearch = { label: 'Username', key: 'Name', type: 'string', isPivotField: false };
165
+ var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
166
+ var dispatch = (0, react_redux_1.useDispatch)();
167
+ var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
168
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
169
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
170
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
171
+ var defaultSearchcols = [
172
+ { label: 'Username', key: 'Name', type: 'string', isPivotField: false },
173
+ { label: 'Email', key: 'Email', type: 'string', isPivotField: false },
174
+ { label: 'Account Locked', key: 'LockedOut', type: 'boolean', isPivotField: false },
175
+ ];
176
+ React.useEffect(function () {
177
+ return props.GetAddlFields(setAddlFieldCols);
178
+ }, []);
179
+ return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' User(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
180
+ }
181
+ DefaultSearch.User = User;
182
+ /** This Implements a standard Customer Search */
183
+ function Customer(props) {
184
+ var defaultSearchcols = [
185
+ { label: 'Name', key: 'Name', type: 'string', isPivotField: false },
186
+ { label: 'Account Name', key: 'CustomerKey', type: 'string', isPivotField: false },
187
+ { label: 'Phone', key: 'Phone', type: 'string', isPivotField: false },
188
+ { label: 'Description', key: 'Description', type: 'string', isPivotField: false },
189
+ ];
190
+ var standardSearch = { label: 'Name', key: 'Name', type: 'string', isPivotField: false };
191
+ var _a = React.useState([]), addlFieldCols = _a[0], setAddlFieldCols = _a[1];
192
+ var dispatch = (0, react_redux_1.useDispatch)();
193
+ var searchStatus = (0, react_redux_1.useSelector)(props.Slice.SearchStatus);
194
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
195
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
196
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
197
+ React.useEffect(function () {
198
+ return props.GetAddlFields(setAddlFieldCols);
199
+ }, []);
200
+ return React.createElement(react_interactive_1.SearchBar, { CollumnList: __spreadArray(__spreadArray([], defaultSearchcols, true), addlFieldCols, true), SetFilter: function (flds) { return dispatch(props.Slice.DBSearch({ filter: (props.AddlFilters === undefined ? flds : __spreadArray(__spreadArray([], flds, true), props.AddlFilters, true)), sortField: sortField, ascending: ascending })); }, Direction: 'left', defaultCollumn: standardSearch, Width: '50%', Label: 'Search', ShowLoading: searchStatus === 'loading', ResultNote: searchStatus === 'error' ? 'Could not complete Search' : 'Found ' + data.length + ' Customer(s)', GetEnum: props.GetEnum, StorageID: props.StorageID }, props.children);
201
+ }
202
+ DefaultSearch.Customer = Customer;
203
+ })(DefaultSearch || (exports.DefaultSearch = DefaultSearch = {}));
@@ -1,42 +1,42 @@
1
- import React = require("react");
2
- import { GenericSlice, Search } from "@gpa-gemstone/react-interactive";
3
- import { Application, OpenXDA, SystemCenter } from "@gpa-gemstone/application-typings";
4
- import { Column } from "@gpa-gemstone/react-table";
5
- interface U {
6
- ID: number | string;
7
- }
8
- interface IProps<T extends U> {
9
- Slice: GenericSlice<T>;
10
- Selection: T[];
11
- OnClose: (selected: T[], conf: boolean) => void;
12
- Show: boolean;
13
- Type?: 'single' | 'multiple';
14
- Columns: Column<T>[];
15
- Title: string;
16
- GetEnum: (setOptions: (options: IOptions[]) => void, field: Search.IField<T>) => () => void;
17
- GetAddlFields: (setAddlFields: (cols: Search.IField<T>[]) => void) => () => void;
18
- AddlFilters?: Search.IFilter<T>[];
19
- MinSelection?: number;
20
- children?: React.ReactNode;
21
- StorageID?: string;
22
- }
23
- interface IOptions {
24
- Value: string;
25
- Label: string;
26
- }
27
- /** This Implements a few standardized Selection Popups */
28
- export declare namespace DefaultSelects {
29
- /** This Implements a standard Meter Selection Modal */
30
- function Meter(props: IProps<SystemCenter.Types.DetailedMeter>): JSX.Element;
31
- /** This Implements a standard Substation Selection Modal */
32
- function Location(props: IProps<SystemCenter.Types.DetailedLocation>): JSX.Element;
33
- /** This Implements a standard Transmission Asset Selection Modal */
34
- function Asset(props: IProps<SystemCenter.Types.DetailedAsset>): JSX.Element;
35
- /** This Implements a standard Asset Group Selection Modal */
36
- function AssetGroup(props: IProps<OpenXDA.Types.AssetGroup>): JSX.Element;
37
- /** This Implements a standard User Selection Modal */
38
- function User(props: IProps<Application.Types.iUserAccount>): JSX.Element;
39
- /** This Implements a standard Customer Selection Modal */
40
- function Customer(props: IProps<OpenXDA.Types.Customer>): JSX.Element;
41
- }
42
- export {};
1
+ import React = require("react");
2
+ import { GenericSlice, Search } from "@gpa-gemstone/react-interactive";
3
+ import { Application, OpenXDA, SystemCenter } from "@gpa-gemstone/application-typings";
4
+ import { Column } from "@gpa-gemstone/react-table";
5
+ interface U {
6
+ ID: number | string;
7
+ }
8
+ interface IProps<T extends U> {
9
+ Slice: GenericSlice<T>;
10
+ Selection: T[];
11
+ OnClose: (selected: T[], conf: boolean) => void;
12
+ Show: boolean;
13
+ Type?: 'single' | 'multiple';
14
+ Columns: Column<T>[];
15
+ Title: string;
16
+ GetEnum: (setOptions: (options: IOptions[]) => void, field: Search.IField<T>) => () => void;
17
+ GetAddlFields: (setAddlFields: (cols: Search.IField<T>[]) => void) => () => void;
18
+ AddlFilters?: Search.IFilter<T>[];
19
+ MinSelection?: number;
20
+ children?: React.ReactNode;
21
+ StorageID?: string;
22
+ }
23
+ interface IOptions {
24
+ Value: string;
25
+ Label: string;
26
+ }
27
+ /** This Implements a few standardized Selection Popups */
28
+ export declare namespace DefaultSelects {
29
+ /** This Implements a standard Meter Selection Modal */
30
+ function Meter(props: IProps<SystemCenter.Types.DetailedMeter>): React.JSX.Element;
31
+ /** This Implements a standard Substation Selection Modal */
32
+ function Location(props: IProps<SystemCenter.Types.DetailedLocation>): React.JSX.Element;
33
+ /** This Implements a standard Transmission Asset Selection Modal */
34
+ function Asset(props: IProps<SystemCenter.Types.DetailedAsset>): React.JSX.Element;
35
+ /** This Implements a standard Asset Group Selection Modal */
36
+ function AssetGroup(props: IProps<OpenXDA.Types.AssetGroup>): React.JSX.Element;
37
+ /** This Implements a standard User Selection Modal */
38
+ function User(props: IProps<Application.Types.iUserAccount>): React.JSX.Element;
39
+ /** This Implements a standard Customer Selection Modal */
40
+ function Customer(props: IProps<OpenXDA.Types.Customer>): React.JSX.Element;
41
+ }
42
+ export {};