@truedat/lm 4.38.8 → 4.40.0

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.39.2] 2022-03-04
4
+
5
+ ### Added
6
+
7
+ - [TD-4378] Filter Linkage (LinksPane) column if all objects have empty/nonexistent column property
8
+
3
9
  ## [4.38.5] 2022-02-20
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/lm",
3
- "version": "4.38.8",
3
+ "version": "4.40.0",
4
4
  "description": "Truedat Link Manager",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -33,7 +33,7 @@
33
33
  "@testing-library/jest-dom": "^5.14.1",
34
34
  "@testing-library/react": "^12.0.0",
35
35
  "@testing-library/user-event": "^13.2.1",
36
- "@truedat/test": "4.38.8",
36
+ "@truedat/test": "4.39.0",
37
37
  "babel-jest": "^27.0.6",
38
38
  "babel-plugin-dynamic-import-node": "^2.3.3",
39
39
  "babel-plugin-lodash": "^3.3.4",
@@ -83,7 +83,7 @@
83
83
  ]
84
84
  },
85
85
  "dependencies": {
86
- "@truedat/core": "4.38.8",
86
+ "@truedat/core": "4.40.0",
87
87
  "path-to-regexp": "^1.7.0",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-graph-vis": "1.0.5",
@@ -100,5 +100,5 @@
100
100
  "react-dom": ">= 16.8.6 < 17",
101
101
  "semantic-ui-react": ">= 0.88.2 < 2.1"
102
102
  },
103
- "gitHead": "66f56f3fe3e1b5eb0b18379f2d141b1433bf82c1"
103
+ "gitHead": "0bd677584da73a5021a5c96f2e5525fde9a1958a"
104
104
  }
@@ -1,5 +1,6 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
+ import PropTypes from "prop-types";
3
4
  import { Table, Header, Grid } from "semantic-ui-react";
4
5
  import { FormattedMessage } from "react-intl";
5
6
  import { columnDecorator } from "@truedat/core/services";
@@ -49,6 +50,17 @@ export const Links = ({ tag, sourceType, targetType, columns, links }) => {
49
50
  );
50
51
  };
51
52
 
53
+ const columnPredicate = (column) => {
54
+ const { fieldSelector, name } = column || {};
55
+ return _.isFunction(fieldSelector)
56
+ ? fieldSelector
57
+ : _.path(_.defaultTo(name)(fieldSelector));
58
+ };
59
+
60
+ const filterColumns = (columns, links) => {
61
+ return _.filter((column) => _.any(columnPredicate(column))(links))(columns);
62
+ };
63
+
52
64
  export const LinksPane = ({ groups, sourceType, targetType, linksActions }) => (
53
65
  <Grid>
54
66
  <Grid.Row>
@@ -63,7 +75,7 @@ export const LinksPane = ({ groups, sourceType, targetType, linksActions }) => (
63
75
  tag={tag}
64
76
  sourceType={sourceType}
65
77
  targetType={targetType}
66
- columns={columns}
78
+ columns={filterColumns(columns, links)}
67
79
  links={links}
68
80
  />
69
81
  </Grid.Column>
@@ -72,4 +84,11 @@ export const LinksPane = ({ groups, sourceType, targetType, linksActions }) => (
72
84
  </Grid>
73
85
  );
74
86
 
87
+ LinksPane.propTypes = {
88
+ groups: PropTypes.array,
89
+ sourceType: PropTypes.string,
90
+ targetType: PropTypes.string,
91
+ linksActions: PropTypes.object,
92
+ };
93
+
75
94
  export default LinksPane;