@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.
- package/lib/ErrorBoundary.d.ts +17 -17
- package/lib/ErrorBoundary.js +91 -68
- package/lib/Note.d.ts +22 -22
- package/lib/Note.js +256 -230
- package/lib/SearchBar.d.ts +37 -37
- package/lib/SearchBar.js +203 -180
- package/lib/SelectionPopup.d.ts +42 -42
- package/lib/SelectionPopup.js +93 -90
- package/lib/Setting.d.ts +8 -8
- package/lib/Setting.js +151 -125
- package/lib/SliceInterfaces.d.ts +76 -76
- package/lib/SliceInterfaces.js +2 -2
- package/lib/StandardSelectPopup.d.ts +20 -20
- package/lib/StandardSelectPopup.js +135 -109
- package/lib/TimeFilter/QuickSelects.d.ts +7 -0
- package/lib/TimeFilter/QuickSelects.js +240 -0
- package/lib/TimeFilter.d.ts +26 -0
- package/lib/TimeFilter.js +270 -0
- package/lib/TimeWindowUtils.d.ts +33 -0
- package/lib/TimeWindowUtils.js +121 -0
- package/lib/ValueList/ByValueList.d.ts +10 -10
- package/lib/ValueList/ByValueList.js +141 -115
- package/lib/ValueList/Group.d.ts +11 -11
- package/lib/ValueList/Group.js +97 -71
- package/lib/ValueList/GroupForm.d.ts +9 -9
- package/lib/ValueList/GroupForm.js +74 -51
- package/lib/ValueList/GroupInfo.d.ts +8 -8
- package/lib/ValueList/GroupInfo.js +95 -69
- package/lib/ValueList/GroupItem.d.ts +9 -9
- package/lib/ValueList/GroupItem.js +142 -116
- package/lib/ValueList/ItemForm.d.ts +9 -9
- package/lib/ValueList/ItemForm.js +82 -59
- package/lib/index.d.ts +12 -11
- package/lib/index.js +50 -45
- package/lib/user/AdditionalField.d.ts +26 -26
- package/lib/user/AdditionalField.js +290 -264
- package/lib/user/ByUser.d.ts +12 -12
- package/lib/user/ByUser.js +174 -148
- package/lib/user/User.d.ts +14 -14
- package/lib/user/User.js +97 -71
- package/lib/user/UserForm.d.ts +12 -12
- package/lib/user/UserForm.js +166 -143
- package/lib/user/UserInfo.d.ts +7 -7
- package/lib/user/UserInfo.js +123 -97
- package/lib/user/UserPermissions.d.ts +8 -8
- package/lib/user/UserPermissions.js +106 -83
- 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
|
26
|
-
if (
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
var
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
(function (
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
var
|
93
|
-
var
|
94
|
-
var
|
95
|
-
var
|
96
|
-
var
|
97
|
-
var
|
98
|
-
var
|
99
|
-
|
100
|
-
{ label: 'Key', key: '
|
101
|
-
{ label: '
|
102
|
-
{ label: '
|
103
|
-
{ label: '
|
104
|
-
{ label: '
|
105
|
-
{ label: '
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
];
|
110
|
-
React.
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
var
|
119
|
-
var
|
120
|
-
var
|
121
|
-
var
|
122
|
-
var
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
{ label: '
|
127
|
-
{ label: '
|
128
|
-
{ label: '
|
129
|
-
{ label: 'Number of
|
130
|
-
{ label: '
|
131
|
-
{ label: '
|
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
|
137
|
-
}
|
138
|
-
DefaultSearch.
|
139
|
-
/** This Implements a standard
|
140
|
-
function
|
141
|
-
var standardSearch = { label: '
|
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: '
|
150
|
-
{ label: '
|
151
|
-
{ label: '
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
var
|
168
|
-
var
|
169
|
-
var
|
170
|
-
var
|
171
|
-
var
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
}
|
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 = {}));
|
package/lib/SelectionPopup.d.ts
CHANGED
@@ -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 {};
|