@truedat/core 7.0.5 → 7.0.7

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.
Files changed (32) hide show
  1. package/package.json +3 -3
  2. package/src/components/DomainSelector.js +15 -0
  3. package/src/components/DropdownMenuItem.js +12 -3
  4. package/src/components/Hierarchy.js +316 -0
  5. package/src/components/HierarchyNodeFinder.js +65 -0
  6. package/src/components/HierarchySelector.js +18 -2
  7. package/src/components/NodeOpenActions.js +30 -0
  8. package/src/components/ResourceMembers.js +2 -3
  9. package/src/components/TreeSelector.js +102 -52
  10. package/src/components/__tests__/AddResourceMember.spec.js +1 -1
  11. package/src/components/__tests__/DomainSelector.spec.js +18 -1
  12. package/src/components/__tests__/DropdownMenuItem.spec.js +6 -2
  13. package/src/components/__tests__/FilterMultilevelDropdown.spec.js +12 -4
  14. package/src/components/__tests__/Hierarchy.spec.js +42 -0
  15. package/src/components/__tests__/HierarchyFilterDropdown.spec.js +9 -3
  16. package/src/components/__tests__/HierarchyNodeFinder.spec.js +203 -0
  17. package/src/components/__tests__/ResourceMembers.spec.js +1 -2
  18. package/src/components/__tests__/TreeSelector.spec.js +25 -7
  19. package/src/components/__tests__/__snapshots__/DomainSelector.spec.js.snap +86 -5
  20. package/src/components/__tests__/__snapshots__/DropdownMenuItem.spec.js.snap +1 -1
  21. package/src/components/__tests__/__snapshots__/FilterMultilevelDropdown.spec.js.snap +2 -2
  22. package/src/components/__tests__/__snapshots__/Hierarchy.spec.js.snap +189 -0
  23. package/src/components/__tests__/__snapshots__/HierarchyFilterDropdown.spec.js.snap +1 -1
  24. package/src/components/__tests__/__snapshots__/HierarchyNodeFinder.spec.js.snap +146 -0
  25. package/src/components/__tests__/__snapshots__/HierarchySelector.spec.js.snap +3 -3
  26. package/src/components/__tests__/__snapshots__/TreeSelector.spec.js.snap +46 -3
  27. package/src/components/index.js +2 -0
  28. package/src/messages/en.js +3 -0
  29. package/src/messages/es.js +3 -1
  30. package/src/routes.js +0 -2
  31. package/src/services/__tests__/tree.spec.js +14 -0
  32. package/src/services/tree.js +16 -0
@@ -13,7 +13,22 @@ const renderOpts = {};
13
13
 
14
14
  describe("<TreeSelector />", () => {
15
15
  it("matches latest snapshot", () => {
16
- const props = { options, placeholder: "Select a domain" };
16
+ const props = {
17
+ options,
18
+ placeholder: "Select a domain",
19
+ className: "testClassName",
20
+ };
21
+ const { container } = render(<TreeSelector {...props} />, renderOpts);
22
+ expect(container).toMatchSnapshot();
23
+ });
24
+
25
+ it("matches latest snapshot with notDropdown parameter", () => {
26
+ const props = {
27
+ options,
28
+ placeholder: "Select a domain",
29
+ className: "testClassName",
30
+ notDropdown: true,
31
+ };
17
32
  const { container } = render(<TreeSelector {...props} />, renderOpts);
18
33
  expect(container).toMatchSnapshot();
19
34
  });
@@ -23,6 +38,7 @@ describe("<TreeSelector />", () => {
23
38
  onChange: jest.fn(),
24
39
  options,
25
40
  placeholder: "Select a domain",
41
+ value: [],
26
42
  };
27
43
  const { getByText, getByRole } = render(
28
44
  <TreeSelector multiple {...props} />,
@@ -70,6 +86,7 @@ describe("<TreeSelector />", () => {
70
86
  options,
71
87
  placeholder: "Select a domain",
72
88
  minDepth: minDepth,
89
+ value: [],
73
90
  };
74
91
 
75
92
  const { getByText, getByRole } = render(
@@ -84,7 +101,7 @@ describe("<TreeSelector />", () => {
84
101
 
85
102
  userEvent.click(
86
103
  getByRole("option", { name: /foo/i }).querySelector(
87
- 'i[class="plus icon"]'
104
+ 'i[class="chevron circle down icon"]'
88
105
  )
89
106
  );
90
107
 
@@ -94,7 +111,7 @@ describe("<TreeSelector />", () => {
94
111
 
95
112
  userEvent.click(
96
113
  getByRole("option", { name: /bar/i }).querySelector(
97
- 'i[class="plus icon"]'
114
+ 'i[class="chevron circle down icon"]'
98
115
  )
99
116
  );
100
117
 
@@ -116,6 +133,7 @@ describe("<TreeSelector />", () => {
116
133
  options,
117
134
  placeholder: "Select a domain",
118
135
  minDepth: minDepth,
136
+ value: [],
119
137
  };
120
138
 
121
139
  const { getByText, getByRole } = render(
@@ -130,7 +148,7 @@ describe("<TreeSelector />", () => {
130
148
 
131
149
  userEvent.click(
132
150
  getByRole("option", { name: /foo/i }).querySelector(
133
- 'i[class="plus icon"]'
151
+ 'i[class="chevron circle down icon"]'
134
152
  )
135
153
  );
136
154
 
@@ -165,7 +183,7 @@ describe("<TreeSelector />", () => {
165
183
 
166
184
  userEvent.click(
167
185
  getByRole("option", { name: /foo/i }).querySelector(
168
- 'i[class="plus icon"]'
186
+ 'i[class="chevron circle down icon"]'
169
187
  )
170
188
  );
171
189
 
@@ -175,7 +193,7 @@ describe("<TreeSelector />", () => {
175
193
 
176
194
  userEvent.click(
177
195
  getByRole("option", { name: /bar/i }).querySelector(
178
- 'i[class="plus icon"]'
196
+ 'i[class="chevron circle down icon"]'
179
197
  )
180
198
  );
181
199
 
@@ -211,7 +229,7 @@ describe("<TreeSelector />", () => {
211
229
 
212
230
  userEvent.click(
213
231
  getByRole("option", { name: /foo/i }).querySelector(
214
- 'i[class="plus icon"]'
232
+ 'i[class="chevron circle down icon"]'
215
233
  )
216
234
  );
217
235
 
@@ -3,7 +3,7 @@
3
3
  exports[`<DomainSelector /> matches latest snapshot 1`] = `
4
4
  <div>
5
5
  <div
6
- class="field fix-dropdown-selector"
6
+ class="field fix-dropdown-selector test className"
7
7
  >
8
8
  <div
9
9
  aria-disabled="false"
@@ -24,7 +24,7 @@ exports[`<DomainSelector /> matches latest snapshot 1`] = `
24
24
  class="menu transition"
25
25
  >
26
26
  <div
27
- class="ui left icon input search"
27
+ class="ui fluid left icon input search "
28
28
  >
29
29
  <input
30
30
  type="text"
@@ -47,7 +47,7 @@ exports[`<DomainSelector /> matches latest snapshot 1`] = `
47
47
  >
48
48
  <i
49
49
  aria-hidden="true"
50
- class="plus icon"
50
+ class="chevron circle down icon"
51
51
  />
52
52
  <span
53
53
  style="opacity: 1;"
@@ -66,7 +66,7 @@ exports[`<DomainSelector /> matches latest snapshot 1`] = `
66
66
  >
67
67
  <i
68
68
  aria-hidden="true"
69
- class="icon"
69
+ class="circle icon"
70
70
  />
71
71
  <span
72
72
  style="opacity: 1;"
@@ -85,7 +85,7 @@ exports[`<DomainSelector /> matches latest snapshot 1`] = `
85
85
  >
86
86
  <i
87
87
  aria-hidden="true"
88
- class="icon"
88
+ class="circle icon"
89
89
  />
90
90
  <span
91
91
  style="opacity: 1;"
@@ -100,3 +100,84 @@ exports[`<DomainSelector /> matches latest snapshot 1`] = `
100
100
  </div>
101
101
  </div>
102
102
  `;
103
+
104
+ exports[`<DomainSelector /> matches latest snapshot with notDropdow parameter 1`] = `
105
+ <div>
106
+ <div
107
+ class="menu transition test className"
108
+ >
109
+ <div
110
+ class="ui fluid left icon input search notDropdownInput"
111
+ >
112
+ <input
113
+ type="text"
114
+ />
115
+ <i
116
+ aria-hidden="true"
117
+ class="search icon"
118
+ />
119
+ </div>
120
+ <div
121
+ class="scrolling menu transition notDropdownSelector"
122
+ >
123
+ <div
124
+ aria-selected="false"
125
+ class="item"
126
+ role="option"
127
+ >
128
+ <div
129
+ style="margin-left: 0px;"
130
+ >
131
+ <i
132
+ aria-hidden="true"
133
+ class="chevron circle down icon"
134
+ />
135
+ <span
136
+ style="opacity: 1;"
137
+ >
138
+ barDomain
139
+ </span>
140
+ </div>
141
+ </div>
142
+ <div
143
+ aria-selected="false"
144
+ class="item"
145
+ role="option"
146
+ >
147
+ <div
148
+ style="margin-left: 0px;"
149
+ >
150
+ <i
151
+ aria-hidden="true"
152
+ class="circle icon"
153
+ />
154
+ <span
155
+ style="opacity: 1;"
156
+ >
157
+ bazDomain
158
+ </span>
159
+ </div>
160
+ </div>
161
+ <div
162
+ aria-selected="false"
163
+ class="item"
164
+ role="option"
165
+ >
166
+ <div
167
+ style="margin-left: 0px;"
168
+ >
169
+ <i
170
+ aria-hidden="true"
171
+ class="circle icon"
172
+ />
173
+ <span
174
+ style="opacity: 1;"
175
+ >
176
+ fooDomain
177
+ </span>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ </div>
183
+ `;
@@ -10,7 +10,7 @@ exports[`<DropdownMenuItem /> matches the latest snapshot 1`] = `
10
10
  <div>
11
11
  <i
12
12
  aria-hidden="true"
13
- class="plus icon"
13
+ class="chevron circle down icon"
14
14
  />
15
15
  <i
16
16
  aria-hidden="true"
@@ -45,7 +45,7 @@ exports[`<FilterMultilevelDropdown /> matches the latest snapshot 1`] = `
45
45
  >
46
46
  <i
47
47
  aria-hidden="true"
48
- class="plus icon"
48
+ class="chevron circle down icon"
49
49
  />
50
50
  <i
51
51
  aria-hidden="true"
@@ -68,7 +68,7 @@ exports[`<FilterMultilevelDropdown /> matches the latest snapshot 1`] = `
68
68
  >
69
69
  <i
70
70
  aria-hidden="true"
71
- class="icon"
71
+ class="circle icon"
72
72
  />
73
73
  <i
74
74
  aria-hidden="true"
@@ -0,0 +1,189 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<Hierarchy /> matches snapshot with edition mode 1`] = `
4
+ <div>
5
+ <div
6
+ class="column"
7
+ >
8
+ <div
9
+ class="row"
10
+ >
11
+ <div
12
+ style="display: flex; flex-direction: row; align-items: self-start;"
13
+ >
14
+ <div
15
+ class="ui input"
16
+ >
17
+ <input
18
+ placeholder="Hierarchy name"
19
+ type="text"
20
+ value="Baggins"
21
+ />
22
+ </div>
23
+ <div
24
+ class="description_wrapper"
25
+ >
26
+ <div
27
+ class="description"
28
+ >
29
+ bar
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ <ul
35
+ class="wtree expanded"
36
+ >
37
+ <li>
38
+ <i
39
+ aria-hidden="true"
40
+ class="cut large icon li_trash"
41
+ style="cursor: pointer; visibility: hidden;"
42
+ title="Delete node"
43
+ />
44
+ <div
45
+ style="display: flex; flex-direction: row; align-items: self-start;"
46
+ >
47
+ <div>
48
+ <div
49
+ class="ui left labeled input"
50
+ >
51
+ <div
52
+ class="ui basic label"
53
+ title="Expand"
54
+ >
55
+ <i
56
+ aria-hidden="true"
57
+ class="circle fitted icon"
58
+ style="cursor: pointer;"
59
+ />
60
+ </div>
61
+ <input
62
+ placeholder="Node"
63
+ type="text"
64
+ value="Fosco"
65
+ />
66
+ </div>
67
+ </div>
68
+ <div
69
+ class="description_wrapper"
70
+ >
71
+ <div
72
+ class="description"
73
+ >
74
+ Add description
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </li>
79
+ <li
80
+ class="add_node"
81
+ >
82
+ <div>
83
+ <form
84
+ class="ui form"
85
+ >
86
+ <div
87
+ class="ui input"
88
+ >
89
+ <input
90
+ placeholder="New node"
91
+ type="text"
92
+ value=""
93
+ />
94
+ </div>
95
+ </form>
96
+ </div>
97
+ </li>
98
+ </ul>
99
+ </div>
100
+ </div>
101
+ `;
102
+
103
+ exports[`<Hierarchy /> matches the last snapshot with edition mode false 1`] = `
104
+ <div>
105
+ <div
106
+ class="column"
107
+ >
108
+ <div
109
+ class="row"
110
+ >
111
+ <div
112
+ style="display: flex; flex-direction: row; align-items: self-start;"
113
+ >
114
+ <div
115
+ class="ui disabled input"
116
+ data-position="top left"
117
+ data-tooltip="Baggins"
118
+ style="opacity: 1;"
119
+ >
120
+ <input
121
+ disabled=""
122
+ placeholder="Hierarchy name"
123
+ tabindex="-1"
124
+ type="text"
125
+ value="Baggins"
126
+ />
127
+ </div>
128
+ <div
129
+ class="description_wrapper"
130
+ >
131
+ <div
132
+ class="description disabled"
133
+ >
134
+ bar
135
+ </div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ <ul
140
+ class="wtree expanded"
141
+ >
142
+ <li>
143
+ <i
144
+ aria-hidden="true"
145
+ class="cut large icon li_trash"
146
+ style="cursor: pointer; visibility: hidden;"
147
+ title="Delete node"
148
+ />
149
+ <div
150
+ style="display: flex; flex-direction: row; align-items: self-start;"
151
+ >
152
+ <div>
153
+ <div
154
+ class="ui disabled left labeled input hierarchyNode"
155
+ data-position="top left"
156
+ data-tooltip="Fosco"
157
+ >
158
+ <div
159
+ class="ui basic label"
160
+ title="Expand"
161
+ >
162
+ <i
163
+ aria-hidden="true"
164
+ class="circle fitted icon"
165
+ style="cursor: pointer;"
166
+ />
167
+ </div>
168
+ <input
169
+ disabled=""
170
+ placeholder="Node"
171
+ tabindex="-1"
172
+ type="text"
173
+ value="Fosco"
174
+ />
175
+ </div>
176
+ </div>
177
+ <div
178
+ class="description_wrapper"
179
+ >
180
+ <div
181
+ class="description disabled"
182
+ />
183
+ </div>
184
+ </div>
185
+ </li>
186
+ </ul>
187
+ </div>
188
+ </div>
189
+ `;
@@ -45,7 +45,7 @@ exports[`<HierarchyFilterDropdown /> matches the latest snapshot 1`] = `
45
45
  >
46
46
  <i
47
47
  aria-hidden="true"
48
- class="plus icon"
48
+ class="chevron circle down icon"
49
49
  />
50
50
  <i
51
51
  aria-hidden="true"
@@ -0,0 +1,146 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`HierarchyNodeFinder matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="ui segment"
7
+ >
8
+ <div
9
+ class="ui grid"
10
+ >
11
+ <div
12
+ class="row"
13
+ >
14
+ <div
15
+ class="sixteen wide column"
16
+ >
17
+ <button
18
+ class="ui icon secondary right floated button nodeOpenActions"
19
+ data-position="bottom right"
20
+ data-tooltip="Open all"
21
+ >
22
+ <i
23
+ aria-hidden="true"
24
+ class="plus icon"
25
+ />
26
+ </button>
27
+ <div
28
+ class="menu transition hierarchyNodeFinderTreeSelector"
29
+ >
30
+ <div
31
+ class="ui fluid left icon input search notDropdownInput"
32
+ >
33
+ <input
34
+ type="text"
35
+ />
36
+ <i
37
+ aria-hidden="true"
38
+ class="search icon"
39
+ />
40
+ </div>
41
+ <div
42
+ class="scrolling menu transition notDropdownSelector"
43
+ >
44
+ <div
45
+ aria-selected="false"
46
+ class="item"
47
+ role="option"
48
+ >
49
+ <div
50
+ style="margin-left: 0px;"
51
+ >
52
+ <i
53
+ aria-hidden="true"
54
+ class="circle icon"
55
+ />
56
+ <span
57
+ style="opacity: 1;"
58
+ >
59
+ element_1
60
+ </span>
61
+ </div>
62
+ </div>
63
+ <div
64
+ aria-selected="false"
65
+ class="item"
66
+ role="option"
67
+ >
68
+ <div
69
+ style="margin-left: 0px;"
70
+ >
71
+ <i
72
+ aria-hidden="true"
73
+ class="chevron circle down icon"
74
+ />
75
+ <span
76
+ style="opacity: 1;"
77
+ >
78
+ element_2
79
+ </span>
80
+ </div>
81
+ </div>
82
+ <div
83
+ aria-selected="false"
84
+ class="item ascendant"
85
+ role="option"
86
+ >
87
+ <div
88
+ style="margin-left: 0px;"
89
+ >
90
+ <i
91
+ aria-hidden="true"
92
+ class="chevron circle right icon"
93
+ />
94
+ <span
95
+ style="opacity: 1;"
96
+ >
97
+ element_5
98
+ </span>
99
+ </div>
100
+ </div>
101
+ <div
102
+ aria-selected="false"
103
+ class="item ascendant"
104
+ role="option"
105
+ >
106
+ <div
107
+ style="margin-left: 8px;"
108
+ >
109
+ <i
110
+ aria-hidden="true"
111
+ class="chevron circle right icon"
112
+ />
113
+ <span
114
+ style="opacity: 1;"
115
+ >
116
+ element_6
117
+ </span>
118
+ </div>
119
+ </div>
120
+ <div
121
+ aria-selected="true"
122
+ class="selected item ascendant"
123
+ role="option"
124
+ >
125
+ <div
126
+ style="margin-left: 16px;"
127
+ >
128
+ <i
129
+ aria-hidden="true"
130
+ class="circle icon"
131
+ />
132
+ <span
133
+ style="opacity: 1;"
134
+ >
135
+ element_7
136
+ </span>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ `;
@@ -3,7 +3,7 @@
3
3
  exports[`<HierarchySelector /> matches latest snapshot 1`] = `
4
4
  <div>
5
5
  <div
6
- class="field fix-dropdown-selector"
6
+ class="field fix-dropdown-selector "
7
7
  >
8
8
  <div
9
9
  aria-disabled="false"
@@ -24,7 +24,7 @@ exports[`<HierarchySelector /> matches latest snapshot 1`] = `
24
24
  class="menu transition"
25
25
  >
26
26
  <div
27
- class="ui left icon input search"
27
+ class="ui fluid left icon input search "
28
28
  >
29
29
  <input
30
30
  type="text"
@@ -47,7 +47,7 @@ exports[`<HierarchySelector /> matches latest snapshot 1`] = `
47
47
  >
48
48
  <i
49
49
  aria-hidden="true"
50
- class="plus icon"
50
+ class="chevron circle down icon"
51
51
  />
52
52
  <span
53
53
  style="opacity: 1;"
@@ -3,7 +3,7 @@
3
3
  exports[`<TreeSelector /> matches latest snapshot 1`] = `
4
4
  <div>
5
5
  <div
6
- class="field fix-dropdown-selector"
6
+ class="field fix-dropdown-selector testClassName"
7
7
  >
8
8
  <div
9
9
  aria-disabled="false"
@@ -24,7 +24,7 @@ exports[`<TreeSelector /> matches latest snapshot 1`] = `
24
24
  class="menu transition"
25
25
  >
26
26
  <div
27
- class="ui left icon input search"
27
+ class="ui fluid left icon input search "
28
28
  >
29
29
  <input
30
30
  type="text"
@@ -47,7 +47,7 @@ exports[`<TreeSelector /> matches latest snapshot 1`] = `
47
47
  >
48
48
  <i
49
49
  aria-hidden="true"
50
- class="plus icon"
50
+ class="chevron circle down icon"
51
51
  />
52
52
  <span
53
53
  style="opacity: 1;"
@@ -62,3 +62,46 @@ exports[`<TreeSelector /> matches latest snapshot 1`] = `
62
62
  </div>
63
63
  </div>
64
64
  `;
65
+
66
+ exports[`<TreeSelector /> matches latest snapshot with notDropdown parameter 1`] = `
67
+ <div>
68
+ <div
69
+ class="menu transition testClassName"
70
+ >
71
+ <div
72
+ class="ui fluid left icon input search notDropdownInput"
73
+ >
74
+ <input
75
+ type="text"
76
+ />
77
+ <i
78
+ aria-hidden="true"
79
+ class="search icon"
80
+ />
81
+ </div>
82
+ <div
83
+ class="scrolling menu transition notDropdownSelector"
84
+ >
85
+ <div
86
+ aria-selected="false"
87
+ class="item"
88
+ role="option"
89
+ >
90
+ <div
91
+ style="margin-left: 0px;"
92
+ >
93
+ <i
94
+ aria-hidden="true"
95
+ class="chevron circle down icon"
96
+ />
97
+ <span
98
+ style="opacity: 1;"
99
+ >
100
+ foo
101
+ </span>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ `;