@gpa-gemstone/common-pages 0.0.152 → 0.0.153

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.
@@ -1,41 +1,33 @@
1
- import * as React from 'react';
2
1
  import { Gemstone } from '@gpa-gemstone/application-typings';
3
2
  interface IProps<T> {
4
3
  /**
5
4
  * Attribute used to control what type of files are filtered by default in file explorer
6
- * @type {string}
7
5
  * */
8
6
  FileTypeAttribute: string;
9
7
  /**
10
8
  * Array of available pipelines to use
11
- * @type {IPipeline[]}
12
9
  * */
13
10
  Pipelines: Gemstone.TSX.Interfaces.IPipeline<T, any>[];
14
11
  /**
15
12
  * React Component to be used in the Review Step
16
- * @type {React.FC<IReviewProps<T>>}
17
13
  * */
18
14
  ReviewUI: (props: {
19
15
  Data: T[];
20
16
  }) => JSX.Element;
21
17
  /**
22
18
  * React Component to be used in the Complete Step
23
- * @type {React.FC<IReviewProps<T>>}
24
19
  * */
25
20
  CompleteUI?: JSX.Element;
26
21
  /**
27
22
  * Index of the steps array in the current pipline
28
- * @type {React.FC<IReviewProps<T>>}
29
23
  * */
30
24
  CurrentPipelineStep: number;
31
25
  /**
32
26
  * Setter to pass into the pipeline UI Components
33
- * @type {React.FC<IReviewProps<T>>}
34
27
  * */
35
28
  SetCurrentPipelineStep: (step: number) => void;
36
29
  /**
37
30
  * Step to represent current stage of component
38
- * @type {'Upload' | 'Process' | 'Review' | 'Complete'}
39
31
  * */
40
32
  Step: Gemstone.TSX.Types.BulkUploadStep;
41
33
  /**
@@ -50,14 +42,12 @@ interface IProps<T> {
50
42
  SetErrors: (errors: string[]) => void;
51
43
  /**
52
44
  * Optional Progress Bar component to replace internal Progress Bar.
53
- * @type {JSX.Element}
54
45
  */
55
46
  ProgressBar?: JSX.Element;
56
47
  /**
57
48
  * Optional flag to call OnComplete handler when the review step is hit.
58
- * @type {boolean}
59
49
  */
60
50
  CompleteOnReview?: boolean;
61
51
  }
62
- export default function BulkUpload<T>(props: IProps<T>): React.JSX.Element;
52
+ export default function BulkUpload<T>(props: IProps<T>): JSX.Element;
63
53
  export {};
@@ -10,9 +10,9 @@ interface IProps {
10
10
  ClassName?: string;
11
11
  ErrorIconSize?: number;
12
12
  }
13
- export default class ErrorBoundary extends React.Component<IProps, IError> {
13
+ export default class ErrorBoundary extends React.Component<React.PropsWithChildren<IProps>, IError> {
14
14
  constructor(props: IProps);
15
15
  componentDidCatch(error: IError): void;
16
- render(): React.JSX.Element;
16
+ render(): JSX.Element;
17
17
  }
18
18
  export {};
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { OpenXDA } from '@gpa-gemstone/application-typings';
3
2
  interface IProps {
4
3
  setEventFilters: (characteristics?: IEventCharacteristicFilters, types?: number[]) => void;
@@ -36,5 +35,5 @@ interface IEventCharacteristicFilters {
36
35
  curveInside: boolean;
37
36
  curveOutside: boolean;
38
37
  }
39
- declare const EventCharacteristicFilter: (props: IProps) => React.JSX.Element | null;
38
+ declare const EventCharacteristicFilter: (props: IProps) => JSX.Element | null;
40
39
  export default EventCharacteristicFilter;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import 'moment';
3
2
  import { OpenXDA } from '@gpa-gemstone/application-typings';
4
3
  interface IProps {
@@ -7,5 +6,5 @@ interface IProps {
7
6
  EventTypes: OpenXDA.Types.EventType[];
8
7
  SelectedTypeID: number[];
9
8
  }
10
- declare const EventTypeFilter: React.FC<IProps>;
9
+ declare const EventTypeFilter: (props: IProps) => JSX.Element;
11
10
  export default EventTypeFilter;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import 'moment';
3
2
  import { OpenXDA, SystemCenter } from '@gpa-gemstone/application-typings';
4
3
  type S = SystemCenter.Types.DetailedMeter | SystemCenter.Types.DetailedAsset | SystemCenter.Types.DetailedLocation | OpenXDA.Types.AssetGroup;
@@ -11,5 +10,5 @@ interface IProps<S> {
11
10
  selected: string;
12
11
  };
13
12
  }
14
- declare function NavbarFilterButton(props: IProps<S>): React.JSX.Element;
13
+ declare function NavbarFilterButton(props: IProps<S>): JSX.Element;
15
14
  export default NavbarFilterButton;
package/lib/Note.d.ts CHANGED
@@ -16,5 +16,5 @@ interface IProps {
16
16
  DefaultApplication?: OpenXDA.Types.NoteApplication;
17
17
  Filter?: (note: OpenXDA.Types.Note) => boolean;
18
18
  }
19
- declare function Note(props: React.PropsWithChildren<IProps>): React.JSX.Element;
19
+ declare function Note(props: React.PropsWithChildren<IProps>): JSX.Element;
20
20
  export default Note;
@@ -4,5 +4,5 @@ interface IProps {
4
4
  ClassName?: string;
5
5
  Logo?: string;
6
6
  }
7
- declare const RoleAccessErrorPage: React.FunctionComponent<IProps>;
7
+ declare const RoleAccessErrorPage: (props: IProps) => JSX.Element;
8
8
  export default RoleAccessErrorPage;
@@ -21,16 +21,16 @@ interface IOptions {
21
21
  /** This Implements a few standardized SearchBars */
22
22
  export declare namespace DefaultSearch {
23
23
  /** This Implements a standard Meter Search */
24
- const Meter: React.FC<IProps<SystemCenter.Types.DetailedMeter>>;
24
+ const Meter: (props: React.PropsWithChildren<IProps<SystemCenter.Types.DetailedMeter>>) => JSX.Element;
25
25
  /** This Implements a standard Substation Search */
26
- const Location: React.FC<IProps<SystemCenter.Types.DetailedLocation>>;
26
+ const Location: (props: React.PropsWithChildren<IProps<SystemCenter.Types.DetailedLocation>>) => JSX.Element;
27
27
  /** This Implements a standard Transmission Asset Search */
28
- const Asset: React.FC<IProps<SystemCenter.Types.DetailedAsset>>;
28
+ const Asset: (props: React.PropsWithChildren<IProps<SystemCenter.Types.DetailedAsset>>) => JSX.Element;
29
29
  /** This Implements a standard AssetGroup Search */
30
- const AssetGroup: React.FC<IProps<OpenXDA.Types.AssetGroup>>;
30
+ const AssetGroup: (props: React.PropsWithChildren<IProps<OpenXDA.Types.AssetGroup>>) => JSX.Element;
31
31
  /** This Implements a standard User Search */
32
- const User: React.FC<IProps<Application.Types.iUserAccount>>;
32
+ const User: (props: React.PropsWithChildren<IProps<Application.Types.iUserAccount>>) => JSX.Element;
33
33
  /** This Implements a standard Customer Search */
34
- const Customer: React.FC<IProps<OpenXDA.Types.Customer>>;
34
+ const Customer: (props: React.PropsWithChildren<IProps<OpenXDA.Types.Customer>>) => JSX.Element;
35
35
  }
36
36
  export {};
@@ -25,16 +25,16 @@ interface IOptions {
25
25
  /** This Implements a few standardized Selection Popups */
26
26
  export declare namespace DefaultSelects {
27
27
  /** This Implements a standard Meter Selection Modal */
28
- function Meter(props: IProps<SystemCenter.Types.DetailedMeter>): React.JSX.Element;
28
+ function Meter(props: IProps<SystemCenter.Types.DetailedMeter>): JSX.Element;
29
29
  /** This Implements a standard Substation Selection Modal */
30
- function Location(props: IProps<SystemCenter.Types.DetailedLocation>): React.JSX.Element;
30
+ function Location(props: IProps<SystemCenter.Types.DetailedLocation>): JSX.Element;
31
31
  /** This Implements a standard Transmission Asset Selection Modal */
32
- function Asset(props: IProps<SystemCenter.Types.DetailedAsset>): React.JSX.Element;
32
+ function Asset(props: IProps<SystemCenter.Types.DetailedAsset>): JSX.Element;
33
33
  /** This Implements a standard Asset Group Selection Modal */
34
- function AssetGroup(props: IProps<OpenXDA.Types.AssetGroup>): React.JSX.Element;
34
+ function AssetGroup(props: IProps<OpenXDA.Types.AssetGroup>): JSX.Element;
35
35
  /** This Implements a standard User Selection Modal */
36
- function User(props: IProps<Application.Types.iUserAccount>): React.JSX.Element;
36
+ function User(props: IProps<Application.Types.iUserAccount>): JSX.Element;
37
37
  /** This Implements a standard Customer Selection Modal */
38
- function Customer(props: IProps<OpenXDA.Types.Customer>): React.JSX.Element;
38
+ function Customer(props: IProps<OpenXDA.Types.Customer>): JSX.Element;
39
39
  }
40
40
  export {};
@@ -14,5 +14,5 @@ interface IProps<T extends U> {
14
14
  MinSelection?: number;
15
15
  children?: React.ReactNode;
16
16
  }
17
- export default function SelectPopup<T extends U>(props: IProps<T>): React.JSX.Element;
17
+ export default function SelectPopup<T extends U>(props: IProps<T>): JSX.Element;
18
18
  export {};
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { DateTimeSetting, ITimeFilter } from './TimeFilter';
3
2
  import { TimeUnit } from './TimeWindowUtils';
4
3
  export type DateUnit = ('datetime-local' | 'date' | 'time');
@@ -18,7 +17,7 @@ interface IProps {
18
17
  AddRowContainer?: boolean;
19
18
  SplitSelects?: boolean;
20
19
  }
21
- declare const QuickSelects: (props: IProps) => React.JSX.Element;
20
+ declare const QuickSelects: (props: IProps) => JSX.Element;
22
21
  export default QuickSelects;
23
22
  export declare function getFormat(format?: DateUnit): "MM/DD/YYYY HH:mm:ss.SSS" | "YYYY-MM-DD" | "HH:mm:ss.SSS";
24
23
  export declare const AvailableQuickSelects: IQuickSelect[];
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { IFilterProps } from './StartEndFilter';
3
- declare const DateFilter: (props: IFilterProps) => React.JSX.Element;
2
+ declare const DateFilter: (props: IFilterProps) => JSX.Element;
4
3
  export default DateFilter;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { IFilterProps } from './StartEndFilter';
3
- declare const DateTimeLocalFilter: (props: IFilterProps) => React.JSX.Element;
2
+ declare const DateTimeLocalFilter: (props: IFilterProps) => JSX.Element;
4
3
  export default DateTimeLocalFilter;
@@ -17,5 +17,5 @@ export interface IFilterProps {
17
17
  ShowQuickSelects: boolean;
18
18
  ContainerWidth: number;
19
19
  }
20
- declare const StartEndFilter: (props: IFilterProps) => React.JSX.Element;
20
+ declare const StartEndFilter: (props: IFilterProps) => JSX.Element;
21
21
  export default StartEndFilter;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { IFilterProps } from './StartEndFilter';
3
- declare const TimeFilter: (props: IFilterProps) => React.JSX.Element;
2
+ declare const TimeFilter: (props: IFilterProps) => JSX.Element;
4
3
  export default TimeFilter;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { IStartEnd, IStartDuration, IEndDuration, TimeUnit } from './TimeWindowUtils';
3
2
  import { DateUnit } from './QuickSelects';
4
3
  import { Gemstone } from '@gpa-gemstone/application-typings';
@@ -48,7 +47,15 @@ interface IProps {
48
47
  * Flag to toggle usage of helper message
49
48
  */
50
49
  showHelpMessage?: boolean;
50
+ /**
51
+ * Optional Flag to enable collapsing of TimeFilter
52
+ */
53
+ enableCollapse?: boolean;
54
+ /**
55
+ * Optional setter to push collapse state to parent
56
+ */
57
+ setCollapsed?: (collapsed: boolean) => void;
51
58
  }
52
- declare const TimeFilter: (props: IProps) => React.JSX.Element;
59
+ declare const TimeFilter: (props: IProps) => JSX.Element;
53
60
  export declare function getTimeWindowFromFilter(flt: ITimeFilter, format?: string): ITimeWindow;
54
61
  export default TimeFilter;
@@ -58,38 +58,53 @@ var lodash_1 = __importDefault(require("lodash"));
58
58
  var StartEndFilter_1 = __importDefault(require("./StartEndFilter/StartEndFilter"));
59
59
  var helper_functions_1 = require("@gpa-gemstone/helper-functions");
60
60
  var WindowFilter_1 = __importDefault(require("./WindowFilter/WindowFilter"));
61
+ var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
61
62
  var TimeFilter = function (props) {
62
- var _a, _b, _c, _d;
63
+ var _a, _b, _c, _d, _e;
63
64
  var containerRef = React.useRef(null);
64
65
  var width = (0, helper_functions_1.useGetContainerPosition)(containerRef).width;
65
66
  var format = (0, QuickSelects_1.getFormat)(props.format);
66
- var _e = React.useState(-1), activeQuickSelect = _e[0], setActiveQuickSelect = _e[1];
67
- var _f = React.useState(getTimeWindowFromFilter(props.filter, format)), filter = _f[0], setFilter = _f[1];
68
- // Checks typing of ITimeFilter and then compares to ITimeWindow
69
- function isEqual(timeWindow, timeFilter) {
70
- var flt = getTimeWindowFromFilter(timeFilter, format);
71
- return lodash_1.default.isEqual(timeWindow, flt);
72
- }
67
+ var _f = React.useState(-1), activeQuickSelect = _f[0], setActiveQuickSelect = _f[1];
68
+ var _g = React.useState(getTimeWindowFromFilter(props.filter, format)), filter = _g[0], setFilter = _g[1];
69
+ var _h = React.useState(false), collapsed = _h[0], setCollapsed = _h[1];
70
+ //Effect to set parent filter when internal filter changes
73
71
  React.useEffect(function () {
74
72
  if (!isEqual(filter, props.filter)) {
75
73
  props.setFilter(filter.start, filter.end, filter.unit, filter.duration);
76
74
  }
77
75
  }, [filter]);
76
+ //Effect to sync filter if external filter changes
78
77
  React.useEffect(function () {
79
78
  if (!isEqual(filter, props.filter)) {
80
79
  var flt = getTimeWindowFromFilter(props.filter, format);
81
80
  setFilter(flt);
82
81
  }
83
82
  }, [props.filter]);
83
+ //Effect to push collapse state to parent
84
+ React.useEffect(function () {
85
+ if (props.setCollapsed == null)
86
+ return;
87
+ props.setCollapsed(collapsed);
88
+ }, [collapsed]);
89
+ // Checks typing of ITimeFilter and then compares to ITimeWindow
90
+ var isEqual = function (timeWindow, timeFilter) {
91
+ var flt = getTimeWindowFromFilter(timeFilter, format);
92
+ return lodash_1.default.isEqual(timeWindow, flt);
93
+ };
84
94
  var helpMessaage = ((_a = props.showHelpMessage) !== null && _a !== void 0 ? _a : true) ? "All times shown are in system time (".concat(props.timeZone, ").") : undefined;
85
95
  return (React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%', overflow: 'hidden' }, ref: containerRef },
86
- React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Date/Time Filter:"),
87
- props.dateTimeSetting === 'startEnd' ?
88
- React.createElement(StartEndFilter_1.default, { TimeWindowFilter: filter, SetTimeWindowFilter: setFilter, Timezone: props.timeZone, ActiveQP: activeQuickSelect, SetActiveQP: setActiveQuickSelect, SetFilter: props.setFilter, Accuracy: props.accuracy, Format: format, DateUnit: (_b = props.format) !== null && _b !== void 0 ? _b : 'datetime-local', ShowQuickSelects: props.showQuickSelect, ContainerWidth: width, HelpMessage: helpMessaage })
89
- : props.dateTimeSetting === 'startWindow' ?
90
- React.createElement(WindowFilter_1.default, { TimeWindowFilter: filter, SetTimeWindowFilter: setFilter, Timezone: props.timeZone, ActiveQP: activeQuickSelect, SetActiveQP: setActiveQuickSelect, SetFilter: props.setFilter, Accuracy: props.accuracy, Format: format, DateUnit: (_c = props.format) !== null && _c !== void 0 ? _c : 'datetime-local', ShowQuickSelects: props.showQuickSelect, ContainerWidth: width, HelpMessage: helpMessaage, Window: 'start' })
91
- :
92
- React.createElement(WindowFilter_1.default, { TimeWindowFilter: filter, SetTimeWindowFilter: setFilter, Timezone: props.timeZone, ActiveQP: activeQuickSelect, SetActiveQP: setActiveQuickSelect, SetFilter: props.setFilter, Accuracy: props.accuracy, Format: format, DateUnit: (_d = props.format) !== null && _d !== void 0 ? _d : 'datetime-local', ShowQuickSelects: props.showQuickSelect, ContainerWidth: width, HelpMessage: helpMessaage, Window: 'end' })));
96
+ React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } },
97
+ React.createElement("div", { className: "d-flex align-items-center" },
98
+ React.createElement("span", { className: "mr-2" }, "Date/Time Filter:"),
99
+ ((_b = props.enableCollapse) !== null && _b !== void 0 ? _b : false) ?
100
+ React.createElement("button", { type: "button", className: "btn p-0 ml-auto", onClick: function () { return setCollapsed(function (x) { return !x; }); } }, collapsed ? React.createElement(gpa_symbols_1.ReactIcons.ArrowDropDown, null) : React.createElement(gpa_symbols_1.ReactIcons.ArrowDropUp, null)) : null)),
101
+ collapsed ? null :
102
+ props.dateTimeSetting === 'startEnd' ?
103
+ React.createElement(StartEndFilter_1.default, { TimeWindowFilter: filter, SetTimeWindowFilter: setFilter, Timezone: props.timeZone, ActiveQP: activeQuickSelect, SetActiveQP: setActiveQuickSelect, SetFilter: props.setFilter, Accuracy: props.accuracy, Format: format, DateUnit: (_c = props.format) !== null && _c !== void 0 ? _c : 'datetime-local', ShowQuickSelects: props.showQuickSelect, ContainerWidth: width, HelpMessage: helpMessaage })
104
+ : props.dateTimeSetting === 'startWindow' ?
105
+ React.createElement(WindowFilter_1.default, { TimeWindowFilter: filter, SetTimeWindowFilter: setFilter, Timezone: props.timeZone, ActiveQP: activeQuickSelect, SetActiveQP: setActiveQuickSelect, SetFilter: props.setFilter, Accuracy: props.accuracy, Format: format, DateUnit: (_d = props.format) !== null && _d !== void 0 ? _d : 'datetime-local', ShowQuickSelects: props.showQuickSelect, ContainerWidth: width, HelpMessage: helpMessaage, Window: 'start' })
106
+ :
107
+ React.createElement(WindowFilter_1.default, { TimeWindowFilter: filter, SetTimeWindowFilter: setFilter, Timezone: props.timeZone, ActiveQP: activeQuickSelect, SetActiveQP: setActiveQuickSelect, SetFilter: props.setFilter, Accuracy: props.accuracy, Format: format, DateUnit: (_e = props.format) !== null && _e !== void 0 ? _e : 'datetime-local', ShowQuickSelects: props.showQuickSelect, ContainerWidth: width, HelpMessage: helpMessaage, Window: 'end' })));
93
108
  };
94
109
  // Converts ITimeFilter to an ITimeWindow filter
95
110
  function getTimeWindowFromFilter(flt, format) {
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
1
  import { IFilterProps } from '../StartEndFilter/StartEndFilter';
3
2
  import { Window } from './WindowForm';
4
3
  export interface IProps extends IFilterProps {
5
4
  Window: Window;
6
5
  }
7
- declare const WindowFilter: (props: IProps) => React.JSX.Element;
6
+ declare const WindowFilter: (props: IProps) => JSX.Element;
8
7
  export default WindowFilter;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { ITimeWindow } from '../TimeFilter';
3
2
  export type Window = "start" | "end";
4
3
  export interface IProps {
@@ -9,5 +8,5 @@ export interface IProps {
9
8
  ShowQuickSelect: boolean;
10
9
  Window: Window;
11
10
  }
12
- declare const WindowForm: (props: IProps) => React.JSX.Element;
11
+ declare const WindowForm: (props: IProps) => JSX.Element;
13
12
  export default WindowForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/common-pages",
3
- "version": "0.0.152",
3
+ "version": "0.0.153",
4
4
  "description": "Common UI pages for GPA products",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -35,6 +35,8 @@
35
35
  "@types/crypto-js": "^4.2.0",
36
36
  "@types/jest": "^27.0.0",
37
37
  "@types/jquery": "3.5.6",
38
+ "@types/lodash": "^4.17.20",
39
+ "@types/react": "18.2.0",
38
40
  "@typescript-eslint/eslint-plugin": "^5.60.0",
39
41
  "@typescript-eslint/parser": "^5.60.0",
40
42
  "eslint": "^8.43.0",
@@ -44,19 +46,22 @@
44
46
  "typescript": "5.5.3"
45
47
  },
46
48
  "dependencies": {
47
- "@gpa-gemstone/application-typings": "0.0.89",
48
- "@gpa-gemstone/gpa-symbols": "0.0.56",
49
- "@gpa-gemstone/helper-functions": "0.0.47",
50
- "@gpa-gemstone/react-forms": "1.1.101",
51
- "@gpa-gemstone/react-interactive": "1.0.163",
52
- "@gpa-gemstone/react-table": "1.2.86",
49
+ "@gpa-gemstone/application-typings": "0.0.90",
50
+ "@gpa-gemstone/gpa-symbols": "0.0.57",
51
+ "@gpa-gemstone/helper-functions": "0.0.48",
52
+ "@gpa-gemstone/react-forms": "1.1.102",
53
+ "@gpa-gemstone/react-interactive": "1.0.164",
54
+ "@gpa-gemstone/react-table": "1.2.87",
53
55
  "@reduxjs/toolkit": "1.8.3",
54
56
  "crypto-js": "^4.2.0",
55
57
  "moment": "^2.29.4",
56
58
  "moment-timezone": "0.5.43",
57
- "react": "^18.2.0",
58
59
  "react-redux": "8.0.2",
59
60
  "styled-components": "5.3.3"
60
61
  },
62
+ "peerDependencies": {
63
+ "react": "18.2.0",
64
+ "react-dom": "18.2.0"
65
+ },
61
66
  "publishConfig": {"access": "public"}
62
67
  }