@truedat/dd 4.46.2 → 4.46.5
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 +6 -0
- package/package.json +6 -6
- package/src/components/StructureFieldsDropdown.js +23 -4
- package/src/components/__tests__/__snapshots__/ValueConditionStructure.spec.js.snap +18 -8
- package/src/selectors/__tests__/getGrantsColumns.spec.js +0 -1
- package/src/selectors/getGrantsColumns.js +1 -6
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.46.
|
|
3
|
+
"version": "4.46.5",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.46.
|
|
37
|
+
"@truedat/test": "4.46.5",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/auth": "4.46.
|
|
92
|
-
"@truedat/core": "4.46.
|
|
93
|
-
"@truedat/df": "4.46.
|
|
91
|
+
"@truedat/auth": "4.46.5",
|
|
92
|
+
"@truedat/core": "4.46.5",
|
|
93
|
+
"@truedat/df": "4.46.5",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
96
96
|
"prop-types": "^15.8.1",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"react-dom": ">= 16.8.6 < 17",
|
|
112
112
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "cc6e42515345adf2926f47216622e0fc4f7a0d86"
|
|
115
115
|
}
|
|
@@ -11,23 +11,37 @@ export const StructureFieldsDropdown = ({
|
|
|
11
11
|
fluid,
|
|
12
12
|
inline,
|
|
13
13
|
onSelectField,
|
|
14
|
+
onSelectFields,
|
|
14
15
|
structureFields,
|
|
15
16
|
filters,
|
|
16
17
|
value,
|
|
17
18
|
typeCastModifiers,
|
|
19
|
+
multiple,
|
|
18
20
|
}) => {
|
|
19
21
|
const { formatMessage } = useIntl();
|
|
20
22
|
const onClick = ({ value, modifier }) => {
|
|
23
|
+
onSelectField(dropdownItemToField(value), modifier);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const onChangeStructureFieldsDropdown = (valueOrValues) => {
|
|
27
|
+
return _.flow(
|
|
28
|
+
_.map((value) => {
|
|
29
|
+
return dropdownItemToField(value);
|
|
30
|
+
}),
|
|
31
|
+
multiple ? onSelectFields : onSelectField
|
|
32
|
+
)(Array.isArray(valueOrValues) ? valueOrValues : [valueOrValues]);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const dropdownItemToField = (value) => {
|
|
21
36
|
const [data_structure_id, parent_index] = _.isString(value)
|
|
22
37
|
? value.split("/").map(Number)
|
|
23
38
|
: [value, undefined];
|
|
24
|
-
|
|
39
|
+
return _.isNil(parent_index)
|
|
25
40
|
? _.find({ data_structure_id: data_structure_id })(structureFields)
|
|
26
41
|
: _.find({
|
|
27
42
|
data_structure_id: data_structure_id,
|
|
28
43
|
parent_index: parent_index,
|
|
29
44
|
})(structureFields);
|
|
30
|
-
onSelectField(field, modifier);
|
|
31
45
|
};
|
|
32
46
|
|
|
33
47
|
const formatOption = (field) => {
|
|
@@ -62,14 +76,15 @@ export const StructureFieldsDropdown = ({
|
|
|
62
76
|
}),
|
|
63
77
|
};
|
|
64
78
|
};
|
|
65
|
-
const toFieldOption = (field) =>
|
|
66
|
-
_.has("options")(field)
|
|
79
|
+
const toFieldOption = (field) => {
|
|
80
|
+
return _.has("options")(field)
|
|
67
81
|
? {
|
|
68
82
|
icon: "table",
|
|
69
83
|
label: field.label,
|
|
70
84
|
options: _.map(formatOption)(field.options),
|
|
71
85
|
}
|
|
72
86
|
: formatOption(field);
|
|
87
|
+
};
|
|
73
88
|
|
|
74
89
|
const getOptions = _.flow(
|
|
75
90
|
_.sortBy(_.flow(_.prop("name"), _.toLower)),
|
|
@@ -100,11 +115,13 @@ export const StructureFieldsDropdown = ({
|
|
|
100
115
|
|
|
101
116
|
return (
|
|
102
117
|
<OptionGroup
|
|
118
|
+
multiple={multiple}
|
|
103
119
|
fluid={fluid}
|
|
104
120
|
inline={inline}
|
|
105
121
|
label={label}
|
|
106
122
|
value={value}
|
|
107
123
|
onClick={onClick}
|
|
124
|
+
onChange={onChangeStructureFieldsDropdown}
|
|
108
125
|
placeholder={formatMessage({
|
|
109
126
|
id: "structureFields.dropdown.placeholder",
|
|
110
127
|
})}
|
|
@@ -120,8 +137,10 @@ StructureFieldsDropdown.propTypes = {
|
|
|
120
137
|
value: PropTypes.number,
|
|
121
138
|
structureFields: PropTypes.array,
|
|
122
139
|
onSelectField: PropTypes.func,
|
|
140
|
+
onSelectFields: PropTypes.func,
|
|
123
141
|
filters: PropTypes.object,
|
|
124
142
|
typeCastModifiers: PropTypes.array,
|
|
143
|
+
multiple: PropTypes.bool,
|
|
125
144
|
};
|
|
126
145
|
|
|
127
146
|
const mapStateToProps = (state, props) => ({
|
|
@@ -36,21 +36,31 @@ exports[`<ValueConditionStructure /> matches the latest snapshot 1`] = `
|
|
|
36
36
|
role="listbox"
|
|
37
37
|
>
|
|
38
38
|
<div
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
aria-checked="false"
|
|
40
|
+
aria-selected="true"
|
|
41
|
+
class="selected item"
|
|
42
|
+
role="option"
|
|
43
|
+
style="pointer-events: all;"
|
|
43
44
|
>
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
class="table icon"
|
|
45
|
+
<div
|
|
46
|
+
class="divider"
|
|
47
47
|
/>
|
|
48
|
-
|
|
48
|
+
<div
|
|
49
|
+
class="header"
|
|
50
|
+
>
|
|
51
|
+
<i
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
class="table icon"
|
|
54
|
+
/>
|
|
55
|
+
bar
|
|
56
|
+
</div>
|
|
49
57
|
</div>
|
|
50
58
|
<div
|
|
59
|
+
aria-checked="false"
|
|
51
60
|
aria-selected="false"
|
|
52
61
|
class="item group"
|
|
53
62
|
role="option"
|
|
63
|
+
style="pointer-events: all;"
|
|
54
64
|
>
|
|
55
65
|
<i
|
|
56
66
|
aria-hidden="true"
|
|
@@ -6,7 +6,6 @@ import { Link } from "react-router-dom";
|
|
|
6
6
|
import { linkTo } from "@truedat/core/routes";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
8
|
import Moment from "react-moment";
|
|
9
|
-
import moment from "moment";
|
|
10
9
|
import PropTypes from "prop-types";
|
|
11
10
|
|
|
12
11
|
export const GrantUserDecorator = ({ authentication, user }) => {
|
|
@@ -137,11 +136,7 @@ export const EndDateDecorator = ({ end_date, pending_removal }) => {
|
|
|
137
136
|
trigger={
|
|
138
137
|
<Header>
|
|
139
138
|
<Header.Subheader>
|
|
140
|
-
<Moment
|
|
141
|
-
locale={locale}
|
|
142
|
-
date={end_date}
|
|
143
|
-
from={moment().format("L")}
|
|
144
|
-
/>
|
|
139
|
+
<Moment locale={locale} date={end_date} fromNow />
|
|
145
140
|
</Header.Subheader>
|
|
146
141
|
</Header>
|
|
147
142
|
}
|