@truedat/df 5.7.6 → 5.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/df",
3
- "version": "5.7.6",
3
+ "version": "5.8.0",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "5.7.5",
37
+ "@truedat/test": "5.8.0",
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",
@@ -87,8 +87,8 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@apollo/client": "^3.7.1",
90
- "@truedat/auth": "5.7.5",
91
- "@truedat/core": "5.7.5",
90
+ "@truedat/auth": "5.8.0",
91
+ "@truedat/core": "5.8.0",
92
92
  "decode-uri-component": "^0.2.2",
93
93
  "path-to-regexp": "^1.7.0",
94
94
  "prop-types": "^15.8.1",
@@ -109,5 +109,5 @@
109
109
  "react-dom": ">= 16.8.6 < 17",
110
110
  "semantic-ui-react": ">= 2.0.3 < 2.2"
111
111
  },
112
- "gitHead": "0afdc4cca93cdc906072d6e7371e6a051721f59c"
112
+ "gitHead": "dd51c78f3143413ec2bc9a77001d3b648fe92d0a"
113
113
  }
@@ -27,6 +27,7 @@ const validateHierarchy = (hierarchy) => {
27
27
  const hasError =
28
28
  _.isEmpty(node.name) ||
29
29
  node.name === "" ||
30
+ node.name.includes("/") ||
30
31
  hasDuplicatedSiblings(node, hierarchy);
31
32
  return {
32
33
  ...node,
@@ -82,9 +82,24 @@ export const DynamicField = ({
82
82
  }) => (
83
83
  <Form.Field disabled={!editable && isModification} data-testid="form-field">
84
84
  <label>
85
- {label ? (
85
+ {(label && fieldProps.type != "hierarchy") ||
86
+ (fieldProps.type == "hierarchy" &&
87
+ fieldProps.values.hierarchy.min_depth == 0) ? (
86
88
  <FormattedMessage id={`fields.${label}`} defaultMessage={label} />
87
89
  ) : null}
90
+ {label &&
91
+ fieldProps.type == "hierarchy" &&
92
+ fieldProps.values.hierarchy.min_depth > 0 ? (
93
+ <>
94
+ <FormattedMessage id={`fields.${label}`} defaultMessage={label} />
95
+ <Label pointing="left">
96
+ <FormattedMessage
97
+ id="hierarchy.selectable.mindepth"
98
+ values={{ depth: fieldProps.values.hierarchy.min_depth }}
99
+ />
100
+ </Label>
101
+ </>
102
+ ) : null}
88
103
  {fieldProps?.required && (
89
104
  <span
90
105
  style={{
@@ -32,7 +32,6 @@ export const HierarchyDropdown = ({
32
32
  };
33
33
 
34
34
  const multiple = _.includes(cardinality)(["+", "*"]);
35
-
36
35
  return (
37
36
  <>
38
37
  {loading ? <Form.Input loading /> : null}
@@ -8,7 +8,7 @@ describe("<HierarchyDropdown />", () => {
8
8
  name: "foo",
9
9
  cardinality: "*",
10
10
  value: "",
11
- values: { hierarchy: 50 },
11
+ values: { hierarchy: { id: 50, min_depth: null } },
12
12
  },
13
13
  onChange: jest.fn(),
14
14
  };
@@ -26,6 +26,7 @@ export default {
26
26
  "hierarchy.name": "Hierarchy name",
27
27
  "hierarchy.new_node": "New node",
28
28
  "hierarchy.node": "Node",
29
+ "hierarchy.selectable.mindepth": "Selectable minimum level: {depth}",
29
30
  "navigation.admin.templates": "Templates",
30
31
  "navigation.hierarchies": "Hierarchies",
31
32
  "navigation.templates": "Templates",
@@ -69,6 +70,8 @@ export default {
69
70
  "template.field.type.copy": "File Structure",
70
71
  "template.field.type.date": "Date",
71
72
  "template.field.type.datetime": "Date Time",
73
+ "template.field.type.depth":
74
+ "Selectable minimun level (to allow everything, set value: 0)",
72
75
  "template.field.type.domain": "Domain",
73
76
  "template.field.type.enriched_text": "Enriched text",
74
77
  "template.field.type.float": "Float",
@@ -26,6 +26,7 @@ export default {
26
26
  "hierarchy.name": "Nombre de jerarquía",
27
27
  "hierarchy.new_node": "Nuevo nodo",
28
28
  "hierarchy.node": "Nodo",
29
+ "hierarchy.selectable.mindepth": "Nivel minimo seleccionable: {depth}",
29
30
  "navigation.admin.templates": "Plantillas",
30
31
  "navigation.hierarchies": "Jerarquías",
31
32
  "navigation.templates": "Plantillas",
@@ -69,6 +70,8 @@ export default {
69
70
  "template.field.type.copy": "Estructura de Fichero",
70
71
  "template.field.type.date": "Fecha",
71
72
  "template.field.type.datetime": "Fecha Hora",
73
+ "template.field.type.depth":
74
+ "Nivel mínimo seleccionable (para permitir todo, establecer valor: 0)",
72
75
  "template.field.type.domain": "Dominio",
73
76
  "template.field.type.enriched_text": "Texto enriquecido",
74
77
  "template.field.type.float": "Decimal",
@@ -1,19 +1,18 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState, useEffect } from "react";
2
+ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { useIntl } from "react-intl";
5
5
  import { Form } from "semantic-ui-react";
6
6
  import { useHierarchies } from "../../../hooks/useHierarchies";
7
7
 
8
- export const HierarchiesList = ({
9
- hierarchies,
10
- onChange,
11
- values: value,
12
- loading,
13
- }) => {
8
+ export const HierarchiesList = ({ hierarchies, onChange, values, loading }) => {
14
9
  const { formatMessage } = useIntl();
15
10
 
16
- const handleChange = (_e, { value }) => onChange(value);
11
+ const handleChange = (_e, { value, name }) =>
12
+ onChange({
13
+ ...values,
14
+ [name]: value,
15
+ });
17
16
 
18
17
  const options = _.flow(
19
18
  _.map(({ id, name }) => ({ text: name, value: id })),
@@ -24,9 +23,10 @@ export const HierarchiesList = ({
24
23
  <Form.Group size="small" widths="equal">
25
24
  <Form.Dropdown
26
25
  required
26
+ name="id"
27
27
  selection
28
28
  label={
29
- value === ""
29
+ values?.id === ""
30
30
  ? ""
31
31
  : formatMessage({ id: "template.field.type.hierarchy" })
32
32
  }
@@ -36,7 +36,15 @@ export const HierarchiesList = ({
36
36
  })}
37
37
  onChange={handleChange}
38
38
  options={options}
39
- value={value}
39
+ value={values?.id}
40
+ />
41
+ <Form.Input
42
+ type="number"
43
+ required
44
+ name="min_depth"
45
+ label={formatMessage({ id: "template.field.type.depth" })}
46
+ onChange={handleChange}
47
+ value={values.min_depth}
40
48
  />
41
49
  </Form.Group>
42
50
  );
@@ -45,7 +53,6 @@ export const HierarchiesList = ({
45
53
  HierarchiesList.propTypes = {
46
54
  hierarchies: PropTypes.array,
47
55
  onChange: PropTypes.func,
48
- onDefaultValueChange: PropTypes.func,
49
56
  values: PropTypes.number,
50
57
  loading: PropTypes.bool,
51
58
  };