@opengeoweb/shared 9.4.1 → 9.6.0
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/index.esm.js +168 -1036
- package/package.json +17 -1
- package/src/lib/components/LastUpdateTime/LastUpdateTime.d.ts +10 -0
- package/src/lib/components/LastUpdateTime/LastUpdateTime.spec.d.ts +1 -0
- package/src/lib/components/LastUpdateTime/LastUpdateTime.stories.d.ts +13 -0
- package/src/lib/components/LastUpdateTime/index.d.ts +1 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/utils/dateUtils/dateUtils.d.ts +18 -3
- package/src/lib/utils/index.d.ts +1 -0
- package/src/lib/utils/renderCounter.d.ts +21 -0
- package/src/lib/utils/renderCounter.spec.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@mui/material": "5.12.0",
|
|
12
|
+
"@opengeoweb/theme": "*",
|
|
13
|
+
"react-draggable": "^4.4.6",
|
|
14
|
+
"re-resizable": "^6.9.11",
|
|
15
|
+
"lodash": "^4.17.21",
|
|
16
|
+
"@redux-eggs/core": "^2.2.0",
|
|
17
|
+
"react-redux": "^8.1.3",
|
|
18
|
+
"axios": "1.5.0",
|
|
19
|
+
"date-fns": "^3.3.0",
|
|
20
|
+
"redux-mock-store": "^1.5.4",
|
|
21
|
+
"@reduxjs/toolkit": "^1.9.7"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": "18"
|
|
25
|
+
},
|
|
10
26
|
"module": "./index.esm.js",
|
|
11
27
|
"type": "module",
|
|
12
28
|
"main": "./index.esm.js"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const BUTTON_TITLE = "Click to refresh";
|
|
3
|
+
export declare const getLastUpdateTitle: (time: string) => string;
|
|
4
|
+
interface LastUpdateTimeProps {
|
|
5
|
+
onPressRefresh: () => void;
|
|
6
|
+
lastUpdateTime?: string;
|
|
7
|
+
dataTestId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const LastUpdateTime: React.FC<LastUpdateTimeProps>;
|
|
10
|
+
export default LastUpdateTime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const LastUpdateTimeLightTheme: {
|
|
7
|
+
(): React.ReactElement;
|
|
8
|
+
storyName: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const LastUpdateTimeDarkTheme: {
|
|
11
|
+
(): React.ReactElement;
|
|
12
|
+
storyName: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LastUpdateTime, getLastUpdateTitle, BUTTON_TITLE, } from './LastUpdateTime';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isEqual, Duration } from 'date-fns';
|
|
1
2
|
export interface DateValues {
|
|
2
3
|
year?: number;
|
|
3
4
|
month?: number;
|
|
@@ -170,7 +171,7 @@ export declare const differenceInMinutes: (dateLeft: Date | number, dateRight: D
|
|
|
170
171
|
* @param dateRight - the earlier date
|
|
171
172
|
* @returns {number} the number of hours
|
|
172
173
|
*/
|
|
173
|
-
export declare const differenceInHours: (dateLeft: Date | number, dateRight: Date | number) => number;
|
|
174
|
+
export declare const differenceInHours: (dateLeft: Date | number, dateRight: Date | number, roundingMethod?: 'ceil' | 'floor' | 'round' | 'trunc') => number;
|
|
174
175
|
/**
|
|
175
176
|
*
|
|
176
177
|
* @param date - the date that should be before the other one to return true
|
|
@@ -206,9 +207,23 @@ export declare const isValid: (date: Date) => boolean;
|
|
|
206
207
|
*/
|
|
207
208
|
export declare const unix: (date: Date | number) => number;
|
|
208
209
|
/**
|
|
209
|
-
*
|
|
210
|
+
* Return the Date object for a given timestamp
|
|
211
|
+
* @param {number} unixTime - timestamp
|
|
212
|
+
* @returns the timestamp
|
|
213
|
+
*/
|
|
214
|
+
export declare const fromUnix: (unixTime: number) => Date;
|
|
215
|
+
/**
|
|
216
|
+
* Set date values to a given date (by default it is assumed you are passing the new values in UTC).
|
|
210
217
|
* @param date - the dater to be changed
|
|
211
218
|
* @param values - an object with options
|
|
219
|
+
* @param useLocalTimeZone - boolean true if you are passing the values in local timezone
|
|
212
220
|
* @returns the new date with options set
|
|
213
221
|
*/
|
|
214
|
-
export declare const set: (date: Date
|
|
222
|
+
export declare const set: (date: Date, values: DateValues, useLocalTimeZone?: boolean) => Date;
|
|
223
|
+
/**
|
|
224
|
+
* Compares two dates if values are the same
|
|
225
|
+
* @param {Date} date - first date
|
|
226
|
+
* @param {Date} date - second date
|
|
227
|
+
* @returns {boolean} - True if dates are equal
|
|
228
|
+
*/
|
|
229
|
+
export { isEqual };
|
package/src/lib/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to keep track of number of renders by a react component
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* 1) reset all counters to zero by:
|
|
6
|
+
* renderCounter.reset()
|
|
7
|
+
* 2) in the render function of the functional component do:
|
|
8
|
+
* renderCounter.count(<your react functional component>.name);
|
|
9
|
+
* 3) in the test do:
|
|
10
|
+
* expect(renderCounter.get(<your react functional component>.name)).toBe(1);
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
declare class RenderCounter {
|
|
14
|
+
private numRenders;
|
|
15
|
+
constructor();
|
|
16
|
+
reset(): void;
|
|
17
|
+
count(id: string): void;
|
|
18
|
+
get(id: string): number;
|
|
19
|
+
}
|
|
20
|
+
export declare const renderCounter: RenderCounter;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|