@truedat/core 4.47.9 → 4.48.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 +12 -0
- package/package.json +2 -2
- package/src/components/DateRangeFilter.js +0 -6
- package/src/components/OptionGroup.js +1 -19
- package/src/components/TemplateSelector.js +10 -9
- package/src/components/UserFilters.js +2 -2
- package/src/components/__tests__/__snapshots__/UserFilters.spec.js.snap +2 -2
- package/src/messages/en.js +3 -0
- package/src/messages/es.js +4 -0
- package/src/services/axios.js +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.48.3] 2022-07-11
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-3614] Always include Bearer token if present in localStorage
|
|
8
|
+
|
|
9
|
+
## [4.48.2] 2022-07-08
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-4995] Support localization of template fields and fixed values
|
|
14
|
+
|
|
3
15
|
## [4.47.5] 2022-06-30
|
|
4
16
|
|
|
5
17
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.48.3",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -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": "
|
|
115
|
+
"gitHead": "5b30312f30c532988985ab9271d1e39ad0ad5c43"
|
|
116
116
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import moment from "moment";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { useIntl } from "react-intl";
|
|
5
|
-
import { Form, Input, Label, Dropdown } from "semantic-ui-react";
|
|
6
4
|
import { DatesRangeInput } from "semantic-ui-calendar-react";
|
|
7
5
|
|
|
8
6
|
const validNumber = (value) => RegExp("^\\d+$").test(value);
|
|
@@ -10,10 +8,8 @@ const validRange = (value) =>
|
|
|
10
8
|
RegExp("^\\d{4}-\\d\\d-\\d\\d *- *\\d{4}-\\d\\d-\\d\\d$").test(value);
|
|
11
9
|
|
|
12
10
|
export const DateRangeFilter = ({
|
|
13
|
-
label,
|
|
14
11
|
onChange,
|
|
15
12
|
defaultValues,
|
|
16
|
-
size = "small",
|
|
17
13
|
name = "date",
|
|
18
14
|
dateFormat = "YYYY-MM-DD",
|
|
19
15
|
}) => {
|
|
@@ -47,10 +43,8 @@ export const DateRangeFilter = ({
|
|
|
47
43
|
DateRangeFilter.propTypes = {
|
|
48
44
|
dateFormat: PropTypes.string,
|
|
49
45
|
defaultValues: PropTypes.object,
|
|
50
|
-
label: PropTypes.node,
|
|
51
46
|
name: PropTypes.string,
|
|
52
47
|
onChange: PropTypes.func,
|
|
53
|
-
size: PropTypes.string,
|
|
54
48
|
};
|
|
55
49
|
|
|
56
50
|
export default DateRangeFilter;
|
|
@@ -4,21 +4,6 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { Dropdown } from "semantic-ui-react";
|
|
5
5
|
import { lowerDeburr } from "../services/sort";
|
|
6
6
|
|
|
7
|
-
const Group = ({ label, icon, options, onClick, value }) => (
|
|
8
|
-
<>
|
|
9
|
-
<Dropdown.Divider />
|
|
10
|
-
<Dropdown.Header icon={icon} content={label} />
|
|
11
|
-
{options.map((option, i) => (
|
|
12
|
-
<Dropdown.Item
|
|
13
|
-
key={i}
|
|
14
|
-
className="group"
|
|
15
|
-
{...option}
|
|
16
|
-
onClick={onClick}
|
|
17
|
-
selected={value == option.value}
|
|
18
|
-
/>
|
|
19
|
-
))}
|
|
20
|
-
</>
|
|
21
|
-
);
|
|
22
7
|
// TODO: Refactor
|
|
23
8
|
export const OptionGroup = ({
|
|
24
9
|
fluid,
|
|
@@ -62,10 +47,7 @@ export const OptionGroup = ({
|
|
|
62
47
|
|
|
63
48
|
useEffect(() => {
|
|
64
49
|
// eslint-disable-next-line prettier/prettier
|
|
65
|
-
_.flow(
|
|
66
|
-
toFlattenedShorthands,
|
|
67
|
-
setFlattenedOptions
|
|
68
|
-
)(availableOptions);
|
|
50
|
+
_.flow(toFlattenedShorthands, setFlattenedOptions)(availableOptions);
|
|
69
51
|
}, [availableOptions]);
|
|
70
52
|
|
|
71
53
|
const flatOptionMatches = (o, searchQuery) =>
|
|
@@ -7,14 +7,15 @@ import { useQuery } from "@apollo/client";
|
|
|
7
7
|
import { accentInsensitivePathOrder } from "../services/sort";
|
|
8
8
|
import { TEMPLATES_QUERY } from "../api/queries";
|
|
9
9
|
|
|
10
|
-
const makeOptions =
|
|
11
|
-
_.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)
|
|
10
|
+
const makeOptions = (formatMessage) =>
|
|
11
|
+
_.flow(
|
|
12
|
+
_.map(({ label, id: value }) => ({
|
|
13
|
+
key: value,
|
|
14
|
+
value,
|
|
15
|
+
text: formatMessage({ id: `templates.${label}`, defaultMessage: label }),
|
|
16
|
+
})),
|
|
17
|
+
_.sortBy(accentInsensitivePathOrder("text"))
|
|
18
|
+
);
|
|
18
19
|
|
|
19
20
|
export const TemplateSelector = ({
|
|
20
21
|
clearable,
|
|
@@ -26,7 +27,7 @@ export const TemplateSelector = ({
|
|
|
26
27
|
templates,
|
|
27
28
|
}) => {
|
|
28
29
|
const { formatMessage } = useIntl();
|
|
29
|
-
const options = makeOptions(templates);
|
|
30
|
+
const options = makeOptions(formatMessage)(templates);
|
|
30
31
|
const hidden = loading ? false : _.size(templates) <= 1;
|
|
31
32
|
|
|
32
33
|
const handleChange = (e, { value, ...data }) => {
|
|
@@ -16,11 +16,11 @@ export const UserFilters = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
return _.isEmpty(userFilters) ? null : (
|
|
18
18
|
<div className="selectedFilters">
|
|
19
|
-
{userFilters.map((userFilter,
|
|
19
|
+
{userFilters.map((userFilter, key) => (
|
|
20
20
|
<Label
|
|
21
21
|
basic={selectedUserFilter == userFilter.name ? false : true}
|
|
22
22
|
circular
|
|
23
|
-
key={
|
|
23
|
+
key={key}
|
|
24
24
|
>
|
|
25
25
|
<span
|
|
26
26
|
onClick={
|
|
@@ -7,7 +7,7 @@ exports[`<UserFilters /> matches the latest snapshot 1`] = `
|
|
|
7
7
|
<Label
|
|
8
8
|
basic={true}
|
|
9
9
|
circular={true}
|
|
10
|
-
key="
|
|
10
|
+
key="0"
|
|
11
11
|
>
|
|
12
12
|
<span
|
|
13
13
|
className="userFilter"
|
|
@@ -51,7 +51,7 @@ exports[`<UserFilters /> matches the latest snapshot 1`] = `
|
|
|
51
51
|
<Label
|
|
52
52
|
basic={true}
|
|
53
53
|
circular={true}
|
|
54
|
-
key="
|
|
54
|
+
key="1"
|
|
55
55
|
>
|
|
56
56
|
<span
|
|
57
57
|
className="userFilter"
|
package/src/messages/en.js
CHANGED
|
@@ -113,4 +113,7 @@ export default {
|
|
|
113
113
|
"sidemenu.taxonomy": "Taxonomy",
|
|
114
114
|
"sidemenu.templates": "Templates",
|
|
115
115
|
"sidemenu.users": "Users",
|
|
116
|
+
"view.unauthorized.content":
|
|
117
|
+
"If you want to update your permissions, please contact the administrator.",
|
|
118
|
+
"view.unauthorized.head": "You are not authorized to view this content",
|
|
116
119
|
};
|
package/src/messages/es.js
CHANGED
|
@@ -116,4 +116,8 @@ export default {
|
|
|
116
116
|
"sidemenu.taxonomy": "Dominios",
|
|
117
117
|
"sidemenu.templates": "Plantillas",
|
|
118
118
|
"sidemenu.users": "Usuarios",
|
|
119
|
+
"view.unauthorized.head":
|
|
120
|
+
"No dispones de autorización para ver este contenido",
|
|
121
|
+
"view.unauthorized.content":
|
|
122
|
+
"Si quiere actualizar sus permisos, por favor contacte con el administrador.",
|
|
119
123
|
};
|
package/src/services/axios.js
CHANGED
|
@@ -4,16 +4,15 @@ import { readToken } from "./storage";
|
|
|
4
4
|
axios.interceptors.request.use(
|
|
5
5
|
function (config) {
|
|
6
6
|
const token = readToken();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return config;
|
|
7
|
+
return token === null
|
|
8
|
+
? config
|
|
9
|
+
: {
|
|
10
|
+
...config,
|
|
11
|
+
headers: {
|
|
12
|
+
...config.headers,
|
|
13
|
+
Authorization: `Bearer ${token}`,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
17
16
|
},
|
|
18
17
|
function (err) {
|
|
19
18
|
return Promise.reject(err);
|