@truedat/dd 6.8.2 → 6.8.4

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.
@@ -0,0 +1,96 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<PendingStructureNotesPagination /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ aria-label="Pagination Navigation"
7
+ class="ui pagination menu"
8
+ role="navigation"
9
+ >
10
+ <a
11
+ aria-current="false"
12
+ aria-disabled="false"
13
+ aria-label="First item"
14
+ class="item"
15
+ tabindex="0"
16
+ type="firstItem"
17
+ value="1"
18
+ >
19
+ «
20
+ </a>
21
+ <a
22
+ aria-current="false"
23
+ aria-disabled="false"
24
+ aria-label="Previous item"
25
+ class="item"
26
+ tabindex="0"
27
+ type="prevItem"
28
+ value="1"
29
+ >
30
+
31
+ </a>
32
+ <a
33
+ aria-current="true"
34
+ aria-disabled="false"
35
+ class="active item"
36
+ tabindex="0"
37
+ type="pageItem"
38
+ value="1"
39
+ >
40
+ 1
41
+ </a>
42
+ <a
43
+ aria-current="false"
44
+ aria-disabled="false"
45
+ class="item"
46
+ tabindex="0"
47
+ type="pageItem"
48
+ value="2"
49
+ >
50
+ 2
51
+ </a>
52
+ <a
53
+ aria-current="false"
54
+ aria-disabled="false"
55
+ class="item"
56
+ tabindex="0"
57
+ type="pageItem"
58
+ value="3"
59
+ >
60
+ 3
61
+ </a>
62
+ <a
63
+ aria-current="false"
64
+ aria-disabled="false"
65
+ class="item"
66
+ tabindex="0"
67
+ type="pageItem"
68
+ value="4"
69
+ >
70
+ 4
71
+ </a>
72
+ <a
73
+ aria-current="false"
74
+ aria-disabled="false"
75
+ aria-label="Next item"
76
+ class="item"
77
+ tabindex="0"
78
+ type="nextItem"
79
+ value="2"
80
+ >
81
+
82
+ </a>
83
+ <a
84
+ aria-current="false"
85
+ aria-disabled="false"
86
+ aria-label="Last item"
87
+ class="item"
88
+ tabindex="0"
89
+ type="lastItem"
90
+ value="4"
91
+ >
92
+ »
93
+ </a>
94
+ </div>
95
+ </div>
96
+ `;
@@ -3,7 +3,7 @@
3
3
  exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
4
4
  <div>
5
5
  <table
6
- class="ui selectable table"
6
+ class="ui selectable sortable table"
7
7
  >
8
8
  <thead
9
9
  class=""
@@ -12,27 +12,27 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
12
12
  class=""
13
13
  >
14
14
  <th
15
- class=""
15
+ class="two wide"
16
16
  >
17
- Structure
17
+ Name
18
18
  </th>
19
19
  <th
20
- class=""
20
+ class="one wide"
21
21
  >
22
22
  Status
23
23
  </th>
24
24
  <th
25
- class=""
25
+ class="one wide"
26
26
  >
27
27
  System
28
28
  </th>
29
29
  <th
30
- class=""
30
+ class="one wide disabled"
31
31
  >
32
- Domains
32
+ Domain
33
33
  </th>
34
34
  <th
35
- class=""
35
+ class="one wide disabled"
36
36
  >
37
37
  Path
38
38
  </th>
@@ -45,8 +45,11 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
45
45
  class=""
46
46
  >
47
47
  <td
48
- class=""
49
- />
48
+ class="structure-cell-overflow"
49
+ title="bar"
50
+ >
51
+ bar
52
+ </td>
50
53
  <td
51
54
  class=""
52
55
  >
@@ -54,24 +57,33 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
54
57
  </td>
55
58
  <td
56
59
  class=""
57
- />
60
+ >
61
+ bar system
62
+ </td>
58
63
  <td
59
64
  class=""
60
65
  >
61
-
66
+ bar domain
62
67
  </td>
63
68
  <td
64
69
  class=""
65
70
  >
66
-
71
+ <span
72
+ title="bar rute"
73
+ >
74
+ bar rute
75
+ </span>
67
76
  </td>
68
77
  </tr>
69
78
  <tr
70
79
  class=""
71
80
  >
72
81
  <td
73
- class=""
74
- />
82
+ class="structure-cell-overflow"
83
+ title="foo"
84
+ >
85
+ foo
86
+ </td>
75
87
  <td
76
88
  class=""
77
89
  >
@@ -79,16 +91,22 @@ exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
79
91
  </td>
80
92
  <td
81
93
  class=""
82
- />
94
+ >
95
+ foo system
96
+ </td>
83
97
  <td
84
98
  class=""
85
99
  >
86
-
100
+ foo domain 1, foo domain 2
87
101
  </td>
88
102
  <td
89
103
  class=""
90
104
  >
91
-
105
+ <span
106
+ title="foo rute › other route"
107
+ >
108
+ foo rute › other route
109
+ </span>
92
110
  </td>
93
111
  </tr>
94
112
  </tbody>
@@ -40,6 +40,10 @@ export {
40
40
  defaultStructureFieldColumns,
41
41
  } from "./getStructureFieldColumns";
42
42
  export { getStructureParent } from "./getStructureParent";
43
+ export {
44
+ getStructureNotesColumnsSelector,
45
+ defaultStructureNoteColumns,
46
+ } from "./structureNotesColumnsSelector";
43
47
  export { getStructuresFields } from "./getStructuresFields";
44
48
  export { getStructureSortingCriteria } from "./getStructureSortingCriteria";
45
49
  export { getStructureUpdatedAt } from "./getStructureUpdatedAt";
@@ -0,0 +1,65 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import PropTypes from "prop-types";
4
+ import { createSelector } from "reselect";
5
+ import { FormattedMessage } from "react-intl";
6
+
7
+ const translateDecorator = (id) =>
8
+ id ? <FormattedMessage id={id} defaultMessage={id} /> : null;
9
+
10
+ const DomainDecorator = (domains) =>
11
+ _.flow(_.map("name"), _.join(", "))(domains);
12
+
13
+ DomainDecorator.propTypes = {
14
+ domains: PropTypes.array,
15
+ };
16
+
17
+ const PathDecorator = (path) => (
18
+ <span title={_.join(" › ")(path)}>
19
+ {_.flow(_.join(" › "), _.truncate({ length: 90 }))(path)}
20
+ </span>
21
+ );
22
+ PathDecorator.propTypes = {
23
+ path: PropTypes.string,
24
+ };
25
+
26
+ export const defaultStructureNoteColumns = [
27
+ {
28
+ name: "name",
29
+ sort: { name: "name.sort" },
30
+ width: 2,
31
+ },
32
+ {
33
+ name: "status",
34
+ fieldSelector: ({ non_published_note: { status: status } }) =>
35
+ translateDecorator(`pendingStructureNotes.status.${status}`),
36
+ sort: { name: "non_published_note.status.sort" },
37
+ width: 1,
38
+ },
39
+
40
+ {
41
+ name: "system",
42
+ fieldSelector: _.path("system.name"),
43
+ sort: { name: "system.name.sort" },
44
+ width: 1,
45
+ },
46
+ {
47
+ name: "domain",
48
+ fieldSelector: _.pathOr([], "domains"),
49
+ fieldDecorator: DomainDecorator,
50
+ width: 1,
51
+ },
52
+ {
53
+ name: "path",
54
+ fieldSelector: _.path("path"),
55
+ fieldDecorator: PathDecorator,
56
+ width: 1,
57
+ },
58
+ ];
59
+
60
+ const getColumns = (state) => state.structuresNotesColumns;
61
+
62
+ export const getStructureNotesColumnsSelector = createSelector(
63
+ getColumns,
64
+ _.defaultTo(defaultStructureNoteColumns)
65
+ );