@charlesgomes/leafcode-shared-lib-react 1.0.40 → 1.0.42

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/index.d.mts CHANGED
@@ -94,7 +94,7 @@ interface IItemProps {
94
94
  }
95
95
 
96
96
  declare const DateFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
97
- declare const DateTimeFilterTemplate: (options: any, mask?: (value: Date) => string | number) => react_jsx_runtime.JSX.Element;
97
+ declare const DateTimeFilterTemplate: (options: any, mask?: (date: Date) => string) => react_jsx_runtime.JSX.Element;
98
98
  declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
99
99
  declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
100
100
  declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -94,7 +94,7 @@ interface IItemProps {
94
94
  }
95
95
 
96
96
  declare const DateFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
97
- declare const DateTimeFilterTemplate: (options: any, mask?: (value: Date) => string | number) => react_jsx_runtime.JSX.Element;
97
+ declare const DateTimeFilterTemplate: (options: any, mask?: (date: Date) => string) => react_jsx_runtime.JSX.Element;
98
98
  declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
99
99
  declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
100
100
  declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -1043,50 +1043,27 @@ var DateFilterTemplate = (options, mask) => {
1043
1043
  );
1044
1044
  };
1045
1045
  var DateTimeFilterTemplate = (options, mask) => {
1046
- const parsedValue = (() => {
1047
- if (!options.value) {
1048
- return (0, import_moment2.default)().set({
1049
- hour: 0,
1050
- minute: 0,
1051
- second: 0,
1052
- millisecond: 0
1053
- }).toDate();
1054
- }
1055
- if (typeof options.value === "string") {
1056
- return (0, import_moment2.default)(options.value, [
1057
- "YYYY-MM-DD",
1058
- "YYYY-MM-DDTHH:mm:ss.SSS"
1059
- ]).toDate();
1060
- }
1061
- return options.value;
1062
- })();
1063
- const handleChange = (e) => {
1064
- if (!e.value) {
1065
- options.filterCallback(null, options.index);
1066
- return;
1067
- }
1068
- const date = e.value;
1069
- const normalizedDate = (0, import_moment2.default)(date).set({
1070
- hour: 0,
1071
- minute: 0,
1072
- second: 0,
1073
- millisecond: 0
1074
- }).toDate();
1075
- const valueToFilter = mask ? mask(normalizedDate) : (0, import_moment2.default)(normalizedDate).format("YYYY-MM-DDTHH:mm:ss.SSS");
1076
- options.filterCallback(valueToFilter, options.index);
1077
- };
1046
+ const value = typeof options.value === "string" ? (0, import_moment2.default)(options.value).toDate() : options.value ?? null;
1078
1047
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1079
1048
  import_calendar.Calendar,
1080
1049
  {
1081
- value: parsedValue,
1082
- onChange: handleChange,
1050
+ value,
1083
1051
  showTime: true,
1084
1052
  showSeconds: true,
1085
1053
  hourFormat: "24",
1086
1054
  dateFormat: "dd/mm/yy",
1087
- placeholder: "dd/mm/yyyy 00:00:00.000",
1055
+ placeholder: "dd/mm/yyyy 00:00:00",
1056
+ readOnlyInput: true,
1088
1057
  inputClassName: "custom-input",
1089
- mask: "99/99/9999 99:99:99.999"
1058
+ onChange: (e) => {
1059
+ const selectedDate = e.value;
1060
+ if (!selectedDate) {
1061
+ options.filterCallback(null, options.index);
1062
+ return;
1063
+ }
1064
+ const formatted = mask ? mask(selectedDate) : (0, import_moment2.default)(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
1065
+ options.filterCallback(formatted, options.index);
1066
+ }
1090
1067
  }
1091
1068
  );
1092
1069
  };
package/dist/index.mjs CHANGED
@@ -992,50 +992,27 @@ var DateFilterTemplate = (options, mask) => {
992
992
  );
993
993
  };
994
994
  var DateTimeFilterTemplate = (options, mask) => {
995
- const parsedValue = (() => {
996
- if (!options.value) {
997
- return moment2().set({
998
- hour: 0,
999
- minute: 0,
1000
- second: 0,
1001
- millisecond: 0
1002
- }).toDate();
1003
- }
1004
- if (typeof options.value === "string") {
1005
- return moment2(options.value, [
1006
- "YYYY-MM-DD",
1007
- "YYYY-MM-DDTHH:mm:ss.SSS"
1008
- ]).toDate();
1009
- }
1010
- return options.value;
1011
- })();
1012
- const handleChange = (e) => {
1013
- if (!e.value) {
1014
- options.filterCallback(null, options.index);
1015
- return;
1016
- }
1017
- const date = e.value;
1018
- const normalizedDate = moment2(date).set({
1019
- hour: 0,
1020
- minute: 0,
1021
- second: 0,
1022
- millisecond: 0
1023
- }).toDate();
1024
- const valueToFilter = mask ? mask(normalizedDate) : moment2(normalizedDate).format("YYYY-MM-DDTHH:mm:ss.SSS");
1025
- options.filterCallback(valueToFilter, options.index);
1026
- };
995
+ const value = typeof options.value === "string" ? moment2(options.value).toDate() : options.value ?? null;
1027
996
  return /* @__PURE__ */ jsx11(
1028
997
  Calendar,
1029
998
  {
1030
- value: parsedValue,
1031
- onChange: handleChange,
999
+ value,
1032
1000
  showTime: true,
1033
1001
  showSeconds: true,
1034
1002
  hourFormat: "24",
1035
1003
  dateFormat: "dd/mm/yy",
1036
- placeholder: "dd/mm/yyyy 00:00:00.000",
1004
+ placeholder: "dd/mm/yyyy 00:00:00",
1005
+ readOnlyInput: true,
1037
1006
  inputClassName: "custom-input",
1038
- mask: "99/99/9999 99:99:99.999"
1007
+ onChange: (e) => {
1008
+ const selectedDate = e.value;
1009
+ if (!selectedDate) {
1010
+ options.filterCallback(null, options.index);
1011
+ return;
1012
+ }
1013
+ const formatted = mask ? mask(selectedDate) : moment2(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
1014
+ options.filterCallback(formatted, options.index);
1015
+ }
1039
1016
  }
1040
1017
  );
1041
1018
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",