@gustavo-valsechi/client 1.4.281 → 1.4.282
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/src/components/types/form/types/datetime/index.js +1 -2
- package/dist/src/components/types/form/types/datetime/index.mjs +1 -2
- package/dist/src/components/types/form/types/datetime/picker/index.js +9 -13
- package/dist/src/components/types/form/types/datetime/picker/index.mjs +9 -13
- package/dist/src/contexts/target/index.js +0 -1
- package/dist/src/contexts/target/index.mjs +0 -1
- package/package.json +1 -1
|
@@ -71,7 +71,7 @@ function InputDateTime(props) {
|
|
|
71
71
|
};
|
|
72
72
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { className: props.className, error: props.error, disabled: props.disabled, children: [
|
|
73
73
|
!!props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.InputLabel, { optional: props.optional, children: props.label }),
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "input-content", children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: inputRef, className: "input-content", children: [
|
|
75
75
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
@@ -81,7 +81,6 @@ function InputDateTime(props) {
|
|
|
81
81
|
if (props.onFocus) props.onFocus(props.name);
|
|
82
82
|
},
|
|
83
83
|
...register,
|
|
84
|
-
ref: inputRef,
|
|
85
84
|
onChange
|
|
86
85
|
}
|
|
87
86
|
),
|
|
@@ -38,7 +38,7 @@ function InputDateTime(props) {
|
|
|
38
38
|
};
|
|
39
39
|
return /* @__PURE__ */ jsxs(Container, { className: props.className, error: props.error, disabled: props.disabled, children: [
|
|
40
40
|
!!props.label && /* @__PURE__ */ jsx(InputLabel, { optional: props.optional, children: props.label }),
|
|
41
|
-
/* @__PURE__ */ jsxs("div", { className: "input-content", children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { ref: inputRef, className: "input-content", children: [
|
|
42
42
|
/* @__PURE__ */ jsx(
|
|
43
43
|
"input",
|
|
44
44
|
{
|
|
@@ -48,7 +48,6 @@ function InputDateTime(props) {
|
|
|
48
48
|
if (props.onFocus) props.onFocus(props.name);
|
|
49
49
|
},
|
|
50
50
|
...register,
|
|
51
|
-
ref: inputRef,
|
|
52
51
|
onChange
|
|
53
52
|
}
|
|
54
53
|
),
|
|
@@ -38,23 +38,23 @@ var import_react = require("react");
|
|
|
38
38
|
var import_contexts = require("../../../../../../contexts");
|
|
39
39
|
var import_styles = require("./styles");
|
|
40
40
|
var import_LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
41
|
-
var
|
|
41
|
+
var import_AdapterMoment = require("@mui/x-date-pickers/AdapterMoment");
|
|
42
42
|
var import_DateCalendar = require("@mui/x-date-pickers/DateCalendar");
|
|
43
43
|
var import_MultiSectionDigitalClock = require("@mui/x-date-pickers/MultiSectionDigitalClock");
|
|
44
44
|
var import_x_date_pickers = require("@mui/x-date-pickers");
|
|
45
45
|
var import_locales = require("@mui/x-date-pickers/locales");
|
|
46
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
47
46
|
var import_utils = __toESM(require("@gustavo-valsechi/utils"));
|
|
48
47
|
function InputDateTimePicker(props) {
|
|
49
48
|
const theme = (0, import_contexts.useTheme)();
|
|
50
|
-
const [dateTime, setDateTime] = (0, import_react.useState)(
|
|
49
|
+
const [dateTime, setDateTime] = (0, import_react.useState)(import_utils.default.moment());
|
|
51
50
|
(0, import_react.useEffect)(() => {
|
|
52
|
-
if (props.setValue)
|
|
51
|
+
if (!props.setValue) return;
|
|
52
|
+
props.setValue(props.name, import_utils.default.moment(dateTime.startOf("minutes").toDate()).format("YYYY-MM-DD HH:mm"));
|
|
53
53
|
}, [dateTime]);
|
|
54
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
55
|
import_LocalizationProvider.LocalizationProvider,
|
|
56
56
|
{
|
|
57
|
-
dateAdapter:
|
|
57
|
+
dateAdapter: import_AdapterMoment.AdapterMoment,
|
|
58
58
|
adapterLocale: "pt-br",
|
|
59
59
|
localeText: import_locales.ptBR.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
60
60
|
children: theme.content.isMobile ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.MobileContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -74,9 +74,7 @@ function InputDateTimePicker(props) {
|
|
|
74
74
|
value: dateTime,
|
|
75
75
|
onChange: (newDate) => {
|
|
76
76
|
if (!newDate) return;
|
|
77
|
-
setDateTime(
|
|
78
|
-
(prev) => prev.year(newDate.year()).month(newDate.month()).date(newDate.date())
|
|
79
|
-
);
|
|
77
|
+
setDateTime(newDate);
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
),
|
|
@@ -87,11 +85,9 @@ function InputDateTimePicker(props) {
|
|
|
87
85
|
minutesStep: 1,
|
|
88
86
|
timeSteps: { minutes: 1 },
|
|
89
87
|
ampm: false,
|
|
90
|
-
onChange: (
|
|
91
|
-
if (!
|
|
92
|
-
setDateTime(
|
|
93
|
-
(prev) => prev.hour(newTime.hour()).minute(newTime.minute())
|
|
94
|
-
);
|
|
88
|
+
onChange: (newDate) => {
|
|
89
|
+
if (!newDate) return;
|
|
90
|
+
setDateTime(newDate);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
)
|
|
@@ -5,23 +5,23 @@ import { useEffect, useState } from "react";
|
|
|
5
5
|
import { useTheme } from "../../../../../../contexts";
|
|
6
6
|
import { Container, MobileContainer } from "./styles";
|
|
7
7
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
8
|
-
import {
|
|
8
|
+
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
|
9
9
|
import { DateCalendar } from "@mui/x-date-pickers/DateCalendar";
|
|
10
10
|
import { MultiSectionDigitalClock } from "@mui/x-date-pickers/MultiSectionDigitalClock";
|
|
11
11
|
import { StaticDateTimePicker, PickersLayout } from "@mui/x-date-pickers";
|
|
12
12
|
import { ptBR } from "@mui/x-date-pickers/locales";
|
|
13
|
-
import dayjs from "dayjs";
|
|
14
13
|
import Utils from "@gustavo-valsechi/utils";
|
|
15
14
|
function InputDateTimePicker(props) {
|
|
16
15
|
const theme = useTheme();
|
|
17
|
-
const [dateTime, setDateTime] = useState(
|
|
16
|
+
const [dateTime, setDateTime] = useState(Utils.moment());
|
|
18
17
|
useEffect(() => {
|
|
19
|
-
if (props.setValue)
|
|
18
|
+
if (!props.setValue) return;
|
|
19
|
+
props.setValue(props.name, Utils.moment(dateTime.startOf("minutes").toDate()).format("YYYY-MM-DD HH:mm"));
|
|
20
20
|
}, [dateTime]);
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
22
|
LocalizationProvider,
|
|
23
23
|
{
|
|
24
|
-
dateAdapter:
|
|
24
|
+
dateAdapter: AdapterMoment,
|
|
25
25
|
adapterLocale: "pt-br",
|
|
26
26
|
localeText: ptBR.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
27
27
|
children: theme.content.isMobile ? /* @__PURE__ */ jsx(MobileContainer, { children: /* @__PURE__ */ jsx(
|
|
@@ -41,9 +41,7 @@ function InputDateTimePicker(props) {
|
|
|
41
41
|
value: dateTime,
|
|
42
42
|
onChange: (newDate) => {
|
|
43
43
|
if (!newDate) return;
|
|
44
|
-
setDateTime(
|
|
45
|
-
(prev) => prev.year(newDate.year()).month(newDate.month()).date(newDate.date())
|
|
46
|
-
);
|
|
44
|
+
setDateTime(newDate);
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
),
|
|
@@ -54,11 +52,9 @@ function InputDateTimePicker(props) {
|
|
|
54
52
|
minutesStep: 1,
|
|
55
53
|
timeSteps: { minutes: 1 },
|
|
56
54
|
ampm: false,
|
|
57
|
-
onChange: (
|
|
58
|
-
if (!
|
|
59
|
-
setDateTime(
|
|
60
|
-
(prev) => prev.hour(newTime.hour()).minute(newTime.minute())
|
|
61
|
-
);
|
|
55
|
+
onChange: (newDate) => {
|
|
56
|
+
if (!newDate) return;
|
|
57
|
+
setDateTime(newDate);
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
)
|
|
@@ -121,7 +121,6 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
121
121
|
element.style.left = `${coords.left}px`;
|
|
122
122
|
element.style.opacity = "1";
|
|
123
123
|
element.style.zIndex = "10";
|
|
124
|
-
console.log("OPEN", target, index);
|
|
125
124
|
};
|
|
126
125
|
const removeInside = (index) => {
|
|
127
126
|
insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
|
|
@@ -87,7 +87,6 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
87
87
|
element.style.left = `${coords.left}px`;
|
|
88
88
|
element.style.opacity = "1";
|
|
89
89
|
element.style.zIndex = "10";
|
|
90
|
-
console.log("OPEN", target, index);
|
|
91
90
|
};
|
|
92
91
|
const removeInside = (index) => {
|
|
93
92
|
insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
|