@trackunit/custom-field-components 1.22.3 → 1.22.4
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 +2 -4
- package/index.esm.js +3 -5
- package/package.json +9 -10
package/index.cjs.js
CHANGED
|
@@ -7,7 +7,6 @@ var reactFormComponents = require('@trackunit/react-form-components');
|
|
|
7
7
|
var sharedUtils = require('@trackunit/shared-utils');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var reactHookForm = require('react-hook-form');
|
|
10
|
-
var reactDateAndTimeHooks = require('@trackunit/react-date-and-time-hooks');
|
|
11
10
|
var reactComponents = require('@trackunit/react-components');
|
|
12
11
|
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
13
12
|
var reactModal = require('@trackunit/react-modal');
|
|
@@ -169,16 +168,15 @@ const BooleanCustomField = ({ defaultValue = false, "data-testid": dataTestId =
|
|
|
169
168
|
*/
|
|
170
169
|
const DateCustomField = (props) => {
|
|
171
170
|
const { setValue, defaultValue, register, id, validationRules, ...rest } = props;
|
|
172
|
-
const { YYYYMMDDToUTCMidnightISO } = reactDateAndTimeHooks.useDateAndTime();
|
|
173
171
|
const onChangeHandler = react.useCallback((e) => {
|
|
174
172
|
if (setValue) {
|
|
175
|
-
const isoUTC =
|
|
173
|
+
const isoUTC = reactFormComponents.toISODateStringUTC(e.target.value);
|
|
176
174
|
setValue(id, isoUTC ?? undefined, {
|
|
177
175
|
shouldDirty: true,
|
|
178
176
|
shouldValidate: true,
|
|
179
177
|
});
|
|
180
178
|
}
|
|
181
|
-
}, [setValue, id
|
|
179
|
+
}, [setValue, id]);
|
|
182
180
|
react.useEffect(() => {
|
|
183
181
|
const value = Boolean(defaultValue) && defaultValue !== undefined ? new Date(defaultValue) : undefined;
|
|
184
182
|
if (register) {
|
package/index.esm.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
|
|
3
3
|
import { getCustomFieldValueForDisplayInUI } from '@trackunit/iris-app-runtime-core';
|
|
4
|
-
import { FormGroup, Checkbox, DateField, MultiSelectField, SelectField, TextBaseInput, useGetPhoneValidationRules, NumberField, TextField, PhoneField, ActionButton } from '@trackunit/react-form-components';
|
|
4
|
+
import { FormGroup, Checkbox, toISODateStringUTC, DateField, MultiSelectField, SelectField, TextBaseInput, useGetPhoneValidationRules, NumberField, TextField, PhoneField, ActionButton } from '@trackunit/react-form-components';
|
|
5
5
|
import { uuidv4, exhaustiveCheck } from '@trackunit/shared-utils';
|
|
6
6
|
import { useState, useEffect, useCallback, createElement, useMemo } from 'react';
|
|
7
7
|
import { Controller, useWatch } from 'react-hook-form';
|
|
8
|
-
import { useDateAndTime } from '@trackunit/react-date-and-time-hooks';
|
|
9
8
|
import { Card, CardHeader, Tooltip, CardBody, Text, CardFooter, Button, IconButton, Icon } from '@trackunit/react-components';
|
|
10
9
|
import { useConfirmationDialog } from '@trackunit/react-core-hooks';
|
|
11
10
|
import { useModal, Modal, ModalHeader, ModalBody, ModalFooter } from '@trackunit/react-modal';
|
|
@@ -167,16 +166,15 @@ const BooleanCustomField = ({ defaultValue = false, "data-testid": dataTestId =
|
|
|
167
166
|
*/
|
|
168
167
|
const DateCustomField = (props) => {
|
|
169
168
|
const { setValue, defaultValue, register, id, validationRules, ...rest } = props;
|
|
170
|
-
const { YYYYMMDDToUTCMidnightISO } = useDateAndTime();
|
|
171
169
|
const onChangeHandler = useCallback((e) => {
|
|
172
170
|
if (setValue) {
|
|
173
|
-
const isoUTC =
|
|
171
|
+
const isoUTC = toISODateStringUTC(e.target.value);
|
|
174
172
|
setValue(id, isoUTC ?? undefined, {
|
|
175
173
|
shouldDirty: true,
|
|
176
174
|
shouldValidate: true,
|
|
177
175
|
});
|
|
178
176
|
}
|
|
179
|
-
}, [setValue, id
|
|
177
|
+
}, [setValue, id]);
|
|
180
178
|
useEffect(() => {
|
|
181
179
|
const value = Boolean(defaultValue) && defaultValue !== undefined ? new Date(defaultValue) : undefined;
|
|
182
180
|
if (register) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/custom-field-components",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.4",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,16 +8,15 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react-select": "^5.10.2",
|
|
11
|
-
"@trackunit/react-
|
|
12
|
-
"@trackunit/react-form-components": "1.23.2",
|
|
11
|
+
"@trackunit/react-form-components": "1.23.3",
|
|
13
12
|
"@trackunit/shared-utils": "1.13.117",
|
|
14
|
-
"@trackunit/custom-field-api": "1.22.
|
|
15
|
-
"@trackunit/iris-app-runtime-core": "1.15.
|
|
16
|
-
"@trackunit/react-components": "1.22.
|
|
17
|
-
"@trackunit/react-modal": "1.23.
|
|
18
|
-
"@trackunit/react-core-hooks": "1.15.
|
|
19
|
-
"@trackunit/i18n-library-translation": "1.19.
|
|
20
|
-
"@trackunit/iris-app-runtime-core-api": "1.14.
|
|
13
|
+
"@trackunit/custom-field-api": "1.22.4",
|
|
14
|
+
"@trackunit/iris-app-runtime-core": "1.15.33",
|
|
15
|
+
"@trackunit/react-components": "1.22.26",
|
|
16
|
+
"@trackunit/react-modal": "1.23.3",
|
|
17
|
+
"@trackunit/react-core-hooks": "1.15.35",
|
|
18
|
+
"@trackunit/i18n-library-translation": "1.19.3",
|
|
19
|
+
"@trackunit/iris-app-runtime-core-api": "1.14.33"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"@apollo/client": "^3.13.8",
|