@truedat/core 4.51.1 → 4.51.3

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.51.3] 2022-09-16
4
+
5
+ ### Changed
6
+
7
+ - [TD-4794] `DomainSelector` improvements
8
+
3
9
  ## [4.51.1] 2022-09-14
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.51.1",
3
+ "version": "4.51.3",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -35,7 +35,7 @@
35
35
  "@testing-library/jest-dom": "^5.16.4",
36
36
  "@testing-library/react": "^12.0.0",
37
37
  "@testing-library/user-event": "^13.2.1",
38
- "@truedat/test": "4.47.9",
38
+ "@truedat/test": "4.51.3",
39
39
  "babel-jest": "^28.1.0",
40
40
  "babel-plugin-dynamic-import-node": "^2.3.3",
41
41
  "babel-plugin-lodash": "^3.3.4",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "2f5c5f130f1fd84a103c8a97096eb2c191d06446"
115
+ "gitHead": "69d6cf8f7379eb2ef5744a4fdd357a7dd662b115"
116
116
  }
@@ -54,7 +54,11 @@ DomainSelector.propTypes = {
54
54
  multiple: PropTypes.bool,
55
55
  domainActions: PropTypes.array,
56
56
  onLoad: PropTypes.func,
57
- value: PropTypes.array,
57
+ value: PropTypes.oneOfType([
58
+ PropTypes.array,
59
+ PropTypes.string,
60
+ PropTypes.number,
61
+ ]),
58
62
  };
59
63
 
60
64
  export default DomainSelector;
@@ -12,26 +12,35 @@ export const match =
12
12
  _.contains(query)(lowerDeburr(name));
13
13
  export const matchAny = recursiveMatch(match);
14
14
 
15
- export const SelectedLabels = ({ onClick, options, placeholder, value }) =>
15
+ export const SelectedLabels = ({
16
+ disabled,
17
+ onClick,
18
+ options,
19
+ placeholder,
20
+ value,
21
+ }) =>
16
22
  _.isEmpty(value) ? (
17
23
  <label>{placeholder}</label>
18
24
  ) : (
19
25
  _.map((id) => (
20
26
  <Label key={id}>
21
27
  {_.flow(_.find({ id }), _.prop("name"))(options)}
22
- <Icon
23
- name="delete"
24
- onClick={(e) => {
25
- e.preventDefault();
26
- e.stopPropagation();
27
- onClick(e, id);
28
- }}
29
- />
28
+ {disabled ? null : (
29
+ <Icon
30
+ name="delete"
31
+ onClick={(e) => {
32
+ e.preventDefault();
33
+ e.stopPropagation();
34
+ onClick(e, id);
35
+ }}
36
+ />
37
+ )}
30
38
  </Label>
31
39
  ))(value)
32
40
  );
33
41
 
34
42
  SelectedLabels.propTypes = {
43
+ disabled: PropTypes.bool,
35
44
  onClick: PropTypes.func,
36
45
  options: PropTypes.array,
37
46
  placeholder: PropTypes.string,
@@ -50,6 +59,7 @@ const labelValues = _.cond([
50
59
 
51
60
  export const TreeSelector = ({
52
61
  check = false,
62
+ disabled = false,
53
63
  error,
54
64
  label,
55
65
  labels = false,
@@ -117,6 +127,7 @@ export const TreeSelector = ({
117
127
 
118
128
  const trigger = labels ? (
119
129
  <SelectedLabels
130
+ disabled={disabled}
120
131
  placeholder={placeholder}
121
132
  options={options}
122
133
  onClick={handleClick}
@@ -180,6 +191,7 @@ export const TreeSelector = ({
180
191
 
181
192
  TreeSelector.propTypes = {
182
193
  check: PropTypes.bool,
194
+ disabled: PropTypes.bool,
183
195
  error: PropTypes.bool,
184
196
  label: PropTypes.string,
185
197
  labels: PropTypes.bool,