@trackunit/custom-field-components 2.6.16 → 2.6.18
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/index.cjs.js +3 -3
- package/index.esm.js +3 -3
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -139,7 +139,7 @@ const setupLibraryTranslations = () => {
|
|
|
139
139
|
const BooleanCustomField = ({ defaultValue = false, "data-testid": dataTestId = "booleanField", onChange, value = defaultValue, id, setValue, register, validationRules, disabled = false, readOnly = false, label, tip, isInvalid = false, errorMessage, helpAddon, maxLength, helpText, ...rest }) => {
|
|
140
140
|
const initialValue = value;
|
|
141
141
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
142
|
-
const htmlForId = id ? id :
|
|
142
|
+
const htmlForId = id ? id : `boolean-custom-field-${sharedUtils.uuidv4()}`;
|
|
143
143
|
const [internalValue, setInternalValue] = react.useState(initialValue);
|
|
144
144
|
react.useEffect(() => {
|
|
145
145
|
setInternalValue(value);
|
|
@@ -199,7 +199,7 @@ const convertToValueFormat = (value) => {
|
|
|
199
199
|
*/
|
|
200
200
|
const DropdownCustomField = ({ defaultValue, "data-testid": dataTestId, onChange, onBlur, id, disabled = false, allValues, multiSelect = false, register, validationRules, setValue, label, tip, errorMessage, helpText, isInvalid = false, helpAddon, }) => {
|
|
201
201
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
202
|
-
const htmlFor = id ? id :
|
|
202
|
+
const htmlFor = id ? id : `dropdown-custom-field-${sharedUtils.uuidv4()}`;
|
|
203
203
|
const options = react.useMemo(() => {
|
|
204
204
|
return allValues ? allValues.map(convertToValueFormat) : [];
|
|
205
205
|
}, [allValues]);
|
|
@@ -564,7 +564,7 @@ const useCustomFieldResolver = ({ field, definition, register, setValue, formSta
|
|
|
564
564
|
const value = useValue(uniqueIdentifier, numberValue, control, def, field);
|
|
565
565
|
const key = def?.key ?? uniqueIdentifier;
|
|
566
566
|
const fieldError = uniqueIdentifier ? validation.formState.errors[uniqueIdentifier] : undefined;
|
|
567
|
-
const errorMessage = fieldError ? fieldError.message
|
|
567
|
+
const errorMessage = fieldError ? `${fieldError.message}` : undefined;
|
|
568
568
|
const { description, title, __typename } = def ?? {};
|
|
569
569
|
if (!__typename || !def) {
|
|
570
570
|
return null;
|
package/index.esm.js
CHANGED
|
@@ -137,7 +137,7 @@ const setupLibraryTranslations = () => {
|
|
|
137
137
|
const BooleanCustomField = ({ defaultValue = false, "data-testid": dataTestId = "booleanField", onChange, value = defaultValue, id, setValue, register, validationRules, disabled = false, readOnly = false, label, tip, isInvalid = false, errorMessage, helpAddon, maxLength, helpText, ...rest }) => {
|
|
138
138
|
const initialValue = value;
|
|
139
139
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
140
|
-
const htmlForId = id ? id :
|
|
140
|
+
const htmlForId = id ? id : `boolean-custom-field-${uuidv4()}`;
|
|
141
141
|
const [internalValue, setInternalValue] = useState(initialValue);
|
|
142
142
|
useEffect(() => {
|
|
143
143
|
setInternalValue(value);
|
|
@@ -197,7 +197,7 @@ const convertToValueFormat = (value) => {
|
|
|
197
197
|
*/
|
|
198
198
|
const DropdownCustomField = ({ defaultValue, "data-testid": dataTestId, onChange, onBlur, id, disabled = false, allValues, multiSelect = false, register, validationRules, setValue, label, tip, errorMessage, helpText, isInvalid = false, helpAddon, }) => {
|
|
199
199
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
200
|
-
const htmlFor = id ? id :
|
|
200
|
+
const htmlFor = id ? id : `dropdown-custom-field-${uuidv4()}`;
|
|
201
201
|
const options = useMemo(() => {
|
|
202
202
|
return allValues ? allValues.map(convertToValueFormat) : [];
|
|
203
203
|
}, [allValues]);
|
|
@@ -562,7 +562,7 @@ const useCustomFieldResolver = ({ field, definition, register, setValue, formSta
|
|
|
562
562
|
const value = useValue(uniqueIdentifier, numberValue, control, def, field);
|
|
563
563
|
const key = def?.key ?? uniqueIdentifier;
|
|
564
564
|
const fieldError = uniqueIdentifier ? validation.formState.errors[uniqueIdentifier] : undefined;
|
|
565
|
-
const errorMessage = fieldError ? fieldError.message
|
|
565
|
+
const errorMessage = fieldError ? `${fieldError.message}` : undefined;
|
|
566
566
|
const { description, title, __typename } = def ?? {};
|
|
567
567
|
if (!__typename || !def) {
|
|
568
568
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/custom-field-components",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.18",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"react-select": "^5.10.2",
|
|
11
11
|
"@trackunit/react-form-components": "2.4.10",
|
|
12
12
|
"@trackunit/shared-utils": "1.16.4",
|
|
13
|
-
"@trackunit/custom-field-api": "2.7.
|
|
13
|
+
"@trackunit/custom-field-api": "2.7.18",
|
|
14
14
|
"@trackunit/iris-app-runtime-core": "1.18.4",
|
|
15
15
|
"@trackunit/react-components": "2.6.5",
|
|
16
16
|
"@trackunit/react-modal": "2.4.10",
|