@truedat/core 4.53.9 → 4.53.11

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.53.11] 2022-10-20
4
+
5
+ ### Changed
6
+
7
+ - [TD-5234] Route `/structures/:id/rules_implementations` changed to
8
+ `/structures/:id/rules`
9
+
10
+ ## [4.53.10] 2022-10-17
11
+
12
+ ### Added
13
+
14
+ - [TD-4177] `CursorPagination` component for paginating GraphQL connections
15
+
3
16
  ## [4.53.8] 2022-10-17
4
17
 
5
18
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.53.9",
3
+ "version": "4.53.11",
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.9",
38
+ "@truedat/test": "4.53.11",
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.6.4",
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": "cfb29ec044aeb972df15ad73f30cf7fb06e2a54b"
115
+ "gitHead": "f0bff07f7491edcbe2195f2ff9d0ef74736edef9"
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
+ `;
@@ -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";
@@ -166,8 +168,7 @@ export const STRUCTURE_NOTES = "/structures/:id/notes";
166
168
  export const STRUCTURE_NOTES_EDIT = "/structures/:id/notes/edit";
167
169
  export const STRUCTURE_PARENTS = "/structures/:id/parents";
168
170
  export const STRUCTURE_PROFILE = "/structures/:id/profile";
169
- export const STRUCTURE_RULES_IMPLEMENTATIONS =
170
- "/structures/:id/rules_implementations";
171
+ export const STRUCTURE_RULES = "/structures/:id/rules";
171
172
  export const STRUCTURE_TAGS = "/structureTags";
172
173
  export const STRUCTURE_TAGS_NEW = "/structureTags/new";
173
174
  export const STRUCTURE_TAG_EDIT = "/structureTags/:id/edit";
@@ -250,6 +251,7 @@ const routes = {
250
251
  IMPLEMENTATION_CONCEPT_LINKS_NEW,
251
252
  IMPLEMENTATION_EDIT,
252
253
  IMPLEMENTATION_EVENTS,
254
+ IMPLEMENTATION_EXECUTIONS,
253
255
  IMPLEMENTATION_HISTORY,
254
256
  IMPLEMENTATION_MOVE,
255
257
  IMPLEMENTATION_NEW,
@@ -334,7 +336,7 @@ const routes = {
334
336
  STRUCTURE_NOTES_EDIT,
335
337
  STRUCTURE_PARENTS,
336
338
  STRUCTURE_PROFILE,
337
- STRUCTURE_RULES_IMPLEMENTATIONS,
339
+ STRUCTURE_RULES,
338
340
  STRUCTURE_TAGS,
339
341
  STRUCTURE_TAGS_NEW,
340
342
  STRUCTURE_TAG_EDIT,