@gpa-gemstone/common-pages 0.0.104 → 0.0.106
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 +11 -10
package/lib/Note.js
CHANGED
@@ -1,230 +1,256 @@
|
|
1
|
-
"use strict";
|
2
|
-
// ******************************************************************************************************
|
3
|
-
// Note.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
|
-
// 04/28/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.
|
35
|
-
|
36
|
-
var
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
var
|
70
|
-
var
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
React.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
if (props.
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
if (props.
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
" ",
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
React.createElement("
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
}
|
230
|
-
|
1
|
+
"use strict";
|
2
|
+
// ******************************************************************************************************
|
3
|
+
// Note.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
|
+
// 04/28/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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
35
|
+
if (k2 === undefined) k2 = k;
|
36
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
37
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
38
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
39
|
+
}
|
40
|
+
Object.defineProperty(o, k2, desc);
|
41
|
+
}) : (function(o, m, k, k2) {
|
42
|
+
if (k2 === undefined) k2 = k;
|
43
|
+
o[k2] = m[k];
|
44
|
+
}));
|
45
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
46
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
47
|
+
}) : function(o, v) {
|
48
|
+
o["default"] = v;
|
49
|
+
});
|
50
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
51
|
+
if (mod && mod.__esModule) return mod;
|
52
|
+
var result = {};
|
53
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
54
|
+
__setModuleDefault(result, mod);
|
55
|
+
return result;
|
56
|
+
};
|
57
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
58
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
59
|
+
};
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
61
|
+
var React = __importStar(require("react"));
|
62
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
63
|
+
var react_table_1 = __importDefault(require("@gpa-gemstone/react-table"));
|
64
|
+
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
65
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
66
|
+
var moment = require("moment");
|
67
|
+
var react_redux_1 = require("react-redux");
|
68
|
+
function Note(props) {
|
69
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
70
|
+
var standardCollumns = [
|
71
|
+
{
|
72
|
+
key: 'Note', field: 'Note', label: 'Note',
|
73
|
+
headerStyle: { width: '50%' }, rowStyle: { width: '50%' }
|
74
|
+
},
|
75
|
+
{
|
76
|
+
key: 'Timestamp', field: 'Timestamp', label: 'Time',
|
77
|
+
headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' },
|
78
|
+
content: function (item) { return moment.utc(item.Timestamp).format("MM/DD/YYYY HH:mm"); }
|
79
|
+
},
|
80
|
+
{
|
81
|
+
key: 'UserAccount', field: 'UserAccount', label: 'User',
|
82
|
+
headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' }
|
83
|
+
}
|
84
|
+
];
|
85
|
+
var allowEdit = props.AllowEdit === undefined ? true : props.AllowEdit;
|
86
|
+
var allowRemove = props.AllowRemove === undefined ? true : props.AllowRemove;
|
87
|
+
var allowAdd = props.AllowAdd === undefined ? true : props.AllowAdd;
|
88
|
+
var useFixedApp = props.NoteApplications.length === 1 || props.DefaultApplication !== undefined;
|
89
|
+
var defaultApplication = props.DefaultApplication !== undefined ? props.DefaultApplication : props.NoteApplications[0];
|
90
|
+
var showCard = props.ShowCard === undefined || props.ShowCard;
|
91
|
+
var _a = React.useState(false), showEdit = _a[0], setEdit = _a[1];
|
92
|
+
var _b = React.useState('none'), hover = _b[0], setHover = _b[1];
|
93
|
+
var _c = React.useState(standardCollumns), collumns = _c[0], setCollumns = _c[1];
|
94
|
+
var data = (0, react_redux_1.useSelector)(props.NoteSlice.Data);
|
95
|
+
var dataStatus = (0, react_redux_1.useSelector)(props.NoteSlice.Status);
|
96
|
+
var parentID = (0, react_redux_1.useSelector)((props.NoteSlice.ParentID === undefined ? function (state) { return props.ReferenceTableID; } : props.NoteSlice.ParentID));
|
97
|
+
var sortField = (0, react_redux_1.useSelector)(props.NoteSlice.SortField);
|
98
|
+
var ascending = (0, react_redux_1.useSelector)(props.NoteSlice.Ascending);
|
99
|
+
var _d = React.useState(CreateNewNote()), note = _d[0], setNote = _d[1];
|
100
|
+
var _e = React.useState([]), notes = _e[0], setNotes = _e[1];
|
101
|
+
React.useEffect(function () {
|
102
|
+
if (dataStatus === 'unintiated' || dataStatus === 'changed' || parentID !== props.ReferenceTableID)
|
103
|
+
dispatch(props.NoteSlice.Fetch(props.ReferenceTableID));
|
104
|
+
}, [props.ReferenceTableID, dispatch, dataStatus]);
|
105
|
+
React.useEffect(function () {
|
106
|
+
if (note.NoteTypeID > 0 || props.NoteTypes.length === 0)
|
107
|
+
return;
|
108
|
+
setNote(function (n) { return (__assign(__assign({}, n), { NoteTypeID: props.NoteTypes[0].ID })); });
|
109
|
+
}, [props.NoteTypes]);
|
110
|
+
React.useEffect(function () {
|
111
|
+
if (note.NoteApplicationID > 0 || props.NoteApplications.length === 0)
|
112
|
+
return;
|
113
|
+
setNote(function (n) { return (__assign(__assign({}, n), { NoteApplicationID: props.NoteApplications[0].ID })); });
|
114
|
+
}, [props.NoteApplications]);
|
115
|
+
React.useEffect(function () {
|
116
|
+
if (note.NoteTagID > 0 || props.NoteTags.length === 0)
|
117
|
+
return;
|
118
|
+
setNote(function (n) { return (__assign(__assign({}, n), { NoteTagID: props.NoteTags[0].ID })); });
|
119
|
+
}, [props.NoteTags]);
|
120
|
+
React.useEffect(function () {
|
121
|
+
if (note.ReferenceTableID === undefined)
|
122
|
+
return;
|
123
|
+
setNote(function (n) { return (__assign(__assign({}, n), { ReferenceTableID: props.ReferenceTableID !== undefined ? props.ReferenceTableID : -1 })); });
|
124
|
+
}, [props.ReferenceTableID]);
|
125
|
+
React.useEffect(function () {
|
126
|
+
var c = standardCollumns;
|
127
|
+
if (props.AdditionalCollumns !== undefined)
|
128
|
+
c.push.apply(c, props.AdditionalCollumns);
|
129
|
+
if (props.NoteTags.length > 1)
|
130
|
+
c.push({ key: 'NoteTagID', field: 'NoteTagID', label: 'Type', headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' },
|
131
|
+
content: function (n) { var _a; return (_a = props.NoteTags.find(function (t) { return t.ID === n.NoteTagID; })) === null || _a === void 0 ? void 0 : _a.Name; } });
|
132
|
+
if (props.NoteApplications.length > 1)
|
133
|
+
c.push({ key: 'NoteApplicationID', field: 'NoteApplicationID', label: 'Application', headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' },
|
134
|
+
content: function (n) { var _a; return (_a = props.NoteApplications.find(function (t) { return t.ID === n.NoteApplicationID; })) === null || _a === void 0 ? void 0 : _a.Name; } });
|
135
|
+
c.push({
|
136
|
+
key: 'buttons',
|
137
|
+
label: '',
|
138
|
+
headerStyle: { width: 'auto' }, rowStyle: { width: 'auto' },
|
139
|
+
content: function (item) { return React.createElement(React.Fragment, null,
|
140
|
+
allowEdit ? React.createElement("button", { className: "btn btn-sm", onClick: function () { return handleEdit(item); } },
|
141
|
+
React.createElement("span", null,
|
142
|
+
" ",
|
143
|
+
gpa_symbols_1.Pencil,
|
144
|
+
" ")) : null,
|
145
|
+
allowRemove ? React.createElement("button", { className: "btn btn-sm", onClick: function () { return dispatch(props.NoteSlice.DBAction({ verb: 'DELETE', record: item })); } },
|
146
|
+
React.createElement("span", null,
|
147
|
+
" ",
|
148
|
+
gpa_symbols_1.TrashCan,
|
149
|
+
" ")) : null); }
|
150
|
+
});
|
151
|
+
setCollumns(c);
|
152
|
+
}, [props.NoteTags, props.NoteApplications, props.AdditionalCollumns]);
|
153
|
+
React.useEffect(function () {
|
154
|
+
setNotes(data.filter(function (n) { return (props.Filter === undefined ? true : props.Filter(n)); }));
|
155
|
+
}, [props.Filter, data]);
|
156
|
+
function CreateNewNote() {
|
157
|
+
var newNote = { ID: -1, ReferenceTableID: -1, NoteTagID: -1, NoteTypeID: -1, NoteApplicationID: -1, Timestamp: '', UserAccount: '', Note: '' };
|
158
|
+
if (props.ReferenceTableID !== undefined)
|
159
|
+
newNote.ReferenceTableID = props.ReferenceTableID;
|
160
|
+
if (defaultApplication != null)
|
161
|
+
newNote.NoteApplicationID = defaultApplication.ID;
|
162
|
+
if (props.NoteTypes.length > 0)
|
163
|
+
newNote.NoteTypeID = props.NoteTypes[0].ID;
|
164
|
+
if (props.NoteTags.length > 0)
|
165
|
+
newNote.NoteTagID = props.NoteTags[0].ID;
|
166
|
+
return newNote;
|
167
|
+
}
|
168
|
+
function handleEdit(d) {
|
169
|
+
setNote(d);
|
170
|
+
setEdit(true);
|
171
|
+
}
|
172
|
+
function handleAdd(d) {
|
173
|
+
dispatch(props.NoteSlice.DBAction({ verb: 'POST', record: __assign(__assign({}, d), { UserAccount: undefined, Timestamp: moment().format('MM/DD/YYYY HH:mm') }) }));
|
174
|
+
setNote(CreateNewNote());
|
175
|
+
}
|
176
|
+
function handleSaveEdit(confirm) {
|
177
|
+
if (note.Note.length === 0 && confirm)
|
178
|
+
return;
|
179
|
+
setEdit(false);
|
180
|
+
if (confirm && allowEdit)
|
181
|
+
dispatch(props.NoteSlice.DBAction({ verb: 'PATCH', record: note }));
|
182
|
+
setNote(CreateNewNote());
|
183
|
+
}
|
184
|
+
if (dataStatus === "error")
|
185
|
+
return (React.createElement("div", { style: { width: '100%', height: '100%' } },
|
186
|
+
React.createElement("div", { style: { height: '40px', margin: 'auto', marginTop: 'calc(50% - 20 px)' } },
|
187
|
+
React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Size: 40 }))));
|
188
|
+
return (React.createElement("div", { className: showCard ? "card" : "", style: { marginBottom: 10, maxHeight: props.MaxHeight, width: '100%' } },
|
189
|
+
React.createElement(react_interactive_1.LoadingScreen, { Show: dataStatus === 'loading' }),
|
190
|
+
React.createElement("div", { className: props.ShowCard === undefined || props.ShowCard ? "card-header" : "" },
|
191
|
+
React.createElement("div", { className: "row" },
|
192
|
+
React.createElement("div", { className: "col" },
|
193
|
+
React.createElement("h4", null, props.Title !== undefined ? props.Title : 'Notes:')))),
|
194
|
+
React.createElement("div", { className: showCard ? "card-body" : "", style: { maxHeight: props.MaxHeight - 100, overflowY: 'auto', width: '100%' } },
|
195
|
+
allowAdd && !showCard ?
|
196
|
+
React.createElement(React.Fragment, null,
|
197
|
+
React.createElement(NoteOptions, { Record: note, Setter: function (n) { return setNote(n); }, NoteTags: props.NoteTags, NoteTypes: props.NoteTypes, NoteApplications: props.NoteApplications, ShowApplications: !useFixedApp }),
|
198
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
199
|
+
React.createElement("button", { className: "btn btn-primary" + (note.Note === null || note.Note.length === 0 ? ' disabled' : ''), onClick: function () { if (note.Note !== null && note.Note.length > 0)
|
200
|
+
handleAdd(note); }, "data-tooltip": "Add", style: { cursor: note.Note === null || note.Note.length === 0 ? 'not-allowed' : 'pointer' }, onMouseOver: function () { return setHover('add'); }, onMouseOut: function () { return setHover('none'); } }, "Add Note"),
|
201
|
+
React.createElement(react_interactive_1.ToolTip, { Show: hover === 'add' && (note.Note === null || note.Note.length === 0), Position: 'top', Theme: 'dark', Target: "Add" },
|
202
|
+
React.createElement("p", null,
|
203
|
+
gpa_symbols_1.CrossMark,
|
204
|
+
" A note needs to be entered. "))),
|
205
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
206
|
+
React.createElement("button", { className: "btn btn-default" + (note.Note === null || note.Note.length === 0 ? ' disabled' : ''), onClick: function () { return setNote(function (n) { return (__assign(__assign({}, n), { Note: '' })); }); }, style: { cursor: note.Note === null || note.Note.length === 0 ? 'not-allowed' : 'pointer' }, "data-tooltip": "Remove", onMouseOver: function () { return setHover('clear'); }, onMouseOut: function () { return setHover('none'); } }, "Clear"),
|
207
|
+
React.createElement(react_interactive_1.ToolTip, { Show: hover === 'clear' && (note.Note === null || note.Note.length === 0), Position: 'top', Theme: 'dark', Target: "Remove" },
|
208
|
+
React.createElement("p", null,
|
209
|
+
gpa_symbols_1.CrossMark,
|
210
|
+
" The note field is already empty. ")))) : null,
|
211
|
+
React.createElement("div", null,
|
212
|
+
React.createElement(react_table_1.default, { cols: collumns, tableClass: "table table-hover", data: notes, sortKey: sortField, ascending: ascending, onSort: function (d) {
|
213
|
+
if (d.colField === undefined)
|
214
|
+
return;
|
215
|
+
if (d.colField === sortField)
|
216
|
+
dispatch(props.NoteSlice.Sort({ SortField: sortField, Ascending: ascending }));
|
217
|
+
else
|
218
|
+
dispatch(props.NoteSlice.Sort({ SortField: d.colField, Ascending: true }));
|
219
|
+
}, onClick: function () { return; }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: props.MaxHeight - 300, width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function () { return false; } })),
|
220
|
+
allowAdd && showCard ?
|
221
|
+
React.createElement(NoteOptions, { Record: note, Setter: function (n) { return setNote(n); }, NoteTags: props.NoteTags, NoteTypes: props.NoteTypes, NoteApplications: props.NoteApplications, ShowApplications: !useFixedApp })
|
222
|
+
: null,
|
223
|
+
React.createElement(react_interactive_1.Modal, { Show: showEdit, Title: 'Edit Note', ShowCancel: true, CallBack: handleSaveEdit, DisableConfirm: note.Note == null || note.Note.length === 0, ShowX: true, ConfirmShowToolTip: note.Note == null || note.Note.length === 0, ConfirmToolTipContent: React.createElement("p", null,
|
224
|
+
" ",
|
225
|
+
gpa_symbols_1.CrossMark,
|
226
|
+
" An empty Note can not be saved. ") },
|
227
|
+
React.createElement(NoteOptions, { ShowApplications: !useFixedApp, Record: note, Setter: function (n) { return setNote(n); }, NoteTags: props.NoteTags, NoteTypes: props.NoteTypes, NoteApplications: props.NoteApplications }))),
|
228
|
+
allowAdd && showCard ?
|
229
|
+
React.createElement("div", { className: "card-footer" },
|
230
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
231
|
+
React.createElement("button", { className: "btn btn-primary" + (note.Note === null || note.Note.length === 0 ? ' disabled' : ''), onClick: function () { if (note.Note !== null && note.Note.length > 0)
|
232
|
+
handleAdd(note); }, "data-tooltip": "Add", style: { cursor: note.Note === null || note.Note.length === 0 ? 'not-allowed' : 'pointer' }, onMouseOver: function () { return setHover('add'); }, onMouseOut: function () { return setHover('none'); } }, "Add Note"),
|
233
|
+
React.createElement(react_interactive_1.ToolTip, { Show: hover === 'add' && (note.Note === null || note.Note.length === 0), Position: 'top', Theme: 'dark', Target: "Add" },
|
234
|
+
React.createElement("p", null,
|
235
|
+
gpa_symbols_1.CrossMark,
|
236
|
+
" A note needs to be entered. "))),
|
237
|
+
React.createElement("div", { className: "btn-group mr-2" },
|
238
|
+
React.createElement("button", { className: "btn btn-default" + (note.Note === null || note.Note.length === 0 ? ' disabled' : ''), onClick: function () { return setNote(function (n) { return (__assign(__assign({}, n), { Note: '' })); }); }, style: { cursor: note.Note === null || note.Note.length === 0 ? 'not-allowed' : 'pointer' }, "data-tooltip": "Remove", onMouseOver: function () { return setHover('clear'); }, onMouseOut: function () { return setHover('none'); } }, "Clear"),
|
239
|
+
React.createElement(react_interactive_1.ToolTip, { Show: hover === 'clear' && (note.Note === null || note.Note.length === 0), Position: 'top', Theme: 'dark', Target: "Remove" },
|
240
|
+
React.createElement("p", null,
|
241
|
+
gpa_symbols_1.CrossMark,
|
242
|
+
" The note field is already empty. "))))
|
243
|
+
: null,
|
244
|
+
!allowAdd && showCard ? React.createElement("div", { className: props.ShowCard === undefined || props.ShowCard ? "card-footer" : "" }, " ") : null));
|
245
|
+
}
|
246
|
+
function NoteOptions(props) {
|
247
|
+
var showOptions = props.NoteTags.length > 1 || props.NoteTypes.length > 1 || props.NoteApplications.length > 1;
|
248
|
+
return (React.createElement("div", { className: "row", style: { marginRight: 0, marginLeft: 0 } },
|
249
|
+
React.createElement("div", { className: showOptions ? "col-6" : 'col-12' },
|
250
|
+
React.createElement(react_forms_1.TextArea, { Record: props.Record, Rows: 4, Field: 'Note', Setter: function (n) { return props.Setter(n); }, Valid: function () { return props.Record.Note != null && props.Record.Note.length > 0; }, Label: '' })),
|
251
|
+
showOptions ? React.createElement("div", { className: "col-6" },
|
252
|
+
props.NoteTypes.length > 1 ? React.createElement(react_forms_1.Select, { Record: props.Record, Field: 'NoteTypeID', Label: 'Note for: ', Options: props.NoteTypes.map(function (r) { return ({ Value: r.ID.toString(), Label: r.Name }); }), Setter: function (record) { return props.Setter(__assign(__assign({}, record), { NoteTypeID: parseInt(record.NoteTypeID.toString(), 10) })); } }) : null,
|
253
|
+
props.NoteTags.length > 1 ? React.createElement(react_forms_1.Select, { Record: props.Record, Field: 'NoteTagID', Label: 'Type: ', Options: props.NoteTags.map(function (r) { return ({ Value: r.ID.toString(), Label: r.Name }); }), Setter: function (record) { return props.Setter(__assign(__assign({}, record), { NoteTagID: parseInt(record.NoteTagID.toString(), 10) })); } }) : null,
|
254
|
+
props.ShowApplications && props.NoteApplications.length > 1 ? React.createElement(react_forms_1.Select, { Record: props.Record, Field: 'NoteApplicationID', Label: 'Application: ', Options: props.NoteApplications.map(function (r) { return ({ Value: r.ID.toString(), Label: r.Name }); }), Setter: function (record) { return props.Setter(__assign(__assign({}, record), { NoteApplicationID: parseInt(record.NoteApplicationID.toString(), 10) })); } }) : null) : null));
|
255
|
+
}
|
256
|
+
exports.default = Note;
|
package/lib/SearchBar.d.ts
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { GenericSlice, Search } from '@gpa-gemstone/react-interactive';
|
3
|
-
import { OpenXDA, SystemCenter, Application } from '@gpa-gemstone/application-typings';
|
4
|
-
interface U {
|
5
|
-
ID: number | string;
|
6
|
-
}
|
7
|
-
interface IProps<T extends U> {
|
8
|
-
/** A Generic Slyce for the Search */
|
9
|
-
Slice: GenericSlice<T>;
|
10
|
-
/** Functions that gets available values for any ENUM Types */
|
11
|
-
GetEnum: (setOptions: (options: IOptions[]) => void, field: Search.IField<T>) => () => void;
|
12
|
-
/** Function that Grabs any additional Filters that shoudl be available (such as Addl Fields) */
|
13
|
-
GetAddlFields: (setAddlFields: (cols: Search.IField<T>[]) => void) => () => void;
|
14
|
-
children: React.ReactNode;
|
15
|
-
AddlFilters?: Search.IFilter<T>[];
|
16
|
-
StorageID?: string;
|
17
|
-
}
|
18
|
-
interface IOptions {
|
19
|
-
Value: string;
|
20
|
-
Label: string;
|
21
|
-
}
|
22
|
-
/** This Implements a few standardized SearchBars */
|
23
|
-
export declare namespace DefaultSearch {
|
24
|
-
/** This Implements a standard Meter Search */
|
25
|
-
function Meter(props: IProps<SystemCenter.Types.DetailedMeter>): JSX.Element;
|
26
|
-
/** This Implements a standard Substation Search */
|
27
|
-
function Location(props: IProps<SystemCenter.Types.DetailedLocation>): JSX.Element;
|
28
|
-
/** This Implements a standard Transmission Asset Search */
|
29
|
-
function Asset(props: IProps<SystemCenter.Types.DetailedAsset>): JSX.Element;
|
30
|
-
/** This Implements a standard AssetGroup Search */
|
31
|
-
function AssetGroup(props: IProps<OpenXDA.Types.AssetGroup>): JSX.Element;
|
32
|
-
/** This Implements a standard User Search */
|
33
|
-
function User(props: IProps<Application.Types.iUserAccount>): JSX.Element;
|
34
|
-
/** This Implements a standard Customer Search */
|
35
|
-
function Customer(props: IProps<OpenXDA.Types.Customer>): JSX.Element;
|
36
|
-
}
|
37
|
-
export {};
|
1
|
+
import * as React from 'react';
|
2
|
+
import { GenericSlice, Search } from '@gpa-gemstone/react-interactive';
|
3
|
+
import { OpenXDA, SystemCenter, Application } from '@gpa-gemstone/application-typings';
|
4
|
+
interface U {
|
5
|
+
ID: number | string;
|
6
|
+
}
|
7
|
+
interface IProps<T extends U> {
|
8
|
+
/** A Generic Slyce for the Search */
|
9
|
+
Slice: GenericSlice<T>;
|
10
|
+
/** Functions that gets available values for any ENUM Types */
|
11
|
+
GetEnum: (setOptions: (options: IOptions[]) => void, field: Search.IField<T>) => () => void;
|
12
|
+
/** Function that Grabs any additional Filters that shoudl be available (such as Addl Fields) */
|
13
|
+
GetAddlFields: (setAddlFields: (cols: Search.IField<T>[]) => void) => () => void;
|
14
|
+
children: React.ReactNode;
|
15
|
+
AddlFilters?: Search.IFilter<T>[];
|
16
|
+
StorageID?: string;
|
17
|
+
}
|
18
|
+
interface IOptions {
|
19
|
+
Value: string;
|
20
|
+
Label: string;
|
21
|
+
}
|
22
|
+
/** This Implements a few standardized SearchBars */
|
23
|
+
export declare namespace DefaultSearch {
|
24
|
+
/** This Implements a standard Meter Search */
|
25
|
+
function Meter(props: IProps<SystemCenter.Types.DetailedMeter>): React.JSX.Element;
|
26
|
+
/** This Implements a standard Substation Search */
|
27
|
+
function Location(props: IProps<SystemCenter.Types.DetailedLocation>): React.JSX.Element;
|
28
|
+
/** This Implements a standard Transmission Asset Search */
|
29
|
+
function Asset(props: IProps<SystemCenter.Types.DetailedAsset>): React.JSX.Element;
|
30
|
+
/** This Implements a standard AssetGroup Search */
|
31
|
+
function AssetGroup(props: IProps<OpenXDA.Types.AssetGroup>): React.JSX.Element;
|
32
|
+
/** This Implements a standard User Search */
|
33
|
+
function User(props: IProps<Application.Types.iUserAccount>): React.JSX.Element;
|
34
|
+
/** This Implements a standard Customer Search */
|
35
|
+
function Customer(props: IProps<OpenXDA.Types.Customer>): React.JSX.Element;
|
36
|
+
}
|
37
|
+
export {};
|