@reltio/components 1.4.2122 → 1.4.2124

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.
@@ -10,14 +10,14 @@ var getLookupByUri = useWith(path, [splitOnce(LOOKUP_URI_SEPARATOR)]);
10
10
  var byLabel = ascend(prop('label'));
11
11
  export var buildLookupEntries = function (lookupTypeCode, lookups) {
12
12
  var getLookupPath = function (uri) {
13
- var parent = getLookupByUri(uri, lookups).parent;
13
+ var parent = (getLookupByUri(uri, lookups) || {}).parent;
14
14
  return parent ? getLookupPath(parent).concat(uri) : [uri];
15
15
  };
16
16
  var buildEntry = function (_a) {
17
17
  var uri = _a[0], value = _a[1];
18
18
  var lookup = getLookupByUri(uri, lookups);
19
19
  var _b = splitOnce(LOOKUP_URI_SEPARATOR, uri), code = _b[1];
20
- var label = getLookupLabel(code, lookup.displayName);
20
+ var label = getLookupLabel(code, lookup === null || lookup === void 0 ? void 0 : lookup.displayName);
21
21
  return lookup === value ? { label: label, value: code } : { label: label, values: buildEntries(value) };
22
22
  };
23
23
  var buildEntries = function (value) { return Object.entries(value).map(buildEntry).sort(byLabel); };
@@ -99,5 +99,25 @@ describe('helpers', function () {
99
99
  }
100
100
  ]);
101
101
  });
102
+ it('should not fail if there is no parent lookup', function () {
103
+ expect(buildLookupEntries('Country', {
104
+ Continent: {
105
+ AS: { displayName: 'Asia' }
106
+ },
107
+ Country: {
108
+ IT: { displayName: 'Italy', parent: 'Continent.EU' }
109
+ }
110
+ })).toEqual([
111
+ {
112
+ label: 'EU',
113
+ values: [
114
+ {
115
+ label: 'Italy (IT)',
116
+ value: 'IT'
117
+ }
118
+ ]
119
+ }
120
+ ]);
121
+ });
102
122
  });
103
123
  });
@@ -13,14 +13,14 @@ var getLookupByUri = (0, ramda_1.useWith)(ramda_1.path, [splitOnce(LOOKUP_URI_SE
13
13
  var byLabel = (0, ramda_1.ascend)((0, ramda_1.prop)('label'));
14
14
  var buildLookupEntries = function (lookupTypeCode, lookups) {
15
15
  var getLookupPath = function (uri) {
16
- var parent = getLookupByUri(uri, lookups).parent;
16
+ var parent = (getLookupByUri(uri, lookups) || {}).parent;
17
17
  return parent ? getLookupPath(parent).concat(uri) : [uri];
18
18
  };
19
19
  var buildEntry = function (_a) {
20
20
  var uri = _a[0], value = _a[1];
21
21
  var lookup = getLookupByUri(uri, lookups);
22
22
  var _b = splitOnce(LOOKUP_URI_SEPARATOR, uri), code = _b[1];
23
- var label = (0, mdm_sdk_1.getLookupLabel)(code, lookup.displayName);
23
+ var label = (0, mdm_sdk_1.getLookupLabel)(code, lookup === null || lookup === void 0 ? void 0 : lookup.displayName);
24
24
  return lookup === value ? { label: label, value: code } : { label: label, values: buildEntries(value) };
25
25
  };
26
26
  var buildEntries = function (value) { return Object.entries(value).map(buildEntry).sort(byLabel); };
@@ -101,5 +101,25 @@ describe('helpers', function () {
101
101
  }
102
102
  ]);
103
103
  });
104
+ it('should not fail if there is no parent lookup', function () {
105
+ expect((0, helpers_1.buildLookupEntries)('Country', {
106
+ Continent: {
107
+ AS: { displayName: 'Asia' }
108
+ },
109
+ Country: {
110
+ IT: { displayName: 'Italy', parent: 'Continent.EU' }
111
+ }
112
+ })).toEqual([
113
+ {
114
+ label: 'EU',
115
+ values: [
116
+ {
117
+ label: 'Italy (IT)',
118
+ value: 'IT'
119
+ }
120
+ ]
121
+ }
122
+ ]);
123
+ });
104
124
  });
105
125
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2122",
3
+ "version": "1.4.2124",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -11,7 +11,7 @@
11
11
  "@fluentui/react-context-selector": "^9.1.26",
12
12
  "@googlemaps/markerclusterer": "^2.5.3",
13
13
  "@react-sigma/core": "3.4.0",
14
- "@reltio/mdm-sdk": "^1.4.1953",
14
+ "@reltio/mdm-sdk": "^1.4.1954",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",