@gpa-gemstone/common-pages 0.0.104 → 0.0.106

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.
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 +11 -10
@@ -1,76 +1,76 @@
1
- import { Application } from '@gpa-gemstone/application-typings';
2
- import { Search } from '@gpa-gemstone/react-interactive';
3
- import { ActionCreatorWithPayload, AsyncThunk, ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
4
- declare type DBAction = 'POST' | 'DELETE' | 'PATCH';
5
- export declare type UserValidation = 'Resolving' | 'Valid' | 'Invalid' | 'Unknown';
6
- export interface IGenericSlice<T> {
7
- Fetch: (AsyncThunk<any, void | number | string, {}>);
8
- DBAction: (AsyncThunk<any, {
9
- verb: DBAction;
10
- record: T;
11
- }, {}>);
12
- Sort: AsyncThunk<any, {
13
- SortField: keyof T;
14
- Ascending: boolean;
15
- }, {}>;
16
- Data: (state: any) => T[];
17
- Status: (state: any) => Application.Types.Status;
18
- SortField: (state: any) => keyof T;
19
- Ascending: (state: any) => boolean;
20
- ParentID?: (state: any) => number | string;
21
- }
22
- export interface ISearchableSlice<T> extends IGenericSlice<T> {
23
- DBSearch: (AsyncThunk<any, {
24
- filter: Search.IFilter<T>[];
25
- sortField?: keyof T;
26
- ascending?: boolean;
27
- }, {}>);
28
- SearchFilters: (state: any) => Search.IFilter<T>[];
29
- SearchResults: (state: any) => T[];
30
- SearchStatus: (state: any) => Application.Types.Status;
31
- }
32
- export interface IAdditionalFieldSlice<F, V> {
33
- FetchField: AsyncThunk<any, void, {}>;
34
- FieldAction: AsyncThunk<any, {
35
- Verb: DBAction;
36
- Record: F;
37
- }, {}>;
38
- FetchValues: AsyncThunk<any, number | string, {}>;
39
- UpdateValues: AsyncThunk<any, {
40
- ParentID: number | string;
41
- Values: V[];
42
- }, {}>;
43
- Sort: ActionCreatorWithPayload<{
44
- SortField: keyof F;
45
- Ascending: boolean;
46
- }, string>;
47
- Fields: (state: any) => F[];
48
- Values: (state: any) => V[];
49
- FieldStatus: (state: any) => Application.Types.Status;
50
- ValueStatus: (state: any) => Application.Types.Status;
51
- ValueParentId: (state: any) => number | string;
52
- SortField: (state: any) => keyof F;
53
- Ascending: (state: any) => boolean;
54
- }
55
- export interface IUserAccountSlice extends ISearchableSlice<Application.Types.iUserAccount> {
56
- ADUpdate: (AsyncThunk<any, void, {}>);
57
- SetCurrentUser: (AsyncThunk<any, Application.Types.iUserAccount, {}>);
58
- LoadExistingUser: (AsyncThunk<any, string, {}>);
59
- SetNewUser: ActionCreatorWithoutPayload;
60
- CurrentID: (state: any) => string | undefined;
61
- CurrentUser: (state: any) => Application.Types.iUserAccount;
62
- ADValidation: (state: any) => UserValidation;
63
- }
64
- export interface ISecurityRoleSlice {
65
- FetchRoles: (AsyncThunk<any, void, {}>);
66
- FetchUserRoles: (AsyncThunk<any, string, {}>);
67
- SetUserRoles: (AsyncThunk<any, {
68
- UserId: string;
69
- Roles: Application.Types.iApplicationRoleUserAccount[];
70
- }, {}>);
71
- Status: (state: any) => Application.Types.Status;
72
- CurrentRoleStatus: (state: any) => Application.Types.Status;
73
- Roles: (state: any) => Application.Types.iApplicationRoleUserAccount[];
74
- AvailableRoles: (state: any) => Application.Types.iApplicationRole<Application.Types.SecurityRoleName>[];
75
- }
76
- export {};
1
+ import { Application } from '@gpa-gemstone/application-typings';
2
+ import { Search } from '@gpa-gemstone/react-interactive';
3
+ import { ActionCreatorWithPayload, AsyncThunk, ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
4
+ type DBAction = 'POST' | 'DELETE' | 'PATCH';
5
+ export type UserValidation = 'Resolving' | 'Valid' | 'Invalid' | 'Unknown';
6
+ export interface IGenericSlice<T> {
7
+ Fetch: (AsyncThunk<any, void | number | string, {}>);
8
+ DBAction: (AsyncThunk<any, {
9
+ verb: DBAction;
10
+ record: T;
11
+ }, {}>);
12
+ Sort: AsyncThunk<any, {
13
+ SortField: keyof T;
14
+ Ascending: boolean;
15
+ }, {}>;
16
+ Data: (state: any) => T[];
17
+ Status: (state: any) => Application.Types.Status;
18
+ SortField: (state: any) => keyof T;
19
+ Ascending: (state: any) => boolean;
20
+ ParentID?: (state: any) => number | string;
21
+ }
22
+ export interface ISearchableSlice<T> extends IGenericSlice<T> {
23
+ DBSearch: (AsyncThunk<any, {
24
+ filter: Search.IFilter<T>[];
25
+ sortField?: keyof T;
26
+ ascending?: boolean;
27
+ }, {}>);
28
+ SearchFilters: (state: any) => Search.IFilter<T>[];
29
+ SearchResults: (state: any) => T[];
30
+ SearchStatus: (state: any) => Application.Types.Status;
31
+ }
32
+ export interface IAdditionalFieldSlice<F, V> {
33
+ FetchField: AsyncThunk<any, void, {}>;
34
+ FieldAction: AsyncThunk<any, {
35
+ Verb: DBAction;
36
+ Record: F;
37
+ }, {}>;
38
+ FetchValues: AsyncThunk<any, number | string, {}>;
39
+ UpdateValues: AsyncThunk<any, {
40
+ ParentID: number | string;
41
+ Values: V[];
42
+ }, {}>;
43
+ Sort: ActionCreatorWithPayload<{
44
+ SortField: keyof F;
45
+ Ascending: boolean;
46
+ }, string>;
47
+ Fields: (state: any) => F[];
48
+ Values: (state: any) => V[];
49
+ FieldStatus: (state: any) => Application.Types.Status;
50
+ ValueStatus: (state: any) => Application.Types.Status;
51
+ ValueParentId: (state: any) => number | string;
52
+ SortField: (state: any) => keyof F;
53
+ Ascending: (state: any) => boolean;
54
+ }
55
+ export interface IUserAccountSlice extends ISearchableSlice<Application.Types.iUserAccount> {
56
+ ADUpdate: (AsyncThunk<any, void, {}>);
57
+ SetCurrentUser: (AsyncThunk<any, Application.Types.iUserAccount, {}>);
58
+ LoadExistingUser: (AsyncThunk<any, string, {}>);
59
+ SetNewUser: ActionCreatorWithoutPayload;
60
+ CurrentID: (state: any) => string | undefined;
61
+ CurrentUser: (state: any) => Application.Types.iUserAccount;
62
+ ADValidation: (state: any) => UserValidation;
63
+ }
64
+ export interface ISecurityRoleSlice {
65
+ FetchRoles: (AsyncThunk<any, void, {}>);
66
+ FetchUserRoles: (AsyncThunk<any, string, {}>);
67
+ SetUserRoles: (AsyncThunk<any, {
68
+ UserId: string;
69
+ Roles: Application.Types.iApplicationRoleUserAccount[];
70
+ }, {}>);
71
+ Status: (state: any) => Application.Types.Status;
72
+ CurrentRoleStatus: (state: any) => Application.Types.Status;
73
+ Roles: (state: any) => Application.Types.iApplicationRoleUserAccount[];
74
+ AvailableRoles: (state: any) => Application.Types.iApplicationRole<Application.Types.SecurityRoleName>[];
75
+ }
76
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +1,20 @@
1
- import { Column } from "@gpa-gemstone/react-table";
2
- import * as React from 'react';
3
- import { GenericSlice } from "@gpa-gemstone/react-interactive";
4
- interface U {
5
- ID: number | string;
6
- }
7
- interface IProps<T extends U> {
8
- Slice: GenericSlice<T>;
9
- Selection: T[];
10
- OnClose: (selected: T[], conf: boolean) => void;
11
- Show: boolean;
12
- Searchbar: (children: React.ReactNode) => React.ReactNode;
13
- Type?: 'single' | 'multiple';
14
- Columns: Column<T>[];
15
- Title: string;
16
- MinSelection?: number;
17
- children?: React.ReactNode;
18
- }
19
- export default function SelectPopup<T extends U>(props: IProps<T>): JSX.Element;
20
- export {};
1
+ import { Column } from "@gpa-gemstone/react-table";
2
+ import * as React from 'react';
3
+ import { GenericSlice } from "@gpa-gemstone/react-interactive";
4
+ interface U {
5
+ ID: number | string;
6
+ }
7
+ interface IProps<T extends U> {
8
+ Slice: GenericSlice<T>;
9
+ Selection: T[];
10
+ OnClose: (selected: T[], conf: boolean) => void;
11
+ Show: boolean;
12
+ Searchbar: (children: React.ReactNode) => React.ReactNode;
13
+ Type?: 'single' | 'multiple';
14
+ Columns: Column<T>[];
15
+ Title: string;
16
+ MinSelection?: number;
17
+ children?: React.ReactNode;
18
+ }
19
+ export default function SelectPopup<T extends U>(props: IProps<T>): React.JSX.Element;
20
+ export {};
@@ -1,109 +1,135 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // StandardSelectPopup.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/19/2021 - C. Lackner
21
- // Generated original version of source code.
22
- // ******************************************************************************************************
23
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
- if (ar || !(i in from)) {
26
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
- ar[i] = from[i];
28
- }
29
- }
30
- return to.concat(ar || Array.prototype.slice.call(from));
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- var react_table_1 = require("@gpa-gemstone/react-table");
34
- var React = require("react");
35
- var react_redux_1 = require("react-redux");
36
- var react_interactive_1 = require("@gpa-gemstone/react-interactive");
37
- var _ = require("lodash");
38
- var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
39
- function SelectPopup(props) {
40
- var dispatch = (0, react_redux_1.useDispatch)();
41
- var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
42
- var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
43
- var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
44
- var _a = React.useState(props.Selection), selectedData = _a[0], setSelectedData = _a[1];
45
- var _b = React.useState(''), sortKeySelected = _b[0], setSortKeySelected = _b[1];
46
- var _c = React.useState(false), ascendingSelected = _c[0], setAscendingSelected = _c[1];
47
- React.useEffect(function () {
48
- setSelectedData(props.Selection);
49
- }, [props.Selection]);
50
- function AddCurrentList() {
51
- var updatedData;
52
- updatedData = selectedData.concat(data);
53
- setSelectedData(_.uniqBy(updatedData, function (d) { return d.ID; }));
54
- }
55
- return (React.createElement(React.Fragment, null,
56
- React.createElement(react_interactive_1.Modal, { Show: props.Show, Title: props.Title, ShowX: true, Size: 'xlg', CallBack: function (conf) { return props.OnClose(selectedData, conf); }, DisableConfirm: props.MinSelection !== undefined && selectedData.length < props.MinSelection, ConfirmShowToolTip: props.MinSelection !== undefined && selectedData.length < props.MinSelection, ConfirmToolTipContent: React.createElement("p", null,
57
- gpa_symbols_1.CrossMark,
58
- " At least ",
59
- props.MinSelection,
60
- " items must be selected. ") },
61
- React.createElement("div", { className: "row" },
62
- React.createElement("div", { className: "col" }, props.Searchbar(React.createElement(React.Fragment, null,
63
- props.Type === 'multiple' ? React.createElement("li", { className: "nav-item", style: { width: '20%', paddingRight: 10 } },
64
- React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%' } },
65
- React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Quick Selects:"),
66
- React.createElement("form", null,
67
- React.createElement("div", { className: "form-group" },
68
- React.createElement("div", { className: "btn btn-primary", onClick: function (event) { event.preventDefault(); AddCurrentList(); } }, "Add Current List to Selection")),
69
- React.createElement("div", { className: "form-group" },
70
- React.createElement("div", { className: "btn btn-danger", onClick: function (event) { event.preventDefault(); setSelectedData([]); } }, "Remove All"))))) : null,
71
- React.Children.map(props.children, function (e) {
72
- if (React.isValidElement(e))
73
- return e;
74
- return null;
75
- }))))),
76
- React.createElement("div", { className: "row" },
77
- React.createElement("div", { className: "col", style: { width: (props.Type === undefined || props.Type === 'single' ? '100%' : '60%') } },
78
- React.createElement(react_table_1.default, { cols: props.Columns, tableClass: "table table-hover", data: data, sortKey: sortField, ascending: ascending, onSort: function (d) {
79
- if (d.colKey === "Scroll")
80
- return;
81
- if (d.colKey === sortField)
82
- dispatch(props.Slice.Sort({ SortField: sortField, Ascending: ascending }));
83
- else {
84
- dispatch(props.Slice.Sort({ SortField: d.colField, Ascending: true }));
85
- }
86
- }, onClick: function (d) {
87
- if (props.Type === undefined || props.Type === 'single')
88
- setSelectedData([d.row]);
89
- else
90
- setSelectedData(function (s) { return __spreadArray(__spreadArray([], s.filter(function (item) { return item.ID !== d.row.ID; }), true), [d.row], false); });
91
- }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: '400px', width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return selectedData.findIndex(function (d) { return d.ID === item.ID; }) > -1; } })),
92
- props.Type === 'multiple' ? React.createElement("div", { className: "col", style: { width: '40%' } },
93
- React.createElement("div", { style: { width: '100%' } },
94
- React.createElement("h3", null, " Current Selection ")),
95
- React.createElement(react_table_1.default, { cols: props.Columns, tableClass: "table table-hover", data: selectedData, sortKey: sortKeySelected, ascending: ascendingSelected, onSort: function (d) {
96
- if (d.colKey === sortKeySelected) {
97
- var ordered = _.orderBy(selectedData, [d.colKey], [(!ascendingSelected ? "asc" : "desc")]);
98
- setAscendingSelected(!ascendingSelected);
99
- setSelectedData(ordered);
100
- }
101
- else {
102
- var ordered = _.orderBy(selectedData, [d.colKey], ["asc"]);
103
- setAscendingSelected(!ascendingSelected);
104
- setSelectedData(ordered);
105
- setSortKeySelected(d.colKey);
106
- }
107
- }, onClick: function (d) { return setSelectedData(__spreadArray([], selectedData.filter(function (item) { return item.ID !== d.row.ID; }), true)); }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: '400px', width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return false; } })) : null))));
108
- }
109
- exports.default = SelectPopup;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // StandardSelectPopup.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/19/2021 - C. Lackner
21
+ // Generated original version of source code.
22
+ // ******************************************************************************************************
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
47
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
48
+ if (ar || !(i in from)) {
49
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
50
+ ar[i] = from[i];
51
+ }
52
+ }
53
+ return to.concat(ar || Array.prototype.slice.call(from));
54
+ };
55
+ var __importDefault = (this && this.__importDefault) || function (mod) {
56
+ return (mod && mod.__esModule) ? mod : { "default": mod };
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.default = SelectPopup;
60
+ var react_table_1 = __importDefault(require("@gpa-gemstone/react-table"));
61
+ var React = __importStar(require("react"));
62
+ var react_redux_1 = require("react-redux");
63
+ var react_interactive_1 = require("@gpa-gemstone/react-interactive");
64
+ var _ = require("lodash");
65
+ var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
66
+ function SelectPopup(props) {
67
+ var dispatch = (0, react_redux_1.useDispatch)();
68
+ var sortField = (0, react_redux_1.useSelector)(props.Slice.SortField);
69
+ var ascending = (0, react_redux_1.useSelector)(props.Slice.Ascending);
70
+ var data = (0, react_redux_1.useSelector)(props.Slice.SearchResults);
71
+ var _a = React.useState(props.Selection), selectedData = _a[0], setSelectedData = _a[1];
72
+ var _b = React.useState(''), sortKeySelected = _b[0], setSortKeySelected = _b[1];
73
+ var _c = React.useState(false), ascendingSelected = _c[0], setAscendingSelected = _c[1];
74
+ React.useEffect(function () {
75
+ setSelectedData(props.Selection);
76
+ }, [props.Selection]);
77
+ function AddCurrentList() {
78
+ var updatedData;
79
+ updatedData = selectedData.concat(data);
80
+ setSelectedData(_.uniqBy(updatedData, function (d) { return d.ID; }));
81
+ }
82
+ return (React.createElement(React.Fragment, null,
83
+ React.createElement(react_interactive_1.Modal, { Show: props.Show, Title: props.Title, ShowX: true, Size: 'xlg', CallBack: function (conf) { return props.OnClose(selectedData, conf); }, DisableConfirm: props.MinSelection !== undefined && selectedData.length < props.MinSelection, ConfirmShowToolTip: props.MinSelection !== undefined && selectedData.length < props.MinSelection, ConfirmToolTipContent: React.createElement("p", null,
84
+ gpa_symbols_1.CrossMark,
85
+ " At least ",
86
+ props.MinSelection,
87
+ " items must be selected. ") },
88
+ React.createElement("div", { className: "row" },
89
+ React.createElement("div", { className: "col" }, props.Searchbar(React.createElement(React.Fragment, null,
90
+ props.Type === 'multiple' ? React.createElement("li", { className: "nav-item", style: { width: '20%', paddingRight: 10 } },
91
+ React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%' } },
92
+ React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Quick Selects:"),
93
+ React.createElement("form", null,
94
+ React.createElement("div", { className: "form-group" },
95
+ React.createElement("div", { className: "btn btn-primary", onClick: function (event) { event.preventDefault(); AddCurrentList(); } }, "Add Current List to Selection")),
96
+ React.createElement("div", { className: "form-group" },
97
+ React.createElement("div", { className: "btn btn-danger", onClick: function (event) { event.preventDefault(); setSelectedData([]); } }, "Remove All"))))) : null,
98
+ React.Children.map(props.children, function (e) {
99
+ if (React.isValidElement(e))
100
+ return e;
101
+ return null;
102
+ }))))),
103
+ React.createElement("div", { className: "row" },
104
+ React.createElement("div", { className: "col", style: { width: (props.Type === undefined || props.Type === 'single' ? '100%' : '60%') } },
105
+ React.createElement(react_table_1.default, { cols: props.Columns, tableClass: "table table-hover", data: data, sortKey: sortField, ascending: ascending, onSort: function (d) {
106
+ if (d.colKey === "Scroll")
107
+ return;
108
+ if (d.colKey === sortField)
109
+ dispatch(props.Slice.Sort({ SortField: sortField, Ascending: ascending }));
110
+ else {
111
+ dispatch(props.Slice.Sort({ SortField: d.colField, Ascending: true }));
112
+ }
113
+ }, onClick: function (d) {
114
+ if (props.Type === undefined || props.Type === 'single')
115
+ setSelectedData([d.row]);
116
+ else
117
+ setSelectedData(function (s) { return __spreadArray(__spreadArray([], s.filter(function (item) { return item.ID !== d.row.ID; }), true), [d.row], false); });
118
+ }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: '400px', width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return selectedData.findIndex(function (d) { return d.ID === item.ID; }) > -1; } })),
119
+ props.Type === 'multiple' ? React.createElement("div", { className: "col", style: { width: '40%' } },
120
+ React.createElement("div", { style: { width: '100%' } },
121
+ React.createElement("h3", null, " Current Selection ")),
122
+ React.createElement(react_table_1.default, { cols: props.Columns, tableClass: "table table-hover", data: selectedData, sortKey: sortKeySelected, ascending: ascendingSelected, onSort: function (d) {
123
+ if (d.colKey === sortKeySelected) {
124
+ var ordered = _.orderBy(selectedData, [d.colKey], [(!ascendingSelected ? "asc" : "desc")]);
125
+ setAscendingSelected(!ascendingSelected);
126
+ setSelectedData(ordered);
127
+ }
128
+ else {
129
+ var ordered = _.orderBy(selectedData, [d.colKey], ["asc"]);
130
+ setAscendingSelected(!ascendingSelected);
131
+ setSelectedData(ordered);
132
+ setSortKeySelected(d.colKey);
133
+ }
134
+ }, onClick: function (d) { return setSelectedData(__spreadArray([], selectedData.filter(function (item) { return item.ID !== d.row.ID; }), true)); }, theadStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, tbodyStyle: { display: 'block', overflowY: 'scroll', maxHeight: '400px', width: '100%' }, rowStyle: { fontSize: 'smaller', display: 'table', tableLayout: 'fixed', width: '100%' }, selected: function (item) { return false; } })) : null))));
135
+ }
@@ -0,0 +1,7 @@
1
+ import { ITimeFilter } from '../TimeFilter';
2
+ interface IQuickSelect {
3
+ label: string;
4
+ createFilter: (timeZone: string) => ITimeFilter;
5
+ }
6
+ export declare const AvailableQuickSelects: IQuickSelect[];
7
+ export {};