@trackunit/react-core-contexts-api 1.5.0 → 1.5.2
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/package.json +4 -4
- package/src/timeRangeContext.d.ts +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts-api",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"jest-fetch-mock": "^3.0.3",
|
|
11
|
-
"@trackunit/shared-utils": "1.6.
|
|
12
|
-
"@trackunit/geo-json-utils": "1.4.
|
|
13
|
-
"@trackunit/react-test-setup": "1.1.
|
|
11
|
+
"@trackunit/shared-utils": "1.6.1",
|
|
12
|
+
"@trackunit/geo-json-utils": "1.4.1",
|
|
13
|
+
"@trackunit/react-test-setup": "1.1.1"
|
|
14
14
|
},
|
|
15
15
|
"module": "./index.esm.js",
|
|
16
16
|
"main": "./index.cjs.js",
|
|
@@ -2,11 +2,33 @@ export type TimeRange = {
|
|
|
2
2
|
startMsInEpoch: number;
|
|
3
3
|
endMsInEpoch: number;
|
|
4
4
|
};
|
|
5
|
+
export type TemporalUnit = "day" | "days" | "week" | "weeks" | "month" | "months";
|
|
6
|
+
export type TemporalDirection = "next" | "last";
|
|
7
|
+
export type TemporalPeriod = {
|
|
8
|
+
direction: TemporalDirection;
|
|
9
|
+
count: number;
|
|
10
|
+
unit: TemporalUnit;
|
|
11
|
+
};
|
|
12
|
+
export type SelectedTimeRange = {
|
|
13
|
+
timeRange: TimeRange | null;
|
|
14
|
+
temporalPeriod: TemporalPeriod | null;
|
|
15
|
+
};
|
|
5
16
|
export interface TimeRangeContext {
|
|
6
17
|
/**
|
|
7
18
|
* Gets the current time range.
|
|
19
|
+
* This is the time range that is currently selected.
|
|
20
|
+
* If the user has selected a temporal period, this will be the start and end of the temporal period.
|
|
21
|
+
* If the user has selected a custom time range, this will be the start and end of the custom time range.
|
|
8
22
|
*
|
|
9
23
|
* @returns the current time range
|
|
10
24
|
*/
|
|
11
25
|
timeRange: TimeRange | null;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the current temporal period.
|
|
28
|
+
* This is only if the user has selected a temporal period.
|
|
29
|
+
* If the user has selected a custom time range, this will be null.
|
|
30
|
+
*
|
|
31
|
+
* @returns the current temporal period
|
|
32
|
+
*/
|
|
33
|
+
temporalPeriod: TemporalPeriod | null;
|
|
12
34
|
}
|