@gpa-gemstone/common-pages 0.0.146 → 0.0.148
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/ErrorBoundary.d.ts +4 -4
- package/lib/ErrorBoundary.js +2 -4
- package/lib/Pipelines/CSVPipeline/CSVPipeline.js +1 -1
- package/lib/TimeFilter/QuickSelects.d.ts +16 -2
- package/lib/TimeFilter/QuickSelects.js +78 -0
- package/lib/TimeFilter/StartEndFilter/DateFilter.d.ts +4 -0
- package/lib/TimeFilter/StartEndFilter/DateFilter.js +97 -0
- package/lib/TimeFilter/StartEndFilter/DateTimeLocalFilter.d.ts +4 -0
- package/lib/TimeFilter/StartEndFilter/DateTimeLocalFilter.js +121 -0
- package/lib/TimeFilter/StartEndFilter/StartEndFilter.d.ts +21 -0
- package/lib/TimeFilter/StartEndFilter/StartEndFilter.js +74 -0
- package/lib/TimeFilter/StartEndFilter/TimeFilter.d.ts +4 -0
- package/lib/TimeFilter/StartEndFilter/TimeFilter.js +93 -0
- package/lib/TimeFilter/TimeFilter.d.ts +32 -8
- package/lib/TimeFilter/TimeFilter.js +14 -113
- package/lib/TimeFilter/WindowFilter/WindowFilter.d.ts +8 -0
- package/lib/TimeFilter/WindowFilter/WindowFilter.js +111 -0
- package/lib/TimeFilter/WindowFilter/WindowForm.d.ts +13 -0
- package/lib/TimeFilter/WindowFilter/WindowForm.js +73 -0
- package/package.json +4 -4
package/lib/ErrorBoundary.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import { CSSProperties } from 'styled-components';
|
2
3
|
interface IError {
|
3
4
|
name: string;
|
4
5
|
message: string;
|
5
6
|
}
|
6
7
|
interface IProps {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Width: number | string;
|
8
|
+
ErrorMessage: string;
|
9
|
+
Style?: CSSProperties;
|
10
|
+
ClassName?: string;
|
11
11
|
ErrorIconSize?: number;
|
12
12
|
}
|
13
13
|
export default class ErrorBoundary extends React.Component<IProps, IError> {
|
package/lib/ErrorBoundary.js
CHANGED
@@ -79,10 +79,8 @@ var ErrorBoundary = /** @class */ (function (_super) {
|
|
79
79
|
ErrorBoundary.prototype.render = function () {
|
80
80
|
var _a;
|
81
81
|
if (this.state.name.length > 0) {
|
82
|
-
return (React.createElement("div", { className:
|
83
|
-
React.createElement(
|
84
|
-
React.createElement("div", { className: "card-body", style: { overflowY: 'auto' } },
|
85
|
-
React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Label: this.props.BodyErrorMessage, Size: (_a = this.props.ErrorIconSize) !== null && _a !== void 0 ? _a : 150 }))));
|
82
|
+
return (React.createElement("div", { className: this.props.ClassName, style: this.props.Style },
|
83
|
+
React.createElement(react_interactive_1.ServerErrorIcon, { Show: true, Label: this.props.ErrorMessage, Size: (_a = this.props.ErrorIconSize) !== null && _a !== void 0 ? _a : 150 })));
|
86
84
|
}
|
87
85
|
else
|
88
86
|
return React.createElement(React.Fragment, null, this.props.children);
|
@@ -414,7 +414,7 @@ function CsvPipelineEditStep(props) {
|
|
414
414
|
};
|
415
415
|
return (React.createElement(React.Fragment, null,
|
416
416
|
React.createElement("div", { className: "container-fluid d-flex flex-column p-0 h-100" },
|
417
|
-
React.createElement(ErrorBoundary_1.default, {
|
417
|
+
React.createElement(ErrorBoundary_1.default, { ClassName: "row h-100", ErrorMessage: 'Error loading page.' },
|
418
418
|
React.createElement("div", { className: 'row h-100' },
|
419
419
|
React.createElement("div", { className: 'col-12 d-flex flex-column h-100' }, pagedData.length !== 0 ?
|
420
420
|
React.createElement(React.Fragment, null,
|
@@ -1,10 +1,24 @@
|
|
1
|
-
import
|
1
|
+
import * as React from 'react';
|
2
|
+
import { DateTimeSetting, ITimeFilter } from './TimeFilter';
|
3
|
+
import { TimeUnit } from './TimeWindowUtils';
|
2
4
|
export type DateUnit = ('datetime-local' | 'date' | 'time');
|
3
5
|
interface IQuickSelect {
|
4
6
|
label: string;
|
5
7
|
hideQuickPick: (format?: DateUnit) => boolean;
|
6
8
|
createFilter: (timeZone: string, format?: DateUnit) => ITimeFilter;
|
7
9
|
}
|
10
|
+
interface IProps {
|
11
|
+
DateTimeSetting: DateTimeSetting;
|
12
|
+
Format?: "YYYY-MM-DD" | "HH:mm:ss.SSS" | "MM/DD/YYYY HH:mm:ss.SSS";
|
13
|
+
DateUnit?: DateUnit;
|
14
|
+
Timezone: string;
|
15
|
+
ActiveQP: number;
|
16
|
+
SetActiveQP: (qp: number) => void;
|
17
|
+
SetFilter: (start: string, end: string, unit: TimeUnit, duration: number) => void;
|
18
|
+
AddRowContainer?: boolean;
|
19
|
+
SplitSelects?: boolean;
|
20
|
+
}
|
21
|
+
declare const QuickSelects: (props: IProps) => React.JSX.Element;
|
22
|
+
export default QuickSelects;
|
8
23
|
export declare function getFormat(format?: DateUnit): "MM/DD/YYYY HH:mm:ss.SSS" | "YYYY-MM-DD" | "HH:mm:ss.SSS";
|
9
24
|
export declare const AvailableQuickSelects: IQuickSelect[];
|
10
|
-
export {};
|
@@ -22,14 +22,74 @@
|
|
22
22
|
// 06/20/2024 - Ali Karrar
|
23
23
|
// Moved QuickSelects from TimeFilter to new file
|
24
24
|
//******************************************************************************************************
|
25
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
26
|
+
if (k2 === undefined) k2 = k;
|
27
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
28
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
29
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
30
|
+
}
|
31
|
+
Object.defineProperty(o, k2, desc);
|
32
|
+
}) : (function(o, m, k, k2) {
|
33
|
+
if (k2 === undefined) k2 = k;
|
34
|
+
o[k2] = m[k];
|
35
|
+
}));
|
36
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
37
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
38
|
+
}) : function(o, v) {
|
39
|
+
o["default"] = v;
|
40
|
+
});
|
41
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
42
|
+
if (mod && mod.__esModule) return mod;
|
43
|
+
var result = {};
|
44
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
45
|
+
__setModuleDefault(result, mod);
|
46
|
+
return result;
|
47
|
+
};
|
25
48
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
49
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
50
|
};
|
28
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
52
|
exports.AvailableQuickSelects = void 0;
|
30
53
|
exports.getFormat = getFormat;
|
54
|
+
var React = __importStar(require("react"));
|
55
|
+
var TimeFilter_1 = require("./TimeFilter");
|
31
56
|
var moment_1 = __importDefault(require("moment"));
|
32
57
|
var moment_timezone_1 = __importDefault(require("moment-timezone"));
|
58
|
+
var QuickSelects = function (props) {
|
59
|
+
var _a;
|
60
|
+
var CurrentQuickSelects = React.useMemo(function () { return exports.AvailableQuickSelects.filter(function (qs) { return !qs.hideQuickPick(props.DateUnit); }); }, [props.DateUnit]);
|
61
|
+
return (React.createElement(Container, { AddRow: (_a = props.AddRowContainer) !== null && _a !== void 0 ? _a : true }, CurrentQuickSelects.map(function (qs, i) {
|
62
|
+
var _a;
|
63
|
+
if (i % 3 !== 0)
|
64
|
+
return null;
|
65
|
+
return (React.createElement("div", { key: i, className: getColSize(props.DateTimeSetting, (_a = props.SplitSelects) !== null && _a !== void 0 ? _a : false), style: {
|
66
|
+
paddingLeft: (props.DateTimeSetting === 'startEnd' ? 0 : (i % 9 == 0 ? 15 : 0)),
|
67
|
+
paddingRight: (props.DateTimeSetting === 'startEnd' ? 2 : ((i % 18 == 6 || i % 18 == 15) ? 15 : 2)),
|
68
|
+
marginTop: 10
|
69
|
+
} },
|
70
|
+
React.createElement("ul", { className: "list-group", key: i },
|
71
|
+
React.createElement("li", { key: i, style: { cursor: 'pointer' }, onClick: function () {
|
72
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)(CurrentQuickSelects[i].createFilter(props.Timezone, props.DateUnit), props.Format);
|
73
|
+
props.SetFilter(flt.start, flt.end, flt.unit, flt.duration);
|
74
|
+
props.SetActiveQP(i);
|
75
|
+
}, className: "item badge badge-" + (i == props.ActiveQP ? "primary" : "secondary") }, CurrentQuickSelects[i].label),
|
76
|
+
i + 1 < CurrentQuickSelects.length ?
|
77
|
+
React.createElement("li", { key: i + 1, style: { marginTop: 3, cursor: 'pointer' }, className: "item badge badge-" + (i + 1 == props.ActiveQP ? "primary" : "secondary"), onClick: function () {
|
78
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)(CurrentQuickSelects[i + 1].createFilter(props.Timezone, props.DateUnit), props.Format);
|
79
|
+
props.SetFilter(flt.start, flt.end, flt.unit, flt.duration);
|
80
|
+
props.SetActiveQP(i + 1);
|
81
|
+
} }, CurrentQuickSelects[i + 1].label)
|
82
|
+
: null,
|
83
|
+
i + 2 < CurrentQuickSelects.length ?
|
84
|
+
React.createElement("li", { key: i + 2, style: { marginTop: 3, cursor: 'pointer' }, className: "item badge badge-" + (i + 2 == props.ActiveQP ? "primary" : "secondary"), onClick: function () {
|
85
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)(CurrentQuickSelects[i + 2].createFilter(props.Timezone, props.DateUnit), props.Format);
|
86
|
+
props.SetFilter(flt.start, flt.end, flt.unit, flt.duration);
|
87
|
+
props.SetActiveQP(i + 2);
|
88
|
+
} }, CurrentQuickSelects[i + 2].label)
|
89
|
+
: null)));
|
90
|
+
})));
|
91
|
+
};
|
92
|
+
exports.default = QuickSelects;
|
33
93
|
function getFormat(format) {
|
34
94
|
if (format == 'date')
|
35
95
|
return 'YYYY-MM-DD';
|
@@ -38,6 +98,18 @@ function getFormat(format) {
|
|
38
98
|
else
|
39
99
|
return 'MM/DD/YYYY HH:mm:ss.SSS';
|
40
100
|
}
|
101
|
+
var getColSize = function (dateTimeSetting, splitSelects) {
|
102
|
+
if (dateTimeSetting === 'startEnd') {
|
103
|
+
if (splitSelects)
|
104
|
+
return 'col-4';
|
105
|
+
else
|
106
|
+
return 'col-2';
|
107
|
+
}
|
108
|
+
if (splitSelects)
|
109
|
+
return 'col-8';
|
110
|
+
else
|
111
|
+
return 'col-4';
|
112
|
+
};
|
41
113
|
//update all quick selects to use new timefilters
|
42
114
|
exports.AvailableQuickSelects = [
|
43
115
|
{
|
@@ -300,3 +372,9 @@ exports.AvailableQuickSelects = [
|
|
300
372
|
}
|
301
373
|
}
|
302
374
|
];
|
375
|
+
var Container = function (props) {
|
376
|
+
if (props.AddRow)
|
377
|
+
return React.createElement("div", { className: 'row m-0 align-items-center justify-content-center' }, props.children);
|
378
|
+
else
|
379
|
+
return React.createElement(React.Fragment, null, props.children);
|
380
|
+
};
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"use strict";
|
2
|
+
//******************************************************************************************************
|
3
|
+
// DateFilter.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
|
+
// 07/14/2025 - Preston Crawford
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
48
|
+
};
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
50
|
+
var React = __importStar(require("react"));
|
51
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
52
|
+
var TimeFilter_1 = require("../TimeFilter");
|
53
|
+
var QuickSelects_1 = __importDefault(require("../QuickSelects"));
|
54
|
+
var DateFilter = function (props) {
|
55
|
+
var FirstFallbackBreakpoint = 1050;
|
56
|
+
var SecondFallbackBreakpoint = 541;
|
57
|
+
var FirstFallbackBreakpointNoQS = 375;
|
58
|
+
var handleSetTimeWindowFilter = React.useCallback(function (record) {
|
59
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)({ start: record.start, end: record.end }, props.Format);
|
60
|
+
props.SetTimeWindowFilter(flt);
|
61
|
+
props.SetActiveQP(-1);
|
62
|
+
}, [props.Format]);
|
63
|
+
var startEndCol = React.useMemo(function () {
|
64
|
+
if (props.ShowQuickSelects && props.ContainerWidth > FirstFallbackBreakpoint)
|
65
|
+
return 'col-2';
|
66
|
+
if (!props.ShowQuickSelects && props.ContainerWidth > FirstFallbackBreakpointNoQS)
|
67
|
+
return 'col-6';
|
68
|
+
else
|
69
|
+
return 'col-12';
|
70
|
+
}, [props.ShowQuickSelects, props.ContainerWidth]);
|
71
|
+
var quickSelectClass = React.useMemo(function () {
|
72
|
+
if (props.ContainerWidth > FirstFallbackBreakpoint)
|
73
|
+
return 'col-8';
|
74
|
+
else
|
75
|
+
return 'col-12';
|
76
|
+
}, [props.ContainerWidth]);
|
77
|
+
if (props.ContainerWidth > FirstFallbackBreakpoint)
|
78
|
+
return (React.createElement("div", { className: 'row m-0' },
|
79
|
+
React.createElement("div", { className: startEndCol },
|
80
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
81
|
+
React.createElement("div", { className: startEndCol },
|
82
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
83
|
+
props.ShowQuickSelects ?
|
84
|
+
React.createElement("div", { className: quickSelectClass },
|
85
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit })) : null));
|
86
|
+
else
|
87
|
+
return (React.createElement(React.Fragment, null,
|
88
|
+
React.createElement("div", { className: 'row m-0' },
|
89
|
+
React.createElement("div", { className: startEndCol },
|
90
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
91
|
+
React.createElement("div", { className: startEndCol },
|
92
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy }))),
|
93
|
+
props.ShowQuickSelects ?
|
94
|
+
React.createElement("div", { className: quickSelectClass },
|
95
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit, SplitSelects: props.ContainerWidth < SecondFallbackBreakpoint })) : null));
|
96
|
+
};
|
97
|
+
exports.default = DateFilter;
|
@@ -0,0 +1,121 @@
|
|
1
|
+
"use strict";
|
2
|
+
//******************************************************************************************************
|
3
|
+
// DateTimeLocalFilter.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
|
+
// 07/14/2025 - Preston Crawford
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
48
|
+
};
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
50
|
+
var React = __importStar(require("react"));
|
51
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
52
|
+
var TimeFilter_1 = require("../TimeFilter");
|
53
|
+
var QuickSelects_1 = __importDefault(require("../QuickSelects"));
|
54
|
+
var react_interactive_1 = require("@gpa-gemstone/react-interactive");
|
55
|
+
var DateTimeLocalFilter = function (props) {
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
57
|
+
var FirstFallbackBreakpointQS = 1768;
|
58
|
+
var SecondFallbackBreakpointQS = 612, FirstFallbacKBreakpointNoQS = 612;
|
59
|
+
var _g = React.useState(false), showQuickPickModal = _g[0], setShowQuickPickModal = _g[1];
|
60
|
+
var handleSetTimeWindowFilter = React.useCallback(function (record) {
|
61
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)({ start: record.start, end: record.end }, props.Format);
|
62
|
+
props.SetTimeWindowFilter(flt);
|
63
|
+
props.SetActiveQP(-1);
|
64
|
+
}, [props.Format]);
|
65
|
+
var startEndCol = React.useMemo(function () {
|
66
|
+
if (props.ShowQuickSelects) {
|
67
|
+
if (props.ContainerWidth > FirstFallbackBreakpointQS)
|
68
|
+
return 'col-2';
|
69
|
+
else if (props.ContainerWidth > SecondFallbackBreakpointQS)
|
70
|
+
return 'col-6';
|
71
|
+
else
|
72
|
+
return 'col-12';
|
73
|
+
}
|
74
|
+
if (props.ContainerWidth > FirstFallbacKBreakpointNoQS)
|
75
|
+
return 'col-6';
|
76
|
+
else
|
77
|
+
return 'col-12';
|
78
|
+
}, [props.ShowQuickSelects, props.DateUnit, props.ContainerWidth]);
|
79
|
+
var quickSelectCol = React.useMemo(function () {
|
80
|
+
if (props.ContainerWidth > FirstFallbackBreakpointQS)
|
81
|
+
return 'col-8';
|
82
|
+
return 'col-12';
|
83
|
+
}, [props.DateUnit, props.ContainerWidth]);
|
84
|
+
if (props.ContainerWidth > FirstFallbackBreakpointQS) {
|
85
|
+
return (React.createElement("div", { className: 'row m-0' },
|
86
|
+
React.createElement("div", { className: startEndCol },
|
87
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: (_a = props.DateUnit) !== null && _a !== void 0 ? _a : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
88
|
+
React.createElement("div", { className: startEndCol },
|
89
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: (_b = props.DateUnit) !== null && _b !== void 0 ? _b : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
90
|
+
props.ShowQuickSelects ?
|
91
|
+
React.createElement("div", { className: quickSelectCol },
|
92
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit })) : null));
|
93
|
+
}
|
94
|
+
else if (props.ContainerWidth > SecondFallbackBreakpointQS) {
|
95
|
+
return (React.createElement("div", { className: 'row m-0' },
|
96
|
+
React.createElement("div", { className: startEndCol },
|
97
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: (_c = props.DateUnit) !== null && _c !== void 0 ? _c : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
98
|
+
React.createElement("div", { className: startEndCol },
|
99
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: (_d = props.DateUnit) !== null && _d !== void 0 ? _d : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
100
|
+
React.createElement("div", { className: 'row m-0 w-100' }, props.ShowQuickSelects ?
|
101
|
+
React.createElement("div", { className: quickSelectCol },
|
102
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit }))
|
103
|
+
: null)));
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
return (React.createElement("div", { className: 'row m-0' },
|
107
|
+
React.createElement("div", { className: startEndCol },
|
108
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: (_e = props.DateUnit) !== null && _e !== void 0 ? _e : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
109
|
+
React.createElement("div", { className: startEndCol },
|
110
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: (_f = props.DateUnit) !== null && _f !== void 0 ? _f : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
111
|
+
props.ShowQuickSelects ?
|
112
|
+
React.createElement("div", { className: 'row m-0 w-100' },
|
113
|
+
React.createElement("div", { className: 'col-12 d-flex align-items-center justify-content-center' },
|
114
|
+
React.createElement("button", { className: 'btn btn-primary w-100', onClick: function () { return setShowQuickPickModal(true); } }, "Quick Selects")),
|
115
|
+
React.createElement(react_interactive_1.Modal, { Show: showQuickPickModal, Title: 'Quick Selects', CallBack: function () { return setShowQuickPickModal(false); }, ShowX: true, ShowCancel: false, ShowConfirm: false, Size: 'xlg' },
|
116
|
+
React.createElement("div", { className: quickSelectCol },
|
117
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit }))))
|
118
|
+
: null));
|
119
|
+
}
|
120
|
+
};
|
121
|
+
exports.default = DateTimeLocalFilter;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { ITimeWindow } from "../TimeFilter";
|
3
|
+
import { DateUnit } from '../QuickSelects';
|
4
|
+
import { Gemstone } from '@gpa-gemstone/application-typings';
|
5
|
+
import { TimeUnit } from '../TimeWindowUtils';
|
6
|
+
export interface IFilterProps {
|
7
|
+
TimeWindowFilter: ITimeWindow;
|
8
|
+
SetTimeWindowFilter: React.Dispatch<React.SetStateAction<ITimeWindow>>;
|
9
|
+
HelpMessage?: string;
|
10
|
+
Format: "YYYY-MM-DD" | "HH:mm:ss.SSS" | "MM/DD/YYYY HH:mm:ss.SSS";
|
11
|
+
DateUnit: DateUnit;
|
12
|
+
Timezone: string;
|
13
|
+
Accuracy?: Gemstone.TSX.Types.Accuracy;
|
14
|
+
ActiveQP: number;
|
15
|
+
SetActiveQP: React.Dispatch<React.SetStateAction<number>>;
|
16
|
+
SetFilter: (start: string, end: string, unit: TimeUnit, duration: number) => void;
|
17
|
+
ShowQuickSelects: boolean;
|
18
|
+
ContainerWidth: number;
|
19
|
+
}
|
20
|
+
declare const StartEndFilter: (props: IFilterProps) => React.JSX.Element;
|
21
|
+
export default StartEndFilter;
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
//******************************************************************************************************
|
3
|
+
// StartEndFilter.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
|
+
// 07/14/2025 - Preston Crawford
|
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 DateTimeLocalFilter_1 = __importDefault(require("./DateTimeLocalFilter"));
|
63
|
+
var TimeFilter_1 = __importDefault(require("./TimeFilter"));
|
64
|
+
var DateFilter_1 = __importDefault(require("./DateFilter"));
|
65
|
+
var StartEndFilter = function (props) {
|
66
|
+
if (props.DateUnit === 'datetime-local')
|
67
|
+
return React.createElement(DateTimeLocalFilter_1.default, __assign({}, props));
|
68
|
+
if (props.DateUnit === 'time')
|
69
|
+
return React.createElement(TimeFilter_1.default, __assign({}, props));
|
70
|
+
if (props.DateUnit === 'date')
|
71
|
+
return React.createElement(DateFilter_1.default, __assign({}, props));
|
72
|
+
return React.createElement(React.Fragment, null);
|
73
|
+
};
|
74
|
+
exports.default = StartEndFilter;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
"use strict";
|
2
|
+
//******************************************************************************************************
|
3
|
+
// TimeFilter.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
|
+
// 07/14/2025 - Preston Crawford
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
48
|
+
};
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
50
|
+
var React = __importStar(require("react"));
|
51
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
52
|
+
var TimeFilter_1 = require("../TimeFilter");
|
53
|
+
var QuickSelects_1 = __importDefault(require("../QuickSelects"));
|
54
|
+
var TimeFilter = function (props) {
|
55
|
+
var FirstFallback_BreakpointQS = 634;
|
56
|
+
var FirstFallback_BreakpointNoQS = 454;
|
57
|
+
var handleSetTimeWindowFilter = React.useCallback(function (record) {
|
58
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)({ start: record.start, end: record.end }, props.Format);
|
59
|
+
props.SetTimeWindowFilter(flt);
|
60
|
+
props.SetActiveQP(-1);
|
61
|
+
}, [props.Format]);
|
62
|
+
var startEndCol = React.useMemo(function () {
|
63
|
+
if (props.ShowQuickSelects) {
|
64
|
+
if (props.ContainerWidth > FirstFallback_BreakpointQS)
|
65
|
+
return 'col-5';
|
66
|
+
return 'col-6';
|
67
|
+
}
|
68
|
+
if (props.ContainerWidth > FirstFallback_BreakpointNoQS)
|
69
|
+
return 'col-6';
|
70
|
+
else
|
71
|
+
return 'col-12';
|
72
|
+
}, [props.ShowQuickSelects, props.DateUnit, props.ContainerWidth]);
|
73
|
+
if (props.ContainerWidth > FirstFallback_BreakpointQS)
|
74
|
+
return (React.createElement("div", { className: 'row m-0' },
|
75
|
+
React.createElement("div", { className: startEndCol },
|
76
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
77
|
+
React.createElement("div", { className: startEndCol },
|
78
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
79
|
+
props.ShowQuickSelects ?
|
80
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit, AddRowContainer: false })
|
81
|
+
: null));
|
82
|
+
else
|
83
|
+
return (React.createElement(React.Fragment, null,
|
84
|
+
React.createElement("div", { className: 'row m-0' },
|
85
|
+
React.createElement("div", { className: startEndCol },
|
86
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "start", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'Start', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
87
|
+
React.createElement("div", { className: startEndCol },
|
88
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: "end", Help: props.HelpMessage, Setter: handleSetTimeWindowFilter, Label: 'End', Type: props.DateUnit, Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy }))),
|
89
|
+
props.ShowQuickSelects ?
|
90
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: 'startEnd', Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit })
|
91
|
+
: null));
|
92
|
+
};
|
93
|
+
exports.default = TimeFilter;
|
@@ -2,27 +2,51 @@ import * as React from 'react';
|
|
2
2
|
import { IStartEnd, IStartDuration, IEndDuration, TimeUnit } from './TimeWindowUtils';
|
3
3
|
import { DateUnit } from './QuickSelects';
|
4
4
|
import { Gemstone } from '@gpa-gemstone/application-typings';
|
5
|
-
interface ITimeWindow {
|
5
|
+
export interface ITimeWindow {
|
6
6
|
start: string;
|
7
7
|
end: string;
|
8
8
|
unit: TimeUnit;
|
9
9
|
duration: number;
|
10
10
|
}
|
11
11
|
export type ITimeFilter = IStartEnd | IStartDuration | IEndDuration;
|
12
|
-
|
13
|
-
* filter: an interface of IStartEnd | IStartDuration | IEndDuration | ICenterDuration
|
14
|
-
* showQuickSelect: displays Quick Select component
|
15
|
-
* isHorizontal: displays Quick Selects in horizontal view
|
16
|
-
*/
|
12
|
+
export type DateTimeSetting = 'startWindow' | 'endWindow' | 'startEnd';
|
17
13
|
interface IProps {
|
14
|
+
/**
|
15
|
+
* Filter to be used in form
|
16
|
+
*/
|
18
17
|
filter: ITimeFilter;
|
18
|
+
/**
|
19
|
+
* Setter function to update filter
|
20
|
+
* @param start - Start Time
|
21
|
+
* @param end - End Time
|
22
|
+
* @param unit - Time Unit
|
23
|
+
* @param duration - Duration
|
24
|
+
* @returns
|
25
|
+
*/
|
19
26
|
setFilter: (start: string, end: string, unit: TimeUnit, duration: number) => void;
|
27
|
+
/**
|
28
|
+
* Flag to toggle QuickSelects UI
|
29
|
+
*/
|
20
30
|
showQuickSelect: boolean;
|
21
|
-
|
31
|
+
/**
|
32
|
+
* Type of TimeFilter to render
|
33
|
+
*/
|
34
|
+
dateTimeSetting: DateTimeSetting;
|
35
|
+
/**
|
36
|
+
* Time zone to use
|
37
|
+
*/
|
22
38
|
timeZone: string;
|
23
|
-
|
39
|
+
/**
|
40
|
+
* Format for date/time input
|
41
|
+
*/
|
24
42
|
format?: DateUnit;
|
43
|
+
/**
|
44
|
+
* Accuracy of the time input
|
45
|
+
*/
|
25
46
|
accuracy?: Gemstone.TSX.Types.Accuracy;
|
47
|
+
/**
|
48
|
+
* Flag to toggle usage of helper message
|
49
|
+
*/
|
26
50
|
showHelpMessage?: boolean;
|
27
51
|
}
|
28
52
|
declare const TimeFilter: (props: IProps) => React.JSX.Element;
|
@@ -51,16 +51,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
52
52
|
exports.getTimeWindowFromFilter = getTimeWindowFromFilter;
|
53
53
|
var React = __importStar(require("react"));
|
54
|
-
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
55
54
|
var TimeWindowUtils_1 = require("./TimeWindowUtils");
|
56
55
|
var moment_1 = __importDefault(require("moment"));
|
57
56
|
var QuickSelects_1 = require("./QuickSelects");
|
58
57
|
var lodash_1 = __importDefault(require("lodash"));
|
58
|
+
var StartEndFilter_1 = __importDefault(require("./StartEndFilter/StartEndFilter"));
|
59
|
+
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
60
|
+
var WindowFilter_1 = __importDefault(require("./WindowFilter/WindowFilter"));
|
59
61
|
var TimeFilter = function (props) {
|
60
62
|
var _a, _b, _c, _d;
|
63
|
+
var containerRef = React.useRef(null);
|
64
|
+
var width = (0, helper_functions_1.useGetContainerPosition)(containerRef).width;
|
61
65
|
var format = (0, QuickSelects_1.getFormat)(props.format);
|
62
|
-
var
|
63
|
-
var _e = React.useState(-1), activeQP = _e[0], setActiveQP = _e[1];
|
66
|
+
var _e = React.useState(-1), activeQuickSelect = _e[0], setActiveQuickSelect = _e[1];
|
64
67
|
var _f = React.useState(getTimeWindowFromFilter(props.filter, format)), filter = _f[0], setFilter = _f[1];
|
65
68
|
// Checks typing of ITimeFilter and then compares to ITimeWindow
|
66
69
|
function isEqual(timeWindow, timeFilter) {
|
@@ -78,118 +81,16 @@ var TimeFilter = function (props) {
|
|
78
81
|
setFilter(flt);
|
79
82
|
}
|
80
83
|
}, [props.filter]);
|
81
|
-
|
84
|
+
var helpMessaage = ((_a = props.showHelpMessage) !== null && _a !== void 0 ? _a : true) ? "All times shown are in system time (".concat(props.timeZone, ").") : undefined;
|
85
|
+
return (React.createElement("fieldset", { className: "border", style: { padding: '10px', height: '100%', overflow: 'hidden' }, ref: containerRef },
|
82
86
|
React.createElement("legend", { className: "w-auto", style: { fontSize: 'large' } }, "Date/Time Filter:"),
|
83
|
-
|
84
|
-
props.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
getTimeWindowFromFilter({ start: r.start, duration: r.duration, unit: r.unit }, format) :
|
90
|
-
getTimeWindowFromFilter({ start: r.start, end: r.end }, format);
|
91
|
-
setFilter(flt);
|
92
|
-
setActiveQP(-1);
|
93
|
-
}, Label: 'Start', Type: (_b = props.format) !== null && _b !== void 0 ? _b : 'datetime-local', Valid: function () { return true; }, Format: format, Accuracy: props.accuracy }),
|
94
|
-
props.showQuickSelect && props.dateTimeSetting === 'startWindow' ?
|
95
|
-
React.createElement(StartWindowForm, { IsHorizontal: props.isHorizontal, Filter: filter, SetFilter: setFilter, SetActiveQP: setActiveQP, Format: format, ShowQuickSelect: props.showQuickSelect })
|
96
|
-
: null))
|
97
|
-
: null,
|
98
|
-
props.dateTimeSetting === 'endWindow' || props.dateTimeSetting === 'startEnd' ?
|
99
|
-
React.createElement(Row, { addRow: !props.isHorizontal, class: 'm-0' },
|
100
|
-
React.createElement("div", { className: props.isHorizontal ? (props.showQuickSelect ? props.dateTimeSetting === 'startEnd' ? 'col-2' : 'col-4' : 'col-6') : 'col-12 p-0' },
|
101
|
-
React.createElement(react_forms_1.DatePicker, { Record: filter, Field: "end", Help: ((_c = props.showHelpMessage) !== null && _c !== void 0 ? _c : true) ? "All times shown are in system time (".concat(props.timeZone, ").") : undefined, Setter: function (r) {
|
102
|
-
var flt = props.dateTimeSetting === 'endWindow' ?
|
103
|
-
getTimeWindowFromFilter({ end: r.end, duration: r.duration, unit: r.unit }, format) :
|
104
|
-
getTimeWindowFromFilter({ start: r.start, end: r.end }, format);
|
105
|
-
setFilter(flt);
|
106
|
-
setActiveQP(-1);
|
107
|
-
}, Label: 'End', Type: (_d = props.format) !== null && _d !== void 0 ? _d : 'datetime-local', Valid: function () { return true; }, Format: format, Accuracy: props.accuracy }),
|
108
|
-
props.showQuickSelect && props.dateTimeSetting === 'endWindow' ?
|
109
|
-
React.createElement(EndWindowForm, { IsHorizontal: props.isHorizontal, Filter: filter, SetFilter: setFilter, SetActiveQP: setActiveQP, Format: format, ShowQuickSelect: props.showQuickSelect })
|
110
|
-
: null))
|
111
|
-
: null,
|
112
|
-
props.dateTimeSetting === 'startWindow' && !props.showQuickSelect ?
|
113
|
-
React.createElement(StartWindowForm, { IsHorizontal: props.isHorizontal, Filter: filter, SetFilter: setFilter, SetActiveQP: setActiveQP, Format: format, ShowQuickSelect: props.showQuickSelect })
|
114
|
-
: null,
|
115
|
-
props.dateTimeSetting === 'endWindow' && !props.showQuickSelect ?
|
116
|
-
React.createElement(EndWindowForm, { IsHorizontal: props.isHorizontal, Filter: filter, SetFilter: setFilter, SetActiveQP: setActiveQP, Format: format, ShowQuickSelect: props.showQuickSelect })
|
117
|
-
: null,
|
118
|
-
props.showQuickSelect ?
|
119
|
-
React.createElement("div", { className: props.isHorizontal ? "col-8 ".concat(props.dateTimeSetting !== 'startEnd' ? 'pt-3' : '') : 'row m-0 flex-grow-1' },
|
120
|
-
React.createElement(Row, { addRow: props.isHorizontal, class: "m-0 justify-content-center align-items-center" }, QuickSelects.map(function (qs, i) {
|
121
|
-
if (i % 3 !== 0)
|
122
|
-
return null;
|
123
|
-
return (React.createElement("div", { key: i, className: props.isHorizontal && props.dateTimeSetting === 'startEnd' ? 'col-2' : "col-4", style: {
|
124
|
-
paddingLeft: (props.isHorizontal && props.dateTimeSetting === 'startEnd' ? 0 : (i % 9 == 0 ? 15 : 0)),
|
125
|
-
paddingRight: (props.isHorizontal && props.dateTimeSetting === 'startEnd' ? 2 : ((i % 18 == 6 || i % 18 == 15) ? 15 : 2)),
|
126
|
-
marginTop: 10
|
127
|
-
} },
|
128
|
-
React.createElement("ul", { className: "list-group", key: i },
|
129
|
-
React.createElement("li", { key: i, style: { cursor: 'pointer' }, onClick: function () {
|
130
|
-
var flt = getTimeWindowFromFilter(QuickSelects[i].createFilter(props.timeZone, props.format), format);
|
131
|
-
props.setFilter(flt.start, flt.end, flt.unit, flt.duration);
|
132
|
-
setActiveQP(i);
|
133
|
-
}, className: "item badge badge-" + (i == activeQP ? "primary" : "secondary") }, QuickSelects[i].label),
|
134
|
-
i + 1 < QuickSelects.length ?
|
135
|
-
React.createElement("li", { key: i + 1, style: { marginTop: 3, cursor: 'pointer' }, className: "item badge badge-" + (i + 1 == activeQP ? "primary" : "secondary"), onClick: function () {
|
136
|
-
var flt = getTimeWindowFromFilter(QuickSelects[i + 1].createFilter(props.timeZone, props.format), format);
|
137
|
-
props.setFilter(flt.start, flt.end, flt.unit, flt.duration);
|
138
|
-
setActiveQP(i + 1);
|
139
|
-
} }, QuickSelects[i + 1].label)
|
140
|
-
: null,
|
141
|
-
i + 2 < QuickSelects.length ?
|
142
|
-
React.createElement("li", { key: i + 2, style: { marginTop: 3, cursor: 'pointer' }, className: "item badge badge-" + (i + 2 == activeQP ? "primary" : "secondary"), onClick: function () {
|
143
|
-
var flt = getTimeWindowFromFilter(QuickSelects[i + 2].createFilter(props.timeZone, props.format), format);
|
144
|
-
props.setFilter(flt.start, flt.end, flt.unit, flt.duration);
|
145
|
-
setActiveQP(i + 2);
|
146
|
-
} }, QuickSelects[i + 2].label)
|
147
|
-
: null)));
|
148
|
-
})))
|
149
|
-
: null)));
|
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' })));
|
150
93
|
};
|
151
|
-
var StartWindowForm = function (props) {
|
152
|
-
return (React.createElement(Row, { addRow: !props.IsHorizontal, class: 'm-0' },
|
153
|
-
React.createElement("div", { className: props.IsHorizontal ? props.ShowQuickSelect ? 'col-12 p-0' : 'col-6' : 'col-12 p-0' },
|
154
|
-
React.createElement("div", { className: 'form-group' },
|
155
|
-
React.createElement("label", { style: { width: '100%', position: 'relative', float: "left" } }, "Span(+)"),
|
156
|
-
React.createElement("div", { className: 'row' },
|
157
|
-
React.createElement("div", { className: 'col-6' },
|
158
|
-
React.createElement(react_forms_1.Input, { Record: props.Filter, Field: 'duration', Label: '', Valid: function () { return true; }, Type: 'number', Setter: function (r) {
|
159
|
-
props.SetFilter(getTimeWindowFromFilter({ start: r.start, duration: r.duration, unit: r.unit }, props.Format));
|
160
|
-
props.SetActiveQP(-1);
|
161
|
-
} })),
|
162
|
-
React.createElement("div", { className: 'col-6' },
|
163
|
-
React.createElement(react_forms_1.Select, { Record: props.Filter, Label: '', Field: 'unit', Options: TimeWindowUtils_1.units.map(function (unit) { return ({ Value: unit, Label: (0, TimeWindowUtils_1.readableUnit)(unit) }); }), Setter: function (r) {
|
164
|
-
props.SetFilter(getTimeWindowFromFilter({ start: r.start, duration: r.duration, unit: r.unit }, props.Format));
|
165
|
-
props.SetActiveQP(-1);
|
166
|
-
} })))))));
|
167
|
-
};
|
168
|
-
var EndWindowForm = function (props) {
|
169
|
-
return (React.createElement(Row, { addRow: !props.IsHorizontal, class: 'm-0' },
|
170
|
-
React.createElement("div", { className: props.IsHorizontal ? props.ShowQuickSelect ? 'col-12 p-0' : 'col-6' : 'col-12 p-0' },
|
171
|
-
React.createElement("div", { className: 'form-group' },
|
172
|
-
React.createElement("label", { style: { width: '100%', position: 'relative', float: "left" } }, "Span(-)"),
|
173
|
-
React.createElement("div", { className: 'row' },
|
174
|
-
React.createElement("div", { className: 'col-6' },
|
175
|
-
React.createElement(react_forms_1.Input, { Record: props.Filter, Field: 'duration', Label: '', Valid: function () { return true; }, Type: 'number', Setter: function (r) {
|
176
|
-
props.SetFilter(getTimeWindowFromFilter({ end: r.end, duration: r.duration, unit: r.unit }, props.Format));
|
177
|
-
props.SetActiveQP(-1);
|
178
|
-
} })),
|
179
|
-
React.createElement("div", { className: 'col-6' },
|
180
|
-
React.createElement(react_forms_1.Select, { Record: props.Filter, Label: '', Field: 'unit', Options: TimeWindowUtils_1.units.map(function (unit) { return ({ Value: unit, Label: (0, TimeWindowUtils_1.readableUnit)(unit) }); }), Setter: function (r) {
|
181
|
-
props.SetFilter(getTimeWindowFromFilter({ end: r.end, duration: r.duration, unit: r.unit }, props.Format));
|
182
|
-
props.SetActiveQP(-1);
|
183
|
-
} })))))));
|
184
|
-
};
|
185
|
-
// Returns a row div element with props as children of row
|
186
|
-
function Row(props) {
|
187
|
-
var _a;
|
188
|
-
if (props.addRow) {
|
189
|
-
return React.createElement("div", { className: "row ".concat((_a = props.class) !== null && _a !== void 0 ? _a : '') }, props.children);
|
190
|
-
}
|
191
|
-
return React.createElement(React.Fragment, null, props.children);
|
192
|
-
}
|
193
94
|
// Converts ITimeFilter to an ITimeWindow filter
|
194
95
|
function getTimeWindowFromFilter(flt, format) {
|
195
96
|
var start;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { IFilterProps } from '../StartEndFilter/StartEndFilter';
|
3
|
+
import { Window } from './WindowForm';
|
4
|
+
export interface IProps extends IFilterProps {
|
5
|
+
Window: Window;
|
6
|
+
}
|
7
|
+
declare const WindowFilter: (props: IProps) => React.JSX.Element;
|
8
|
+
export default WindowFilter;
|
@@ -0,0 +1,111 @@
|
|
1
|
+
"use strict";
|
2
|
+
//******************************************************************************************************
|
3
|
+
// TimeWindowFilter.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
|
+
// 07/14/2025 - Preston Crawford
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
48
|
+
};
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
50
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
51
|
+
var React = __importStar(require("react"));
|
52
|
+
var TimeFilter_1 = require("../TimeFilter");
|
53
|
+
var QuickSelects_1 = __importDefault(require("../QuickSelects"));
|
54
|
+
var WindowForm_1 = __importDefault(require("./WindowForm"));
|
55
|
+
var WINDOW_FirstFallbackBreakpoint = 898;
|
56
|
+
var WINDOW_SecondFallbackBreakpoint = 611;
|
57
|
+
var WindowFilter = function (props) {
|
58
|
+
var _a, _b, _c, _d;
|
59
|
+
var DatePickerField = props.Window;
|
60
|
+
var DatePickerLabel = props.Window.charAt(0).toUpperCase() + props.Window.slice(1);
|
61
|
+
var filterType = props.Window === 'start' ? 'startWindow' : 'endWindow';
|
62
|
+
var setter = React.useCallback(function (record) {
|
63
|
+
if (props.Window === 'start') {
|
64
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)({ start: record.start, duration: record.duration, unit: record.unit }, props.Format);
|
65
|
+
props.SetTimeWindowFilter(flt);
|
66
|
+
props.SetActiveQP(-1);
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
var flt = (0, TimeFilter_1.getTimeWindowFromFilter)({ end: record.end, duration: record.duration, unit: record.unit }, props.Format);
|
70
|
+
props.SetTimeWindowFilter(flt);
|
71
|
+
props.SetActiveQP(-1);
|
72
|
+
}
|
73
|
+
}, [props.Window, props.SetTimeWindowFilter, props.SetActiveQP, props.Format]);
|
74
|
+
if (!props.ShowQuickSelects) {
|
75
|
+
return (React.createElement("div", { className: 'row m-0' },
|
76
|
+
React.createElement("div", { className: 'col-12' },
|
77
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: DatePickerField, Help: props.HelpMessage, Setter: setter, Label: DatePickerLabel, Type: (_a = props.DateUnit) !== null && _a !== void 0 ? _a : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy }),
|
78
|
+
React.createElement(WindowForm_1.default, { Filter: props.TimeWindowFilter, SetFilter: props.SetTimeWindowFilter, SetActiveQP: props.SetActiveQP, Format: props.Format, ShowQuickSelect: props.ShowQuickSelects, Window: props.Window }))));
|
79
|
+
}
|
80
|
+
else if (props.ContainerWidth > WINDOW_FirstFallbackBreakpoint)
|
81
|
+
return (React.createElement("div", { className: 'row m-0' },
|
82
|
+
React.createElement("div", { className: 'col-4' },
|
83
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: DatePickerField, Help: props.HelpMessage, Setter: setter, Label: DatePickerLabel, Type: (_b = props.DateUnit) !== null && _b !== void 0 ? _b : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy }),
|
84
|
+
React.createElement(WindowForm_1.default, { Filter: props.TimeWindowFilter, SetFilter: props.SetTimeWindowFilter, SetActiveQP: props.SetActiveQP, Format: props.Format, ShowQuickSelect: props.ShowQuickSelects, Window: props.Window })),
|
85
|
+
React.createElement("div", { className: 'col-8 pt-3' },
|
86
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: filterType, Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit }))));
|
87
|
+
else if (props.ContainerWidth > WINDOW_SecondFallbackBreakpoint) {
|
88
|
+
return (React.createElement(React.Fragment, null,
|
89
|
+
React.createElement("div", { className: 'row m-0' },
|
90
|
+
React.createElement("div", { className: 'col-6' },
|
91
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: DatePickerField, Help: props.HelpMessage, Setter: setter, Label: DatePickerLabel, Type: (_c = props.DateUnit) !== null && _c !== void 0 ? _c : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy })),
|
92
|
+
React.createElement("div", { className: 'col-6' },
|
93
|
+
React.createElement(WindowForm_1.default, { Filter: props.TimeWindowFilter, SetFilter: props.SetTimeWindowFilter, SetActiveQP: props.SetActiveQP, Format: props.Format, ShowQuickSelect: props.ShowQuickSelects, Window: props.Window }))),
|
94
|
+
React.createElement("div", { className: 'row m-0' },
|
95
|
+
React.createElement("div", { className: 'col-12' },
|
96
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: filterType, Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit })))));
|
97
|
+
}
|
98
|
+
else {
|
99
|
+
return (React.createElement(React.Fragment, null,
|
100
|
+
React.createElement("div", { className: 'row m-0' },
|
101
|
+
React.createElement("div", { className: 'col-12' },
|
102
|
+
React.createElement(react_forms_1.DatePicker, { Record: props.TimeWindowFilter, Field: DatePickerField, Help: props.HelpMessage, Setter: setter, Label: DatePickerLabel, Type: (_d = props.DateUnit) !== null && _d !== void 0 ? _d : 'datetime-local', Valid: function () { return true; }, Format: props.Format, Accuracy: props.Accuracy }))),
|
103
|
+
React.createElement("div", { className: 'row m-0' },
|
104
|
+
React.createElement("div", { className: 'col-12' },
|
105
|
+
React.createElement(WindowForm_1.default, { Filter: props.TimeWindowFilter, SetFilter: props.SetTimeWindowFilter, SetActiveQP: props.SetActiveQP, Format: props.Format, ShowQuickSelect: props.ShowQuickSelects, Window: props.Window }))),
|
106
|
+
React.createElement("div", { className: 'row m-0' },
|
107
|
+
React.createElement("div", { className: 'col-12' },
|
108
|
+
React.createElement(QuickSelects_1.default, { DateTimeSetting: filterType, Timezone: props.Timezone, ActiveQP: props.ActiveQP, SetActiveQP: props.SetActiveQP, SetFilter: props.SetFilter, Format: props.Format, DateUnit: props.DateUnit })))));
|
109
|
+
}
|
110
|
+
};
|
111
|
+
exports.default = WindowFilter;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { ITimeWindow } from '../TimeFilter';
|
3
|
+
export type Window = "start" | "end";
|
4
|
+
export interface IProps {
|
5
|
+
Filter: ITimeWindow;
|
6
|
+
SetFilter: (filter: ITimeWindow) => void;
|
7
|
+
SetActiveQP: (qp: number) => void;
|
8
|
+
Format: string;
|
9
|
+
ShowQuickSelect: boolean;
|
10
|
+
Window: Window;
|
11
|
+
}
|
12
|
+
declare const WindowForm: (props: IProps) => React.JSX.Element;
|
13
|
+
export default WindowForm;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
//******************************************************************************************************
|
3
|
+
// WindowForm.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
|
+
// 07/14/2025 - Preston Crawford
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
47
|
+
var react_forms_1 = require("@gpa-gemstone/react-forms");
|
48
|
+
var React = __importStar(require("react"));
|
49
|
+
var TimeFilter_1 = require("../TimeFilter");
|
50
|
+
var TimeWindowUtils_1 = require("../TimeWindowUtils");
|
51
|
+
var WindowForm = function (props) {
|
52
|
+
var setter = React.useCallback(function (record) {
|
53
|
+
if (props.Window === 'start') {
|
54
|
+
props.SetFilter((0, TimeFilter_1.getTimeWindowFromFilter)({ start: record.start, duration: record.duration, unit: record.unit }, props.Format));
|
55
|
+
props.SetActiveQP(-1);
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
props.SetFilter((0, TimeFilter_1.getTimeWindowFromFilter)({ end: record.end, duration: record.duration, unit: record.unit }, props.Format));
|
59
|
+
props.SetActiveQP(-1);
|
60
|
+
}
|
61
|
+
}, [props.Window, props.Format, props.SetActiveQP, props.SetActiveQP]);
|
62
|
+
return (React.createElement("div", { className: 'form-group' },
|
63
|
+
React.createElement("label", { style: { width: '100%', position: 'relative', float: "left" } },
|
64
|
+
"Span(",
|
65
|
+
props.Window === 'start' ? '+' : '-',
|
66
|
+
")"),
|
67
|
+
React.createElement("div", { className: 'row' },
|
68
|
+
React.createElement("div", { className: 'col-6' },
|
69
|
+
React.createElement(react_forms_1.Input, { Record: props.Filter, Field: 'duration', Label: '', Valid: function () { return true; }, Type: 'number', Setter: setter })),
|
70
|
+
React.createElement("div", { className: 'col-6' },
|
71
|
+
React.createElement(react_forms_1.Select, { Record: props.Filter, Label: '', Field: 'unit', Options: TimeWindowUtils_1.units.map(function (unit) { return ({ Value: unit, Label: (0, TimeWindowUtils_1.readableUnit)(unit) }); }), Setter: setter })))));
|
72
|
+
};
|
73
|
+
exports.default = WindowForm;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gpa-gemstone/common-pages",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.148",
|
4
4
|
"description": "Common UI pages for GPA products",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "lib/index.d.ts",
|
@@ -47,9 +47,9 @@
|
|
47
47
|
"@gpa-gemstone/application-typings": "0.0.87",
|
48
48
|
"@gpa-gemstone/gpa-symbols": "0.0.53",
|
49
49
|
"@gpa-gemstone/helper-functions": "0.0.45",
|
50
|
-
"@gpa-gemstone/react-forms": "1.1.
|
51
|
-
"@gpa-gemstone/react-interactive": "1.0.
|
52
|
-
"@gpa-gemstone/react-table": "1.2.
|
50
|
+
"@gpa-gemstone/react-forms": "1.1.97",
|
51
|
+
"@gpa-gemstone/react-interactive": "1.0.159",
|
52
|
+
"@gpa-gemstone/react-table": "1.2.82",
|
53
53
|
"@reduxjs/toolkit": "1.8.3",
|
54
54
|
"crypto-js": "^4.2.0",
|
55
55
|
"moment": "^2.29.4",
|