@truedat/core 4.53.8 → 4.53.10
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/CHANGELOG.md +6 -0
- package/package.json +4 -4
- package/src/components/CursorPagination.js +70 -0
- package/src/components/DateTime.js +2 -1
- package/src/components/__tests__/CursorPagination.spec.js +16 -0
- package/src/components/__tests__/__snapshots__/CursorPagination.spec.js.snap +32 -0
- package/src/components/index.js +2 -0
- package/src/routes.js +3 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "4.53.
|
|
3
|
+
"version": "4.53.10",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@testing-library/jest-dom": "^5.16.4",
|
|
36
36
|
"@testing-library/react": "^12.0.0",
|
|
37
37
|
"@testing-library/user-event": "^13.2.1",
|
|
38
|
-
"@truedat/test": "4.53.
|
|
38
|
+
"@truedat/test": "4.53.10",
|
|
39
39
|
"babel-jest": "^28.1.0",
|
|
40
40
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
41
41
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@apollo/client": "^3.
|
|
91
|
+
"@apollo/client": "^3.7.0",
|
|
92
92
|
"axios": "^0.27.2",
|
|
93
93
|
"immutable": "^4.0.0-rc.12",
|
|
94
94
|
"is-hotkey": "^0.1.6",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"react-dom": ">= 16.8.6 < 17",
|
|
113
113
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "66304ff9ac3d25820b3bec2d0147f21cb0a2c579"
|
|
116
116
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import queryString from "query-string";
|
|
5
|
+
import { useLocation, Link } from "react-router-dom";
|
|
6
|
+
import { Menu } from "semantic-ui-react";
|
|
7
|
+
|
|
8
|
+
export const CursorPagination = ({ pageInfo }) => {
|
|
9
|
+
const { search, ...location } = useLocation();
|
|
10
|
+
const { endCursor, startCursor, hasPreviousPage, hasNextPage } =
|
|
11
|
+
pageInfo || {};
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line no-unused-vars
|
|
14
|
+
const { after, before, ...rest } = queryString.parse(search);
|
|
15
|
+
const next =
|
|
16
|
+
hasNextPage && endCursor
|
|
17
|
+
? {
|
|
18
|
+
...location,
|
|
19
|
+
search: "?" + queryString.stringify({ ...rest, after: endCursor }),
|
|
20
|
+
}
|
|
21
|
+
: null;
|
|
22
|
+
const prev =
|
|
23
|
+
hasPreviousPage && startCursor
|
|
24
|
+
? {
|
|
25
|
+
...location,
|
|
26
|
+
search: "?" + queryString.stringify({ ...rest, before: startCursor }),
|
|
27
|
+
}
|
|
28
|
+
: null;
|
|
29
|
+
const latest = {
|
|
30
|
+
...location,
|
|
31
|
+
search: _.isEmpty(rest) ? null : "?" + queryString.stringify(rest),
|
|
32
|
+
};
|
|
33
|
+
return (
|
|
34
|
+
<Menu pagination role="navigation">
|
|
35
|
+
<Menu.Item
|
|
36
|
+
as={next ? Link : null}
|
|
37
|
+
link={!!next}
|
|
38
|
+
content="«"
|
|
39
|
+
disabled={!hasNextPage}
|
|
40
|
+
to={next ? latest : null}
|
|
41
|
+
replace={next ? true : null}
|
|
42
|
+
aria-label="Latest"
|
|
43
|
+
/>
|
|
44
|
+
<Menu.Item
|
|
45
|
+
as={next ? Link : null}
|
|
46
|
+
link={!!next}
|
|
47
|
+
content="⟨"
|
|
48
|
+
disabled={!hasNextPage}
|
|
49
|
+
to={next}
|
|
50
|
+
replace={next ? true : null}
|
|
51
|
+
aria-label="Later"
|
|
52
|
+
/>
|
|
53
|
+
<Menu.Item
|
|
54
|
+
as={prev ? Link : null}
|
|
55
|
+
link={!!prev}
|
|
56
|
+
content="⟩"
|
|
57
|
+
disabled={!hasPreviousPage}
|
|
58
|
+
to={prev}
|
|
59
|
+
replace={prev ? true : null}
|
|
60
|
+
aria-label="Earlier"
|
|
61
|
+
/>
|
|
62
|
+
</Menu>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
CursorPagination.propTypes = {
|
|
67
|
+
pageInfo: PropTypes.object,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default CursorPagination;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import Moment from "react-moment";
|
|
4
4
|
|
|
5
|
-
export const DateTime = ({ value, className }) =>
|
|
5
|
+
export const DateTime = ({ value, className, locale }) =>
|
|
6
6
|
value ? (
|
|
7
7
|
<Moment className={className} date={value} format="YYYY-MM-DD HH:mm" />
|
|
8
8
|
) : null;
|
|
@@ -10,6 +10,7 @@ export const DateTime = ({ value, className }) =>
|
|
|
10
10
|
DateTime.propTypes = {
|
|
11
11
|
value: PropTypes.string,
|
|
12
12
|
className: PropTypes.string,
|
|
13
|
+
locale: PropTypes.string,
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export default DateTime;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import CursorPagination from "../CursorPagination";
|
|
4
|
+
|
|
5
|
+
describe("<CursorPagination />", () => {
|
|
6
|
+
it("matches latest snapshot", () => {
|
|
7
|
+
const pageInfo = {
|
|
8
|
+
startCursor: "FOO",
|
|
9
|
+
endCursor: "BAR",
|
|
10
|
+
hasNextPage: true,
|
|
11
|
+
hasPreviousPage: true,
|
|
12
|
+
};
|
|
13
|
+
const { container } = render(<CursorPagination pageInfo={pageInfo} />);
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<CursorPagination /> matches latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui pagination menu"
|
|
7
|
+
role="navigation"
|
|
8
|
+
>
|
|
9
|
+
<a
|
|
10
|
+
aria-label="Latest"
|
|
11
|
+
class="link item"
|
|
12
|
+
href="/"
|
|
13
|
+
>
|
|
14
|
+
«
|
|
15
|
+
</a>
|
|
16
|
+
<a
|
|
17
|
+
aria-label="Later"
|
|
18
|
+
class="link item"
|
|
19
|
+
href="/?after=BAR"
|
|
20
|
+
>
|
|
21
|
+
⟨
|
|
22
|
+
</a>
|
|
23
|
+
<a
|
|
24
|
+
aria-label="Earlier"
|
|
25
|
+
class="link item"
|
|
26
|
+
href="/?before=FOO"
|
|
27
|
+
>
|
|
28
|
+
⟩
|
|
29
|
+
</a>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
package/src/components/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import CatalogMenu from "./CatalogMenu";
|
|
|
9
9
|
import Comments from "./Comments";
|
|
10
10
|
import CommentsLoader from "./CommentsLoader";
|
|
11
11
|
import ConfirmModal from "./ConfirmModal";
|
|
12
|
+
import CursorPagination from "./CursorPagination";
|
|
12
13
|
import DashboardMenu from "./DashboardMenu";
|
|
13
14
|
import Date from "./Date";
|
|
14
15
|
import DateFilter from "./DateFilter";
|
|
@@ -58,6 +59,7 @@ export {
|
|
|
58
59
|
Comments,
|
|
59
60
|
CommentsLoader,
|
|
60
61
|
ConfirmModal,
|
|
62
|
+
CursorPagination,
|
|
61
63
|
DashboardMenu,
|
|
62
64
|
Date,
|
|
63
65
|
DateFilter,
|
package/src/routes.js
CHANGED
|
@@ -67,6 +67,8 @@ export const IMPLEMENTATION_CONCEPT_LINKS_NEW =
|
|
|
67
67
|
export const IMPLEMENTATION_EDIT = "/implementations/:implementation_id/edit";
|
|
68
68
|
export const IMPLEMENTATION_EVENTS =
|
|
69
69
|
"/implementations/:implementation_id/events";
|
|
70
|
+
export const IMPLEMENTATION_EXECUTIONS =
|
|
71
|
+
"/implementations/:implementation_id/executions";
|
|
70
72
|
export const IMPLEMENTATION_HISTORY =
|
|
71
73
|
"/implementations/:implementation_id/history";
|
|
72
74
|
export const IMPLEMENTATION_MOVE = "/implementations/:implementation_id/move";
|
|
@@ -250,6 +252,7 @@ const routes = {
|
|
|
250
252
|
IMPLEMENTATION_CONCEPT_LINKS_NEW,
|
|
251
253
|
IMPLEMENTATION_EDIT,
|
|
252
254
|
IMPLEMENTATION_EVENTS,
|
|
255
|
+
IMPLEMENTATION_EXECUTIONS,
|
|
253
256
|
IMPLEMENTATION_HISTORY,
|
|
254
257
|
IMPLEMENTATION_MOVE,
|
|
255
258
|
IMPLEMENTATION_NEW,
|