@truedat/bg 4.39.0 → 4.40.2

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.40.2] 2022-03-14
4
+
5
+ ### Added
6
+
7
+ - [TD-4500] Support for data structures with multiple domain_ids
8
+
9
+ ## [4.40.0] 2022-03-07
10
+
11
+ ### Changed
12
+
13
+ - [TD-4491] Simplified `getDomainSelectorOptions` selector
14
+
3
15
  ## [4.38.8] 2022-02-22
4
16
 
5
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.39.0",
3
+ "version": "4.40.2",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -83,8 +83,8 @@
83
83
  ]
84
84
  },
85
85
  "dependencies": {
86
- "@truedat/core": "4.39.0",
87
- "@truedat/df": "4.39.0",
86
+ "@truedat/core": "4.40.2",
87
+ "@truedat/df": "4.40.2",
88
88
  "file-saver": "^2.0.5",
89
89
  "moment": "^2.24.0",
90
90
  "path-to-regexp": "^1.7.0",
@@ -104,5 +104,5 @@
104
104
  "react-dom": ">= 16.8.6 < 17",
105
105
  "semantic-ui-react": ">= 0.88.2 < 2.1"
106
106
  },
107
- "gitHead": "f3d2fe3fcdec546afc22d0a79c4f4f3dfb91ea48"
107
+ "gitHead": "86aa7e6c6e49c8e3a975f8f4f744c44035324c7f"
108
108
  }
@@ -50,6 +50,7 @@ exports[`<ConceptManageDomain /> matches the latest snapshot 1`] = `
50
50
  class="dropdown icon"
51
51
  />
52
52
  <div
53
+ aria-multiselectable="false"
53
54
  class="menu transition"
54
55
  role="listbox"
55
56
  >
@@ -242,7 +242,6 @@ export default {
242
242
  "fields.pairlist.url.value.placeholder": "https://example.com",
243
243
  "filters._confidential": "Confidential",
244
244
  "filters.domain": "Domain",
245
- "filters.domain_parents": "Domain",
246
245
  "filters.filiacion": "Filiacion",
247
246
  "filters.link_count": "Data fields",
248
247
  "filters.rule_count": "Quality Rules",
@@ -244,7 +244,6 @@ export default {
244
244
  "fields.pairlist.url.value.placeholder": "https://ejemplo.es",
245
245
  "filters._confidential": "Confidencial",
246
246
  "filters.domain": "Dominio",
247
- "filters.domain_parents": "Dominio",
248
247
  "filters.filiacion": "Filiacion",
249
248
  "filters.link_count": "Datos",
250
249
  "filters.rule_count": "Reglas de calidad",
@@ -37,6 +37,7 @@ export const DomainDropdownSelector = ({
37
37
  domainOptions: options,
38
38
  hideLabel,
39
39
  invalid,
40
+ multiple = false,
40
41
  onChange,
41
42
  value: defaultValue,
42
43
  }) => {
@@ -95,8 +96,9 @@ export const DomainDropdownSelector = ({
95
96
 
96
97
  const handleBlur = () => {
97
98
  setQuery();
98
- if (!_.isNil(value)) {
99
- const domain = _.find({ id: value })(options);
99
+ const lastesSelection = _.isNumber(value) ? value : _.last(value);
100
+ if (!_.isNil(lastesSelection)) {
101
+ const domain = _.find({ id: lastesSelection })(options);
100
102
  const ancestors = _.map("id")(domain.ancestors);
101
103
  const ids = [...ancestors, domain.id];
102
104
  setOpen(ancestors);
@@ -169,6 +171,7 @@ export const DomainDropdownSelector = ({
169
171
  )(filteredOptions)}
170
172
  placeholder={formatMessage({ id: "domain.selector.placeholder" })}
171
173
  search={_.identity}
174
+ multiple={multiple}
172
175
  selection
173
176
  value={value}
174
177
  />
@@ -182,8 +185,9 @@ DomainDropdownSelector.propTypes = {
182
185
  domainOptions: PropTypes.array,
183
186
  hideLabel: PropTypes.bool,
184
187
  invalid: PropTypes.bool,
188
+ multiple: PropTypes.bool,
185
189
  onChange: PropTypes.func,
186
- value: PropTypes.number,
190
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.array]),
187
191
  };
188
192
 
189
193
  const mapStateToProps = (state, props) => ({
@@ -38,6 +38,7 @@ exports[`<DomainDropdownSelector /> matches the latest snapshot 1`] = `
38
38
  class="dropdown icon"
39
39
  />
40
40
  <div
41
+ aria-multiselectable="false"
41
42
  class="menu transition"
42
43
  role="listbox"
43
44
  >
@@ -0,0 +1,66 @@
1
+ import { getDomainSelectorOptions } from "..";
2
+
3
+ describe("selectors: getDomainSelectorOptions", () => {
4
+ const domains = [
5
+ { id: 1, name: "domain1" },
6
+ { id: 2, name: "domain2", parent_id: 1 },
7
+ { id: 3, name: "domain3" },
8
+ { id: 4, name: "domain4", parent_id: 0 },
9
+ { id: 5, name: "domain2", parent_id: 2 },
10
+ ];
11
+
12
+ it("foo", () => {
13
+ const options = getDomainSelectorOptions({ domains });
14
+ expect(options).toEqual([
15
+ {
16
+ ancestors: [],
17
+ children: [{ id: 2, name: "domain2", parent_id: 1 }],
18
+ descendents: [
19
+ { id: 2, name: "domain2", parent_id: 1 },
20
+ { id: 5, name: "domain2", parent_id: 2 },
21
+ ],
22
+ id: 1,
23
+ level: 0,
24
+ name: "domain1",
25
+ },
26
+ {
27
+ ancestors: [{ id: 1, name: "domain1" }],
28
+ children: [{ id: 5, name: "domain2", parent_id: 2 }],
29
+ descendents: [{ id: 5, name: "domain2", parent_id: 2 }],
30
+ id: 2,
31
+ level: 1,
32
+ name: "domain2",
33
+ parent_id: 1,
34
+ },
35
+ {
36
+ ancestors: [
37
+ { id: 1, name: "domain1" },
38
+ { id: 2, name: "domain2", parent_id: 1 },
39
+ ],
40
+ children: [],
41
+ descendents: [],
42
+ id: 5,
43
+ level: 2,
44
+ name: "domain2",
45
+ parent_id: 2,
46
+ },
47
+ {
48
+ ancestors: [],
49
+ children: [],
50
+ descendents: [],
51
+ id: 3,
52
+ level: 0,
53
+ name: "domain3",
54
+ },
55
+ {
56
+ ancestors: [],
57
+ children: [],
58
+ descendents: [],
59
+ id: 4,
60
+ level: 0,
61
+ name: "domain4",
62
+ parent_id: 0,
63
+ },
64
+ ]);
65
+ });
66
+ });
@@ -148,9 +148,10 @@ const reduceTaxonomy = (domains) => (domainsInLevel, level) => {
148
148
  };
149
149
 
150
150
  const getDomainSelectorOptions = createSelector([getDomains], (domains) => {
151
- const roots = getChildOrRootDomains({
152
- domains: _.sortBy(accentInsensitivePathOrder("name"))(domains),
153
- });
151
+ const roots = _.flow(
152
+ _.filter(hasNoParentIn(domains)),
153
+ _.sortBy(accentInsensitivePathOrder("name"))
154
+ )(domains);
154
155
  return reduceTaxonomy(domains)(roots, 0);
155
156
  });
156
157