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

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) => 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) => 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
@@ -1042,51 +1042,29 @@ var DateFilterTemplate = (options, mask) => {
1042
1042
  }
1043
1043
  );
1044
1044
  };
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
- };
1045
+ var DateTimeFilterTemplate = (options) => {
1046
+ const value = typeof options.value === "string" ? (0, import_moment2.default)(options.value, "YYYY-MM-DDTHH:mm:ss.SSS").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,
1051
+ onChange: (e) => {
1052
+ if (!e.value) {
1053
+ options.filterCallback(null, options.index);
1054
+ return;
1055
+ }
1056
+ const formatted = (0, import_moment2.default)(e.value).format(
1057
+ "YYYY-MM-DDTHH:mm:ss.SSS"
1058
+ );
1059
+ options.filterCallback(formatted, options.index);
1060
+ },
1083
1061
  showTime: true,
1084
1062
  showSeconds: true,
1085
1063
  hourFormat: "24",
1064
+ placeholder: "dd/mm/yyyy 00:00:00",
1086
1065
  dateFormat: "dd/mm/yy",
1087
- placeholder: "dd/mm/yyyy 00:00:00.000",
1088
- inputClassName: "custom-input",
1089
- mask: "99/99/9999 99:99:99.999"
1066
+ readOnlyInput: true,
1067
+ inputClassName: "custom-input"
1090
1068
  }
1091
1069
  );
1092
1070
  };
package/dist/index.mjs CHANGED
@@ -991,51 +991,29 @@ var DateFilterTemplate = (options, mask) => {
991
991
  }
992
992
  );
993
993
  };
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
- };
994
+ var DateTimeFilterTemplate = (options) => {
995
+ const value = typeof options.value === "string" ? moment2(options.value, "YYYY-MM-DDTHH:mm:ss.SSS").toDate() : options.value ?? null;
1027
996
  return /* @__PURE__ */ jsx11(
1028
997
  Calendar,
1029
998
  {
1030
- value: parsedValue,
1031
- onChange: handleChange,
999
+ value,
1000
+ onChange: (e) => {
1001
+ if (!e.value) {
1002
+ options.filterCallback(null, options.index);
1003
+ return;
1004
+ }
1005
+ const formatted = moment2(e.value).format(
1006
+ "YYYY-MM-DDTHH:mm:ss.SSS"
1007
+ );
1008
+ options.filterCallback(formatted, options.index);
1009
+ },
1032
1010
  showTime: true,
1033
1011
  showSeconds: true,
1034
1012
  hourFormat: "24",
1013
+ placeholder: "dd/mm/yyyy 00:00:00",
1035
1014
  dateFormat: "dd/mm/yy",
1036
- placeholder: "dd/mm/yyyy 00:00:00.000",
1037
- inputClassName: "custom-input",
1038
- mask: "99/99/9999 99:99:99.999"
1015
+ readOnlyInput: true,
1016
+ inputClassName: "custom-input"
1039
1017
  }
1040
1018
  );
1041
1019
  };
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.41",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",