@gpa-gemstone/common-pages 0.0.130 → 0.0.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/BulkUpload.js CHANGED
@@ -113,10 +113,9 @@ function BulkUpload(props) {
113
113
  }, [rawFileContent, fileName, isFileTypeValid, pipelineErrors, props.Step]);
114
114
  React.useEffect(function () {
115
115
  var _a;
116
- if (props.Step !== 'Complete' || ((_a = props.CompleteOnReview) !== null && _a !== void 0 ? _a : false))
117
- return;
118
- props.OnComplete(data);
119
- }, [props.Step, data, props.OnComplete]);
116
+ if ((props.Step === 'Review' && ((_a = props.CompleteOnReview) !== null && _a !== void 0 ? _a : false)) || props.Step === 'Complete')
117
+ props.OnComplete(data);
118
+ }, [props.Step, props.CompleteOnReview, data]);
120
119
  var handleFileUpload = function (file) {
121
120
  var matchArray = file.name.match(fileExtRegex);
122
121
  var fileExtension = matchArray != null ? matchArray[0].substring(1) : '';
@@ -44,6 +44,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
44
44
  __setModuleDefault(result, mod);
45
45
  return result;
46
46
  };
47
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
48
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
49
+ return new (P || (P = Promise))(function (resolve, reject) {
50
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
51
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
52
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
53
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
54
+ });
55
+ };
56
+ var __generator = (this && this.__generator) || function (thisArg, body) {
57
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
58
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
59
+ function verb(n) { return function (v) { return step([n, v]); }; }
60
+ function step(op) {
61
+ if (f) throw new TypeError("Generator is already executing.");
62
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
63
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
64
+ if (y = 0, t) op = [op[0] & 2, t.value];
65
+ switch (op[0]) {
66
+ case 0: case 1: t = op; break;
67
+ case 4: _.label++; return { value: op[1], done: false };
68
+ case 5: _.label++; y = op[1]; op = [0]; continue;
69
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
70
+ default:
71
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
72
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
73
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
74
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
75
+ if (t[2]) _.ops.pop();
76
+ _.trys.pop(); continue;
77
+ }
78
+ op = body.call(thisArg, _);
79
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
80
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
81
+ }
82
+ };
47
83
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
48
84
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
49
85
  if (ar || !(i in from)) {
@@ -53,6 +89,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
53
89
  }
54
90
  return to.concat(ar || Array.prototype.slice.call(from));
55
91
  };
92
+ var __importDefault = (this && this.__importDefault) || function (mod) {
93
+ return (mod && mod.__esModule) ? mod : { "default": mod };
94
+ };
56
95
  Object.defineProperty(exports, "__esModule", { value: true });
57
96
  exports.useCSVPipeline = useCSVPipeline;
58
97
  var React = __importStar(require("react"));
@@ -62,6 +101,7 @@ var react_forms_1 = require("@gpa-gemstone/react-forms");
62
101
  var react_table_1 = require("@gpa-gemstone/react-table");
63
102
  var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
64
103
  var lodash_1 = require("lodash");
104
+ var ErrorBoundary_1 = __importDefault(require("../ErrorBoundary"));
65
105
  var AdditionalUploadUI = function (props) {
66
106
  return (React.createElement("div", { className: 'row justify-content-center' },
67
107
  React.createElement("div", { className: 'col-6 p-0' },
@@ -98,13 +138,11 @@ function CsvPipelineEditStep(props) {
98
138
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
99
139
  var rawDataRef = React.useRef();
100
140
  var _z = React.useState([]), pagedData = _z[0], setPagedData = _z[1];
101
- var _0 = React.useState(true), isFileParseable = _0[0], setIsFileParseable = _0[1];
102
- var _1 = React.useState(false), isCSVMissingHeaders = _1[0], setIsCSVMissingHeaders = _1[1];
103
- var _2 = React.useState(false), isCSVMissingDataCells = _2[0], setIsCSVMissingDataCells = _2[1];
104
- var _3 = React.useState(0), page = _3[0], setPage = _3[1];
105
- var _4 = React.useState(1), totalPages = _4[0], setTotalPages = _4[1];
106
- var _5 = React.useState(true), showDataHeaderAlert = _5[0], setShowDataHeaderAlert = _5[1];
107
- var _6 = React.useState(true), showDataOrHeaderAlert = _6[0], setShowDataOrHeaderAlert = _6[1];
141
+ var _0 = React.useState(0), page = _0[0], setPage = _0[1];
142
+ var _1 = React.useState(1), totalPages = _1[0], setTotalPages = _1[1];
143
+ var _2 = React.useState(true), isFileParseable = _2[0], setIsFileParseable = _2[1];
144
+ var _3 = React.useState(0), isCSVMissingHeadersCount = _3[0], setIsCSVMissingHeadersCount = _3[1];
145
+ var _4 = React.useState(0), isCSVMissingDataCellsCount = _4[0], setIsCSVMissingDataCellsCount = _4[1];
108
146
  React.useEffect(function () {
109
147
  var _a, _b, _c, _d, _e;
110
148
  if (((_a = props.AdditionalProps) === null || _a === void 0 ? void 0 : _a.Data.length) === 0)
@@ -115,59 +153,115 @@ function CsvPipelineEditStep(props) {
115
153
  setPagedData(Data.slice(page * 10, (page + 1) * 10));
116
154
  }, [(_a = props.AdditionalProps) === null || _a === void 0 ? void 0 : _a.Data, page]);
117
155
  React.useEffect(function () {
118
- var _a;
119
- var errors = [];
120
- if (props.AdditionalProps == null)
121
- return;
122
- var headerMap = (_a = props.AdditionalProps) === null || _a === void 0 ? void 0 : _a.HeaderMap;
123
- props.AdditionalProps.Fields.forEach(function (field) {
124
- var _a, _b, _c, _d, _e;
125
- var matchedHeader = (_a = Array.from(headerMap).find(function (_a) {
126
- var value = _a[1];
127
- return value === field.Field;
128
- })) === null || _a === void 0 ? void 0 : _a[0];
129
- if (matchedHeader == null) {
130
- if (field.Required)
131
- errors.push("".concat(field.Label, " is required and must be mapped to a header."));
132
- return; // return early if the field was never mapped to a header
133
- }
134
- var fieldIndex = (_b = props.AdditionalProps) === null || _b === void 0 ? void 0 : _b.Headers.indexOf(matchedHeader);
135
- var foundDuplicate = false;
136
- var foundEmpty = false;
137
- var foundInvalid = false;
138
- var uniqueValues = new Set();
139
- //Need to also make sure that all the fields that have the Required flag got mapped to a header...
140
- (_c = props.AdditionalProps) === null || _c === void 0 ? void 0 : _c.Data.forEach(function (row) {
141
- var value = row[fieldIndex + 1]; //+1 for row index value
142
- // Unique check
143
- if (field.Unique) {
144
- if (uniqueValues.has(value))
145
- foundDuplicate = true;
146
- else
147
- uniqueValues.add(value);
148
- }
149
- // Allowed emptiness
150
- if (!field.AllowEmpty && (value == null || (value.trim() === '')))
151
- foundEmpty = true;
152
- // Validate
153
- if (!field.Validate(value))
154
- foundInvalid = true;
156
+ var callback;
157
+ function runValidation() {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var errors, headerMap, _loop_1, _i, _a, field;
160
+ var _b, _c;
161
+ return __generator(this, function (_d) {
162
+ switch (_d.label) {
163
+ case 0:
164
+ errors = [];
165
+ if (props.AdditionalProps == null)
166
+ return [2 /*return*/];
167
+ headerMap = props.AdditionalProps.HeaderMap;
168
+ _loop_1 = function (field) {
169
+ var matchedHeader, fieldIndex, foundDuplicate, foundEmpty, foundInvalid, uniqueValues, _e, _f, row, value, result, isValid, abortCallback, allValues;
170
+ return __generator(this, function (_g) {
171
+ switch (_g.label) {
172
+ case 0:
173
+ matchedHeader = (_b = Array.from(headerMap).find(function (_a) {
174
+ var value = _a[1];
175
+ return value === field.Field;
176
+ })) === null || _b === void 0 ? void 0 : _b[0];
177
+ if (matchedHeader == null) {
178
+ if (field.Required)
179
+ errors.push("".concat(field.Label, " is required and must be mapped to a header."));
180
+ return [2 /*return*/, "continue"];
181
+ }
182
+ fieldIndex = props.AdditionalProps.Headers.indexOf(matchedHeader);
183
+ foundDuplicate = false;
184
+ foundEmpty = false;
185
+ foundInvalid = false;
186
+ uniqueValues = new Set();
187
+ _e = 0, _f = props.AdditionalProps.Data;
188
+ _g.label = 1;
189
+ case 1:
190
+ if (!(_e < _f.length)) return [3 /*break*/, 4];
191
+ row = _f[_e];
192
+ value = row[fieldIndex + 1];
193
+ // Unique check
194
+ if (field.Unique) {
195
+ if (uniqueValues.has(value))
196
+ foundDuplicate = true;
197
+ else
198
+ uniqueValues.add(value);
199
+ }
200
+ // Allowed emptiness
201
+ if (!field.AllowEmpty && (value == null || (value.trim() === '')))
202
+ foundEmpty = true;
203
+ return [4 /*yield*/, Promise.resolve(field.Validate(value))];
204
+ case 2:
205
+ result = _g.sent();
206
+ isValid = void 0;
207
+ if (Array.isArray(result)) {
208
+ //[boolean, abortCallback]
209
+ isValid = result[0];
210
+ abortCallback = result[1];
211
+ if (typeof abortCallback === 'function')
212
+ callback = abortCallback;
213
+ }
214
+ else
215
+ isValid = result;
216
+ if (!isValid) {
217
+ foundInvalid = true;
218
+ }
219
+ _g.label = 3;
220
+ case 3:
221
+ _e++;
222
+ return [3 /*break*/, 1];
223
+ case 4:
224
+ if (field.Unique && foundDuplicate)
225
+ errors.push("All ".concat(field.Label, " values must be unique."));
226
+ if (foundEmpty)
227
+ errors.push("All ".concat(field.Label, " values cannot be empty."));
228
+ if (foundInvalid)
229
+ errors.push("All ".concat(field.Label, " values must be valid."));
230
+ // Check for SameValueForAllRows
231
+ if ((_c = field.SameValueForAllRows) !== null && _c !== void 0 ? _c : false) {
232
+ allValues = props.AdditionalProps.Data.map(function (row) { var _a; return (_a = row[fieldIndex + 1]) !== null && _a !== void 0 ? _a : ''; });
233
+ if (new Set(allValues).size > 1)
234
+ errors.push("All rows must contain the same value for ".concat(field.Label, "."));
235
+ }
236
+ return [2 /*return*/];
237
+ }
238
+ });
239
+ };
240
+ _i = 0, _a = props.AdditionalProps.Fields;
241
+ _d.label = 1;
242
+ case 1:
243
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
244
+ field = _a[_i];
245
+ return [5 /*yield**/, _loop_1(field)];
246
+ case 2:
247
+ _d.sent();
248
+ _d.label = 3;
249
+ case 3:
250
+ _i++;
251
+ return [3 /*break*/, 1];
252
+ case 4:
253
+ if (!(0, lodash_1.isEqual)(props.Errors.sort(), errors.sort()))
254
+ props.SetErrors(errors);
255
+ return [2 /*return*/];
256
+ }
257
+ });
155
258
  });
156
- if (field.Unique && foundDuplicate)
157
- errors.push("All ".concat(field.Label, " values must be unique."));
158
- if (foundEmpty)
159
- errors.push("All ".concat(field.Label, " values cannot be empty."));
160
- if (foundInvalid)
161
- errors.push("All ".concat(field.Label, " values must be valid."));
162
- //Check for SameValueForAllRows
163
- if ((_d = field.SameValueForAllRows) !== null && _d !== void 0 ? _d : false) {
164
- var allValues = (_e = props.AdditionalProps) === null || _e === void 0 ? void 0 : _e.Data.map(function (row) { var _a; return (_a = row[fieldIndex + 1]) !== null && _a !== void 0 ? _a : ''; });
165
- if (new Set(allValues).size > 1)
166
- errors.push("All rows must contain the same value for ".concat(field.Label, "."));
167
- }
168
- });
169
- if (!(0, lodash_1.isEqual)(props.Errors.sort(), errors.sort()))
170
- props.SetErrors(errors);
259
+ }
260
+ runValidation();
261
+ return function () {
262
+ if (callback != null)
263
+ callback();
264
+ };
171
265
  }, [(_b = props.AdditionalProps) === null || _b === void 0 ? void 0 : _b.Data, (_c = props.AdditionalProps) === null || _c === void 0 ? void 0 : _c.Headers, (_d = props.AdditionalProps) === null || _d === void 0 ? void 0 : _d.HeaderMap, isFileParseable, (_e = props.AdditionalProps) === null || _e === void 0 ? void 0 : _e.Fields]);
172
266
  //Effect to parse rawfiledata initially
173
267
  React.useEffect(function () {
@@ -183,8 +277,10 @@ function CsvPipelineEditStep(props) {
183
277
  return;
184
278
  }
185
279
  setIsFileParseable(true);
186
- setIsCSVMissingDataCells(parsedData.AddedMissingDataValues);
187
- setIsCSVMissingHeaders(parsedData.AddedMissingHeaders);
280
+ if (parsedData.AddedMissingDataValues)
281
+ setIsCSVMissingDataCellsCount(function (p) { return p + 1; });
282
+ if (parsedData.AddedMissingHeaders)
283
+ setIsCSVMissingHeadersCount(function (p) { return p + 1; });
188
284
  (_a = props.AdditionalProps) === null || _a === void 0 ? void 0 : _a.SetData(parsedData.Data);
189
285
  props.AdditionalProps.SetHeaders(parsedData.Headers);
190
286
  (_b = props.AdditionalProps) === null || _b === void 0 ? void 0 : _b.SetHeaderMap(autoMapHeaders(parsedData.Headers, props.AdditionalProps.Fields.map(function (field) { return field.Field; })));
@@ -317,57 +413,57 @@ function CsvPipelineEditStep(props) {
317
413
  };
318
414
  return (React.createElement(React.Fragment, null,
319
415
  React.createElement("div", { className: "container-fluid d-flex flex-column p-0 h-100" },
320
- React.createElement("div", { className: 'row h-100' },
321
- React.createElement("div", { className: 'col-12 d-flex flex-column h-100' }, pagedData.length !== 0 ?
322
- React.createElement(React.Fragment, null,
323
- isCSVMissingDataCells && isCSVMissingHeaders ? (React.createElement("div", { className: 'row' },
324
- React.createElement("div", { className: 'col-12' },
325
- React.createElement(react_interactive_1.Alert, { AlertColor: 'alert-info', Show: showDataHeaderAlert, SetShow: setShowDataHeaderAlert },
326
- React.createElement("p", { style: { whiteSpace: 'nowrap' } }, "Missing data cells were added to meet the number of required fields."),
327
- React.createElement("hr", null),
328
- React.createElement("p", { style: { whiteSpace: 'nowrap' } }, "Missing headers were added to meet the number of required fields."))))) : isCSVMissingDataCells || isCSVMissingHeaders ? (React.createElement("div", { className: 'row' },
329
- React.createElement("div", { className: 'col-12' },
330
- React.createElement(react_interactive_1.Alert, { AlertColor: 'alert-info', Show: showDataOrHeaderAlert, SetShow: setShowDataOrHeaderAlert },
331
- React.createElement("p", { style: { whiteSpace: 'nowrap' } }, isCSVMissingDataCells ? 'Missing data cells were added to meet the number of required fields.' : 'Missing headers were added to meet the number of required fields.'))))) : null,
332
- React.createElement("div", { className: 'row flex-grow-1', style: { overflowY: 'hidden' } },
333
- React.createElement("div", { className: 'col-12 h-100' },
334
- React.createElement(react_table_1.Table, { Data: pagedData, key: (_v = props.AdditionalProps) === null || _v === void 0 ? void 0 : _v.Headers.join(','), SortKey: '', Ascending: false, OnSort: function () { }, KeySelector: function (data) { return data[0]; }, TableClass: 'table', TableStyle: { height: '100%', width: ((_x = (_w = props.AdditionalProps) === null || _w === void 0 ? void 0 : _w.Headers.length) !== null && _x !== void 0 ? _x : 0) * 150 } }, (_y = props.AdditionalProps) === null || _y === void 0 ? void 0 :
335
- _y.Headers.map(function (header, i) {
336
- return React.createElement(react_table_1.Column, { Key: header, Field: i + 1, AllowSort: false, Content: function (_a) {
337
- var _b, _c;
338
- var item = _a.item, field = _a.field;
339
- if (props.AdditionalProps == null)
340
- return;
341
- var mappedField = (_b = props.AdditionalProps) === null || _b === void 0 ? void 0 : _b.HeaderMap.get(header);
342
- var matchedField = props.AdditionalProps.Fields.find(function (f) { return f.Field === mappedField; });
343
- if (matchedField == null)
344
- return item[field];
345
- var value = item[field];
346
- var isValid = matchedField.Validate(value);
347
- var feedback = matchedField.Feedback;
348
- var selectOptions = matchedField.SelectOptions;
349
- var allValues = {};
350
- (_c = props.AdditionalProps) === null || _c === void 0 ? void 0 : _c.Headers.forEach(function (header, index) {
351
- var _a;
352
- var mappedField = (_a = props.AdditionalProps) === null || _a === void 0 ? void 0 : _a.HeaderMap.get(header);
353
- if (mappedField != null) {
354
- allValues[mappedField] = item[index + 1];
355
- }
356
- });
357
- return (React.createElement(matchedField.EditComponent, { Value: value, SetValue: function (val) { return handleValueChange(parseInt(item[0]), field, val); }, Valid: isValid, Feedback: feedback, AllRecordValues: allValues, SelectOptions: selectOptions }));
358
- } },
359
- getHeader(header),
360
- getFieldSelect(header));
361
- }),
362
- React.createElement(react_table_1.Column, { Key: 'delete', Field: 0, AllowSort: false, RowStyle: { textAlign: 'right' }, Content: function (_a) {
363
- var item = _a.item;
364
- return (React.createElement("button", { className: 'btn', onClick: function () { return handleRowDelete(parseInt(item[0])); } },
365
- React.createElement(gpa_symbols_1.ReactIcons.TrashCan, { Color: "red" })));
366
- } }, '')))),
367
- React.createElement("div", { className: 'row' },
368
- React.createElement("div", { className: 'col-12' },
369
- React.createElement(react_table_1.Paging, { Current: page + 1, Total: totalPages, SetPage: function (p) { return setPage(p - 1); } }))))
370
- : null)))));
416
+ React.createElement(ErrorBoundary_1.default, { Height: '100%', Width: '100%', BodyErrorMessage: 'Error loading page.', HeaderErrorMessage: 'Error' },
417
+ React.createElement("div", { className: 'row h-100' },
418
+ React.createElement("div", { className: 'col-12 d-flex flex-column h-100' }, pagedData.length !== 0 ?
419
+ React.createElement(React.Fragment, null,
420
+ isCSVMissingDataCellsCount > 0 && isCSVMissingHeadersCount > 0 ? (React.createElement("div", { className: 'row' },
421
+ React.createElement("div", { className: 'col-12' },
422
+ React.createElement(react_interactive_1.Alert, { Color: 'alert-info', ReTrigger: isCSVMissingDataCellsCount + isCSVMissingHeadersCount },
423
+ React.createElement("p", { style: { whiteSpace: 'nowrap' } }, "Missing data cells were added to meet the number of required fields."),
424
+ React.createElement("hr", null),
425
+ React.createElement("p", { style: { whiteSpace: 'nowrap' } }, "Missing headers were added to meet the number of required fields."))))) : isCSVMissingDataCellsCount > 0 || isCSVMissingHeadersCount > 0 ? (React.createElement("div", { className: 'row' },
426
+ React.createElement("div", { className: 'col-12' },
427
+ React.createElement(react_interactive_1.Alert, { Color: 'alert-info', ReTrigger: isCSVMissingDataCellsCount > 0 ? isCSVMissingDataCellsCount : isCSVMissingHeadersCount },
428
+ React.createElement("p", { style: { whiteSpace: 'nowrap' } }, isCSVMissingDataCellsCount > 0 ? 'Missing data cells were added to meet the number of required fields.' : 'Missing headers were added to meet the number of required fields.'))))) : null,
429
+ React.createElement("div", { className: 'row flex-grow-1', style: { overflowY: 'hidden' } },
430
+ React.createElement("div", { className: 'col-12 h-100' },
431
+ React.createElement(react_table_1.Table, { Data: pagedData, key: (_v = props.AdditionalProps) === null || _v === void 0 ? void 0 : _v.Headers.join(','), SortKey: '', Ascending: false, OnSort: function () { }, KeySelector: function (data) { return data[0]; }, TableClass: 'table', TableStyle: { height: '100%', width: ((_x = (_w = props.AdditionalProps) === null || _w === void 0 ? void 0 : _w.Headers.length) !== null && _x !== void 0 ? _x : 0) * 150 } }, (_y = props.AdditionalProps) === null || _y === void 0 ? void 0 :
432
+ _y.Headers.map(function (header, i) {
433
+ return React.createElement(react_table_1.Column, { Key: header, Field: i + 1, AllowSort: false, Content: function (_a) {
434
+ var _b, _c;
435
+ var item = _a.item, field = _a.field;
436
+ if (props.AdditionalProps == null)
437
+ return;
438
+ var mappedField = (_b = props.AdditionalProps) === null || _b === void 0 ? void 0 : _b.HeaderMap.get(header);
439
+ var matchedField = props.AdditionalProps.Fields.find(function (f) { return f.Field === mappedField; });
440
+ if (matchedField == null)
441
+ return item[field];
442
+ var value = item[field];
443
+ var feedback = matchedField.Feedback;
444
+ var selectOptions = matchedField.SelectOptions;
445
+ var allValues = {};
446
+ (_c = props.AdditionalProps) === null || _c === void 0 ? void 0 : _c.Headers.forEach(function (header, index) {
447
+ var _a;
448
+ var mappedField = (_a = props.AdditionalProps) === null || _a === void 0 ? void 0 : _a.HeaderMap.get(header);
449
+ if (mappedField != null) {
450
+ allValues[mappedField] = item[index + 1];
451
+ }
452
+ });
453
+ return (React.createElement(matchedField.EditComponent, { Value: value, SetValue: function (val) { return handleValueChange(parseInt(item[0]), field, val); }, Validate: matchedField.Validate, Feedback: feedback, AllRecordValues: allValues, SelectOptions: selectOptions }));
454
+ } },
455
+ getHeader(header),
456
+ getFieldSelect(header));
457
+ }),
458
+ React.createElement(react_table_1.Column, { Key: 'delete', Field: 0, AllowSort: false, RowStyle: { textAlign: 'right' }, Content: function (_a) {
459
+ var item = _a.item;
460
+ return (React.createElement("button", { className: 'btn', onClick: function () { return handleRowDelete(parseInt(item[0])); } },
461
+ React.createElement(gpa_symbols_1.ReactIcons.TrashCan, { Color: "red" })));
462
+ } }, '')))),
463
+ React.createElement("div", { className: 'row' },
464
+ React.createElement("div", { className: 'col-12' },
465
+ React.createElement(react_table_1.Paging, { Current: page + 1, Total: totalPages, SetPage: function (p) { return setPage(p - 1); } }))))
466
+ : null))))));
371
467
  }
372
468
  //Helper functions
373
469
  function autoMapHeaders(headers, fields) {
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface IProps {
3
+ Style?: React.CSSProperties;
4
+ ClassName?: string;
5
+ Logo?: string;
6
+ }
7
+ declare const RoleAccessErrorPage: React.FunctionComponent<IProps>;
8
+ export default RoleAccessErrorPage;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ //******************************************************************************************************
3
+ // RoleAccessErrorPage.tsx - Gbtc
4
+ //
5
+ // Copyright © 2025, Grid Protection Alliance. All Rights Reserved.
6
+ //
7
+ // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
+ // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
+ // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
+ // file except in compliance with the License. You may obtain a copy of the License at:
11
+ //
12
+ // http://opensource.org/licenses/MIT
13
+ //
14
+ // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
+ // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
+ // License for the specific language governing permissions and limitations.
17
+ //
18
+ // Code Modification History:
19
+ // ----------------------------------------------------------------------------------------------------
20
+ // 01/21/2025 - Gabriel Santos
21
+ // Generated original version of source code.
22
+ //
23
+ //******************************************************************************************************
24
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ var desc = Object.getOwnPropertyDescriptor(m, k);
27
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28
+ desc = { enumerable: true, get: function() { return m[k]; } };
29
+ }
30
+ Object.defineProperty(o, k2, desc);
31
+ }) : (function(o, m, k, k2) {
32
+ if (k2 === undefined) k2 = k;
33
+ o[k2] = m[k];
34
+ }));
35
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
36
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
37
+ }) : function(o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar = (this && this.__importStar) || function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ var React = __importStar(require("react"));
49
+ var react_interactive_1 = require("@gpa-gemstone/react-interactive");
50
+ var RoleAccessErrorPage = function (props) {
51
+ var _a, _b;
52
+ return (React.createElement("div", { style: (_a = props.Style) !== null && _a !== void 0 ? _a : { width: '100%', height: '100%' }, className: (_b = props.ClassName) !== null && _b !== void 0 ? _b : undefined },
53
+ React.createElement("div", { className: "col", style: { height: "100%", width: "100%" } },
54
+ React.createElement("div", { className: "row", style: { width: "100%", height: "50%", display: "grid", alignItems: "end" } }, props.Logo == null ? React.createElement(React.Fragment, null) :
55
+ React.createElement("img", { src: props.Logo, className: "contain", style: { width: "40%", paddingBottom: "50px", marginLeft: "auto", marginRight: "auto" } })),
56
+ React.createElement("div", { className: "row", style: { alignItems: "top", justifyContent: "center", width: "100%", height: "50%" } },
57
+ React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Size: 100, Label: 'You do not have permission to view this page.\n Please contact your Administrator if you believe this to be in error.' })))));
58
+ };
59
+ exports.default = RoleAccessErrorPage;
package/lib/index.d.ts CHANGED
@@ -10,7 +10,8 @@ import NavBarFilterButton from './NavBarFilterButton';
10
10
  import { useCSVPipeline } from './Pipelines/CSVPipeline';
11
11
  import * as TimeWindowUtils from './TimeFilter/TimeWindowUtils';
12
12
  import BulkUpload from './BulkUpload';
13
+ import RoleAccessErrorPage from './RoleAcessErrorPage';
13
14
  declare const Pipelines: {
14
15
  CSV: typeof useCSVPipeline;
15
16
  };
16
- export { TimeFilter, TimeWindowUtils, EventTypeFilter, EventCharacteristicFilter, NavBarFilterButton, Note, DefaultSearch, SelectPopup, DefaultSelects, ErrorBoundary, Pipelines, BulkUpload };
17
+ export { TimeFilter, TimeWindowUtils, EventTypeFilter, EventCharacteristicFilter, NavBarFilterButton, Note, DefaultSearch, SelectPopup, DefaultSelects, ErrorBoundary, Pipelines, BulkUpload, RoleAccessErrorPage };
package/lib/index.js CHANGED
@@ -48,7 +48,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
48
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
49
49
  };
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
- exports.BulkUpload = exports.Pipelines = exports.ErrorBoundary = exports.DefaultSelects = exports.SelectPopup = exports.DefaultSearch = exports.Note = exports.NavBarFilterButton = exports.EventCharacteristicFilter = exports.EventTypeFilter = exports.TimeWindowUtils = exports.TimeFilter = void 0;
51
+ exports.RoleAccessErrorPage = exports.BulkUpload = exports.Pipelines = exports.ErrorBoundary = exports.DefaultSelects = exports.SelectPopup = exports.DefaultSearch = exports.Note = exports.NavBarFilterButton = exports.EventCharacteristicFilter = exports.EventTypeFilter = exports.TimeWindowUtils = exports.TimeFilter = void 0;
52
52
  var Note_1 = __importDefault(require("./Note"));
53
53
  exports.Note = Note_1.default;
54
54
  var SearchBar_1 = require("./SearchBar");
@@ -72,6 +72,8 @@ var TimeWindowUtils = __importStar(require("./TimeFilter/TimeWindowUtils"));
72
72
  exports.TimeWindowUtils = TimeWindowUtils;
73
73
  var BulkUpload_1 = __importDefault(require("./BulkUpload"));
74
74
  exports.BulkUpload = BulkUpload_1.default;
75
+ var RoleAcessErrorPage_1 = __importDefault(require("./RoleAcessErrorPage"));
76
+ exports.RoleAccessErrorPage = RoleAcessErrorPage_1.default;
75
77
  var Pipelines = {
76
78
  CSV: CSVPipeline_1.useCSVPipeline
77
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/common-pages",
3
- "version": "0.0.130",
3
+ "version": "0.0.132",
4
4
  "description": "Common UI pages for GPA products",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,12 +44,12 @@
44
44
  "typescript": "5.5.3"
45
45
  },
46
46
  "dependencies": {
47
- "@gpa-gemstone/application-typings": "0.0.81",
48
- "@gpa-gemstone/gpa-symbols": "0.0.47",
47
+ "@gpa-gemstone/application-typings": "0.0.82",
48
+ "@gpa-gemstone/gpa-symbols": "0.0.48",
49
49
  "@gpa-gemstone/helper-functions": "0.0.37",
50
- "@gpa-gemstone/react-forms": "1.1.81",
51
- "@gpa-gemstone/react-interactive": "1.0.142",
52
- "@gpa-gemstone/react-table": "1.2.64",
50
+ "@gpa-gemstone/react-forms": "1.1.83",
51
+ "@gpa-gemstone/react-interactive": "1.0.144",
52
+ "@gpa-gemstone/react-table": "1.2.66",
53
53
  "@reduxjs/toolkit": "1.8.3",
54
54
  "crypto-js": "^4.2.0",
55
55
  "moment": "^2.29.4",