@truedat/core 4.46.9 → 4.46.13

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.46.12] 2022-06-20
4
+
5
+ ### Reverted
6
+
7
+ - [TD-4894] Multiple column operator in implementation creation
8
+
3
9
  ## [4.46.6] 2022-06-20
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.46.9",
3
+ "version": "4.46.13",
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.46.9",
38
+ "@truedat/test": "4.46.12",
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": "e4b69516afe19d864531f507af8c7d0f17b2a064"
115
+ "gitHead": "89cd539e47e64a3e4a6f8bc30ea4d3b66fb0b666"
116
116
  }
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState, useEffect } from "react";
2
+ import React, { useState } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Dropdown } from "semantic-ui-react";
5
5
  import { lowerDeburr } from "../services/sort";
@@ -27,12 +27,9 @@ export const OptionGroup = ({
27
27
  options = [],
28
28
  placeholder = "Select",
29
29
  onClick,
30
- onChange,
31
30
  value,
32
- multiple,
33
31
  }) => {
34
32
  const [availableOptions, setOptions] = useState(options);
35
- const [flattenedOptions, setFlattenedOptions] = useState();
36
33
  const [open, openMenu] = useState(false);
37
34
  const [query, setQuery] = useState("");
38
35
 
@@ -58,14 +55,6 @@ export const OptionGroup = ({
58
55
  );
59
56
  };
60
57
 
61
- useEffect(() => {
62
- // eslint-disable-next-line prettier/prettier
63
- _.flow(
64
- toFlattenedShorthands,
65
- setFlattenedOptions
66
- )(availableOptions);
67
- }, [availableOptions]);
68
-
69
58
  const flatOptionMatches = (o, searchQuery) =>
70
59
  !_.has("options")(o) && optionMatches(lowerDeburr(searchQuery))(o);
71
60
 
@@ -87,10 +76,6 @@ export const OptionGroup = ({
87
76
  onClick(values);
88
77
  };
89
78
 
90
- const onChangeOptionsGroup = (e, dropdown) => {
91
- multiple && onChange(dropdown.value);
92
- };
93
-
94
79
  const findText = () =>
95
80
  _.flow(
96
81
  _.reduce(
@@ -104,43 +89,10 @@ export const OptionGroup = ({
104
89
 
105
90
  const text = value && !query && findText();
106
91
 
107
- const toFlattenedShorthands = (availableOpts) =>
108
- availableOpts.flatMap((option, i) => {
109
- const result = _.has("options")(option)
110
- ? [
111
- {
112
- key: i,
113
- children: (
114
- <>
115
- <Dropdown.Divider />
116
- <Dropdown.Header icon={option.icon} content={option.label} />
117
- </>
118
- ),
119
- },
120
- ...option.options.map((innerOption, i) => ({
121
- ...innerOption,
122
- className: "group",
123
- onClick: doOnClick,
124
- })),
125
- ]
126
- : [
127
- {
128
- ...option,
129
- className: "header",
130
- onClick: doOnClick,
131
- },
132
- ];
133
- return result;
134
- });
135
-
136
92
  return (
137
93
  <>
138
94
  {label && <label>{label}</label>}
139
-
140
95
  <Dropdown
141
- multiple={multiple}
142
- options={flattenedOptions}
143
- onChange={onChangeOptionsGroup}
144
96
  fluid={fluid}
145
97
  className="selection"
146
98
  placeholder={placeholder}
@@ -154,21 +106,41 @@ export const OptionGroup = ({
154
106
  onBlur={() => openMenu(false)}
155
107
  text={text}
156
108
  value={value}
157
- />
109
+ >
110
+ <Dropdown.Menu>
111
+ {availableOptions.map((option, i) =>
112
+ _.has("options")(option) ? (
113
+ <Group
114
+ key={i}
115
+ value={value}
116
+ onClick={doOnClick}
117
+ options={_.prop("options")(option)}
118
+ {...option}
119
+ />
120
+ ) : (
121
+ <Dropdown.Item
122
+ key={i}
123
+ {...option}
124
+ onClick={doOnClick}
125
+ className="header"
126
+ selected={value == option.value}
127
+ />
128
+ )
129
+ )}
130
+ </Dropdown.Menu>
131
+ </Dropdown>
158
132
  </>
159
133
  );
160
134
  };
161
135
 
162
136
  OptionGroup.propTypes = {
163
137
  onClick: PropTypes.func,
164
- onChange: PropTypes.func,
165
138
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
166
139
  fluid: PropTypes.bool,
167
140
  inline: PropTypes.bool,
168
141
  label: PropTypes.string,
169
142
  placeholder: PropTypes.string,
170
143
  options: PropTypes.array,
171
- multiple: PropTypes.bool,
172
144
  };
173
145
 
174
146
  export default OptionGroup;
@@ -25,70 +25,61 @@ export const SelectedFilters = ({
25
25
  toggleFilterValue,
26
26
  userFilters,
27
27
  userFilterScope,
28
- }) => {
29
- useEffect(
30
- () => () => {
31
- resetFilters();
32
- },
33
- [resetFilters]
34
- );
35
-
36
- return (
37
- <>
38
- {_.isEmpty(userFilters) ? null : (
39
- <UserFilters
40
- applyUserFilter={applyUserFilter}
41
- userFilterScope={userFilterScope}
42
- deleteUserFilter={deleteUserFilter}
43
- resetFilters={resetFilters}
44
- selectedUserFilter={selectedUserFilter}
45
- userFilters={userFilters}
46
- disabled={loading}
47
- />
28
+ }) => (
29
+ <>
30
+ {_.isEmpty(userFilters) ? null : (
31
+ <UserFilters
32
+ applyUserFilter={applyUserFilter}
33
+ userFilterScope={userFilterScope}
34
+ deleteUserFilter={deleteUserFilter}
35
+ resetFilters={resetFilters}
36
+ selectedUserFilter={selectedUserFilter}
37
+ userFilters={userFilters}
38
+ disabled={loading}
39
+ />
40
+ )}
41
+ <div className="selectedFilters">
42
+ {_.isEmpty(selectedFilters) ? null : (
43
+ <>
44
+ <div className="appliedFilters">
45
+ <FormattedMessage id="search.applied_filters" />
46
+ </div>
47
+ {selectedFilters.map((filter) => {
48
+ const options = _.isEqual(filter, selectedFilter)
49
+ ? selectedFilterValues
50
+ : null;
51
+ const props = {
52
+ key: filter,
53
+ activeValues,
54
+ closeFilter,
55
+ filter,
56
+ loading,
57
+ openFilter,
58
+ options,
59
+ removeFilter,
60
+ toggleFilterValue,
61
+ };
62
+ return selectedFilter === "taxonomy" ? (
63
+ <FilterMultilevelDropdown {...props} />
64
+ ) : (
65
+ <FilterDropdown {...props} />
66
+ );
67
+ })}
68
+ <a className="resetFilters" onClick={() => resetFilters()}>
69
+ <FormattedMessage id="search.clear_filters" />
70
+ </a>
71
+ {saveFilters && (
72
+ <ModalSaveFilter
73
+ saveFilters={saveFilters}
74
+ activeFilters={activeFilters}
75
+ scope={userFilterScope}
76
+ />
77
+ )}
78
+ </>
48
79
  )}
49
- <div className="selectedFilters">
50
- {_.isEmpty(selectedFilters) ? null : (
51
- <>
52
- <div className="appliedFilters">
53
- <FormattedMessage id="search.applied_filters" />
54
- </div>
55
- {selectedFilters.map((filter) => {
56
- const options = _.isEqual(filter, selectedFilter)
57
- ? selectedFilterValues
58
- : null;
59
- const props = {
60
- key: filter,
61
- activeValues,
62
- closeFilter,
63
- filter,
64
- loading,
65
- openFilter,
66
- options,
67
- removeFilter,
68
- toggleFilterValue,
69
- };
70
- return selectedFilter === "taxonomy" ? (
71
- <FilterMultilevelDropdown {...props} />
72
- ) : (
73
- <FilterDropdown {...props} />
74
- );
75
- })}
76
- <a className="resetFilters" onClick={() => resetFilters()}>
77
- <FormattedMessage id="search.clear_filters" />
78
- </a>
79
- {saveFilters && (
80
- <ModalSaveFilter
81
- saveFilters={saveFilters}
82
- activeFilters={activeFilters}
83
- scope={userFilterScope}
84
- />
85
- )}
86
- </>
87
- )}
88
- </div>
89
- </>
90
- );
91
- };
80
+ </div>
81
+ </>
82
+ );
92
83
 
93
84
  SelectedFilters.propTypes = {
94
85
  activeFilters: PropTypes.object,
@@ -13,7 +13,6 @@ exports[`<OptionGroup /> matches the latest snapshot 1`] = `
13
13
  minCharacters={1}
14
14
  noResultsMessage="No results found."
15
15
  onBlur={[Function]}
16
- onChange={[Function]}
17
16
  onClick={[Function]}
18
17
  onSearchChange={[Function]}
19
18
  open={false}
@@ -26,6 +25,8 @@ exports[`<OptionGroup /> matches the latest snapshot 1`] = `
26
25
  selectOnBlur={true}
27
26
  selectOnNavigation={true}
28
27
  wrapSelection={true}
29
- />
28
+ >
29
+ <DropdownMenu />
30
+ </Dropdown>
30
31
  </Fragment>
31
32
  `;