tp-react-elements-dev 1.14.2 → 1.14.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/dist/_virtual/index.esm12.js +2 -2
- package/dist/_virtual/index.esm13.js +2 -2
- package/dist/_virtual/index.esm4.js +2 -2
- package/dist/_virtual/index.esm5.js +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.esm.js +10 -8
- package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateInput/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/InputRangeField/index.esm.js +1 -1
- package/package.json +1 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DateInput = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DateInput as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var InputRangeField = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { InputRangeField as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var DefinedRange = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { DefinedRange as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Calendar = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Calendar as __exports };
|
|
@@ -4,8 +4,10 @@ import { Controller } from 'react-hook-form';
|
|
|
4
4
|
import { d as distExports } from '../../_virtual/index.esm.js';
|
|
5
5
|
import FormBottomField from '../FormComponents/FormBottomField/FormBottomField.esm.js';
|
|
6
6
|
import { Box, TextField, Popover } from '@mui/material';
|
|
7
|
-
import
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
8
9
|
|
|
10
|
+
dayjs.extend(customParseFormat);
|
|
9
11
|
const DateRangePickerComponent = ({ item, control, watch, setValue, getValues, clearErrors, errors, register, }) => {
|
|
10
12
|
// Using a generic type for anchorEl to avoid environment-specific linting issues.
|
|
11
13
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -16,8 +18,8 @@ const DateRangePickerComponent = ({ item, control, watch, setValue, getValues, c
|
|
|
16
18
|
const getValidDate = (dateString) => {
|
|
17
19
|
if (!dateString)
|
|
18
20
|
return undefined;
|
|
19
|
-
const date =
|
|
20
|
-
return isValid(
|
|
21
|
+
const date = dayjs(dateString, 'DD/MM/YYYY');
|
|
22
|
+
return date.isValid() ? date.toDate() : undefined;
|
|
21
23
|
};
|
|
22
24
|
const [state, setState] = useState([
|
|
23
25
|
{
|
|
@@ -46,9 +48,9 @@ const DateRangePickerComponent = ({ item, control, watch, setValue, getValues, c
|
|
|
46
48
|
const open = Boolean(anchorEl);
|
|
47
49
|
const id = open ? 'date-range-popover' : undefined;
|
|
48
50
|
const displayValue = state[0].startDate && state[0].endDate
|
|
49
|
-
? `${
|
|
51
|
+
? `${dayjs(state[0].startDate).format('DD/MM/YYYY')} - ${dayjs(state[0].endDate).format('DD/MM/YYYY')}`
|
|
50
52
|
: '';
|
|
51
|
-
return (jsxs(Fragment, { children: [jsx(Box, { onClick: handleClick, sx: { width: '100%' }, children: jsx(Controller, { name: fromDateName, control: control, render: ({ fieldState }) => (jsx(TextField, { fullWidth: true, value: displayValue, placeholder: item.placeholder || '
|
|
53
|
+
return (jsxs(Fragment, { children: [jsx(Box, { onClick: handleClick, sx: { width: '100%' }, children: jsx(Controller, { name: fromDateName, control: control, render: ({ fieldState }) => (jsx(TextField, { fullWidth: true, value: displayValue, placeholder: item.placeholder || 'DD/MM/YYYY - DD/MM/YYYY', error: !!fieldState.error, InputProps: {
|
|
52
54
|
readOnly: true,
|
|
53
55
|
}, size: "small" })) }) }), jsx(Popover, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: {
|
|
54
56
|
vertical: 'bottom',
|
|
@@ -62,15 +64,15 @@ const DateRangePickerComponent = ({ item, control, watch, setValue, getValues, c
|
|
|
62
64
|
const selection = range.selection;
|
|
63
65
|
setState([selection]);
|
|
64
66
|
if (selection.startDate) {
|
|
65
|
-
setValue(fromDateName,
|
|
67
|
+
setValue(fromDateName, dayjs(selection.startDate).format('DD/MM/YYYY'), { shouldValidate: true, shouldDirty: true });
|
|
66
68
|
}
|
|
67
69
|
if (selection.endDate) {
|
|
68
|
-
setValue(toDateName,
|
|
70
|
+
setValue(toDateName, dayjs(selection.endDate).format('DD/MM/YYYY'), { shouldValidate: true, shouldDirty: true });
|
|
69
71
|
}
|
|
70
72
|
if (selection.startDate && selection.endDate && selection.startDate?.getTime() !== selection.endDate?.getTime()) {
|
|
71
73
|
handleClose();
|
|
72
74
|
}
|
|
73
|
-
}, moveRangeOnFirstSelection: false, ranges: state, months: 2, direction: "horizontal", showDateDisplay: false, dateDisplayFormat: "
|
|
75
|
+
}, moveRangeOnFirstSelection: false, ranges: state, months: 2, direction: "horizontal", showDateDisplay: false, dateDisplayFormat: "DD/MM/YYYY", rangeColors: ['#82a7e2'] }) }), jsx(FormBottomField, { item,
|
|
74
76
|
control,
|
|
75
77
|
errors,
|
|
76
78
|
getValues,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as Calendar } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as Calendar } from '../../../../../_virtual/index.esm5.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireDayCell } from '../DayCell/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DateInput } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DateInput } from '../../../../../_virtual/index.esm12.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireClassnames } from '../../../../classnames/index.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as DefinedRange } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as DefinedRange } from '../../../../../_virtual/index.esm4.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
import { __require as requireStyles } from '../../styles.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as InputRangeField } from '../../../../../_virtual/index.
|
|
1
|
+
import { __exports as InputRangeField } from '../../../../../_virtual/index.esm13.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tp-react-elements-dev",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "React form components library built with React Hook Form and Yup",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"@mui/material": ">=7.3.1 <8.0.0",
|
|
87
87
|
"@mui/x-date-pickers": ">=8.10.2 <9.0.0",
|
|
88
88
|
"crypto-js": ">=4.2.0 <5.0.0",
|
|
89
|
-
"date-fns": ">=3.0.0 <4.0.0",
|
|
90
89
|
"dayjs": ">=1.11.13 <2.0.0",
|
|
91
90
|
"file-saver": ">=2.0.5 <3.0.0",
|
|
92
91
|
"jodit": ">=4.6.2 <5.0.0",
|
|
@@ -138,7 +137,6 @@
|
|
|
138
137
|
"@vitest/ui": "^3.0.0",
|
|
139
138
|
"cross-env": "^10.0.0",
|
|
140
139
|
"crypto-js": "^4.2.0",
|
|
141
|
-
"date-fns": "^3.6.0",
|
|
142
140
|
"dayjs": "^1.11.13",
|
|
143
141
|
"eslint": "^9.12.0",
|
|
144
142
|
"eslint-config-prettier": "^9.1.0",
|