@truedat/df 4.49.10 → 4.50.2

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": "4.49.10",
3
+ "version": "4.50.2",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -87,8 +87,8 @@
87
87
  ]
88
88
  },
89
89
  "dependencies": {
90
- "@truedat/auth": "4.49.10",
91
- "@truedat/core": "4.49.10",
90
+ "@truedat/auth": "4.50.2",
91
+ "@truedat/core": "4.50.2",
92
92
  "path-to-regexp": "^1.7.0",
93
93
  "prop-types": "^15.8.1",
94
94
  "react-color": "^2.17.3",
@@ -106,5 +106,5 @@
106
106
  "react-dom": ">= 16.8.6 < 17",
107
107
  "semantic-ui-react": ">= 0.88.2 < 2.1"
108
108
  },
109
- "gitHead": "fb6fcd549a722d777d692f2938dbc991c72dd3a1"
109
+ "gitHead": "5785ca8828b3c25947e8d2587c909f729fbee317"
110
110
  }
@@ -1,5 +1,6 @@
1
1
  import _ from "lodash/fp";
2
2
  import React, { useState } from "react";
3
+ import PropTypes from "prop-types";
3
4
  import { TemplateSelector } from "@truedat/core/components";
4
5
  import { applyTemplate, validateContent } from "@truedat/df/utils";
5
6
  import DynamicForm from "./DynamicForm";
@@ -13,12 +14,14 @@ export default function SelectableDynamicForm({
13
14
  name,
14
15
  onChange,
15
16
  onNameChange,
17
+ placeholder,
18
+ hideLabel,
16
19
  }) {
17
20
  const [template, setTemplate] = useState();
18
21
  const domain = _.size(domainIds) > 0 ? { id: _.head(domainIds) } : null;
19
22
 
20
- const handleChange = (content) => {
21
- onChange({ content, valid: validateContent(template)(content) });
23
+ const handleChange = (content, currentTemplate = template) => {
24
+ onChange({ content, valid: validateContent(currentTemplate)(content) });
22
25
  };
23
26
 
24
27
  const handleLoad = ({ templates }) => {
@@ -30,13 +33,19 @@ export default function SelectableDynamicForm({
30
33
  if (template?.name !== name) {
31
34
  onNameChange(template?.name);
32
35
  }
33
- handleChange(template ? applyTemplate(template)(content, domain?.id) : {});
36
+ handleChange(
37
+ template ? applyTemplate(template)(content, domain?.id) : {},
38
+ template
39
+ );
34
40
  setTemplate(template);
35
41
  };
36
42
 
37
43
  const handleSelected = (_e, { template }) => {
38
44
  onNameChange(template?.name);
39
- handleChange(template ? applyTemplate(template)(content, domain?.id) : {});
45
+ handleChange(
46
+ template ? applyTemplate(template)(content, domain?.id) : {},
47
+ template
48
+ );
40
49
  setTemplate(template);
41
50
  };
42
51
 
@@ -49,6 +58,8 @@ export default function SelectableDynamicForm({
49
58
  selectedValue={template?.id}
50
59
  onChange={handleSelected}
51
60
  onLoad={handleLoad}
61
+ placeholder={placeholder}
62
+ hideLabel={hideLabel}
52
63
  />
53
64
  {template ? (
54
65
  <>
@@ -64,3 +75,16 @@ export default function SelectableDynamicForm({
64
75
  </>
65
76
  );
66
77
  }
78
+
79
+ SelectableDynamicForm.propTypes = {
80
+ domainIds: PropTypes.array,
81
+ scope: PropTypes.string,
82
+ required: PropTypes.bool,
83
+ content: PropTypes.object,
84
+ header: PropTypes.node,
85
+ name: PropTypes.string,
86
+ onChange: PropTypes.func,
87
+ onNameChange: PropTypes.func,
88
+ placeholder: PropTypes.string,
89
+ hideLabel: PropTypes.bool,
90
+ };